Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
5e2a675
fix: vcpkg_configure_make for NDK r23 clang cross-compiling
holmesconan Sep 29, 2021
077ad28
remove merge marks
holmesconan Oct 19, 2021
6367b06
fix: Android NDK r23+
holmesconan Oct 25, 2021
f2eb05f
merged to latest master branch
holmesconan Nov 3, 2021
02e7ba7
Merge branch 'master' into fix-android-ndk-clang
holmesconan Nov 6, 2021
bd5de96
fix: 1. -> ; 2. -avoid-version patch ignored
holmesconan Nov 6, 2021
eec092c
fix for review
holmesconan Nov 6, 2021
0920613
Merge branch 'fix-android-ndk-clang' of github.com:holmescn/vcpkg int…
holmesconan Nov 6, 2021
854ca58
fix variable renamed inside z_vcpkg_determine_autotools_host_cpu
holmesconan Nov 6, 2021
1ba1b4f
fix: 1. guard arg_BUILD_TRIPLET; 2. typo of VCPKG_DETECTED_CMAKE_HOST…
holmesconan Nov 6, 2021
00ad9dc
fix: try to fix z_vcpkg_determine_autotools_host_cpu for x86_64
holmesconan Nov 9, 2021
1b1fbdc
Merge branch 'fix-android-ndk-clang' of github.com:holmescn/vcpkg int…
holmesconan Nov 9, 2021
632c5a1
fix: remove CMAKE_SYSTEM_VERSION in get_cmake_vars
holmesconan Nov 11, 2021
d3bdd74
small fix
holmesconan Nov 12, 2021
8fa0a95
Merge branch 'master' of https://github.com/microsoft/vcpkg into fix-…
holmesconan Nov 12, 2021
b903f6e
Merge branch 'master' of https://github.com/microsoft/vcpkg into fix-…
holmesconan Nov 13, 2021
3ebd934
Merge branch 'master' of https://github.com/microsoft/vcpkg into fix-…
holmesconan Nov 15, 2021
0c39006
Merge branch 'master' of https://github.com/microsoft/vcpkg into fix-…
holmesconan Nov 19, 2021
4244425
Merge branch 'master' of https://github.com/microsoft/vcpkg into fix-…
holmesconan Nov 24, 2021
f57da1c
Merge branch 'master' of https://github.com/microsoft/vcpkg into fix-…
holmesconan Nov 29, 2021
c42b2ee
Merge branch 'master' of https://github.com/microsoft/vcpkg into fix-…
holmesconan Nov 30, 2021
fa1b6cd
Detect compiler for make
m-kuhn Nov 21, 2021
ed47108
tools
m-kuhn Nov 21, 2021
6e21eae
Remove implicit include directories
m-kuhn Nov 30, 2021
3d405fb
Clean android platform
m-kuhn Dec 3, 2021
096f674
Address review comments
m-kuhn Dec 3, 2021
9aa6235
Fixup unintended change
m-kuhn Dec 3, 2021
3554482
Simplify things even more
m-kuhn Dec 4, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 49 additions & 2 deletions scripts/cmake/vcpkg_configure_make.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ macro(z_vcpkg_determine_autotools_host_cpu out_var)
endif()
if(host_arch MATCHES "(amd|AMD)64")
set(${out_var} x86_64)
elseif(host_arch MATCHES "(x|X)86_64")
set(${out_var} x86_64)
elseif(host_arch MATCHES "(x|X)86")
set(${out_var} i686)
elseif(host_arch MATCHES "^(ARM|arm)64$")
Expand Down Expand Up @@ -199,6 +201,12 @@ macro(z_vcpkg_extract_cpp_flags_and_set_cflags_and_cxxflags flag_suffix)
debug_message("CXXFLAGS_${flag_suffix}: ${CXXFLAGS_${flag_suffix}}")
endmacro()

macro(_vcpkg_setup_detected_env env_name cmake_var)
if(VCPKG_DETECTED_${cmake_var})
set(ENV{${env_name}} "${VCPKG_DETECTED_${cmake_var}}")
endif()
endmacro()

macro(z_vcpkg_append_to_configure_environment inoutstring var defaultval)
# Allows to overwrite settings in custom triplets via the environment on windows
if(CMAKE_HOST_WIN32 AND DEFINED ENV{${var}})
Expand Down Expand Up @@ -278,8 +286,10 @@ function(vcpkg_configure_make)
# Backup environment variables
# CCAS CC C CPP CXX FC FF GC LD LF LIBTOOL OBJC OBJCXX R UPC Y
set(cm_FLAGS AS CCAS CC C CPP CXX FC FF GC LD LF LIBTOOL OBJC OBJXX R UPC Y RC)
set(cm_TOOLS CC CXX AR AS LD RANLIB STRIP)
list(TRANSFORM cm_FLAGS APPEND "FLAGS")
vcpkg_backup_env_variables(VARS ${cm_FLAGS})
vcpkg_backup_env_variables(VARS ${cm_TOOLS})


# FC fotran compiler | FF Fortran 77 compiler
Expand Down Expand Up @@ -316,7 +326,7 @@ function(vcpkg_configure_make)
# Only for ports using autotools so we can assume that they follow the common conventions for build/target/host
if(CMAKE_HOST_WIN32)
set(arg_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
# shell which will be otherwise identified as ${BUILD_ARCH}-pc-msys
endif()
if(NOT TARGET_ARCH MATCHES "${BUILD_ARCH}" OR NOT CMAKE_HOST_WIN32) # we don't need to specify the additional flags if we build nativly, this does not hold when we are not on windows
string(APPEND arg_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)
Expand Down Expand Up @@ -465,6 +475,34 @@ function(vcpkg_configure_make)
endif()
endif()

# Android - cross-compiling support
if(VCPKG_TARGET_IS_ANDROID)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keen to know if this should be avoided and if yes, how

if (VCPKG_DETECTED_CMAKE_CXX_COMPILER_ID MATCHES "^Clang$")
if (arg_DETERMINE_BUILD_TRIPLET OR NOT arg_BUILD_TRIPLET)
if(VCPKG_HOST_IS_WINDOWS)
z_vcpkg_determine_autotools_host_cpu(BUILD_ARCH) # machine you are building on => --build=
z_vcpkg_determine_host_mingw(BUILD_MINGW)
set(arg_BUILD_TRIPLET "--build=${BUILD_ARCH}-pc-${BUILD_MINGW}") # This is required since we are running in a msys
# shell which will be otherwise identified as ${BUILD_ARCH}-pc-msys
elseif(VCPKG_HOST_IS_OSX)
z_vcpkg_determine_autotools_host_arch_mac(BUILD_ARCH) # machine you are building on => --build=
set(arg_BUILD_TRIPLET "--build=${BUILD_ARCH}-apple-darwin")
elseif(VCPKG_HOST_IS_LINUX)
z_vcpkg_determine_autotools_host_cpu(BUILD_ARCH) # machine you are building on => --build=
set(arg_BUILD_TRIPLET "--build=${BUILD_ARCH}-pc-linux-gnu")
endif()

z_vcpkg_determine_autotools_target_cpu(TARGET_ARCH)
if (TARGET_ARCH MATCHES "armv7-a")
string(APPEND arg_BUILD_TRIPLET " --host=arm-linux-androideabi")
else()
string(APPEND arg_BUILD_TRIPLET " --host=${TARGET_ARCH}-linux-android")
endif()
endif()
debug_message("Using make triplet: ${arg_BUILD_TRIPLET}")
endif()
endif()

# Cleanup previous build dirs
file(REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel"
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg"
Expand Down Expand Up @@ -726,6 +764,11 @@ function(vcpkg_configure_make)
vcpkg_list(JOIN tmp " " "${var}")
endforeach()

set(_tools AR RANLIB STRIP NM OBJDUMP DLLTOOL MT STRIP AS)
foreach (_toolname ${_tools})
_vcpkg_setup_detected_env(${_toolname} CMAKE_${_toolname})
endforeach()

foreach(current_buildtype IN LISTS all_buildtypes)
foreach(ENV_VAR ${arg_CONFIG_DEPENDENT_ENVIRONMENT})
if(DEFINED ENV{${ENV_VAR}})
Expand Down Expand Up @@ -754,6 +797,10 @@ function(vcpkg_configure_make)
endif()

# Setup environment
_vcpkg_setup_detected_env(CC CMAKE_C_COMPILER)
_vcpkg_setup_detected_env(CXX CMAKE_CXX_COMPILER)
_vcpkg_setup_detected_env(LD CMAKE_LINKER)

set(ENV{CPPFLAGS} "${CPPFLAGS_${current_buildtype}}")
set(ENV{CFLAGS} "${CFLAGS_${current_buildtype}}")
set(ENV{CXXFLAGS} "${CXXFLAGS_${current_buildtype}}")
Expand Down Expand Up @@ -847,7 +894,7 @@ function(vcpkg_configure_make)
endif()

# Restore environment
vcpkg_restore_env_variables(VARS ${cm_FLAGS} LIB LIBPATH LIBRARY_PATH LD_LIBRARY_PATH)
vcpkg_restore_env_variables(VARS ${cm_FLAGS} ${cm_TOOLS} LIB LIBPATH LIBRARY_PATH LD_LIBRARY_PATH)

set(_VCPKG_PROJECT_SOURCE_PATH ${arg_SOURCE_PATH} PARENT_SCOPE)
set(_VCPKG_PROJECT_SUBPATH ${arg_PROJECT_SUBPATH} PARENT_SCOPE)
Expand Down
9 changes: 8 additions & 1 deletion scripts/get_cmake_vars/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@ list(APPEND VCPKG_DEFAULT_VARS_TO_CHECK CMAKE_CROSSCOMPILING
CMAKE_SYSTEM_NAME
CMAKE_HOST_SYSTEM_NAME
CMAKE_SYSTEM_PROCESSOR
CMAKE_HOST_SYSTEM_PROCESSOR)
CMAKE_HOST_SYSTEM_PROCESSOR
CMAKE_SYSTEM_VERSION
CMAKE_INCLUDE_FLAG_C
CMAKE_INCLUDE_FLAG_CXX
CMAKE_INCLUDE_FLAG_C_SEP
CMAKE_INCLUDE_FLAG_CXX_SEP
CMAKE_INCLUDE_SYSTEM_FLAG_C
CMAKE_INCLUDE_SYSTEM_FLAG_CXX)
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
list(APPEND VCPKG_DEFAULT_VARS_TO_CHECK CMAKE_OSX_DEPLOYMENT_TARGET
CMAKE_OSX_SYSROOT)
Expand Down