aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAhmad Fatoum <ahmad@a3f.at>2018-02-03 10:17:51 +0100
committerGitHub <noreply@github.com>2018-02-03 10:17:51 +0100
commit7f5fa4d49c4641a8dc0a6716b64cec9166f3fcdc (patch)
treec5a82ecb5a412f0d5b1220ae4c859d9437b0e588 /src
parent007ae1b7b3446da7d2c561db69a535c5ac0b93da (diff)
downloadraylib-7f5fa4d49c4641a8dc0a6716b64cec9166f3fcdc.tar.gz
raylib-7f5fa4d49c4641a8dc0a6716b64cec9166f3fcdc.zip
CMake: Add tristate option for using system GLFW (#455)
-DWITH_SYSTEM_GLFW=ON: Link against system glfw and fail otherwise -DWITH_SYSTEM_GLFW=OFF: Use embedded rglfw.c -DWITH_SYSTEM_GLFW=IF_POSSIBLE: Probe for system glfw but fallback to rglfw if unavailable Also change Linux 64-bit CI build to install system glfw and use it, so this doesn't bitrot. Addresses #453.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt43
1 files changed, 12 insertions, 31 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 809eb4ce..54d3e59c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -26,9 +26,19 @@ set_property(CACHE PLATFORM PROPERTY STRINGS "Desktop" "Web" "Android" "Raspberr
set(OPENGL_VERSION "3.3" CACHE STRING "OpenGL Version to build raylib with")
set_property(CACHE OPENGL_VERSION PROPERTY STRINGS "3.3" "2.1" "1.1" "ES 2.0")
-### Config options ###
-include_directories(external/glfw/include)
+# Get the sources together
+file(GLOB raylib_sources *.c)
+if(glfw3_FOUND)
+ list(REMOVE_ITEM raylib_sources ${CMAKE_CURRENT_SOURCE_DIR}/rglfw.c)
+else()
+ include_directories(external/glfw/include)
+endif()
+file(GLOB stb_vorbis external/stb_vorbis.c)
+file(GLOB mini_al external/mini_al.c ${stb_vorbis})
+set(sources ${raylib_sources} ${mini_al})
+
+### Config options ###
# Translate the config options to what raylib wants
if(${PLATFORM} MATCHES "Desktop")
set(PLATFORM "PLATFORM_DESKTOP")
@@ -81,38 +91,9 @@ if(MACOS_FATLIB)
endif()
endif()
-# Get the sources together
-file(GLOB raylib_sources *.c)
-file(GLOB stb_vorbis external/stb_vorbis.c)
-file(GLOB mini_al external/mini_al.c ${stb_vorbis})
-set(sources ${raylib_sources} ${mini_al})
-
# Which platform?
if(${PLATFORM} MATCHES "PLATFORM_DESKTOP")
- foreach(L ${LIBS_PRIVATE})
- get_filename_component(DIR ${L} PATH)
- get_filename_component(LIBFILE ${L} NAME_WE)
- STRING(REGEX REPLACE "^lib" "" FILE ${LIBFILE})
-
- if (${L} MATCHES "[.]framework$")
- set(FILE_OPT "-framework ${FILE}")
- set(DIR_OPT "-F${DIR} ")
- else()
- set(FILE_OPT "-l${FILE}")
- set(DIR_OPT "-L${DIR} ")
- endif()
-
- if ("${DIR}" STREQUAL "" OR "${DIR}" STREQUAL "${LASTDIR}")
- set (DIR_OPT "")
- endif()
-
- set(LASTDIR ${DIR})
-
- set(PKG_CONFIG_LIBS_PRIVATE "${PKG_CONFIG_LIBS_PRIVATE} ${DIR_OPT}${FILE_OPT}")
- endforeach(L)
-
-
if(${SHARED_RAYLIB})
add_library(${RAYLIB}_shared SHARED ${sources})