From 39a55a595ebb85ada7b8047f969f8cd12354a027 Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Wed, 3 Apr 2024 14:45:40 -0500 Subject: [PATCH 1/2] Use relative install paths for plugin shared libraries and gz-tools data Signed-off-by: Addisu Z. Taddese --- CMakeLists.txt | 4 ++-- src/CMakeLists.txt | 4 ---- src/cmd/CMakeLists.txt | 8 ++++---- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f131a19a66..2b98e07aea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -226,10 +226,10 @@ else() endif() # Plugin install dirs set(GZ_SIM_PLUGIN_INSTALL_DIR - ${CMAKE_INSTALL_PREFIX}/${GZ_LIB_INSTALL_DIR}/gz-${GZ_DESIGNATION}-${PROJECT_VERSION_MAJOR}/plugins + ${GZ_LIB_INSTALL_DIR}/gz-${GZ_DESIGNATION}-${PROJECT_VERSION_MAJOR}/plugins ) set(GZ_SIM_GUI_PLUGIN_INSTALL_DIR - ${CMAKE_INSTALL_PREFIX}/${GZ_LIB_INSTALL_DIR}/gz-${GZ_DESIGNATION}-${PROJECT_VERSION_MAJOR}/plugins/gui + ${GZ_LIB_INSTALL_DIR}/gz-${GZ_DESIGNATION}-${PROJECT_VERSION_MAJOR}/plugins/gui ) #============================================================================ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 667562dc45..e23c1a866a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -245,10 +245,6 @@ target_include_directories(${PROJECT_LIBRARY_TARGET_NAME} $ ) -set(GZ_SIM_PLUGIN_INSTALL_DIR - ${CMAKE_INSTALL_PREFIX}/${GZ_LIB_INSTALL_DIR}/gz-${GZ_DESIGNATION}-${PROJECT_VERSION_MAJOR}/plugins -) - include_directories(${PROJECT_SOURCE_DIR}/test) # Build the unit tests diff --git a/src/cmd/CMakeLists.txt b/src/cmd/CMakeLists.txt index facaaca434..021cc37dd9 100644 --- a/src/cmd/CMakeLists.txt +++ b/src/cmd/CMakeLists.txt @@ -41,7 +41,7 @@ configure_file( install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${GZ_DESIGNATION}${PROJECT_VERSION_MAJOR}.yaml DESTINATION - ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/gz/) + ${CMAKE_INSTALL_DATAROOTDIR}/gz/) #=============================================================================== # Used for the installed model command version. @@ -69,7 +69,7 @@ configure_file( "model.yaml.in" ${model_configured}) -install(FILES ${model_configured} DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/gz/) +install(FILES ${model_configured} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/gz/) #=============================================================================== @@ -146,7 +146,7 @@ install( FILES ${CMAKE_CURRENT_BINARY_DIR}/sim${PROJECT_VERSION_MAJOR}.bash_completion.sh DESTINATION - ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/gz/gz${GZ_TOOLS_VER}.completion.d) + ${CMAKE_INSTALL_DATAROOTDIR}/gz/gz${GZ_TOOLS_VER}.completion.d) configure_file( "model.bash_completion.sh" @@ -155,4 +155,4 @@ install( FILES ${CMAKE_CURRENT_BINARY_DIR}/model${PROJECT_VERSION_MAJOR}.bash_completion.sh DESTINATION - ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/gz/gz${GZ_TOOLS_VER}.completion.d) + ${CMAKE_INSTALL_DATAROOTDIR}/gz/gz${GZ_TOOLS_VER}.completion.d) From 7f6f832546f255d6797fd088783494923f0b185d Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Wed, 10 Apr 2024 16:25:04 -0500 Subject: [PATCH 2/2] Use new `*_RELATIVE_INSTALL_DIR` variables instead of modifying the originals Signed-off-by: Addisu Z. Taddese --- CMakeLists.txt | 10 ++++++++-- src/gui/plugins/CMakeLists.txt | 2 +- src/gui/plugins/modules/CMakeLists.txt | 4 ++-- src/systems/CMakeLists.txt | 4 ++-- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2b98e07aea..53a2ed1962 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -225,12 +225,18 @@ else() endif() endif() # Plugin install dirs -set(GZ_SIM_PLUGIN_INSTALL_DIR +set(GZ_SIM_PLUGIN_RELATIVE_INSTALL_DIR ${GZ_LIB_INSTALL_DIR}/gz-${GZ_DESIGNATION}-${PROJECT_VERSION_MAJOR}/plugins ) -set(GZ_SIM_GUI_PLUGIN_INSTALL_DIR +set(GZ_SIM_PLUGIN_INSTALL_DIR + ${CMAKE_INSTALL_PREFIX}/${GZ_SIM_PLUGIN_RELATIVE_INSTALL_DIR} +) +set(GZ_SIM_GUI_PLUGIN_RELATIVE_INSTALL_DIR ${GZ_LIB_INSTALL_DIR}/gz-${GZ_DESIGNATION}-${PROJECT_VERSION_MAJOR}/plugins/gui ) +set(GZ_SIM_GUI_PLUGIN_INSTALL_DIR + ${CMAKE_INSTALL_PREFIX}/${GZ_SIM_GUI_PLUGIN_RELATIVE_INSTALL_DIR} +) #============================================================================ # Configure the build diff --git a/src/gui/plugins/CMakeLists.txt b/src/gui/plugins/CMakeLists.txt index 93cf416713..837f929c7a 100644 --- a/src/gui/plugins/CMakeLists.txt +++ b/src/gui/plugins/CMakeLists.txt @@ -124,7 +124,7 @@ function(gz_add_gui_plugin plugin_name) endif() endif() - install (TARGETS ${plugin_name} DESTINATION ${GZ_SIM_GUI_PLUGIN_INSTALL_DIR}) + install (TARGETS ${plugin_name} DESTINATION ${GZ_SIM_GUI_PLUGIN_RELATIVE_INSTALL_DIR}) endfunction() add_subdirectory(modules) diff --git a/src/gui/plugins/modules/CMakeLists.txt b/src/gui/plugins/modules/CMakeLists.txt index 3874f36f46..4721a155cd 100644 --- a/src/gui/plugins/modules/CMakeLists.txt +++ b/src/gui/plugins/modules/CMakeLists.txt @@ -7,5 +7,5 @@ gz_add_gui_library(EntityContextMenu QT_HEADERS EntityContextMenu.hh ) -install (TARGETS EntityContextMenu DESTINATION ${GZ_SIM_GUI_PLUGIN_INSTALL_DIR}/${module_name}) -install (FILES qmldir DESTINATION ${GZ_SIM_GUI_PLUGIN_INSTALL_DIR}/${module_name}) +install (TARGETS EntityContextMenu DESTINATION ${GZ_SIM_GUI_PLUGIN_RELATIVE_INSTALL_DIR}/${module_name}) +install (FILES qmldir DESTINATION ${GZ_SIM_GUI_PLUGIN_RELATIVE_INSTALL_DIR}/${module_name}) diff --git a/src/systems/CMakeLists.txt b/src/systems/CMakeLists.txt index d75a20663d..1603a13930 100644 --- a/src/systems/CMakeLists.txt +++ b/src/systems/CMakeLists.txt @@ -72,7 +72,7 @@ function(gz_add_system system_name) endif() # Note that plugins are currently being installed in 2 places. /lib and the plugin dir - install(TARGETS ${system_target} DESTINATION ${GZ_SIM_PLUGIN_INSTALL_DIR}) + install(TARGETS ${system_target} DESTINATION ${GZ_SIM_PLUGIN_RELATIVE_INSTALL_DIR}) # The library created by `gz_add_component` includes the gz-sim version # (i.e. libgz-sim1-name-system.so), but for portability of SDF @@ -90,7 +90,7 @@ function(gz_add_system system_name) else() file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/lib") EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E create_symlink ${versioned} ${unversioned} WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/lib") - INSTALL(FILES ${PROJECT_BINARY_DIR}/lib/${unversioned} DESTINATION ${GZ_SIM_PLUGIN_INSTALL_DIR}) + INSTALL(FILES ${PROJECT_BINARY_DIR}/lib/${unversioned} DESTINATION ${GZ_SIM_PLUGIN_RELATIVE_INSTALL_DIR}) endif() endfunction()