Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
laser_scan_utils
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
labrobotica
algorithms
laser_scan_utils
Commits
e755a92d
Commit
e755a92d
authored
3 years ago
by
Joan Vallvé Navarro
Browse files
Options
Downloads
Patches
Plain Diff
still debuging
parent
e90d308c
No related branches found
No related tags found
2 merge requests
!8
Cmake refactoring was merged to main, merge back to devel also
,
!7
Resolve "Adapt to core CMakeLists.txt refactor"
Pipeline
#10918
failed
3 years ago
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CMakeLists.txt
+54
-54
54 additions, 54 deletions
CMakeLists.txt
test/CMakeLists.txt
+1
-17
1 addition, 17 deletions
test/CMakeLists.txt
test/gtest/CMakeLists.txt
+9
-4
9 additions, 4 deletions
test/gtest/CMakeLists.txt
with
64 additions
and
75 deletions
CMakeLists.txt
+
54
−
54
View file @
e755a92d
...
...
@@ -4,13 +4,14 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.10)
# The project name and the type of project
PROJECT
(
laser_scan_utils
)
# Paths
SET
(
EXECUTABLE_OUTPUT_PATH
${
CMAKE_CURRENT_SOURCE_DIR
}
/bin
)
SET
(
LIBRARY_OUTPUT_PATH
${
CMAKE_CURRENT_SOURCE_DIR
}
/lib
)
set
(
INCLUDE_INSTALL_DIR include/iri-algorithms
)
set
(
LIB_INSTALL_DIR lib/
)
# Build type
IF
(
NOT CMAKE_BUILD_TYPE
)
#SET(CMAKE_BUILD_TYPE "DEBUG")
SET
(
CMAKE_BUILD_TYPE
"RELEASE"
)
ENDIF
(
NOT CMAKE_BUILD_TYPE
)
message
(
STATUS
"Configured to compile in
${
CMAKE_BUILD_TYPE
}
mode."
)
...
...
@@ -19,7 +20,34 @@ message(STATUS "Configured to compile in ${CMAKE_BUILD_TYPE} mode.")
SET
(
CMAKE_CXX_FLAGS_DEBUG
"-g -Wall -D_REENTRANT"
)
SET
(
CMAKE_CXX_FLAGS_RELEASE
"-O3 -D_REENTRANT"
)
#find dependencies
#Set compiler according C++11 support
include
(
CheckCXXCompilerFlag
)
CHECK_CXX_COMPILER_FLAG
(
"-std=c++11"
COMPILER_SUPPORTS_CXX11
)
if
(
COMPILER_SUPPORTS_CXX11
)
message
(
STATUS
"The compiler
${
CMAKE_CXX_COMPILER
}
has C++11 support."
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-std=c++11"
)
else
()
message
(
STATUS
"The compiler
${
CMAKE_CXX_COMPILER
}
has no C++11 support. Please use a different C++ compiler."
)
endif
()
# Options
IF
(
NOT BUILD_TESTS
)
OPTION
(
BUILD_TESTS
"Build Unit tests"
ON
)
ENDIF
(
NOT BUILD_TESTS
)
IF
(
NOT BUILD_DEMOS
)
OPTION
(
BUILD_DEMOS
"Build demos"
ON
)
ENDIF
(
NOT BUILD_DEMOS
)
if
(
BUILD_TESTS
)
# Enables testing for this directory and below.
# Note that ctest expects to find a test file in the build directory root.
# Therefore, this command should be in the source directory root.
#include(CTest) # according to http://public.kitware.com/pipermail/cmake/2012-June/050853.html
enable_testing
()
endif
()
# ============ DEPENDENCIES ============
FIND_PACKAGE
(
Eigen3 3.3 REQUIRED CONFIG
)
FIND_PACKAGE
(
falkolib QUIET
)
find_package
(
PkgConfig
)
...
...
@@ -28,37 +56,16 @@ link_directories(${csm_LIBRARY_DIRS})
message
(
csm_LIBRARY_DIRS:
${
csm_LIBRARY_DIRS
}
)
# keep only the files in a lib folder: by default the "." is in csm_LIBRARY_DIRS,
# which is not acceptable for target_link_directories
string
(
REPLACE
"./"
"/"
csm_LIBRARY_DIRS
${
csm_LIBRARY_DIRS
}
)
# SET(csm_LIBRARY_DIRS_LENGTH "0")
# list(LENGTH csm_LIBRARY_DIRS csm_LIBRARY_DIRS_LENGTH )
message
(
csm_LIBRARY_DIRS:
${
csm_LIBRARY_DIRS
}
)
# list(FILTER csm_LIBRARY_DIRS EXCLUDE REGEX ".")
# message(csm_LIBRARY_DIRS: ${csm_LIBRARY_DIRS})
foreach
(
my_entry IN LISTS csm_LIBRARY_DIRS
)
message
(
"csm_LIBRARY_DIRS has
${
my_entry
}
"
)
endforeach
()
list
(
FILTER csm_LIBRARY_DIRS INCLUDE REGEX
"lib"
)
foreach
(
my_entry IN LISTS csm_LIBRARY_DIRS
)
message
(
"csm_LIBRARY_DIRS has
${
my_entry
}
"
)
endforeach
()
#Build tests
IF
(
NOT BUILD_TESTS
)
OPTION
(
BUILD_TESTS
"Build Unit tests"
ON
)
ENDIF
(
NOT BUILD_TESTS
)
#Build demos
IF
(
NOT BUILD_DEMOS
)
OPTION
(
BUILD_DEMOS
"Build demos"
ON
)
ENDIF
(
NOT BUILD_DEMOS
)
#Set compiler according C++11 support
include
(
CheckCXXCompilerFlag
)
CHECK_CXX_COMPILER_FLAG
(
"-std=c++11"
COMPILER_SUPPORTS_CXX11
)
CHECK_CXX_COMPILER_FLAG
(
"-std=c++0x"
COMPILER_SUPPORTS_CXX0X
)
if
(
COMPILER_SUPPORTS_CXX11
)
message
(
STATUS
"The compiler
${
CMAKE_CXX_COMPILER
}
has C++11 support."
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-std=c++11"
)
elseif
(
COMPILER_SUPPORTS_CXX0X
)
message
(
STATUS
"The compiler
${
CMAKE_CXX_COMPILER
}
has C++0x support."
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-std=c++0x"
)
else
()
message
(
STATUS
"The compiler
${
CMAKE_CXX_COMPILER
}
has no C++11 support. Please use a different C++ compiler."
)
endif
()
# ============ INCLUDES ============
...
...
@@ -152,12 +159,19 @@ ENDIF(falkolib_FOUND)
#Build tests
#===============
EXAMPLE
=========================
#========================================
IF
(
BUILD_DEMOS
)
MESSAGE
(
"Building examples."
)
ADD_SUBDIRECTORY
(
examples
)
ENDIF
(
BUILD_DEMOS
)
#Build tests
IF
(
BUILD_TESTS
)
MESSAGE
(
"Building tests."
)
set
(
_LASER_SCAN_UTILS_ROOT_DIR
${
CMAKE_SOURCE_DIR
}
)
add_subdirectory
(
test
)
ENDIF
(
BUILD_TESTS
)
#install library
#=============================================================
INSTALL
(
TARGETS
${
PROJECT_NAME
}
EXPORT
${
PROJECT_NAME
}
Targets
...
...
@@ -168,12 +182,6 @@ INSTALL(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}Targets
install
(
EXPORT
${
PROJECT_NAME
}
Targets DESTINATION lib/
${
PROJECT_NAME
}
/cmake
)
#install headers
INSTALL
(
FILES
${
HDRS_BASE
}
DESTINATION include/iri-algorithms/laser_scan_utils
)
INSTALL
(
FILES
${
HDRS
}
DESTINATION include/iri-algorithms/laser_scan_utils
)
# Configure the package installation
include
(
CMakePackageConfigHelpers
)
configure_package_config_file
(
...
...
@@ -192,25 +200,17 @@ install(
# Specifies include directories to use when compiling the plugin target
# This way, include_directories does not need to be called in plugins depending on this one
# target_include_directories(${PROJECT_NAME} INTERFACE
# $<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}>
# )
target_include_directories
(
${
PROJECT_NAME
}
PUBLIC
$<BUILD_INTERFACE:
${
CMAKE_CURRENT_SOURCE_DIR
}
/include/laser_scan_utils>
$<INSTALL_INTERFACE:
${
INCLUDE_INSTALL_DIR
}
>
target_include_directories
(
${
PROJECT_NAME
}
INTERFACE
$<INSTALL_INTERFACE:
${
INCLUDE_INSTALL_DIR
}
>
)
#Build tests
IF
(
BUILD_TESTS
)
# Enables testing for this directory and below.
# Note that ctest expects to find a test file in the build directory root.
# Therefore, this command should be in the source directory root.
#include(CTest) # according to http://public.kitware.com/pipermail/cmake/2012-June/050853.html
MESSAGE
(
"Building tests."
)
enable_testing
()
set
(
_LASER_SCAN_UTILS_ROOT_DIR
${
CMAKE_SOURCE_DIR
}
)
add_subdirectory
(
test
)
ENDIF
(
BUILD_TESTS
)
#install headers
INSTALL
(
FILES
${
HDRS_BASE
}
DESTINATION
${
INCLUDE_INSTALL_DIR
}
/
${
PROJECT_NAME
}
)
INSTALL
(
FILES
${
HDRS
}
DESTINATION
${
INCLUDE_INSTALL_DIR
}
/
${
PROJECT_NAME
}
)
export
(
PACKAGE
${
PROJECT_NAME
}
)
FIND_PACKAGE
(
Doxygen MODULE
)
...
...
This diff is collapsed.
Click to expand it.
test/CMakeLists.txt
+
1
−
17
View file @
e755a92d
# Retrieve googletest from github & compile
add_subdirectory
(
gtest
)
#Include directories
INCLUDE_DIRECTORIES
(
../src
)
INCLUDE_DIRECTORIES
(
/data
)
FIND_PACKAGE
(
Eigen3 3.3 REQUIRED CONFIG
)
FIND_PACKAGE
(
PythonLibs QUIET
)
INCLUDE_DIRECTORIES
(
${
EIGEN3_INCLUDE_DIRS
}
)
INCLUDE_DIRECTORIES
(
${
csm_INCLUDE_DIRS
}
)
INCLUDE_DIRECTORIES
(
${
falkolib_INCLUDE_DIRS
}
)
############# USE THIS TEST AS AN EXAMPLE ####################
# #
# Create a specific test executable for gtest_example #
# laser_scan_utils_add_gtest(gtest_example gtest_example.cpp)#
# target_link_libraries(gtest_example ${PROJECT_NAME}) #
# #
##############################################################
...
...
@@ -24,14 +14,8 @@ laser_scan_utils_add_gtest(gtest_example gtest_example.cpp)
# gtest icp
IF
(
csm_FOUND
)
laser_scan_utils_add_gtest
(
gtest_icp gtest_icp.cpp
)
IF
(
python_FOUND
)
target_link_libraries
(
gtest_icp
${
PROJECT_NAME
}
${
PYTHON_LIBRARIES
}
)
ELSE
(
python_FOUND
)
target_link_libraries
(
gtest_icp
${
PROJECT_NAME
}
)
ENDIF
(
python_FOUND
)
ENDIF
(
csm_FOUND
)
IF
(
falkolib_FOUND
)
laser_scan_utils_add_gtest
(
gtest_loop_closure_falko gtest_loop_closure_falko.cpp
${
PROJECT_SOURCE_DIR
}
/test/data
)
target_link_libraries
(
gtest_loop_closure_falko
${
PROJECT_NAME
}
)
laser_scan_utils_add_gtest
(
gtest_loop_closure_falko gtest_loop_closure_falko.cpp
)
ENDIF
(
falkolib_FOUND
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
test/gtest/CMakeLists.txt
+
9
−
4
View file @
e755a92d
...
...
@@ -63,18 +63,23 @@ else()
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG main
)
FetchContent_MakeAvailable
(
googletest
)
#FetchContent_MakeAvailable(googletest)
FetchContent_GetProperties
(
googletest
)
if
(
NOT googletest_POPULATED
)
FetchContent_Populate
(
googletest
)
add_subdirectory
(
${
googletest_SOURCE_DIR
}
${
googletest_BINARY_DIR
}
EXCLUDE_FROM_ALL
)
endif
()
endif
()
function
(
laser_scan_utils_add_gtest target
)
add_executable
(
${
target
}
${
ARGN
}
)
if
(
${
CMAKE_VERSION
}
VERSION_LESS
"3.11.0"
)
add_dependencies
(
${
target
}
libgtest
)
target_link_libraries
(
${
target
}
libgtest
${
P
LUGIN
_NAME
}
)
target_link_libraries
(
${
target
}
PUBLIC
libgtest
${
P
ROJECT
_NAME
}
)
target_include_directories
(
${
target
}
PUBLIC
${
GTEST_INCLUDE_DIRS
}
)
else
()
target_link_libraries
(
${
target
}
gtest_main
${
P
LUGIN
_NAME
}
)
target_link_libraries
(
${
target
}
PUBLIC
gtest_main
${
P
ROJECT
_NAME
}
)
endif
()
add_test
(
NAME
${
target
}
COMMAND
${
target
}
)
endfunction
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment