raylib/cmake/GlfwImport.cmake
Alexandre Almeida 6589311a0b
Update GLFW to 3.4 (#3827)
* Update GLFW to 3.4 (draft)

* Add _glfwConnectNull() function to rglfw.c

* Update rglfw.c

* Update Makefile

* Makefile: Replace USE_WAYLAND_DISPLAY with DISABLE_WAYLAND

* Revert "Makefile: Replace USE_WAYLAND_DISPLAY with DISABLE_WAYLAND"

This reverts commit 9e79abde78.

* GlfwImport.cmake: Replace GLFW_USE_WAYLAND with GLFW_BUILD_WAYLAND

* Update rglfw.c

* Output platform selected by GLFW to TRACELOG

* GLFW has removed Mir support
2024-02-29 18:29:32 +01:00

38 lines
1.4 KiB
CMake

if(USE_EXTERNAL_GLFW STREQUAL "ON")
find_package(glfw3 3.3.3 REQUIRED)
elseif(USE_EXTERNAL_GLFW STREQUAL "IF_POSSIBLE")
find_package(glfw3 3.3.3 QUIET)
endif()
if (glfw3_FOUND)
set(LIBS_PRIVATE ${LIBS_PRIVATE} glfw)
endif()
# Explicitly check against "ON", because USE_EXTERNAL_GLFW is a tristate option
# Also adding only on desktop (web also uses glfw but it is more limited and is added using an emcc linker flag)
if(NOT glfw3_FOUND AND NOT USE_EXTERNAL_GLFW STREQUAL "ON" AND "${PLATFORM}" MATCHES "Desktop")
MESSAGE(STATUS "Using raylib's GLFW")
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(GLFW_INSTALL OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_WAYLAND ${USE_WAYLAND} CACHE BOOL "" FORCE)
set(GLFW_LIBRARY_TYPE "OBJECT" CACHE STRING "" FORCE)
add_subdirectory(external/glfw)
# Hide glfw's symbols when building a shared lib
if (BUILD_SHARED_LIBS)
set_property(TARGET glfw PROPERTY C_VISIBILITY_PRESET hidden)
endif()
list(APPEND raylib_sources $<TARGET_OBJECTS:glfw>)
include_directories(BEFORE SYSTEM external/glfw/include)
elseif("${PLATFORM}" STREQUAL "DRM")
MESSAGE(STATUS "No GLFW required on PLATFORM_DRM")
else()
MESSAGE(STATUS "Using external GLFW")
set(GLFW_PKG_DEPS glfw3)
endif()