Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake compilation system #71

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

CMake compilation system #71

wants to merge 12 commits into from

Conversation

SimBe195
Copy link
Collaborator

This PR adds a CMake compilation system as an alternative to the Makefile-based compilation for RASR. The old compilation system is untouched so the changes here are fully backwards compatible. The new CMake compilation, however, has several advantages:

  • CMakeLists are generally easier to read and understand (and thus to extend) compared to Makefiles.
  • The project is much more straightforward to parse with IDEs such as CLion.
  • Builds are out-of-source.
  • Compilation is faster when compiling from scratch (tested ~5:00 minutes for make -j 10 && make install vs. ~3:30 minutes for mkdir .build && cd .build && cmake ../ && make -j 10 && make install).
  • Locations of certain dependencies are detected automatically instead of having to be specified via an absolute path somewhere in one of the Makefiles (e.g. Python, Tensorflow etc.)
  • In the Makefile system when triggering recompilation everything gets re-linked even if no changes were made in the code due to some weird dependency workaround with phony targets that is described in Rules.make. The CMake system makes the dependency mechanism much simpler and such re-linking is not required.

The mechanism of enabling/disabling modules works a bit different (and less hacky) now compared to the Makefile way: Previously, a Modules.hh file was generated containing a bunch of #define MODULE_... statements and included all over the code base to check whether certain modules are enabled or not. In the CMake system the modules are just added directly as compile definitions and this Modules.hh generation and including is not needed anymore. To keep the old include logic intact, a CMAKE_DISABLE_MODULES_HH compile definition is added and the includes of Modules.hh in the code base are wrapped using

#ifndef CMAKE_DISABLE_MODULES_HH
#include <Modules.hh>
#endif

I have personally been using such a CMake compiled RASR for a few months now for several tasks and it has been working well but of course issues might still come up in the future for different use cases or on different machines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant