I am in the process of using CMake to automate a build process on Windows. The first step of the build process involves using IBM Rhapsody to generate the code to be built.
I have found that Rhapsody can be run headless (i.e. from command line) with RhapsodyCL.exe. Before proceeding with CMake I had the following questions:
Is this use-case (auto-generated code) supported by CMake?
How do I call RhapsodyCL.exe as a required CMake pre-build step? What is the recommended way to do the code generation as a pre-build step?
Since all my code is being generated by Rhapsody, how should my CMakeLists.txt look?
I found an answer to my question at the following site:
Integrating a code generator with CMake
Related
In one of our projects we have used Gstreamer good plugins. I see that each element has a Makefile for building.
Now I wanted to upgrade rtpmanager code (https://github.com/GStreamer/gst-plugins-good/tree/master/gst/rtpmanager) inside Gstreamer. But, I see that there are no Makfiles anymore but 'meson.build' file.
Currently our project build does not support meson. So, is there a way to convert the latest rtpmanager code involving meson.build to traditional Makefile kind of build so that I can integrate its latest changes into my project.
Meson does not and never will generate makefiles.
Qemu meson PoC is using a tool to convert ninja files to Makefile:
https://github.com/bonzini/qemu/blob/meson-poc/scripts/ninjatool.py
The library mylib consists of the library proper, in directory lib/, and a test suite, in directory test/. It is completely under CMake control:
mylib/CMakeLists.txt:
...
add_subdirectory(lib)
add_subdirectory(test)
...
mylib/lib/CMakeLists.txt:
...
add_library(my_lib ${src_files})
...
mylib/test/CMakeLists.txt:
...
add_executable(mytest mytest.c)
target_link_libraries(mytest mylib)
Build steps are:
mkdir build
cd build
cmake ..
make
ctest # or make test
make install
Works under Linux, stable since many years. Under Windows10 though, a message window pops up, entitled "mytest.exe - System error": "The code execution cannot proceed because mylib.dll was not found. Reinstalling the program may fix this problem."
No, installing (rather than reinstalling) would not be a good solution: I need to first test the library before I install it (btw: this excludes most solutions proposed in response to somewhat similar questions).
Isn't CMake supposed to work cross-platform? What is the minimally invasive adjustment to make the above build steps work under Windows?
The right way of doing this on Windows is to populate the PATH environment variable for the test run:
set_tests_properties(your_test_name
PROPERTIES
ENVIRONMENT PATH="path-containing-your-dll")
I believe you can use generator expression if path-containing-your-dll is a function of an artifact that you generate in your build.
Cherry on top: since cmake 3.13, the variable VS_DEBUGGER_ENVIRONMENT can also be set on the target for having a nice debugging behaviour inside Visual Studio (eg. being able to debug the application directly from Visual instead of going through ctest).
This is the first time I am trying to build something from the source codes. I was trying to make a console program out of WebRTC native code.
I followed official guide and checked out the source code.
As the guide says,
To generate IDE project files, pass the --ide flag to the GN command. See the GN reference for more details on the supported IDEs.
I used this command to generate Xcode project:
$ gn gen out/Default --ide=xcode
But the Xcode project generated does not compile. Xcode kept telling me it could not find those files.
Is it because I did not do ninja -C out/Default? I am confused — am I supposed to still compile the whole source codes using ninja while I have generated an Xcode project using gn?
am I supposed to still compile the whole source codes using ninja while I have generated an Xcode project using gn? => yes
See https://dev.chromium.org/developers/how-tos/debugging-on-os-x/building-with-ninja-debugging-with-xcode for further details on building with Ninja and debugging with Xcode.
I have a Cmake project where I use static libraries from another project (which uses its own unique build system).
I have a bash script set up which compiles the libraries.
The problem arises when a new user checkouts both project. The new user cannot do cmake until the libaries are properly compiled in the other project, and the cmake command find_libarary cant find them.
I made the bash script part of cmake by using the command add_custom_target. But the issue is that it only execute if you do a "make".
Is there a way I can make CMake execute a command while its generating a build system. Or a better way would be to have it ignore the find command until the actual make?
Thanks
Why not LINK_DIRECTORIES(xxx) to the library folder and don't use find_library at all.
Sure, execute_process() function.
I am doing C development using Netbeans on OS X and my project fails to build, stating "...this installation of Open MPI was not compiled with Fortran 90 support"
I have installed a newer gcc and Open MPI (along side the default versions), and I can build using them via make on a command line. This leads me to believe that Netbeans is using the default Open MPI installation (which did not have fortran support). If I am correct, how do I get it to use the new installation? I told Netbeans about the other compilers via the Tool Collection Manager (File->Project Properties->Build->Tool Collection->[...]). However, I do not know of a way to tell it about Open MPI.
I have a working solution. This solution exists in two parts.
1) I reran configure on the command line for my project and specified full paths for MPICC and MPIFC. This solved the problem of getting Netbeans to use the right mpicc compiler. However, it created another issue: the mpif90 wrapper could not find gfortran.
2) I altered the 'GUI environment' PATH variable to put gfortran in my path using the /etc/launchd.conf method found here (http://stackoverflow.com/questions/135688/setting-environment-variables-in-os-x).
After a reboot, Netbeans compiles my project. So, I'm claiming success.