Revert "CMake: Build glfw separately with CMake"
This reverts commit 0adb4b67de
,
because it failed tests for Alien::raylib:
http://www.cpantesters.org/distro/A/Alien-raylib.html
This commit is contained in:
parent
245704df72
commit
2d6fb5c628
26
.travis.yml
26
.travis.yml
@ -18,18 +18,19 @@ matrix:
|
||||
- os: linux
|
||||
env: ARCH=amd64 GLFW=SYSTEM
|
||||
sudo: required
|
||||
- os: linux
|
||||
env: USE_WAYLAND=ON ARCH=amd64
|
||||
sudo: required
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libwayland-dev
|
||||
- libxkbcommon-dev
|
||||
- libegl1-mesa-dev
|
||||
- os: osx
|
||||
env: ARCH=universal
|
||||
|
||||
# - os: linux
|
||||
# env: USE_WAYLAND=ON ARCH=amd64
|
||||
# sudo: required
|
||||
# addons:
|
||||
# apt:
|
||||
# packages:
|
||||
# - libwayland-dev
|
||||
# - libxkbcommon-dev
|
||||
# - libegl1-mesa-dev
|
||||
|
||||
before_script:
|
||||
|
||||
before_install:
|
||||
@ -37,12 +38,11 @@ before_install:
|
||||
sudo apt-get install -y gcc-multilib
|
||||
libasound2-dev:$ARCH
|
||||
libxcursor-dev:$ARCH libxinerama-dev:$ARCH mesa-common-dev:$ARCH
|
||||
libx11-dev:$ARCH libxrandr-dev:$ARCH libxrandr2:$ARCH libxi-dev:$ARCH
|
||||
libx11-dev:$ARCH libxrandr-dev:$ARCH libxi-dev:$ARCH
|
||||
libgl1-mesa-dev:$ARCH libglu1-mesa-dev:$ARCH;
|
||||
if [ "$ARCH" == "i386" ]; then
|
||||
export CMAKE_ARCH_ARGS='-DCMAKE_C_FLAGS=-m32 -DCMAKE_SYSTEM_LIBRARY_PATH=/usr/lib/i386-linux-gnu';
|
||||
fi;
|
||||
export RAYLIB_PACKAGE_SUFFIX="-Linux-$ARCH";
|
||||
if [ "$ARCH" == "i386" ]; then export CFLAGS="-m32"; fi;
|
||||
if [ "$ARCH" == "amd64" ]; then export CFLAGS="-m64"; fi;
|
||||
if [ "$GLFW" == "SYSTEM" ]; then
|
||||
wget 'http://ftp.de.debian.org/debian/pool/main/g/glfw3/libglfw3_3.2.1-1_amd64.deb';
|
||||
wget 'http://ftp.de.debian.org/debian/pool/main/g/glfw3/libglfw3-dev_3.2.1-1_amd64.deb';
|
||||
|
36
src/CMakeLists.txt
Executable file → Normal file
36
src/CMakeLists.txt
Executable file → Normal file
@ -10,28 +10,16 @@ include("CMakeOptions.txt")
|
||||
configure_file(config.h.in ${CMAKE_BINARY_DIR}/cmake/config.h)
|
||||
include_directories(${CMAKE_BINARY_DIR})
|
||||
|
||||
if(MACOS_FATLIB)
|
||||
if (CMAKE_OSX_ARCHITECTURES)
|
||||
message(FATAL_ERROR "User supplied -DCMAKE_OSX_ARCHITECTURES overrides -DMACOS_FATLIB=ON")
|
||||
else()
|
||||
SET(CMAKE_OSX_ARCHITECTURES "x86_64;i386")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT glfw3_FOUND)
|
||||
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_USE_WAYLAND ${USE_WAYLAND} CACHE BOOL "" FORCE)
|
||||
|
||||
add_subdirectory(external/glfw)
|
||||
endif()
|
||||
|
||||
include("../utils.cmake")
|
||||
|
||||
# Get the sources together
|
||||
file(GLOB raylib_sources *.c)
|
||||
list(REMOVE_ITEM raylib_sources ${CMAKE_CURRENT_SOURCE_DIR}/rglfw.c)
|
||||
|
||||
if(glfw3_FOUND)
|
||||
list(REMOVE_ITEM raylib_sources ${CMAKE_CURRENT_SOURCE_DIR}/rglfw.c)
|
||||
else()
|
||||
include_directories(external/glfw/include)
|
||||
endif()
|
||||
|
||||
if(USE_AUDIO)
|
||||
file(GLOB stb_vorbis external/stb_vorbis.c)
|
||||
@ -63,6 +51,7 @@ if(${PLATFORM} MATCHES "Desktop")
|
||||
# See: https://github.com/raysan5/raylib/issues/341
|
||||
if(APPLE)
|
||||
set(GRAPHICS "GRAPHICS_API_OPENGL_33")
|
||||
set_source_files_properties(rglfw.c PROPERTIES COMPILE_FLAGS "-x objective-c")
|
||||
link_libraries("${LIBS_PRIVATE}")
|
||||
elseif(WIN32)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
@ -87,6 +76,14 @@ elseif(${PLATFORM} MATCHES "Raspberry Pi")
|
||||
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
|
||||
endif()
|
||||
|
||||
if(MACOS_FATLIB)
|
||||
if (CMAKE_OSX_ARCHITECTURES)
|
||||
message(FATAL_ERROR "User supplied -DCMAKE_OSX_ARCHITECTURES overrides -DMACOS_FATLIB=ON")
|
||||
else()
|
||||
SET(CMAKE_OSX_ARCHITECTURES "x86_64;i386")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Which platform?
|
||||
if(${PLATFORM} MATCHES "PLATFORM_DESKTOP")
|
||||
|
||||
@ -103,7 +100,7 @@ if(${PLATFORM} MATCHES "PLATFORM_DESKTOP")
|
||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
set(CMAKE_MACOSX_RPATH ON)
|
||||
|
||||
target_link_libraries(${RAYLIB}_shared ${LIBS_PRIVATE} glfw)
|
||||
target_link_libraries(${RAYLIB}_shared ${LIBS_PRIVATE})
|
||||
if (UNIX AND ${FILESYSTEM_LACKS_SYMLINKS})
|
||||
MESSAGE(WARNING "Can't version UNIX shared library on file system without symlink support")
|
||||
else()
|
||||
@ -140,7 +137,6 @@ if(${PLATFORM} MATCHES "PLATFORM_DESKTOP")
|
||||
)
|
||||
|
||||
set(PKG_CONFIG_LIBS_PRIVATE ${__PKG_CONFIG_LIBS_PRIVATE})
|
||||
target_link_libraries(${RAYLIB} glfw)
|
||||
|
||||
if (WITH_PIC)
|
||||
set_property(TARGET ${RAYLIB} PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||
|
51
utils.cmake
Executable file → Normal file
51
utils.cmake
Executable file → Normal file
@ -17,24 +17,47 @@ 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 "")
|
||||
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)
|
||||
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()
|
||||
else()
|
||||
set(LIBS_PRIVATE ${LIBS_PRIVATE} X11 Xrandr Xinerama Xi Xxf86vm Xcursor)
|
||||
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()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user