From b23d463652da94579381be5a00c12909704cfb04 Mon Sep 17 00:00:00 2001 From: Rafael Kitover Date: Fri, 14 Aug 2020 11:15:01 +0000 Subject: [PATCH] Use vcpkg installed wxrc, support mingw triplet. Use the vcpkg installed wxrc, from a tools subdirectory, instead of copying it out of the build tree. Except when running on appveyor, for some reason the vcpkg wxrc does not work there, so use our own from the dependencies submodule. Support vcpkg mingw triplets, they don't work yet however. Signed-off-by: Rafael Kitover --- cmake/Set-Toolchain-vcpkg.cmake | 14 ++++++++++---- dependencies | 2 +- src/wx/CMakeLists.txt | 18 +++++------------- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/cmake/Set-Toolchain-vcpkg.cmake b/cmake/Set-Toolchain-vcpkg.cmake index c96207e7..c66457ea 100644 --- a/cmake/Set-Toolchain-vcpkg.cmake +++ b/cmake/Set-Toolchain-vcpkg.cmake @@ -184,10 +184,16 @@ function(vcpkg_set_toolchain) set(CMAKE_GENERATOR_PLATFORM x64 CACHE STRING "visual studio build architecture" FORCE) endif() - if(WIN32 AND (NOT CMAKE_GENERATOR MATCHES "Visual Studio")) - # set toolchain to VS for e.g. Ninja or jom - set(CMAKE_C_COMPILER cl CACHE STRING "Microsoft C/C++ Compiler" FORCE) - set(CMAKE_CXX_COMPILER cl CACHE STRING "Microsoft C/C++ Compiler" FORCE) + if(WIN32 AND NOT CMAKE_GENERATOR MATCHES "Visual Studio") + if(VCPKG_TARGET_TRIPLET MATCHES "^x[68][46]-windows-") + # set toolchain to VS for e.g. Ninja or jom + set(CMAKE_C_COMPILER cl CACHE STRING "Microsoft C/C++ Compiler" FORCE) + set(CMAKE_CXX_COMPILER cl CACHE STRING "Microsoft C/C++ Compiler" FORCE) + elseif(VCPKG_TARGET_TRIPLET MATCHES "^x[68][46]-mingw-") + # set toolchain to MinGW for e.g. Ninja or jom + set(CMAKE_C_COMPILER gcc CACHE STRING "MinGW GCC C Compiler" FORCE) + set(CMAKE_CXX_COMPILER g++ CACHE STRING "MinGW G++ C++ Compiler" FORCE) + endif() endif() set(CMAKE_TOOLCHAIN_FILE ${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake CACHE FILEPATH "vcpkg toolchain" FORCE) diff --git a/dependencies b/dependencies index 605765f5..a39ddbb9 160000 --- a/dependencies +++ b/dependencies @@ -1 +1 @@ -Subproject commit 605765f55dccc515a9b3b934a7718321f14e3d56 +Subproject commit a39ddbb983b6ca42bd328f4eb3119b1d507f1019 diff --git a/src/wx/CMakeLists.txt b/src/wx/CMakeLists.txt index b6fa48df..71b745c5 100644 --- a/src/wx/CMakeLists.txt +++ b/src/wx/CMakeLists.txt @@ -163,21 +163,13 @@ if(WIN32 AND CMAKE_TOOLCHAIN_FILE MATCHES vcpkg AND (X86_32 OR AMD64)) ) endif() - if(NOT EXISTS ${installed_prefix}/bin/wxrc.exe) - # Need to copy both the release and debug versions out of the build tree, because - # appveyor does not cache the build trees. - file( - COPY ${build_prefix_rel}/lib/wxrc.exe - DESTINATION ${common_prefix}/bin - ) - file( - COPY ${build_prefix_dbg}/lib/wxrc.exe - DESTINATION ${dbg_prefix}/bin - ) + if(DEFINED ENV{APPVEYOR}) + # For some reason, the vcpkg built wxrc fails on appveyor. + set(WXRC ${CMAKE_SOURCE_DIR}/dependencies/wxrc.exe) + else() + set(WXRC ${common_prefix}/tools/wxwidgets/wxrc.exe) endif() - set(WXRC ${installed_prefix}/bin/wxrc.exe) - if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/zip.exe) # get zip binary for wxrc file(DOWNLOAD "https://www.willus.com/archive/zip64/infozip_binaries_win32.zip" ${CMAKE_CURRENT_BINARY_DIR}/infozip_binaries_win32.zip)