mirror of https://github.com/PCSX2/pcsx2.git
CMake: Post-WX cleanup
- Remove unused build options - Disable setcap by default Applications should not need to call sudo as part of the build process. - Rename XDG_STD to USE_LEGACY_USER_DIRECTORY By default, we use ~/.config/PCSX2 now. - Default Wayland support to on I don't think there's any systems worth supporting that don't have it. - Rework "install" logic Linux no longer installs to GIT_ROOT/bin, it builds direct to BUILD/bin. Saves a file copy, and running make install before running your developer build was always silly. - Don't require install target to build appimage AppImage creator now just adds the entire bin directory as-is. Everything needed is in there.
This commit is contained in:
parent
b2416c6466
commit
f240660a6e
|
@ -122,8 +122,7 @@ jobs:
|
|||
env:
|
||||
NAME: ${{ steps.artifact-metadata.outputs.artifact-name }}
|
||||
run: |
|
||||
ninja -C build install
|
||||
.github/workflows/scripts/linux/appimage-qt.sh "$(realpath .)" "$HOME/deps" "$NAME"
|
||||
.github/workflows/scripts/linux/appimage-qt.sh "$(realpath .)" "$(realpath ./build)" "$HOME/deps" "$NAME"
|
||||
mkdir -p "$GITHUB_WORKSPACE"/ci-artifacts/
|
||||
mv "${NAME}.AppImage" "$GITHUB_WORKSPACE"/ci-artifacts/
|
||||
|
||||
|
|
|
@ -25,16 +25,15 @@
|
|||
#
|
||||
# For more information, please refer to <http://unlicense.org/>
|
||||
|
||||
if [ "$#" -ne 3 ]; then
|
||||
echo "Syntax: $0 <path to PCSX2 directory> <deps prefix> <output name>"
|
||||
if [ "$#" -ne 4 ]; then
|
||||
echo "Syntax: $0 <path to pcsx2 directory> <path to build directory> <deps prefix> <output name>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PCSX2DIR=$1
|
||||
DEPSDIR=$2
|
||||
NAME=$3
|
||||
|
||||
BINDIR="$PCSX2DIR/bin"
|
||||
BUILDDIR=$2
|
||||
DEPSDIR=$3
|
||||
NAME=$4
|
||||
|
||||
BINARY=pcsx2-qt
|
||||
APPDIRNAME=PCSX2.AppDir
|
||||
|
@ -199,11 +198,10 @@ OUTDIR=$(realpath "./$APPDIRNAME")
|
|||
SCRIPTDIR=$(dirname "${BASH_SOURCE[0]}")
|
||||
rm -fr "$OUTDIR"
|
||||
mkdir "$OUTDIR"
|
||||
|
||||
mkdir -p "$OUTDIR/usr/bin" "$OUTDIR/usr/lib" "$OUTDIR/usr/lib/pulseaudio"
|
||||
mkdir "$OUTDIR/usr"
|
||||
|
||||
echo "Copying binary and resources..."
|
||||
cp -a "$BINDIR/$BINARY" "$BINDIR/resources" "$OUTDIR/usr/bin"
|
||||
cp -a "$BUILDDIR/bin" "$OUTDIR/usr"
|
||||
|
||||
# Patch RPATH so the binary goes hunting for shared libraries in the AppDir instead of system.
|
||||
echo "Patching RPATH in ${BINARY}..."
|
||||
|
@ -214,6 +212,7 @@ patchelf --set-rpath '$ORIGIN/../lib' "$OUTDIR/usr/bin/$BINARY"
|
|||
|
||||
# Libraries we pull in from the system.
|
||||
echo "Copying system libraries..."
|
||||
mkdir -p "$OUTDIR/usr/lib" "$OUTDIR/usr/lib/pulseaudio"
|
||||
for lib in "${SYSLIBS[@]}"; do
|
||||
blib=$(basename "$lib")
|
||||
if [ -f "/lib/x86_64-linux-gnu/$lib" ]; then
|
||||
|
|
|
@ -27,10 +27,10 @@ cmake \
|
|||
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DQT_BUILD=ON \
|
||||
-DCUBEB_API=ON \
|
||||
-DX11_API=ON \
|
||||
-DWAYLAND_API=ON \
|
||||
-DXDG_STD=TRUE \
|
||||
-DDISABLE_PCSX2_WRAPPER=ON \
|
||||
-DDISABLE_SETCAP=ON \
|
||||
-DENABLE_SETCAP=OFF \
|
||||
-DCMAKE_PREFIX_PATH="$HOME/deps" \
|
||||
-DUSE_SYSTEM_SDL2=ON \
|
||||
-DUSE_SYSTEM_ZSTD=OFF \
|
||||
|
|
|
@ -15,6 +15,13 @@ set(TOP_CMAKE_WAS_SOURCED TRUE)
|
|||
# set module path
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
|
||||
|
||||
# Write binaries to the bin directory under the build directory.
|
||||
# This makes it simple to run development builds directly out of the build directory.
|
||||
if (UNIX AND NOT APPLE)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
|
||||
endif()
|
||||
|
||||
# include some generic functions to ensure correctness of the env
|
||||
include(Pcsx2Utils)
|
||||
|
||||
|
|
|
@ -1,14 +1,3 @@
|
|||
### Select the build type
|
||||
# Use Release/Devel/Debug : -DCMAKE_BUILD_TYPE=Release|Devel|Debug
|
||||
# Enable/disable the stripping : -DCMAKE_BUILD_STRIP=TRUE|FALSE
|
||||
# generation .po based on src : -DCMAKE_BUILD_PO=TRUE|FALSE
|
||||
|
||||
### GCC optimization options
|
||||
# control C flags : -DUSER_CMAKE_C_FLAGS="cflags"
|
||||
# control C++ flags : -DUSER_CMAKE_CXX_FLAGS="cxxflags"
|
||||
# control link flags : -DUSER_CMAKE_LD_FLAGS="ldflags"
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# Extra preprocessor definitions that will be added to all pcsx2 builds
|
||||
set(PCSX2_DEFS "")
|
||||
|
||||
|
@ -24,12 +13,6 @@ optional_system_library(zstd)
|
|||
optional_system_library(libzip)
|
||||
optional_system_library(SDL2)
|
||||
option(LTO_PCSX2_CORE "Enable LTO/IPO/LTCG on the subset of pcsx2 that benefits most from it but not anything else")
|
||||
|
||||
if(DISABLE_BUILD_DATE OR openSUSE)
|
||||
message(STATUS "Disabling the inclusion of the binary compile date.")
|
||||
list(APPEND PCSX2_DEFS DISABLE_BUILD_DATE)
|
||||
endif()
|
||||
|
||||
option(USE_VTUNE "Plug VTUNE to profile GS JIT.")
|
||||
option(USE_ACHIEVEMENTS "Build with RetroAchievements support" ON)
|
||||
option(USE_DISCORD_PRESENCE "Enable support for Discord Rich Presence" ON)
|
||||
|
@ -37,21 +20,20 @@ option(USE_DISCORD_PRESENCE "Enable support for Discord Rich Presence" ON)
|
|||
#-------------------------------------------------------------------------------
|
||||
# Graphical option
|
||||
#-------------------------------------------------------------------------------
|
||||
option(BUILD_REPLAY_LOADERS "Build GS replayer to ease testing (developer option)")
|
||||
option(USE_OPENGL "Enable OpenGL GS renderer" ON)
|
||||
option(USE_VULKAN "Enable Vulkan GS renderer" ON)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Path and lib option
|
||||
#-------------------------------------------------------------------------------
|
||||
option(DISABLE_SETCAP "Do not set files capabilities")
|
||||
option(XDG_STD "Use XDG standard path instead of the standard PCSX2 path")
|
||||
option(CUBEB_API "Build Cubeb support on SPU2" ON)
|
||||
option(QT_BUILD "Build Qt frontend instead of wx" ON)
|
||||
option(QT_BUILD "Build Qt frontend" ON)
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
option(ENABLE_SETCAP "Enable networking capability for DEV9" OFF)
|
||||
option(USE_LEGACY_USER_DIRECTORY "Use legacy home/PCSX2 user directory instead of XDG standard" OFF)
|
||||
option(X11_API "Enable X11 support" ON)
|
||||
option(WAYLAND_API "Enable Wayland support" OFF)
|
||||
option(WAYLAND_API "Enable Wayland support" ON)
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
|
@ -104,12 +86,6 @@ if(CMAKE_CONFIGURATION_TYPES)
|
|||
endif()
|
||||
mark_as_advanced(CMAKE_C_FLAGS_DEVEL CMAKE_CXX_FLAGS_DEVEL CMAKE_LINKER_FLAGS_DEVEL CMAKE_SHARED_LINKER_FLAGS_DEVEL CMAKE_EXE_LINKER_FLAGS_DEVEL)
|
||||
|
||||
# Initially strip was disabled on release build but it is not stackstrace friendly!
|
||||
# It only cost several MB so disbable it by default
|
||||
option(CMAKE_BUILD_STRIP "Srip binaries to save a couple of MB (developer option)")
|
||||
|
||||
option(CMAKE_BUILD_PO "Build po files (modifies git-tracked files)" OFF)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Select the architecture
|
||||
#-------------------------------------------------------------------------------
|
||||
|
@ -289,18 +265,9 @@ endif()
|
|||
|
||||
set(PCSX2_WARNINGS ${DEFAULT_WARNINGS} ${AGGRESSIVE_WARNING})
|
||||
|
||||
if(CMAKE_BUILD_STRIP)
|
||||
add_link_options(-s)
|
||||
endif()
|
||||
|
||||
if(QT_BUILD)
|
||||
# We want the core PCSX2 library.
|
||||
set(PCSX2_CORE TRUE)
|
||||
endif()
|
||||
|
||||
# Enable special stuff for CI builds
|
||||
if("$ENV{CI}" STREQUAL "true")
|
||||
list(APPEND PCSX2_DEFS PCSX2_CI)
|
||||
if(DISABLE_BUILD_DATE)
|
||||
message(STATUS "Disabling the inclusion of the binary compile date.")
|
||||
list(APPEND PCSX2_DEFS DISABLE_BUILD_DATE)
|
||||
endif()
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
|
|
@ -51,7 +51,6 @@
|
|||
<PreprocessorDefinitions Condition="$(Configuration.Contains(Debug))">PCSX2_DEBUG;PCSX2_DEVBUILD;_SECURE_SCL_=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="$(Configuration.Contains(Devel))">PCSX2_DEVEL;PCSX2_DEVBUILD;NDEBUG;_SECURE_SCL_=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="$(Configuration.Contains(Release))">NDEBUG;_SECURE_SCL_=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(CI)'=='true'">PCSX2_CI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="!$(Configuration.Contains(AVX2))">_M_SSE=0x401;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="$(Configuration.Contains(AVX2))">_M_SSE=0x501;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<EnableEnhancedInstructionSet Condition="!$(Configuration.Contains(AVX2))">NotSet</EnableEnhancedInstructionSet>
|
||||
|
|
|
@ -4,12 +4,6 @@ set(CMAKE_AUTOUIC ON)
|
|||
|
||||
add_executable(pcsx2-qt)
|
||||
|
||||
if (PACKAGE_MODE)
|
||||
message(FATAL_ERROR "Package mode is not supported for Qt builds.")
|
||||
else()
|
||||
install(TARGETS pcsx2-qt DESTINATION ${CMAKE_SOURCE_DIR}/bin)
|
||||
endif()
|
||||
|
||||
target_sources(pcsx2-qt PRIVATE
|
||||
AboutDialog.cpp
|
||||
AboutDialog.h
|
||||
|
|
|
@ -56,7 +56,6 @@
|
|||
<PreprocessorDefinitions Condition="$(Configuration.Contains(Debug))">PCSX2_DEBUG;PCSX2_DEVBUILD;_SECURE_SCL_=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="$(Configuration.Contains(Devel))">PCSX2_DEVEL;PCSX2_DEVBUILD;NDEBUG;_SECURE_SCL_=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="$(Configuration.Contains(Release))">NDEBUG;_SECURE_SCL_=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(CI)'=='true'">PCSX2_CI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<!-- MSVC automatically adds __AVX__ and __AVX2__ appropriately -->
|
||||
<PreprocessorDefinitions>__SSE4_1__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<EnableEnhancedInstructionSet Condition="!$(Configuration.Contains(AVX2))">NotSet</EnableEnhancedInstructionSet>
|
||||
|
|
|
@ -13,12 +13,6 @@ target_compile_features(PCSX2_FLAGS INTERFACE cxx_std_17)
|
|||
target_compile_definitions(PCSX2_FLAGS INTERFACE "${PCSX2_DEFS}")
|
||||
target_compile_options(PCSX2_FLAGS INTERFACE "${PCSX2_WARNINGS}")
|
||||
|
||||
if (openSUSE)
|
||||
# openSUSE don't install wx in a standard library system
|
||||
# path. Let's bypass the dynamic linker and hardcode the path.
|
||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON)
|
||||
endif()
|
||||
|
||||
# Check that people use the good file
|
||||
if(NOT TOP_CMAKE_WAS_SOURCED)
|
||||
message(FATAL_ERROR "
|
||||
|
@ -39,7 +33,6 @@ else()
|
|||
-Wno-parentheses
|
||||
-Wno-missing-braces
|
||||
-Wno-unknown-pragmas
|
||||
-DWX_PRECOMP
|
||||
)
|
||||
endif()
|
||||
|
||||
|
@ -54,8 +47,8 @@ elseif("${PGO}" STREQUAL "use")
|
|||
target_compile_options(PCSX2_FLAGS INTERFACE -fprofile-use)
|
||||
endif()
|
||||
|
||||
if(XDG_STD)
|
||||
target_compile_definitions(PCSX2_FLAGS INTERFACE XDG_STD)
|
||||
if(USE_LEGACY_USER_DIRECTORY)
|
||||
target_compile_definitions(PCSX2_FLAGS INTERFACE USE_LEGACY_USER_DIRECTORY)
|
||||
endif()
|
||||
|
||||
if(TARGET SDL2::SDL2 OR TARGET SDL2::SDL2-static)
|
||||
|
@ -1297,6 +1290,7 @@ function(setup_main_executable target)
|
|||
${PCSX2_SOURCE_DIR}/windows/PCSX2.rc
|
||||
)
|
||||
set_target_properties(${target} PROPERTIES WIN32_EXECUTABLE TRUE)
|
||||
install(TARGETS ${target} DESTINATION ${CMAKE_SOURCE_DIR}/bin)
|
||||
if(MSVC)
|
||||
install(FILES $<TARGET_PDB_FILE:${target}> DESTINATION ${CMAKE_SOURCE_DIR}/bin)
|
||||
endif()
|
||||
|
@ -1368,11 +1362,17 @@ function(setup_main_executable target)
|
|||
)
|
||||
add_dependencies(pcsx2-postprocess-bundle ${target})
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
if(NOT DISABLE_SETCAP AND NOT WIN32)
|
||||
install(CODE "execute_process(COMMAND /bin/bash -c \"echo 'Enabling networking capability on Linux...';set -x; [ -f '${CMAKE_SOURCE_DIR}/bin/pcsx2' ] && sudo setcap 'CAP_NET_RAW+eip CAP_NET_ADMIN+eip' '${CMAKE_SOURCE_DIR}/bin/pcsx2'; set +x\")")
|
||||
if(ENABLE_SETCAP AND UNIX AND NOT APPLE)
|
||||
message(WARNING "Networking capabilities enabled, building will require temporary root elevation.")
|
||||
add_custom_target(
|
||||
pcsx2-enable-setcap
|
||||
ALL
|
||||
DEPENDS ${target}
|
||||
COMMAND bash -c "set +x\; echo 'Elevating to enable networking capability on $<TARGET_FILE:${target}>...'\; sudo setcap 'CAP_NET_RAW+eip CAP_NET_ADMIN+eip' '$<TARGET_FILE:${target}>'"
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
source_groups_from_vcxproj_filters(pcsx2core.vcxproj.filters)
|
||||
|
||||
|
|
|
@ -174,7 +174,7 @@ void CommonHost::SetDataDirectory()
|
|||
const char* home_dir = getenv("HOME");
|
||||
if (home_dir)
|
||||
{
|
||||
#ifndef XDG_STD
|
||||
#ifdef USE_LEGACY_USER_DIRECTORY
|
||||
EmuFolders::DataRoot = Path::Combine(home_dir, "PCSX2");
|
||||
#else
|
||||
// ~/.config should exist, but just in case it doesn't and this is a fresh profile..
|
||||
|
|
|
@ -63,7 +63,6 @@
|
|||
<PreprocessorDefinitions Condition="$(Configuration.Contains(Debug))">PCSX2_DEBUG;PCSX2_DEVBUILD;_SECURE_SCL_=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="$(Configuration.Contains(Devel))">PCSX2_DEVEL;PCSX2_DEVBUILD;NDEBUG;_SECURE_SCL_=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="$(Configuration.Contains(Release))">NDEBUG;_SECURE_SCL_=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(CI)'=='true'">PCSX2_CI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<!-- MSVC automatically adds __AVX__ and __AVX2__ appropriately -->
|
||||
<PreprocessorDefinitions>__SSE4_1__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Platform)'=='x64'">ZYCORE_STATIC_DEFINE;ZYDIS_STATIC_DEFINE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
|
|
Loading…
Reference in New Issue