Skip to content

Commit

Permalink
[toolchain windows] set CMAKE_SYSTEM_PROCESSOR (#24100)
Browse files Browse the repository at this point in the history
* [toolchain windows] set CMAKE_SYSTEM_NAME and CMAKE_SYSTEM_PROCESSOR

In specific, I did this for the cpuinfo PR - I realized the reason
that cpuinfo doesn't support arm64 windows cross compilation is because
we don't set CMAKE_SYSTEM_PROCESSOR.

* correctly set CMAKE_CROSSCOMPILING

* start fixin libraries

* more changes:

- gainput: remove line
- glog: remove try_run when cross compiling
- windows.cmake: set CMAKE_SYSTEM_VERSION

* more patches

- mapnik: set BOOST_REGEX_HAS_ICU to avoid check_cxx_source_runs
- orc: set HAS_PRE_1970 and HAS_POST_2038 for same
- seal: change out check_cxx_source_runs for check_cxx_source_compiles

* more changes

* fix x86-windows

* fix qpid-proton, glog

* build corrade-rc

* fix x64-uwp ports

* forgot to _actually_ always build corrade-rc .,.

* Replay #22831

* Dedupe CMAKE_SYSTEM_NAME settings.

* Add quotes for corrade_rc_param

Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>

* Update version DB.

Co-authored-by: nicole mazzuca <mazzucan@outlook.com>
Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>
  • Loading branch information
4 people committed Apr 29, 2022
1 parent 585ff44 commit 9ccd693
Show file tree
Hide file tree
Showing 59 changed files with 529 additions and 55 deletions.
6 changes: 6 additions & 0 deletions ports/ampl-mp/fix-arm-build.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt
index 92089a3..d4c6762 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -240,4 +240,4 @@
set(MP_EXPR_INFO_FILE ${MP_SOURCE_DIR}/src/expr-info.cc)
-add_executable(gen-expr-info EXCLUDE_FROM_ALL
+add_executable(gen-expr-info
src/gen-expr-info.cc $<TARGET_OBJECTS:format>)
if (MINGW)
@@ -257,9 +257,15 @@ if (CMAKE_CROSSCOMPILING)
COMMAND ${CMAKE_COMMAND} -E echo
"warning: cannot re-generate ${MP_EXPR_INFO_FILE}")
Expand Down
4 changes: 2 additions & 2 deletions ports/ampl-mp/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ampl-mp",
"version-string": "2020-11-11",
"port-version": 2,
"version-date": "2020-11-11",
"port-version": 3,
"description": "An open-source library for mathematical programming",
"homepage": "https://github.com/ampl/mp",
"supports": "!uwp",
Expand Down
9 changes: 8 additions & 1 deletion ports/aom/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,24 @@ vcpkg_from_git(
OUT_SOURCE_PATH SOURCE_PATH
URL "https://aomedia.googlesource.com/aom"
REF 6bbe6ae701d65bdf36bb72053db9b71f9739a083
TAG v3.2.0
FETCH_REF v3.2.0
PATCHES
aom-rename-static.diff
# Can be dropped when https://bugs.chromium.org/p/aomedia/issues/detail?id=3029 is merged into the upstream
aom-install.diff
aom-uninitialized-pointer.diff
)

set(aom_target_cpu "")
if(VCPKG_TARGET_IS_UWP)
# UWP + aom's assembler files result in weirdness and build failures
set(aom_target_cpu "-DAOM_TARGET_CPU=generic")
endif()

vcpkg_cmake_configure(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
${aom_target_cpu}
-DENABLE_DOCS=OFF
-DENABLE_EXAMPLES=OFF
-DENABLE_TESTDATA=OFF
Expand Down
2 changes: 1 addition & 1 deletion ports/aom/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "aom",
"version-semver": "3.2.0",
"port-version": 2,
"port-version": 3,
"description": "AV1 codec library",
"homepage": "https://aomedia.googlesource.com/aom",
"supports": "!(windows & arm & !uwp)",
Expand Down
8 changes: 8 additions & 0 deletions ports/caf/fix_cxx17.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
--- a/CMakeLists.txt
+++ a/CMakeLists.txt
@@ -115,3 +115,4 @@
+target_compile_features(caf_internal INTERFACE cxx_std_17)
# TODO: simply set CXX_STANDARD when switching to CMake ≥ 3.9.6
-if(NOT CMAKE_CROSSCOMPILING)
+if(0)
try_compile(caf_has_cxx_17
1 change: 1 addition & 0 deletions ports/caf/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ vcpkg_from_github(
HEAD_REF master
PATCHES
fix_dependency.patch
fix_cxx17.patch
)

vcpkg_cmake_configure(
Expand Down
1 change: 1 addition & 0 deletions ports/caf/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "caf",
"version": "0.18.6",
"port-version": 1,
"description": "an open source implementation of the actor model for C++ featuring lightweight & fast actor implementations, pattern matching for messages, network transparent messaging, and more.",
"homepage": "https://github.com/actor-framework/actor-framework",
"license": "BSD-3-Clause",
Expand Down
27 changes: 27 additions & 0 deletions ports/corrade/build-corrade-rc-always.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
--- a/src/Corrade/Utility/CMakeLists.txt
+++ b/src/Corrade/Utility/CMakeLists.txt
@@ -185,13 +185,12 @@
# corrade-rc when generating WinRT targets by setting
# set_target_properties(corrade-rc PROPERTIES VS_WINRT_COMPONENT OFF)
# Then this would be if(NOT CMAKE_CROSSCOMPILING OR CORRADE_TARGET_WINDOWS_RT).
# However, it seems like this feature never materialized, as doing this will
# result in corrade-rc that's looking for vcruntime140_app.dll in order to be
# run. Last checked: Nov 2019.
-if(NOT CMAKE_CROSSCOMPILING)
# Sources for standalone corrade-rc
set(CorradeUtilityRc_SRCS
Arguments.cpp
Debug.cpp
Directory.cpp
Configuration.cpp
@@ -235,9 +234,10 @@
if(CORRADE_TARGET_UNIX)
target_link_libraries(corrade-rc PRIVATE ${CMAKE_DL_LIBS})
endif()
set_target_properties(corrade-rc PROPERTIES FOLDER "Corrade/Utility")
install(TARGETS corrade-rc DESTINATION ${CORRADE_BINARY_INSTALL_DIR})

+if(NOT CMAKE_CROSSCOMPILING)
# Corrade::rc target alias for superprojects
add_executable(Corrade::rc ALIAS corrade-rc)
endif()
19 changes: 15 additions & 4 deletions ports/corrade/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ vcpkg_from_github(
REF v2020.06
SHA512 94cc8959b0ee43ecd8d13a25307e7829d53dc6601628d97c32288d1704e2c0835b755bffc06b2105e6aa5a612f119a60e83cb475860b51e6a35999215c100227
HEAD_REF master
PATCHES fix-vs2019.patch
PATCHES
fix-vs2019.patch
build-corrade-rc-always.patch
)

string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BUILD_STATIC)
Expand All @@ -24,13 +26,23 @@ endforeach()

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS FEATURES ${_COMPONENTS})

set(corrade_rc_param "")
if(VCPKG_CROSSCOMPILING)
set(corrade_rc_param
"-DCORRADE_RC_EXECUTABLE=${CURRENT_HOST_INSTALLED_DIR}/tools/corrade/corrade-rc${VCPKG_HOST_EXECUTABLE_SUFFIX}"
)
endif()

vcpkg_configure_cmake(
SOURCE_PATH "${SOURCE_PATH}"
PREFER_NINJA # Disable this option if project cannot be built with Ninja
OPTIONS
${FEATURE_OPTIONS}
"${corrade_rc_param}"
-DUTILITY_USE_ANSI_COLORS=ON
-DBUILD_STATIC=${BUILD_STATIC}
MAYBE_UNUSED_VARIABLES
CORRADE_RC_EXECUTABLE
)

vcpkg_install_cmake()
Expand All @@ -39,9 +51,8 @@ vcpkg_install_cmake()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")

# Install tools
# corrade-rc is not built when CMAKE_CROSSCOMPILING
if("utility" IN_LIST FEATURES)
# Drop a copy of tools
vcpkg_copy_tools(TOOL_NAMES "corrade-rc" AUTO_CLEAN)
endif()

Expand All @@ -67,4 +78,4 @@ file(INSTALL "${SOURCE_PATH}/COPYING"
DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}"
RENAME copyright)

vcpkg_copy_pdbs()
vcpkg_copy_pdbs()
12 changes: 11 additions & 1 deletion ports/corrade/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
{
"name": "corrade",
"version-string": "2020.06",
"port-version": 3,
"port-version": 4,
"description": "C++11/C++14 multiplatform utility library.",
"homepage": "https://magnum.graphics/corrade/",
"dependencies": [
{
"name": "corrade",
"host": true,
"default-features": false,
"features": [
"utility"
]
}
],
"default-features": [
"interconnect",
"pluginmanager",
Expand Down
4 changes: 3 additions & 1 deletion ports/cpu-features/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ vcpkg_from_github(
REF a8397ba4591237c17d18e4acc091f5f3ebe7391e # 0.6.0
SHA512 71a583e8190699d6df3dfa2857886089265cdfbcb916d9828a3611a1d6d23487464d6448b900b49637f015dd7d4e18bb206e0249af0932928f8ced13a081d42b
HEAD_REF master
PATCHES make_list_cpu_features_optional.patch
PATCHES
make_list_cpu_features_optional.patch
windows-x86-fix.patch
)

# If feature "tools" is not specified, disable building/exporting executable targets.
Expand Down
2 changes: 1 addition & 1 deletion ports/cpu-features/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "cpu-features",
"version": "0.6.0",
"port-version": 1,
"port-version": 2,
"description": "A cross-platform C library to retrieve CPU features (such as available instructions) at runtime",
"homepage": "https://github.com/google/cpu_features",
"license": "Apache-2.0",
Expand Down
17 changes: 17 additions & 0 deletions ports/cpu-features/windows-x86-fix.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -60,13 +60,13 @@
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^mips")
set(PROCESSOR_IS_MIPS TRUE)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
set(PROCESSOR_IS_ARM TRUE)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64")
set(PROCESSOR_IS_AARCH64 TRUE)
-elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64)|(AMD64|amd64)|(^i.86$)")
+elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(AMD64|amd64)|(^i.86$)")
set(PROCESSOR_IS_X86 TRUE)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)")
set(PROCESSOR_IS_POWER TRUE)
endif()

macro(add_cpu_features_headers_and_sources HDRS_LIST_NAME SRCS_LIST_NAME)
13 changes: 12 additions & 1 deletion ports/fltk/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ else()
set(OPTION_USE_GL "-DOPTION_USE_GL=ON")
endif()

set(fluid_path_param "")
if(VCPKG_CROSSCOMPILING)
set(fluid_path_param "-DFLUID_PATH=${CURRENT_HOST_INSTALLED_DIR}/tools/fltk/fluid${VCPKG_HOST_EXECUTABLE_SUFFIX}")
endif()

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
Expand All @@ -30,6 +35,7 @@ vcpkg_cmake_configure(
-DOPTION_USE_SYSTEM_LIBJPEG=ON
-DOPTION_BUILD_SHARED_LIBS=OFF
-DFLTK_CONFIG_PATH=share/fltk
${fluid_path_param}
${OPTION_USE_GL}
)

Expand All @@ -39,7 +45,12 @@ vcpkg_cmake_config_fixup()

vcpkg_copy_pdbs()

if(VCPKG_TARGET_IS_OSX)
# don't install fluid
if(VCPKG_CROSSCOMPILING)
if(NOT VCPKG_TARGET_IS_WINDOWS)
vcpkg_copy_tools(TOOL_NAMES fltk-config AUTO_CLEAN)
endif()
elseif(VCPKG_TARGET_IS_OSX)
vcpkg_copy_tools(TOOL_NAMES fluid.app fltk-config AUTO_CLEAN)
elseif(VCPKG_TARGET_IS_WINDOWS)
file(REMOVE "${CURRENT_PACKAGES_DIR}/bin/fltk-config" "${CURRENT_PACKAGES_DIR}/debug/bin/fltk-config")
Expand Down
6 changes: 5 additions & 1 deletion ports/fltk/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
{
"name": "fltk",
"version": "1.3.8",
"port-version": 1,
"port-version": 2,
"description": "FLTK (pronounced fulltick) is a cross-platform C++ GUI toolkit for UNIX/Linux (X11), Microsoft Windows, and MacOS X. FLTK provides modern GUI functionality without the bloat and supports 3D graphics via OpenGL and its built-in GLUT emulation.",
"homepage": "https://www.fltk.org/",
"supports": "!uwp",
"dependencies": [
{
"name": "fltk",
"host": true
},
"libjpeg-turbo",
"libpng",
{
Expand Down
5 changes: 4 additions & 1 deletion ports/gainput/fix-build.patch
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
set(XINPUT, "xinput") sets the variable "XINPUT," to "xinput",
so this variable is never used anyways

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a443b66..61ff7b8 100644
--- a/CMakeLists.txt
Expand All @@ -12,7 +15,7 @@ index a443b66..61ff7b8 100644
else()
set(XINPUT "Xinput9_1_0")
- if ( ${CMAKE_SYSTEM_VERSION} LESS 6.1 )
+ if ( ${CMAKE_SYSTEM_VERSION} VERSION_LESS 6.1 )
+ if ( 0 )
set(XINPUT, "xinput")
endif()
endif()
Expand Down
2 changes: 1 addition & 1 deletion ports/gainput/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gainput",
"version": "1.0.0",
"port-version": 5,
"port-version": 6,
"description": "Gainput is a multiplatform C++ input library, supporting mouse, keyboard and controllers",
"homepage": "https://github.com/jkuhlmann/gainput",
"license": "MIT",
Expand Down
18 changes: 18 additions & 0 deletions ports/glog/fix_crosscompile_symbolize.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -401,4 +401,7 @@
if (WITH_SYMBOLIZE)
if (WIN32 OR CYGWIN)
+ if(CMAKE_CROSSCOMPILING)
+ set(HAVE_SYMBOLIZE 0)
+ else()
cmake_push_check_state (RESET)
set (CMAKE_REQUIRED_LIBRARIES DbgHelp)
@@ -430,6 +433,7 @@
]=] HAVE_SYMBOLIZE)

cmake_pop_check_state ()
+ endif()

if (HAVE_SYMBOLIZE)
set (HAVE_STACKTRACE 1)
9 changes: 0 additions & 9 deletions ports/glog/fix_log_every_n.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt
index 61e5f6c..889df87 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -65,7 +65,7 @@ include (GenerateExportHeader)
include (GetCacheVariables)
include (GNUInstallDirs)

-#set (CMAKE_DEBUG_POSTFIX d)
+#set (CMAKE_DEBUG_POSTFIX d)
set (CMAKE_THREAD_PREFER_PTHREAD 1)

find_package (GTest)
@@ -501,6 +501,7 @@ set (GLOG_PUBLIC_H
${CMAKE_CURRENT_BINARY_DIR}/glog/stl_logging.h
${CMAKE_CURRENT_BINARY_DIR}/glog/vlog_is_on.h
Expand Down
1 change: 1 addition & 0 deletions ports/glog/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ vcpkg_from_github(
fix_glog_CMAKE_MODULE_PATH.patch
fix_log_every_n.patch
nogdi-nominmax.patch
fix_crosscompile_symbolize.patch

)

Expand Down
4 changes: 2 additions & 2 deletions ports/glog/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "glog",
"version": "0.5.0",
"port-version": 2,
"port-version": 3,
"description": "C++ implementation of the Google logging module",
"homepage": "https://github.com/google/glog",
"license": null,
"license": "BSD-3-Clause",
"dependencies": [
"gflags",
{
Expand Down
20 changes: 20 additions & 0 deletions ports/libcopp/fix-x86-windows.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,12 +11,17 @@
libcopp
VERSION "1.4.1"
DESCRIPTION "Cross-platform coroutine library in C++ ."
HOMEPAGE_URL "https://libcopp.atframe.work"
LANGUAGES C CXX ASM)

+# libcopp requires x86 to be called i386
+if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86")
+ set(CMAKE_SYSTEM_PROCESSOR i386)
+endif()
+
# ######################################################################################################################
include("${PROJECT_SOURCE_DIR}/project/cmake/ProjectBuildOption.cmake")

# # #############################################################################
echowithcolor(COLOR GREEN "-- Build Type: ${CMAKE_BUILD_TYPE}")

1 change: 1 addition & 0 deletions ports/libcopp/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ vcpkg_from_github(
REF 1.4.1
SHA512 eba06bd2de7c9ee557cdd0bf79e0c53e37722b671347436322c14c99e94d955477bfc0980a4f59a5c31051e108f952ec96791024c45fa8eeaa5f7a49099dd8ae
HEAD_REF v2
PATCHES fix-x86-windows.patch
)

# atframework/cmake-toolset needed as a submodule for configure cmake
Expand Down
2 changes: 1 addition & 1 deletion ports/libcopp/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "libcopp",
"version-semver": "1.4.1",
"port-version": 1,
"port-version": 2,
"maintainers": "owent <admin@owent.net>",
"description": "A cross-platfrom coroutine library for C++",
"homepage": "https://github.com/owent/libcopp",
Expand Down

0 comments on commit 9ccd693

Please sign in to comment.