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
Support multiple build systems such as pure make, catkin, ament, etc #109
base: master
Are you sure you want to change the base?
Changes from 1 commit
f8fdd06
3cc0712
89d1da7
c9414bb
0b57425
641f177
3177e0f
4bbfee9
be08549
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,22 +11,18 @@ find_package(catkin REQUIRED) | |
find_package(Eigen3 REQUIRED) | ||
find_package(Boost REQUIRED COMPONENTS python) | ||
|
||
find_package(OpenMP REQUIRED) | ||
if (OpenMP_FOUND) | ||
add_compile_options("${OpenMP_CXX_FLAGS}") | ||
add_definitions(-DHAVE_OPENMP=${OpenMP_FOUND}) | ||
find_package(OpenMP) | ||
if (NOT OpenMP_FOUND) | ||
message("OpenMP was not found. It is highly recommended to build libnabo with OpenMP support.") | ||
endif() | ||
|
||
# Catkin package macro | ||
catkin_package( | ||
INCLUDE_DIRS | ||
nabo | ||
${CMAKE_SOURCE_DIR} | ||
YoshuaNava marked this conversation as resolved.
Show resolved
Hide resolved
|
||
${EIGEN3_INCLUDE_DIR} | ||
LIBRARIES | ||
nabo | ||
DEPENDS | ||
Boost | ||
) | ||
|
||
######################## | ||
|
@@ -37,22 +33,29 @@ add_library(nabo | |
${NABO_SRC} | ||
${NABO_HEADERS} | ||
) | ||
|
||
target_include_directories(nabo | ||
PUBLIC | ||
${CMAKE_SOURCE_DIR} | ||
${CMAKE_SOURCE_DIR}/nabo | ||
SYSTEM | ||
${EIGEN3_INCLUDE_DIR} | ||
${Boost_INCLUDE_DIRS} | ||
${OpenMP_CXX_INCLUDE_DIRS} | ||
target_include_directories(nabo PUBLIC | ||
${CMAKE_SOURCE_DIR} | ||
${CMAKE_SOURCE_DIR}/nabo | ||
) | ||
|
||
target_link_libraries(nabo | ||
target_include_directories(nabo SYSTEM PRIVATE | ||
${EIGEN3_INCLUDE_DIR} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Eigen is a public dependency (it's in nabo.h). Move it above and add |
||
${Boost_INCLUDE_DIRS} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Boost isn't used in the core library, just for the python bindings. So remove it from here. |
||
${OpenMP_CXX_INCLUDE_DIRS} | ||
) | ||
target_link_libraries(nabo PRIVATE | ||
${catkin_LIBRARIES} | ||
${Boost_LIBRARIES} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And, remove it from here, too. |
||
${OpenMP_CXX_LIBRARIES} | ||
) | ||
target_compile_options(nabo PRIVATE | ||
"${OpenMP_CXX_FLAGS}" | ||
) | ||
target_compile_definitions(nabo PRIVATE | ||
-DHAVE_OPENMP=${OpenMP_FOUND} | ||
) | ||
|
||
# Python bindings | ||
add_subdirectory(python) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Respect LIBNABO_BUILD_PYTHON setting. |
||
|
||
############# | ||
## Install ## | ||
|
@@ -69,4 +72,7 @@ install( | |
DIRECTORY | ||
${CMAKE_SOURCE_DIR}/nabo/ | ||
DESTINATION ${CATKIN_GLOBAL_INCLUDE_DESTINATION}/nabo | ||
YoshuaNava marked this conversation as resolved.
Show resolved
Hide resolved
|
||
FILES_MATCHING | ||
PATTERN "*.h" | ||
PATTERN "*.hpp" | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,10 +16,7 @@ | |
|
||
<build_depend>boost</build_depend> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If python bindings are not built, then remove it. |
||
<build_depend>eigen</build_depend> | ||
<build_depend>libopenmp-dev</build_depend> | ||
|
||
<run_depend>boost</run_depend> | ||
<run_depend>eigen</run_depend> | ||
<build_depend>libomp-dev</build_depend> | ||
|
||
<!-- For a pure-cmake build the package must be exported explicitly --> | ||
<!-- Thus the following block of code must be un-commented --> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only when Python bindings are built?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I can add the Python bindings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, but isn't this find_package anyways done inside python/CMakeLists.txt? It might be superfluous here...