mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-27 18:31:15 +08:00
[vcpkg/meson] fix some details (#15756)
* [vcpkg_install_meson] add bin to path to run code generators * [vcpkg_configure_meson] deactivate native compiler in cross builds make x86 on x86_x64 a native instead of a cross build (as long as we are not building for UWP) * remove double spaces in _FLAGS remove unnecessary comments * change regex to take double - into account. * add missing removal of multiple spaces back into the regex * remove ws diff change * remove ws to reduce diff * Change macro to function Co-authored-by: Robert Schumacher <roschuma@microsoft.com> * UWP is cross target. Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
This commit is contained in:
parent
db1df24767
commit
8646c6587b
@ -6,9 +6,13 @@ Builds a meson project previously configured with `vcpkg_configure_meson()`.
|
||||
|
||||
## Usage
|
||||
```cmake
|
||||
vcpkg_install_meson()
|
||||
vcpkg_install_meson([ADD_BIN_TO_PATH])
|
||||
```
|
||||
|
||||
## Parameters:
|
||||
### ADD_BIN_TO_PATH
|
||||
Adds the appropriate Release and Debug `bin\` directories to the path during the build such that executables can run against the in-tree DLLs.
|
||||
|
||||
## Examples
|
||||
|
||||
* [fribidi](https://github.com/Microsoft/vcpkg/blob/master/ports/fribidi/portfile.cmake)
|
||||
|
19
scripts/buildsystems/meson/none.txt
Normal file
19
scripts/buildsystems/meson/none.txt
Normal file
@ -0,0 +1,19 @@
|
||||
# native file used to make the build machine compiler unusable
|
||||
|
||||
[host_machine]
|
||||
system = 'none'
|
||||
cpu_family = 'none'
|
||||
cpu = 'none'
|
||||
endian = 'little'
|
||||
|
||||
[properties]
|
||||
|
||||
[binaries]
|
||||
c = ['false']
|
||||
cpp = ['false']
|
||||
objc = ['false']
|
||||
objcpp = ['false']
|
||||
ar = ['false']
|
||||
pkgconfig = ['false']
|
||||
cmake = ['false']
|
||||
ninja = ['false']
|
@ -69,7 +69,10 @@ function(vcpkg_internal_meson_generate_native_file _additional_binaries) #https:
|
||||
|
||||
string(APPEND NATIVE "[built-in options]\n") #https://mesonbuild.com/Builtin-options.html
|
||||
if(VCPKG_DETECTED_CMAKE_C_COMPILER MATCHES "cl.exe")
|
||||
string(APPEND NATIVE "cpp_eh='none'\n") # To make sure meson is not adding eh flags by itself using msvc
|
||||
# This is currently wrongly documented in the meson docs or buggy. The docs say: 'none' = no flags
|
||||
# In reality however 'none' tries to deactivate eh and meson passes the flags for it resulting in a lot of warnings
|
||||
# about overriden flags. Until this is fixed in meson vcpkg should not pass this here.
|
||||
# string(APPEND NATIVE "cpp_eh='none'\n") # To make sure meson is not adding eh flags by itself using msvc
|
||||
endif()
|
||||
if(VCPKG_TARGET_IS_WINDOWS)
|
||||
string(REGEX REPLACE "( |^)(-|/)" ";\\2" WIN_C_STANDARD_LIBRARIES "${VCPKG_DETECTED_CMAKE_C_STANDARD_LIBRARIES}")
|
||||
@ -92,51 +95,56 @@ function(vcpkg_internal_meson_generate_native_file _additional_binaries) #https:
|
||||
endfunction()
|
||||
|
||||
function(vcpkg_internal_meson_convert_compiler_flags_to_list _out_var _compiler_flags)
|
||||
string(REGEX REPLACE [=[( +|^)((\"(\\\"|[^"])+\"|\\\"|\\ |[^ ])+)]=] ";\\2" ${_out_var} "${_compiler_flags}")
|
||||
string(REPLACE ";" "\\\;" tmp_var "${_compiler_flags}")
|
||||
string(REGEX REPLACE [=[( +|^)((\"(\\\"|[^"])+\"|\\\"|\\ |[^ ])+)]=] ";\\2" ${_out_var} "${tmp_var}")
|
||||
list(POP_FRONT ${_out_var}) # The first element is always empty due to the above replacement
|
||||
list(TRANSFORM ${_out_var} STRIP) # Strip leading trailing whitespaces from each element in the list.
|
||||
set(${_out_var} "${${_out_var}}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(vcpkg_internal_meson_generate_native_file_config _config) #https://mesonbuild.com/Native-environments.html
|
||||
function(vcpkg_internal_meson_convert_list_to_python_array _out_var)
|
||||
set(FLAG_LIST ${ARGN})
|
||||
list(TRANSFORM FLAG_LIST APPEND "'")
|
||||
list(TRANSFORM FLAG_LIST PREPEND "'")
|
||||
list(JOIN FLAG_LIST ", " ${_out_var})
|
||||
string(REPLACE "'', " "" ${_out_var} "${${_out_var}}") # remove empty elements if any
|
||||
set(${_out_var} "[${${_out_var}}]" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Generates the required compiler properties for meson
|
||||
function(vcpkg_internal_meson_generate_flags_properties_string _out_var _config)
|
||||
if(VCPKG_TARGET_IS_WINDOWS)
|
||||
set(L_FLAG /LIBPATH:)
|
||||
else()
|
||||
set(L_FLAG -L)
|
||||
endif()
|
||||
set(PATH_SUFFIX_DEBUG /debug)
|
||||
set(LIBPATH_${_config} "'${L_FLAG}${CURRENT_INSTALLED_DIR}${PATH_SUFFIX_${_config}}/lib'")
|
||||
|
||||
set(NATIVE_${_config} "[properties]\n") #https://mesonbuild.com/Builtin-options.html
|
||||
set(LIBPATH_${_config} "${L_FLAG}${CURRENT_INSTALLED_DIR}${PATH_SUFFIX_${_config}}/lib")
|
||||
vcpkg_internal_meson_convert_compiler_flags_to_list(MESON_CFLAGS_${_config} "${VCPKG_DETECTED_CMAKE_C_FLAGS_${_config}}")
|
||||
list(TRANSFORM MESON_CFLAGS_${_config} APPEND "'")
|
||||
list(TRANSFORM MESON_CFLAGS_${_config} PREPEND "'")
|
||||
#list(APPEND MESON_CFLAGS_${_config} "${LIBPATH_${_config}}")
|
||||
list(APPEND MESON_CFLAGS_${_config} "'-I${CURRENT_INSTALLED_DIR}/include'")
|
||||
list(JOIN MESON_CFLAGS_${_config} ", " MESON_CFLAGS_${_config})
|
||||
string(REPLACE "'', " "" MESON_CFLAGS_${_config} "${MESON_CFLAGS_${_config}}")
|
||||
string(APPEND NATIVE_${_config} "c_args = [${MESON_CFLAGS_${_config}}]\n")
|
||||
list(APPEND MESON_CFLAGS_${_config} "-I\"${CURRENT_INSTALLED_DIR}/include\"")
|
||||
vcpkg_internal_meson_convert_list_to_python_array(MESON_CFLAGS_${_config} ${MESON_CFLAGS_${_config}})
|
||||
string(APPEND ${_out_var} "c_args = ${MESON_CFLAGS_${_config}}\n")
|
||||
vcpkg_internal_meson_convert_compiler_flags_to_list(MESON_CXXFLAGS_${_config} "${VCPKG_DETECTED_CMAKE_CXX_FLAGS_${_config}}")
|
||||
list(TRANSFORM MESON_CXXFLAGS_${_config} APPEND "'")
|
||||
list(TRANSFORM MESON_CXXFLAGS_${_config} PREPEND "'")
|
||||
#list(APPEND MESON_CXXFLAGS_${_config} "${LIBPATH_${_config}}")
|
||||
list(APPEND MESON_CXXFLAGS_${_config} "'-I${CURRENT_INSTALLED_DIR}/include'")
|
||||
list(JOIN MESON_CXXFLAGS_${_config} ", " MESON_CXXFLAGS_${_config})
|
||||
string(REPLACE "'', " "" MESON_CXXFLAGS_${_config} "${MESON_CXXFLAGS_${_config}}")
|
||||
string(APPEND NATIVE_${_config} "cpp_args = [${MESON_CXXFLAGS_${_config}}]\n")
|
||||
|
||||
list(APPEND MESON_CXXFLAGS_${_config} "-I\"${CURRENT_INSTALLED_DIR}/include\"")
|
||||
vcpkg_internal_meson_convert_list_to_python_array(MESON_CXXFLAGS_${_config} ${MESON_CXXFLAGS_${_config}})
|
||||
string(APPEND ${_out_var} "cpp_args = ${MESON_CXXFLAGS_${_config}}\n")
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
||||
set(LINKER_FLAGS_${_config} "${VCPKG_DETECTED_CMAKE_SHARED_LINKER_FLAGS_${_config}}")
|
||||
else()
|
||||
set(LINKER_FLAGS_${_config} "${VCPKG_DETECTED_CMAKE_STATIC_LINKER_FLAGS_${_config}}")
|
||||
endif()
|
||||
vcpkg_internal_meson_convert_compiler_flags_to_list(LINKER_FLAGS_${_config} "${LINKER_FLAGS_${_config}}")
|
||||
list(TRANSFORM LINKER_FLAGS_${_config} APPEND "'")
|
||||
list(TRANSFORM LINKER_FLAGS_${_config} PREPEND "'")
|
||||
list(APPEND LINKER_FLAGS_${_config} "${LIBPATH_${_config}}")
|
||||
list(JOIN LINKER_FLAGS_${_config} ", " LINKER_FLAGS_${_config})
|
||||
string(REPLACE "'', " "" LINKER_FLAGS_${_config} "${LINKER_FLAGS_${_config}}")
|
||||
string(APPEND NATIVE_${_config} "c_link_args = [${LINKER_FLAGS_${_config}}]\n")
|
||||
string(APPEND NATIVE_${_config} "cpp_link_args = [${LINKER_FLAGS_${_config}}]\n")
|
||||
vcpkg_internal_meson_convert_list_to_python_array(LINKER_FLAGS_${_config} ${LINKER_FLAGS_${_config}})
|
||||
string(APPEND ${_out_var} "c_link_args = ${LINKER_FLAGS_${_config}}\n")
|
||||
string(APPEND ${_out_var} "cpp_link_args = ${LINKER_FLAGS_${_config}}\n")
|
||||
set(${_out_var} "${${_out_var}}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(vcpkg_internal_meson_generate_native_file_config _config) #https://mesonbuild.com/Native-environments.html
|
||||
set(NATIVE_${_config} "[properties]\n") #https://mesonbuild.com/Builtin-options.html
|
||||
vcpkg_internal_meson_generate_flags_properties_string(NATIVE_PROPERTIES ${_config})
|
||||
string(APPEND NATIVE_${_config} "${NATIVE_PROPERTIES}")
|
||||
#Setup CMake properties
|
||||
string(APPEND NATIVE_${_config} "cmake_toolchain_file = '${SCRIPTS}/buildsystems/vcpkg.cmake'\n")
|
||||
string(APPEND NATIVE_${_config} "[cmake]\n")
|
||||
@ -254,7 +262,7 @@ function(vcpkg_internal_meson_generate_cross_file _additional_binaries) #https:/
|
||||
endforeach()
|
||||
|
||||
string(APPEND CROSS "[properties]\n")
|
||||
string(APPEND CROSS "skip_sanity_check = true\n")
|
||||
|
||||
string(APPEND CROSS "[host_machine]\n")
|
||||
string(APPEND CROSS "endian = 'little'\n")
|
||||
if(NOT VCPKG_CMAKE_SYSTEM_NAME)
|
||||
@ -278,7 +286,7 @@ function(vcpkg_internal_meson_generate_cross_file _additional_binaries) #https:/
|
||||
string(APPEND CROSS "cpu_family = '${BUILD_CPU_FAM}'\n")
|
||||
string(APPEND CROSS "cpu = '${BUILD_CPU}'\n")
|
||||
|
||||
if(NOT BUILD_CPU_FAM STREQUAL HOST_CPU_FAM OR VCPKG_TARGET_IS_ANDROID OR VCPKG_TARGET_IS_IOS)
|
||||
if(NOT BUILD_CPU_FAM MATCHES "${HOST_CPU_FAM}" OR VCPKG_TARGET_IS_ANDROID OR VCPKG_TARGET_IS_IOS OR VCPKG_TARGET_IS_UWP)
|
||||
set(_file "${CURRENT_BUILDTREES_DIR}/meson-cross-${TARGET_TRIPLET}.log")
|
||||
set(VCPKG_MESON_CROSS_FILE "${_file}" PARENT_SCOPE)
|
||||
file(WRITE "${_file}" "${CROSS}")
|
||||
@ -286,46 +294,10 @@ function(vcpkg_internal_meson_generate_cross_file _additional_binaries) #https:/
|
||||
endfunction()
|
||||
|
||||
function(vcpkg_internal_meson_generate_cross_file_config _config) #https://mesonbuild.com/Native-environments.html
|
||||
if(VCPKG_TARGET_IS_WINDOWS)
|
||||
set(L_FLAG /LIBPATH:)
|
||||
else()
|
||||
set(L_FLAG -L)
|
||||
endif()
|
||||
set(PATH_SUFFIX_DEBUG /debug)
|
||||
set(LIBPATH_${_config} "'${L_FLAG}${CURRENT_INSTALLED_DIR}${PATH_SUFFIX_${_config}}/lib'")
|
||||
|
||||
|
||||
set(NATIVE_${_config} "[properties]\n") #https://mesonbuild.com/Builtin-options.html
|
||||
vcpkg_internal_meson_convert_compiler_flags_to_list(MESON_CFLAGS_${_config} "${VCPKG_DETECTED_CMAKE_C_FLAGS_${_config}}")
|
||||
list(TRANSFORM MESON_CFLAGS_${_config} APPEND "'")
|
||||
list(TRANSFORM MESON_CFLAGS_${_config} PREPEND "'")
|
||||
list(APPEND MESON_CFLAGS_${_config} "'-I\"${CURRENT_INSTALLED_DIR}/include\"'")
|
||||
list(JOIN MESON_CFLAGS_${_config} ", " MESON_CFLAGS_${_config})
|
||||
string(REPLACE "'', " "" MESON_CFLAGS_${_config} "${MESON_CFLAGS_${_config}}")
|
||||
string(APPEND NATIVE_${_config} "c_args = [${MESON_CFLAGS_${_config}}]\n")
|
||||
vcpkg_internal_meson_convert_compiler_flags_to_list(MESON_CXXFLAGS_${_config} "${VCPKG_DETECTED_CMAKE_CXX_FLAGS_${_config}}")
|
||||
list(TRANSFORM MESON_CXXFLAGS_${_config} APPEND "'")
|
||||
list(TRANSFORM MESON_CXXFLAGS_${_config} PREPEND "'")
|
||||
list(APPEND MESON_CXXFLAGS_${_config} "'-I\"${CURRENT_INSTALLED_DIR}/include\"'")
|
||||
list(JOIN MESON_CXXFLAGS_${_config} ", " MESON_CXXFLAGS_${_config})
|
||||
string(REPLACE "'', " "" MESON_CXXFLAGS_${_config} "${MESON_CXXFLAGS_${_config}}")
|
||||
string(APPEND NATIVE_${_config} "cpp_args = [${MESON_CXXFLAGS_${_config}}]\n")
|
||||
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
||||
set(LINKER_FLAGS_${_config} "${VCPKG_DETECTED_CMAKE_SHARED_LINKER_FLAGS_${_config}}")
|
||||
else()
|
||||
set(LINKER_FLAGS_${_config} "${VCPKG_DETECTED_CMAKE_STATIC_LINKER_FLAGS_${_config}}")
|
||||
endif()
|
||||
vcpkg_internal_meson_convert_compiler_flags_to_list(LINKER_FLAGS_${_config} "${LINKER_FLAGS_${_config}}")
|
||||
list(TRANSFORM LINKER_FLAGS_${_config} APPEND "'")
|
||||
list(TRANSFORM LINKER_FLAGS_${_config} PREPEND "'")
|
||||
list(APPEND LINKER_FLAGS_${_config} "${LIBPATH_${_config}}")
|
||||
list(JOIN LINKER_FLAGS_${_config} ", " LINKER_FLAGS_${_config})
|
||||
string(REPLACE "'', " "" LINKER_FLAGS_${_config} "${LINKER_FLAGS_${_config}}")
|
||||
string(APPEND NATIVE_${_config} "c_link_args = [${LINKER_FLAGS_${_config}}]\n")
|
||||
string(APPEND NATIVE_${_config} "cpp_link_args = [${LINKER_FLAGS_${_config}}]\n")
|
||||
|
||||
string(APPEND NATIVE_${_config} "[built-in options]\n")
|
||||
set(CROSS_${_config} "[properties]\n") #https://mesonbuild.com/Builtin-options.html
|
||||
vcpkg_internal_meson_generate_flags_properties_string(CROSS_PROPERTIES ${_config})
|
||||
string(APPEND CROSS_${_config} "${CROSS_PROPERTIES}")
|
||||
string(APPEND CROSS_${_config} "[built-in options]\n")
|
||||
if(VCPKG_TARGET_IS_WINDOWS)
|
||||
if(VCPKG_CRT_LINKAGE STREQUAL "static")
|
||||
set(CRT mt)
|
||||
@ -335,13 +307,12 @@ function(vcpkg_internal_meson_generate_cross_file_config _config) #https://meson
|
||||
if(${_config} STREQUAL DEBUG)
|
||||
set(CRT ${CRT}d)
|
||||
endif()
|
||||
string(APPEND NATIVE_${_config} "b_vscrt = '${CRT}'\n")
|
||||
string(APPEND CROSS_${_config} "b_vscrt = '${CRT}'\n")
|
||||
endif()
|
||||
|
||||
string(TOLOWER "${_config}" lowerconfig)
|
||||
set(_file "${CURRENT_BUILDTREES_DIR}/meson-cross-${TARGET_TRIPLET}-${lowerconfig}.log")
|
||||
set(VCPKG_MESON_CROSS_FILE_${_config} "${_file}" PARENT_SCOPE)
|
||||
file(WRITE "${_file}" "${NATIVE_${_config}}")
|
||||
file(WRITE "${_file}" "${CROSS_${_config}}")
|
||||
endfunction()
|
||||
|
||||
|
||||
@ -349,8 +320,8 @@ function(vcpkg_configure_meson)
|
||||
# parse parameters such that semicolons in options arguments to COMMAND don't get erased
|
||||
cmake_parse_arguments(PARSE_ARGV 0 _vcm "" "SOURCE_PATH" "OPTIONS;OPTIONS_DEBUG;OPTIONS_RELEASE;ADDITIONAL_NATIVE_BINARIES;ADDITIONAL_CROSS_BINARIES")
|
||||
|
||||
file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel)
|
||||
file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg)
|
||||
file(REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel")
|
||||
file(REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg")
|
||||
|
||||
vcpkg_internal_get_cmake_vars(OUTPUT_FILE _VCPKG_CMAKE_VARS_FILE)
|
||||
set(_VCPKG_CMAKE_VARS_FILE "${_VCPKG_CMAKE_VARS_FILE}" PARENT_SCOPE)
|
||||
@ -375,19 +346,6 @@ function(vcpkg_configure_meson)
|
||||
|
||||
list(APPEND _vcm_OPTIONS --buildtype plain --backend ninja --wrap-mode nodownload)
|
||||
|
||||
if(NOT VCPKG_MESON_NATIVE_FILE)
|
||||
vcpkg_internal_meson_generate_native_file("_vcm_ADDITIONAL_NATIVE_BINARIES")
|
||||
endif()
|
||||
if(NOT VCPKG_MESON_NATIVE_FILE_DEBUG)
|
||||
vcpkg_internal_meson_generate_native_file_config(DEBUG)
|
||||
endif()
|
||||
if(NOT VCPKG_MESON_NATIVE_FILE_RELEASE)
|
||||
vcpkg_internal_meson_generate_native_file_config(RELEASE)
|
||||
endif()
|
||||
list(APPEND _vcm_OPTIONS --native "${VCPKG_MESON_NATIVE_FILE}")
|
||||
list(APPEND _vcm_OPTIONS_DEBUG --native "${VCPKG_MESON_NATIVE_FILE_DEBUG}")
|
||||
list(APPEND _vcm_OPTIONS_RELEASE --native "${VCPKG_MESON_NATIVE_FILE_RELEASE}")
|
||||
|
||||
if(NOT VCPKG_MESON_CROSS_FILE)
|
||||
vcpkg_internal_meson_generate_cross_file("_vcm_ADDITIONAL_CROSS_BINARIES")
|
||||
endif()
|
||||
@ -400,7 +358,6 @@ function(vcpkg_configure_meson)
|
||||
if(VCPKG_MESON_CROSS_FILE)
|
||||
list(APPEND _vcm_OPTIONS --cross "${VCPKG_MESON_CROSS_FILE}")
|
||||
endif()
|
||||
|
||||
if(VCPKG_MESON_CROSS_FILE_DEBUG)
|
||||
list(APPEND _vcm_OPTIONS_DEBUG --cross "${VCPKG_MESON_CROSS_FILE_DEBUG}")
|
||||
endif()
|
||||
@ -408,6 +365,22 @@ function(vcpkg_configure_meson)
|
||||
list(APPEND _vcm_OPTIONS_RELEASE --cross "${VCPKG_MESON_CROSS_FILE_RELEASE}")
|
||||
endif()
|
||||
|
||||
if(NOT VCPKG_MESON_NATIVE_FILE AND NOT VCPKG_MESON_CROSS_FILE)
|
||||
vcpkg_internal_meson_generate_native_file("_vcm_ADDITIONAL_NATIVE_BINARIES")
|
||||
endif()
|
||||
if(NOT VCPKG_MESON_NATIVE_FILE_DEBUG AND NOT VCPKG_MESON_CROSS_FILE)
|
||||
vcpkg_internal_meson_generate_native_file_config(DEBUG)
|
||||
endif()
|
||||
if(NOT VCPKG_MESON_NATIVE_FILE_RELEASE AND NOT VCPKG_MESON_CROSS_FILE)
|
||||
vcpkg_internal_meson_generate_native_file_config(RELEASE)
|
||||
endif()
|
||||
if(VCPKG_MESON_NATIVE_FILE AND NOT VCPKG_MESON_CROSS_FILE)
|
||||
list(APPEND _vcm_OPTIONS --native "${VCPKG_MESON_NATIVE_FILE}")
|
||||
list(APPEND _vcm_OPTIONS_DEBUG --native "${VCPKG_MESON_NATIVE_FILE_DEBUG}")
|
||||
list(APPEND _vcm_OPTIONS_RELEASE --native "${VCPKG_MESON_NATIVE_FILE_RELEASE}")
|
||||
else()
|
||||
list(APPEND _vcm_OPTIONS --native "${SCRIPTS}/buildsystems/meson/none.txt")
|
||||
endif()
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
||||
list(APPEND _vcm_OPTIONS --default-library shared)
|
||||
else()
|
||||
|
@ -5,9 +5,13 @@ Builds a meson project previously configured with `vcpkg_configure_meson()`.
|
||||
|
||||
## Usage
|
||||
```cmake
|
||||
vcpkg_install_meson()
|
||||
vcpkg_install_meson([ADD_BIN_TO_PATH])
|
||||
```
|
||||
|
||||
## Parameters:
|
||||
### ADD_BIN_TO_PATH
|
||||
Adds the appropriate Release and Debug `bin\` directories to the path during the build such that executables can run against the in-tree DLLs.
|
||||
|
||||
## Examples
|
||||
|
||||
* [fribidi](https://github.com/Microsoft/vcpkg/blob/master/ports/fribidi/portfile.cmake)
|
||||
@ -17,6 +21,7 @@ vcpkg_install_meson()
|
||||
function(vcpkg_install_meson)
|
||||
vcpkg_find_acquire_program(NINJA)
|
||||
unset(ENV{DESTDIR}) # installation directory was already specified with '--prefix' option
|
||||
cmake_parse_arguments(PARSE_ARGV 0 _im "ADD_BIN_TO_PATH" "" "")
|
||||
|
||||
if(VCPKG_TARGET_IS_OSX)
|
||||
if(DEFINED ENV{SDKROOT})
|
||||
@ -30,23 +35,35 @@ function(vcpkg_install_meson)
|
||||
set(ENV{MACOSX_DEPLOYMENT_TARGET} "${VCPKG_DETECTED_CMAKE_OSX_DEPLOYMENT_TARGET}")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
||||
message(STATUS "Package ${TARGET_TRIPLET}-rel")
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND ${NINJA} install -v
|
||||
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel
|
||||
LOGNAME package-${TARGET_TRIPLET}-rel
|
||||
)
|
||||
endif()
|
||||
foreach(BUILDTYPE "debug" "release")
|
||||
if(DEFINED VCPKG_BUILD_TYPE AND NOT VCPKG_BUILD_TYPE STREQUAL BUILDTYPE)
|
||||
continue()
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
||||
message(STATUS "Package ${TARGET_TRIPLET}-dbg")
|
||||
if(BUILDTYPE STREQUAL "debug")
|
||||
set(SHORT_BUILDTYPE "dbg")
|
||||
else()
|
||||
set(SHORT_BUILDTYPE "rel")
|
||||
endif()
|
||||
|
||||
message(STATUS "Package ${TARGET_TRIPLET}-${SHORT_BUILDTYPE}")
|
||||
if(_im_ADD_BIN_TO_PATH)
|
||||
set(_BACKUP_ENV_PATH "$ENV{PATH}")
|
||||
if(BUILDTYPE STREQUAL "debug")
|
||||
vcpkg_add_to_path(PREPEND "${CURRENT_INSTALLED_DIR}/debug/bin")
|
||||
else()
|
||||
vcpkg_add_to_path(PREPEND "${CURRENT_INSTALLED_DIR}/bin")
|
||||
endif()
|
||||
endif()
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND ${NINJA} install -v
|
||||
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg
|
||||
LOGNAME package-${TARGET_TRIPLET}-dbg
|
||||
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${SHORT_BUILDTYPE}
|
||||
LOGNAME package-${TARGET_TRIPLET}-${SHORT_BUILDTYPE}
|
||||
)
|
||||
endif()
|
||||
if(_im_ADD_BIN_TO_PATH)
|
||||
set(ENV{PATH} "${_BACKUP_ENV_PATH}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
set(RENAMED_LIBS)
|
||||
if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_LIBRARY_LINKAGE STREQUAL static)
|
||||
|
Loading…
x
Reference in New Issue
Block a user