-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Switch to CMake (release builds are broken) * Fixed release builds * Install SDL2 first * Fix install and uninstall * Update INSTALL.md * Update INSTALL.md
- Loading branch information
Showing
8 changed files
with
206 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,4 @@ docs/ | |
_temp | ||
*.gz | ||
book/icp_descr | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
cmake_minimum_required(VERSION 3.10) | ||
project(cevicp CXX) | ||
|
||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
||
# Add compile options | ||
add_compile_options(-Wall -Wextra -pedantic) | ||
|
||
# Find dependencies | ||
find_package(Eigen3 REQUIRED) | ||
find_package(SDL2 REQUIRED) | ||
|
||
# Library target | ||
set(LIB_SOURCES | ||
lib/algo/kdtree.cpp | ||
lib/algo/quickselect.cpp | ||
lib/icp/icp.cpp | ||
lib/icp/driver.cpp | ||
lib/icp/geo.cpp | ||
lib/icp/impl/vanilla.cpp | ||
lib/icp/impl/trimmed.cpp | ||
lib/icp/impl/feature_aware.cpp | ||
) | ||
add_library(cevicp STATIC ${LIB_SOURCES}) | ||
target_include_directories(cevicp | ||
PUBLIC | ||
${CMAKE_CURRENT_SOURCE_DIR}/include | ||
${EIGEN3_INCLUDE_DIRS} | ||
) | ||
|
||
# Main executable | ||
set(MAIN_SOURCES | ||
src/main.cpp | ||
src/sim/lidar_view.cpp | ||
src/sim/view_config.cpp | ||
) | ||
add_executable(main ${MAIN_SOURCES}) | ||
target_link_libraries(main | ||
cevicp | ||
SDL2::SDL2 | ||
libcmdapp.a | ||
libsdlwrapper.a | ||
libconfig.a | ||
) | ||
target_include_directories(main | ||
PRIVATE | ||
${CMAKE_CURRENT_SOURCE_DIR}/include | ||
${EIGEN3_INCLUDE_DIRS} | ||
/usr/local/include/cmdapp | ||
/usr/local/include/config | ||
/usr/local/include/sdlwrapper | ||
) | ||
|
||
set(TEST_SOURCES tests/test.cpp) | ||
add_executable(test_suite ${TEST_SOURCES}) | ||
target_link_libraries(test_suite | ||
cevicp | ||
) | ||
target_include_directories(test_suite | ||
PRIVATE | ||
${CMAKE_CURRENT_SOURCE_DIR}/include | ||
/usr/local/include/simple_test | ||
) | ||
target_compile_definitions(test_suite PRIVATE TEST) | ||
|
||
# Debug/Release configuration | ||
if(CMAKE_BUILD_TYPE STREQUAL "Release") | ||
target_compile_definitions(cevicp PRIVATE RELEASE_BUILD) | ||
target_compile_options(cevicp PRIVATE -O3) | ||
else() | ||
target_compile_options(cevicp PRIVATE -g) | ||
endif() | ||
|
||
# Installation | ||
install(TARGETS cevicp | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
) | ||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ | ||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cev_icp | ||
FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp" | ||
) | ||
|
||
# Per https://gitlab.kitware.com/cmake/community/-/wikis/FAQ#can-i-do-make-uninstall-with-cmake | ||
# uninstall target | ||
if(NOT TARGET uninstall) | ||
configure_file( | ||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" | ||
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" | ||
IMMEDIATE @ONLY) | ||
|
||
add_custom_target(uninstall | ||
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Per https://gitlab.kitware.com/cmake/community/-/wikis/FAQ#can-i-do-make-uninstall-with-cmake | ||
if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") | ||
message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt") | ||
endif() | ||
|
||
file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files) | ||
string(REGEX REPLACE "\n" ";" files "${files}") | ||
foreach(file ${files}) | ||
message(STATUS "Uninstalling $ENV{DESTDIR}${file}") | ||
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") | ||
execute_process( | ||
COMMAND "@CMAKE_COMMAND@" -E remove "$ENV{DESTDIR}${file}" | ||
OUTPUT_VARIABLE rm_out | ||
RESULT_VARIABLE rm_retval | ||
) | ||
if(NOT "${rm_retval}" STREQUAL 0) | ||
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") | ||
endif() | ||
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") | ||
message(STATUS "File $ENV{DESTDIR}${file} does not exist.") | ||
endif() | ||
endforeach() |
Oops, something went wrong.