Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
vision
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
mobile_robotics
wolf_projects
wolf_lib
plugins
vision
Commits
0b99e0b9
Commit
0b99e0b9
authored
3 years ago
by
Mederic Fourmy
Browse files
Options
Downloads
Patches
Plain Diff
Adapt gtest CMakeLists.txt fix JoanV fix in core
parent
597272b1
No related branches found
No related tags found
2 merge requests
!36
After cmake and const refactor
,
!33
Resolve "Adapt to core CMakeLists.txt refactor"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
test/CMakeLists.txt
+1
-27
1 addition, 27 deletions
test/CMakeLists.txt
test/gtest/CMakeLists.txt
+65
-50
65 additions, 50 deletions
test/gtest/CMakeLists.txt
with
66 additions
and
77 deletions
test/CMakeLists.txt
+
1
−
27
View file @
0b99e0b9
# Retrieve googletest from github & compile
# Retrieve googletest from github & compile
add_subdirectory
(
gtest
)
add_subdirectory
(
gtest
)
# Include gtest directory.
include_directories
(
${
GTEST_INCLUDE_DIRS
}
)
wolf_add_gtest
(
gtest_pinhole gtest_pinhole.cpp
)
wolf_add_gtest
(
gtest_pinhole gtest_pinhole.cpp
)
target_link_libraries
(
gtest_pinhole
${
PLUGIN_NAME
}
)
wolf_add_gtest
(
gtest_capture_image gtest_capture_image.cpp
)
wolf_add_gtest
(
gtest_capture_image gtest_capture_image.cpp
)
target_link_libraries
(
gtest_capture_image
${
PLUGIN_NAME
}
)
wolf_add_gtest
(
gtest_feature_point_image gtest_feature_point_image.cpp
)
wolf_add_gtest
(
gtest_feature_point_image gtest_feature_point_image.cpp
)
target_link_libraries
(
gtest_feature_point_image
${
PLUGIN_NAME
}
)
wolf_add_gtest
(
gtest_sensor_camera gtest_sensor_camera.cpp
)
wolf_add_gtest
(
gtest_sensor_camera gtest_sensor_camera.cpp
)
target_link_libraries
(
gtest_sensor_camera
${
PLUGIN_NAME
}
)
wolf_add_gtest
(
gtest_processor_visual_odometry gtest_processor_visual_odometry.cpp
)
target_link_libraries
(
gtest_processor_visual_odometry
${
PLUGIN_NAME
}
)
# # FactorTrifocal test
# wolf_add_gtest(gtest_factor_trifocal gtest_factor_trifocal.cpp)
# target_link_libraries(gtest_factor_trifocal ${PLUGIN_NAME})
# # FactorFeatureEpipolar test
# wolf_add_gtest(gtest_factor_epipolar gtest_factor_epipolar.cpp)
# target_link_libraries(gtest_factor_epipolar ${PLUGIN_NAME})
# # ProcessorBundleAdjustment test
# wolf_add_gtest(gtest_processor_bundle_adjustment gtest_processor_bundle_adjustment.cpp)
# target_link_libraries(gtest_processor_bundle_adjustment ${PLUGIN_NAME})
# # FactorPixelHp test -> depends on processor_bundle_adjustment.cpp
wolf_add_gtest
(
gtest_processor_visual_odometry gtest_processor_visual_odometry.cpp
)
# wolf_add_gtest(gtest_factor_pixel_hp gtest_factor_pixel_hp.cpp)
\ No newline at end of file
# target_link_libraries(gtest_factor_pixel_hp ${PLUGIN_NAME})
This diff is collapsed.
Click to expand it.
test/gtest/CMakeLists.txt
+
65
−
50
View file @
0b99e0b9
cmake_minimum_required
(
VERSION 2.8.8
)
if
(
${
CMAKE_VERSION
}
VERSION_LESS
"3.11.0"
)
project
(
gtest_builder C CXX
)
message
(
"CMake version less than 3.11.0"
)
# We need thread support
# Enable ExternalProject CMake module
#find_package(Threads REQUIRED
)
include
(
ExternalProject
)
# Enable ExternalProject CMake module
set
(
GTEST_FORCE_SHARED_CRT ON
)
include
(
ExternalProject
)
set
(
GTEST_DISABLE_PTHREADS OFF
)
set
(
GTEST_FORCE_SHARED_CRT ON
)
# For some reason I need to disable PTHREADS
set
(
GTEST_DISABLE_PTHREADS OFF
)
# with g++ (Ubuntu 4.9.3-8ubuntu2~14.04) 4.9.3
# This is a known issue for MinGW :
# https://github.com/google/shaderc/pull/174
#if(MINGW)
# set(GTEST_DISABLE_PTHREADS ON)
#endif()
# For some reason I need to disable PTHREADS
# Download GoogleTest
# with g++ (Ubuntu 4.9.3-8ubuntu2~14.04) 4.9.3
ExternalProject_Add
(
googletest
# This is a known issue for MinGW :
GIT_REPOSITORY https://github.com/google/googletest.git
# https://github.com/google/shaderc/pull/174
GIT_TAG v1.8.x
#if(MINGW)
# TIMEOUT 1 # We'll try this
set
(
GTEST_DISABLE_PTHREADS ON
)
CMAKE_ARGS -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG:PATH=DebugLibs
#endif()
-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE:PATH=ReleaseLibs
-DCMAKE_CXX_FLAGS=
${
MSVC_COMPILER_DEFS
}
-Dgtest_force_shared_crt=
${
GTEST_FORCE_SHARED_CRT
}
-Dgtest_disable_pthreads=
${
GTEST_DISABLE_PTHREADS
}
-DBUILD_GTEST=ON
PREFIX
"
${
CMAKE_CURRENT_BINARY_DIR
}
"
# Disable install step
INSTALL_COMMAND
""
UPDATE_DISCONNECTED 1
# 1: do not update googletest; 0: update googletest via github
)
# Download GoogleTest
# Get GTest source and binary directories from CMake project
ExternalProject_Add
(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG v1.8.x
# TIMEOUT 1 # We'll try this
CMAKE_ARGS -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG:PATH=DebugLibs
-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE:PATH=ReleaseLibs
-DCMAKE_CXX_FLAGS=
${
MSVC_COMPILER_DEFS
}
-Dgtest_force_shared_crt=
${
GTEST_FORCE_SHARED_CRT
}
-Dgtest_disable_pthreads=
${
GTEST_DISABLE_PTHREADS
}
-DBUILD_GTEST=ON
PREFIX
"
${
CMAKE_CURRENT_BINARY_DIR
}
"
# Disable install step
INSTALL_COMMAND
""
UPDATE_DISCONNECTED 1
# 1: do not update googletest; 0: update googletest via github
)
# Get GTest source and binary directories from CMake project
# Specify include dir
ExternalProject_Get_Property
(
googletest source_dir
)
set
(
GTEST_INCLUDE_DIRS
${
source_dir
}
/googletest/include PARENT_SCOPE
)
# Specify
include dir
# Specify
MainTest's link libraries
ExternalProject_Get_Property
(
googletest
source
_dir
)
ExternalProject_Get_Property
(
googletest
binary
_dir
)
set
(
GTEST_
INCLUDE
_DIR
S
${
source
_dir
}
/google
test/include
PARENT_SCOPE
)
set
(
GTEST_
LIBS
_DIR
${
binary
_dir
}
/google
mock/gtest
PARENT_SCOPE
)
# Specify MainTest's link librarie
s
# Create a libgtest target to be used as a dependency by test program
s
ExternalProject_Get_Property
(
googletest binary_dir
)
add_library
(
libgtest IMPORTED STATIC GLOBAL
)
set
(
GTEST_LIBS_DIR
${
binary_dir
}
/googlemock/gtest PARENT_SCOPE
)
add_dependencies
(
libgtest googletest
)
# Create a libgtest target to be used as a dependency by test programs
# Set libgtest properties
add_library
(
libgtest IMPORTED STATIC GLOBAL
)
set_target_properties
(
libgtest PROPERTIES
add_dependencies
(
libgtest googletest
)
"IMPORTED_LOCATION"
"
${
binary_dir
}
/googlemock/gtest/libgtest.a"
"IMPORTED_LINK_INTERFACE_LIBRARIES"
"
${
CMAKE_THREAD_LIBS_INIT
}
"
)
# Set libgtest properties
else
()
set_target_properties
(
libgtest PROPERTIES
"IMPORTED_LOCATION"
"
${
binary_dir
}
/googlemock/gtest/libgtest.a"
"IMPORTED_LINK_INTERFACE_LIBRARIES"
"
${
CMAKE_THREAD_LIBS_INIT
}
"
)
message
(
"CMake version equal or greater than 3.11.0"
)
include
(
FetchContent
)
FetchContent_Declare
(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG main
)
FetchContent_MakeAvailable
(
googletest
)
endif
()
function
(
wolf_add_gtest target
)
function
(
wolf_add_gtest target
)
add_executable
(
${
target
}
${
ARGN
}
)
add_executable
(
${
target
}
${
ARGN
}
)
add_dependencies
(
${
target
}
libgtest
)
if
(
${
CMAKE_VERSION
}
VERSION_LESS
"3.11.0"
)
target_link_libraries
(
${
target
}
libgtest
)
add_dependencies
(
${
target
}
libgtest
)
target_link_libraries
(
${
target
}
libgtest
${
PLUGIN_NAME
}
)
#WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin
target_include_directories
(
${
target
}
PUBLIC
${
GTEST_INCLUDE_DIRS
}
)
else
()
target_link_libraries
(
${
target
}
PUBLIC gtest_main
${
PLUGIN_NAME
}
)
endif
()
add_test
(
NAME
${
target
}
COMMAND
${
target
}
)
add_test
(
NAME
${
target
}
COMMAND
${
target
}
)
endfunction
()
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