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 <rkitover@gmail.com>
This commit is contained in:
Rafael Kitover
2020-08-14 11:15:01 +00:00
parent 08b5685049
commit b23d463652
3 changed files with 16 additions and 18 deletions

View File

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

View File

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