mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-01-14 05:28:01 +08:00
[vcpkg] Make configure meson sane and work for all targets. (#10395)
* fix configure meson for non windows builds. * change to the two ports using meson * fix passing of empty compiler arguments. * dont transform / into - for all flags * copy meson logs into the buildtree to better diagnose CI errors of meson ports * another change to the two ports to actually force a CI rebuild * add missing /pkgconfig dir to PKG_CONFIG_PATH * fix pkgconfig setup * add share/pkgconfig to PKG_CONFIG_PATH * Add CMake path to PATH for meson * add share folder to prefix for meson * remove double message * add libdir so that meson does not install into architecture folder in linux and make prefix path target dependent. (Or should it be host dependent?) * bump controls * update toolchain selector to use VCPKG_TARGET_IS_<paltform>. * change pkgconfig prefix and path..... meson is not correctly handling native windows paths and eating "\" PKG_CONFIG_PATH also nees : to correctly separate paths Prefix still must be near to native path but with / instead of \ C:/somepath/
This commit is contained in:
parent
52b5dfd2ef
commit
bd0c7106f9
@ -1,4 +1,4 @@
|
||||
Source: fribidi
|
||||
Version: 2019-02-04-2
|
||||
Version: 2019-02-04-3
|
||||
Description: GNU FriBidi is an implementation of the Unicode Bidirectional Algorithm (bidi)
|
||||
Build-Depends: tool-meson
|
||||
|
@ -1,5 +1,3 @@
|
||||
include(vcpkg_common_functions)
|
||||
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO fribidi/fribidi
|
||||
@ -32,4 +30,4 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
|
||||
endif()
|
||||
|
||||
# Handle copyright
|
||||
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/fribidi RENAME copyright)
|
||||
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
|
||||
|
@ -1,5 +1,5 @@
|
||||
Source: libepoxy
|
||||
Version: 1.5.3-2
|
||||
Version: 1.5.3-3
|
||||
Homepage: https://github.com/anholt/libepoxy
|
||||
Description: Epoxy is a library for handling OpenGL function pointer management for you
|
||||
Build-Depends: tool-meson
|
||||
|
@ -1,5 +1,3 @@
|
||||
include(vcpkg_common_functions)
|
||||
|
||||
vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)
|
||||
|
||||
vcpkg_from_github(
|
||||
@ -72,5 +70,5 @@ endif()
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share/pkgconfig)
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share/pkgconfig)
|
||||
|
||||
file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libepoxy)
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/share/libepoxy/COPYING ${CURRENT_PACKAGES_DIR}/share/libepoxy/copyright)
|
||||
file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/share/${PORT}/COPYING ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright)
|
||||
|
@ -38,83 +38,218 @@ function(vcpkg_configure_meson)
|
||||
|
||||
file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel)
|
||||
file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg)
|
||||
|
||||
# use the same compiler options as in vcpkg_configure_cmake
|
||||
if(NOT VCPKG_TARGET_IS_WINDOWS)
|
||||
message(FATAL_ERROR "vcpkg_configure_meson() currently only supports windows targets.")
|
||||
|
||||
#Extract compiler flags
|
||||
if(NOT VCPKG_CHAINLOAD_TOOLCHAIN_FILE)
|
||||
set(MESON_CMAKE_FLAG_SUFFIX "_INIT")
|
||||
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
|
||||
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/windows.cmake")
|
||||
set(MESON_CMAKE_FLAG_SUFFIX "")
|
||||
elseif(VCPKG_TARGET_IS_LINUX)
|
||||
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/linux.cmake")
|
||||
elseif(VCPKG_TARGET_IS_ANDROID)
|
||||
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/android.cmake")
|
||||
elseif(VCPKG_TARGET_IS_OSX)
|
||||
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/osx.cmake")
|
||||
elseif(VVCPKG_TARGET_IS_FREEBSD)
|
||||
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/freebsd.cmake")
|
||||
elseif(VCPKG_TARGET_IS_MINGW)
|
||||
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/mingw.cmake")
|
||||
endif()
|
||||
endif()
|
||||
set(MESON_COMMON_CFLAGS "${MESON_COMMON_CFLAGS} /DWIN32 /D_WINDOWS /W3 /utf-8")
|
||||
set(MESON_COMMON_CXXFLAGS "${MESON_COMMON_CXXFLAGS} /DWIN32 /D_WINDOWS /W3 /utf-8 /GR /EHsc")
|
||||
|
||||
include("${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}")
|
||||
|
||||
if(DEFINED VCPKG_CRT_LINKAGE AND VCPKG_CRT_LINKAGE STREQUAL "dynamic")
|
||||
set(MESON_DEBUG_CFLAGS "${MESON_DEBUG_CFLAGS} /D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1")
|
||||
set(MESON_DEBUG_CXXFLAGS "${MESON_DEBUG_CXXFLAGS} /D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1")
|
||||
|
||||
set(MESON_RELEASE_CFLAGS "${MESON_RELEASE_CFLAGS} /MD /O2 /Gy /DNDEBUG /Z7")
|
||||
set(MESON_RELEASE_CXXFLAGS "${MESON_RELEASE_CXXFLAGS} /MD /O2 /Gy /DNDEBUG /Z7")
|
||||
elseif(DEFINED VCPKG_CRT_LINKAGE AND VCPKG_CRT_LINKAGE STREQUAL "static")
|
||||
set(MESON_DEBUG_CFLAGS "${MESON_DEBUG_CFLAGS} /D_DEBUG /MTd /Z7 /Ob0 /Od /RTC1")
|
||||
set(MESON_DEBUG_CXXFLAGS "${MESON_DEBUG_CXXFLAGS} /D_DEBUG /MTd /Z7 /Ob0 /Od /RTC1")
|
||||
|
||||
set(MESON_RELEASE_CFLAGS "${MESON_RELEASE_CFLAGS} /MT /O2 /Gy /DNDEBUG /Z7")
|
||||
set(MESON_RELEASE_CXXFLAGS "${MESON_RELEASE_CXXFLAGS} /MT /O2 /Gy /DNDEBUG /Z7")
|
||||
endif()
|
||||
|
||||
set(MESON_COMMON_LDFLAGS "${MESON_COMMON_LDFLAGS} /DEBUG")
|
||||
set(MESON_RELEASE_LDFLAGS "${MESON_RELEASE_LDFLAGS} /INCREMENTAL:NO /OPT:REF /OPT:ICF")
|
||||
string(APPEND MESON_COMMON_CFLAGS " ${CMAKE_C_FLAGS${MESON_CMAKE_FLAG_SUFFIX}}")
|
||||
string(APPEND MESON_COMMON_CXXFLAGS " ${CMAKE_CXX_FLAGS${MESON_CMAKE_FLAG_SUFFIX}}")
|
||||
|
||||
string(APPEND MESON_DEBUG_CFLAGS " ${CMAKE_C_FLAGS_DEBUG${MESON_CMAKE_FLAG_SUFFIX}}")
|
||||
string(APPEND MESON_DEBUG_CXXFLAGS " ${CMAKE_CXX_FLAGS_DEBUG${MESON_CMAKE_FLAG_SUFFIX}}")
|
||||
|
||||
string(APPEND MESON_RELEASE_CFLAGS " ${CMAKE_C_FLAGS_RELEASE${MESON_CMAKE_FLAG_SUFFIX}}")
|
||||
string(APPEND MESON_RELEASE_CXXFLAGS " ${CMAKE_CXX_FLAGS_RELEASE${MESON_CMAKE_FLAG_SUFFIX}}")
|
||||
|
||||
string(APPEND MESON_COMMON_LDFLAGS " ${CMAKE_SHARED_LINKER_FLAGS${MESON_CMAKE_FLAG_SUFFIX}}")
|
||||
string(APPEND MESON_DEBUG_LDFLAGS " ${CMAKE_SHARED_LINKER_FLAGS_DEBUG${MESON_CMAKE_FLAG_SUFFIX}}")
|
||||
string(APPEND MESON_RELEASE_LDFLAGS " ${CMAKE_SHARED_LINKER_FLAGS_RELEASE${MESON_CMAKE_FLAG_SUFFIX}}")
|
||||
|
||||
# select meson cmd-line options
|
||||
list(APPEND _vcm_OPTIONS -Dcmake_prefix_path=${CURRENT_INSTALLED_DIR})
|
||||
if(VCPKG_TARGET_IS_WINDOWS)
|
||||
list(APPEND _vcm_OPTIONS "-Dcmake_prefix_path=['${CURRENT_INSTALLED_DIR}','${CURRENT_INSTALLED_DIR}/share']")
|
||||
else()
|
||||
list(APPEND _vcm_OPTIONS "-Dcmake_prefix_path=['${CURRENT_INSTALLED_DIR}']")
|
||||
endif()
|
||||
list(APPEND _vcm_OPTIONS --buildtype plain --backend ninja --wrap-mode nodownload)
|
||||
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
||||
list(APPEND _vcm_OPTIONS --default-library shared)
|
||||
else()
|
||||
list(APPEND _vcm_OPTIONS --default-library static)
|
||||
endif()
|
||||
|
||||
list(APPEND _vcm_OPTIONS --libdir lib) # else meson install into an architecture describing folder
|
||||
list(APPEND _vcm_OPTIONS_DEBUG --prefix ${CURRENT_PACKAGES_DIR}/debug --includedir ../include)
|
||||
list(APPEND _vcm_OPTIONS_RELEASE --prefix ${CURRENT_PACKAGES_DIR})
|
||||
|
||||
vcpkg_find_acquire_program(MESON)
|
||||
|
||||
get_filename_component(CMAKE_PATH ${CMAKE_COMMAND} DIRECTORY)
|
||||
vcpkg_add_to_path("${CMAKE_PATH}") # Make CMake invokeable for Meson
|
||||
|
||||
vcpkg_find_acquire_program(NINJA)
|
||||
get_filename_component(NINJA_PATH ${NINJA} DIRECTORY)
|
||||
if(CMAKE_HOST_WIN32)
|
||||
set(_PATHSEP ";")
|
||||
vcpkg_add_to_path("${NINJA_PATH}")
|
||||
|
||||
if(NOT ENV{PKG_CONFIG})
|
||||
find_program(PKGCONFIG pkg-config)
|
||||
if(NOT PKGCONFIG AND CMAKE_HOST_WIN32)
|
||||
vcpkg_acquire_msys(MSYS_ROOT PACKAGES pkg-config)
|
||||
vcpkg_add_to_path("${MSYS_ROOT}/usr/bin")
|
||||
endif()
|
||||
find_program(PKGCONFIG pkg-config REQUIRED)
|
||||
else()
|
||||
set(_PATHSEP ":")
|
||||
debug_message(STATUS "PKG_CONFIG found in ENV! Using $ENV{PKG_CONFIG}")
|
||||
set(PKGCONFIG $ENV{PKG_CONFIG})
|
||||
endif()
|
||||
set(ENV{PATH} "$ENV{PATH}${_PATHSEP}${NINJA_PATH}")
|
||||
|
||||
# configure release
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
||||
message(STATUS "Configuring ${TARGET_TRIPLET}-rel")
|
||||
file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel)
|
||||
set(ENV{CFLAGS} "${MESON_COMMON_CFLAGS} ${MESON_RELEASE_CFLAGS}")
|
||||
set(ENV{CXXFLAGS} "${MESON_COMMON_CXXFLAGS} ${MESON_RELEASE_CXXFLAGS}")
|
||||
set(ENV{LDFLAGS} "${MESON_COMMON_LDFLAGS} ${MESON_RELEASE_LDFLAGS}")
|
||||
set(ENV{CPPFLAGS} "${MESON_COMMON_CPPFLAGS} ${MESON_RELEASE_CPPFLAGS}")
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND ${MESON} ${_vcm_OPTIONS} ${_vcm_OPTIONS_RELEASE} ${_vcm_SOURCE_PATH}
|
||||
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel
|
||||
LOGNAME config-${TARGET_TRIPLET}-rel
|
||||
)
|
||||
message(STATUS "Configuring ${TARGET_TRIPLET}-rel done")
|
||||
set(PKGCONFIG_SHARE_DIR "${CURRENT_INSTALLED_DIR}/share/pkgconfig/")
|
||||
if(WIN32)
|
||||
string(REGEX REPLACE "([a-zA-Z]):/" "/\\1/" PKGCONFIG_SHARE_DIR "${PKGCONFIG_SHARE_DIR}")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
||||
# configure debug
|
||||
# configure debug
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
||||
message(STATUS "Configuring ${TARGET_TRIPLET}-dbg")
|
||||
file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg)
|
||||
set(ENV{CFLAGS} "${MESON_COMMON_CFLAGS} ${MESON_DEBUG_CFLAGS}")
|
||||
set(ENV{CXXFLAGS} "${MESON_COMMON_CXXFLAGS} ${MESON_DEBUG_CXXFLAGS}")
|
||||
set(ENV{LDFLAGS} "${MESON_COMMON_LDFLAGS} ${MESON_DEBUG_LDFLAGS}")
|
||||
set(ENV{CPPFLAGS} "${MESON_COMMON_CPPFLAGS} ${MESON_DEBUG_CPPFLAGS}")
|
||||
|
||||
#setting up PKGCONFIG
|
||||
if(NOT PKGCONFIG MATCHES "--define-variable=prefix")
|
||||
set(PKGCONFIG_PREFIX "${CURRENT_INSTALLED_DIR}/debug")
|
||||
# if(WIN32)
|
||||
# string(REGEX REPLACE "([a-zA-Z]):/" "/\\1/" PKGCONFIG_PREFIX "${PKGCONFIG_PREFIX}")
|
||||
# endif()
|
||||
set(ENV{PKG_CONFIG} "${PKGCONFIG} --define-variable=prefix=${PKGCONFIG_PREFIX}")
|
||||
endif()
|
||||
set(PKGCONFIG_INSTALLED_DIR "${CURRENT_INSTALLED_DIR}/debug/lib/pkgconfig/")
|
||||
if(WIN32)
|
||||
string(REGEX REPLACE "([a-zA-Z]):/" "/\\1/" PKGCONFIG_INSTALLED_DIR "${PKGCONFIG_INSTALLED_DIR}")
|
||||
endif()
|
||||
if(ENV{PKG_CONFIG_PATH})
|
||||
set(BACKUP_ENV_PKG_CONFIG_PATH_DEBUG $ENV{PKG_CONFIG_PATH})
|
||||
set(ENV{PKG_CONFIG_PATH} "${PKGCONFIG_INSTALLED_DIR}: ${PKGCONFIG_SHARE_DIR}: $ENV{PKG_CONFIG_PATH}")
|
||||
else()
|
||||
set(ENV{PKG_CONFIG_PATH} "${PKGCONFIG_INSTALLED_DIR}: ${PKGCONFIG_SHARE_DIR}")
|
||||
endif()
|
||||
|
||||
set(CFLAGS "-Dc_args=[${MESON_COMMON_CFLAGS} ${MESON_DEBUG_CFLAGS}]")
|
||||
string(REGEX REPLACE " +(/|-)" "','\\1" CFLAGS ${CFLAGS}) # Seperate compiler arguments with comma and enclose in '
|
||||
string(REGEX REPLACE " *\\\]" "']" CFLAGS ${CFLAGS}) # Add trailing ' at end
|
||||
string(REGEX REPLACE "\\\['," "[" CFLAGS ${CFLAGS}) # Remove prepended ', introduced in #1
|
||||
string(REGEX REPLACE "\\\['\\\]" "[]" CFLAGS ${CFLAGS}) # Remove trailing ' introduced in #2 if no elements
|
||||
|
||||
set(CXXFLAGS "-Dcpp_args=[${MESON_COMMON_CXXFLAGS} ${MESON_DEBUG_CXXFLAGS}]")
|
||||
string(REGEX REPLACE " +(/|-)" "','\\1" CXXFLAGS ${CXXFLAGS})
|
||||
string(REGEX REPLACE " *\\\]" "']" CXXFLAGS ${CXXFLAGS})
|
||||
string(REGEX REPLACE "\\\['," "[" CXXFLAGS ${CXXFLAGS})
|
||||
string(REGEX REPLACE "\\\['\\\]" "[]" CXXFLAGS ${CXXFLAGS})
|
||||
|
||||
set(LDFLAGS "[${MESON_COMMON_LDFLAGS} ${MESON_DEBUG_LDFLAGS}]")
|
||||
string(REGEX REPLACE " +(/|-)" "','\\1" LDFLAGS ${LDFLAGS})
|
||||
string(REGEX REPLACE " *\\\]" "']" LDFLAGS ${LDFLAGS})
|
||||
string(REGEX REPLACE "\\\['," "[" LDFLAGS ${LDFLAGS})
|
||||
string(REGEX REPLACE "\\\['\\\]" "[]" LDFLAGS ${LDFLAGS})
|
||||
set(CLDFLAGS "-Dc_link_args=${LDFLAGS}")
|
||||
set(CXXLDFLAGS "-Dcpp_link_args=${LDFLAGS}")
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND ${MESON} ${_vcm_OPTIONS} ${_vcm_OPTIONS_DEBUG} ${_vcm_SOURCE_PATH}
|
||||
COMMAND ${MESON} ${_vcm_OPTIONS} ${_vcm_OPTIONS_DEBUG} ${_vcm_SOURCE_PATH} ${CFLAGS} ${CXXFLAGS} ${CLDFLAGS} ${CXXLDFLAGS}
|
||||
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg
|
||||
LOGNAME config-${TARGET_TRIPLET}-dbg
|
||||
)
|
||||
|
||||
#Copy meson log files into buildtree for CI
|
||||
if(EXISTS "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/meson-logs/meson-log.txt")
|
||||
file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/meson-logs/meson-log.txt" DESTINATION "${CURRENT_BUILDTREES_DIR}")
|
||||
file(RENAME "${CURRENT_BUILDTREES_DIR}/meson-log.txt" "${CURRENT_BUILDTREES_DIR}/meson-log-dbg.txt")
|
||||
endif()
|
||||
if(EXISTS "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/meson-logs/install-log.txt")
|
||||
file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/meson-logs/install-log.txt" DESTINATION "${CURRENT_BUILDTREES_DIR}")
|
||||
file(RENAME "${CURRENT_BUILDTREES_DIR}/install-log.txt" "${CURRENT_BUILDTREES_DIR}/install-log-dbg.txt")
|
||||
endif()
|
||||
message(STATUS "Configuring ${TARGET_TRIPLET}-dbg done")
|
||||
|
||||
#Restore PKG_CONFIG_PATH
|
||||
if(BACKUP_ENV_PKG_CONFIG_PATH_DEBUG)
|
||||
set(ENV{PKG_CONFIG_PATH} "${BACKUP_ENV_PKG_CONFIG_PATH_DEBUG}")
|
||||
unset(BACKUP_ENV_PKG_CONFIG_PATH_DEBUG)
|
||||
else()
|
||||
unset(ENV{PKG_CONFIG_PATH})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# configure release
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
||||
message(STATUS "Configuring ${TARGET_TRIPLET}-rel")
|
||||
file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel)
|
||||
#setting up PKGCONFIG
|
||||
if(NOT PKGCONFIG MATCHES "--define-variable=prefix")
|
||||
set(PKGCONFIG_PREFIX "${CURRENT_INSTALLED_DIR}")
|
||||
# if(WIN32)
|
||||
# string(REGEX REPLACE "([a-zA-Z]):/" "/\\1/" PKGCONFIG_PREFIX "${PKGCONFIG_PREFIX}")
|
||||
# endif()
|
||||
set(ENV{PKG_CONFIG} "${PKGCONFIG} --define-variable=prefix=${PKGCONFIG_PREFIX}")
|
||||
endif()
|
||||
set(PKGCONFIG_INSTALLED_DIR "${CURRENT_INSTALLED_DIR}/lib/pkgconfig/")
|
||||
if(WIN32)
|
||||
string(REGEX REPLACE "([a-zA-Z]):/" "/\\1/" PKGCONFIG_INSTALLED_DIR "${PKGCONFIG_INSTALLED_DIR}")
|
||||
endif()
|
||||
if(ENV{PKG_CONFIG_PATH})
|
||||
set(BACKUP_ENV_PKG_CONFIG_PATH_RELEASE $ENV{PKG_CONFIG_PATH})
|
||||
set(ENV{PKG_CONFIG_PATH} "${PKGCONFIG_INSTALLED_DIR}: ${PKGCONFIG_SHARE_DIR}: $ENV{PKG_CONFIG_PATH}")
|
||||
else()
|
||||
set(ENV{PKG_CONFIG_PATH} "${PKGCONFIG_INSTALLED_DIR}: ${PKGCONFIG_SHARE_DIR}")
|
||||
endif()
|
||||
|
||||
# Normalize flags for meson (i.e. " /string /with /flags " -> ['/string', '/with', '/flags'])
|
||||
set(CFLAGS "-Dc_args=[${MESON_COMMON_CFLAGS} ${MESON_RELEASE_CFLAGS}]")
|
||||
string(REGEX REPLACE " +(/|-)" "','\\1" CFLAGS ${CFLAGS}) # Seperate compiler arguments with comma and enclose in '
|
||||
string(REGEX REPLACE " *\\\]" "']" CFLAGS ${CFLAGS}) # Add trailing ' at end
|
||||
string(REGEX REPLACE "\\\['," "[" CFLAGS ${CFLAGS}) # Remove prepended ', introduced in #1
|
||||
string(REGEX REPLACE "\\\['\\\]" "[]" CFLAGS ${CFLAGS}) # Remove trailing ' introduced in #2 if no elements
|
||||
set(CXXFLAGS "-Dcpp_args=[${MESON_COMMON_CXXFLAGS} ${MESON_RELEASE_CXXFLAGS}]")
|
||||
string(REGEX REPLACE " +(/|-)" "','\\1" CXXFLAGS ${CXXFLAGS})
|
||||
string(REGEX REPLACE " *\\\]" "']" CXXFLAGS ${CXXFLAGS})
|
||||
string(REGEX REPLACE "\\\['," "[" CXXFLAGS ${CXXFLAGS})
|
||||
string(REGEX REPLACE "\\\['\\\]" "[]" CXXFLAGS ${CXXFLAGS})
|
||||
set(LDFLAGS "[${MESON_COMMON_LDFLAGS} ${MESON_RELEASE_LDFLAGS}]")
|
||||
string(REGEX REPLACE " +(/|-)" "','\\1" LDFLAGS ${LDFLAGS})
|
||||
string(REGEX REPLACE " *\\\]" "']" LDFLAGS ${LDFLAGS})
|
||||
string(REGEX REPLACE "\\\['," "[" LDFLAGS ${LDFLAGS})
|
||||
string(REGEX REPLACE "\\\['\\\]" "[]" LDFLAGS ${LDFLAGS})
|
||||
set(CLDFLAGS "-Dc_link_args=${LDFLAGS}")
|
||||
set(CXXLDFLAGS "-Dcpp_link_args=${LDFLAGS}")
|
||||
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND ${MESON} ${_vcm_OPTIONS} ${_vcm_OPTIONS_RELEASE} ${_vcm_SOURCE_PATH} ${CFLAGS} ${CXXFLAGS} ${CLDFLAGS} ${CXXLDFLAGS}
|
||||
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel
|
||||
LOGNAME config-${TARGET_TRIPLET}-rel
|
||||
)
|
||||
#Copy meson log files into buildtree for CI
|
||||
if(EXISTS "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/meson-logs/meson-log.txt")
|
||||
file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/meson-logs/meson-log.txt" DESTINATION "${CURRENT_BUILDTREES_DIR}")
|
||||
file(RENAME "${CURRENT_BUILDTREES_DIR}/meson-log.txt" "${CURRENT_BUILDTREES_DIR}/meson-log-rel.txt")
|
||||
endif()
|
||||
if(EXISTS "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/meson-logs/install-log.txt")
|
||||
file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/meson-logs/install-log.txt" DESTINATION "${CURRENT_BUILDTREES_DIR}")
|
||||
file(RENAME "${CURRENT_BUILDTREES_DIR}/install-log.txt" "${CURRENT_BUILDTREES_DIR}/install-log-rel.txt")
|
||||
endif()
|
||||
message(STATUS "Configuring ${TARGET_TRIPLET}-rel done")
|
||||
|
||||
#Restore PKG_CONFIG_PATH
|
||||
if(BACKUP_ENV_PKG_CONFIG_PATH_RELEASE)
|
||||
set(ENV{PKG_CONFIG_PATH} "${BACKUP_ENV_PKG_CONFIG_PATH_RELEASE}")
|
||||
unset(BACKUP_ENV_PKG_CONFIG_PATH_RELEASE)
|
||||
else()
|
||||
unset(ENV{PKG_CONFIG_PATH})
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
endfunction()
|
||||
|
Loading…
x
Reference in New Issue
Block a user