Skip to content

Commit

Permalink
Migrate CMake files (#1477)
Browse files Browse the repository at this point in the history
Signed-off-by: methylDragon <[email protected]>
  • Loading branch information
methylDragon committed May 16, 2022
1 parent bf52da5 commit 730b7cf
Show file tree
Hide file tree
Showing 14 changed files with 48 additions and 34 deletions.
14 changes: 13 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ find_package(ignition-cmake3 REQUIRED)
#============================================================================
# Configure the project
#============================================================================
ign_configure_project(VERSION_SUFFIX pre1)
ign_configure_project(
REPLACE_IGNITION_INCLUDE_PATH gz/sim
VERSION_SUFFIX pre1)
set (CMAKE_CXX_STANDARD 17)

#============================================================================
Expand Down Expand Up @@ -252,3 +254,13 @@ endif()
if(TARGET doc)
file(COPY ${CMAKE_SOURCE_DIR}/tutorials/files/ DESTINATION ${CMAKE_BINARY_DIR}/doxygen/html/files/)
endif()

# TICKTOCK MASTER HEADER (to bypass IGN_DESIGNATION)
# TODO(CH3): Remove on tock
configure_file(
${CMAKE_CURRENT_BINARY_DIR}/include/gz/${IGN_DESIGNATION}.hh
${CMAKE_CURRENT_BINARY_DIR}/include/gz/sim.hh
COPYONLY)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/include/gz/sim.hh
DESTINATION ${IGN_INCLUDE_INSTALL_DIR_FULL}/gz)
3 changes: 2 additions & 1 deletion include/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
add_subdirectory(ignition)
add_subdirectory(gz)
install(DIRECTORY ignition DESTINATION ${IGN_INCLUDE_INSTALL_DIR_FULL})
2 changes: 1 addition & 1 deletion include/gz/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
add_subdirectory(gazebo)
add_subdirectory(sim)
4 changes: 2 additions & 2 deletions include/gz/sim/components/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ file(GLOB component_headers *.hh)
set (component_includes "")
foreach (header_full ${component_headers})
get_filename_component(header ${header_full} NAME)
set(component_includes "${component_includes}#include <ignition/gazebo/components/${header}>\n")
set(component_includes "${component_includes}#include <gz/sim/components/${header}>\n")
endforeach()

configure_file(
Expand All @@ -13,5 +13,5 @@ configure_file(

install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/components.hh
DESTINATION ${IGN_INCLUDE_INSTALL_DIR_FULL}/ignition/${IGN_DESIGNATION}
DESTINATION ${IGN_INCLUDE_INSTALL_DIR_FULL}/gz/sim
)
22 changes: 11 additions & 11 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ function(configure_build_install_location _library_name)
endfunction()

pybind11_add_module(gazebo SHARED
src/ignition/gazebo/_ignition_gazebo_pybind11.cc
src/ignition/gazebo/EntityComponentManager.cc
src/ignition/gazebo/EventManager.cc
src/ignition/gazebo/TestFixture.cc
src/ignition/gazebo/Server.cc
src/ignition/gazebo/ServerConfig.cc
src/ignition/gazebo/UpdateInfo.cc
src/ignition/gazebo/Util.cc
src/ignition/gazebo/World.cc
src/gz/sim/_gz_sim_pybind11.cc
src/gz/sim/EntityComponentManager.cc
src/gz/sim/EventManager.cc
src/gz/sim/TestFixture.cc
src/gz/sim/Server.cc
src/gz/sim/ServerConfig.cc
src/gz/sim/UpdateInfo.cc
src/gz/sim/Util.cc
src/gz/sim/World.cc
)

target_link_libraries(gazebo PRIVATE
Expand All @@ -55,8 +55,8 @@ target_link_libraries(gazebo PRIVATE

# TODO(ahcorde): Move this module to ign-common
pybind11_add_module(common SHARED
src/ignition/common/_ignition_common_pybind11.cc
src/ignition/common/Console.cc
src/gz/common/_gz_common_pybind11.cc
src/gz/common/Console.cc
)

target_link_libraries(common PRIVATE
Expand Down
11 changes: 5 additions & 6 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ set(gui_sources
PARENT_SCOPE
)

ign_add_component(ign
ign_add_component(gz
SOURCES
ign.cc
cmd/ModelCommandAPI.cc
GET_TARGET_NAME ign_lib_target)
target_link_libraries(${ign_lib_target}
GET_TARGET_NAME gz_lib_target)
target_link_libraries(${gz_lib_target}
PRIVATE
${PROJECT_LIBRARY_TARGET_NAME}
ignition-common${IGN_COMMON_VER}::ignition-common${IGN_COMMON_VER}
Expand Down Expand Up @@ -163,7 +163,7 @@ target_include_directories(${PROJECT_LIBRARY_TARGET_NAME}
)

add_dependencies(${PROJECT_LIBRARY_TARGET_NAME}
ignition-gazebo_private_msgs
gz-sim_private_msgs
)

set(IGNITION_GAZEBO_PLUGIN_INSTALL_DIR
Expand Down Expand Up @@ -199,7 +199,7 @@ foreach(CMD_TEST
endif()

add_dependencies(${CMD_TEST}
${ign_lib_target}
${gz_lib_target}
TestModelSystem
TestSensorSystem
TestWorldSystem
Expand All @@ -223,4 +223,3 @@ endforeach()
if(NOT WIN32)
add_subdirectory(cmd)
endif()

4 changes: 2 additions & 2 deletions src/cmd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set(cmd_script_configured "${cmd_script_generated}.configured")

# Set the library_location variable to the relative path to the library file
# within the install directory structure.
set(library_location "../../../${CMAKE_INSTALL_LIBDIR}/$<TARGET_FILE_NAME:${ign_lib_target}>")
set(library_location "../../../${CMAKE_INSTALL_LIBDIR}/$<TARGET_FILE_NAME:${gz_lib_target}>")

configure_file(
"cmd${IGN_DESIGNATION}.rb.in"
Expand Down Expand Up @@ -73,7 +73,7 @@ set(cmd_script_configured_test "${cmd_script_generated_test}.configured")

# Set the library_location variable to the relative path to the library file
# within the install directory structure.
set(library_location "$<TARGET_FILE:${ign_lib_target}>")
set(library_location "$<TARGET_FILE:${gz_lib_target}>")

configure_file(
"cmd${IGN_DESIGNATION}.rb.in"
Expand Down
4 changes: 2 additions & 2 deletions src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ set(CMAKE_AUTORCC ON)

# CMake AUTOMOC does not generate moc_*.cpp files automatically for headers
# located in different directories than the containing .cc file. For Qt header
# files in `include/ignition/gazebo/gui`, we use qt5_wrap_cpp instead. There is
# files in `include/gz/sim/gui`, we use qt5_wrap_cpp instead. There is
# no need to add entries for Qt header files in `src/gui/`.
qt5_wrap_cpp(gui_sources
${PROJECT_SOURCE_DIR}/include/ignition/gazebo/gui/GuiSystem.hh
${PROJECT_SOURCE_DIR}/include/gz/sim/gui/GuiSystem.hh
)

if (MSVC)
Expand Down
6 changes: 3 additions & 3 deletions src/gui/plugins/modules/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Create an IgnGazebo module
set(module_name IgnGazebo)
# Create an GzSim module
set(module_name GzSim)

# Add EntityContextMenu QML plugin to IgnGazebo module
# Add EntityContextMenu QML plugin to GzSim module
gz_add_gui_library(EntityContextMenu
SOURCES EntityContextMenu.cc
QT_HEADERS EntityContextMenu.hh
Expand Down
2 changes: 1 addition & 1 deletion src/msgs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ PROTOBUF_GENERATE_CPP(PROTO_PRIVATE_SRC PROTO_PRIVATE_HEADERS
set(PROTO_PRIVATE_SRC ${PROTO_PRIVATE_SRC} PARENT_SCOPE)
set(PROTO_PRIVATE_HEADERS ${PROTO_PRIVATE_HEADERS} PARENT_SCOPE)

add_custom_target(ignition-gazebo_private_msgs
add_custom_target(gz-sim_private_msgs
DEPENDS ${PROTO_PRIVATE_SRC}
)

2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ include_directories (
${PROJECT_BINARY_DIR}/include/
)

configure_file (test_config.hh.in ${PROJECT_BINARY_DIR}/include/ignition/gazebo/test_config.hh)
configure_file (test_config.hh.in ${PROJECT_BINARY_DIR}/include/gz/sim/test_config.hh)

# Build gtest
add_library(gtest STATIC gtest/src/gtest-all.cc)
Expand Down
4 changes: 3 additions & 1 deletion test/benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
set(TEST_TYPE "BENCHMARK")

# TODO(CH3): Remove on ticktock
include(IgnBenchmark OPTIONAL RESULT_VARIABLE IgnBenchmark_FOUND)
include(GzBenchmark OPTIONAL RESULT_VARIABLE GzBenchmark_FOUND)

if (IgnBenchmark_FOUND)
if (GzBenchmark_FOUND OR IgnBenchmark_FOUND)
set(tests
each.cc
ecm_serialize.cc
Expand Down
2 changes: 1 addition & 1 deletion test/plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ set (test_plugins
)

# TODO: someone with knowledge of ign-plugin please resolve:
# TestSystem.obj : error LNK2001: unresolved external symbol IgnitionPluginHook
# TestSystem.obj : error LNK2001: unresolved external symbol GzPluginHook
if(NOT WIN32)
set (test_plugins
${test_plugins}
Expand Down
2 changes: 1 addition & 1 deletion tools/clang_tidy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ cmake .. \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1

# Build enough to get generated msg headers
make ignition-gazebo_private_msgs
make gz-sim_private_msgs

cd ..

Expand Down

0 comments on commit 730b7cf

Please sign in to comment.