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

Modernize cmake #53

Merged

Conversation

mattangus
Copy link

This PR moves to a more modern target based CMake usage. This avoids setting properties globally for potential consumers of this project.

@mattangus mattangus mentioned this pull request Oct 18, 2024
@mattangus
Copy link
Author

Additionally, we planned to revisit default compile flags for v0.4.0 release at #48 (e.g., -DNDEBUG, -O3 instead of -O2, etc.), but this will be done at the end after it is feature complete (there are some API changes + new functionalities are still in testing, especially curve offsets and polyline fitting)

To respond to your other comment. CMake already has some optimization levels by default. E.g. running a clean build:

$ cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
...
$ cmake --build build
...
[ 25%] Building CXX object CMakeFiles/bezier.dir/src/utils.cpp.o
/usr/bin/c++  -I/path/to/Bezier/include -isystem /usr/include/eigen3 -O3 -DNDEBUG -std=c++17 -fPIC -MD -MT CMakeFiles/bezier.dir/src/utils.cpp.o -MF CMakeFiles/bezier.dir/src/utils.cpp.o.d -o CMakeFiles/bezier.dir/src/utils.cpp.o -c /path/to/Bezier/src/utils.cpp
..

Note the -O3. Similarly, setting -DCMAKE_BUILD_TYPE=Debug the -g flag will be used by default. I'm happy to include the custom optimization level in my PR. But I would set them via CMAKE_CXX_FLAGS_DEBUG and CMAKE_CXX_FLAGS_RELEASE.

CMakeLists.txt Outdated Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
@mattangus mattangus requested a review from stribor14 October 22, 2024 15:45
@stribor14 stribor14 merged commit 7bfa742 into romb-technologies:devel-v040 Oct 23, 2024
1 check passed
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.

2 participants