Skip to content

Commit

Permalink
Migrate CMake files
Browse files Browse the repository at this point in the history
Signed-off-by: methylDragon <[email protected]>
  • Loading branch information
methylDragon committed May 7, 2022
1 parent aa5bc78 commit b2212f2
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 30 deletions.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion doc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
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})
82 changes: 55 additions & 27 deletions src/plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,38 @@
# [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}
)
target_link_libraries(${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()

Expand All @@ -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
Expand All @@ -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()

Expand Down

0 comments on commit b2212f2

Please sign in to comment.