[glfw3] Fix build on wasm32-emscripten (#39959)

This commit is contained in:
Weihang Ding 2024-09-06 06:59:19 +08:00 committed by GitHub
parent 91d888703f
commit 110c50d470
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 24 additions and 14 deletions

View File

@ -0,0 +1,6 @@
if (NOT TARGET glfw)
add_library(glfw INTERFACE IMPORTED)
set_target_properties(glfw PROPERTIES
INTERFACE_LINK_OPTIONS "-sUSE_GLFW=3"
)
endif()

View File

@ -1,3 +1,11 @@
if (VCPKG_TARGET_IS_EMSCRIPTEN)
# emscripten has built-in glfw3 library
set(VCPKG_BUILD_TYPE release)
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/glfw3Config.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/glfw3")
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
return()
endif()
vcpkg_from_github( vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH OUT_SOURCE_PATH SOURCE_PATH
REPO glfw/glfw REPO glfw/glfw
@ -20,16 +28,6 @@ These can be installed on Ubuntu systems via sudo apt install libxinerama-dev li
Alternatively, when targeting the Wayland display server, use the packages listed in the GLFW documentation here: Alternatively, when targeting the Wayland display server, use the packages listed in the GLFW documentation here:
https://www.glfw.org/docs/3.3/compile.html#compile_deps_wayland") https://www.glfw.org/docs/3.3/compile.html#compile_deps_wayland")
else(VCPKG_TARGET_IS_OSX)
message(
"GLFW3 currently requires the following libraries from the system package manager:
xinerama
xcursor
xorg
libglu1-mesa
pkg-config
These can be installed via brew install libxinerama-dev libxcursor-dev xorg-dev libglu1-mesa-dev pkg-config")
endif() endif()
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
@ -44,6 +42,8 @@ vcpkg_cmake_configure(
-DGLFW_BUILD_TESTS=OFF -DGLFW_BUILD_TESTS=OFF
-DGLFW_BUILD_DOCS=OFF -DGLFW_BUILD_DOCS=OFF
${FEATURE_OPTIONS} ${FEATURE_OPTIONS}
MAYBE_UNUSED_VARIABLES
GLFW_USE_WAYLAND
) )
vcpkg_cmake_install() vcpkg_cmake_install()
@ -54,6 +54,4 @@ vcpkg_fixup_pkgconfig()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(INSTALL "${SOURCE_PATH}/LICENSE.md" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.md")
vcpkg_copy_pdbs()

View File

@ -1,6 +1,7 @@
{ {
"name": "glfw3", "name": "glfw3",
"version": "3.4", "version": "3.4",
"port-version": 1,
"description": "GLFW is a free, Open Source, multi-platform library for OpenGL, OpenGL ES and Vulkan application development. It provides a simple, platform-independent API for creating windows, contexts and surfaces, reading input, handling events, etc.", "description": "GLFW is a free, Open Source, multi-platform library for OpenGL, OpenGL ES and Vulkan application development. It provides a simple, platform-independent API for creating windows, contexts and surfaces, reading input, handling events, etc.",
"homepage": "https://github.com/glfw/glfw", "homepage": "https://github.com/glfw/glfw",
"license": "Zlib", "license": "Zlib",

View File

@ -3102,7 +3102,7 @@
}, },
"glfw3": { "glfw3": {
"baseline": "3.4", "baseline": "3.4",
"port-version": 0 "port-version": 1
}, },
"gli": { "gli": {
"baseline": "2021-07-06", "baseline": "2021-07-06",

View File

@ -1,5 +1,10 @@
{ {
"versions": [ "versions": [
{
"git-tree": "d4bbd4f27c2ca619f57778985120cddcedadb1cc",
"version": "3.4",
"port-version": 1
},
{ {
"git-tree": "fcbaa3b4073da7a24e20e043164075512f027d2d", "git-tree": "fcbaa3b4073da7a24e20e043164075512f027d2d",
"version": "3.4", "version": "3.4",