Skip to content

Commit

Permalink
[vcpkg-cmake] Fix windows toolchain chainloading for uwp (#21857)
Browse files Browse the repository at this point in the history
* Fix uwp toolchain chainloading

* Use common definitions

* Update versions

* [netcdf-c] Fix uwp compiler flags

* Update versions

* [skip actions] CI

Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
  • Loading branch information
dg0yt and BillyONeal authored Dec 10, 2021
1 parent f315dea commit 207af1c
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 21 deletions.
4 changes: 2 additions & 2 deletions ports/netcdf-c/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ if(ENABLE_HDF5)
endif()

if(VCPKG_TARGET_IS_UWP)
set(ENV{CFLAGS} "$ENV{CFLAGS} /wd4996 /wd4703")
set(ENV{CXXFLAGS} "$ENV{CXXFLAGS} /wd4996 /wd4703")
string(APPEND VCPKG_C_FLAGS " /wd4996 /wd4703")
string(APPEND VCPKG_CXX_FLAGS " /wd4996 /wd4703")
endif()

vcpkg_cmake_configure(
Expand Down
1 change: 1 addition & 0 deletions ports/netcdf-c/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "netcdf-c",
"version": "4.8.1",
"port-version": 1,
"description": "A set of self-describing, machine-independent data formats that support the creation, access, and sharing of array-oriented scientific data.",
"homepage": "https://github.com/Unidata/netcdf-c",
"dependencies": [
Expand Down
2 changes: 1 addition & 1 deletion ports/vcpkg-cmake/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"name": "vcpkg-cmake",
"version-date": "2021-09-13"
"version-date": "2021-12-05"
}
28 changes: 12 additions & 16 deletions ports/vcpkg-cmake/vcpkg_cmake_configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,11 @@ function(vcpkg_cmake_configure)
set(ninja_can_be_used ON) # Ninja as generator
set(ninja_host ON) # Ninja as parallel configurator

if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
set(targetting_uwp ON)
endif()

if(host_architecture STREQUAL "x86")
# Prebuilt ninja binaries are only provided for x64 hosts
set(ninja_can_be_used OFF)
set(ninja_host OFF)
elseif(targetting_uwp)
elseif(VCPKG_TARGET_IS_UWP)
# Ninja and MSBuild have many differences when targetting UWP, so use MSBuild to maximize existing compatibility
set(ninja_can_be_used OFF)
endif()
Expand Down Expand Up @@ -247,9 +243,9 @@ function(vcpkg_cmake_configure)

if(DEFINED VCPKG_CMAKE_SYSTEM_NAME)
list(APPEND arg_OPTIONS "-DCMAKE_SYSTEM_NAME=${VCPKG_CMAKE_SYSTEM_NAME}")
if(targetting_uwp AND NOT DEFINED VCPKG_CMAKE_SYSTEM_VERSION)
if(VCPKG_TARGET_IS_UWP AND NOT DEFINED VCPKG_CMAKE_SYSTEM_VERSION)
set(VCPKG_CMAKE_SYSTEM_VERSION 10.0)
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Android" AND NOT DEFINED VCPKG_CMAKE_SYSTEM_VERSION)
elseif(VCPKG_TARGET_IS_ANDROID AND NOT DEFINED VCPKG_CMAKE_SYSTEM_VERSION)
set(VCPKG_CMAKE_SYSTEM_VERSION 21)
endif()
endif()
Expand Down Expand Up @@ -278,22 +274,22 @@ function(vcpkg_cmake_configure)
endif()

if(NOT DEFINED VCPKG_CHAINLOAD_TOOLCHAIN_FILE)
if(NOT DEFINED VCPKG_CMAKE_SYSTEM_NAME OR _TARGETTING_UWP)
if(VCPKG_TARGET_IS_MINGW)
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/mingw.cmake")
elseif(VCPKG_TARGET_IS_WINDOWS)
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/windows.cmake")
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux")
elseif(VCPKG_TARGET_IS_LINUX)
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/linux.cmake")
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Android")
elseif(VCPKG_TARGET_IS_ANDROID)
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/android.cmake")
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Darwin")
elseif(VCPKG_TARGET_IS_OSX)
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/osx.cmake")
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "iOS")
elseif(VCPKG_TARGET_IS_IOS)
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/ios.cmake")
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
elseif(VCPKG_TARGET_IS_FREEBSD)
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/freebsd.cmake")
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
elseif(VCPKG_TARGET_IS_OPENBSD)
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/openbsd.cmake")
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "MinGW")
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/mingw.cmake")
endif()
endif()

Expand Down
4 changes: 2 additions & 2 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -4674,7 +4674,7 @@
},
"netcdf-c": {
"baseline": "4.8.1",
"port-version": 0
"port-version": 1
},
"netcdf-cxx4": {
"baseline": "4.3.1",
Expand Down Expand Up @@ -7093,7 +7093,7 @@
"port-version": 1
},
"vcpkg-cmake": {
"baseline": "2021-09-13",
"baseline": "2021-12-05",
"port-version": 0
},
"vcpkg-cmake-config": {
Expand Down
5 changes: 5 additions & 0 deletions versions/n-/netcdf-c.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "9d8a0a97fd75563172e3f1947608db3802c3b84a",
"version": "4.8.1",
"port-version": 1
},
{
"git-tree": "7e6529a5673ac8494b62443a9fab590ce6810826",
"version": "4.8.1",
Expand Down
5 changes: 5 additions & 0 deletions versions/v-/vcpkg-cmake.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "462dd9ada82163b8c104cef8c2ad5b5c0bfa5eb8",
"version-date": "2021-12-05",
"port-version": 0
},
{
"git-tree": "fc4d9fcc5b8d2b97c083c6b70dd06df5174bd97b",
"version-date": "2021-09-13",
Expand Down

0 comments on commit 207af1c

Please sign in to comment.