Skip to content

Commit

Permalink
Use relative install paths for plugin shared libraries and gz-tools d…
Browse files Browse the repository at this point in the history
…ata (#2358)

Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
  • Loading branch information
azeey authored Apr 11, 2024
1 parent 401c811 commit 1a54e96
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 15 deletions.
10 changes: 8 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,17 @@ else()
endif()
endif()
# Plugin install dirs
set(GZ_SIM_PLUGIN_RELATIVE_INSTALL_DIR
${GZ_LIB_INSTALL_DIR}/gz-${GZ_DESIGNATION}-${PROJECT_VERSION_MAJOR}/plugins
)
set(GZ_SIM_PLUGIN_INSTALL_DIR
${CMAKE_INSTALL_PREFIX}/${GZ_LIB_INSTALL_DIR}/gz-${GZ_DESIGNATION}-${PROJECT_VERSION_MAJOR}/plugins
${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_LIB_INSTALL_DIR}/gz-${GZ_DESIGNATION}-${PROJECT_VERSION_MAJOR}/plugins/gui
${CMAKE_INSTALL_PREFIX}/${GZ_SIM_GUI_PLUGIN_RELATIVE_INSTALL_DIR}
)

#============================================================================
Expand Down
4 changes: 0 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,6 @@ target_include_directories(${PROJECT_LIBRARY_TARGET_NAME}
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/gz_msgs_gen>
)

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
Expand Down
8 changes: 4 additions & 4 deletions src/cmd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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/)


#===============================================================================
Expand Down Expand Up @@ -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"
Expand All @@ -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)
2 changes: 1 addition & 1 deletion src/gui/plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/gui/plugins/modules/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
4 changes: 2 additions & 2 deletions src/systems/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()

Expand Down

0 comments on commit 1a54e96

Please sign in to comment.