diff options
| author | Ahmad Fatoum <[email protected]> | 2018-05-12 15:39:13 +0200 |
|---|---|---|
| committer | Ahmad Fatoum <[email protected]> | 2018-05-12 18:38:20 +0200 |
| commit | 0f1aaa474a0d81ccb8c7fd74d856cd42e48cb3b0 (patch) | |
| tree | 1aa2564561a698ce0e80adf81151c98c369d302f /utils.cmake | |
| parent | a09d6fd428d4ee82dd7723625285660e25a902e1 (diff) | |
| download | raylib-0f1aaa474a0d81ccb8c7fd74d856cd42e48cb3b0.tar.gz raylib-0f1aaa474a0d81ccb8c7fd74d856cd42e48cb3b0.zip | |
CMake: (Properly) build glfw separately with CMake
This reverts commit 2d6fb5c628068757387525e190c3afdbe33ae9c6,
and adds a fix for Alien::raylib's test failures.
The tests failed because the resulting static library didn't reexport
GLFW symbols. As a fix, we now have GLFW create a CMake "object library"
target that we can link with both the static and shared raylib.
This is arguably ugly... Proper fix would probably be a GLFW upstream
object library target.
Closes #536.
Diffstat (limited to 'utils.cmake')
| -rwxr-xr-x[-rw-r--r--] | utils.cmake | 51 |
1 files changed, 14 insertions, 37 deletions
diff --git a/utils.cmake b/utils.cmake index 71e34e01..27f74e68 100644..100755 --- a/utils.cmake +++ b/utils.cmake @@ -17,47 +17,24 @@ if(APPLE) elseif(WIN32) # no pkg-config --static on Windows yet... else() - if(USE_WAYLAND) - set(_GLFW_WAYLAND 1) - else() - set(_GLFW_X11 1) - endif() - find_library(pthread NAMES pthread) find_package(OpenGL QUIET) if ("${OPENGL_LIBRARIES}" STREQUAL "") - if(NOT USE_WAYLAND) - # CFLAGS=-m32 cmake on Linux fails for some reason, so fallback to hardcoding - set(LIBS_PRIVATE m pthread GL X11 Xrandr Xinerama Xi Xxf86vm Xcursor) - else() - # CFLAGS=-m32 cmake on Linux fails for some reason, so fallback to hardcoding - set(LIBS_PRIVATE m pthread GL wayland-client wayland-cursor wayland-egl) - endif() + set(OPENGL_LIBRARIES "GL") + endif() + + include_directories(${OPENGL_INCLUDE_DIR}) + + if ("${CMAKE_SYSTEM_NAME}" MATCHES "(Net|Open)BSD") + find_library(OSS_LIBRARY ossaudio) + endif() + + 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() - if(NOT USE_WAYLAND) - find_package(X11 REQUIRED X11) - find_library(XRANDR_LIBRARY Xrandr) - find_library(XI_LIBRARY Xi) - find_library(XINERAMA_LIBRARY Xinerama) - find_library(XXF86VM_LIBRARY Xxf86vm) - find_library(XCURSOR_LIBRARY Xcursor) - else() - find_library(WAYLAND_CLIENT_LIBRARY wayland-client) - find_library(WAYLAND_CURSOR_LIBRARY wayland-cursor) - find_library(WAYLAND_EGL_LIBRARY wayland-egl) - endif() - - include_directories(${OPENGL_INCLUDE_DIR}) - - if ("${CMAKE_SYSTEM_NAME}" MATCHES "(Net|Open)BSD") - find_library(OSS_LIBRARY ossaudio) - endif() - - if(NOT USE_WAYLAND) - set(LIBS_PRIVATE m ${pthread} ${OPENGL_LIBRARIES} ${X11_LIBRARIES} ${XRANDR_LIBRARY} ${XINERAMA_LIBRARY} ${XI_LIBRARY} ${XXF86VM_LIBRARY} ${XCURSOR_LIBRARY} ${OSS_LIBRARY}) - else() - set(LIBS_PRIVATE m ${pthread} ${OPENGL_LIBRARIES} ${WAYLAND_CLIENT_LIBRARY} ${WAYLAND_CURSOR_LIBRARY} ${WAYLAND_EGL_LIBRARY} ${OSS_LIBRARY}) - endif() + set(LIBS_PRIVATE ${LIBS_PRIVATE} X11 Xrandr Xinerama Xi Xxf86vm Xcursor) endif() endif() |
