2021-01-14 01:10:02 +03:00
|
|
|
|
|
|
|
if(USE_EXTERNAL_GLFW STREQUAL "ON")
|
2021-05-25 13:19:36 +03:00
|
|
|
find_package(glfw3 3.3.3 REQUIRED)
|
2021-01-14 01:10:02 +03:00
|
|
|
elseif(USE_EXTERNAL_GLFW STREQUAL "IF_POSSIBLE")
|
2021-05-25 13:19:36 +03:00
|
|
|
find_package(glfw3 3.3.3 QUIET)
|
2021-01-14 01:10:02 +03:00
|
|
|
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_USE_WAYLAND ${USE_WAYLAND} CACHE BOOL "" FORCE)
|
2023-12-03 21:53:11 +03:00
|
|
|
set(GLFW_LIBRARY_TYPE "OBJECT" CACHE STRING "" FORCE)
|
2021-01-14 01:10:02 +03:00
|
|
|
|
2021-01-22 02:07:22 +03:00
|
|
|
|
2021-01-14 01:10:02 +03:00
|
|
|
add_subdirectory(external/glfw)
|
2021-01-22 02:07:22 +03:00
|
|
|
|
2023-11-28 22:43:45 +03:00
|
|
|
# Hide glfw's symbols when building a shared lib
|
|
|
|
if (BUILD_SHARED_LIBS)
|
|
|
|
set_property(TARGET glfw PROPERTY C_VISIBILITY_PRESET hidden)
|
|
|
|
endif()
|
2021-01-14 01:10:02 +03:00
|
|
|
|
2023-12-03 21:53:11 +03:00
|
|
|
list(APPEND raylib_sources $<TARGET_OBJECTS:glfw>)
|
2021-01-14 01:10:02 +03:00
|
|
|
include_directories(BEFORE SYSTEM external/glfw/include)
|
2022-06-24 11:50:24 +03:00
|
|
|
elseif("${PLATFORM}" STREQUAL "DRM")
|
|
|
|
MESSAGE(STATUS "No GLFW required on PLATFORM_DRM")
|
2021-01-14 01:10:02 +03:00
|
|
|
else()
|
|
|
|
MESSAGE(STATUS "Using external GLFW")
|
|
|
|
set(GLFW_PKG_DEPS glfw3)
|
2021-01-23 01:43:06 +03:00
|
|
|
endif()
|