aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Neumann <30894796+Neumann-A@users.noreply.github.com>2021-01-12 01:12:01 +0100
committerGitHub <noreply@github.com>2021-01-11 16:12:01 -0800
commit9c63f97fa1d4915a7dfc5f32d5cdb6ee8fe9bf8b (patch)
treea8d4c13f0367d95d68c0c8325d851f5b23605f82
parentc7e96f2a5b73b3278b004aa88abec2f8ebfb43b5 (diff)
downloadvcpkg-9c63f97fa1d4915a7dfc5f32d5cdb6ee8fe9bf8b.tar.gz
vcpkg-9c63f97fa1d4915a7dfc5f32d5cdb6ee8fe9bf8b.zip
[mesa] new port (#14640)
* [mesa] new port * make mesa build more. * more fine tuning * fix x86 * add supports. * comment about EGL feature. * apply suggestion from CR. added opengl feature. error on disabled shared glapi if multiple GL APIs are selected. * fix boolean option * make sharedgl-api=true the hardcoded default * add suggestion from CR * add mesa:x64-windows-static=fail to ci.baseline.txt due to static crt and parts being a dynamic library. * apply CR sugesstion Co-authored-by: PhoebeHui <20694052+PhoebeHui@users.noreply.github.com>
-rw-r--r--ports/mesa/CONTROL31
-rw-r--r--ports/mesa/dual-osmesa-part2.patch13
-rw-r--r--ports/mesa/dual-osmesa.patch80
-rw-r--r--ports/mesa/portfile.cmake199
-rw-r--r--ports/mesa/swravx512.patch22
-rw-r--r--scripts/ci.baseline.txt5
-rw-r--r--scripts/cmake/vcpkg_configure_meson.cmake48
7 files changed, 380 insertions, 18 deletions
diff --git a/ports/mesa/CONTROL b/ports/mesa/CONTROL
new file mode 100644
index 000000000..c29d91e31
--- /dev/null
+++ b/ports/mesa/CONTROL
@@ -0,0 +1,31 @@
+Source: mesa
+Version: 20.2.2
+Homepage: https://www.mesa3d.org/
+Description: Mesa - The 3D Graphics Library
+Build-Depends: zlib, zstd, tool-meson
+Default-Features: default-features
+Supports: !(windows&arm)
+
+Feature: default-features
+Description: Platform dependent default features
+Build-Depends: mesa[core,llvm](x64), mesa[core,opengl], mesa[core,gles1], mesa[core,gles2]
+
+Feature: llvm
+Description: Build with llvmpipe
+Build-Depends: llvm[core]
+
+Feature: gles1
+Description: Build support for OpenGL ES 1.x
+Build-Depends: mesa[core]
+
+Feature: gles2
+Description: Build support for OpenGL ES 2.x and 3.x
+Build-Depends: mesa[core]
+
+Feature: opengl
+Description: Build support for OpenGL (all versions)
+Build-Depends: mesa[core]
+
+Feature: egl
+Description: Build support for EGL platform
+Build-Depends: mesa[core] \ No newline at end of file
diff --git a/ports/mesa/dual-osmesa-part2.patch b/ports/mesa/dual-osmesa-part2.patch
new file mode 100644
index 000000000..6d39786d7
--- /dev/null
+++ b/ports/mesa/dual-osmesa-part2.patch
@@ -0,0 +1,13 @@
+diff --git a/src/gallium/meson.build b/src/gallium/meson.build
+index 1f81fcf1fd5..5a5a8d2f0a6 100644
+--- a/src/gallium/meson.build
++++ b/src/gallium/meson.build
+@@ -175,7 +175,7 @@ if with_dri
+ subdir('frontends/dri')
+ subdir('targets/dri')
+ endif
+-if with_osmesa == 'gallium'
++if with_osmesa.contains('gallium')
+ subdir('frontends/osmesa')
+ subdir('targets/osmesa')
+ endif
diff --git a/ports/mesa/dual-osmesa.patch b/ports/mesa/dual-osmesa.patch
new file mode 100644
index 000000000..8acebe64b
--- /dev/null
+++ b/ports/mesa/dual-osmesa.patch
@@ -0,0 +1,80 @@
+diff --git a/include/meson.build b/include/meson.build
+index a64d9373a92..22c50eb5eb7 100644
+--- a/include/meson.build
++++ b/include/meson.build
+@@ -89,7 +89,7 @@ if with_egl
+ )
+ endif
+
+-if with_osmesa != 'none'
++if with_osmesa != []
+ install_headers('GL/osmesa.h', subdir : 'GL')
+ endif
+
+diff --git a/meson.build b/meson.build
+index 898d025f066..d73818e7ce5 100644
+--- a/meson.build
++++ b/meson.build
+@@ -444,7 +444,7 @@ if with_any_vk and (with_platform_x11 and not with_dri3)
+ error('Vulkan drivers require dri3 for X11 support')
+ endif
+ if with_dri
+- if with_glx == 'disabled' and not with_egl and not with_gbm and with_osmesa != 'classic'
++ if with_glx == 'disabled' and not with_egl and not with_gbm and not with_osmesa.contains('classic')
+ error('building dri drivers require at least one windowing system or classic osmesa')
+ endif
+ endif
+@@ -1508,8 +1508,8 @@ else
+ dep_unwind = null_dep
+ endif
+
+-if with_osmesa != 'none'
+- if with_osmesa == 'gallium' and not with_gallium_softpipe
++if with_osmesa != []
++ if with_osmesa.contains('gallium') and not with_gallium_softpipe
+ error('OSMesa gallium requires gallium softpipe or llvmpipe.')
+ endif
+ if host_machine.system() == 'windows'
+@@ -1710,10 +1710,10 @@ lines = ['',
+ with_gles2 ? 'yes' : 'no'),
+ ]
+
+-if with_osmesa != 'none'
++if with_osmesa != []
+ lines += ''
+ suffix = ''
+- if with_osmesa == 'gallium'
++ if with_osmesa.contains('gallium')
+ suffix = '(Gallium)'
+ endif
+ lines += 'OSMesa: lib' + osmesa_lib_name + suffix
+diff --git a/meson_options.txt b/meson_options.txt
+index 626baf3d5c2..cb3dc3b383f 100644
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -295,9 +295,9 @@ option(
+ )
+ option(
+ 'osmesa',
+- type : 'combo',
+- value : 'none',
+- choices : ['none', 'classic', 'gallium'],
++ type : 'array',
++ value : [],
++ choices : ['classic', 'gallium'],
+ description : 'Build OSmesa.'
+ )
+ option(
+diff --git a/src/mesa/meson.build b/src/mesa/meson.build
+index fa5c54cc6fb..f7b223862fa 100644
+--- a/src/mesa/meson.build
++++ b/src/mesa/meson.build
+@@ -744,7 +744,7 @@ libmesa_gallium = static_library(
+ )
+
+ subdir('drivers/dri')
+-if with_osmesa == 'classic'
++if with_osmesa.contains('classic')
+ subdir('drivers/osmesa')
+ endif
+ if with_glx == 'xlib'
diff --git a/ports/mesa/portfile.cmake b/ports/mesa/portfile.cmake
new file mode 100644
index 000000000..17e43d2c6
--- /dev/null
+++ b/ports/mesa/portfile.cmake
@@ -0,0 +1,199 @@
+# Build-Depends: From X Window PR: zstd, drm (!windows), elfutils (!windows), wayland (!windows), wayland-protocols (!windows), xdamage, xshmfence (!windows), x11, xcb, xfixes, xext, xxf86vm, xrandr, xv, xvmc (!windows), egl-registry, opengl-registry, tool-meson
+# Required LLVM modules: LLVM (modules: bitwriter, core, coroutines, engine, executionengine, instcombine, mcdisassembler, mcjit, scalaropts, transformutils) found: YES
+
+#patches are from https://github.com/pal1000/mesa-dist-win/tree/master/patches
+set(PATCHES dual-osmesa.patch
+ dual-osmesa-part2.patch
+ swravx512.patch
+ )
+
+vcpkg_check_linkage(ONLY_DYNAMIC_CRT)
+IF(VCPKG_TARGET_IS_WINDOWS)
+ set(VCPKG_POLICY_DLLS_IN_STATIC_LIBRARY enabled) # some parts of this port can only build as a shared library.
+endif()
+
+vcpkg_from_gitlab(
+ GITLAB_URL https://gitlab.freedesktop.org
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO mesa/mesa
+ REF df2977f871fc70ebd6be48c180d117189b5861b5 #v20.2.2
+ SHA512 6c51d817fe265ea6405c4e8afbb516f30cf697d00cf39f162473ea8a59c202bcdfbfe4b6f7c4a6fd2d4e98eb4a1604cb5e0a02558338bf415e53fe5421cbfbbe
+ HEAD_REF master # branch name
+ PATCHES ${PATCHES} #patch name
+)
+vcpkg_find_acquire_program(PYTHON3)
+get_filename_component(PYTHON3_DIR "${PYTHON3}" DIRECTORY)
+vcpkg_add_to_path("${PYTHON3_DIR}")
+vcpkg_add_to_path("${PYTHON3_DIR}/Scripts")
+set(ENV{PYTHON} "${PYTHON3}")
+
+function(vcpkg_get_python_package PYTHON_DIR )
+ cmake_parse_arguments(PARSE_ARGV 0 _vgpp "" "PYTHON_EXECUTABLE" "PACKAGES")
+
+ if(NOT _vgpp_PYTHON_EXECUTABLE)
+ message(FATAL_ERROR "${CMAKE_CURRENT_FUNCTION} requires parameter PYTHON_EXECUTABLE!")
+ endif()
+ if(NOT _vgpp_PACKAGES)
+ message(FATAL_ERROR "${CMAKE_CURRENT_FUNCTION} requires parameter PACKAGES!")
+ endif()
+ if(NOT _vgpp_PYTHON_DIR)
+ get_filename_component(_vgpp_PYTHON_DIR "${_vgpp_PYTHON_EXECUTABLE}" DIRECTORY)
+ endif()
+
+ if (WIN32)
+ set(PYTHON_OPTION "")
+ else()
+ set(PYTHON_OPTION "--user")
+ endif()
+
+ if("${_vgpp_PYTHON_DIR}" MATCHES "${DOWNLOADS}") # inside vcpkg
+ if(NOT EXISTS "${_vgpp_PYTHON_DIR}/easy_install${VCPKG_HOST_EXECUTABLE_SUFFIX}")
+ if(NOT EXISTS "${_vgpp_PYTHON_DIR}/Scripts/pip${VCPKG_HOST_EXECUTABLE_SUFFIX}")
+ vcpkg_from_github(
+ OUT_SOURCE_PATH PYFILE_PATH
+ REPO pypa/get-pip
+ REF 309a56c5fd94bd1134053a541cb4657a4e47e09d #2019-08-25
+ SHA512 bb4b0745998a3205cd0f0963c04fb45f4614ba3b6fcbe97efe8f8614192f244b7ae62705483a5305943d6c8fedeca53b2e9905aed918d2c6106f8a9680184c7a
+ HEAD_REF master
+ )
+ execute_process(COMMAND "${_vgpp_PYTHON_EXECUTABLE}" "${PYFILE_PATH}/get-pip.py" ${PYTHON_OPTION})
+ endif()
+ foreach(_package IN LISTS _vgpp_PACKAGES)
+ execute_process(COMMAND "${_vgpp_PYTHON_DIR}/Scripts/pip${VCPKG_HOST_EXECUTABLE_SUFFIX}" install ${_package} ${PYTHON_OPTION})
+ endforeach()
+ else()
+ foreach(_package IN LISTS _vgpp_PACKAGES)
+ execute_process(COMMAND "${_vgpp_PYTHON_DIR}/easy_install${VCPKG_HOST_EXECUTABLE_SUFFIX}" ${_package})
+ endforeach()
+ endif()
+ if(NOT VCPKG_TARGET_IS_WINDOWS)
+ execute_process(COMMAND pip3 install ${_vgpp_PACKAGES})
+ endif()
+ else() # outside vcpkg
+ foreach(_package IN LISTS _vgpp_PACKAGES)
+ execute_process(COMMAND ${_vgpp_PYTHON_EXECUTABLE} -c "import ${_package}" RESULT_VARIABLE HAS_ERROR)
+ if(HAS_ERROR)
+ message(FATAL_ERROR "Python package '${_package}' needs to be installed for port '${PORT}'.\nComplete list of required python packages: ${_vgpp_PACKAGES}")
+ endif()
+ endforeach()
+ endif()
+endfunction()
+
+vcpkg_get_python_package(PYTHON_EXECUTABLE "${PYTHON3}" PACKAGES setuptools mako)
+
+vcpkg_find_acquire_program(FLEX)
+get_filename_component(FLEX_DIR "${FLEX}" DIRECTORY )
+vcpkg_add_to_path(PREPEND "${FLEX_DIR}")
+vcpkg_find_acquire_program(BISON)
+get_filename_component(BISON_DIR "${BISON}" DIRECTORY )
+vcpkg_add_to_path(PREPEND "${BISON_DIR}")
+
+if(WIN32) # WIN32 HOST probably has win_flex and win_bison!
+ if(NOT EXISTS "${FLEX_DIR}/flex${VCPKG_HOST_EXECUTABLE_SUFFIX}")
+ if(FLEX_DIR MATCHES "${DOWNLOADS}")
+ file(CREATE_LINK "${FLEX}" "${FLEX_DIR}/flex${VCPKG_HOST_EXECUTABLE_SUFFIX}")
+ else()
+ message(FATAL_ERROR "${PORT} requires flex being named flex on windows and not win_flex!\n(Can be solved by creating a simple link from win_flex to flex)")
+ endif()
+ endif()
+ if(NOT EXISTS "${BISON_DIR}/BISON${VCPKG_HOST_EXECUTABLE_SUFFIX}")
+ if(BISON_DIR MATCHES "${DOWNLOADS}")
+ file(CREATE_LINK "${BISON}" "${BISON_DIR}/bison${VCPKG_HOST_EXECUTABLE_SUFFIX}")
+ else()
+ message(FATAL_ERROR "${PORT} requires bison being named bison on windows and not win_bison!\n(Can be solved by creating a simple link from win_bison to bison)")
+ endif()
+ endif()
+endif()
+
+# For features https://github.com/pal1000/mesa-dist-win should be probably studied a bit more.
+#string(APPEND GALLIUM_DRIVERS 'auto')
+list(APPEND MESA_OPTIONS -Dzstd=enabled)
+list(APPEND MESA_OPTIONS -Dshared-llvm=auto)
+list(APPEND MESA_OPTIONS -Dlibunwind=disabled)
+list(APPEND MESA_OPTIONS -Dlmsensors=disabled)
+list(APPEND MESA_OPTIONS -Dvalgrind=disabled)
+list(APPEND MESA_OPTIONS -Dglvnd=false)
+list(APPEND MESA_OPTIONS -Dglx=disabled)
+list(APPEND MESA_OPTIONS -Dgbm=disabled)
+#list(APPEND MESA_OPTIONS -Dosmesa=['gallium','classic']) # classic has compiler errors.
+list(APPEND MESA_OPTIONS -Dosmesa=['gallium'])
+
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
+ list(APPEND MESA_OPTIONS -Dshared-swr=false)
+ list(APPEND MESA_OPTIONS "-Dswr-arches=['avx']")
+else()
+ list(APPEND MESA_OPTIONS -Dshared-swr=true)
+ list(APPEND MESA_OPTIONS "-Dswr-arches=['avx','avx2','knl','skx']")
+endif()
+
+string(APPEND GALLIUM_DRIVERS 'swrast')
+if("llvm" IN_LIST FEATURES)
+ list(APPEND MESA_OPTIONS -Dllvm=enabled)
+ string(APPEND GALLIUM_DRIVERS ",'swr'") # SWR always requires llvm
+else()
+ list(APPEND MESA_OPTIONS -Dllvm=disabled)
+endif()
+
+list(APPEND MESA_OPTIONS -Dgallium-drivers=[${GALLIUM_DRIVERS}])
+
+if("gles1" IN_LIST FEATURES)
+ list(APPEND MESA_OPTIONS -Dgles1=enabled)
+else()
+ list(APPEND MESA_OPTIONS -Dgles1=disabled)
+endif()
+if("gles2" IN_LIST FEATURES)
+ list(APPEND MESA_OPTIONS -Dgles2=enabled)
+else()
+ list(APPEND MESA_OPTIONS -Dgles2=disabled)
+endif()
+if("opengl" IN_LIST FEATURES)
+ list(APPEND MESA_OPTIONS -Dopengl=true)
+else()
+ list(APPEND MESA_OPTIONS -Dopengl=false)
+endif()
+if("egl" IN_LIST FEATURES) # EGL feature only works on Linux
+ list(APPEND MESA_OPTIONS -Degl=enabled)
+else()
+ list(APPEND MESA_OPTIONS -Degl=disabled)
+endif()
+
+list(APPEND MESA_OPTIONS -Dshared-glapi=enabled) #shared GLAPI required when building two or more of the following APIs - opengl, gles1 gles2
+
+
+if(VCPKG_TARGET_IS_WINDOWS)
+ list(APPEND MESA_OPTIONS -Dplatforms=['windows'])
+endif()
+
+vcpkg_configure_meson(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ #-D gles-lib-suffix=_mesa
+ #-D egl-lib-suffix=_mesa
+ -Dbuild-tests=false
+ ${MESA_OPTIONS}
+ )
+vcpkg_install_meson()
+vcpkg_fixup_pkgconfig()
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
+
+#installed by egl-registry
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/KHR)
+file(REMOVE ${CURRENT_PACKAGES_DIR}/include/EGL/egl.h)
+file(REMOVE ${CURRENT_PACKAGES_DIR}/include/EGL/eglext.h)
+file(REMOVE ${CURRENT_PACKAGES_DIR}/include/EGL/eglplatform.h)
+#installed by opengl-registry
+set(_double_files include/GL/glcorearb.h include/GL/glext.h include/GL/glxext.h
+ include/GLES/egl.h include/GLES/gl.h include/GLES/glext.h include/GLES/glplatform.h
+ include/GLES2/gl2.h include/GLES2/gl2ext.h include/GLES2/gl2platform.h
+ include/GLES3/gl3.h include/GLES3/gl31.h include/GLES3/gl32.h include/GLES3/gl3platform.h)
+list(TRANSFORM _double_files PREPEND "${CURRENT_PACKAGES_DIR}/")
+file(REMOVE ${_double_files})
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/GLES)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/GLES2)
+# # Handle copyright
+file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/${PORT}")
+file(TOUCH "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright")
diff --git a/ports/mesa/swravx512.patch b/ports/mesa/swravx512.patch
new file mode 100644
index 000000000..c1085252f
--- /dev/null
+++ b/ports/mesa/swravx512.patch
@@ -0,0 +1,22 @@
+diff --git a/src/gallium/drivers/swr/meson.build b/src/gallium/drivers/swr/meson.build
+index 2fad60365a3..dce7f656d64 100644
+--- a/src/gallium/drivers/swr/meson.build
++++ b/src/gallium/drivers/swr/meson.build
+@@ -249,7 +249,7 @@ endif
+
+ if with_swr_arches.contains('knl')
+ swr_knl_args = cpp.first_supported_argument(
+- '-march=knl', '-target-cpu=mic-knl', '-xMIC-AVX512',
++ '-march=knl', '-target-cpu=mic-knl', '-xMIC-AVX512', '/arch:AVX512',
+ )
+ if swr_knl_args == []
+ error('Cannot find KNL support for swr.')
+@@ -274,7 +274,7 @@ endif
+
+ if with_swr_arches.contains('skx')
+ swr_skx_args = cpp.first_supported_argument(
+- '-march=skylake-avx512', '-target-cpu=x86-skylake', '-xCORE-AVX512',
++ '-march=skylake-avx512', '-target-cpu=x86-skylake', '-xCORE-AVX512', '/arch:AVX512',
+ )
+ if swr_skx_args == []
+ error('Cannot find SKX support for swr.')
diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt
index 5e0a90ea6..77bec59ea 100644
--- a/scripts/ci.baseline.txt
+++ b/scripts/ci.baseline.txt
@@ -894,6 +894,11 @@ memorymodule:arm-uwp=fail
memorymodule:x64-linux=fail
memorymodule:x64-osx=fail
memorymodule:x64-uwp=fail
+# Due to static crt.
+mesa:x64-windows-static=fail
+# Missing dependent libraries.
+mesa:x64-linux=fail
+mesa:x64-osx=fail
meschach:arm-uwp=fail
meschach:x64-linux=fail
meschach:x64-osx=fail
diff --git a/scripts/cmake/vcpkg_configure_meson.cmake b/scripts/cmake/vcpkg_configure_meson.cmake
index 212bcf076..0bc181c41 100644
--- a/scripts/cmake/vcpkg_configure_meson.cmake
+++ b/scripts/cmake/vcpkg_configure_meson.cmake
@@ -36,7 +36,7 @@ This command supplies many common arguments to Meson. To see the full list, exam
* [libepoxy](https://github.com/Microsoft/vcpkg/blob/master/ports/libepoxy/portfile.cmake)
#]===]
-function(vcpkg_internal_meson_generate_native_file) #https://mesonbuild.com/Native-environments.html
+function(vcpkg_internal_meson_generate_native_file _additional_binaries) #https://mesonbuild.com/Native-environments.html
set(NATIVE "[binaries]\n")
#set(proglist AR RANLIB STRIP NM OBJDUMP DLLTOOL MT)
if(VCPKG_TARGET_IS_WINDOWS)
@@ -63,6 +63,10 @@ function(vcpkg_internal_meson_generate_native_file) #https://mesonbuild.com/Nati
string(APPEND NATIVE "cpp_ld = '${VCPKG_DETECTED_CMAKE_LINKER}'\n")
endif()
string(APPEND NATIVE "cmake = '${CMAKE_COMMAND}'\n")
+ foreach(_binary IN LISTS ${_additional_binaries})
+ string(APPEND NATIVE "${_binary}\n")
+ endforeach()
+
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
@@ -154,6 +158,7 @@ function(vcpkg_internal_meson_generate_native_file_config _config) #https://meso
string(APPEND NATIVE_${_config} "VCPKG_TARGET_TRIPLET = '${TARGET_TRIPLET}'\n")
string(APPEND NATIVE_${_config} "VCPKG_CHAINLOAD_TOOLCHAIN_FILE = '${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}'\n")
+ string(APPEND NATIVE_${_config} "VCPKG_CRT_LINKAGE = '${VCPKG_CRT_LINKAGE}'\n")
string(APPEND NATIVE_${_config} "[built-in options]\n")
if(VCPKG_TARGET_IS_WINDOWS)
@@ -173,7 +178,7 @@ function(vcpkg_internal_meson_generate_native_file_config _config) #https://meso
file(WRITE "${_file}" "${NATIVE_${_config}}")
endfunction()
-function(vcpkg_internal_meson_generate_cross_file) #https://mesonbuild.com/Cross-compilation.html
+function(vcpkg_internal_meson_generate_cross_file _additional_binaries) #https://mesonbuild.com/Cross-compilation.html
if(CMAKE_HOST_WIN32)
if(DEFINED ENV{PROCESSOR_ARCHITEW6432})
set(BUILD_ARCH $ENV{PROCESSOR_ARCHITEW6432})
@@ -239,6 +244,10 @@ function(vcpkg_internal_meson_generate_cross_file) #https://mesonbuild.com/Cross
string(APPEND CROSS "c_ld = '${VCPKG_DETECTED_CMAKE_LINKER}'\n")
string(APPEND CROSS "cpp_ld = '${VCPKG_DETECTED_CMAKE_LINKER}'\n")
endif()
+ foreach(_binary IN LISTS ${_additional_binaries})
+ string(APPEND CROSS "${_binary}\n")
+ endforeach()
+
string(APPEND CROSS "[properties]\n")
string(APPEND CROSS "skip_sanity_check = true\n")
string(APPEND CROSS "[host_machine]\n")
@@ -333,7 +342,7 @@ 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 _vcm "" "SOURCE_PATH" "OPTIONS;OPTIONS_DEBUG;OPTIONS_RELEASE")
+ 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)
@@ -343,10 +352,26 @@ function(vcpkg_configure_meson)
debug_message("Including cmake vars from: ${_VCPKG_CMAKE_VARS_FILE}")
include("${_VCPKG_CMAKE_VARS_FILE}")
+ vcpkg_find_acquire_program(PYTHON3)
+ get_filename_component(PYTHON3_DIR "${PYTHON3}" DIRECTORY)
+ vcpkg_add_to_path("${PYTHON3_DIR}")
+ list(APPEND _vcm_ADDITIONAL_NATIVE_BINARIES "python = '${PYTHON3}'")
+ list(APPEND _vcm_ADDITIONAL_CROSS_BINARIES "python = '${PYTHON3}'")
+
+ 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)
+ vcpkg_add_to_path(PREPEND "${NINJA_PATH}") # Need to prepend so that meson picks up the correct ninja from vcpkg ....
+ # list(APPEND _vcm_ADDITIONAL_NATIVE_BINARIES "ninja = '${NINJA}'") # This does not work due to meson issues ......
+
list(APPEND _vcm_OPTIONS --buildtype plain --backend ninja --wrap-mode nodownload)
if(NOT VCPKG_MESON_NATIVE_FILE)
- vcpkg_internal_meson_generate_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)
@@ -359,7 +384,7 @@ function(vcpkg_configure_meson)
list(APPEND _vcm_OPTIONS_RELEASE --native "${VCPKG_MESON_NATIVE_FILE_RELEASE}")
if(NOT VCPKG_MESON_CROSS_FILE)
- vcpkg_internal_meson_generate_cross_file()
+ vcpkg_internal_meson_generate_cross_file("_vcm_ADDITIONAL_CROSS_BINARIES")
endif()
if(NOT VCPKG_MESON_CROSS_FILE_DEBUG AND VCPKG_MESON_CROSS_FILE)
vcpkg_internal_meson_generate_cross_file_config(DEBUG)
@@ -397,19 +422,6 @@ function(vcpkg_configure_meson)
list(APPEND _vcm_OPTIONS_RELEASE "-Dcmake_prefix_path=['${CURRENT_INSTALLED_DIR}','${CURRENT_INSTALLED_DIR}/debug']")
endif()
- vcpkg_find_acquire_program(PYTHON3)
- get_filename_component(PYTHON3_DIR "${PYTHON3}" DIRECTORY)
- vcpkg_add_to_path("${PYTHON3_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)
- vcpkg_add_to_path("${NINJA_PATH}")
-
vcpkg_find_acquire_program(PKGCONFIG)
get_filename_component(PKGCONFIG_PATH ${PKGCONFIG} DIRECTORY)
vcpkg_add_to_path("${PKGCONFIG_PATH}")