1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-02 09:02:03 +02:00

Update vcpkg, fix QT paths

This commit is contained in:
Andrii Danylchenko 2022-09-20 11:50:47 +03:00 committed by Andrii Danylchenko
parent 2b0f02c832
commit 735c4f149a
4 changed files with 49 additions and 58 deletions

View File

@ -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

View File

@ -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)

View File

@ -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)

43
win/CMakeLists.txt Normal file
View File

@ -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)