Sync with upstream GLFW pull request
The GLFW tree distributed with raylib has two modifications: - GLFW_PKG_{DEPS,LIBS} are exported to PARENT_SCOPE, so we can use them in our pkg-config file - An intermediary glfw_objlib target is added, so we can reexport GLFW symbols from libraylib.a rglfw can fix the second point, but for Wayland usage, we would have to replicate protocol generation, so we just leverage GLFW's existing support instead. To make maintenance easier, I have submitted a pull request for including these modifications to upstream GLFW. And to make that one easier, this patch dog-foods the modifications, so raylib users can help find regressions. :-) glfw/glfw#1307
This commit is contained in:
parent
7154a83313
commit
286c41af52
@ -33,12 +33,8 @@ if(NOT glfw3_FOUND AND NOT USE_EXTERNAL_GLFW STREQUAL "ON" AND "${PLATFORM}" MAT
|
||||
set(GLFW_INSTALL OFF CACHE BOOL "" FORCE)
|
||||
set(BUILD_SHARED_LIBS OFF CACHE BOOL " " FORCE)
|
||||
set(GLFW_USE_WAYLAND ${USE_WAYLAND} CACHE BOOL "" FORCE)
|
||||
if (WITH_PIC OR SHARED)
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
endif()
|
||||
|
||||
add_subdirectory(external/glfw)
|
||||
include_directories(BEFORE SYSTEM external/glfw/include)
|
||||
|
||||
list(APPEND raylib_sources $<TARGET_OBJECTS:glfw_objlib>)
|
||||
else()
|
||||
|
6
src/external/glfw/CMakeLists.txt
vendored
6
src/external/glfw/CMakeLists.txt
vendored
@ -327,10 +327,12 @@ endif()
|
||||
# Export GLFW library dependencies
|
||||
#--------------------------------------------------------------------
|
||||
foreach(arg ${glfw_PKG_DEPS})
|
||||
set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} ${arg}" PARENT_SCOPE)
|
||||
set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} ${arg}" CACHE INTERNAL
|
||||
"GLFW pkg-config Requires.private")
|
||||
endforeach()
|
||||
foreach(arg ${glfw_PKG_LIBS})
|
||||
set(GLFW_PKG_LIBS "${GLFW_PKG_LIBS} ${arg}" PARENT_SCOPE)
|
||||
set(GLFW_PKG_LIBS "${GLFW_PKG_LIBS} ${arg}" CACHE INTERNAL
|
||||
"GLFW pkg-config Libs.private")
|
||||
endforeach()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
|
13
src/external/glfw/src/CMakeLists.txt
vendored
13
src/external/glfw/src/CMakeLists.txt
vendored
@ -94,18 +94,20 @@ endif()
|
||||
|
||||
add_library(glfw_objlib OBJECT ${glfw_SOURCES} ${glfw_HEADERS})
|
||||
add_library(glfw $<TARGET_OBJECTS:glfw_objlib>)
|
||||
|
||||
set_target_properties(glfw_objlib PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||
set_target_properties(glfw PROPERTIES
|
||||
OUTPUT_NAME ${GLFW_LIB_NAME}
|
||||
VERSION ${GLFW_VERSION}
|
||||
SOVERSION ${GLFW_VERSION_MAJOR}
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
FOLDER "GLFW3")
|
||||
|
||||
target_compile_definitions(glfw_objlib PRIVATE _GLFW_USE_CONFIG_H)
|
||||
target_include_directories(glfw_objlib PUBLIC
|
||||
"$<BUILD_INTERFACE:${GLFW_SOURCE_DIR}/include>"
|
||||
"$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>")
|
||||
target_include_directories(glfw PUBLIC
|
||||
"$<BUILD_INTERFACE:${GLFW_SOURCE_DIR}/include>"
|
||||
"$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>")
|
||||
target_include_directories(glfw_objlib PRIVATE
|
||||
"${GLFW_SOURCE_DIR}/src"
|
||||
"${GLFW_BINARY_DIR}/src"
|
||||
@ -143,17 +145,17 @@ if (BUILD_SHARED_LIBS)
|
||||
INSTALL_NAME_DIR "lib${LIB_SUFFIX}")
|
||||
elseif (UNIX)
|
||||
# Hide symbols not explicitly tagged for export from the shared library
|
||||
target_compile_options(glfw PRIVATE "-fvisibility=hidden")
|
||||
target_compile_options(glfw_objlib PRIVATE "-fvisibility=hidden")
|
||||
endif()
|
||||
|
||||
target_compile_definitions(glfw INTERFACE GLFW_DLL)
|
||||
target_compile_definitions(glfw_objlib INTERFACE GLFW_DLL)
|
||||
target_link_libraries(glfw PRIVATE ${glfw_LIBRARIES})
|
||||
else()
|
||||
target_link_libraries(glfw INTERFACE ${glfw_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
target_compile_definitions(glfw PRIVATE _CRT_SECURE_NO_WARNINGS)
|
||||
target_compile_definitions(glfw_objlib PRIVATE _CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
|
||||
if (GLFW_INSTALL)
|
||||
@ -163,3 +165,4 @@ if (GLFW_INSTALL)
|
||||
ARCHIVE DESTINATION "lib${LIB_SUFFIX}"
|
||||
LIBRARY DESTINATION "lib${LIB_SUFFIX}")
|
||||
endif()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user