Generating redistributable Visual Studio project with cmake - visual-studio

is it possible to generate Visual Studio projects that are redistributable with CMake?
The project file in question are examples/demos of our library. We don't want that our customers have to install cmake (and learn what to do with it) just to compile a few examples.
The problem with CMake generated project files is that they contain absolute paths (relativeliy easy to fix with string replacement) and references to CMake files (e.g. in prelin step. This is not easy to automatically change).
Does CMake provide an easy way to solve this problem?
Thank in advance

Yes,
you can have a cMake project, and generate Visual project on windows, XCode or makefile for other plateforms.
You use it for development, and after use install package makers like iceberg on mac, or scripts based installers on linux, or other installer creator on PC.(inno setup I think could be a solution)
Good luck

Related

Compiling a static program in Visual Studio (VCPKG / CMAKE)

I am trying to create static program in Visual Studio, where I end up with a single executable that I can deploy to other PCs.
I am using VCPKG to static download libraries, as per the instructions here:
https://devblogs.microsoft.com/cppblog/vcpkg-updates-static-linking-is-now-available/
In the following post, the answer to the question is to use VCPKG and then CMAKE
Using Cmake to build ssh.dll with Visual Studio 2017
My question is with regards Cmake. If VCPKG downloads and creates folders that my project links to. What's Cmake for and why would I need to use it?
What's Cmake for and why would I need to use it?
https://cmake.org/ read the text below the logo.
It can be used to generate a project files for different build system, like make, msbuild, ninja etc.
It also can be used as a general scripting language.
You don't need to use it but it is highly encouraged for consuming other dependencies.
vcpkg however will download cmake since it is used as a scripting language within vcpkg.

What is the benefit of building with CMake?

I am working on SFML and I am curious about the option that I can compile it myself. I found it in tutorials, but from the first line I became confused:
CMake is an open-source meta build system. Instead of building SFML, it builds what builds SFML: Visual Studio solutions ...
There is a build option in visual studio too, is there any difference between that build and CMake build?
What does it mean that it builds what builds SFML? It means library files?
Visual studio solutions? What does it mean? As far as i know, when i open a new project it is within a solution and i can add new projects to this solution (I am confused about why there must be more than one project in a solution too!).
What does it mean that CMake builds a solution? And what is it for?
There is sourcecode. People want to compile it. It is difficult and annoying to type the compile commands into a terminal.
People invent build systems, to make 1.) more easy. For example make files or what Visual Studio integrates and stores in its files, called solution.
There are projects, that are cross-platform. They could provide make files, solution files, files for Xcode, Eclipse and so on. This becomes difficult and annoying.
People invent systems, that creates build system to ease 3.). From a common set of files, several different build systems can be steered.
In your actual case: CMake creates the solution file, you can open the solution file and built SFML with that.
CMake is a wonderful tool for cross-platform development without the hassle of maintaining separate build utilities. On Windows, CMake can create a Visual Studio solution file based on its CMakeLists.txt file. On Linux, generally CMake outputs a makefile. CMake is compatible with many build tools, I recommend reading more of there documentation on their website to gain more information.
Edit: Just to be more clear. CMake literally builds what builds SFML since it creates the Visual Studio solution used to build SFML.
A build in VS for a solution is building the library itself. A CMake build generates the VS solution with which you would use to build the library.
See 1.
A VS solution is the full buildable setup containing 1 or more projects. Solutions can contain multiple projects since VS has a limitation on only 1 output per project. If you want multiple outputs (e.g. 4 dlls) each output needs it's own project.

Compiling the opus-codec API library

First, going to be honest. I'm a c#/java-language-level dweller. So I have no idea about how to compile native-C projects such as opus.
I've tried doing it myself, and I've tried googling it. I simply need help compiling the opus-codec API (on Windows).
Once I have the library compiled, I'll build a wrapper for it's API.
While my searches have indeed found opus wrappers targeting my current project's language (c#), I can't find an up-to-date one. I don't know if it matters, but I need it for it's VoIP capabilities.
Sorry for my stupidity in the matter.
[UPDATE]
After compiling with Visual Studio 2010: Ultimate, I have a .lib library file. I need a .dll. I don't know what I'm doing. Help?
In a C project there is going to be some way to drive a build of all the object files, libraries, etc. Basically the same thing as maven build in Java, just with different tools. You will have to have the right tools if you don't.
On unix systems it's usually Makefile driven, running command line programs that compile and link the program or library that is being built. In GUI environments like XCode or Visual Studio, there are ways to run the build directly from the UI.
Looking at the source tree, there's a directory with a number of Visual Studio 2010 projects in it - https://git.xiph.org/?p=opus.git;a=tree;f=win32/VS2010
If you're using Visual Studio, loading that up and trying a build to see if it still works is where I'd start. Or perhaps have a look at Any way to do Visual Studio "project only" build from command line? or other questions that reference msbuild.

MakeFile to Visual Studio project

Currently i am using makefile to build the project but i want to convert it into visual studio 2010 project? After some research i can not find a single tutorial or guide to do this. Can any one help me by pointing to any of the relevant resource or step by step guide for it.
P.S: I have only elementary knowledge of makefile
I'd suggest to use CMake for creating VS projects. You just define your project structure, i.e. sources, headers, resources and CMake creates appropriate project/solution files for your target IDE: makefiles, Visual Studio etc.
After installation CMake provides a GUI, where you can choose your target IDE.
I know, this is not a direct answer to your question, but it is a way to make your projects more portable.

Build Visual Studio Projects from Jamfiles?

Anyone know of a way to create Visual Studio Projects from a build based on Jamfiles?
I'd settle for a jamfile -> XML-or-some-other-intermediate-format exporter tool, so I could write my own.
This jam distribution has a tool that does that:
http://redmine.jamplex.org/
See here:
http://redmine.jamplex.org/git/jamplus/docs/html/jamtoworkspace.html
Haven't used any of it myself yet, so I'm afraid I can't say anything about how well it works.
You might also consider CMake. CMake files are about as easy to write as Jamfiles, and CMake can generate projects for Visual Studio, Xcode, and Unix Makefiles automatically. I used to use Jam for all my Linux projects, but once I discovered CMake, I haven't gone back.
JamPlus has a built-in workspace generator that reads a project's Jamfiles and exports an IDE workspace.
http://jamplus.org/git/jamplus/docs/html/jamtoworkspace.html

Resources