Skip to content

Commit

Permalink
[Fix uwp toolchain|world rebuild] make ninja work for uwp (#22831)
Browse files Browse the repository at this point in the history
  • Loading branch information
Neumann-A authored Apr 28, 2022
1 parent e9d2b4c commit 05c93c5
Show file tree
Hide file tree
Showing 37 changed files with 250 additions and 128 deletions.
3 changes: 0 additions & 3 deletions ports/boost-modular-build-helper/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,7 @@ if(VCPKG_DETECTED_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
list(TRANSFORM libpath_args PREPEND "/AI\"")
list(TRANSFORM libpath_args APPEND "\"")
list(JOIN libpath_args " " libpath_arg)

string(APPEND CXXFLAGS " /ZW")
string(APPEND COMPILEFLAGS " ${libpath_arg} /D_WIN32_WINNT=0x0A00")
string(APPEND CFLAGS " -Zl")
list(APPEND B2_OPTIONS windows-api=store)
list(APPEND B2_OPTIONS linkflags=WindowsApp.lib)
endif()
Expand Down
1 change: 1 addition & 0 deletions ports/boost-modular-build-helper/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "boost-modular-build-helper",
"version": "1.79.0",
"port-version": 1,
"description": "Internal vcpkg port used to build Boost libraries",
"license": "MIT",
"dependencies": [
Expand Down
20 changes: 12 additions & 8 deletions ports/cpprestsdk/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,13 @@ vcpkg_check_features(
websockets CPPREST_EXCLUDE_WEBSOCKETS
)

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}/Release
PREFER_NINJA
if(VCPKG_TARGET_IS_UWP)
set(configure_opts WINDOWS_USE_MSBUILD)
endif()

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}/Release"
${configure_opts}
OPTIONS
${OPTIONS}
${FEATURE_OPTIONS}
Expand All @@ -38,16 +42,16 @@ vcpkg_configure_cmake(
-DCPPREST_INSTALL_HEADERS=OFF
)

vcpkg_install_cmake()
vcpkg_cmake_install()

vcpkg_copy_pdbs()

vcpkg_fixup_cmake_targets(CONFIG_PATH lib/share/${PORT})
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/share ${CURRENT_PACKAGES_DIR}/lib/share)
vcpkg_cmake_config_fixup(CONFIG_PATH "lib/share/${PORT}")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/lib/share" "${CURRENT_PACKAGES_DIR}/lib/share")

if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/include/cpprest/details/cpprest_compat.h
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/cpprest/details/cpprest_compat.h"
"#ifdef _NO_ASYNCRTIMP" "#if 1")
endif()

file(INSTALL ${SOURCE_PATH}/license.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(INSTALL "${SOURCE_PATH}/license.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
11 changes: 10 additions & 1 deletion ports/cpprestsdk/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "cpprestsdk",
"version-string": "2.10.18",
"version": "2.10.18",
"port-version": 1,
"description": [
"C++11 JSON, REST, and OAuth library",
"The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services."
Expand Down Expand Up @@ -42,6 +43,14 @@
{
"name": "openssl",
"platform": "!uwp & !windows"
},
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
],
"default-features": [
Expand Down
3 changes: 2 additions & 1 deletion ports/igraph/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"name": "igraph",
"version": "0.9.8",
"port-version": 1,
"port-version": 2,
"description": "igraph is a C library for network analysis and graph theory, with an emphasis on efficiency portability and ease of use.",
"homepage": "https://igraph.org/",
"license": "GPL-2.0-or-later",
"supports": "!uwp",
"dependencies": [
"blas",
"lapack",
Expand Down
16 changes: 10 additions & 6 deletions ports/libcerf/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,22 @@ vcpkg_extract_source_archive_ex(
PATCHES 001-fix-static-build.patch
)

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
if(VCPKG_TARGET_IS_UWP)
set(configure_opts WINDOWS_USE_MSBUILD)
endif()

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
${configure_opts}
OPTIONS
-DCERF_CPP=ON
-DLIB_MAN=OFF
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
)

vcpkg_install_cmake()
vcpkg_cmake_install()

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libcerf RENAME copyright)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/libcerf" RENAME copyright)

vcpkg_fixup_pkgconfig()
12 changes: 9 additions & 3 deletions ports/libcerf/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
{
"name": "libcerf",
"version-string": "1.13",
"port-version": 2,
"version": "1.13",
"port-version": 3,
"description": "A self-contained numeric library that provides an efficient and accurate implementation of complex error functions, along with Dawson, Faddeeva, and Voigt functions.",
"homepage": "https://jugit.fz-juelich.de/mlz/libcerf"
"homepage": "https://jugit.fz-juelich.de/mlz/libcerf",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
}
]
}
13 changes: 6 additions & 7 deletions ports/liblbfgs/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@ vcpkg_from_github(

message(STATUS "source path is : ${SOURCE_PATH}")

file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFIX_NINJA
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
)
vcpkg_install_cmake()
vcpkg_cmake_install()
vcpkg_copy_pdbs()

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")

file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/liblbfgs RENAME copyright)
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/liblbfgs" RENAME copyright)
12 changes: 9 additions & 3 deletions ports/liblbfgs/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
{
"name": "liblbfgs",
"version-string": "1.10",
"port-version": 1,
"version": "1.10",
"port-version": 2,
"description": "libLBFGS: a library of Limited-memory Broyden-Fletcher-Goldfarb-Shanno (L-BFGS)",
"homepage": "http://www.chokkan.org/software/liblbfgs/"
"homepage": "http://www.chokkan.org/software/liblbfgs/",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
}
]
}
32 changes: 16 additions & 16 deletions ports/orc/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@ file(REMOVE "${SOURCE_PATH}/cmake_modules/FindProtobuf.cmake")
file(REMOVE "${SOURCE_PATH}/cmake_modules/FindSnappy.cmake")
file(REMOVE "${SOURCE_PATH}/cmake_modules/FindZLIB.cmake")

if(CMAKE_HOST_WIN32)
set(PROTOBUF_EXECUTABLE ${CURRENT_INSTALLED_DIR}/tools/protobuf/protoc.exe)
else()
set(PROTOBUF_EXECUTABLE ${CURRENT_INSTALLED_DIR}/tools/protobuf/protoc)
endif()
set(PROTOBUF_EXECUTABLE "${CURRENT_HOST_INSTALLED_DIR}/tools/protobuf/protoc${VCPKG_HOST_EXECUTABLE_SUFFIX}")

if(VCPKG_TARGET_IS_WINDOWS)
set(BUILD_TOOLS OFF)
else()
set(BUILD_TOOLS ON)
endif()

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
if(VCPKG_TARGET_IS_UWP)
set(configure_opts WINDOWS_USE_MSBUILD)
endif()

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
${configure_opts}
OPTIONS
-DBUILD_TOOLS=${BUILD_TOOLS}
-DBUILD_CPP_TESTS=OFF
Expand All @@ -42,23 +42,23 @@ vcpkg_configure_cmake(
-DENABLE_TEST=OFF
)

vcpkg_install_cmake()
vcpkg_cmake_install()
vcpkg_copy_pdbs()

file(GLOB TOOLS ${CURRENT_PACKAGES_DIR}/bin/orc-*)
if(TOOLS)
file(COPY ${TOOLS} DESTINATION ${CURRENT_PACKAGES_DIR}/tools/orc)
file(COPY ${TOOLS} DESTINATION "${CURRENT_PACKAGES_DIR}/tools/orc")
file(REMOVE ${TOOLS})
endif()

file(GLOB BINS ${CURRENT_PACKAGES_DIR}/bin/*)
file(GLOB BINS "${CURRENT_PACKAGES_DIR}/bin/*")
if(NOT BINS)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")


file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(COPY "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
12 changes: 10 additions & 2 deletions ports/orc/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
{
"name": "orc",
"version-string": "1.6.4",
"port-version": 2,
"version": "1.6.4",
"port-version": 3,
"description": "The smallest, fastest columnar storage for Hadoop workloads.",
"homepage": "https://orc.apache.org/",
"dependencies": [
"gtest",
"lz4",
"protobuf",
{
"name": "protobuf",
"host": true
},
"snappy",
{
"name": "vcpkg-cmake",
"host": true
},
"zlib",
"zstd"
]
Expand Down
9 changes: 7 additions & 2 deletions ports/physfs/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ vcpkg_download_distfile(ARCHIVE

vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE ${ARCHIVE}
ARCHIVE "${ARCHIVE}"
REF ${PHYSFS_VERSION}
PATCHES
"001-fix-lzmasdk-arm64-windows.patch"
Expand All @@ -20,8 +20,13 @@ vcpkg_extract_source_archive_ex(
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" PHYSFS_STATIC)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" PHYSFS_SHARED)

if(VCPKG_TARGET_IS_UWP)
set(configure_opts WINDOWS_USE_MSBUILD)
endif()

vcpkg_cmake_configure(
SOURCE_PATH ${SOURCE_PATH}
SOURCE_PATH "${SOURCE_PATH}"
${configure_opts}
OPTIONS
-DPHYSFS_BUILD_STATIC=${PHYSFS_STATIC}
-DPHYSFS_BUILD_SHARED=${PHYSFS_SHARED}
Expand Down
2 changes: 1 addition & 1 deletion ports/physfs/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "physfs",
"version-semver": "3.0.2",
"port-version": 6,
"port-version": 7,
"description": "a library to provide abstract access to various archives",
"homepage": "https://icculus.org/physfs/",
"dependencies": [
Expand Down
2 changes: 2 additions & 0 deletions ports/physx/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ set(OPTIONS_DEBUG

if(VCPKG_TARGET_IS_UWP)
list(APPEND OPTIONS "-DTARGET_BUILD_PLATFORM=uwp")
set(configure_options WINDOWS_USE_MSBUILD)
elseif(VCPKG_TARGET_IS_WINDOWS)
list(APPEND OPTIONS "-DTARGET_BUILD_PLATFORM=windows")
elseif(VCPKG_TARGET_IS_OSX)
Expand Down Expand Up @@ -76,6 +77,7 @@ endif()

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}/physx/compiler/public"
${configure_options}
DISABLE_PARALLEL_CONFIGURE
OPTIONS ${OPTIONS}
OPTIONS_DEBUG ${OPTIONS_DEBUG}
Expand Down
4 changes: 2 additions & 2 deletions ports/physx/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "physx",
"version-semver": "4.1.2",
"port-version": 2,
"version": "4.1.2",
"port-version": 3,
"description": "The NVIDIA PhysX SDK is a scalable multi-platform physics solution supporting a wide range of devices, from smartphones to high-end multicore CPUs and GPUs",
"homepage": "https://github.com/NVIDIAGameWorks/PhysX",
"license": null,
Expand Down
5 changes: 5 additions & 0 deletions ports/sdl2/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,13 @@ if ("x11" IN_LIST FEATURES)
message(WARNING "You will need to install Xorg dependencies to use feature x11:\nsudo apt install libx11-dev libxft-dev libxext-dev\n")
endif()

if(VCPKG_TARGET_IS_UWP)
set(configure_opts WINDOWS_USE_MSBUILD)
endif()

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
${configure_opts}
OPTIONS ${FEATURE_OPTIONS}
-DSDL_STATIC=${SDL_STATIC}
-DSDL_SHARED=${SDL_SHARED}
Expand Down
2 changes: 1 addition & 1 deletion ports/sdl2/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "sdl2",
"version": "2.0.20",
"port-version": 2,
"port-version": 3,
"description": "Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D.",
"homepage": "https://www.libsdl.org/download-2.0.php",
"dependencies": [
Expand Down
5 changes: 5 additions & 0 deletions ports/vcpkg-cmake/cmake_get_vars/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@ foreach(flag CXX C SHARED_LINKER EXE_LINKER STATIC_LINKER RC)
# Transform MSVC /flags to -flags due to bash scripts intepreting /flag as a path.
# This is imperfect because it fails on directories with trailing spaces, but those are exceedingly rare
string(REGEX REPLACE "(^| )/" "\\1-" ${flag}_FLAGS "${${flag}_FLAGS}")
if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
if("${flag}" STREQUAL "CXX")
string(APPEND ${flag}_FLAGS " -ZW:nostdlib")
endif()
endif()
endif()
string(REPLACE "\\" "\\\\" ${flag}_FLAGS "${${flag}_FLAGS}")
string(REPLACE "\"" "\\\"" ${flag}_FLAGS "${${flag}_FLAGS}")
Expand Down
2 changes: 1 addition & 1 deletion ports/vcpkg-cmake/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "vcpkg-cmake",
"version-date": "2022-04-12",
"version-date": "2022-04-21",
"license": "MIT"
}
3 changes: 0 additions & 3 deletions ports/vcpkg-cmake/vcpkg_cmake_configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,6 @@ function(vcpkg_cmake_configure)
# Prebuilt ninja binaries are only provided for x64 hosts
set(ninja_can_be_used OFF)
set(ninja_host OFF)
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()

set(generator "Ninja")
Expand Down
Loading

0 comments on commit 05c93c5

Please sign in to comment.