CI/Flatpak: Improve install behaviour

Use "standard" install path.
This commit is contained in:
Stenzek
2024-09-23 17:22:33 +10:00
parent dae38cb309
commit d67b826033
11 changed files with 51 additions and 20 deletions

View File

@ -215,7 +215,9 @@ function(add_core_resources target)
add_resources(${target} ${path} ${CMAKE_SOURCE_DIR}/data/resources/)
endforeach()
if(ALLOW_INSTALL)
install_imported_dep_library(cpuinfo::cpuinfo)
install(DIRECTORY "$<TARGET_FILE_DIR:${target}>/resources" DESTINATION "${CMAKE_INSTALL_PREFIX}")
if(INSTALL_SELF_CONTAINED)
install_imported_dep_library(cpuinfo::cpuinfo)
endif()
install(DIRECTORY "$<TARGET_FILE_DIR:${target}>/resources" DESTINATION "${CMAKE_INSTALL_BINDIR}")
endif()
endfunction()

View File

@ -250,7 +250,7 @@ endif()
if(ALLOW_INSTALL)
# Install main binary.
install(TARGETS duckstation-qt RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}")
install(TARGETS duckstation-qt RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
endif()
# Compile qrc to a binary file.
@ -276,7 +276,7 @@ if(NOT APPLE)
get_filename_component(QM_FILE_NAME ${QM_FILE} NAME)
add_custom_command(TARGET duckstation-qt POST_BUILD COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${QM_FILE}" "${QM_OUTPUT_DIR}/${QM_FILE_NAME}")
if(ALLOW_INSTALL)
install(FILES "${QM_FILE}" DESTINATION "${CMAKE_INSTALL_PREFIX}/translations")
install(FILES "${QM_FILE}" DESTINATION "${CMAKE_INSTALL_BINDIR}/translations")
endif()
endforeach()
else()

View File

@ -308,12 +308,19 @@ function(add_util_resources target)
set_source_files_properties(${target} PRIVATE ${version_lib} PROPERTIES MACOSX_PACKAGE_LOCATION Frameworks)
endforeach()
elseif(ALLOW_INSTALL)
# Ensure we look for dependency libraries in the installation directory.
set_target_properties(${target} PROPERTIES INSTALL_RPATH "$ORIGIN")
if(INSTALL_SELF_CONTAINED)
# Ensure we look for dependency libraries in the installation directory.
set_target_properties(${target} PROPERTIES INSTALL_RPATH "$ORIGIN")
# Copy dependency libraries to installation directory.
install_imported_dep_library(Shaderc::shaderc_shared)
install_imported_dep_library(spirv-cross-c-shared)
install_imported_dep_library(SoundTouch::SoundTouchDLL)
# Copy dependency libraries to installation directory.
install_imported_dep_library(Shaderc::shaderc_shared)
install_imported_dep_library(spirv-cross-c-shared)
install_imported_dep_library(SoundTouch::SoundTouchDLL)
install_imported_dep_library(lunasvg::lunasvg)
else()
# Prevent CMake from overriding the RPATH in the binary. i.e. use the build locations.
# This is needed for Flatpak builds, since the libs are in /app.
set_target_properties(${target} PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE)
endif()
endif()
endfunction()