Bullet Physics, CMake fails to build project - c++

I'm trying to use CMake to build the Bullet Physics 3 source code for Visual Studio 2012.
I've tried using the CMake GUI to build the projects and the command line version. Each time I get a set of vcxproj and sln files:
project.sln
ZERO_CHECK.vcxproj
ALL_BUILD.vcxproj
BulletCollision.vcxproj
BulletDynamics.vcxproj
BulletSoftBody.vcxproj
LinearMath.vcxproj
This is not what I expected. The documentation here: says there should be BULLET_PHYSICS.sln that does not appear.
Furthermore when I try to import the projects into Visual Studio and do a build all of the #include lines fail. They're trying to find the files originally referenced in the Bullet Physics source directory and failing rather than looking the the current Visual Studio project folder where I've put the CMake built output. I tried manually editing all the project and solution files which contained many occurrences of the original source path and not my new build directory but this made no difference.
Why is CMake failing to build Bullet Physics properly?

Related

Visual Studio puts new files into wrong directory

I use cmake and Visual Studio and have the following directory structure:
workspace
CMakeLists.txt
project1
src
project2
src
build
The idea behind this is an out-of-source build, so that the generated build files by cmake do not spoil my src folders. This is also described here as top answer: Looking for a 'cmake clean' command to clear up cmake output
However, if I generate the visual studio project being in the build directory using the CMakeLists.txt in the workspace directory like so:
cmake ..
, then everything will be created fine but when I open my visual studio solution and add a file to any of the projects, it will be added into the build folder of the corresponding project...
Of course, this is incorrect. It should put the file in the corresponding directory of the src path. Also, it should show the directory structure. So, if I have:
workspace
project1
src
package1
module1.cpp
module2.cpp
package2
module3.cpp
module4.cpp
, then naturally my visual studio project should show both the package folders. I realize that visual studio's filters do not offer this functionality. But when I hit "Show all files", it usually switches to a view where I can see usual file system directories, which is exactly what I want - only that it should have its root in the corresponding src folder and not in the build path.
Can I arrange this somehow?
Your quandry is that you want to generate a build-file set, with CMake, that is displaced from
the source tree and then in the generated build-file set run an IDE project
that is not displaced from the source tree. You can't have it both ways.
The CMake build directory, whether in-source or out-of-source, is the
directory in which CMake will generate build files for your project,
for some target build system. These artifacts are of service to the end-user who
wants to build your project from packaged source. You need to distinguish the target
build system from your development environment. Your development environment
is a personal productivity choice that has no essential link with the target build system.
It is just co-incidence that your target build system is Visual Studio and so
is your development environment. Imagine instead that your development environment is, say, Code::Blocks,
and your target build system is GNU Make, with CMake employed to generate the GNU Make build files.
In that case you have a Code::Blocks .cbp project file that defines
your development project, and a CMakeLists.txt file that defines a distributable
GNU Make build.
The CMake project and the Code::Blocks project have no connection with each other
except the connections you choose to make in terms of common tools, files and targets.
You might have more files and/or targets in your development project than you
ever choose to reflect in the CMakeLists.txt. The target toolchain could be different
from the development toolchain. As far as the CMake project is concerned it doesn't matter
at all where the Code::Blocks .cbp file resides or if such a thing exists, although you will
want the .cbp file as well as the CMakeLists.txt to be under source control in your development branch.
When you run CMake and create build files, you come under no compulsion to stop using
your CodeBlocks project, in situ, as your development environment and somehow
migrate the development environment into the build-files folder. Even
if you instructed CMake to generate a Code::Blocks .cbp file in the build-files,
so that end-users of the package can build it with Code::Blocks, you wouldn't then be tempted to
start using that project file as for your development environment: it's a throw-away artifact of running CMake.
If you want to develop the project with Visual Studio then make a VS project for your development purposes in a normal relationship to
the source tree. Make a CMake project for distribution of the project on your target build system. Forget the incidental
fact that the target build-system is also Visual Studio. Keep the files and targets of your CMake project aligned with
those of your development project to the extent that the CMake project is up to date
whenever you build it. And ensure, of course, that the gating tests you run, for commit, release or whatever, are all run on the CMake build.
If you are not interested in distributing your project and are using CMake merely for
the purpose of generating a Visual Studio project in which to develop it - well that
would be a gratuitously laborious alternative to just developing it in Visual Studio -
but if it's what you want to do you will have to be clear that CMake and Visual Studio cannot both control
the composition of the project. CMake controls it and the VS project is just a CMake artifact. If you want to
add files to the project or change it in any other way then you must do it CMakeLists.txt, then rerun CMake and accept the
VS project that drops out - even if you don't quite like the look of it.

How to set up [ ZeroMQ ] for use in a Visual Studio 2015 Enterprise?

While my primary domain of expertise is not Visual Studio 2015 setup / project configuration, I have experienced troubles on loading / configuring ZeroMQ project.
How to proceed correctly on loading a ZeroMQ Project?
Observed errors:
current build on github and even old "stable" versions cause cmake errors
ZeroMQ Installer does not support Visual Studio v14
Instructions would be awesome, as it seems that there is no other source of documentation for this situation on the internet.
Had the same problem a while ago. Here is what I did to solve this:
Download the right ZMQ version
The "download link" provided on the ZMQ website seems outdated.
To really get the current version you would have to use Git:
git clone https://github.com/zeromq/libzmq.git
Build with Visual Studio 2015
The repository comes with a pre-build Visual Studio project. You can find it in ...\libzmq\builds\msvc. To build for Visual Studio 2015 cd into vs2015 and open libzmq.sln.
You can choose if you want to compile static or dynamic libraries: DynRelease or StaticRelease for either Win32 or x64.
After that, run Build > Build solution to compile everything.
Setup project to use compiled libraries
After you created your project, go to the project's properties:
C++ > General > Additional Include Directories should point to the include path of the repository. If you want to use C++ style some additional files have to be placed in this directory. Alternatively you can take a look at https://github.com/zeromq/zmqpp.
Linker > General > Additional Library Directories should point to the built libraries. They should be located at ...\libzmq\bin\x64\Release\v140\dynamic\.
Linker > Input > Additional Dependencies should contain the name of the library you want to use. The default should be libzmq.lib, otherwise you will find the name in the bin directory.
The program depends on the libzmq.dll file you just built. This file has to be placed within your project's build directory. To achieve this, you can add the following command to Build Events > Post-Build Event > Command Line:
copy /Y "...\libzmq\bin\x64\Release\v140\dynamic\libzmq.dll" "$(OutDir)"
This will copy the .dll file to the destination directory on every build if it's missing.
Hope this helps =)

MsBuild can't find lib

I am using the following script to build a C++ project:
msbuild D:\proj.vcxproj /p:Configuration="Release" /p:Platform="x64" /p:BuildProjectReferences=false /p:AssemblySearchPaths="D:\Import\GenericAIC\Include" /p:AdditionalLibPaths="D:\Export\Release"
I am getting an error that it can't find a certain lib. that lib is present in the D:\Export\Release folder which is set as p:AdditionalLibPaths
The project compiles perfectly in Visual studio.
Any thoughts?
Since you are building a project and not a solution,
you don't have the $SolutionDir, and MSBuild cant interpert all the macros in the project file.
you just need to add /Property:SolutionDir="" and everything will compile.

QT yaml-cpp Windows

i am new on programming in windows and in QT.
I started a QT project and want include yaml-cpp 0.30
Now i have different problems. First i wanted to build the lib with cmake and Visualstudio but i am not sure if i did this right.
I start Cmake and build with VS2010 compiler. Then i load the file
build\CMakeFiles\2.8.11.2\CompilerIdCXX\CompilerCXX.vcxproj in VS 2010 but i cant build this or dont know how.
And how i integrate this build lib inside QTCreator?
Or i have the possibility to build all inside QTCREATOR?
thanks for your help
CMake will build a Visual Studio solution (a .sln file); you don't need to go into the CMakeFiles directory to find it. There should be a solution file in the top build directory.

Build C++ Projects with Makefile using Visual Studio 2008

I downloaded cpptest from internet, and I want to build it using Visual Studio 2008.
The problem is that instead of .sln and vcproj file, Makefile.am is distributed, and I believe that all the all the necessary included file is included in the Makefile.am.
How to use Makefile.am to generate VS project files? I tried to use Cmake, but there is no CMakeList in the distribution.
Edit: Thanks to all the answers! There is a sln file distributed after all. But I am still interested to know the answer to my original question.
the visual studio project files for cpptest are in the win directory, not in the src directory where the makefile is..
edit
makefiles are meant to be used with GNU make. If you want that on windows, you can look at Mingw, GnuWin32 or Cygwin. But they also require gcc for compiling, so you won't really be using VS.
However, for most projects that do not have external dependencies it's no big deal if you do not have the VS project file: after all a makefile is just a list of the source files and some compilation options. To successfully build projects like cpptest, you could just create an emtpy VS project, add all source files to it, set output type to executable, build it and you're done. Eventually you can tune optimization options, but for the rest the default options will just do fine.
Go to win\VisualStudio.NET and you will find a VS solution file.
I just downloaded the archive and found the .sln file. It is under: /win/VisualStudio.NET. You can open that with VS2008 and update it, it should work.