CMake: Reuse libraries found by glfw CMake config
if (${PLATFORM} MATCHES "Desktop")
target_link_libraries(${RAYLIB}_shared glfw ${GLFW_LIBRARIES})
was never true because PLATFORM STREQUAL "PLATFORM_DESKTOP"...
This fixes #551 and makes the changes suggested in #552 (commited as 965cc8ab
)
unnecessary.
This commit is contained in:
parent
33c830353b
commit
61747508b0
19
cmake/utils.cmake
Executable file → Normal file
19
cmake/utils.cmake
Executable file → Normal file
@ -11,13 +11,8 @@ if(${PLATFORM} MATCHES "Android")
|
|||||||
elseif(${PLATFORM} MATCHES "Web")
|
elseif(${PLATFORM} MATCHES "Web")
|
||||||
elseif(APPLE)
|
elseif(APPLE)
|
||||||
find_library(OPENGL_LIBRARY OpenGL)
|
find_library(OPENGL_LIBRARY OpenGL)
|
||||||
find_library(COCOA_LIBRARY Cocoa)
|
|
||||||
find_library(IOKIT_LIBRARY IOKit)
|
|
||||||
find_library(COREFOUNDATION_LIBRARY CoreFoundation)
|
|
||||||
find_library(COREVIDEO_LIBRARY CoreVideo)
|
|
||||||
|
|
||||||
set(LIBS_PRIVATE ${OPENGL_LIBRARY} ${COCOA_LIBRARY}
|
set(LIBS_PRIVATE ${OPENGL_LIBRARY})
|
||||||
${IOKIT_LIBRARY} ${COREFOUNDATION_LIBRARY} ${COREVIDEO_LIBRARY})
|
|
||||||
elseif(WIN32)
|
elseif(WIN32)
|
||||||
# no pkg-config --static on Windows yet...
|
# no pkg-config --static on Windows yet...
|
||||||
else()
|
else()
|
||||||
@ -34,12 +29,6 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(LIBS_PRIVATE m pthread ${OPENGL_LIBRARIES} ${OSS_LIBRARY})
|
set(LIBS_PRIVATE m pthread ${OPENGL_LIBRARIES} ${OSS_LIBRARY})
|
||||||
# TODO: maybe read those out of glfw's cmake config?
|
|
||||||
if(USE_WAYLAND)
|
|
||||||
set(LIBS_PRIVATE ${LIBS_PRIVATE} wayland-client wayland-cursor wayland-egl)
|
|
||||||
else()
|
|
||||||
set(LIBS_PRIVATE ${LIBS_PRIVATE} X11 Xrandr Xinerama Xi Xxf86vm Xcursor)
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(${PLATFORM} MATCHES "Desktop")
|
if(${PLATFORM} MATCHES "Desktop")
|
||||||
@ -53,14 +42,8 @@ if(${PLATFORM} MATCHES "Desktop")
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Ugly crutch. Temporary workaround for #551
|
|
||||||
if("${CMAKE_SYSTEM_NAME}" MATCHES "(Free|Net|Open)BSD|DragonFly")
|
|
||||||
link_directories("${CMAKE_INSTALL_PREFIX}/lib")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
|
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
|
||||||
set(LINUX TRUE)
|
set(LINUX TRUE)
|
||||||
set(LIBS_PRIVATE dl ${LIBS_PRIVATE})
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
foreach(L ${LIBS_PRIVATE})
|
foreach(L ${LIBS_PRIVATE})
|
||||||
|
@ -9,5 +9,5 @@ URL: http://github.com/raysan5/raylib
|
|||||||
Version: @PROJECT_VERSION@
|
Version: @PROJECT_VERSION@
|
||||||
Libs: -L${libdir} -lraylib
|
Libs: -L${libdir} -lraylib
|
||||||
Libs.private: @PKG_CONFIG_LIBS_PRIVATE@
|
Libs.private: @PKG_CONFIG_LIBS_PRIVATE@
|
||||||
Requires.private:
|
Requires.private: @GLFW_PKG_DEPS@
|
||||||
Cflags: -I${includedir}
|
Cflags: -I${includedir}
|
||||||
|
13
src/CMakeLists.txt
Executable file → Normal file
13
src/CMakeLists.txt
Executable file → Normal file
@ -33,6 +33,8 @@ if(NOT glfw3_FOUND AND NOT USE_EXTERNAL_GLFW STREQUAL "ON" AND "${PLATFORM}" MAT
|
|||||||
include_directories(external/glfw/include)
|
include_directories(external/glfw/include)
|
||||||
|
|
||||||
list(APPEND raylib_sources $<TARGET_OBJECTS:glfw_objlib>)
|
list(APPEND raylib_sources $<TARGET_OBJECTS:glfw_objlib>)
|
||||||
|
else()
|
||||||
|
set(GLFW_PKG_DEPS glfw)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(utils)
|
include(utils)
|
||||||
@ -92,7 +94,7 @@ elseif(${PLATFORM} MATCHES "Android")
|
|||||||
add_if_flag_compiles(-Wa,--noexecstack CMAKE_C_FLAGS)
|
add_if_flag_compiles(-Wa,--noexecstack CMAKE_C_FLAGS)
|
||||||
add_if_flag_compiles(-no-canonical-prefixes CMAKE_C_FLAGS)
|
add_if_flag_compiles(-no-canonical-prefixes CMAKE_C_FLAGS)
|
||||||
add_definitions(-DANDROID -D__ANDROID_API__=21)
|
add_definitions(-DANDROID -D__ANDROID_API__=21)
|
||||||
include_directories(external/android/native_app_glue )
|
include_directories(external/android/native_app_glue)
|
||||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--exclude-libs,libatomic.a -Wl,--build-id -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings -uANativeActivity_onCreate")
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--exclude-libs,libatomic.a -Wl,--build-id -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings -uANativeActivity_onCreate")
|
||||||
|
|
||||||
elseif(${PLATFORM} MATCHES "Raspberry Pi")
|
elseif(${PLATFORM} MATCHES "Raspberry Pi")
|
||||||
@ -114,8 +116,8 @@ if(${SHARED})
|
|||||||
set(CMAKE_MACOSX_RPATH ON)
|
set(CMAKE_MACOSX_RPATH ON)
|
||||||
|
|
||||||
target_link_libraries(${RAYLIB}_shared ${LIBS_PRIVATE})
|
target_link_libraries(${RAYLIB}_shared ${LIBS_PRIVATE})
|
||||||
if (${PLATFORM} MATCHES "Desktop")
|
if (${PLATFORM} MATCHES "PLATFORM_DESKTOP")
|
||||||
target_link_libraries(${RAYLIB}_shared glfw ${GLFW_LIBRARIES})
|
target_link_libraries(${RAYLIB}_shared glfw)
|
||||||
endif()
|
endif()
|
||||||
if (UNIX AND ${FILESYSTEM_LACKS_SYMLINKS})
|
if (UNIX AND ${FILESYSTEM_LACKS_SYMLINKS})
|
||||||
MESSAGE(WARNING "Can't version UNIX shared library on file system without symlink support")
|
MESSAGE(WARNING "Can't version UNIX shared library on file system without symlink support")
|
||||||
@ -151,8 +153,9 @@ if(${STATIC})
|
|||||||
|
|
||||||
add_library(${RAYLIB} STATIC ${sources})
|
add_library(${RAYLIB} STATIC ${sources})
|
||||||
|
|
||||||
set(PKG_CONFIG_LIBS_PRIVATE ${__PKG_CONFIG_LIBS_PRIVATE})
|
set(PKG_CONFIG_LIBS_PRIVATE ${__PKG_CONFIG_LIBS_PRIVATE} ${GLFW_PKG_LIBS})
|
||||||
if (${PLATFORM} MATCHES "Desktop")
|
string (REPLACE ";" " " PKG_CONFIG_LIBS_PRIVATE "${PKG_CONFIG_LIBS_PRIVATE}")
|
||||||
|
if (${PLATFORM} MATCHES "PLATFORM_DESKTOP")
|
||||||
target_link_libraries(${RAYLIB} glfw ${GLFW_LIBRARIES})
|
target_link_libraries(${RAYLIB} glfw ${GLFW_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
4
src/external/glfw/CMakeLists.txt
vendored
4
src/external/glfw/CMakeLists.txt
vendored
@ -327,10 +327,10 @@ endif()
|
|||||||
# Export GLFW library dependencies
|
# Export GLFW library dependencies
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
foreach(arg ${glfw_PKG_DEPS})
|
foreach(arg ${glfw_PKG_DEPS})
|
||||||
set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} ${arg}")
|
set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} ${arg}" PARENT_SCOPE)
|
||||||
endforeach()
|
endforeach()
|
||||||
foreach(arg ${glfw_PKG_LIBS})
|
foreach(arg ${glfw_PKG_LIBS})
|
||||||
set(GLFW_PKG_LIBS "${GLFW_PKG_LIBS} ${arg}")
|
set(GLFW_PKG_LIBS "${GLFW_PKG_LIBS} ${arg}" PARENT_SCOPE)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user