From f37fd29fd08df27bc5f3e75beea35d9c754204c6 Mon Sep 17 00:00:00 2001 From: TellowKrinkle Date: Sun, 28 Aug 2022 13:11:22 -0500 Subject: [PATCH] CMake:Windows: Add install step --- .github/workflows/windows_build_qt.yml | 10 +--------- CMakeLists.txt | 3 +-- pcsx2/CMakeLists.txt | 17 ++++++++++++++--- updater/CMakeLists.txt | 7 +++++++ 4 files changed, 23 insertions(+), 14 deletions(-) diff --git a/.github/workflows/windows_build_qt.yml b/.github/workflows/windows_build_qt.yml index b21774ff87..b7cc86668e 100644 --- a/.github/workflows/windows_build_qt.yml +++ b/.github/workflows/windows_build_qt.yml @@ -100,15 +100,7 @@ jobs: if "${{ inputs.configuration }}"=="CMake" ( call "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat" cmake --build build --config Release || exit /b - copy build\pcsx2-qt\pcsx2-qt.* bin - copy build\updater\updater.* bin - del bin\*.manifest - for %%F in (Qt6Core Qt6Gui Qt6Widgets Qt6Network Qt6Svg Qt6Concurrent) do copy "${{ inputs.qt_dir }}\bin\%%F.dll" bin - xcopy /s ${{ inputs.qt_dir }}\plugins\*.dll bin\QtPlugins\ - for /r bin\QtPlugins\ %%F in (*.dll) do if exist "%%~dpnFd.dll" del "%%~dpnFd.dll" - xcopy /s /i ${{ inputs.qt_dir }}\translations bin\translations - echo [Paths]> bin\qt.conf - echo Plugins = ./QtPlugins>> bin\qt.conf + cmake --install build --config Release || exit /b ) else ( msbuild "PCSX2_qt.sln" /m /v:m /p:Configuration="${{ inputs.configuration }}" /p:Platform="${{ inputs.platform }}" ) diff --git a/CMakeLists.txt b/CMakeLists.txt index 91a2c67569..935fa5a2ac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -76,8 +76,7 @@ if(PACKAGE_MODE) if(NOT DISABLE_PCSX2_WRAPPER) INSTALL(FILES "${CMAKE_SOURCE_DIR}/linux_various/PCSX2-linux.sh" DESTINATION "${CMAKE_INSTALL_BINDIR}") endif() - -else() +elseif(NOT WIN32) if(NOT DISABLE_PCSX2_WRAPPER) # special case to avoid having linux files in windows INSTALL(FILES "${CMAKE_SOURCE_DIR}/linux_various/PCSX2-linux.sh" DESTINATION "${CMAKE_SOURCE_DIR}/bin") diff --git a/pcsx2/CMakeLists.txt b/pcsx2/CMakeLists.txt index 6ae8e2cb76..db8005b096 100644 --- a/pcsx2/CMakeLists.txt +++ b/pcsx2/CMakeLists.txt @@ -1841,6 +1841,11 @@ function(setup_main_executable target) get_property(PCSX2_SOURCE_DIR GLOBAL PROPERTY PCSX2_SOURCE_DIR) get_property(PCSX2_METAL_SHADERS GLOBAL PROPERTY PCSX2_METAL_SHADERS) + if(QT_BUILD) + get_target_property(MOC_EXECUTABLE_LOCATION Qt6::moc IMPORTED_LOCATION) + get_filename_component(QT_BINARY_DIRECTORY "${MOC_EXECUTABLE_LOCATION}" DIRECTORY) + endif() + if(WIN32) if(NOT PCSX2_CORE) target_sources(${target} PRIVATE @@ -1857,6 +1862,14 @@ function(setup_main_executable target) ${PCSX2_SOURCE_DIR}/windows/PCSX2.manifest ) set_target_properties(${target} PROPERTIES WIN32_EXECUTABLE TRUE) + if(MSVC) + install(FILES $ DESTINATION ${CMAKE_SOURCE_DIR}/bin) + endif() + if(QT_BUILD) + find_program(WINDEPLOYQT_EXE windeployqt HINTS "${QT_BINARY_DIRECTORY}") + install(CODE "execute_process(COMMAND \"${WINDEPLOYQT_EXE}\" \"${CMAKE_SOURCE_DIR}/bin/pcsx2-qt.exe\" --plugindir ${CMAKE_SOURCE_DIR}/bin/QtPlugins --no-compiler-runtime --no-system-d3d-compiler)") + install(CODE "file(WRITE \"${CMAKE_SOURCE_DIR}/bin/qt.conf\" \"[Paths]\\nPlugins = ./QtPlugins\")") + endif() endif() if(APPLE) @@ -1917,8 +1930,6 @@ function(setup_main_executable target) endif() if(QT_BUILD) - get_target_property(MOC_EXECUTABLE_LOCATION Qt6::moc IMPORTED_LOCATION) - get_filename_component(QT_BINARY_DIRECTORY "${MOC_EXECUTABLE_LOCATION}" DIRECTORY) find_program(MACDEPLOYQT_EXE macdeployqt HINTS "${QT_BINARY_DIRECTORY}") add_custom_target(pcsx2-postprocess-bundle ${postprocessBundleType} COMMAND "${MACDEPLOYQT_EXE}" "$/../.." -no-strip @@ -1937,7 +1948,7 @@ if (NOT QT_BUILD) setup_main_executable(PCSX2) endif() -if(NOT DISABLE_SETCAP AND NOT PCSX2_CORE) +if(NOT DISABLE_SETCAP AND NOT PCSX2_CORE AND NOT WIN32) if(PACKAGE_MODE) install(CODE "execute_process(COMMAND /bin/bash -c \"echo 'Enabling networking capability on Linux...';set -x; [ -f '${CMAKE_INSTALL_FULL_BINDIR}/pcsx2' ] && sudo setcap 'CAP_NET_RAW+eip CAP_NET_ADMIN+eip' '${CMAKE_INSTALL_FULL_BINDIR}/pcsx2'; set +x\")") else() diff --git a/updater/CMakeLists.txt b/updater/CMakeLists.txt index 3a8d0e3e87..94368051d5 100644 --- a/updater/CMakeLists.txt +++ b/updater/CMakeLists.txt @@ -21,3 +21,10 @@ if(WIN32) ) set_target_properties(updater PROPERTIES WIN32_EXECUTABLE TRUE) endif() + +if(NOT PACKAGE_MODE) + install(TARGETS updater DESTINATION ${CMAKE_SOURCE_DIR}/bin) + if(MSVC) + install(FILES $ DESTINATION ${CMAKE_SOURCE_DIR}/bin) + endif() +endif()