diff --git a/.github/workflows/linux_build_qt.yml b/.github/workflows/linux_build_qt.yml index 5dabdb7cb3..b2259e57c6 100644 --- a/.github/workflows/linux_build_qt.yml +++ b/.github/workflows/linux_build_qt.yml @@ -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/ diff --git a/.github/workflows/scripts/linux/appimage-qt.sh b/.github/workflows/scripts/linux/appimage-qt.sh index ba149b6ba5..729c8d6372 100755 --- a/.github/workflows/scripts/linux/appimage-qt.sh +++ b/.github/workflows/scripts/linux/appimage-qt.sh @@ -25,16 +25,15 @@ # # For more information, please refer to -if [ "$#" -ne 3 ]; then - echo "Syntax: $0 " +if [ "$#" -ne 4 ]; then + echo "Syntax: $0 " 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 diff --git a/.github/workflows/scripts/linux/generate-cmake-qt.sh b/.github/workflows/scripts/linux/generate-cmake-qt.sh index 7aed1192ef..47de04eec0 100755 --- a/.github/workflows/scripts/linux/generate-cmake-qt.sh +++ b/.github/workflows/scripts/linux/generate-cmake-qt.sh @@ -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 \ diff --git a/CMakeLists.txt b/CMakeLists.txt index 4059d9e729..35622ee3c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/cmake/BuildParameters.cmake b/cmake/BuildParameters.cmake index 7a507344ba..a402ab8834 100644 --- a/cmake/BuildParameters.cmake +++ b/cmake/BuildParameters.cmake @@ -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() #------------------------------------------------------------------------------- diff --git a/pcsx2-gsrunner/pcsx2-gsrunner.vcxproj b/pcsx2-gsrunner/pcsx2-gsrunner.vcxproj index 64cc51939d..4150d73db2 100644 --- a/pcsx2-gsrunner/pcsx2-gsrunner.vcxproj +++ b/pcsx2-gsrunner/pcsx2-gsrunner.vcxproj @@ -51,7 +51,6 @@ PCSX2_DEBUG;PCSX2_DEVBUILD;_SECURE_SCL_=1;%(PreprocessorDefinitions) PCSX2_DEVEL;PCSX2_DEVBUILD;NDEBUG;_SECURE_SCL_=1;%(PreprocessorDefinitions) NDEBUG;_SECURE_SCL_=0;%(PreprocessorDefinitions) - PCSX2_CI;%(PreprocessorDefinitions) _M_SSE=0x401;%(PreprocessorDefinitions) _M_SSE=0x501;%(PreprocessorDefinitions) NotSet diff --git a/pcsx2-qt/CMakeLists.txt b/pcsx2-qt/CMakeLists.txt index 7e822cb2af..20590de615 100644 --- a/pcsx2-qt/CMakeLists.txt +++ b/pcsx2-qt/CMakeLists.txt @@ -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 diff --git a/pcsx2-qt/pcsx2-qt.vcxproj b/pcsx2-qt/pcsx2-qt.vcxproj index c730d44b47..b3a2c42397 100644 --- a/pcsx2-qt/pcsx2-qt.vcxproj +++ b/pcsx2-qt/pcsx2-qt.vcxproj @@ -56,7 +56,6 @@ PCSX2_DEBUG;PCSX2_DEVBUILD;_SECURE_SCL_=1;%(PreprocessorDefinitions) PCSX2_DEVEL;PCSX2_DEVBUILD;NDEBUG;_SECURE_SCL_=1;%(PreprocessorDefinitions) NDEBUG;_SECURE_SCL_=0;%(PreprocessorDefinitions) - PCSX2_CI;%(PreprocessorDefinitions) __SSE4_1__;%(PreprocessorDefinitions) NotSet diff --git a/pcsx2/CMakeLists.txt b/pcsx2/CMakeLists.txt index a1f79c5872..dde6f5c7da 100644 --- a/pcsx2/CMakeLists.txt +++ b/pcsx2/CMakeLists.txt @@ -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 $ 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\")") -endif() + 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 $...'\; sudo setcap 'CAP_NET_RAW+eip CAP_NET_ADMIN+eip' '$'" + ) + endif() +endfunction() source_groups_from_vcxproj_filters(pcsx2core.vcxproj.filters) diff --git a/pcsx2/Frontend/CommonHost.cpp b/pcsx2/Frontend/CommonHost.cpp index ab992e4832..9da1dafd9d 100644 --- a/pcsx2/Frontend/CommonHost.cpp +++ b/pcsx2/Frontend/CommonHost.cpp @@ -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.. diff --git a/pcsx2/pcsx2core.vcxproj b/pcsx2/pcsx2core.vcxproj index fcd2116a85..f517457b55 100644 --- a/pcsx2/pcsx2core.vcxproj +++ b/pcsx2/pcsx2core.vcxproj @@ -63,7 +63,6 @@ PCSX2_DEBUG;PCSX2_DEVBUILD;_SECURE_SCL_=1;%(PreprocessorDefinitions) PCSX2_DEVEL;PCSX2_DEVBUILD;NDEBUG;_SECURE_SCL_=1;%(PreprocessorDefinitions) NDEBUG;_SECURE_SCL_=0;%(PreprocessorDefinitions) - PCSX2_CI;%(PreprocessorDefinitions) __SSE4_1__;%(PreprocessorDefinitions) ZYCORE_STATIC_DEFINE;ZYDIS_STATIC_DEFINE;%(PreprocessorDefinitions)