mirror of
https://github.com/stenzek/duckstation.git
synced 2025-07-28 22:01:59 +00:00
CMake: Drop Flatpak workarounds
No longer needed since it is using self-contained.
This commit is contained in:
parent
6c4300c6c7
commit
83d521f3d8
@ -91,16 +91,10 @@ endif()
|
||||
# Write binaries to a seperate directory.
|
||||
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).
|
||||
# Installation directories. Everything goes into one directory.
|
||||
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()
|
||||
set(CMAKE_INSTALL_BINDIR "${CMAKE_INSTALL_PREFIX}")
|
||||
set(CMAKE_INSTALL_LIBDIR "${CMAKE_INSTALL_PREFIX}")
|
||||
endif()
|
||||
|
||||
# Enable large file support on Linux 32-bit platforms.
|
||||
|
@ -11,7 +11,6 @@ if(LINUX OR BSD)
|
||||
option(ENABLE_X11 "Support X11 window system" ON)
|
||||
option(ENABLE_WAYLAND "Support Wayland window system" ON)
|
||||
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()
|
||||
if(APPLE)
|
||||
option(SKIP_POSTPROCESS_BUNDLE "Disable bundle post-processing, including Qt additions" OFF)
|
||||
|
@ -27,15 +27,11 @@ if(BUILD_TESTS)
|
||||
endif()
|
||||
|
||||
if(ALLOW_INSTALL)
|
||||
message(WARNING "Install target is enabled. This will install all DuckStation files into:
|
||||
${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.")
|
||||
message(STATUS "Creating self-contained install at ${CMAKE_INSTALL_PREFIX}")
|
||||
|
||||
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}")
|
||||
# Stop users being silly.
|
||||
if("${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr")
|
||||
message(FATAL_ERROR "You are trying to install DuckStation into a system directory, this is not supported. Please use a different CMAKE_INSTALL_PREFIX.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -46,7 +46,7 @@ endif()
|
||||
find_package(Shaderc REQUIRED)
|
||||
find_package(spirv_cross_c_shared REQUIRED)
|
||||
|
||||
if(LINUX AND NOT (ALLOW_INSTALL AND INSTALL_SELF_CONTAINED))
|
||||
if(LINUX AND NOT ALLOW_INSTALL)
|
||||
# We need to add the rpath for shaderc to the executable.
|
||||
get_target_property(SHADERC_LIBRARY Shaderc::shaderc_shared IMPORTED_LOCATION)
|
||||
get_filename_component(SHADERC_LIBRARY_DIRECTORY ${SHADERC_LIBRARY} DIRECTORY)
|
||||
|
@ -252,8 +252,7 @@ function(install_imported_dep_library name)
|
||||
|
||||
# Only install if it's not a system library.
|
||||
foreach(path ${CMAKE_PREFIX_PATH})
|
||||
string(FIND "${LOCATION}" "${path}" out)
|
||||
if (NOT "${out}" EQUAL 0)
|
||||
if (NOT "${LOCATION}" MATCHES "^${path}")
|
||||
message(STATUS "Not installing imported system library ${name}")
|
||||
return()
|
||||
endif()
|
||||
|
@ -123,9 +123,8 @@ build() {
|
||||
-DCMAKE_PREFIX_PATH="${_depsdir}" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
|
||||
-DALLOW_INSTALL=ON \
|
||||
-DINSTALL_SELF_CONTAINED=ON \
|
||||
-DCMAKE_INSTALL_PREFIX="${pkgdir}${_destdir}"
|
||||
-DCMAKE_INSTALL_PREFIX="${pkgdir}${_destdir}" \
|
||||
-DALLOW_INSTALL=ON
|
||||
ninja -C build-arch
|
||||
}
|
||||
|
||||
|
@ -70,8 +70,8 @@ cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_MODULE_LINKER_FLAGS_INIT="-fuse-ld=lld" \
|
||||
-DCMAKE_SHARED_LINKER_FLAGS_INIT="-fuse-ld=lld" \
|
||||
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
|
||||
-DALLOW_INSTALL=ON -DINSTALL_SELF_CONTAINED=ON \
|
||||
-DCMAKE_INSTALL_PREFIX=%{buildroot}/opt/%{name}
|
||||
-DCMAKE_INSTALL_PREFIX=%{buildroot}/opt/%{name} \
|
||||
-DALLOW_INSTALL=ON
|
||||
ninja -C build %{?_smp_mflags}
|
||||
|
||||
%install
|
||||
|
@ -65,20 +65,17 @@ modules:
|
||||
# Flatpak build does not appear to default to Release.
|
||||
- "-DCMAKE_BUILD_TYPE=Release"
|
||||
|
||||
# Self-contained install, need to change the directory.
|
||||
# Typical flatpak garbage makes it a pain to change the path from /app/bin...
|
||||
- "-DCMAKE_INSTALL_PREFIX=/app/bin"
|
||||
|
||||
# Dependencies path.
|
||||
- "-DCMAKE_PREFIX_PATH=/app/deps"
|
||||
|
||||
# Self-contained install, need to change the directory.
|
||||
# Typical flatpak garbage makes it a pain to change the path from /app/bin...
|
||||
- "-DCMAKE_INSTALL_PREFIX=/app/bin"
|
||||
- "-DALLOW_INSTALL=ON"
|
||||
|
||||
# We're not running tests as part of the flatpak build.
|
||||
- "-DBUILD_TESTS=OFF"
|
||||
|
||||
# Install to /app.
|
||||
- "-DALLOW_INSTALL=ON"
|
||||
- "-DINSTALL_SELF_CONTAINED=ON"
|
||||
|
||||
# Set the page range to 4K-16K. This has no effect on X86, but is required for
|
||||
# ARM builds, as some devices are now shipping with 16K kernels.
|
||||
- "-DHOST_MIN_PAGE_SIZE=4096"
|
||||
|
@ -222,10 +222,9 @@ function(add_core_resources target)
|
||||
add_resources(${target} ${path} ${CMAKE_SOURCE_DIR}/data/resources/)
|
||||
endforeach()
|
||||
if(ALLOW_INSTALL)
|
||||
if(INSTALL_SELF_CONTAINED)
|
||||
install_imported_dep_library(cpuinfo::cpuinfo)
|
||||
install_imported_dep_library(DiscordRPC::discord-rpc)
|
||||
endif()
|
||||
install_imported_dep_library(cpuinfo::cpuinfo)
|
||||
install_imported_dep_library(DiscordRPC::discord-rpc)
|
||||
install_imported_dep_library(libzip::zip)
|
||||
install(DIRECTORY "$<TARGET_FILE_DIR:${target}>/resources" DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||
endif()
|
||||
|
||||
|
@ -322,17 +322,14 @@ function(add_util_resources target)
|
||||
set_source_files_properties(${target} PRIVATE ${version_lib} PROPERTIES MACOSX_PACKAGE_LOCATION Frameworks)
|
||||
endforeach()
|
||||
elseif(ALLOW_INSTALL)
|
||||
if(INSTALL_SELF_CONTAINED)
|
||||
# Ensure we look for dependency libraries in the installation directory.
|
||||
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.
|
||||
install_imported_dep_library(SDL3::SDL3)
|
||||
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(plutosvg::plutosvg)
|
||||
install_imported_dep_library(libzip::zip)
|
||||
endif()
|
||||
# Copy dependency libraries to installation directory.
|
||||
install_imported_dep_library(SDL3::SDL3)
|
||||
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(plutosvg::plutosvg)
|
||||
endif()
|
||||
endfunction()
|
||||
|
Loading…
x
Reference in New Issue
Block a user