Skip to content

Commit

Permalink
[vcpkg_configure_make] Misc fixes (microsoft#31228)
Browse files Browse the repository at this point in the history
* Fix lib suffix matching

* Preserve flags when transforming standard libs

* Use separate_arguments

* Fix transform

* [vcpkg_configure_make] Fix SKIP_CONFIGURE

* Update linker flags

* Update linker flags

* Fix regex substitution

* Restore full CI

* Reuse configure's linker flags setup

* Handle ldflags separately from linker flags

* Factor out common definitions

* Control docdir and mandir for debug

* Use vcpkg_list APPEND

* Don't pass -avoid-version into configure

* Restore lost escaping

* Copy --target from LDFLAGS to CC/CXX

* Consolidate macros into one function

* Elaborate ABI flags

* Elaborate flag processing

* Update warnings for embedded space

* Update windows tool path fixup

* [libudns] No cross builds

* [vcpkg_find_acquire_program] Add VSCLANG

Find VS's clang without fallback to the giant LLVM download.

* [gmp] Update CCAS setup

* [nettle] Update CCAS setup

* Fix VSCLANG

* WIP

* Restore processing of isysroot

* [nettle] Fix assembler option

* [liburing] Adjust

* Variable name changes

* Remove redundant separate arguments

* Move -m32/-m64 to ABI flags

* Unify ABIFLAGS spelling

* CI

* Revert VSCLANG

* Use GNU Make to build autotools ports on FreeBSD (microsoft#32282)

* Fix flag removal

* Drop separation of ABI flags

* Handle '-arch=...'

* Revert "Control docdir and mandir for debug"

This reverts commit d8293a1.

* [icu] Pass uwp option to pkgdata

* Restore old osx flags hook

* Add triplet variable to make libtool pass --target to linker

---------

Co-authored-by: Schaich, Alonso <alonsoschaich@fastmail.fm>
  • Loading branch information
2 people authored and TomKatom committed Feb 23, 2024
1 parent fdb07ab commit 4c70d98
Show file tree
Hide file tree
Showing 6 changed files with 262 additions and 240 deletions.
1 change: 1 addition & 0 deletions ports/icu/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ elseif(VCPKG_TARGET_IS_UWP)
vcpkg_list(APPEND CONFIGURE_OPTIONS --disable-extras ac_cv_func_tzset=no ac_cv_func__tzset=no)
string(APPEND VCPKG_C_FLAGS " -DU_PLATFORM_HAS_WINUWP_API=1")
string(APPEND VCPKG_CXX_FLAGS " -DU_PLATFORM_HAS_WINUWP_API=1")
vcpkg_list(APPEND BUILD_OPTIONS "PKGDATA_OPTS=--windows-uwp-build -O ../data/icupkg.inc")
elseif(VCPKG_TARGET_IS_OSX AND VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
vcpkg_list(APPEND CONFIGURE_OPTIONS --enable-rpath)
if(DEFINED CMAKE_INSTALL_NAME_DIR)
Expand Down
1 change: 1 addition & 0 deletions ports/icu/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "icu",
"version": "74.1",
"port-version": 1,
"description": "Mature and widely used Unicode and localization library.",
"homepage": "https://icu.unicode.org/home",
"license": "ICU",
Expand Down
59 changes: 22 additions & 37 deletions scripts/cmake/vcpkg_build_make.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function(vcpkg_build_make)
#TODO: optimize for install-data (release) and install-exec (release/debug)

else()
if(VCPKG_HOST_IS_OPENBSD)
if(VCPKG_HOST_IS_FREEBSD OR VCPKG_HOST_IS_OPENBSD)
find_program(Z_VCPKG_MAKE gmake REQUIRED)
else()
find_program(Z_VCPKG_MAKE make REQUIRED)
Expand All @@ -70,45 +70,30 @@ function(vcpkg_build_make)
# Since includes are buildtype independent those are setup by vcpkg_configure_make
vcpkg_backup_env_variables(VARS LIB LIBPATH LIBRARY_PATH LD_LIBRARY_PATH CPPFLAGS CFLAGS CXXFLAGS RCFLAGS)

z_vcpkg_configure_make_common_definitions()

foreach(buildtype IN ITEMS "debug" "release")
if (buildtype STREQUAL "debug" AND _VCPKG_MAKE_NO_DEBUG)
continue()
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "${buildtype}")
if("${buildtype}" STREQUAL "debug")
set(short_buildtype "-dbg")
set(cmake_buildtype "DEBUG")
set(path_suffix "/debug")
else()
# In NO_DEBUG mode, we only use ${TARGET_TRIPLET} directory.
set(short_buildtype "-rel")
set(cmake_buildtype "RELEASE")
set(path_suffix "")
string(TOUPPER "${buildtype}" cmake_buildtype)
set(short_buildtype "${short_name_${cmake_buildtype}}")
set(path_suffix "${path_suffix_${cmake_buildtype}}")

set(working_directory "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${short_buildtype}/${arg_SUBPATH}")
message(STATUS "Building ${TARGET_TRIPLET}-${short_buildtype}")

if("libtool-link-pass-target" IN_LIST VCPKG_BUILD_MAKE_FIXUP)
# Pass --target to the linker, e.g. for Android
file(GLOB_RECURSE libtool_files "${working_directory}/libtool")
foreach(file IN LISTS libtool_files)
vcpkg_replace_string("${file}" [[-xtarget=*|]] [[-xtarget=*|--target=*|]])
endforeach()
endif()

set(working_directory "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}${short_buildtype}/${arg_SUBPATH}")
message(STATUS "Building ${TARGET_TRIPLET}${short_buildtype}")
z_vcpkg_configure_make_process_flags("${cmake_buildtype}")

z_vcpkg_extract_cpp_flags_and_set_cflags_and_cxxflags("${cmake_buildtype}")

if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
set(LINKER_FLAGS_${cmake_buildtype} "${VCPKG_DETECTED_CMAKE_STATIC_LINKER_FLAGS_${cmake_buildtype}}")
else() # dynamic
set(LINKER_FLAGS_${cmake_buildtype} "${VCPKG_DETECTED_CMAKE_SHARED_LINKER_FLAGS_${cmake_buildtype}}")
endif()
set(LDFLAGS_${cmake_buildtype} "")
if(EXISTS "${Z_VCPKG_INSTALLED}${path_suffix}/lib")
string(APPEND LDFLAGS_${cmake_buildtype} " -L${Z_VCPKG_INSTALLED}${path_suffix}/lib")
endif()
if(EXISTS "${Z_VCPKG_INSTALLED}${path_suffix}/lib/manual-link")
string(APPEND LDFLAGS_${cmake_buildtype} " -L${Z_VCPKG_INSTALLED}${path_suffix}/lib/manual-link")
endif()
if (CMAKE_HOST_WIN32 AND VCPKG_DETECTED_CMAKE_C_COMPILER MATCHES "cl.exe")
set(LINK_ENV_${cmake_buildtype} "$ENV{_LINK_} ${LINKER_FLAGS_${cmake_buildtype}}")
else()
string(APPEND LDFLAGS_${cmake_buildtype} " ${LINKER_FLAGS_${cmake_buildtype}}")
endif()

# Setup environment
set(ENV{CPPFLAGS} "${CPPFLAGS_${cmake_buildtype}}")
set(ENV{CFLAGS} "${CFLAGS_${cmake_buildtype}}")
Expand Down Expand Up @@ -145,31 +130,31 @@ function(vcpkg_build_make)
vcpkg_execute_build_process(
COMMAND ${no_parallel_make_cmd_line}
WORKING_DIRECTORY "${working_directory}"
LOGNAME "${arg_LOGFILE_ROOT}-${TARGET_TRIPLET}${short_buildtype}"
LOGNAME "${arg_LOGFILE_ROOT}-${TARGET_TRIPLET}-${short_buildtype}"
)
else()
vcpkg_execute_build_process(
COMMAND ${make_cmd_line}
NO_PARALLEL_COMMAND ${no_parallel_make_cmd_line}
WORKING_DIRECTORY "${working_directory}"
LOGNAME "${arg_LOGFILE_ROOT}-${TARGET_TRIPLET}${short_buildtype}"
LOGNAME "${arg_LOGFILE_ROOT}-${TARGET_TRIPLET}-${short_buildtype}"
)
endif()

file(READ "${CURRENT_BUILDTREES_DIR}/${arg_LOGFILE_ROOT}-${TARGET_TRIPLET}${short_buildtype}-out.log" logdata)
file(READ "${CURRENT_BUILDTREES_DIR}/${arg_LOGFILE_ROOT}-${TARGET_TRIPLET}-${short_buildtype}-out.log" logdata)
if(logdata MATCHES "Warning: linker path does not have real file for library")
message(FATAL_ERROR "libtool could not find a file being linked against!")
endif()

if (arg_ENABLE_INSTALL)
message(STATUS "Installing ${TARGET_TRIPLET}${short_buildtype}")
message(STATUS "Installing ${TARGET_TRIPLET}-${short_buildtype}")
vcpkg_list(SET make_cmd_line ${make_command} ${install_opts})
vcpkg_list(SET no_parallel_make_cmd_line ${make_command} ${no_parallel_install_opts})
vcpkg_execute_build_process(
COMMAND ${make_cmd_line}
NO_PARALLEL_COMMAND ${no_parallel_make_cmd_line}
WORKING_DIRECTORY "${working_directory}"
LOGNAME "install-${TARGET_TRIPLET}${short_buildtype}"
LOGNAME "install-${TARGET_TRIPLET}-${short_buildtype}"
)
endif()

Expand Down
Loading

0 comments on commit 4c70d98

Please sign in to comment.