summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAhmad Fatoum <[email protected]>2018-07-29 22:42:10 +0200
committerAhmad Fatoum <[email protected]>2018-07-29 23:56:16 +0200
commit286c41af5264511073c1da73d6b5d7de324c22ab (patch)
tree081ce4207a26b195a77480d9d47b6b8871b31606
parent7154a833138d4ec2990d7503bd8dfbd47920e9f7 (diff)
downloadraylib-286c41af5264511073c1da73d6b5d7de324c22ab.tar.gz
raylib-286c41af5264511073c1da73d6b5d7de324c22ab.zip
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
-rw-r--r--src/CMakeLists.txt4
-rw-r--r--src/external/glfw/CMakeLists.txt6
-rw-r--r--src/external/glfw/src/CMakeLists.txt13
3 files changed, 12 insertions, 11 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 70cb5527..5581cc7a 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -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()
diff --git a/src/external/glfw/CMakeLists.txt b/src/external/glfw/CMakeLists.txt
index 0eb7e7ea..83fe954e 100644
--- a/src/external/glfw/CMakeLists.txt
+++ b/src/external/glfw/CMakeLists.txt
@@ -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()
#--------------------------------------------------------------------
diff --git a/src/external/glfw/src/CMakeLists.txt b/src/external/glfw/src/CMakeLists.txt
index fe060844..76460769 100644
--- a/src/external/glfw/src/CMakeLists.txt
+++ b/src/external/glfw/src/CMakeLists.txt
@@ -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()
+