From 735c4f149a8e6a00aceeb557c3b60c884d911d3f Mon Sep 17 00:00:00 2001 From: Andrii Danylchenko Date: Tue, 20 Sep 2022 11:50:47 +0300 Subject: [PATCH] Update vcpkg, fix QT paths --- CI/msvc/before_install.sh | 5 +++- CMakeLists.txt | 1 + osx/CMakeLists.txt | 58 +-------------------------------------- win/CMakeLists.txt | 43 +++++++++++++++++++++++++++++ 4 files changed, 49 insertions(+), 58 deletions(-) create mode 100644 win/CMakeLists.txt diff --git a/CI/msvc/before_install.sh b/CI/msvc/before_install.sh index 9ee5d77e8..c80aaf4d7 100644 --- a/CI/msvc/before_install.sh +++ b/CI/msvc/before_install.sh @@ -1,7 +1,10 @@ curl -LfsS -o "vcpkg-export-${VCMI_BUILD_PLATFORM}-windows-v140.7z" \ - "https://github.com/vcmi/vcmi-deps-windows/releases/download/v1.4/vcpkg-export-${VCMI_BUILD_PLATFORM}-windows-v140.7z" + "https://github.com/vcmi/vcmi-deps-windows/releases/download/v1.5/vcpkg-export-${VCMI_BUILD_PLATFORM}-windows-v140.7z" 7z x "vcpkg-export-${VCMI_BUILD_PLATFORM}-windows-v140.7z" rm -r -f vcpkg/installed/${VCMI_BUILD_PLATFORM}-windows/debug mkdir -p vcpkg/installed/${VCMI_BUILD_PLATFORM}-windows/debug/bin cp vcpkg/installed/${VCMI_BUILD_PLATFORM}-windows/bin/* vcpkg/installed/${VCMI_BUILD_PLATFORM}-windows/debug/bin + +DUMPBIN_DIR=$(vswhere -latest -find **/dumpbin.exe | head -n 1) +dirname "$DUMPBIN_DIR" > $GITHUB_PATH \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d7e99df3..472a65cef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -488,6 +488,7 @@ if(WIN32) # Use BundleUtilities to fix build when Vcpkg is used and disable it for MXE if(NOT (${CMAKE_CROSSCOMPILING})) add_subdirectory(osx) + add_subdirectory(win) endif() elseif(APPLE AND NOT ENABLE_MONOLITHIC_INSTALL) set(CPACK_MONOLITHIC_INSTALL 1) diff --git a/osx/CMakeLists.txt b/osx/CMakeLists.txt index 9c0057da9..91d343074 100644 --- a/osx/CMakeLists.txt +++ b/osx/CMakeLists.txt @@ -58,60 +58,4 @@ if(APPLE) ) endforeach() ") -endif(APPLE) - -# This will likely only work for Vcpkg -if(WIN32) - if(ENABLE_LAUNCHER) - # Temporary ugly fix for Qt deployment since windeployqt broken in Vcpkg - - #there are some weird issues with variables used in path not evaluated properly when trying to remove code duplication from below lines - if(EXISTS ${CMAKE_BINARY_DIR}/../../vcpkg) #current path to vcpkg main folder on appveyor CI - if(CMAKE_SIZEOF_VOID_P EQUAL 8) #64 bit build - install(CODE " - file(COPY ${CMAKE_BINARY_DIR}/../../vcpkg/installed/x64-windows/plugins/bearer DESTINATION \${CMAKE_INSTALL_PREFIX}) - file(COPY ${CMAKE_BINARY_DIR}/../../vcpkg/installed/x64-windows/plugins/iconengines DESTINATION \${CMAKE_INSTALL_PREFIX}) - file(COPY ${CMAKE_BINARY_DIR}/../../vcpkg/installed/x64-windows/plugins/imageformats DESTINATION \${CMAKE_INSTALL_PREFIX}) - file(COPY ${CMAKE_BINARY_DIR}/../../vcpkg/installed/x64-windows/plugins/platforminputcontexts DESTINATION \${CMAKE_INSTALL_PREFIX}) - file(COPY ${CMAKE_BINARY_DIR}/../../vcpkg/installed/x64-windows/plugins/platforms DESTINATION \${CMAKE_INSTALL_PREFIX}) - ") - else() - install(CODE " - file(COPY ${CMAKE_BINARY_DIR}/../../vcpkg/installed/x86-windows/plugins/bearer DESTINATION \${CMAKE_INSTALL_PREFIX}) - file(COPY ${CMAKE_BINARY_DIR}/../../vcpkg/installed/x86-windows/plugins/iconengines DESTINATION \${CMAKE_INSTALL_PREFIX}) - file(COPY ${CMAKE_BINARY_DIR}/../../vcpkg/installed/x86-windows/plugins/imageformats DESTINATION \${CMAKE_INSTALL_PREFIX}) - file(COPY ${CMAKE_BINARY_DIR}/../../vcpkg/installed/x86-windows/plugins/platforminputcontexts DESTINATION \${CMAKE_INSTALL_PREFIX}) - file(COPY ${CMAKE_BINARY_DIR}/../../vcpkg/installed/x86-windows/plugins/platforms DESTINATION \${CMAKE_INSTALL_PREFIX}) - ") - endif() - else() #not appveyor build - lines below do not work properly - install(CODE " - execute_process( - COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/bin/\${BUILD_TYPE}/bearer \${CMAKE_INSTALL_PREFIX}/bearer - COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/bin/\${BUILD_TYPE}/iconengines \${CMAKE_INSTALL_PREFIX}/iconengines - COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/bin/\${BUILD_TYPE}/imageformats \${CMAKE_INSTALL_PREFIX}/imageformats - COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/bin/\${BUILD_TYPE}/platforminputcontexts \${CMAKE_INSTALL_PREFIX}/platforminputcontexts - COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/bin/\${BUILD_TYPE}/platforms \${CMAKE_INSTALL_PREFIX}/platforms) - ") - endif() - endif() - - - #TODO: check if some equivalent of block below can be used for above block (easy qt dependencies copy) - if(ENABLE_LUA) - install_vcpkg_imported_tgt(luajit::luajit) - endif() - - #LuaJIT will not be copied automatically by not meeting criteria for this block of code - install(CODE " - if(\"\${BUILD_TYPE}\" STREQUAL \"Debug\") - set(dirs \"${CMAKE_PREFIX_PATH}/debug/bin/\") - else() - set(dirs \"${CMAKE_PREFIX_PATH}/bin/\") - endif() - set(BU_CHMOD_BUNDLE_ITEMS ON) - include(BundleUtilities) - fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/VCMI_Client.exe\" \"\" \"\${dirs}\") - - " COMPONENT Runtime) -endif(WIN32) +endif(APPLE) \ No newline at end of file diff --git a/win/CMakeLists.txt b/win/CMakeLists.txt new file mode 100644 index 000000000..bf3ab9922 --- /dev/null +++ b/win/CMakeLists.txt @@ -0,0 +1,43 @@ +# We need to keep this code into separate directory so CMake will execute it after all other subdirectories install code +# Otherwise we can't fix win bundle dependencies since binaries wouldn't be there when this code executed +# This will likely only work for Vcpkg +if(WIN32) + #there are some weird issues with variables used in path not evaluated properly when trying to remove code duplication from below lines + + if(ENABLE_LAUNCHER) + install(CODE " + file(WRITE \"\${CMAKE_INSTALL_PREFIX}/qt.conf\" + \"[Paths]\nPlugins = .\" + ) + ") + endif() + + + #TODO: check if some equivalent of block below can be used for above block (easy qt dependencies copy) + #LuaJIT will not be copied automatically by not meeting criteria for this block of code + if(ENABLE_LUA) + install_vcpkg_imported_tgt(luajit::luajit) + endif() + + if(MSVC) + set(gp_tool "dumpbin") + endif() + + install(CODE " + set(dirs \"${CMAKE_PREFIX_PATH}\") + if(\"\${CMAKE_INSTALL_CONFIG_NAME}\" STREQUAL \"Debug\") + list(TRANSFORM dirs APPEND \"/debug/bin\") + else() + list(TRANSFORM dirs APPEND \"/bin\") + list(FILTER dirs EXCLUDE REGEX \".*debug.*\") + endif() + + set(BU_CHMOD_BUNDLE_ITEMS ON) + set(gp_tool \"${gp_tool}\") + + include(BundleUtilities) + + fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/VCMI_Client.exe\" \"\" \"\${dirs}\") + + " COMPONENT Runtime) +endif(WIN32)