mirror of
https://github.com/stenzek/duckstation.git
synced 2024-11-22 21:39:40 +00:00
CI/Flatpak: Improve install behaviour
Use "standard" install path.
This commit is contained in:
parent
dae38cb309
commit
d67b826033
@ -33,6 +33,7 @@ detect_cache_line_size()
|
|||||||
|
|
||||||
# Build options. Depends on system attributes.
|
# Build options. Depends on system attributes.
|
||||||
include(DuckStationBuildOptions)
|
include(DuckStationBuildOptions)
|
||||||
|
include(DuckStationDependencies)
|
||||||
|
|
||||||
# Enable PIC on Linux, otherwise the builds do not support ASLR.
|
# Enable PIC on Linux, otherwise the builds do not support ASLR.
|
||||||
if(LINUX OR BSD)
|
if(LINUX OR BSD)
|
||||||
@ -94,6 +95,18 @@ endif()
|
|||||||
# Write binaries to a seperate directory.
|
# Write binaries to a seperate directory.
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
|
||||||
|
|
||||||
|
# Installation directories. If INSTALL_SELF_CONTAINED is set, everything goes
|
||||||
|
# into one directory, otherwise CMAKE_INSTALL_PREFIX/bin is used (for Flatpak).
|
||||||
|
if(ALLOW_INSTALL)
|
||||||
|
if(INSTALL_SELF_CONTAINED)
|
||||||
|
set(CMAKE_INSTALL_BINDIR "${CMAKE_INSTALL_PREFIX}")
|
||||||
|
set(CMAKE_INSTALL_LIBDIR "${CMAKE_INSTALL_PREFIX}")
|
||||||
|
else()
|
||||||
|
# Let GNUInstallDirs set the destinations.
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
# Enable large file support on Linux 32-bit platforms.
|
# Enable large file support on Linux 32-bit platforms.
|
||||||
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||||
add_definitions("-D_FILE_OFFSET_BITS=64")
|
add_definitions("-D_FILE_OFFSET_BITS=64")
|
||||||
@ -112,7 +125,6 @@ set(CMAKE_CXX_STANDARD 20)
|
|||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
# Recursively include the source tree.
|
# Recursively include the source tree.
|
||||||
include(DuckStationDependencies)
|
|
||||||
add_subdirectory(dep)
|
add_subdirectory(dep)
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|
||||||
|
@ -42,6 +42,8 @@ function(copy_base_translations target)
|
|||||||
target_sources(${target} PRIVATE ${path})
|
target_sources(${target} PRIVATE ${path})
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
set_source_files_properties(${path} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/translations)
|
set_source_files_properties(${path} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/translations)
|
||||||
|
elseif(ALLOW_INSTALL)
|
||||||
|
install(FILES "${path}" DESTINATION "${CMAKE_INSTALL_BINDIR}/translations")
|
||||||
else()
|
else()
|
||||||
add_custom_command(TARGET ${target} POST_BUILD
|
add_custom_command(TARGET ${target} POST_BUILD
|
||||||
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${path}" "$<TARGET_FILE_DIR:${target}>/translations")
|
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${path}" "$<TARGET_FILE_DIR:${target}>/translations")
|
||||||
|
@ -10,6 +10,7 @@ if(LINUX OR BSD)
|
|||||||
option(ENABLE_X11 "Support X11 window system" ON)
|
option(ENABLE_X11 "Support X11 window system" ON)
|
||||||
option(ENABLE_WAYLAND "Support Wayland window system" ON)
|
option(ENABLE_WAYLAND "Support Wayland window system" ON)
|
||||||
option(ALLOW_INSTALL "Allow installation to CMAKE_INSTALL_PREFIX" OFF)
|
option(ALLOW_INSTALL "Allow installation to CMAKE_INSTALL_PREFIX" OFF)
|
||||||
|
option(INSTALL_SELF_CONTAINED "Make self-contained install, i.e. everything in one directory" ON)
|
||||||
endif()
|
endif()
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
option(SKIP_POSTPROCESS_BUNDLE "Disable bundle post-processing, including Qt additions" OFF)
|
option(SKIP_POSTPROCESS_BUNDLE "Disable bundle post-processing, including Qt additions" OFF)
|
||||||
|
@ -28,6 +28,13 @@ if(ALLOW_INSTALL)
|
|||||||
message(WARNING "Install target is enabled. This will install all DuckStation files into:
|
message(WARNING "Install target is enabled. This will install all DuckStation files into:
|
||||||
${CMAKE_INSTALL_PREFIX}
|
${CMAKE_INSTALL_PREFIX}
|
||||||
It does **not** use the LSB subdirectories of bin, share, etc, so you should disable this option if it is set to /usr or /usr/local.")
|
It does **not** use the LSB subdirectories of bin, share, etc, so you should disable this option if it is set to /usr or /usr/local.")
|
||||||
|
|
||||||
|
if(INSTALL_SELF_CONTAINED)
|
||||||
|
message(STATUS "Creating self-contained install at ${CMAKE_INSTALL_PREFIX}")
|
||||||
|
else()
|
||||||
|
message(STATUS "Creating relative install at ${CMAKE_INSTALL_PREFIX}")
|
||||||
|
message(STATUS " CMAKE_INSTALL_BINDIR: ${CMAKE_INSTALL_BINDIR}")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT IS_SUPPORTED_COMPILER)
|
if(NOT IS_SUPPORTED_COMPILER)
|
||||||
|
@ -225,5 +225,5 @@ endfunction()
|
|||||||
function(install_imported_dep_library name)
|
function(install_imported_dep_library name)
|
||||||
get_target_property(SONAME "${name}" IMPORTED_SONAME_RELEASE)
|
get_target_property(SONAME "${name}" IMPORTED_SONAME_RELEASE)
|
||||||
get_target_property(LOCATION "${name}" IMPORTED_LOCATION_RELEASE)
|
get_target_property(LOCATION "${name}" IMPORTED_LOCATION_RELEASE)
|
||||||
install(FILES "${LOCATION}" RENAME "${SONAME}" DESTINATION "${CMAKE_INSTALL_PREFIX}")
|
install(FILES "${LOCATION}" RENAME "${SONAME}" DESTINATION "${CMAKE_INSTALL_LIBDIR}")
|
||||||
endfunction()
|
endfunction()
|
||||||
|
@ -6,14 +6,14 @@
|
|||||||
|
|
||||||
FIND_PATH(
|
FIND_PATH(
|
||||||
LIBBACKTRACE_INCLUDE_DIR backtrace.h
|
LIBBACKTRACE_INCLUDE_DIR backtrace.h
|
||||||
HINTS /usr/include /usr/local/include
|
HINTS "${CMAKE_PREFIX_PATH}/include" /usr/include /usr/local/include
|
||||||
${LIBBACKTRACE_PATH_INCLUDES}
|
${LIBBACKTRACE_PATH_INCLUDES}
|
||||||
)
|
)
|
||||||
|
|
||||||
FIND_LIBRARY(
|
FIND_LIBRARY(
|
||||||
LIBBACKTRACE_LIBRARY
|
LIBBACKTRACE_LIBRARY
|
||||||
NAMES backtrace
|
NAMES backtrace
|
||||||
PATHS ${ADDITIONAL_LIBRARY_PATHS} ${LIBBACKTRACE_PATH_LIB}
|
PATHS "${CMAKE_PREFIX_PATH}/lib" "${CMAKE_PREFIX_PATH}/lib64" ${ADDITIONAL_LIBRARY_PATHS} ${LIBBACKTRACE_PATH_LIB}
|
||||||
)
|
)
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
|
@ -10,7 +10,7 @@ build-options:
|
|||||||
sources:
|
sources:
|
||||||
- type: git
|
- type: git
|
||||||
url: "https://github.com/ianlancetaylor/libbacktrace.git"
|
url: "https://github.com/ianlancetaylor/libbacktrace.git"
|
||||||
commit: "ad106d5fdd5d960bd33fae1c48a351af567fd075"
|
commit: "86885d14049fab06ef8a33aac51664230ca09200"
|
||||||
cleanup:
|
cleanup:
|
||||||
- /include
|
- /include
|
||||||
- /lib/*.a
|
- /lib/*.a
|
||||||
|
@ -43,7 +43,6 @@ modules:
|
|||||||
- name: duckstation
|
- name: duckstation
|
||||||
buildsystem: cmake-ninja
|
buildsystem: cmake-ninja
|
||||||
builddir: true
|
builddir: true
|
||||||
no-make-install: true
|
|
||||||
build-options:
|
build-options:
|
||||||
# Preserve debug information, it is needed for backtraces.
|
# Preserve debug information, it is needed for backtraces.
|
||||||
strip: false
|
strip: false
|
||||||
@ -60,7 +59,11 @@ modules:
|
|||||||
- "-DCMAKE_BUILD_TYPE=Release"
|
- "-DCMAKE_BUILD_TYPE=Release"
|
||||||
|
|
||||||
# We're not running tests as part of the flatpak build.
|
# We're not running tests as part of the flatpak build.
|
||||||
- '-DBUILD_TESTS=OFF'
|
- "-DBUILD_TESTS=OFF"
|
||||||
|
|
||||||
|
# Install to /app/bin, use /app/lib for dependencies.
|
||||||
|
- "-DALLOW_INSTALL=ON"
|
||||||
|
- "-DINSTALL_SELF_CONTAINED=OFF"
|
||||||
|
|
||||||
# Make sure we're using ThinLTO.
|
# Make sure we're using ThinLTO.
|
||||||
- "-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON"
|
- "-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON"
|
||||||
@ -74,9 +77,6 @@ modules:
|
|||||||
path: ../..
|
path: ../..
|
||||||
|
|
||||||
post-install:
|
post-install:
|
||||||
# Copy the binary distribution.
|
|
||||||
- "cp -a bin \"${FLATPAK_DEST}\""
|
|
||||||
|
|
||||||
# Manually copy desktop file/metadata, it's not done as part of the regular build.
|
# Manually copy desktop file/metadata, it's not done as part of the regular build.
|
||||||
- >-
|
- >-
|
||||||
install -Dm644
|
install -Dm644
|
||||||
|
@ -215,7 +215,9 @@ function(add_core_resources target)
|
|||||||
add_resources(${target} ${path} ${CMAKE_SOURCE_DIR}/data/resources/)
|
add_resources(${target} ${path} ${CMAKE_SOURCE_DIR}/data/resources/)
|
||||||
endforeach()
|
endforeach()
|
||||||
if(ALLOW_INSTALL)
|
if(ALLOW_INSTALL)
|
||||||
install_imported_dep_library(cpuinfo::cpuinfo)
|
if(INSTALL_SELF_CONTAINED)
|
||||||
install(DIRECTORY "$<TARGET_FILE_DIR:${target}>/resources" DESTINATION "${CMAKE_INSTALL_PREFIX}")
|
install_imported_dep_library(cpuinfo::cpuinfo)
|
||||||
|
endif()
|
||||||
|
install(DIRECTORY "$<TARGET_FILE_DIR:${target}>/resources" DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
@ -250,7 +250,7 @@ endif()
|
|||||||
|
|
||||||
if(ALLOW_INSTALL)
|
if(ALLOW_INSTALL)
|
||||||
# Install main binary.
|
# Install main binary.
|
||||||
install(TARGETS duckstation-qt RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}")
|
install(TARGETS duckstation-qt RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Compile qrc to a binary file.
|
# Compile qrc to a binary file.
|
||||||
@ -276,7 +276,7 @@ if(NOT APPLE)
|
|||||||
get_filename_component(QM_FILE_NAME ${QM_FILE} NAME)
|
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}")
|
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)
|
if(ALLOW_INSTALL)
|
||||||
install(FILES "${QM_FILE}" DESTINATION "${CMAKE_INSTALL_PREFIX}/translations")
|
install(FILES "${QM_FILE}" DESTINATION "${CMAKE_INSTALL_BINDIR}/translations")
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
else()
|
else()
|
||||||
|
@ -308,12 +308,19 @@ function(add_util_resources target)
|
|||||||
set_source_files_properties(${target} PRIVATE ${version_lib} PROPERTIES MACOSX_PACKAGE_LOCATION Frameworks)
|
set_source_files_properties(${target} PRIVATE ${version_lib} PROPERTIES MACOSX_PACKAGE_LOCATION Frameworks)
|
||||||
endforeach()
|
endforeach()
|
||||||
elseif(ALLOW_INSTALL)
|
elseif(ALLOW_INSTALL)
|
||||||
# Ensure we look for dependency libraries in the installation directory.
|
if(INSTALL_SELF_CONTAINED)
|
||||||
set_target_properties(${target} PROPERTIES INSTALL_RPATH "$ORIGIN")
|
# Ensure we look for dependency libraries in the installation directory.
|
||||||
|
set_target_properties(${target} PROPERTIES INSTALL_RPATH "$ORIGIN")
|
||||||
|
|
||||||
# Copy dependency libraries to installation directory.
|
# Copy dependency libraries to installation directory.
|
||||||
install_imported_dep_library(Shaderc::shaderc_shared)
|
install_imported_dep_library(Shaderc::shaderc_shared)
|
||||||
install_imported_dep_library(spirv-cross-c-shared)
|
install_imported_dep_library(spirv-cross-c-shared)
|
||||||
install_imported_dep_library(SoundTouch::SoundTouchDLL)
|
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()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
Loading…
Reference in New Issue
Block a user