-
Notifications
You must be signed in to change notification settings - Fork 7.6k
[vcpkg] Enhancement android triplet #21847
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c279bf2
70b610f
b92e645
d3e7ecd
32fe1d9
44b16b8
47cb665
fa44824
c17c234
4dcfd31
42a6154
873e39b
7ed118c
988682b
5b8af5c
522b2e3
07ee3b4
ee40c8c
d11d7a0
1e9816f
02004ea
4ef9c8c
91a9620
206791a
c123f02
e226a27
ba49367
7e04a6b
e2015e1
8742793
4281b88
b6afd4b
e2f9a86
7ecb979
b90a028
759f0f2
199b0d4
5d3e0e8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -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$") | ||||||||||||||||||||||||||||||
|
|
@@ -225,6 +227,14 @@ macro(z_convert_to_list input output) | |||||||||||||||||||||||||||||
| string(REGEX MATCHALL "(( +|^ *)[^ ]+)" ${output} "${${input}}") | ||||||||||||||||||||||||||||||
| endmacro() | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| macro(z_vcpkg_setup_detected_env env_name cmake_var) | ||||||||||||||||||||||||||||||
| if(VCPKG_DETECTED_${cmake_var}) | ||||||||||||||||||||||||||||||
| if(NOT VCPKG_TARGET_IS_OSX) | ||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, I don't know the details since my MBP is dead. This fix is provided because the regression error of x64_osx. And the regression error shows that
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not okay with not getting a real explanation for this.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am trying to investigate the issues here: By using the detected env, e.g. Without the detected env, it's set to
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. buildtrees/gettext/build-x64-osx-dbg-err.log
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So the question is:
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, gcc is a wrapper (binary executable) that forwards tools that implicitly use When it tries to detect for
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Adding Hence adding this to CPPFLAGS should fix the issue too. The following detected variables contain The question that I am not able to answer yet:
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||||||||||||||||||||||||||
| set(ENV{${env_name}} "${VCPKG_DETECTED_${cmake_var}}") | ||||||||||||||||||||||||||||||
| endif() | ||||||||||||||||||||||||||||||
| endif() | ||||||||||||||||||||||||||||||
| endmacro() | ||||||||||||||||||||||||||||||
|
Comment on lines
+230
to
+236
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't need to be a macro:
Suggested change
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I agree with you. I don't know why most vcpkg functions are declared as macros. I think it is because the very first function was declared as a macro, then the following contributors follow the convention. So let's follow the convention either. Although functions are better, macros work fine either.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. most vcpkg functions are not declared as macros. This specifically should not be. |
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| function(vcpkg_configure_make) | ||||||||||||||||||||||||||||||
| # parse parameters such that semicolons in options arguments to COMMAND don't get erased | ||||||||||||||||||||||||||||||
| cmake_parse_arguments(PARSE_ARGV 0 arg | ||||||||||||||||||||||||||||||
|
|
@@ -282,8 +292,9 @@ 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 READELF STRIP) | ||||||||||||||||||||||||||||||
| list(TRANSFORM cm_FLAGS APPEND "FLAGS") | ||||||||||||||||||||||||||||||
| vcpkg_backup_env_variables(VARS ${cm_FLAGS}) | ||||||||||||||||||||||||||||||
| vcpkg_backup_env_variables(VARS ${cm_FLAGS} ${cm_TOOLS}) | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| # FC fotran compiler | FF Fortran 77 compiler | ||||||||||||||||||||||||||||||
|
|
@@ -469,6 +480,36 @@ function(vcpkg_configure_make) | |||||||||||||||||||||||||||||
| endif() | ||||||||||||||||||||||||||||||
| endif() | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| # Android - cross-compiling support | ||||||||||||||||||||||||||||||
| if(VCPKG_TARGET_IS_ANDROID) | ||||||||||||||||||||||||||||||
| # This is temporarily disabled since it just avoid some warnings. | ||||||||||||||||||||||||||||||
| # if(VCPKG_DETECTED_CMAKE_CXX_COMPILER_ID STREQUAL "Clang") | ||||||||||||||||||||||||||||||
| # string(REPLACE "-static-libstdc++" "-lc++_static" VCPKG_DETECTED_CMAKE_CXX_STANDARD_LIBRARIES ${VCPKG_DETECTED_CMAKE_CXX_STANDARD_LIBRARIES}) | ||||||||||||||||||||||||||||||
| # endif() | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| if(arg_DETERMINE_BUILD_TRIPLET OR NOT arg_BUILD_TRIPLET) | ||||||||||||||||||||||||||||||
| if(VCPKG_HOST_IS_WINDOWS) | ||||||||||||||||||||||||||||||
| z_vcpkg_determine_autotools_host_cpu(BUILD_ARCH) | ||||||||||||||||||||||||||||||
| z_vcpkg_determine_host_mingw(BUILD_MINGW) | ||||||||||||||||||||||||||||||
| set(arg_BUILD_TRIPLET "--build=${BUILD_ARCH}-pc-${BUILD_MINGW}") | ||||||||||||||||||||||||||||||
| elseif(VCPKG_HOST_IS_OSX) | ||||||||||||||||||||||||||||||
| z_vcpkg_determine_autotools_host_arch_mac(BUILD_ARCH) | ||||||||||||||||||||||||||||||
| set(arg_BUILD_TRIPLET "--build=${BUILD_ARCH}-apple-darwin") | ||||||||||||||||||||||||||||||
| else() | ||||||||||||||||||||||||||||||
| z_vcpkg_determine_autotools_host_cpu(BUILD_ARCH) | ||||||||||||||||||||||||||||||
| 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() | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| # Linux - cross-compiling support | ||||||||||||||||||||||||||||||
| if(VCPKG_TARGET_IS_LINUX) | ||||||||||||||||||||||||||||||
| if (requires_autoconfig AND NOT arg_BUILD_TRIPLET OR arg_DETERMINE_BUILD_TRIPLET) | ||||||||||||||||||||||||||||||
|
|
@@ -745,6 +786,13 @@ function(vcpkg_configure_make) | |||||||||||||||||||||||||||||
| vcpkg_list(JOIN tmp " " "${var}") | ||||||||||||||||||||||||||||||
| endforeach() | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| foreach(tool IN ITEMS AR AS MT NM RANLIB READELF STRIP OBJDUMP DLLTOOL) | ||||||||||||||||||||||||||||||
| z_vcpkg_setup_detected_env(${tool} "CMAKE_${tool}") | ||||||||||||||||||||||||||||||
| endforeach() | ||||||||||||||||||||||||||||||
| z_vcpkg_setup_detected_env(CC CMAKE_C_COMPILER) | ||||||||||||||||||||||||||||||
| z_vcpkg_setup_detected_env(CXX CMAKE_CXX_COMPILER) | ||||||||||||||||||||||||||||||
| z_vcpkg_setup_detected_env(LD CMAKE_LINKER) | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| foreach(current_buildtype IN LISTS all_buildtypes) | ||||||||||||||||||||||||||||||
| foreach(ENV_VAR ${arg_CONFIG_DEPENDENT_ENVIRONMENT}) | ||||||||||||||||||||||||||||||
| if(DEFINED ENV{${ENV_VAR}}) | ||||||||||||||||||||||||||||||
|
|
@@ -772,7 +820,6 @@ function(vcpkg_configure_make) | |||||||||||||||||||||||||||||
| set(ENV{PKG_CONFIG_PATH} "${pkgconfig_installed_dir}${VCPKG_HOST_PATH_SEPARATOR}${pkgconfig_installed_share_dir}") | ||||||||||||||||||||||||||||||
| endif() | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| # Setup environment | ||||||||||||||||||||||||||||||
| set(ENV{CPPFLAGS} "${CPPFLAGS_${current_buildtype}}") | ||||||||||||||||||||||||||||||
| set(ENV{CFLAGS} "${CFLAGS_${current_buildtype}}") | ||||||||||||||||||||||||||||||
| set(ENV{CXXFLAGS} "${CXXFLAGS_${current_buildtype}}") | ||||||||||||||||||||||||||||||
|
|
@@ -866,7 +913,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) | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,3 +2,6 @@ set(VCPKG_TARGET_ARCHITECTURE arm) | |
| set(VCPKG_CRT_LINKAGE static) | ||
| set(VCPKG_LIBRARY_LINKAGE static) | ||
| set(VCPKG_CMAKE_SYSTEM_NAME Android) | ||
| # If you need to specify the ANDROID_NATIVE_API_LEVEL, | ||
| # please use the overlay triplet and set the value below | ||
| set(ENV{VCPKG_ANDROID_NATIVE_API_LEVEL} "detect") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is "detect" handled?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would probably more obvious if that line 6 would actually check for " |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,3 +2,6 @@ set(VCPKG_TARGET_ARCHITECTURE x86) | |
| set(VCPKG_CRT_LINKAGE static) | ||
| set(VCPKG_LIBRARY_LINKAGE static) | ||
| set(VCPKG_CMAKE_SYSTEM_NAME Android) | ||
| # If you need to specify the ANDROID_NATIVE_API_LEVEL, | ||
| # please use the overlay triplet and set the value below | ||
| set(ENV{VCPKG_ANDROID_NATIVE_API_LEVEL} "detect") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is this an environment variable?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Read this thread: #21847 (comment)
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we do this entirely in the toolchain instead? setting environment variables in the triplet is Not Okay, imo |
||
Uh oh!
There was an error while loading. Please reload this page.