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)
|
|
|
|
|
2021-01-22 02:07:22 +03:00
|
|
|
set(WAS_SHARED ${BUILD_SHARED_LIBS})
|
|
|
|
set(BUILD_SHARED_LIBS OFF CACHE BOOL " " FORCE)
|
|
|
|
|
2021-01-14 01:10:02 +03:00
|
|
|
add_subdirectory(external/glfw)
|
2021-01-22 02:07:22 +03:00
|
|
|
|
2021-01-23 01:43:06 +03:00
|
|
|
set(BUILD_SHARED_LIBS ${WAS_SHARED} CACHE BOOL " " FORCE)
|
2021-01-22 02:07:22 +03:00
|
|
|
unset(WAS_SHARED)
|
2021-01-14 01:10:02 +03:00
|
|
|
|
2021-06-09 10:49:13 +03:00
|
|
|
list(APPEND raylib_sources $<TARGET_OBJECTS:glfw>)
|
2021-01-14 01:10:02 +03:00
|
|
|
include_directories(BEFORE SYSTEM external/glfw/include)
|
|
|
|
else()
|
|
|
|
MESSAGE(STATUS "Using external GLFW")
|
|
|
|
set(GLFW_PKG_DEPS glfw3)
|
2021-01-23 01:43:06 +03:00
|
|
|
endif()
|