summaryrefslogtreecommitdiff
path: root/libs/raylib/cmake
diff options
context:
space:
mode:
authorThomas <mail.thomasclement@gmail.com>2021-08-15 10:03:09 +0200
committerThomas <mail.thomasclement@gmail.com>2021-08-15 10:03:09 +0200
commit3a1d97f556bc4c5384799ac121640984b590c05c (patch)
tree20aeab4c18d76c344e2ce1f16913b39c447659b1 /libs/raylib/cmake
parenteebaddf29efad9bc7b82d8745d839931f08ef887 (diff)
downloadgamejam-slgj-2024-3a1d97f556bc4c5384799ac121640984b590c05c.tar.gz
gamejam-slgj-2024-3a1d97f556bc4c5384799ac121640984b590c05c.tar.bz2
gamejam-slgj-2024-3a1d97f556bc4c5384799ac121640984b590c05c.zip
Updated to raylib 3.7
Diffstat (limited to 'libs/raylib/cmake')
-rw-r--r--libs/raylib/cmake/BuildOptions.cmake18
-rw-r--r--libs/raylib/cmake/BuildType.cmake43
-rw-r--r--libs/raylib/cmake/CheckFileSystemSymlinkSupport.cmake13
-rw-r--r--libs/raylib/cmake/CompileDefinitions.cmake110
-rw-r--r--libs/raylib/cmake/CompilerFlags.cmake79
-rw-r--r--libs/raylib/cmake/GlfwImport.cmake34
-rw-r--r--libs/raylib/cmake/InstallConfigurations.cmake29
-rw-r--r--libs/raylib/cmake/JoinPaths.cmake26
-rw-r--r--libs/raylib/cmake/LibraryConfigurations.cmake107
-rw-r--r--libs/raylib/cmake/PackConfigurations.cmake13
-rw-r--r--libs/raylib/cmake/emscripten.cmake15
-rw-r--r--libs/raylib/cmake/test-pkgconfig.sh21
12 files changed, 416 insertions, 92 deletions
diff --git a/libs/raylib/cmake/BuildOptions.cmake b/libs/raylib/cmake/BuildOptions.cmake
new file mode 100644
index 0000000..0fce642
--- /dev/null
+++ b/libs/raylib/cmake/BuildOptions.cmake
@@ -0,0 +1,18 @@
+if(${PLATFORM} MATCHES "Desktop" AND APPLE)
+ 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()
+endif()
+
+# This helps support the case where emsdk toolchain file is used
+# either by setting it with -DCMAKE_TOOLCHAIN_FILE=<path_to_emsdk>/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake
+# or by using "emcmake cmake -B build -S ." as described in https://emscripten.org/docs/compiling/Building-Projects.html
+if(EMSCRIPTEN)
+ SET(PLATFORM Web CACHE STRING "Forcing PLATFORM_WEB because EMSCRIPTEN was detected")
+endif()
+
+# vim: ft=cmake
diff --git a/libs/raylib/cmake/BuildType.cmake b/libs/raylib/cmake/BuildType.cmake
deleted file mode 100644
index 80ccdee..0000000
--- a/libs/raylib/cmake/BuildType.cmake
+++ /dev/null
@@ -1,43 +0,0 @@
-# Set a default build type if none was specified
-set(default_build_type "Release")
-if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
- set(default_build_type "Debug")
-endif()
-
-if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
- message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
- set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
- STRING "Choose the type of build." FORCE)
- # Set the possible values of build type for cmake-gui
- set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
- "MinSizeRel" "RelWithDebInfo")
-endif()
-
-# Taken from the https://github.com/OpenChemistry/tomviz project
-# Copyright (c) 2014-2017, Kitware, Inc.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-# 1. Redistributions of source code must retain the above copyright notice, this
-# list of conditions and the following disclaimer.
-#
-# 2. Redistributions in binary form must reproduce the above copyright notice,
-# this list of conditions and the following disclaimer in the documentation
-# and/or other materials provided with the distribution.
-#
-# 3. Neither the name of the copyright holder nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
-# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/libs/raylib/cmake/CheckFileSystemSymlinkSupport.cmake b/libs/raylib/cmake/CheckFileSystemSymlinkSupport.cmake
deleted file mode 100644
index 798840e..0000000
--- a/libs/raylib/cmake/CheckFileSystemSymlinkSupport.cmake
+++ /dev/null
@@ -1,13 +0,0 @@
-# Populates a ${FILESYSTEM_LACKS_SYMLINKS} variable
-message(STATUS "Testing if file system supports symlinks")
-execute_process(
- COMMAND ${CMAKE_COMMAND} -E create_symlink CMakeLists.txt "${CMAKE_CURRENT_BINARY_DIR}/TestingIfSymlinkWorks"
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- RESULT_VARIABLE FILESYSTEM_LACKS_SYMLINKS
-)
-If (FILESYSTEM_LACKS_SYMLINKS)
- message(STATUS "Testing if file system supports symlinks -- unsupported")
-else()
- message(STATUS "Testing if file system supports symlinks -- supported")
-endif()
-
diff --git a/libs/raylib/cmake/CompileDefinitions.cmake b/libs/raylib/cmake/CompileDefinitions.cmake
new file mode 100644
index 0000000..36062b3
--- /dev/null
+++ b/libs/raylib/cmake/CompileDefinitions.cmake
@@ -0,0 +1,110 @@
+# Adding compile definitions
+target_compile_definitions("raylib" PUBLIC "${PLATFORM_CPP}")
+target_compile_definitions("raylib" PUBLIC "${GRAPHICS}")
+
+function(define_if target variable)
+ if (${${variable}})
+ target_compile_definitions(${target} PUBLIC "${variable}")
+ endif ()
+endfunction()
+
+if (${CUSTOMIZE_BUILD})
+ target_compile_definitions("raylib" PUBLIC EXTERNAL_CONFIG_FLAGS)
+ define_if("raylib" SUPPORT_CAMERA_SYSTEM)
+ define_if("raylib" SUPPORT_GESTURES_SYSTEM)
+ define_if("raylib" SUPPORT_MOUSE_GESTURES)
+ define_if("raylib" SUPPORT_SSH_KEYBOARD_RPI)
+ define_if("raylib" SUPPORT_BUSY_WAIT_LOOP)
+ define_if("raylib" SUPPORT_EVENTS_WAITING)
+ define_if("raylib" SUPPORT_SCREEN_CAPTURE)
+ define_if("raylib" SUPPORT_GIF_RECORDING)
+ define_if("raylib" SUPPORT_HIGH_DPI)
+ define_if("raylib" SUPPORT_COMPRESSION_API)
+ define_if("raylib" SUPPORT_DATA_STORAGE)
+ define_if("raylib" SUPPORT_VR_SIMULATOR)
+ define_if("raylib" SUPPORT_FONT_TEXTURE)
+ define_if("raylib" SUPPORT_QUADS_DRAW_MODE)
+ define_if("raylib" SUPPORT_FILEFORMAT_PNG)
+ define_if("raylib" SUPPORT_FILEFORMAT_DDS)
+ define_if("raylib" SUPPORT_FILEFORMAT_HDR)
+ define_if("raylib" SUPPORT_FILEFORMAT_KTX)
+ define_if("raylib" SUPPORT_FILEFORMAT_ASTC)
+ define_if("raylib" SUPPORT_FILEFORMAT_BMP)
+ define_if("raylib" SUPPORT_FILEFORMAT_TGA)
+ define_if("raylib" SUPPORT_FILEFORMAT_JPG)
+ define_if("raylib" SUPPORT_FILEFORMAT_GIF)
+ define_if("raylib" SUPPORT_FILEFORMAT_PSD)
+ define_if("raylib" SUPPORT_FILEFORMAT_PKM)
+ define_if("raylib" SUPPORT_FILEFORMAT_PVR)
+ define_if("raylib" ORT_IMAGE_EXPORT)
+ define_if("raylib" SUPPORT_IMAGE_MANIPULATION)
+ define_if("raylib" SUPPORT_IMAGE_GENERATION)
+ define_if("raylib" SUPPORT_DEFAULT_FONT)
+ define_if("raylib" SUPPORT_FILEFORMAT_FNT)
+ define_if("raylib" SUPPORT_FILEFORMAT_TTF)
+ define_if("raylib" SUPPORT_TEXT_MANIPULATION)
+ define_if("raylib" SUPPORT_FILEFORMAT_OBJ)
+ define_if("raylib" SUPPORT_FILEFORMAT_MTL)
+ define_if("raylib" SUPPORT_FILEFORMAT_IQM)
+ define_if("raylib" SUPPORT_FILEFORMAT_GLTF)
+ define_if("raylib" SUPPORT_MESH_GENERATION)
+ define_if("raylib" SUPPORT_FILEFORMAT_WAV)
+ define_if("raylib" SUPPORT_FILEFORMAT_OGG)
+ define_if("raylib" SUPPORT_FILEFORMAT_XM)
+ define_if("raylib" SUPPORT_FILEFORMAT_MOD)
+ define_if("raylib" SUPPORT_FILEFORMAT_FLAC)
+ define_if("raylib" SUPPORT_FILEFORMAT_MP3)
+ define_if("raylib" SUPPORT_STANDARD_FILEIO)
+ define_if("raylib" SUPPORT_TRACELOG)
+ define_if("raylib" SUPPORT_COMPRESSION_API)
+
+
+ if (UNIX AND NOT APPLE)
+ target_compile_definitions("raylib" PUBLIC "MAX_FILEPATH_LENGTH=4096")
+ else ()
+ target_compile_definitions("raylib" PUBLIC "MAX_FILEPATH_LENGTH=512")
+ endif ()
+
+ target_compile_definitions("raylib" PUBLIC "MAX_GAMEPADS=4")
+ target_compile_definitions("raylib" PUBLIC "MAX_GAMEPAD_AXIS=8")
+ target_compile_definitions("raylib" PUBLIC "MAX_GAMEPAD_BUTTONS=32")
+ target_compile_definitions("raylib" PUBLIC "MAX_TOUCH_POINTS=10")
+ target_compile_definitions("raylib" PUBLIC "MAX_KEY_PRESSED_QUEUE=16")
+
+ target_compile_definitions("raylib" PUBLIC "STORAGE_DATA_FILE=\"storage.data\"")
+ target_compile_definitions("raylib" PUBLIC "MAX_KEY_PRESSED_QUEUE=16")
+ target_compile_definitions("raylib" PUBLIC "MAX_DECOMPRESSION_SIZE=64")
+
+ if (${GRAPHICS} MATCHES "GRAPHICS_API_OPENGL_33" OR ${GRAPHICS} MATCHES "GRAPHICS_API_OPENGL_11")
+ target_compile_definitions("raylib" PUBLIC "DEFAULT_BATCH_BUFFER_ELEMENTS=8192")
+ elseif (${GRAPHICS} MATCHES "GRAPHICS_API_OPENGL_ES2")
+ target_compile_definitions("raylib" PUBLIC "DEFAULT_BATCH_BUFFER_ELEMENTS=2048")
+ endif ()
+
+ target_compile_definitions("raylib" PUBLIC "DEFAULT_BATCH_DRAWCALLS=256")
+ target_compile_definitions("raylib" PUBLIC "MAX_MATRIX_STACK_SIZE=32")
+ target_compile_definitions("raylib" PUBLIC "MAX_SHADER_LOCATIONS=32")
+ target_compile_definitions("raylib" PUBLIC "MAX_MATERIAL_MAPS=12")
+ target_compile_definitions("raylib" PUBLIC "RL_CULL_DISTANCE_NEAR=0.01")
+ target_compile_definitions("raylib" PUBLIC "RL_CULL_DISTANCE_FAR=1000.0")
+
+ target_compile_definitions("raylib" PUBLIC "DEFAULT_SHADER_ATTRIB_NAME_POSITION=\"vertexPosition\"")
+ target_compile_definitions("raylib" PUBLIC "DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD=\"vertexTexCoord\"")
+ target_compile_definitions("raylib" PUBLIC "DEFAULT_SHADER_ATTRIB_NAME_NORMAL=\"vertexNormal\"")
+ target_compile_definitions("raylib" PUBLIC "DEFAULT_SHADER_ATTRIB_NAME_COLOR=\"vertexColor\"")
+ target_compile_definitions("raylib" PUBLIC "DEFAULT_SHADER_ATTRIB_NAME_TANGENT=\"vertexTangent\"")
+ target_compile_definitions("raylib" PUBLIC "DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2=\"vertexTexCoord2\"")
+
+ target_compile_definitions("raylib" PUBLIC "MAX_TEXT_BUFFER_LENGTH=1024")
+ target_compile_definitions("raylib" PUBLIC "MAX_TEXT_UNICODE_CHARS=512")
+ target_compile_definitions("raylib" PUBLIC "MAX_TEXTSPLIT_COUNT=128")
+
+ target_compile_definitions("raylib" PUBLIC "AUDIO_DEVICE_FORMAT=ma_format_f32")
+ target_compile_definitions("raylib" PUBLIC "AUDIO_DEVICE_CHANNELS=2")
+ target_compile_definitions("raylib" PUBLIC "AUDIO_DEVICE_SAMPLE_RATE=44100")
+ target_compile_definitions("raylib" PUBLIC "DEFAULT_AUDIO_BUFFER_SIZE=4096")
+
+ target_compile_definitions("raylib" PUBLIC "MAX_TRACELOG_MSG_LENGTH=128")
+ target_compile_definitions("raylib" PUBLIC "MAX_UWP_MESSAGES=512")
+endif ()
+
diff --git a/libs/raylib/cmake/CompilerFlags.cmake b/libs/raylib/cmake/CompilerFlags.cmake
new file mode 100644
index 0000000..970462c
--- /dev/null
+++ b/libs/raylib/cmake/CompilerFlags.cmake
@@ -0,0 +1,79 @@
+include(AddIfFlagCompiles)
+
+# Makes +/- operations on void pointers be considered an error
+# https://gcc.gnu.org/onlinedocs/gcc/Pointer-Arith.html
+add_if_flag_compiles(-Werror=pointer-arith CMAKE_C_FLAGS)
+
+# Generates error whenever a function is used before being declared
+# https://gcc.gnu.org/onlinedocs/gcc-4.0.1/gcc/Warning-Options.html
+add_if_flag_compiles(-Werror=implicit-function-declaration CMAKE_C_FLAGS)
+
+# Allows some casting of pointers without generating a warning
+add_if_flag_compiles(-fno-strict-aliasing CMAKE_C_FLAGS)
+
+if (ENABLE_MSAN AND ENABLE_ASAN)
+ # MSAN and ASAN both work on memory - ASAN does more things
+ MESSAGE(WARNING "Compiling with both AddressSanitizer and MemorySanitizer is not recommended")
+endif()
+
+if (ENABLE_ASAN)
+
+ # If enabled it would generate errors/warnings for all kinds of memory errors
+ # (like returning a stack variable by reference)
+ # https://clang.llvm.org/docs/AddressSanitizer.html
+
+ add_if_flag_compiles(-fno-omit-frame-pointer CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
+ add_if_flag_compiles(-fsanitize=address CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
+
+endif()
+
+if (ENABLE_UBSAN)
+
+ # If enabled this will generate errors for undefined behavior points
+ # (like adding +1 to the maximum int value)
+ # https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
+
+ add_if_flag_compiles(-fno-omit-frame-pointer CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
+ add_if_flag_compiles(-fsanitize=undefined CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
+
+endif()
+
+if (ENABLE_MSAN)
+
+ # If enabled this will generate warnings for places where uninitialized memory is used
+ # https://clang.llvm.org/docs/MemorySanitizer.html
+
+ add_if_flag_compiles(-fno-omit-frame-pointer CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
+ add_if_flag_compiles(-fsanitize=memory CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
+
+endif()
+
+if(CMAKE_VERSION VERSION_LESS "3.1")
+ if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ add_if_flag_compiles(-std=gnu99 CMAKE_C_FLAGS)
+ endif()
+else()
+ set (CMAKE_C_STANDARD 99)
+endif()
+
+if(${PLATFORM} MATCHES "Android")
+
+ # If enabled will remove dead code during the linking process
+ # https://gcc.gnu.org/onlinedocs/gnat_ugn/Compilation-options.html
+ add_if_flag_compiles(-ffunction-sections CMAKE_C_FLAGS)
+
+ # If enabled will generate some exception data (usually disabled for C programs)
+ # https://gcc.gnu.org/onlinedocs/gcc-4.2.4/gcc/Code-Gen-Options.html
+ add_if_flag_compiles(-funwind-tables CMAKE_C_FLAGS)
+
+ # If enabled adds stack protection guards around functions that allocate memory
+ # https://www.keil.com/support/man/docs/armclang_ref/armclang_ref_cjh1548250046139.htm
+ add_if_flag_compiles(-fstack-protector-strong CMAKE_C_FLAGS)
+
+ # Marks that the library will not be compiled with an executable stack
+ add_if_flag_compiles(-Wa,--noexecstack CMAKE_C_FLAGS)
+
+ # Do not expand symbolic links or resolve paths like "/./" or "/../", etc.
+ # https://gcc.gnu.org/onlinedocs/gcc/Directory-Options.html
+ add_if_flag_compiles(-no-canonical-prefixes CMAKE_C_FLAGS)
+endif()
diff --git a/libs/raylib/cmake/GlfwImport.cmake b/libs/raylib/cmake/GlfwImport.cmake
new file mode 100644
index 0000000..b740884
--- /dev/null
+++ b/libs/raylib/cmake/GlfwImport.cmake
@@ -0,0 +1,34 @@
+
+if(USE_EXTERNAL_GLFW STREQUAL "ON")
+ find_package(glfw3 3.2.1 REQUIRED)
+elseif(USE_EXTERNAL_GLFW STREQUAL "IF_POSSIBLE")
+ find_package(glfw3 3.2.1 QUIET)
+endif()
+if (glfw3_FOUND)
+ set(LIBS_PRIVATE ${LIBS_PRIVATE} glfw)
+endif()
+
+# Explicitly check against "ON", because USE_EXTERNAL_GLFW is a tristate option
+# Also adding only on desktop (web also uses glfw but it is more limited and is added using an emcc linker flag)
+if(NOT glfw3_FOUND AND NOT USE_EXTERNAL_GLFW STREQUAL "ON" AND "${PLATFORM}" MATCHES "Desktop")
+ MESSAGE(STATUS "Using raylib's GLFW")
+ 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_INSTALL OFF CACHE BOOL "" FORCE)
+ set(GLFW_USE_WAYLAND ${USE_WAYLAND} CACHE BOOL "" FORCE)
+
+ set(WAS_SHARED ${BUILD_SHARED_LIBS})
+ set(BUILD_SHARED_LIBS OFF CACHE BOOL " " FORCE)
+
+ add_subdirectory(external/glfw)
+
+ set(BUILD_SHARED_LIBS ${WAS_SHARED} CACHE BOOL " " FORCE)
+ unset(WAS_SHARED)
+
+ list(APPEND raylib_sources $<TARGET_OBJECTS:glfw_objlib>)
+ include_directories(BEFORE SYSTEM external/glfw/include)
+else()
+ MESSAGE(STATUS "Using external GLFW")
+ set(GLFW_PKG_DEPS glfw3)
+endif()
diff --git a/libs/raylib/cmake/InstallConfigurations.cmake b/libs/raylib/cmake/InstallConfigurations.cmake
new file mode 100644
index 0000000..6a89ad5
--- /dev/null
+++ b/libs/raylib/cmake/InstallConfigurations.cmake
@@ -0,0 +1,29 @@
+install(
+ TARGETS raylib EXPORT raylib-targets
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
+ PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
+)
+
+# PKG_CONFIG_LIBS_PRIVATE is used in raylib.pc.in
+if (NOT BUILD_SHARED_LIBS)
+ include(LibraryPathToLinkerFlags)
+ library_path_to_linker_flags(__PKG_CONFIG_LIBS_PRIVATE "${LIBS_PRIVATE}")
+ set(PKG_CONFIG_LIBS_PRIVATE ${__PKG_CONFIG_LIBS_PRIVATE} ${GLFW_PKG_LIBS})
+ string(REPLACE ";" " " PKG_CONFIG_LIBS_PRIVATE "${PKG_CONFIG_LIBS_PRIVATE}")
+elseif (BUILD_SHARED_LIBS)
+ set(PKG_CONFIG_LIBS_EXTRA "")
+endif ()
+
+join_paths(libdir_for_pc_file "\${exec_prefix}" "${CMAKE_INSTALL_LIBDIR}")
+join_paths(includedir_for_pc_file "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}")
+configure_file(../raylib.pc.in raylib.pc @ONLY)
+configure_file(../cmake/raylib-config-version.cmake raylib-config-version.cmake @ONLY)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/raylib.pc DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/raylib-config-version.cmake DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/raylib")
+install(FILES ${PROJECT_SOURCE_DIR}/../cmake/raylib-config.cmake DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/raylib")
+
+# populates raylib_{FOUND, INCLUDE_DIRS, LIBRARIES, LDFLAGS, DEFINITIONS}
+include(PopulateConfigVariablesLocally)
+populate_config_variables_locally(raylib)
diff --git a/libs/raylib/cmake/JoinPaths.cmake b/libs/raylib/cmake/JoinPaths.cmake
new file mode 100644
index 0000000..1de3012
--- /dev/null
+++ b/libs/raylib/cmake/JoinPaths.cmake
@@ -0,0 +1,26 @@
+# This module provides function for joining paths
+# known from most languages
+#
+# Original license:
+# SPDX-License-Identifier: (MIT OR CC0-1.0)
+# Explicit permission given to distribute this module under
+# the terms of the project as described in /LICENSE.rst.
+# Copyright 2020 Jan Tojnar
+# https://github.com/jtojnar/cmake-snips
+#
+# Modelled after Python’s os.path.join
+# https://docs.python.org/3.7/library/os.path.html#os.path.join
+# Windows not supported
+function(join_paths joined_path first_path_segment)
+ set(temp_path "${first_path_segment}")
+ foreach(current_segment IN LISTS ARGN)
+ if(NOT ("${current_segment}" STREQUAL ""))
+ if(IS_ABSOLUTE "${current_segment}")
+ set(temp_path "${current_segment}")
+ else()
+ set(temp_path "${temp_path}/${current_segment}")
+ endif()
+ endif()
+ endforeach()
+ set(${joined_path} "${temp_path}" PARENT_SCOPE)
+endfunction()
diff --git a/libs/raylib/cmake/LibraryConfigurations.cmake b/libs/raylib/cmake/LibraryConfigurations.cmake
new file mode 100644
index 0000000..2d4767a
--- /dev/null
+++ b/libs/raylib/cmake/LibraryConfigurations.cmake
@@ -0,0 +1,107 @@
+if (${PLATFORM} MATCHES "Desktop")
+ set(PLATFORM_CPP "PLATFORM_DESKTOP")
+
+ if (APPLE)
+ # Need to force OpenGL 3.3 on OS X
+ # See: https://github.com/raysan5/raylib/issues/341
+ set(GRAPHICS "GRAPHICS_API_OPENGL_33")
+ find_library(OPENGL_LIBRARY OpenGL)
+ set(LIBS_PRIVATE ${OPENGL_LIBRARY})
+ link_libraries("${LIBS_PRIVATE}")
+ if (NOT CMAKE_SYSTEM STRLESS "Darwin-18.0.0")
+ add_definitions(-DGL_SILENCE_DEPRECATION)
+ MESSAGE(AUTHOR_WARNING "OpenGL is deprecated starting with macOS 10.14 (Mojave)!")
+ endif ()
+ elseif (WIN32)
+ add_definitions(-D_CRT_SECURE_NO_WARNINGS)
+ set(LIBS_PRIVATE ${LIBS_PRIVATE} winmm)
+ else ()
+ find_library(pthread NAMES pthread)
+ find_package(OpenGL QUIET)
+ if ("${OPENGL_LIBRARIES}" STREQUAL "")
+ set(OPENGL_LIBRARIES "GL")
+ endif ()
+
+ if ("${CMAKE_SYSTEM_NAME}" MATCHES "(Net|Open)BSD")
+ find_library(OSS_LIBRARY ossaudio)
+ endif ()
+
+ set(LIBS_PRIVATE m pthread ${OPENGL_LIBRARIES} ${OSS_LIBRARY})
+ endif ()
+
+elseif (${PLATFORM} MATCHES "Web")
+ set(PLATFORM_CPP "PLATFORM_WEB")
+ set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s USE_GLFW=3 -s ASSERTIONS=1 --profiling")
+ set(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
+
+elseif (${PLATFORM} MATCHES "Android")
+ set(PLATFORM_CPP "PLATFORM_ANDROID")
+ set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
+ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
+
+ add_definitions(-DANDROID -D__ANDROID_API__=21)
+ 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")
+
+ find_library(OPENGL_LIBRARY OpenGL)
+ set(LIBS_PRIVATE m log android EGL GLESv2 OpenSLES atomic c)
+
+elseif (${PLATFORM} MATCHES "Raspberry Pi")
+ set(PLATFORM_CPP "PLATFORM_RPI")
+ set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
+
+ add_definitions(-D_DEFAULT_SOURCE)
+
+ find_library(GLESV2 brcmGLESv2 HINTS /opt/vc/lib)
+ find_library(EGL brcmEGL HINTS /opt/vc/lib)
+ find_library(BCMHOST bcm_host HINTS /opt/vc/lib)
+ include_directories(/opt/vc/include /opt/vc/include/interface/vmcs_host/linux /opt/vc/include/interface/vcos/pthreads)
+ link_directories(/opt/vc/lib)
+ set(LIBS_PRIVATE ${GLESV2} ${EGL} ${BCMHOST} pthread rt m dl)
+
+elseif (${PLATFORM} MATCHES "DRM")
+ set(PLATFORM_CPP "PLATFORM_DRM")
+ set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
+
+ add_definitions(-D_DEFAULT_SOURCE)
+ add_definitions(-DEGL_NO_X11)
+ add_definitions(-DPLATFORM_DRM)
+
+ find_library(GLESV2 GLESv2)
+ find_library(EGL EGL)
+ find_library(DRM drm)
+ find_library(GBM gbm)
+
+ if (NOT CMAKE_CROSSCOMPILING)
+ include_directories(/usr/include/libdrm)
+ endif ()
+ set(LIBS_PRIVATE ${GLESV2} ${EGL} ${DRM} ${GBM} pthread m dl)
+
+endif ()
+
+if (${OPENGL_VERSION})
+ set(${SUGGESTED_GRAPHICS} "${GRAPHICS}")
+ if (${OPENGL_VERSION} MATCHES "3.3")
+ set(GRAPHICS "GRAPHICS_API_OPENGL_33")
+ elseif (${OPENGL_VERSION} MATCHES "2.1")
+ set(GRAPHICS "GRAPHICS_API_OPENGL_21")
+ elseif (${OPENGL_VERSION} MATCHES "1.1")
+ set(GRAPHICS "GRAPHICS_API_OPENGL_11")
+ elseif (${OPENGL_VERSION} MATCHES "ES 2.0")
+ set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
+ endif ()
+ if ("${SUGGESTED_GRAPHICS}" AND NOT "${SUGGESTED_GRAPHICS}" STREQUAL "${GRAPHICS}")
+ message(WARNING "You are overriding the suggested GRAPHICS=${SUGGESTED_GRAPHICS} with ${GRAPHICS}! This may fail")
+ endif ()
+endif ()
+
+if (NOT GRAPHICS)
+ set(GRAPHICS "GRAPHICS_API_OPENGL_33")
+endif ()
+
+set(LIBS_PRIVATE ${LIBS_PRIVATE} ${OPENAL_LIBRARY})
+
+if (${PLATFORM} MATCHES "Desktop")
+ set(LIBS_PRIVATE ${LIBS_PRIVATE} glfw)
+endif ()
diff --git a/libs/raylib/cmake/PackConfigurations.cmake b/libs/raylib/cmake/PackConfigurations.cmake
new file mode 100644
index 0000000..74eded0
--- /dev/null
+++ b/libs/raylib/cmake/PackConfigurations.cmake
@@ -0,0 +1,13 @@
+# Packaging
+SET(CPACK_PACKAGE_NAME "raylib")
+SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Simple and easy-to-use library to enjoy videogames programming")
+SET(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
+SET(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
+SET(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
+SET(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}")
+SET(CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_SOURCE_DIR}/../README.md")
+SET(CPACK_RESOURCE_FILE_WELCOME "${PROJECT_SOURCE_DIR}/../README.md")
+SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/../LICENSE")
+SET(CPACK_PACKAGE_FILE_NAME "raylib-${PROJECT_VERSION}$ENV{RAYLIB_PACKAGE_SUFFIX}")
+SET(CPACK_GENERATOR "ZIP;TGZ") # Remove this, if you want the NSIS installer on Windows
+include(CPack) \ No newline at end of file
diff --git a/libs/raylib/cmake/emscripten.cmake b/libs/raylib/cmake/emscripten.cmake
deleted file mode 100644
index 621ae78..0000000
--- a/libs/raylib/cmake/emscripten.cmake
+++ /dev/null
@@ -1,15 +0,0 @@
-SET(CMAKE_SYSTEM_NAME Linux)
-
-SET(CMAKE_C_COMPILER emcc)
-SET(CMAKE_CXX_COMPILER em++)
-if(NOT DEFINED CMAKE_AR)
- find_program(CMAKE_AR NAMES emar)
-endif()
-if(NOT DEFINED CMAKE_RANLIB)
- find_program(CMAKE_RANLIB NAMES emranlib)
-endif()
-
-set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
-set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
-set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
-set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
diff --git a/libs/raylib/cmake/test-pkgconfig.sh b/libs/raylib/cmake/test-pkgconfig.sh
deleted file mode 100644
index ccbdfb6..0000000
--- a/libs/raylib/cmake/test-pkgconfig.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/sh
-# Test if including/linking/running an installed raylib works
-
-set -x
-export LD_RUN_PATH=/usr/local/lib
-
-CFLAGS="-Wall -Wextra -Werror $CFLAGS"
-if [ "$ARCH" = "i386" ]; then
-CFLAGS="-m32 $CLFAGS"
-fi
-
-cat << EOF | ${CC:-cc} -otest -xc - $(pkg-config --libs --cflags $@ raylib.pc) $CFLAGS && exec ./test
-#include <stdlib.h>
-#include <raylib.h>
-
-int main(void)
-{
- int num = GetRandomValue(42, 1337);
- return 42 <= num && num <= 1337 ? EXIT_SUCCESS : EXIT_FAILURE;
-}
-EOF