Wolf macro cmake conftime
This pr add a config.h file (template at src/internal/config.h.in
) which is set at cmake configure time - before building.
This allows to define/set pre-processing macro before compilation.
A simple example is also available here.
For instance it allows enabling / disabling _WOLF_DEBUG
token.
Merge request reports
Activity
@jsola The 'logging' macro added here are rather simple/naive tools while waiting for a proper logging solution.
As mentioned in the PR the main interesting one isWOLF_DEBUG
that will print only is compiled in debug.
That will be neat for yourconstructed H constructed T constructed M
Added 2 commits:
- 2fe8745d - add cmake option for building examples
- 248e6694 - add _WOLF_ROOT_DIR that points to wolf root directory
@jsola I just added
_WOLF_ROOT_DIR
that point to the wolf root directory.
Hopefully no more messing around withWOLF_ROOT
environment variable.Added 2 commits:
- 48a0024e - fix _WOLF_ROOT_DIR
- bc427908 - add test_wolf_root
I have a compile error:
[ 85%] Building CXX object src/examples/CMakeFiles/test_sort_keyframes.dir/test_sort_keyframes.cpp.o In file included from /Users/jsola/dev/wolf/src/examples/test_processor_imu.cpp:16: /Users/jsola/dev/wolf/src/./logging.h:22:37: error: no member named '_V2' in namespace 'std::__1::chrono' using wolf_clock_t = std::chrono::_V2::high_resolution_clock; ~~~~~~~~~~~~~^
Usually, we execute from eclipse, which also allows debugging with the IDE. The env variables in IDEs are tricky. I got it to load env variables by re-defininig them within my eclipse configuration. This means that macro variables defined in the CMakeLists.txt are not visible from the IDE. This issue was pursued for a while, until I got it working with env-like variables.
Well, I tried your solution and it works, even if launching from eclipse! I am surprised. What else is there apart from the line
set(_WOLF_ROOT_DIR ${CMAKE_SOURCE_DIR})
?Edited by Joan Solà OrtegaWell, the short answer is cmake configure_file function (link).
This function allows to configure (write) a file during cmake configuration time and so before building. The file in question is src/internal/config.h.in where the macro is defined.
By including the configured version of thisconfig.h
file we can have such_WOLF_ROOT_DIR
macro or_WOLF_DEBUG
and so on.* 432fa70 - (8 minutes ago) Merge branch 'wolf_macro_cmake_conftime' of ssh://gitlab.iri.upc.edu:2202/mobile_robotics/wolf into wolf_macro_cmake_conftime - Joan Solà (HEAD -> wolf_macro_cmake_conftime) |\ | * f614d59 - (29 minutes ago) add test_wolf_root - Jeremie Deray (origin/wolf_macro_cmake_conftime) | * 3de044c - (24 hours ago) add _WOLF_ROOT_DIR that points to wolf root directory - Jeremie Deray | * a7ad4c5 - (24 hours ago) add cmake option for building examples - Jeremie Deray | * 8331106 - (18 minutes ago) include config.h in wolf.h - Jeremie Deray * | bc42790 - (29 minutes ago) add test_wolf_root - Jeremie Deray * | 48a0024 - (29 minutes ago) fix _WOLF_ROOT_DIR - Jeremie Deray * | 248e669 - (24 hours ago) add _WOLF_ROOT_DIR that points to wolf root directory - Jeremie Deray * | 2fe8745 - (24 hours ago) add cmake option for building examples - Jeremie Deray * | fe6cbe4 - (24 hours ago) include config.h in wolf.h & few logging macro - Jeremie Deray |/ * ff2fb16 - (24 hours ago) add conf.h that is set at cmake conf time - Jeremie Deray
No it isn't normal. edit: actually it is. I broke the history.
short solution:
$ git checkout master $ git branch -D wolf_macro_cmake_conftime $ git fetch $ git checkout wolf_macro_cmake_conftime
Np see you later.
Edited by Jeremie Deray