mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-01-19 04:43:02 +08:00
[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
This commit is contained in:
parent
7e3d3beac5
commit
ecdd15e8e4
@ -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}")
|
||||
|
Loading…
Reference in New Issue
Block a user