[vcpkg-tool-meson] Update meson to 1.3.2 (#28084)

This commit is contained in:
Alexander Neumann 2024-03-11 22:09:15 +01:00 committed by GitHub
parent 431eb6bda0
commit a664e41ee5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
35 changed files with 845 additions and 97 deletions

View File

@ -0,0 +1,12 @@
diff --git a/gdk-pixbuf/meson.build b/gdk-pixbuf/meson.build
index d7aa127b48..c313dc272d 100644
--- a/gdk-pixbuf/meson.build
+++ b/gdk-pixbuf/meson.build
@@ -214,6 +214,7 @@ gdkpixbuf = library('gdk_pixbuf-2.0',
dependencies: [
gdk_pixbuf_deps,
included_loaders_deps,
+ loaders_deps
],
install: true)

View File

@ -1,4 +1,3 @@
vcpkg_minimum_required(VERSION 2022-10-12) # for ${VERSION}
vcpkg_from_gitlab(
GITLAB_URL https://gitlab.gnome.org/
OUT_SOURCE_PATH SOURCE_PATH
@ -10,6 +9,7 @@ vcpkg_from_gitlab(
fix_build_error_windows.patch
loaders-cache.patch
use-libtiff-4-pkgconfig.patch
fix-static-deps.patch
)
if("introspection" IN_LIST FEATURES)

View File

@ -1,7 +1,7 @@
{
"name": "gdk-pixbuf",
"version": "2.42.10",
"port-version": 2,
"port-version": 3,
"description": "Image loading library.",
"homepage": "https://gitlab.gnome.org/GNOME/gdk-pixbuf",
"license": "LGPL-2.1-or-later",

View File

@ -9,7 +9,7 @@ diff --git a/meson.build b/meson.build
libintl_prefix = '#include <libintl.h>'
-libintl = dependency('intl', required: false)
-if libintl.found() and libintl.type_name() != 'internal'
+libintl = dependency('Intl', method:'cmake', required: true)
+libintl = dependency('intl', required : true)
+libintl_deps = [libintl]
+if false
# libintl supports different threading APIs, which may not

View File

@ -1,6 +1,7 @@
{
"name": "glib",
"version": "2.78.4",
"port-version": 1,
"description": "Portable, general-purpose utility library.",
"homepage": "https://developer.gnome.org/glib/",
"license": "LGPL-2.1-or-later",

View File

@ -23,10 +23,13 @@ vcpkg_find_acquire_program(FLEX)
vcpkg_find_acquire_program(BISON)
set(OPTIONS_DEBUG -Dbuild_introspection_data=false)
set(OPTIONS_RELEASE -Dbuild_introspection_data=true)
if(VCPKG_CROSSCOMPILING AND
NOT (CMAKE_HOST_WIN32 AND VCPKG_TARGET_ARCHITECTURE STREQUAL "x86"))
if(VCPKG_CROSSCOMPILING)
list(APPEND OPTIONS_RELEASE -Dgi_cross_use_prebuilt_gi=true)
list(APPEND OPTIONS_RELEASE -Dbuild_introspection_data=false)
# g-ir-scanner is not correctly setup for the cross build and
# fails to correctly link against x86 libs (uses x64 instead)
else()
list(APPEND OPTIONS_RELEASE -Dbuild_introspection_data=true)
endif()
vcpkg_configure_meson(
@ -41,6 +44,7 @@ vcpkg_configure_meson(
g-ir-annotation-tool='${CURRENT_HOST_INSTALLED_DIR}/tools/gobject-introspection/g-ir-annotation-tool'
g-ir-compiler='${CURRENT_HOST_INSTALLED_DIR}/tools/gobject-introspection/g-ir-compiler${VCPKG_HOST_EXECUTABLE_SUFFIX}'
g-ir-scanner='${CURRENT_HOST_INSTALLED_DIR}/tools/gobject-introspection/g-ir-scanner'
python='${CURRENT_HOST_INSTALLED_DIR}/tools/python3/python${VCPKG_HOST_EXECUTABLE_SUFFIX}'
)
vcpkg_host_path_list(APPEND ENV{PKG_CONFIG_PATH} "${CURRENT_INSTALLED_DIR}/lib/pkgconfig")

View File

@ -1,7 +1,7 @@
{
"name": "gobject-introspection",
"version": "1.72.0",
"port-version": 7,
"port-version": 8,
"description": "A middleware layer between C libraries (using GObject) and language bindings.",
"homepage": "https://gi.readthedocs.io/en/latest/",
"license": null,
@ -25,6 +25,10 @@
},
"libffi",
"python3",
{
"name": "python3",
"host": true
},
{
"name": "vcpkg-tool-meson",
"host": true

View File

@ -1,7 +1,7 @@
{
"name": "libnice",
"version": "0.1.21",
"port-version": 1,
"port-version": 2,
"description": "Libnice is an implementation of the IETF's Interactive Connectivity Establishment (ICE) standard (RFC 5245) and the Session Traversal Utilities for NAT (STUN) standard (RFC 5389).",
"homepage": "https://nice.freedesktop.org",
"license": "LGPL-2.1-only AND MPL-1.1",
@ -13,6 +13,10 @@
"host": true,
"default-features": false
},
"openssl"
"openssl",
{
"name": "vcpkg-tool-meson",
"host": true
}
]
}

View File

@ -17,6 +17,8 @@ vcpkg_from_gitlab(
)
x_vcpkg_get_python_packages(PYTHON_VERSION "3" OUT_PYTHON_VAR "PYTHON3" PACKAGES setuptools mako)
get_filename_component(PYTHON3_DIR "${PYTHON3}" DIRECTORY)
vcpkg_add_to_path(PREPEND "${PYTHON3_DIR}")
vcpkg_find_acquire_program(FLEX)
get_filename_component(FLEX_DIR "${FLEX}" DIRECTORY)
@ -103,6 +105,9 @@ vcpkg_configure_meson(
#-D egl-lib-suffix=_mesa
-Dbuild-tests=false
${MESA_OPTIONS}
ADDITIONAL_BINARIES
python=['${PYTHON3}','-I']
python3=['${PYTHON3}','-I']
)
vcpkg_install_meson()
vcpkg_fixup_pkgconfig()

View File

@ -1,6 +1,7 @@
{
"name": "mesa",
"version": "23.2.1",
"port-version": 1,
"description": "Mesa - The 3D Graphics Library",
"homepage": "https://www.mesa3d.org/",
"license": "MIT AND BSL-1.0 AND SGI-B-2.0",

View File

@ -21,10 +21,10 @@ vcpkg_configure_meson(
OPTIONS
${BUILD_OPTIONS}
# see ${SOURCE_PATH}/meson_options.txt
-Dengines=sw
-Dengines=['sw']
-Dloaders=all
-Dsavers=tvg
-Dvector=true
-Dvector=true # This assumes AVX
-Dbindings=capi
-Dtests=false
-Dexamples=false

View File

@ -1,6 +1,7 @@
{
"name": "thorvg",
"version": "0.12.1",
"port-version": 1,
"description": "ThorVG is a platform-independent portable library for drawing vector-based scenes and animations",
"homepage": "https://www.thorvg.org",
"license": "MIT",

View File

@ -0,0 +1,12 @@
diff --git a/mesonbuild/cmake/toolchain.py b/mesonbuild/cmake/toolchain.py
index abf2cf6..477629e 100644
--- a/mesonbuild/cmake/toolchain.py
+++ b/mesonbuild/cmake/toolchain.py
@@ -204,6 +204,6 @@ class CMakeToolchain:
@staticmethod
def is_cmdline_option(compiler: 'Compiler', arg: str) -> bool:
if compiler.get_argument_syntax() == 'msvc':
- return arg.startswith('/')
+ return arg.startswith(('/','-'))
else:
return arg.startswith('-')

View File

@ -0,0 +1,46 @@
diff --git a/mesonbuild/dependencies/python.py b/mesonbuild/dependencies/python.py
index 38e3d5f..6427980 100644
--- a/mesonbuild/dependencies/python.py
+++ b/mesonbuild/dependencies/python.py
@@ -208,7 +208,8 @@ class PythonSystemDependency(SystemDependency, _PythonDependencyBase):
# compile args
+ verdot = self.variables.get('py_version_short')
inc_paths = mesonlib.OrderedSet([
self.variables.get('INCLUDEPY'),
- self.paths.get('include'),
+ self.paths.get('include') + f'/../../../include/python${verdot}',
self.paths.get('platinclude')])
self.compile_args += ['-I' + path for path in inc_paths if path]
@@ -279,9 +279,9 @@ class PythonSystemDependency(SystemDependency, _PythonDependencyBase):
else:
libpath = Path(f'python{vernum}.dll')
else:
if limited_api:
vernum = vernum[0]
- libpath = Path('libs') / f'python{vernum}.lib'
+ libpath = Path('libs') / f'..' / f'..' / f'..' / f'lib' / f'python{vernum}.lib'
# For a debug build, pyconfig.h may force linking with
# pythonX_d.lib (see meson#10776). This cannot be avoided
# and won't work unless we also have a debug build of
@@ -296,6 +296,8 @@ class PythonSystemDependency(SystemDependency, _PythonDependencyBase):
vscrt = self.env.coredata.options[mesonlib.OptionKey('b_vscrt')].value
if vscrt in {'mdd', 'mtd', 'from_buildtype', 'static_from_buildtype'}:
vscrt_debug = True
+ if is_debug_build:
+ libpath = Path('libs') / f'..' / f'..' / f'..' / f'debug/lib' / f'python{vernum}_d.lib'
if is_debug_build and vscrt_debug and not self.variables.get('Py_DEBUG'):
mlog.warning(textwrap.dedent('''\
Using a debug build type with MSVC or an MSVC-compatible compiler
@@ -390,10 +390,7 @@ def python_factory(env: 'Environment', for_machine: 'MachineChoice',
set_env('PKG_CONFIG_PATH', old_pkg_path)
candidates.append(functools.partial(wrap_in_pythons_pc_dir, pkg_name, env, kwargs, installation))
+ candidates.append(functools.partial(PythonPkgConfigDependency, pkg_name, env, kwargs, installation))
- # We only need to check both, if a python install has a LIBPC. It might point to the wrong location,
- # e.g. relocated / cross compilation, but the presence of LIBPC indicates we should definitely look for something.
- if pkg_libdir is not None:
- candidates.append(functools.partial(PythonPkgConfigDependency, pkg_name, env, kwargs, installation))
else:
candidates.append(functools.partial(PkgConfigDependency, 'python3', env, kwargs))

View File

@ -1,8 +1,9 @@
diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py
--- a/mesonbuild/dependencies/misc.py
+++ b/mesonbuild/dependencies/misc.py
@@ -610,7 +610,8 @@ iconv_factory = DependencyFactory(
@@ -593,7 +593,8 @@ iconv_factory = DependencyFactory(
intl_factory = DependencyFactory(
packages['intl'] = intl_factory = DependencyFactory(
'intl',
+ [DependencyMethods.BUILTIN, DependencyMethods.SYSTEM, DependencyMethods.CMAKE],
+ cmake_name='Intl',

View File

@ -0,0 +1,41 @@
[binaries]
cmake = ['@CMAKE_COMMAND@']
ninja = ['@NINJA@']
pkg-config= ['@PKGCONFIG@']
@MESON_MT@
@MESON_AR@
@MESON_RC@
@MESON_C@
@MESON_C_LD@
@MESON_CXX@
@MESON_CXX_LD@
@MESON_OBJC@
@MESON_OBJC_LD@
@MESON_OBJCPP@
@MESON_OBJCPP_LD@
@MESON_FC@
@MESON_FC_LD@
@MESON_WINDRES@
@MESON_ADDITIONAL_BINARIES@
[properties]
cmake_toolchain_file = '@SCRIPTS@/buildsystems/vcpkg.cmake'
[cmake]
VCPKG_TARGET_TRIPLET = '@TARGET_TRIPLET@'
VCPKG_HOST_TRIPLET = '@_HOST_TRIPLET@'
VCPKG_CHAINLOAD_TOOLCHAIN_FILE = '@VCPKG_CHAINLOAD_TOOLCHAIN_FILE@'
VCPKG_CRT_LINKAGE = '@VCPKG_CRT_LINKAGE@'
_VCPKG_INSTALLED_DIR = '@_VCPKG_INSTALLED_DIR@'
@MESON_HOST_MACHINE@
@MESON_BUILD_MACHINE@
[built-in options]
default_library = '@MESON_DEFAULT_LIBRARY@'
werror = false
@MESON_CFLAGS@
@MESON_CXXFLAGS@
@MESON_FCFLAGS@
@MESON_OBJCFLAGS@
@MESON_OBJCPPFLAGS@
# b_vscrt
@MESON_VSCRT_LINKAGE@
# c_winlibs/cpp_winlibs
@MESON_WINLIBS@

View File

@ -2,58 +2,38 @@
# In the future, it is expected that this port acquires and installs Meson.
# Currently is used in ports that call vcpkg_find_acquire_program(MESON) in order to force rebuilds.
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
set(VCPKG_POLICY_CMAKE_HELPER_PORT enabled)
set(program MESON)
set(program_version 0.63.0)
set(program_name meson)
set(search_names meson meson.py)
set(interpreter PYTHON3)
set(apt_package_name "meson")
set(brew_package_name "meson")
set(paths_to_search "${CURRENT_PACKAGES_DIR}/tools/meson")
set(supported_on_unix ON)
set(version_command --version)
set(extra_search_args EXACT_VERSION_MATCH)
vcpkg_find_acquire_program(PYTHON3)
# Reenable if no patching of meson is required within vcpkg
# z_vcpkg_find_acquire_program_find_external("${program}"
# ${extra_search_args}
# PROGRAM_NAME "${program_name}"
# MIN_VERSION "${program_version}"
# INTERPRETER "${interpreter}"
# NAMES ${search_names}
# VERSION_COMMAND ${version_command}
# )
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO mesonbuild/meson
REF bb91cea0d66d8d036063dedec1f194d663399cdf
SHA512 e5888eb35dd4ab5fc0a16143cfbb5a7849f6d705e211a80baf0a8b753e2cf877a4587860a79cad129ec5f3474c12a73558ffe66439b1633d80b8044eceaff2da
PATCHES
meson-intl.patch
remove-freebsd-pcfile-specialization.patch
set(files
vcpkg.json
portfile.cmake
vcpkg-port-config.cmake
vcpkg_configure_meson.cmake
vcpkg_install_meson.cmake
meson-intl.patch
adjust-python-dep.patch
adjust-args.patch
remove-freebsd-pcfile-specialization.patch
meson.template.in
)
vcpkg_execute_required_process(
COMMAND "${CMAKE_COMMAND}"
"-DSOURCE_PATH=${SOURCE_PATH}"
"-DCURRENT_PACKAGES_DIR=${CURRENT_PACKAGES_DIR}"
-P "${CURRENT_PORT_DIR}/install.cmake"
WORKING_DIRECTORY "${VCPKG_ROOT_DIR}"
LOGNAME install
)
set(MESON_PATH_HASH "")
foreach(to_hash IN LISTS files)
file(SHA1 ${CMAKE_CURRENT_LIST_DIR}/${to_hash} to_append)
string(APPEND MESON_PATH_HASH "${to_append}")
endforeach()
string(SHA512 MESON_PATH_HASH "${MESON_PATH_HASH}")
file(COPY "${CMAKE_CURRENT_LIST_DIR}/vcpkg-port-config.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-port-config.cmake" "${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-port-config.cmake" @ONLY)
file(COPY "${CMAKE_CURRENT_LIST_DIR}/vcpkg_configure_meson.cmake"
"${CMAKE_CURRENT_LIST_DIR}/vcpkg_install_meson.cmake"
"${CMAKE_CURRENT_LIST_DIR}/meson-intl.patch"
"${CMAKE_CURRENT_LIST_DIR}/adjust-python-dep.patch"
"${CMAKE_CURRENT_LIST_DIR}/adjust-args.patch"
"${CMAKE_CURRENT_LIST_DIR}/remove-freebsd-pcfile-specialization.patch"
"${CMAKE_CURRENT_LIST_DIR}/meson.template.in"
DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
z_vcpkg_find_acquire_program_find_internal("${program}"
INTERPRETER "${interpreter}"
PATHS ${paths_to_search}
NAMES ${search_names}
)
vcpkg_install_copyright(FILE_LIST "${VCPKG_ROOT_DIR}/LICENSE.txt")
message(STATUS "Using meson: ${MESON}")
file(WRITE "${CURRENT_PACKAGES_DIR}/share/meson/version.txt" "${program_version}") # For vcpkg_find_acquire_program
include("${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-port-config.cmake")

View File

@ -1,17 +1,20 @@
--- a/mesonbuild/modules/pkgconfig.py
+++ b/mesonbuild/modules/pkgconfig.py
@@ -583,12 +583,8 @@ class PkgConfigModule(ExtensionModule):
@@ -702,15 +702,8 @@ class PkgConfigModule(ExtensionModule):
pcfile = filebase + '.pc'
pkgroot = pkgroot_name = kwargs.get('install_dir', default_install_dir)
pkgroot = pkgroot_name = kwargs['install_dir'] or default_install_dir
if pkgroot is None:
- if mesonlib.is_freebsd():
- pkgroot = os.path.join(state.environment.coredata.get_option(mesonlib.OptionKey('prefix')), 'libdata', 'pkgconfig')
- pkgroot_name = os.path.join('{prefix}', 'libdata', 'pkgconfig')
- else:
- pkgroot = os.path.join(state.environment.coredata.get_option(mesonlib.OptionKey('libdir')), 'pkgconfig')
- pkgroot_name = os.path.join('{libdir}', 'pkgconfig')
- if mesonlib.is_freebsd():
- pkgroot = os.path.join(_as_str(state.environment.coredata.get_option(mesonlib.OptionKey('prefix'))), 'libdata', 'pkgconfig')
- pkgroot_name = os.path.join('{prefix}', 'libdata', 'pkgconfig')
- elif mesonlib.is_haiku():
- pkgroot = os.path.join(_as_str(state.environment.coredata.get_option(mesonlib.OptionKey('prefix'))), 'develop', 'lib', 'pkgconfig')
- pkgroot_name = os.path.join('{prefix}', 'develop', 'lib', 'pkgconfig')
- else:
- pkgroot = os.path.join(_as_str(state.environment.coredata.get_option(mesonlib.OptionKey('libdir'))), 'pkgconfig')
- pkgroot_name = os.path.join('{libdir}', 'pkgconfig')
+ pkgroot = os.path.join(state.environment.coredata.get_option(mesonlib.OptionKey('libdir')), 'pkgconfig')
+ pkgroot_name = os.path.join('{libdir}', 'pkgconfig')
if not isinstance(pkgroot, str):
raise mesonlib.MesonException('Install_dir must be a string.')
relocatable = state.get_option('relocatable', module='pkgconfig')
self._generate_pkgconfig_file(state, deps, subdirs, name, description, url,
version, pcfile, conflicts, variables,

View File

@ -1 +1,63 @@
set(SCRIPT_MESON "${CMAKE_CURRENT_LIST_DIR}/../../tools/meson/meson.py")
# Overwrite builtin scripts
include("${CMAKE_CURRENT_LIST_DIR}/vcpkg_configure_meson.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/vcpkg_install_meson.cmake")
# Check required python version
vcpkg_find_acquire_program(PYTHON3)
vcpkg_execute_required_process(COMMAND "${PYTHON3}" --version
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}"
LOGNAME "python3-version-${TARGET_TRIPLET}")
file(READ "${CURRENT_BUILDTREES_DIR}/python3-version-${TARGET_TRIPLET}-out.log" version_contents)
string(REGEX MATCH [[[0-9]+\.[0-9]+\.[0-9]+]] python_ver "${version_contents}")
set(min_required 3.7)
if(python_ver VERSION_LESS "${min_required}")
message(FATAL_ERROR "Found Python version '${python_ver} at ${PYTHON3}' is insufficient for meson. meson requires at least version '${min_required}'")
else()
message(STATUS "Found Python version '${python_ver} at ${PYTHON3}'")
endif()
set(meson_path_hash @MESON_PATH_HASH@)
string(SUBSTRING "${meson_path_hash}" 0 6 meson_short_hash)
# Setup meson:
set(program MESON)
set(program_version @VERSION@)
set(program_name meson)
set(search_names meson meson.py)
set(ref 614d436232d3a86518164cbe2b8af12db3bde009)
set(path_to_search "${DOWNLOADS}/tools/meson-${program_version}-${meson_short_hash}")
set(download_urls "https://github.com/mesonbuild/meson/archive/${ref}.tar.gz")
set(download_filename "meson-${ref}.tar.gz")
set(download_sha512 c087da0113e76501fff66e68ac9ef7aede5e6672f1dc7201608cce9e5e1d202d3f4bf92beec1a5e4e8169f6ed1cedbb44b57ede2753437a61a13578de8d22040)
find_program(SCRIPT_MESON NAMES ${search_names} PATHS "${path_to_search}" NO_DEFAULT_PATH) # NO_DEFAULT_PATH due top patching
if(NOT SCRIPT_MESON)
vcpkg_download_distfile(archive_path
URLS ${download_urls}
SHA512 "${download_sha512}"
FILENAME "${download_filename}"
)
file(REMOVE_RECURSE "${path_to_search}-tmp/../")
file(MAKE_DIRECTORY "${path_to_search}-tmp/../")
file(ARCHIVE_EXTRACT INPUT "${archive_path}"
DESTINATION "${path_to_search}-tmp/../"
#PATTERNS "**/mesonbuild/*" "**/*.py"
)
z_vcpkg_apply_patches(
SOURCE_PATH "${path_to_search}-tmp/../meson-${ref}/"
PATCHES
"${CMAKE_CURRENT_LIST_DIR}/adjust-args.patch"
"${CMAKE_CURRENT_LIST_DIR}/meson-intl.patch"
"${CMAKE_CURRENT_LIST_DIR}/adjust-python-dep.patch"
"${CMAKE_CURRENT_LIST_DIR}/remove-freebsd-pcfile-specialization.patch"
)
file(COPY "${path_to_search}-tmp/../meson-${ref}/meson.py" "${path_to_search}-tmp/../meson-${ref}/mesonbuild" DESTINATION "${path_to_search}")
file(REMOVE_RECURSE "${path_to_search}-tmp/../meson-${ref}")
set(SCRIPT_MESON "${path_to_search}/meson.py")
endif()
message(STATUS "Using meson: ${SCRIPT_MESON}")

View File

@ -1,7 +1,6 @@
{
"name": "vcpkg-tool-meson",
"version": "0.63",
"port-version": 2,
"version": "1.3.2",
"description": "Meson build system",
"homepage": "https://github.com/mesonbuild/meson",
"license": "Apache-2.0",

View File

@ -0,0 +1,452 @@
function(z_vcpkg_meson_set_proglist_variables config_type)
if(VCPKG_TARGET_IS_WINDOWS)
set(proglist MT AR)
else()
set(proglist AR RANLIB STRIP NM OBJDUMP DLLTOOL MT)
endif()
foreach(prog IN LISTS proglist)
if(VCPKG_DETECTED_CMAKE_${prog})
if(meson_${prog})
string(TOUPPER "MESON_${meson_${prog}}" var_to_set)
set("${var_to_set}" "${meson_${prog}} = ['${VCPKG_DETECTED_CMAKE_${prog}}']" PARENT_SCOPE)
elseif(${prog} STREQUAL AR AND VCPKG_DETECTED_CMAKE_STATIC_LINKER_FLAGS_${config_type})
# Probably need to move AR somewhere else
string(TOLOWER "${prog}" proglower)
z_vcpkg_meson_convert_compiler_flags_to_list(ar_flags "${VCPKG_DETECTED_CMAKE_STATIC_LINKER_FLAGS_${config_type}}")
list(PREPEND ar_flags "${VCPKG_DETECTED_CMAKE_${prog}}")
z_vcpkg_meson_convert_list_to_python_array(ar_flags ${ar_flags})
set("MESON_AR" "${proglower} = ${ar_flags}" PARENT_SCOPE)
else()
string(TOUPPER "MESON_${prog}" var_to_set)
string(TOLOWER "${prog}" proglower)
set("${var_to_set}" "${proglower} = ['${VCPKG_DETECTED_CMAKE_${prog}}']" PARENT_SCOPE)
endif()
endif()
endforeach()
set(compilers "${arg_LANGUAGES}")
if(VCPKG_TARGET_IS_WINDOWS)
list(APPEND compilers RC)
endif()
set(meson_RC windres)
set(meson_Fortran fortran)
set(meson_CXX cpp)
foreach(prog IN LISTS compilers)
if(VCPKG_DETECTED_CMAKE_${prog}_COMPILER)
string(TOUPPER "MESON_${prog}" var_to_set)
if(meson_${prog})
if(VCPKG_DETECTED_CMAKE_${prog}_FLAGS_${config_type})
# Need compiler flags in prog vars for sanity check.
z_vcpkg_meson_convert_compiler_flags_to_list(${prog}flags "${VCPKG_DETECTED_CMAKE_${prog}_FLAGS_${config_type}}")
endif()
list(PREPEND ${prog}flags "${VCPKG_DETECTED_CMAKE_${prog}_COMPILER}")
list(FILTER ${prog}flags EXCLUDE REGEX "(-|/)nologo") # Breaks compiler detection otherwise
z_vcpkg_meson_convert_list_to_python_array(${prog}flags ${${prog}flags})
set("${var_to_set}" "${meson_${prog}} = ${${prog}flags}" PARENT_SCOPE)
if (DEFINED VCPKG_DETECTED_CMAKE_${prog}_COMPILER_ID AND NOT VCPKG_DETECTED_CMAKE_${prog}_COMPILER_ID MATCHES "^(GNU|Intel)$")
string(TOUPPER "MESON_${prog}_LD" var_to_set)
set(${var_to_set} "${meson_${prog}}_ld = ['${VCPKG_DETECTED_CMAKE_LINKER}']" PARENT_SCOPE)
endif()
else()
if(VCPKG_DETECTED_CMAKE_${prog}_FLAGS_${config_type})
# Need compiler flags in prog vars for sanity check.
z_vcpkg_meson_convert_compiler_flags_to_list(${prog}flags "${VCPKG_DETECTED_CMAKE_${prog}_FLAGS_${config_type}}")
endif()
list(PREPEND ${prog}flags "${VCPKG_DETECTED_CMAKE_${prog}_COMPILER}")
list(FILTER ${prog}flags EXCLUDE REGEX "(-|/)nologo") # Breaks compiler detection otherwise
z_vcpkg_meson_convert_list_to_python_array(${prog}flags ${${prog}flags})
string(TOLOWER "${prog}" proglower)
set("${var_to_set}" "${proglower} = ${${prog}flags}" PARENT_SCOPE)
if (DEFINED VCPKG_DETECTED_CMAKE_${prog}_COMPILER_ID AND NOT VCPKG_DETECTED_CMAKE_${prog}_COMPILER_ID MATCHES "^(GNU|Intel)$")
string(TOUPPER "MESON_${prog}_LD" var_to_set)
set(${var_to_set} "${proglower}_ld = ['${VCPKG_DETECTED_CMAKE_LINKER}']" PARENT_SCOPE)
endif()
endif()
endif()
endforeach()
endfunction()
function(z_vcpkg_meson_convert_compiler_flags_to_list out_var compiler_flags)
separate_arguments(cmake_list NATIVE_COMMAND "${compiler_flags}")
list(TRANSFORM cmake_list REPLACE ";" [[\\;]])
set("${out_var}" "${cmake_list}" PARENT_SCOPE)
endfunction()
function(z_vcpkg_meson_convert_list_to_python_array out_var)
z_vcpkg_function_arguments(flag_list 1)
vcpkg_list(REMOVE_ITEM flag_list "") # remove empty elements if any
vcpkg_list(JOIN flag_list "', '" flag_list)
set("${out_var}" "['${flag_list}']" PARENT_SCOPE)
endfunction()
# Generates the required compiler properties for meson
function(z_vcpkg_meson_set_flags_variables config_type)
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
set(libpath_flag /LIBPATH:)
else()
set(libpath_flag -L)
endif()
if(config_type STREQUAL "DEBUG")
set(path_suffix "/debug")
else()
set(path_suffix "")
endif()
set(includepath "-I${CURRENT_INSTALLED_DIR}/include")
set(libpath "${libpath_flag}${CURRENT_INSTALLED_DIR}${path_suffix}/lib")
foreach(lang IN LISTS arg_LANGUAGES)
z_vcpkg_meson_convert_compiler_flags_to_list(${lang}flags "${VCPKG_DETECTED_CMAKE_${lang}_FLAGS_${config_type}}")
if(lang MATCHES "^(C|CXX)$")
vcpkg_list(APPEND ${lang}flags "${includepath}")
endif()
z_vcpkg_meson_convert_list_to_python_array(${lang}flags ${${lang}flags})
set(lang_mapping "${lang}")
if(lang STREQUAL "Fortran")
set(lang_mapping "FC")
endif()
string(TOLOWER "${lang_mapping}" langlower)
if(lang STREQUAL "CXX")
set(langlower cpp)
endif()
set(MESON_${lang_mapping}FLAGS "${langlower}_args = ${${lang}flags}\n")
set(linker_flags "${VCPKG_DETECTED_CMAKE_SHARED_LINKER_FLAGS_${config_type}}")
z_vcpkg_meson_convert_compiler_flags_to_list(linker_flags "${linker_flags}")
vcpkg_list(APPEND linker_flags "${libpath}")
z_vcpkg_meson_convert_list_to_python_array(linker_flags ${linker_flags})
string(APPEND MESON_${lang_mapping}FLAGS "${langlower}_link_args = ${linker_flags}\n")
set(MESON_${lang_mapping}FLAGS "${MESON_${lang_mapping}FLAGS}" PARENT_SCOPE)
endforeach()
endfunction()
function(z_vcpkg_get_build_and_host_system build_system host_system is_cross) #https://mesonbuild.com/Cross-compilation.html
set(build_unknown FALSE)
if(CMAKE_HOST_WIN32)
if(DEFINED ENV{PROCESSOR_ARCHITEW6432})
set(build_arch $ENV{PROCESSOR_ARCHITEW6432})
else()
set(build_arch $ENV{PROCESSOR_ARCHITECTURE})
endif()
if(build_arch MATCHES "(amd|AMD)64")
set(build_cpu_fam x86_64)
set(build_cpu x86_64)
elseif(build_arch MATCHES "(x|X)86")
set(build_cpu_fam x86)
set(build_cpu i686)
elseif(build_arch MATCHES "^(ARM|arm)64$")
set(build_cpu_fam aarch64)
set(build_cpu armv8)
elseif(build_arch MATCHES "^(ARM|arm)$")
set(build_cpu_fam arm)
set(build_cpu armv7hl)
else()
if(NOT DEFINED VCPKG_MESON_CROSS_FILE OR NOT DEFINED VCPKG_MESON_NATIVE_FILE)
message(WARNING "Unsupported build architecture ${build_arch}! Please set VCPKG_MESON_(CROSS|NATIVE)_FILE to a meson file containing the build_machine entry!")
endif()
set(build_unknown TRUE)
endif()
elseif(CMAKE_HOST_UNIX)
# at this stage, CMAKE_HOST_SYSTEM_PROCESSOR is not defined
execute_process(
COMMAND uname -m
OUTPUT_VARIABLE MACHINE
OUTPUT_STRIP_TRAILING_WHITESPACE
COMMAND_ERROR_IS_FATAL ANY)
# Show real machine architecture to visually understand whether we are in a native Apple Silicon terminal or running under Rosetta emulation
debug_message("Machine: ${MACHINE}")
if(MACHINE MATCHES "arm64|aarch64")
set(build_cpu_fam aarch64)
set(build_cpu armv8)
elseif(MACHINE MATCHES "armv7h?l")
set(build_cpu_fam arm)
set(build_cpu ${MACHINE})
elseif(MACHINE MATCHES "x86_64|amd64")
set(build_cpu_fam x86_64)
set(build_cpu x86_64)
elseif(MACHINE MATCHES "x86|i686")
set(build_cpu_fam x86)
set(build_cpu i686)
elseif(MACHINE MATCHES "i386")
set(build_cpu_fam x86)
set(build_cpu i386)
elseif(MACHINE MATCHES "loongarch64")
set(build_cpu_fam loongarch64)
set(build_cpu loongarch64)
else()
# https://github.com/mesonbuild/meson/blob/master/docs/markdown/Reference-tables.md#cpu-families
if(NOT DEFINED VCPKG_MESON_CROSS_FILE OR NOT DEFINED VCPKG_MESON_NATIVE_FILE)
message(WARNING "Unhandled machine: ${MACHINE}! Please set VCPKG_MESON_(CROSS|NATIVE)_FILE to a meson file containing the build_machine entry!")
endif()
set(build_unknown TRUE)
endif()
else()
if(NOT DEFINED VCPKG_MESON_CROSS_FILE OR NOT DEFINED VCPKG_MESON_NATIVE_FILE)
message(WARNING "Failed to detect the build architecture! Please set VCPKG_MESON_(CROSS|NATIVE)_FILE to a meson file containing the build_machine entry!")
endif()
set(build_unknown TRUE)
endif()
set(build "[build_machine]\n") # Machine the build is performed on
string(APPEND build "endian = 'little'\n")
if(WIN32)
string(APPEND build "system = 'windows'\n")
elseif(DARWIN)
string(APPEND build "system = 'darwin'\n")
elseif(CYGWIN)
string(APPEND build "system = 'cygwin'\n")
elseif(UNIX)
string(APPEND build "system = 'linux'\n")
else()
set(build_unknown TRUE)
endif()
if(DEFINED build_cpu_fam)
string(APPEND build "cpu_family = '${build_cpu_fam}'\n")
endif()
if(DEFINED build_cpu)
string(APPEND build "cpu = '${build_cpu}'")
endif()
if(NOT build_unknown)
set(${build_system} "${build}" PARENT_SCOPE)
endif()
set(host_unkown FALSE)
if(VCPKG_TARGET_ARCHITECTURE MATCHES "(amd|AMD|x|X)64")
set(host_cpu_fam x86_64)
set(host_cpu x86_64)
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "(x|X)86")
set(host_cpu_fam x86)
set(host_cpu i686)
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "^(ARM|arm)64$")
set(host_cpu_fam aarch64)
set(host_cpu armv8)
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "^(ARM|arm)$")
set(host_cpu_fam arm)
set(host_cpu armv7hl)
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "loongarch64")
set(host_cpu_fam loongarch64)
set(host_cpu loongarch64)
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "wasm32")
set(host_cpu_fam wasm32)
set(host_cpu wasm32)
else()
if(NOT DEFINED VCPKG_MESON_CROSS_FILE OR NOT DEFINED VCPKG_MESON_NATIVE_FILE)
message(WARNING "Unsupported target architecture ${VCPKG_TARGET_ARCHITECTURE}! Please set VCPKG_MESON_(CROSS|NATIVE)_FILE to a meson file containing the host_machine entry!" )
endif()
set(host_unkown TRUE)
endif()
set(host "[host_machine]\n") # host=target in vcpkg.
string(APPEND host "endian = 'little'\n")
if(NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_TARGET_IS_MINGW OR VCPKG_TARGET_IS_UWP)
set(meson_system_name "windows")
else()
string(TOLOWER "${VCPKG_CMAKE_SYSTEM_NAME}" meson_system_name)
endif()
string(APPEND host "system = '${meson_system_name}'\n")
string(APPEND host "cpu_family = '${host_cpu_fam}'\n")
string(APPEND host "cpu = '${host_cpu}'")
if(NOT host_unkown)
set(${host_system} "${host}" PARENT_SCOPE)
endif()
if(NOT build_cpu_fam MATCHES "${host_cpu_fam}"
OR VCPKG_TARGET_IS_ANDROID OR VCPKG_TARGET_IS_IOS OR VCPKG_TARGET_IS_UWP
OR (VCPKG_TARGET_IS_MINGW AND NOT WIN32))
set(${is_cross} TRUE PARENT_SCOPE)
endif()
endfunction()
function(z_vcpkg_meson_setup_extra_windows_variables config_type)
## b_vscrt
if(VCPKG_CRT_LINKAGE STREQUAL "static")
set(crt_type "mt")
else()
set(crt_type "md")
endif()
if(config_type STREQUAL "DEBUG")
set(crt_type "${crt_type}d")
endif()
set(MESON_VSCRT_LINKAGE "b_vscrt = '${crt_type}'" PARENT_SCOPE)
## winlibs
separate_arguments(c_winlibs NATIVE_COMMAND "${VCPKG_DETECTED_CMAKE_C_STANDARD_LIBRARIES}")
separate_arguments(cpp_winlibs NATIVE_COMMAND "${VCPKG_DETECTED_CMAKE_CXX_STANDARD_LIBRARIES}")
z_vcpkg_meson_convert_list_to_python_array(c_winlibs ${c_winlibs})
z_vcpkg_meson_convert_list_to_python_array(cpp_winlibs ${cpp_winlibs})
set(MESON_WINLIBS "c_winlibs = ${c_winlibs}\n")
string(APPEND MESON_WINLIBS "cpp_winlibs = ${cpp_winlibs}")
set(MESON_WINLIBS "${MESON_WINLIBS}" PARENT_SCOPE)
endfunction()
function(z_vcpkg_meson_setup_variables config_type)
set(meson_var_list VSCRT_LINKAGE WINLIBS MT AR RC C C_LD CXX CXX_LD OBJC OBJC_LD OBJCXX OBJCXX_LD FC FC_LD WINDRES CFLAGS CXXFLAGS OBJCFLAGS OBJCXXFLAGS FCFLAGS SHARED_LINKER_FLAGS)
foreach(var IN LISTS meson_var_list)
set(MESON_${var} "")
endforeach()
if(VCPKG_TARGET_IS_WINDOWS)
z_vcpkg_meson_setup_extra_windows_variables("${config_type}")
endif()
z_vcpkg_meson_set_proglist_variables("${config_type}")
z_vcpkg_meson_set_flags_variables("${config_type}")
foreach(var IN LISTS meson_var_list)
set(MESON_${var} "${MESON_${var}}" PARENT_SCOPE)
endforeach()
endfunction()
function(vcpkg_configure_meson)
# parse parameters such that semicolons in options arguments to COMMAND don't get erased
cmake_parse_arguments(PARSE_ARGV 0 arg
"NO_PKG_CONFIG"
"SOURCE_PATH"
"OPTIONS;OPTIONS_DEBUG;OPTIONS_RELEASE;LANGUAGES;ADDITIONAL_BINARIES;ADDITIONAL_NATIVE_BINARIES;ADDITIONAL_CROSS_BINARIES"
)
if(NOT arg_LANGUAGES)
set(arg_LANGUAGES C CXX)
endif()
if(DEFINED arg_ADDITIONAL_NATIVE_BINARIES OR DEFINED arg_ADDITIONAL_CROSS_BINARIES)
message(WARNING "Options ADDITIONAL_(NATIVE|CROSS)_BINARIES have been deprecated. Only use ADDITIONAL_BINARIES!")
endif()
vcpkg_list(APPEND arg_ADDITIONAL_BINARIES ${arg_ADDITIONAL_NATIVE_BINARIES} ${arg_ADDITIONAL_CROSS_BINARIES})
vcpkg_list(REMOVE_DUPLICATES arg_ADDITIONAL_BINARIES)
vcpkg_list(JOIN arg_ADDITIONAL_BINARIES "\n" MESON_ADDITIONAL_BINARIES)
file(REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel")
file(REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg")
if(NOT VCPKG_CHAINLOAD_TOOLCHAIN_FILE)
z_vcpkg_select_default_vcpkg_chainload_toolchain()
endif()
z_vcpkg_get_cmake_vars(cmake_vars_file)
debug_message("Including cmake vars from: ${cmake_vars_file}")
include("${cmake_vars_file}")
vcpkg_find_acquire_program(MESON)
get_filename_component(CMAKE_PATH "${CMAKE_COMMAND}" DIRECTORY)
vcpkg_add_to_path("${CMAKE_PATH}" PREPEND) # Make CMake invokeable for Meson
vcpkg_find_acquire_program(PYTHON3)
get_filename_component(PYTHON3_DIR "${PYTHON3}" DIRECTORY)
vcpkg_add_to_path("${PYTHON3_DIR}")
vcpkg_find_acquire_program(NINJA)
get_filename_component(NINJA_PATH ${NINJA} DIRECTORY)
vcpkg_add_to_path(PREPEND "${NINJA_PATH}") # Prepend to use the correct ninja.
set(buildtypes "")
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
set(buildname "DEBUG")
vcpkg_list(APPEND buildtypes "${buildname}")
set(path_suffix_${buildname} "debug/")
set(suffix_${buildname} "dbg")
set(meson_input_file_${buildname} "${CURRENT_BUILDTREES_DIR}/meson-${TARGET_TRIPLET}-${suffix_${buildname}}.log")
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
set(buildname "RELEASE")
vcpkg_list(APPEND buildtypes "${buildname}")
set(path_suffix_${buildname} "")
set(suffix_${buildname} "rel")
set(meson_input_file_${buildname} "${CURRENT_BUILDTREES_DIR}/meson-${TARGET_TRIPLET}-${suffix_${buildname}}.log")
endif()
vcpkg_list(APPEND arg_OPTIONS --backend ninja --wrap-mode nodownload -Dbuildtype=plain -Doptimization=plain)
z_vcpkg_get_build_and_host_system(MESON_HOST_MACHINE MESON_BUILD_MACHINE IS_CROSS)
if(IS_CROSS)
# VCPKG_CROSSCOMPILING is not used since it regresses a lot of ports in x64-windows-x triplets
# For consistency this should proably be changed in the future?
vcpkg_list(APPEND arg_OPTIONS --native "${SCRIPTS}/buildsystems/meson/none.txt")
vcpkg_list(APPEND arg_OPTIONS_DEBUG --cross "${meson_input_file_DEBUG}")
vcpkg_list(APPEND arg_OPTIONS_RELEASE --cross "${meson_input_file_RELEASE}")
else()
vcpkg_list(APPEND arg_OPTIONS_DEBUG --native "${meson_input_file_DEBUG}")
vcpkg_list(APPEND arg_OPTIONS_RELEASE --native "${meson_input_file_RELEASE}")
endif()
# User provided cross/native files
if(VCPKG_MESON_NATIVE_FILE)
vcpkg_list(APPEND arg_OPTIONS_RELEASE --native "${VCPKG_MESON_NATIVE_FILE}")
endif()
if(VCPKG_MESON_NATIVE_FILE_RELEASE)
vcpkg_list(APPEND arg_OPTIONS_RELEASE --native "${VCPKG_MESON_NATIVE_FILE_RELEASE}")
endif()
if(VCPKG_MESON_NATIVE_FILE_DEBUG)
vcpkg_list(APPEND arg_OPTIONS_DEBUG --native "${VCPKG_MESON_NATIVE_FILE_DEBUG}")
endif()
if(VCPKG_MESON_CROSS_FILE)
vcpkg_list(APPEND arg_OPTIONS_RELEASE --cross "${VCPKG_MESON_CROSS_FILE}")
endif()
if(VCPKG_MESON_CROSS_FILE_RELEASE)
vcpkg_list(APPEND arg_OPTIONS_RELEASE --cross "${VCPKG_MESON_CROSS_FILE_RELEASE}")
endif()
if(VCPKG_MESON_CROSS_FILE_DEBUG)
vcpkg_list(APPEND arg_OPTIONS_DEBUG --cross "${VCPKG_MESON_CROSS_FILE_DEBUG}")
endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
set(MESON_DEFAULT_LIBRARY shared)
else()
set(MESON_DEFAULT_LIBRARY static)
endif()
vcpkg_list(APPEND arg_OPTIONS --libdir lib) # else meson install into an architecture describing folder
vcpkg_list(APPEND arg_OPTIONS_DEBUG -Ddebug=true --prefix "${CURRENT_PACKAGES_DIR}/debug" --includedir ../include)
vcpkg_list(APPEND arg_OPTIONS_RELEASE -Ddebug=false --prefix "${CURRENT_PACKAGES_DIR}")
# select meson cmd-line options
if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_list(APPEND arg_OPTIONS_DEBUG "-Dcmake_prefix_path=['${CURRENT_INSTALLED_DIR}/debug','${CURRENT_INSTALLED_DIR}','${CURRENT_INSTALLED_DIR}/share']")
vcpkg_list(APPEND arg_OPTIONS_RELEASE "-Dcmake_prefix_path=['${CURRENT_INSTALLED_DIR}','${CURRENT_INSTALLED_DIR}/debug','${CURRENT_INSTALLED_DIR}/share']")
else()
vcpkg_list(APPEND arg_OPTIONS_DEBUG "-Dcmake_prefix_path=['${CURRENT_INSTALLED_DIR}/debug','${CURRENT_INSTALLED_DIR}']")
vcpkg_list(APPEND arg_OPTIONS_RELEASE "-Dcmake_prefix_path=['${CURRENT_INSTALLED_DIR}','${CURRENT_INSTALLED_DIR}/debug']")
endif()
# Allow overrides / additional configuration variables from triplets
if(DEFINED VCPKG_MESON_CONFIGURE_OPTIONS)
vcpkg_list(APPEND arg_OPTIONS ${VCPKG_MESON_CONFIGURE_OPTIONS})
endif()
if(DEFINED VCPKG_MESON_CONFIGURE_OPTIONS_RELEASE)
vcpkg_list(APPEND arg_OPTIONS_RELEASE ${VCPKG_MESON_CONFIGURE_OPTIONS_RELEASE})
endif()
if(DEFINED VCPKG_MESON_CONFIGURE_OPTIONS_DEBUG)
vcpkg_list(APPEND arg_OPTIONS_DEBUG ${VCPKG_MESON_CONFIGURE_OPTIONS_DEBUG})
endif()
# configure build
foreach(buildtype IN LISTS buildtypes)
message(STATUS "Configuring ${TARGET_TRIPLET}-${suffix_${buildtype}}")
file(MAKE_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${suffix_${buildtype}}")
#setting up PKGCONFIG
if(NOT arg_NO_PKG_CONFIG)
z_vcpkg_setup_pkgconfig_path(CONFIG "${buildtype}")
endif()
z_vcpkg_meson_setup_variables(${buildtype})
configure_file("${CMAKE_CURRENT_FUNCTION_LIST_DIR}/meson.template.in" "${meson_input_file_${buildtype}}" @ONLY)
vcpkg_execute_required_process(
COMMAND ${MESON} ${arg_OPTIONS} ${arg_OPTIONS_${buildtype}} ${arg_SOURCE_PATH}
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${suffix_${buildtype}}"
LOGNAME config-${TARGET_TRIPLET}-${suffix_${buildtype}}
SAVE_LOG_FILES
meson-logs/meson-log.txt
meson-info/intro-dependencies.json
meson-logs/install-log.txt
)
message(STATUS "Configuring ${TARGET_TRIPLET}-${suffix_${buildtype}} done")
if(NOT arg_NO_PKG_CONFIG)
z_vcpkg_restore_pkgconfig_path()
endif()
endforeach()
endfunction()

View File

@ -0,0 +1,71 @@
function(vcpkg_install_meson)
cmake_parse_arguments(PARSE_ARGV 0 arg "ADD_BIN_TO_PATH" "" "")
vcpkg_find_acquire_program(NINJA)
unset(ENV{DESTDIR}) # installation directory was already specified with '--prefix' option
if(VCPKG_TARGET_IS_OSX)
vcpkg_backup_env_variables(VARS SDKROOT MACOSX_DEPLOYMENT_TARGET)
set(ENV{SDKROOT} "${VCPKG_DETECTED_CMAKE_OSX_SYSROOT}")
set(ENV{MACOSX_DEPLOYMENT_TARGET} "${VCPKG_DETECTED_CMAKE_OSX_DEPLOYMENT_TARGET}")
endif()
foreach(buildtype IN ITEMS "debug" "release")
if(DEFINED VCPKG_BUILD_TYPE AND NOT VCPKG_BUILD_TYPE STREQUAL buildtype)
continue()
endif()
if(buildtype STREQUAL "debug")
set(short_buildtype "dbg")
else()
set(short_buildtype "rel")
endif()
message(STATUS "Package ${TARGET_TRIPLET}-${short_buildtype}")
if(arg_ADD_BIN_TO_PATH)
vcpkg_backup_env_variables(VARS 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}-${short_buildtype}"
LOGNAME package-${TARGET_TRIPLET}-${short_buildtype}
)
if(arg_ADD_BIN_TO_PATH)
vcpkg_restore_env_variables(VARS PATH)
endif()
endforeach()
vcpkg_list(SET renamed_libs)
if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_LIBRARY_LINKAGE STREQUAL static AND NOT VCPKG_TARGET_IS_MINGW)
# Meson names all static libraries lib<name>.a which basically breaks the world
file(GLOB_RECURSE gen_libraries "${CURRENT_PACKAGES_DIR}*/**/lib*.a")
foreach(gen_library IN LISTS gen_libraries)
get_filename_component(libdir "${gen_library}" DIRECTORY)
get_filename_component(libname "${gen_library}" NAME)
string(REGEX REPLACE ".a$" ".lib" fixed_librawname "${libname}")
string(REGEX REPLACE "^lib" "" fixed_librawname "${fixed_librawname}")
file(RENAME "${gen_library}" "${libdir}/${fixed_librawname}")
# For cmake fixes.
string(REGEX REPLACE ".a$" "" origin_librawname "${libname}")
string(REGEX REPLACE ".lib$" "" fixed_librawname "${fixed_librawname}")
vcpkg_list(APPEND renamed_libs ${fixed_librawname})
set(${librawname}_old ${origin_librawname})
set(${librawname}_new ${fixed_librawname})
endforeach()
file(GLOB_RECURSE cmake_files "${CURRENT_PACKAGES_DIR}*/*.cmake")
foreach(cmake_file IN LISTS cmake_files)
foreach(current_lib IN LISTS renamed_libs)
vcpkg_replace_string("${cmake_file}" "${${current_lib}_old}" "${${current_lib}_new}")
endforeach()
endforeach()
endif()
if(VCPKG_TARGET_IS_OSX)
vcpkg_restore_env_variables(VARS SDKROOT MACOSX_DEPLOYMENT_TARGET)
endif()
endfunction()

View File

@ -36,8 +36,8 @@ vcpkg_configure_make(
AUTOCONFIG
OPTIONS
ac_cv_path_PYTHON='${PYTHON3}'
am_cv_python_pyexecdir=\\\${prefix}/tools/python3/site-packages
am_cv_python_pythondir=\\\${prefix}/tools/python3/site-packages
am_cv_python_pyexecdir=\\\${prefix}/${PYTHON3_SITE}
am_cv_python_pythondir=\\\${prefix}/${PYTHON3_SITE}
)
vcpkg_install_make()

View File

@ -1,7 +1,7 @@
{
"name": "xcb-proto",
"version": "1.14.1",
"port-version": 1,
"port-version": 2,
"description": "XML-XCB protocol descriptions used by libxcb for the X11 protocol & extensions",
"homepage": "https://xcb.freedesktop.org/",
"license": "X11-distribute-modifications-variant",

View File

@ -34,19 +34,28 @@ function(z_vcpkg_meson_set_proglist_variables config_type)
if(VCPKG_DETECTED_CMAKE_${prog}_COMPILER)
string(TOUPPER "MESON_${prog}" var_to_set)
if(meson_${prog})
set("${var_to_set}" "${meson_${prog}} = ['${VCPKG_DETECTED_CMAKE_${prog}_COMPILER}']" PARENT_SCOPE)
if(VCPKG_DETECTED_CMAKE_${prog}_FLAGS_${config_type})
# Need compiler flags in prog vars for sanity check.
z_vcpkg_meson_convert_compiler_flags_to_list(${prog}flags "${VCPKG_DETECTED_CMAKE_${prog}_FLAGS_${config_type}}")
endif()
list(PREPEND ${prog}flags "${VCPKG_DETECTED_CMAKE_${prog}_COMPILER}")
list(FILTER ${prog}flags EXCLUDE REGEX "(-|/)nologo") # Breaks compiler detection otherwise
z_vcpkg_meson_convert_list_to_python_array(${prog}flags ${${prog}flags})
set("${var_to_set}" "${meson_${prog}} = ${${prog}flags}" PARENT_SCOPE)
if (DEFINED VCPKG_DETECTED_CMAKE_${prog}_COMPILER_ID AND NOT VCPKG_DETECTED_CMAKE_${prog}_COMPILER_ID MATCHES "^(GNU|Intel)$")
string(TOUPPER "MESON_${prog}_LD" var_to_set)
set(${var_to_set} "${meson_${prog}}_ld = ['${VCPKG_DETECTED_CMAKE_LINKER}']" PARENT_SCOPE)
endif()
elseif(${prog} MATCHES RC AND VCPKG_DETECTED_CMAKE_RC_FLAGS_${config_type})
z_vcpkg_meson_convert_compiler_flags_to_list(rc_flags "${VCPKG_DETECTED_CMAKE_RC_FLAGS_${config_type}}")
list(PREPEND rc_flags "${VCPKG_DETECTED_CMAKE_${prog}_COMPILER}")
z_vcpkg_meson_convert_list_to_python_array(rc_flags ${rc_flags})
set("${var_to_set}" "${meson_${prog}} = ${rc_flags}" PARENT_SCOPE)
else()
if(VCPKG_DETECTED_CMAKE_${prog}_FLAGS_${config_type})
# Need compiler flags in prog vars for sanity check.
z_vcpkg_meson_convert_compiler_flags_to_list(${prog}flags "${VCPKG_DETECTED_CMAKE_${prog}_FLAGS_${config_type}}")
endif()
list(PREPEND ${prog}flags "${VCPKG_DETECTED_CMAKE_${prog}_COMPILER}")
list(FILTER ${prog}flags EXCLUDE REGEX "(-|/)nologo") # Breaks compiler detection otherwise
z_vcpkg_meson_convert_list_to_python_array(${prog}flags ${${prog}flags})
string(TOLOWER "${prog}" proglower)
set("${var_to_set}" "${proglower} = ['${VCPKG_DETECTED_CMAKE_${prog}_COMPILER}']" PARENT_SCOPE)
set("${var_to_set}" "${proglower} = ${${prog}flags}" PARENT_SCOPE)
if (DEFINED VCPKG_DETECTED_CMAKE_${prog}_COMPILER_ID AND NOT VCPKG_DETECTED_CMAKE_${prog}_COMPILER_ID MATCHES "^(GNU|Intel)$")
string(TOUPPER "MESON_${prog}_LD" var_to_set)
set(${var_to_set} "${proglower}_ld = ['${VCPKG_DETECTED_CMAKE_LINKER}']" PARENT_SCOPE)
@ -104,7 +113,7 @@ function(z_vcpkg_meson_set_flags_variables config_type)
z_vcpkg_meson_convert_compiler_flags_to_list(linker_flags "${linker_flags}")
vcpkg_list(APPEND linker_flags "${libpath}")
z_vcpkg_meson_convert_list_to_python_array(linker_flags ${linker_flags})
string(APPEND MESON_${lang_mapping}FLAGS "${langlower}_link_args = ${linker_flags}")
string(APPEND MESON_${lang_mapping}FLAGS "${langlower}_link_args = ${linker_flags}\n")
set(MESON_${lang_mapping}FLAGS "${MESON_${lang_mapping}FLAGS}" PARENT_SCOPE)
endforeach()
endfunction()
@ -347,7 +356,7 @@ function(vcpkg_configure_meson)
set(meson_input_file_${buildname} "${CURRENT_BUILDTREES_DIR}/meson-${TARGET_TRIPLET}-${suffix_${buildname}}.log")
endif()
vcpkg_list(APPEND arg_OPTIONS --buildtype plain --backend ninja --wrap-mode nodownload)
vcpkg_list(APPEND arg_OPTIONS --backend ninja --wrap-mode nodownload -Dbuildtype=plain -Doptimization=plain)
z_vcpkg_get_build_and_host_system(MESON_HOST_MACHINE MESON_BUILD_MACHINE IS_CROSS)

View File

@ -7,7 +7,7 @@ set(version_command --version)
set(extra_search_args EXACT_VERSION_MATCH)
if(EXISTS "${CURRENT_HOST_INSTALLED_DIR}/share/meson/version.txt")
file(READ "${CURRENT_HOST_INSTALLED_DIR}/share/meson/version.txt" program_version)
set(paths_to_search "${CURRENT_HOST_INSTALLED_DIR}/tools/meson")
set(paths_to_search "${DOWNLOADS}/tools/meson-${program_version};${CURRENT_HOST_INSTALLED_DIR}/tools/meson")
else() # Old behavior
set(program_version 0.58.1)
set(ref aeda7f249c4a5dbbecc52e44f382246a2377b5b0)

View File

@ -2934,7 +2934,7 @@
},
"gdk-pixbuf": {
"baseline": "2.42.10",
"port-version": 2
"port-version": 3
},
"gemmlowp": {
"baseline": "2021-09-28",
@ -3042,7 +3042,7 @@
},
"glib": {
"baseline": "2.78.4",
"port-version": 0
"port-version": 1
},
"glib-networking": {
"baseline": "2.78.0",
@ -3098,7 +3098,7 @@
},
"gobject-introspection": {
"baseline": "1.72.0",
"port-version": 7
"port-version": 8
},
"google-cloud-cpp": {
"baseline": "2.22.0",
@ -4654,7 +4654,7 @@
},
"libnice": {
"baseline": "0.1.21",
"port-version": 1
"port-version": 2
},
"libnice-gst": {
"baseline": "0.1.21",
@ -5630,7 +5630,7 @@
},
"mesa": {
"baseline": "23.2.1",
"port-version": 0
"port-version": 1
},
"meschach": {
"baseline": "1.2b",
@ -8554,7 +8554,7 @@
},
"thorvg": {
"baseline": "0.12.1",
"port-version": 0
"port-version": 1
},
"threadpool": {
"baseline": "0.2.5",
@ -9021,8 +9021,8 @@
"port-version": 1
},
"vcpkg-tool-meson": {
"baseline": "0.63",
"port-version": 2
"baseline": "1.3.2",
"port-version": 0
},
"vcpkg-tool-mozbuild": {
"baseline": "4.0.2",
@ -9370,7 +9370,7 @@
},
"xcb-proto": {
"baseline": "1.14.1",
"port-version": 1
"port-version": 2
},
"xcb-render-util": {
"baseline": "0.3.10",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "155d642e94235b73e42125201d552211161a4e65",
"version": "2.42.10",
"port-version": 3
},
{
"git-tree": "3dc0bb4b0113c8043f2ed716694303d1bdc08d88",
"version": "2.42.10",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "d73077209c5fcb5a0340baf7d8ba76d128c1ab27",
"version": "2.78.4",
"port-version": 1
},
{
"git-tree": "d67b03e0a09ec580d051b79321b03182c0030c5f",
"version": "2.78.4",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "a79249743886d0325fa6ba7dea173c6d3a7b6d40",
"version": "1.72.0",
"port-version": 8
},
{
"git-tree": "9d0cfb4e7056136db4c9def1e64b88b7417dc0e8",
"version": "1.72.0",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "e727ccac25d95c7a8e43a944407c80a1a071c581",
"version": "0.1.21",
"port-version": 2
},
{
"git-tree": "752ea02df5a3ae83ff67c4bfcfc34e9570cc27f9",
"version": "0.1.21",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "cf4f628acb3c66d2c99544f1acd2a76f576f3f4b",
"version": "23.2.1",
"port-version": 1
},
{
"git-tree": "3f318339b0c26814bbd53fce78471f1a95fdfe0d",
"version": "23.2.1",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "3268f3ca33dc333073105440c3507f03845929f1",
"version": "0.12.1",
"port-version": 1
},
{
"git-tree": "e76612a36df3034ad703e603692ae10c9ca315e1",
"version": "0.12.1",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "7b3bad7cb3eec367da9a8f2c6593b25e00720c66",
"version": "1.3.2",
"port-version": 0
},
{
"git-tree": "3f6f5419cfc743a85e4f1fb1b582d4728b79c1e2",
"version": "0.63",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "927edbd82a8d7801673d5fd3e9f9144d86884801",
"version": "1.14.1",
"port-version": 2
},
{
"git-tree": "f2eac40d0f3ae01205792344a254ac956e0adcd2",
"version": "1.14.1",