@@ -14,7 +14,18 @@ if(WIN32)
1414 set (PLATFORM WINDOWS)
1515 # The vcpkg target triplet has to be set BEFORE the project() function
1616 # of CMake!
17- set (VCPKG_TARGET_TRIPLET x64-windows-static )
17+ if (DEFINED ENV{WIN_ARCH})
18+ # The cibuildwheel tool builds wheel files for both 32- and 64-Bit
19+ # Windows, therefore the vcpkg target triplet needs to be switched
20+ # accordingly.
21+ if ($ENV{WIN_ARCH} STREQUAL "x86" )
22+ set (VCPKG_TARGET_TRIPLET x86-windows-static )
23+ elseif ($ENV{WIN_ARCH} STREQUAL "x64" )
24+ set (VCPKG_TARGET_TRIPLET x64-windows-static )
25+ endif ()
26+ else ()
27+ message (FATAL_ERROR "WIN_ARCH environment variable is not defined" )
28+ endif ()
1829elseif (APPLE )
1930 # On macOS it is necessary to set an environment variable called ARCH with the
2031 # arch (either x86_64 or arm64) of your Mac
@@ -47,7 +58,7 @@ if (${PLATFORM} STREQUAL "WINDOWS")
4758 set_target_properties (opengl32 PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR} /pre-built/windows/libx64/OpenGL32.Lib)
4859
4960 set (LIB_DIR
50- ${CMAKE_SOURCE_DIR} /vcpkg_installed/x64 -windows-static /lib
61+ ${CMAKE_SOURCE_DIR} /vcpkg_installed/${VCPKG_TARGET_TRIPLET} -windows-static /lib
5162 ${CMAKE_SOURCE_DIR} /pre-built/windows/libx64
5263 )
5364 set (ALL_COMPILER_ARGS
@@ -56,7 +67,7 @@ if (${PLATFORM} STREQUAL "WINDOWS")
5667 /std:c++17
5768 )
5869 set (OS_SPECIFIC_INCLUDES
59- vcpkg_installed/x64 -windows-static /include
70+ vcpkg_installed/${VCPKG_TARGET_TRIPLET} -windows-static /include
6071 )
6172 set (OS_SPECIFIC_LIBRARY_NAMES
6273 Advapi32 Ws2_32 glew32 freetype libpng16 libxml2 opengl32 netCDF::netcdf
0 commit comments