Skip to content
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

[vcpkg_configure_make] Misc fixes #31228

Merged
merged 58 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
78bb1df
Fix lib suffix matching
dg0yt Mar 23, 2023
94bfed4
Preserve flags when transforming standard libs
dg0yt Mar 23, 2023
fc21963
Use separate_arguments
dg0yt Mar 30, 2023
991cf8d
Fix transform
dg0yt Mar 30, 2023
d7bb678
Merge branch 'microsoft:master' into ldflags
dg0yt Apr 5, 2023
1006e38
Merge branch 'microsoft:master' into ldflags
dg0yt Apr 6, 2023
316d39e
Merge branch 'microsoft:master' into ldflags
dg0yt Apr 26, 2023
e3d0270
Merge branch 'microsoft:master' into ldflags
dg0yt Apr 29, 2023
d3afd55
Merge remote-tracking branch 'origin/master' into configure-make-rollup
dg0yt May 3, 2023
26e7924
[vcpkg_configure_make] Fix SKIP_CONFIGURE
dg0yt May 3, 2023
22b4736
Update linker flags
dg0yt May 4, 2023
b83ad8c
Update linker flags
dg0yt May 5, 2023
547b8d7
Fix regex substitution
dg0yt May 5, 2023
cca477e
Restore full CI
dg0yt May 10, 2023
34720ff
Merge remote-tracking branch 'origin/master' into configure-make-rollup
dg0yt May 11, 2023
0015e80
Reuse configure's linker flags setup
dg0yt May 13, 2023
65c2599
Handle ldflags separately from linker flags
dg0yt May 13, 2023
ecd3a0d
Factor out common definitions
dg0yt May 13, 2023
d8293a1
Control docdir and mandir for debug
dg0yt May 13, 2023
efefc8a
Use vcpkg_list APPEND
dg0yt May 13, 2023
ccb18c4
Don't pass -avoid-version into configure
dg0yt May 13, 2023
4f70993
Restore lost escaping
dg0yt May 13, 2023
27446b7
Copy --target from LDFLAGS to CC/CXX
dg0yt May 13, 2023
31a54c3
Consolidate macros into one function
dg0yt May 13, 2023
9369a62
Elaborate ABI flags
dg0yt May 15, 2023
1a8d34e
Elaborate flag processing
dg0yt May 18, 2023
7547fb9
Update warnings for embedded space
dg0yt May 18, 2023
0762e72
Update windows tool path fixup
dg0yt May 18, 2023
0f18276
[libudns] No cross builds
dg0yt May 13, 2023
90734f8
[vcpkg_find_acquire_program] Add VSCLANG
dg0yt May 18, 2023
4d435ba
[gmp] Update CCAS setup
dg0yt May 13, 2023
4240d3a
[nettle] Update CCAS setup
dg0yt May 15, 2023
9ceb749
Fix VSCLANG
dg0yt May 18, 2023
3cb4426
WIP
dg0yt May 18, 2023
0fcaa3e
Restore processing of isysroot
dg0yt May 19, 2023
d5581de
[nettle] Fix assembler option
dg0yt May 19, 2023
f000086
[liburing] Adjust
dg0yt May 19, 2023
9221c09
Variable name changes
dg0yt May 21, 2023
ef09721
Remove redundant separate arguments
dg0yt May 21, 2023
e3c3840
Merge remote-tracking branch 'origin/master' into configure-make-rollup
dg0yt Jun 10, 2023
14043b0
Move -m32/-m64 to ABI flags
dg0yt Jun 10, 2023
36304b8
Unify ABIFLAGS spelling
dg0yt Jun 10, 2023
6cbd138
CI
dg0yt Jun 11, 2023
e4e2ee6
Revert VSCLANG
dg0yt Jun 16, 2023
380413b
Merge remote-tracking branch 'origin/master' into configure-make-rollup
dg0yt Jun 16, 2023
8d09b55
Merge branch 'microsoft:master' into configure-make-rollup
dg0yt Jun 19, 2023
766b636
Merge remote-tracking branch 'origin/master' into configure-make-rollup
dg0yt Jun 27, 2023
6b345b1
Merge remote-tracking branch 'origin/master' into configure-make-rollup
dg0yt Jun 27, 2023
6cd7c74
Use GNU Make to build autotools ports on FreeBSD (microsoft/vcpkg#32282)
SchaichAlonso Jun 28, 2023
9e54255
Merge branch 'microsoft:master' into configure-make-rollup
dg0yt Jul 2, 2023
8579af4
Merge remote-tracking branch 'origin/master' into HEAD
dg0yt Dec 23, 2023
bad5007
Fix flag removal
dg0yt Dec 23, 2023
7d3f3c9
Drop separation of ABI flags
dg0yt Dec 23, 2023
8a64d8b
Handle '-arch=...'
dg0yt Dec 24, 2023
8ff9e76
Revert "Control docdir and mandir for debug"
dg0yt Dec 24, 2023
f8ed916
[icu] Pass uwp option to pkgdata
dg0yt Dec 24, 2023
37108e2
Restore old osx flags hook
dg0yt Dec 25, 2023
aca7914
Add triplet variable to make libtool pass --target to linker
dg0yt Dec 28, 2023
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
4 changes: 2 additions & 2 deletions scripts/azure-pipelines/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ parameters:
- name: tripletPattern
displayName: 'Enable triplets which contain this substring'
type: string
default: '-'
default: '^x64-uwp$'

jobs:
- template: windows/azure-pipelines.yml
Expand Down Expand Up @@ -112,4 +112,4 @@ jobs:
poolName: $(android-pool)
dockerImage: $(linux-docker-image)
vcpkgToolSha: ${{ parameters.vcpkgToolSha }}
tripletPattern: ${{ parameters.tripletPattern }}
tripletPattern: ${{ parameters.tripletPattern }}
126 changes: 58 additions & 68 deletions scripts/cmake/vcpkg_configure_make.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,6 @@ macro(z_vcpkg_append_to_configure_environment inoutstring var defaultval)
endif()
endmacro()

macro(z_convert_to_list input output)
string(REGEX MATCHALL "(( +|^ *)[^ ]+)" ${output} "${${input}}")
endmacro()
Comment on lines -119 to -121
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Replaced by standard separate_arguments.


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
Expand Down Expand Up @@ -168,7 +164,10 @@ function(vcpkg_configure_make)
if(EXISTS "${src_dir}/configure" AND EXISTS "${src_dir}/configure.ac" AND arg_AUTOCONFIG) # remove configure; rerun autoconf
set(requires_autoconfig ON)
file(REMOVE "${SRC_DIR}/configure") # remove possible outdated configure scripts
elseif(EXISTS "${src_dir}/configure" AND NOT arg_SKIP_CONFIGURE) # run normally; no autoconf or autogen required
elseif(arg_SKIP_CONFIGURE)
# no action requested
elseif(EXISTS "${src_dir}/configure")
# run normally; no autoconf or autogen required
elseif(EXISTS "${src_dir}/configure.ac") # Run autoconfig
set(requires_autoconfig ON)
set(arg_AUTOCONFIG ON)
Expand Down Expand Up @@ -573,11 +572,10 @@ function(vcpkg_configure_make)
endif()
endif()

z_convert_to_list(VCPKG_DETECTED_CMAKE_C_STANDARD_LIBRARIES c_libs_list)
z_convert_to_list(VCPKG_DETECTED_CMAKE_CXX_STANDARD_LIBRARIES cxx_libs_list)
set(all_libs_list ${c_libs_list} ${cxx_libs_list})
list(REMOVE_DUPLICATES all_libs_list)
list(TRANSFORM all_libs_list STRIP)
separate_arguments(c_libs_list NATIVE_COMMAND "${VCPKG_DETECTED_CMAKE_C_STANDARD_LIBRARIES}")
separate_arguments(cxx_libs_list NATIVE_COMMAND "${VCPKG_DETECTED_CMAKE_CXX_STANDARD_LIBRARIES}")
list(REMOVE_ITEM cxx_libs_list ${c_libs_list})
set(all_libs_list ${cxx_libs_list} ${c_libs_list})
#Do lib list transformation from name.lib to -lname if necessary
set(x_vcpkg_transform_libs ON)
if(VCPKG_TARGET_IS_UWP)
Expand All @@ -587,24 +585,20 @@ function(vcpkg_configure_make)
# Note: Env LIBPATH;LIB are on the search path for libtool by default on windows.
# It even does unix/dos-short/unix transformation with the path to get rid of spaces.
endif()
set(l_prefix)
if(x_vcpkg_transform_libs)
set(l_prefix "-l")
list(TRANSFORM all_libs_list REPLACE "(.dll.lib|.lib|.a|.so)$" "")
list(TRANSFORM all_libs_list REPLACE "[.](dll[.]lib|lib|a|so)$" "")
if(VCPKG_TARGET_IS_WINDOWS)
list(REMOVE_ITEM all_libs_list "uuid")
endif()
list(TRANSFORM all_libs_list REPLACE "^(${l_prefix})" "")
endif()
list(JOIN all_libs_list " ${l_prefix}" all_libs_string)
if(VCPKG_TARGET_IS_MINGW AND VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
# libtool must be told explicitly that there is no dynamic linkage for uuid.
# The "-Wl,..." syntax is understood by libtool and gcc, but no by ld.
string(REPLACE " -luuid" " -Wl,-Bstatic,-luuid,-Bdynamic" all_libs_string "${all_libs_string}")
list(TRANSFORM all_libs_list REPLACE "^([^-].*)" "-l\\1")
if(VCPKG_TARGET_IS_MINGW AND VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
# libtool must be told explicitly that there is no dynamic linkage for uuid.
# The "-Wl,..." syntax is understood by libtool and gcc, but no by ld.
list(TRANSFORM all_libs_list REPLACE "^-luuid\$" "-Wl,-Bstatic,-luuid,-Bdynamic")
endif()
endif()

if(all_libs_string)
set(all_libs_string "${l_prefix}${all_libs_string}")
if(all_libs_list)
list(JOIN all_libs_list " " all_libs_string)
if(DEFINED ENV{LIBS})
set(ENV{LIBS} "$ENV{LIBS} ${all_libs_string}")
else()
Expand Down Expand Up @@ -671,56 +665,52 @@ function(vcpkg_configure_make)
endif()

macro(z_vcpkg_setup_make_linker_flags_vars var_suffix)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
set(LINKER_FLAGS_${var_suffix} "${VCPKG_DETECTED_CMAKE_STATIC_LINKER_FLAGS_${var_suffix}}")
else() # dynamic
set(LINKER_FLAGS_${var_suffix} "${VCPKG_DETECTED_CMAKE_SHARED_LINKER_FLAGS_${var_suffix}}")
endif()
dg0yt marked this conversation as resolved.
Show resolved Hide resolved
set(ARFLAGS_${var_suffix} "${VCPKG_DETECTED_CMAKE_STATIC_LINKER_FLAGS_${var_suffix}}")
set(LDFLAGS_${var_suffix} "${VCPKG_DETECTED_CMAKE_SHARED_LINKER_FLAGS_${var_suffix}}")
if (CMAKE_HOST_WIN32 AND VCPKG_DETECTED_CMAKE_C_COMPILER_ID MATCHES [[cl\.exe$]])
if(NOT vcm_paths_with_spaces)
string(APPEND LDFLAGS_${var_suffix} " -L${z_vcpkg_installed_path}${path_suffix_${var_suffix}}/lib -L${z_vcpkg_installed_path}${path_suffix_${var_suffix}}/lib/manual-link")
set(arflags "${VCPKG_DETECTED_CMAKE_STATIC_LINKER_FLAGS_${var_suffix}}")
if(arflags)
# ARFLAGS need to know the command for creating an archive (Maybe needs user customization?)
# or extract it from CMake via CMAKE_${lang}_ARCHIVE_CREATE ?
# or from CMAKE_${lang}_${rule} with rule being one of CREATE_SHARED_MODULE CREATE_SHARED_LIBRARY LINK_EXECUTABLE
string(PREPEND arflags "cr ")
endif()
string(STRIP "${arflags}" ARFLAGS_${var_suffix})

set(ldflags "${VCPKG_DETECTED_CMAKE_SHARED_LINKER_FLAGS_${var_suffix}}")
# Could use a future VCPKG_DETECTED_CMAKE_LIBRARY_PATH_FLAG
set(library_path_flag "-L")
# Could use a future VCPKG_DETECTED_MSVC
if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_DETECTED_CMAKE_LINKER MATCHES [[link\.exe$]])
set(library_path_flag "-LIBPATH:")
endif()
set(linker_flag_escape "")
if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_DETECTED_CMAKE_C_COMPILER MATCHES [[cl\.exe$]])
# Removed by libtool
set(linker_flag_escape "-Xlinker ")
if(arg_USE_WRAPPERS)
# 1st and 3rd are removed by libtool, 2nd by wrapper
set(linker_flag_escape "-Xlinker -Xlinker -Xlinker ")
endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
set(linker_flags "${VCPKG_DETECTED_CMAKE_STATIC_LINKER_FLAGS_${var_suffix}}")
else() # dynamic
set(linker_flags "${VCPKG_DETECTED_CMAKE_SHARED_LINKER_FLAGS_${var_suffix}}")
endif()
if(DEFINED ENV{_LINK_})
set(LINK_ENV_${var_suffix} "$ENV{_LINK_} ${LINKER_FLAGS_${var_suffix}}")
set(LINK_ENV_${var_suffix} "$ENV{_LINK_} ${linker_flags}")
else()
set(LINK_ENV_${var_suffix} "${LINKER_FLAGS_${var_suffix}}")
endif()
else()
set(link_required_dirs "")
if(EXISTS "${CURRENT_INSTALLED_DIR}${path_suffix_${var_suffix}}/lib")
set(link_required_dirs "-L${z_vcpkg_installed_path}${path_suffix_${var_suffix}}/lib")
endif()
if(EXISTS "{CURRENT_INSTALLED_DIR}${path_suffix_${var_suffix}}/lib/manual-link")
set(link_required_dirs "${link_required_dirs} -L${z_vcpkg_installed_path}${path_suffix_${var_suffix}}/lib/manual-link")
endif()
string(STRIP "${link_required_dirs}" link_required_dirs)
if(link_required_dirs)
string(PREPEND LDFLAGS_${var_suffix} "${link_required_dirs} ")
# ARFLAGS doesn't need -L search paths since it just bundles object files
endif()
if(ARFLAGS_${var_suffix})
# ARFLAGS need to know the command for creating an archive (Maybe needs user customization?)
# or extract it from CMake via CMAKE_${lang}_ARCHIVE_CREATE ?
# or from CMAKE_${lang}_${rule} with rule being one of CREATE_SHARED_MODULE CREATE_SHARED_LIBRARY LINK_EXECUTABLE
string(PREPEND ARFLAGS_${var_suffix} "cr ")
endif()
string(STRIP "${LDFLAGS_${var_suffix}}" LDFLAGS_${var_suffix})
string(STRIP "${ARFLAGS_${var_suffix}}" ARFLAGS_${var_suffix})
if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_DETECTED_CMAKE_LINKER MATCHES [[link\.exe$]])
# Do not touch autotools quirks incoming!
# -Xlinker is repeated three times because:
# - libtool script eats -Xlinker
# - the compile wrapper eats -Xlinker
# - passing through both tools requires 3 -Xlinker; two being eaten in the first script.
# passing only through one script will keep one -Xlinker (done in configure)
# but cl will just ignore those with a warning. (Just like -Xcompiler)
separate_arguments(LDFLAGS_LIST NATIVE_COMMAND "${LDFLAGS_${var_suffix}}")
list(JOIN LDFLAGS_LIST " -Xlinker -Xlinker -Xlinker " LDFLAGS_${var_suffix})
string(PREPEND LDFLAGS_${var_suffix} "-Xlinker -Xlinker -Xlinker ")
dg0yt marked this conversation as resolved.
Show resolved Hide resolved
set(LINK_ENV_${var_suffix} "${linker_flags}")
endif()
separate_arguments(ldflags_list NATIVE_COMMAND "${ldflags}")
list(TRANSFORM ldflags_list REPLACE " " "\\\\ ")
list(TRANSFORM ldflags_list PREPEND "${linker_flag_escape}")
list(JOIN ldflags_list " " ldflags)
endif()
if(EXISTS "${CURRENT_INSTALLED_DIR}${path_suffix_${var_suffix}}/lib/manual-link")
string(PREPEND ldflags "${linker_flag_escape}${library_path_flag}${z_vcpkg_installed_path}${path_suffix_${var_suffix}}/lib/manual-link ")
endif()
if(EXISTS "${CURRENT_INSTALLED_DIR}${path_suffix_${var_suffix}}/lib")
string(PREPEND ldflags "${linker_flag_escape}${library_path_flag}${z_vcpkg_installed_path}${path_suffix_${var_suffix}}/lib ")
endif()
string(STRIP "${ldflags}" LDFLAGS_${var_suffix})
endmacro()

if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug" AND NOT arg_NO_DEBUG)
Expand Down