Skip to content

Modernize cmake#53

Merged
stribor14 merged 1 commit intoromb-technologies:devel-v040from
HumanisingAutonomy:devel-v040
Oct 23, 2024
Merged

Modernize cmake#53
stribor14 merged 1 commit intoromb-technologies:devel-v040from
HumanisingAutonomy:devel-v040

Conversation

@mattangus
Copy link
Copy Markdown

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
Copy Markdown
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.

@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
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