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 #237

Merged
merged 1 commit into from
Jun 17, 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
22 changes: 11 additions & 11 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/sensors
VERSION_SUFFIX pre1)

Expand All @@ -38,26 +38,26 @@ message(STATUS "\n\n-- ====== Finding Dependencies ======")
#--------------------------------------
# Find Protobuf
set(REQ_PROTOBUF_VER 3)
ign_find_package(IgnProtobuf
gz_find_package(IgnProtobuf
VERSION ${REQ_PROTOBUF_VER}
REQUIRED
PRETTY Protobuf)

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

#--------------------------------------
# Find ignition-common
ign_find_package(ignition-common5
gz_find_package(ignition-common5
COMPONENTS profiler
REQUIRED)
set(IGN_COMMON_VER ${ignition-common5_VERSION_MAJOR})

#--------------------------------------
# Find ignition-transport
ign_find_package(ignition-transport12 REQUIRED)
gz_find_package(ignition-transport12 REQUIRED)
set(IGN_TRANSPORT_VER ${ignition-transport12_VERSION_MAJOR})

#--------------------------------------
Expand All @@ -68,7 +68,7 @@ if ((NOT ${CMAKE_VERSION} VERSION_LESS 3.11) AND (NOT OpenGL_GL_PREFERENCE))
set(OpenGL_GL_PREFERENCE "GLVND")
endif()

ign_find_package(ignition-rendering7 REQUIRED OPTIONAL_COMPONENTS ogre ogre2)
gz_find_package(ignition-rendering7 REQUIRED OPTIONAL_COMPONENTS ogre ogre2)
set(IGN_RENDERING_VER ${ignition-rendering7_VERSION_MAJOR})

if (TARGET ignition-rendering${IGN_RENDERING_VER}::ogre)
Expand All @@ -83,31 +83,31 @@ endif()

#--------------------------------------
# Find ignition-msgs
ign_find_package(ignition-msgs9 REQUIRED)
gz_find_package(ignition-msgs9 REQUIRED)
set(IGN_MSGS_VER ${ignition-msgs9_VERSION_MAJOR})

#--------------------------------------
# Find SDFormat
ign_find_package(sdformat13 REQUIRED)
gz_find_package(sdformat13 REQUIRED)
set(SDF_VER ${sdformat13_VERSION_MAJOR})

#============================================================================
# Configure the build
#============================================================================
ign_configure_build(QUIT_IF_BUILD_ERRORS)
gz_configure_build(QUIT_IF_BUILD_ERRORS)

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

#============================================================================
# Configure documentation
#============================================================================
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")

Expand Down
2 changes: 1 addition & 1 deletion include/gz/sensors/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ign_install_all_headers()
gz_install_all_headers()
42 changes: 21 additions & 21 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ if (MSVC)
endif()

# Create the library target.
ign_create_core_library(SOURCES ${sources} CXX_STANDARD 14)
gz_create_core_library(SOURCES ${sources} CXX_STANDARD 14)

target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME}
PUBLIC
Expand All @@ -51,14 +51,14 @@ target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME}
)
target_compile_definitions(${PROJECT_LIBRARY_TARGET_NAME} PUBLIC DepthPoints_EXPORTS)

ign_add_component(rendering SOURCES ${rendering_sources} GET_TARGET_NAME rendering_target)
gz_add_component(rendering SOURCES ${rendering_sources} GET_TARGET_NAME rendering_target)
target_link_libraries(${rendering_target}
PUBLIC
ignition-rendering${IGN_RENDERING_VER}::ignition-rendering${IGN_RENDERING_VER}
)

set(camera_sources CameraSensor.cc)
ign_add_component(camera SOURCES ${camera_sources} GET_TARGET_NAME camera_target)
gz_add_component(camera SOURCES ${camera_sources} GET_TARGET_NAME camera_target)
# custom compile definitions since the one provided automatically is versioned and will
# make the code need to change with every major version
target_compile_definitions(${camera_target} PUBLIC CameraSensor_EXPORTS)
Expand All @@ -71,7 +71,7 @@ target_link_libraries(${camera_target}
)

set(depth_camera_sources DepthCameraSensor.cc)
ign_add_component(depth_camera SOURCES ${depth_camera_sources} GET_TARGET_NAME depth_camera_target)
gz_add_component(depth_camera SOURCES ${depth_camera_sources} GET_TARGET_NAME depth_camera_target)
target_compile_definitions(${depth_camera_target} PUBLIC DepthCameraSensor_EXPORTS)
target_link_libraries(${depth_camera_target}
PRIVATE
Expand All @@ -81,7 +81,7 @@ target_link_libraries(${depth_camera_target}
)

set(lidar_sources Lidar.cc)
ign_add_component(lidar SOURCES ${lidar_sources} GET_TARGET_NAME lidar_target)
gz_add_component(lidar SOURCES ${lidar_sources} GET_TARGET_NAME lidar_target)
target_compile_definitions(${lidar_target} PUBLIC Lidar_EXPORTS)
target_link_libraries(${lidar_target}
PUBLIC
Expand All @@ -92,7 +92,7 @@ target_link_libraries(${lidar_target}
)

set(gpu_lidar_sources GpuLidarSensor.cc)
ign_add_component(gpu_lidar SOURCES ${gpu_lidar_sources} GET_TARGET_NAME gpu_lidar_target)
gz_add_component(gpu_lidar SOURCES ${gpu_lidar_sources} GET_TARGET_NAME gpu_lidar_target)
target_compile_definitions(${gpu_lidar_target} PUBLIC GpuLidarSensor_EXPORTS)
target_link_libraries(${gpu_lidar_target}
PRIVATE
Expand All @@ -102,7 +102,7 @@ target_link_libraries(${gpu_lidar_target}
)

set(logical_camera_sources LogicalCameraSensor.cc)
ign_add_component(logical_camera SOURCES ${logical_camera_sources} GET_TARGET_NAME logical_camera_target)
gz_add_component(logical_camera SOURCES ${logical_camera_sources} GET_TARGET_NAME logical_camera_target)
target_compile_definitions(${logical_camera_target} PUBLIC LogicalCameraSensor_EXPORTS)
target_link_libraries(${logical_camera_target}
PRIVATE
Expand All @@ -111,25 +111,25 @@ target_link_libraries(${logical_camera_target}
)

set(magnetometer_sources MagnetometerSensor.cc)
ign_add_component(magnetometer SOURCES ${magnetometer_sources} GET_TARGET_NAME magnetometer_target)
gz_add_component(magnetometer SOURCES ${magnetometer_sources} GET_TARGET_NAME magnetometer_target)

set(imu_sources ImuSensor.cc)
ign_add_component(imu SOURCES ${imu_sources} GET_TARGET_NAME imu_target)
gz_add_component(imu SOURCES ${imu_sources} GET_TARGET_NAME imu_target)

set(force_torque_sources ForceTorqueSensor.cc)
ign_add_component(force_torque SOURCES ${force_torque_sources} GET_TARGET_NAME force_torque_target)
gz_add_component(force_torque SOURCES ${force_torque_sources} GET_TARGET_NAME force_torque_target)

set(altimeter_sources AltimeterSensor.cc)
ign_add_component(altimeter SOURCES ${altimeter_sources} GET_TARGET_NAME altimeter_target)
gz_add_component(altimeter SOURCES ${altimeter_sources} GET_TARGET_NAME altimeter_target)

set(air_pressure_sources AirPressureSensor.cc)
ign_add_component(air_pressure SOURCES ${air_pressure_sources} GET_TARGET_NAME air_pressure_target)
gz_add_component(air_pressure SOURCES ${air_pressure_sources} GET_TARGET_NAME air_pressure_target)

set(navsat_sources NavSatSensor.cc)
ign_add_component(navsat SOURCES ${navsat_sources} GET_TARGET_NAME navsat_target)
gz_add_component(navsat SOURCES ${navsat_sources} GET_TARGET_NAME navsat_target)

set(rgbd_camera_sources RgbdCameraSensor.cc)
ign_add_component(rgbd_camera SOURCES ${rgbd_camera_sources} GET_TARGET_NAME rgbd_camera_target)
gz_add_component(rgbd_camera SOURCES ${rgbd_camera_sources} GET_TARGET_NAME rgbd_camera_target)
target_compile_definitions(${rgbd_camera_target} PUBLIC RgbdCameraSensor_EXPORTS)
target_link_libraries(${rgbd_camera_target}
PRIVATE
Expand All @@ -139,7 +139,7 @@ target_link_libraries(${rgbd_camera_target}
)

set(thermal_camera_sources ThermalCameraSensor.cc)
ign_add_component(thermal_camera SOURCES ${thermal_camera_sources} GET_TARGET_NAME thermal_camera_target)
gz_add_component(thermal_camera SOURCES ${thermal_camera_sources} GET_TARGET_NAME thermal_camera_target)
target_link_libraries(${thermal_camera_target}
PRIVATE
${camera_target}
Expand All @@ -148,7 +148,7 @@ target_link_libraries(${thermal_camera_target}
)

set(segmentation_camera_sources SegmentationCameraSensor.cc)
ign_add_component(segmentation_camera SOURCES ${segmentation_camera_sources} GET_TARGET_NAME segmentation_camera_target)
gz_add_component(segmentation_camera SOURCES ${segmentation_camera_sources} GET_TARGET_NAME segmentation_camera_target)
target_compile_definitions(${segmentation_camera_target} PUBLIC SegmentationCameraSensor_EXPORTS)
target_link_libraries(${segmentation_camera_target}
PRIVATE
Expand All @@ -158,7 +158,7 @@ target_link_libraries(${segmentation_camera_target}
)

set(wide_angle_camera_sources WideAngleCameraSensor.cc)
ign_add_component(wide_angle_camera SOURCES ${wide_angle_camera_sources} GET_TARGET_NAME wide_angle_camera_target)
gz_add_component(wide_angle_camera SOURCES ${wide_angle_camera_sources} GET_TARGET_NAME wide_angle_camera_target)
target_link_libraries(${wide_angle_camera_target}
PRIVATE
${camera_target}
Expand All @@ -167,10 +167,10 @@ target_link_libraries(${wide_angle_camera_target}
)

# Build the unit tests.
ign_build_tests(TYPE UNIT SOURCES ${gtest_sources} LIB_DEPS ${rendering_target})
gz_build_tests(TYPE UNIT SOURCES ${gtest_sources} LIB_DEPS ${rendering_target})

# Build the unit tests that depend on components.
ign_build_tests(TYPE UNIT SOURCES Lidar_TEST.cc LIB_DEPS ${lidar_target})
ign_build_tests(TYPE UNIT SOURCES Camera_TEST.cc LIB_DEPS ${camera_target})
ign_build_tests(TYPE UNIT SOURCES ImuSensor_TEST.cc LIB_DEPS ${imu_target})
gz_build_tests(TYPE UNIT SOURCES Lidar_TEST.cc LIB_DEPS ${lidar_target})
gz_build_tests(TYPE UNIT SOURCES Camera_TEST.cc LIB_DEPS ${camera_target})
gz_build_tests(TYPE UNIT SOURCES ImuSensor_TEST.cc LIB_DEPS ${imu_target})

4 changes: 2 additions & 2 deletions test/integration/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ if (UNIX AND NOT APPLE)
endif()

if (DRI_TESTS)
ign_build_tests(TYPE INTEGRATION
gz_build_tests(TYPE INTEGRATION
SOURCES
${dri_tests}
LIB_DEPS
Expand All @@ -50,7 +50,7 @@ if (DRI_TESTS)
)
endif()

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

link_directories(${PROJECT_BINARY_DIR}/test)

ign_build_tests(TYPE PERFORMANCE SOURCES ${tests})
gz_build_tests(TYPE PERFORMANCE SOURCES ${tests})
2 changes: 1 addition & 1 deletion test/regression/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ set(tests

link_directories(${PROJECT_BINARY_DIR}/test)

ign_build_tests(TYPE REGRESSION SOURCES ${tests})
gz_build_tests(TYPE REGRESSION SOURCES ${tests})