From b2212f253c9c45c32b736f99302112487492a6d0 Mon Sep 17 00:00:00 2001 From: methylDragon Date: Fri, 6 May 2022 15:16:05 -0700 Subject: [PATCH] Migrate CMake files Signed-off-by: methylDragon --- CMakeLists.txt | 4 +- doc/CMakeLists.txt | 2 +- include/CMakeLists.txt | 3 +- src/plugins/CMakeLists.txt | 82 +++++++++++++++++++++++++------------- 4 files changed, 61 insertions(+), 30 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fbda7e553..aa5637b1a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,9 @@ find_package(ignition-cmake3 REQUIRED) #============================================================================ # Configure the project #============================================================================ -ign_configure_project(VERSION_SUFFIX pre1) +ign_configure_project( + REPLACE_IGNITION_INCLUDE_PATH gz/gui + VERSION_SUFFIX pre1) #============================================================================ # Set project-specific options diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 4e8d4520b..344dc638a 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -25,5 +25,5 @@ if (DOXYGEN_FOUND) COMMENT "Generating API documentation with Doxygen" VERBATIM) install(FILES ${CMAKE_BINARY_DIR}/doc/${PROJECT_NAME_LOWER}.tag.xml - DESTINATION ${CMAKE_INSTALL_PREFIX}/share/ignition/${PROJECT_NAME_LOWER}_${PROJECT_VERSION_MINOR}) + DESTINATION ${CMAKE_INSTALL_PREFIX}/share/gz/${PROJECT_NAME_LOWER}_${PROJECT_VERSION_MINOR}) endif() diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index 25ec89762..4b2bdd7bb 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -1 +1,2 @@ -add_subdirectory(ignition) +add_subdirectory(gz) +install(DIRECTORY ignition DESTINATION ${IGN_INCLUDE_INSTALL_DIR_FULL}) diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt index c32824ad9..04e08d603 100644 --- a/src/plugins/CMakeLists.txt +++ b/src/plugins/CMakeLists.txt @@ -17,17 +17,28 @@ # [PRIVATE_LINK_LIBS]: Specify a list of libraries to be privately linked. # function(ign_gui_add_library library_name) - set(options) - set(oneValueArgs) - set(multiValueArgs SOURCES QT_HEADERS PUBLIC_LINK_LIBS PRIVATE_LINK_LIBS) + # Exactly same as in gz_ below + set(options) + set(oneValueArgs) + set(multiValueArgs SOURCES QT_HEADERS PUBLIC_LINK_LIBS PRIVATE_LINK_LIBS) + cmake_parse_arguments(gz_gui_add_library "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - cmake_parse_arguments(ign_gui_add_library "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + set(gz_gui_add_library_skip_parsing true) + gz_gui_add_library(${library_name}) +endfunction() +function(gz_gui_add_library library_name) + if (NOT gz_gui_add_library_skip_parsing) + set(options) + set(oneValueArgs) + set(multiValueArgs SOURCES QT_HEADERS PUBLIC_LINK_LIBS PRIVATE_LINK_LIBS) + cmake_parse_arguments(gz_gui_add_library "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + endif() - QT5_WRAP_CPP(${library_name}_headers_MOC ${ign_gui_add_library_QT_HEADERS}) + QT5_WRAP_CPP(${library_name}_headers_MOC ${gz_gui_add_library_QT_HEADERS}) QT5_ADD_RESOURCES(${library_name}_RCC ${library_name}.qrc) add_library(${library_name} SHARED - ${ign_gui_add_library_SOURCES} + ${gz_gui_add_library_SOURCES} ${${library_name}_headers_MOC} ${${library_name}_RCC} ) @@ -35,9 +46,9 @@ function(ign_gui_add_library library_name) PUBLIC ${PROJECT_LIBRARY_TARGET_NAME} TINYXML2::TINYXML2 - ${ign_gui_add_library_PUBLIC_LINK_LIBS} + ${gz_gui_add_library_PUBLIC_LINK_LIBS} PRIVATE - ${ign_gui_add_library_PRIVATE_LINK_LIBS} + ${gz_gui_add_library_PRIVATE_LINK_LIBS} ) endfunction() @@ -62,29 +73,46 @@ endfunction() # [PRIVATE_LINK_LIBS]: Specify a list of libraries to be privately linked. # function(ign_gui_add_plugin plugin_name) - set(options) - set(oneValueArgs) - set(multiValueArgs - SOURCES - QT_HEADERS - TEST_SOURCES - PUBLIC_LINK_LIBS - PRIVATE_LINK_LIBS - ) + # Exactly same as in gz_ below + set(options) + set(oneValueArgs) + set(multiValueArgs + SOURCES + QT_HEADERS + TEST_SOURCES + PUBLIC_LINK_LIBS + PRIVATE_LINK_LIBS + ) + cmake_parse_arguments(gz_gui_add_plugin "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - cmake_parse_arguments(ign_gui_add_plugin "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + set(gz_gui_add_plugin_skip_parsing true) + gz_gui_add_plugin(${plugin_name}) +endfunction() +function(gz_gui_add_plugin plugin_name) + if (NOT gz_gui_add_plugin_skip_parsing) + set(options) + set(oneValueArgs) + set(multiValueArgs + SOURCES + QT_HEADERS + TEST_SOURCES + PUBLIC_LINK_LIBS + PRIVATE_LINK_LIBS + ) + cmake_parse_arguments(gz_gui_add_plugin "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + endif() - ign_gui_add_library(${plugin_name} - SOURCES ${ign_gui_add_plugin_SOURCES} - QT_HEADERS ${ign_gui_add_plugin_QT_HEADERS} - PUBLIC_LINK_LIBS ${ign_gui_add_plugin_PUBLIC_LINK_LIBS} - PRIVATE_LINK_LIBS ${ign_gui_add_plugin_PRIVATE_LINK_LIBS} ignition-plugin${IGN_PLUGIN_VER}::register + gz_gui_add_library(${plugin_name} + SOURCES ${gz_gui_add_plugin_SOURCES} + QT_HEADERS ${gz_gui_add_plugin_QT_HEADERS} + PUBLIC_LINK_LIBS ${gz_gui_add_plugin_PUBLIC_LINK_LIBS} + PRIVATE_LINK_LIBS ${gz_gui_add_plugin_PRIVATE_LINK_LIBS} ignition-plugin${IGN_PLUGIN_VER}::register ) - if(ign_gui_add_plugin_TEST_SOURCES) + if(gz_gui_add_plugin_TEST_SOURCES) ign_build_tests(TYPE UNIT SOURCES - ${ign_gui_add_plugin_TEST_SOURCES} + ${gz_gui_add_plugin_TEST_SOURCES} LIB_DEPS ${IGNITION-GUI_LIBRARIES} TINYXML2::TINYXML2 @@ -105,8 +133,8 @@ function(ign_gui_add_plugin plugin_name) # warning is not important since those members do not need to be interfaced # with. set_source_files_properties( - ${ign_gui_add_plugin_SOURCES} - ${ign_gui_add_plugin_TEST_SOURCES} + ${gz_gui_add_plugin_SOURCES} + ${gz_gui_add_plugin_TEST_SOURCES} COMPILE_FLAGS "/wd4251") endif()