Skip to content
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

[ign -> gz] CMake functions #358

Merged
merged 1 commit into from
Jun 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ find_package(ignition-cmake3 REQUIRED)
#============================================================================
# Configure the project
#============================================================================
ign_configure_project(
gz_configure_project(
REPLACE_IGNITION_INCLUDE_PATH gz/physics
VERSION_SUFFIX pre1)

Expand All @@ -36,38 +36,38 @@ message(STATUS "\n\n-- ====== Finding Dependencies ======")

#--------------------------------------
# Find ignition-common
ign_find_package(ignition-common5
gz_find_package(ignition-common5
COMPONENTS geospatial graphics profiler
REQUIRED_BY heightmap mesh dartsim tpe tpelib bullet)
set(IGN_COMMON_VER ${ignition-common5_VERSION_MAJOR})

#--------------------------------------
# Find ignition-math
ign_find_package(ignition-math7 REQUIRED COMPONENTS eigen3)
gz_find_package(ignition-math7 REQUIRED COMPONENTS eigen3)
set(IGN_MATH_VER ${ignition-math7_VERSION_MAJOR})

#--------------------------------------
# Find ignition-plugin
ign_find_package(ignition-plugin2 REQUIRED COMPONENTS all)
gz_find_package(ignition-plugin2 REQUIRED COMPONENTS all)
set(IGN_PLUGIN_VER ${ignition-plugin2_VERSION_MAJOR})

#--------------------------------------
# Find ignition-utils
ign_find_package(ignition-utils2 REQUIRED COMPONENTS cli)
gz_find_package(ignition-utils2 REQUIRED COMPONENTS cli)
set(IGN_UTILS_VER ${ignition-utils2_VERSION_MAJOR})

#--------------------------------------
# Find Eigen
ign_find_package(EIGEN3 REQUIRED)
gz_find_package(EIGEN3 REQUIRED)

#--------------------------------------
# Find SDFormat for the SDF features
ign_find_package(sdformat13
gz_find_package(sdformat13
REQUIRED_BY sdf dartsim tpe bullet)

#--------------------------------------
# Find dartsim for the dartsim plugin wrapper
ign_find_package(DART
gz_find_package(DART
COMPONENTS
collision-bullet
collision-ode
Expand All @@ -81,7 +81,7 @@ ign_find_package(DART

#--------------------------------------
# Find bullet for the bullet plugin wrapper
ign_find_package(IgnBullet
gz_find_package(IgnBullet
VERSION 2.87
REQUIRED_BY bullet
PKGCONFIG bullet
Expand All @@ -99,14 +99,14 @@ set(GZ_PHYSICS_ENGINE_INSTALL_DIR
#============================================================================
# Configure the build
#============================================================================
ign_configure_build(QUIT_IF_BUILD_ERRORS
gz_configure_build(QUIT_IF_BUILD_ERRORS
COMPONENTS sdf heightmap mesh dartsim tpe bullet)


#============================================================================
# Create package information
#============================================================================
ign_create_packages()
gz_create_packages()


#============================================================================
Expand All @@ -115,7 +115,7 @@ ign_create_packages()
configure_file(${CMAKE_SOURCE_DIR}/api.md.in ${CMAKE_BINARY_DIR}/api.md)
configure_file(${CMAKE_SOURCE_DIR}/tutorials.md.in ${CMAKE_BINARY_DIR}/tutorials.md)

ign_create_docs(
gz_create_docs(
API_MAINPAGE_MD "${CMAKE_BINARY_DIR}/api.md"
TUTORIALS_MAINPAGE_MD "${CMAKE_BINARY_DIR}/tutorials.md"
TAGFILES
Expand Down
12 changes: 6 additions & 6 deletions bullet/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# This component expresses custom features of the bullet plugin, which can
# expose native bullet data types.
ign_add_component(bullet INTERFACE
gz_add_component(bullet INTERFACE
DEPENDS_ON_COMPONENTS sdf mesh
GET_TARGET_NAME features)

link_directories(${BULLET_LIBRARY_DIRS})
target_link_libraries(${features} INTERFACE IgnBullet::IgnBullet)

ign_get_libsources_and_unittests(sources test_sources)
gz_get_libsources_and_unittests(sources test_sources)

# TODO(MXG): Think about an ign_add_plugin(~) macro for ign-cmake
# TODO(MXG): Think about an gz_add_plugin(~) macro for ign-cmake
set(engine_name bullet-plugin)
ign_add_component(${engine_name}
gz_add_component(${engine_name}
SOURCES ${sources}
DEPENDS_ON_COMPONENTS bullet
GET_TARGET_NAME bullet_plugin)
Expand All @@ -32,7 +32,7 @@ install(
DIRECTORY include/
DESTINATION "${IGN_INCLUDE_INSTALL_DIR_FULL}")

# The library created by `ign_add_component` includes the ign-physics version
# The library created by `gz_add_component` includes the ign-physics version
# (i.e. libignition-physics1-name-plugin.so), but for portability,
# we also install an unversioned symlink into the same versioned folder.
set(versioned ${CMAKE_SHARED_LIBRARY_PREFIX}${bullet_plugin}${CMAKE_SHARED_LIBRARY_SUFFIX})
Expand All @@ -51,7 +51,7 @@ EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E create_symlink ${versioned} ${unvers
INSTALL(FILES ${PROJECT_BINARY_DIR}/${unversioned} DESTINATION ${GZ_PHYSICS_ENGINE_INSTALL_DIR})

# Testing
ign_build_tests(
gz_build_tests(
TYPE UNIT_bullet
SOURCES ${test_sources}
LIB_DEPS
Expand Down
18 changes: 9 additions & 9 deletions dartsim/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This component expresses custom features of the dartsim plugin, which can
# expose native dartsim data types.
ign_add_component(dartsim INTERFACE
gz_add_component(dartsim INTERFACE
DEPENDS_ON_COMPONENTS sdf heightmap mesh
GET_TARGET_NAME features)

Expand All @@ -15,11 +15,11 @@ install(
DIRECTORY include/
DESTINATION "${IGN_INCLUDE_INSTALL_DIR_FULL}")

ign_get_libsources_and_unittests(sources test_sources)
gz_get_libsources_and_unittests(sources test_sources)

# TODO(MXG): Think about an ign_add_plugin(~) macro for ign-cmake
# TODO(MXG): Think about an gz_add_plugin(~) macro for ign-cmake
set(engine_name dartsim-plugin)
ign_add_component(${engine_name}
gz_add_component(${engine_name}
SOURCES ${sources}
DEPENDS_ON_COMPONENTS dartsim
GET_TARGET_NAME dartsim_plugin)
Expand All @@ -38,9 +38,9 @@ target_link_libraries(${dartsim_plugin}
ignition-common${IGN_COMMON_VER}::profiler
)

# The ignition fork of DART contains additional code that allows customizing
# contact constraints. We check for the presence of "ContactSurface.hpp", which
# was added to enable these customizations, to detect if the feature is
# The ignition fork of DART contains additional code that allows customizing
# contact constraints. We check for the presence of "ContactSurface.hpp", which
# was added to enable these customizations, to detect if the feature is
# available.
include(CheckIncludeFileCXX)
if (MSVC)
Expand All @@ -61,7 +61,7 @@ endif()
# Note that plugins are currently being installed in 2 places: /lib and the engine-plugins dir
install(TARGETS ${dartsim_plugin} DESTINATION ${GZ_PHYSICS_ENGINE_INSTALL_DIR})

# The library created by `ign_add_component` includes the ign-physics version
# The library created by `gz_add_component` includes the ign-physics version
# (i.e. libignition-physics1-name-plugin.so), but for portability,
# we also install an unversioned symlink into the same versioned folder.
set(versioned ${CMAKE_SHARED_LIBRARY_PREFIX}${dartsim_plugin}${CMAKE_SHARED_LIBRARY_SUFFIX})
Expand All @@ -78,7 +78,7 @@ else()
endif()

# Testing
ign_build_tests(
gz_build_tests(
TYPE UNIT
SOURCES ${test_sources}
LIB_DEPS
Expand Down
2 changes: 1 addition & 1 deletion heightmap/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ign_add_component(heightmap INTERFACE
gz_add_component(heightmap INTERFACE
GET_TARGET_NAME heightmap)

target_link_libraries(${heightmap}
Expand Down
3 changes: 1 addition & 2 deletions include/gz/physics/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@

ign_install_all_headers()
gz_install_all_headers()
3 changes: 1 addition & 2 deletions mesh/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

ign_add_component(mesh INTERFACE
gz_add_component(mesh INTERFACE
GET_TARGET_NAME mesh)

target_link_libraries(${mesh}
Expand Down
3 changes: 1 addition & 2 deletions sdf/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

ign_add_component(sdf INTERFACE
gz_add_component(sdf INTERFACE
GET_TARGET_NAME sdf)

target_link_libraries(${sdf} INTERFACE ${SDFormat_LIBRARIES})
Expand Down
6 changes: 3 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ign_get_libsources_and_unittests(sources gtest_sources)
gz_get_libsources_and_unittests(sources gtest_sources)

ign_create_core_library(SOURCES ${sources} CXX_STANDARD 17)
gz_create_core_library(SOURCES ${sources} CXX_STANDARD 17)

target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME}
PUBLIC
Expand All @@ -9,7 +9,7 @@ target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME}
ignition-plugin${IGN_PLUGIN_VER}::register
Eigen3::Eigen)

ign_build_tests(
gz_build_tests(
TYPE UNIT
SOURCES ${gtest_sources})

Expand Down
2 changes: 1 addition & 1 deletion test/benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ set(tests
ExpectData.cc
)

ign_add_benchmarks(SOURCES ${tests})
gz_add_benchmarks(SOURCES ${tests})
5 changes: 2 additions & 3 deletions test/integration/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@

ign_get_sources(tests)
gz_get_sources(tests)

if (NOT DART_FOUND)
list(REMOVE_ITEM tests DoublePendulum.cc)
endif()

configure_file (test_config.h.in ${PROJECT_BINARY_DIR}/test_config.h)

ign_build_tests(
gz_build_tests(
TYPE INTEGRATION
SOURCES ${tests}
LIB_DEPS
Expand Down
5 changes: 2 additions & 3 deletions test/performance/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

ign_get_sources(tests)
gz_get_sources(tests)

# ExpectData test causes lcov to hang
# see ign-cmake issue 25
Expand All @@ -8,6 +7,6 @@ if("${CMAKE_BUILD_TYPE_UPPERCASE}" STREQUAL "COVERAGE")
ExpectData.cc)
endif()

ign_build_tests(
gz_build_tests(
TYPE PERFORMANCE
SOURCES ${tests})
5 changes: 2 additions & 3 deletions test/regression/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
gz_get_sources(tests)

ign_get_sources(tests)

ign_build_tests(
gz_build_tests(
TYPE REGRESSION
SOURCES ${tests})
3 changes: 1 addition & 2 deletions test/static_assert/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

ign_get_sources(assert_tests)
gz_get_sources(assert_tests)

if(UNIX)

Expand Down
6 changes: 3 additions & 3 deletions tpe/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
ign_get_libsources_and_unittests(sources test_sources)
gz_get_libsources_and_unittests(sources test_sources)

set (aabb_tree_SRC
${CMAKE_CURRENT_SOURCE_DIR}/src/aabb_tree/AABB.h
${CMAKE_CURRENT_SOURCE_DIR}/src/aabb_tree/AABB.cc)
set(sources ${sources} ${aabb_tree_SRC})

ign_add_component(tpelib
gz_add_component(tpelib
SOURCES ${sources}
GET_TARGET_NAME tpelib_target
CXX_STANDARD 17)
Expand All @@ -17,7 +17,7 @@ target_link_libraries(${tpelib_target}
ignition-math${IGN_MATH_VER}::eigen3
)

ign_build_tests(
gz_build_tests(
TYPE UNIT_tpelib
SOURCES ${test_sources}
LIB_DEPS
Expand Down
12 changes: 6 additions & 6 deletions tpe/plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# This component expresses custom features of the tpe plugin, which can
# expose native tpe data types.
ign_add_component(tpe INTERFACE
gz_add_component(tpe INTERFACE
DEPENDS_ON_COMPONENTS sdf mesh
GET_TARGET_NAME features)

target_link_libraries(${features} INTERFACE ${PROJECT_LIBRARY_TARGET_NAME}-tpelib)
target_include_directories(${features} SYSTEM INTERFACE)

ign_get_libsources_and_unittests(sources test_sources)
gz_get_libsources_and_unittests(sources test_sources)

# TODO(MXG): Think about an ign_add_plugin(~) macro for ign-cmake
# TODO(MXG): Think about an gz_add_plugin(~) macro for ign-cmake
set(engine_name tpe-plugin)
ign_add_component(${engine_name}
gz_add_component(${engine_name}
SOURCES ${sources}
DEPENDS_ON_COMPONENTS tpe
GET_TARGET_NAME tpe_plugin)
Expand All @@ -34,7 +34,7 @@ target_link_libraries(${tpe_plugin}
# Note that plugins are currently being installed in 2 places: /lib and the engine-plugins dir
install(TARGETS ${tpe_plugin} DESTINATION ${GZ_PHYSICS_ENGINE_INSTALL_DIR})

# The library created by `ign_add_component` includes the ign-physics version
# The library created by `gz_add_component` includes the ign-physics version
# (i.e. libignition-physics1-name-plugin.so), but for portability,
# we also install an unversioned symlink into the same versioned folder.
set(versioned ${CMAKE_SHARED_LIBRARY_PREFIX}${tpe_plugin}${CMAKE_SHARED_LIBRARY_SUFFIX})
Expand All @@ -50,7 +50,7 @@ else()
INSTALL(FILES ${PROJECT_BINARY_DIR}/${unversioned} DESTINATION ${GZ_PHYSICS_ENGINE_INSTALL_DIR})
endif()

ign_build_tests(
gz_build_tests(
TYPE UNIT_tpe
SOURCES ${test_sources}
LIB_DEPS
Expand Down