mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-29 03:34:26 +08:00
ce70fb4f1c
* [mesa] supports: !staticcrt * [mesa] Install copyright from license.rst * [mesa] Revise internal dependencies * [mesa] Revise external dependencies * [mesa] Move windows opengl32 lib to manual-link * [opengl] Fix case of include names * [opengl] Refactor for simplicity and mingw support * [opengl] Stop copying out of windows SDK [skip actions] * Update versions * Revert "[opengl] Stop copying out of windows SDK" * [mesa] Align with port opengl
151 lines
5.8 KiB
CMake
151 lines
5.8 KiB
CMake
# 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
|
|
# Fix symbols exporting for MinGW GCC x86
|
|
def-fixes.patch
|
|
# Clover build on Windows
|
|
clover.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 mesa-22.1.7
|
|
SHA512 41302fc55ef429c14b1595832db3a898380230f86d2b84ac1ae3bd453d0aad87ec7ad310004dc64fcf34f58d8ea2736c13971c04eba056bcc549a4e3cc7c9470
|
|
FILE_DISAMBIGUATOR 1
|
|
HEAD_REF master
|
|
PATCHES ${PATCHES}
|
|
)
|
|
|
|
|
|
x_vcpkg_get_python_packages(PYTHON_VERSION "3" OUT_PYTHON_VAR "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.
|
|
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)
|
|
|
|
if("offscreen" IN_LIST FEATURES)
|
|
list(APPEND MESA_OPTIONS -Dosmesa=true)
|
|
else()
|
|
list(APPEND MESA_OPTIONS -Dosmesa=false)
|
|
endif()
|
|
|
|
if("llvm" IN_LIST FEATURES)
|
|
list(APPEND MESA_OPTIONS -Dllvm=enabled)
|
|
else()
|
|
list(APPEND MESA_OPTIONS -Dllvm=disabled)
|
|
endif()
|
|
|
|
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'])
|
|
list(APPEND MESA_OPTIONS -Dmicrosoft-clc=disabled)
|
|
if(NOT VCPKG_TARGET_IS_MINGW)
|
|
set(VCPKG_CXX_FLAGS "/D_CRT_DECLARE_NONSTDC_NAMES ${VCPKG_CXX_FLAGS}")
|
|
set(VCPKG_C_FLAGS "/D_CRT_DECLARE_NONSTDC_NAMES ${VCPKG_C_FLAGS}")
|
|
endif()
|
|
endif()
|
|
|
|
vcpkg_configure_meson(
|
|
SOURCE_PATH "${SOURCE_PATH}"
|
|
OPTIONS
|
|
-Dgles-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"
|
|
"${CURRENT_PACKAGES_DIR}/debug/share"
|
|
# installed by egl-registry
|
|
"${CURRENT_PACKAGES_DIR}/include/KHR"
|
|
"${CURRENT_PACKAGES_DIR}/include/EGL"
|
|
# installed by opengl-registry
|
|
"${CURRENT_PACKAGES_DIR}/include/GL"
|
|
"${CURRENT_PACKAGES_DIR}/include/GLES"
|
|
"${CURRENT_PACKAGES_DIR}/include/GLES2"
|
|
"${CURRENT_PACKAGES_DIR}/include/GLES3"
|
|
)
|
|
file(GLOB remaining "${CURRENT_PACKAGES_DIR}/include/*")
|
|
if(NOT remaining)
|
|
# All headers to be provided by egl-registry and/or opengl-registry
|
|
set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled)
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include")
|
|
endif()
|
|
|
|
if(VCPKG_TARGET_IS_WINDOWS)
|
|
# opengl32.lib is already installed by port opengl.
|
|
# Mesa claims to provide a drop-in replacement of opengl32.dll.
|
|
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/lib/manual-link")
|
|
file(RENAME "${CURRENT_PACKAGES_DIR}/lib/opengl32.lib" "${CURRENT_PACKAGES_DIR}/lib/manual-link/opengl32.lib")
|
|
if(NOT VCPKG_BUILD_TYPE)
|
|
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/lib/manual-link")
|
|
file(RENAME "${CURRENT_PACKAGES_DIR}/debug/lib/opengl32.lib" "${CURRENT_PACKAGES_DIR}/debug/lib/manual-link/opengl32.lib")
|
|
endif()
|
|
endif()
|
|
|
|
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/docs/license.rst")
|