aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAlexander Neumann <30894796+Neumann-A@users.noreply.github.com>2020-10-14 19:21:11 +0200
committerGitHub <noreply@github.com>2020-10-14 10:21:11 -0700
commitecdd15e8e4d039c506c92418f73df08f2aa3520d (patch)
treefa3e00045a083efe32d99e2d6f43b3d60907c396 /scripts
parent7e3d3beac5ca6fe8aab4599d4e1d8ce270ccdea8 (diff)
downloadvcpkg-ecdd15e8e4d039c506c92418f73df08f2aa3520d.tar.gz
vcpkg-ecdd15e8e4d039c506c92418f73df08f2aa3520d.zip
[vcpkg/configure_make] add option DETERMINE_BUILD_TRIPLET (#14001)
* [vcpkg/configure_make] add option DETERMINE_BUILD_TRIPLET * add missing option to cmake_parse_arguments * add missing USE_WRAPPERS option
Diffstat (limited to 'scripts')
-rw-r--r--scripts/cmake/vcpkg_configure_make.cmake33
1 files changed, 17 insertions, 16 deletions
diff --git a/scripts/cmake/vcpkg_configure_make.cmake b/scripts/cmake/vcpkg_configure_make.cmake
index ac13253c1..4882a295d 100644
--- a/scripts/cmake/vcpkg_configure_make.cmake
+++ b/scripts/cmake/vcpkg_configure_make.cmake
@@ -41,6 +41,9 @@
## ### BUILD_TRIPLET
## Used to pass custom --build/--target/--host to configure. Can be globally overwritten by VCPKG_MAKE_BUILD_TRIPLET
##
+## ### DETERMINE_BUILD_TRIPLET
+## For ports having a configure script following the autotools rules for selecting the triplet
+##
## ### NO_ADDITIONAL_PATHS
## Don't pass any additional paths except for --prefix to the configure call
##
@@ -164,7 +167,7 @@ endmacro()
function(vcpkg_configure_make)
cmake_parse_arguments(_csc
- "AUTOCONFIG;SKIP_CONFIGURE;COPY_SOURCE;DISABLE_VERBOSE_FLAGS;NO_ADDITIONAL_PATHS;ADD_BIN_TO_PATH"
+ "AUTOCONFIG;SKIP_CONFIGURE;COPY_SOURCE;DISABLE_VERBOSE_FLAGS;NO_ADDITIONAL_PATHS;ADD_BIN_TO_PATH;USE_WRAPPERS;DETERMINE_BUILD_TRIPLET"
"SOURCE_PATH;PROJECT_SUBPATH;PRERUN_SHELL;BUILD_TRIPLET"
"OPTIONS;OPTIONS_DEBUG;OPTIONS_RELEASE;CONFIGURE_ENVIRONMENT_VARIABLES;CONFIG_DEPENDENT_ENVIRONMENT"
${ARGN}
@@ -219,28 +222,25 @@ function(vcpkg_configure_make)
# Pre-processing windows configure requirements
if (CMAKE_HOST_WIN32)
- _vcpkg_determine_autotools_host_cpu(BUILD_ARCH) # VCPKG_HOST => machine you are building on => --build=
-
list(APPEND MSYS_REQUIRE_PACKAGES binutils libtool autoconf automake-wrapper automake1.16 m4)
vcpkg_acquire_msys(MSYS_ROOT PACKAGES ${MSYS_REQUIRE_PACKAGES})
- # This inserts msys before system32 (which masks sort.exe and find.exe) but after MSVC (which avoids masking link.exe)
- if (_csc_AUTOCONFIG)
+
+ if (_csc_AUTOCONFIG AND NOT _csc_BUILD_TRIPLET OR _csc_DETERMINE_BUILD_TRIPLET)
+ _vcpkg_determine_autotools_host_cpu(BUILD_ARCH) # VCPKG_HOST => machine you are building on => --build=
+ _vcpkg_determine_autotools_target_cpu(TARGET_ARCH)
# --build: the machine you are building on
# --host: the machine you are building for
# --target: the machine that CC will produce binaries for
# https://stackoverflow.com/questions/21990021/how-to-determine-host-value-for-configure-when-using-cross-compiler
# Only for ports using autotools so we can assume that they follow the common conventions for build/target/host
- if(NOT _csc_BUILD_TRIPLET)
- set(_csc_BUILD_TRIPLET "--build=${BUILD_ARCH}-pc-mingw32") # This is required since we are running in a msys
- # shell which will be otherwise identified as ${BUILD_ARCH}-pc-msys
- _vcpkg_determine_autotools_target_cpu(TARGET_ARCH)
- if(NOT TARGET_ARCH MATCHES "${BUILD_ARCH}") # we do not need to specify the additional flags if we build nativly.
- string(APPEND _csc_BUILD_TRIPLET " --host=${TARGET_ARCH}-pc-mingw32") # (Host activates crosscompilation; The name given here is just the prefix of the host tools for the target)
- endif()
- if(VCPKG_TARGET_IS_UWP AND NOT _csc_BUILD_TRIPLET MATCHES "--host")
- # Needs to be different from --build to enable cross builds.
- string(APPEND _csc_BUILD_TRIPLET " --host=${TARGET_ARCH}-unknown-mingw32")
- endif()
+ set(_csc_BUILD_TRIPLET "--build=${BUILD_ARCH}-pc-mingw32") # This is required since we are running in a msys
+ # shell which will be otherwise identified as ${BUILD_ARCH}-pc-msys
+ if(NOT TARGET_ARCH MATCHES "${BUILD_ARCH}") # we don't need to specify the additional flags if we build nativly.
+ string(APPEND _csc_BUILD_TRIPLET " --host=${TARGET_ARCH}-pc-mingw32") # (Host activates crosscompilation; The name given here is just the prefix of the host tools for the target)
+ endif()
+ if(VCPKG_TARGET_IS_UWP AND NOT _csc_BUILD_TRIPLET MATCHES "--host")
+ # Needs to be different from --build to enable cross builds.
+ string(APPEND _csc_BUILD_TRIPLET " --host=${TARGET_ARCH}-unknown-mingw32")
endif()
debug_message("Using make triplet: ${_csc_BUILD_TRIPLET}")
endif()
@@ -248,6 +248,7 @@ function(vcpkg_configure_make)
if(_csc_AUTOCONFIG OR _csc_USE_WRAPPERS)
set(APPEND_ENV ";${MSYS_ROOT}/usr/share/automake-1.16")
endif()
+ # This inserts msys before system32 (which masks sort.exe and find.exe) but after MSVC (which avoids masking link.exe)
string(REPLACE ";$ENV{SystemRoot}\\System32;" "${APPEND_ENV};${MSYS_ROOT}/usr/bin;$ENV{SystemRoot}\\System32;" NEWPATH "$ENV{PATH}")
string(REPLACE ";$ENV{SystemRoot}\\system32;" "${APPEND_ENV};${MSYS_ROOT}/usr/bin;$ENV{SystemRoot}\\system32;" NEWPATH "$ENV{PATH}")
set(ENV{PATH} "${NEWPATH}")