| 1 | # ## Config options ### |
| 2 | include(CMakeDependentOption) |
| 3 | include(EnumOption) |
| 4 | |
| 5 | if(EMSCRIPTEN) |
| 6 | # When configuring web builds with "emcmake cmake -B build -S .", set PLATFORM to Web by default |
| 7 | SET(PLATFORM Web CACHE STRING "Platform to build for.") |
| 8 | endif() |
| 9 | enum_option(PLATFORM "Desktop;Web;WebRGFW;Android;Raspberry Pi;DRM;SDL;RGFW;Memory" "Platform to build for.") |
| 10 | |
| 11 | enum_option(OPENGL_VERSION "OFF;4.3;3.3;2.1;1.1;ES 2.0;ES 3.0;Software" "Force a specific OpenGL Version?") |
| 12 | |
| 13 | # Configuration options |
| 14 | option(BUILD_EXAMPLES "Build the examples." ${PROJECT_IS_TOP_LEVEL}) |
| 15 | option(CUSTOMIZE_BUILD "Show options for customizing your Raylib library build." OFF) |
| 16 | option(ENABLE_ASAN "Enable AddressSanitizer (ASAN) for debugging (degrades performance)" OFF) |
| 17 | option(ENABLE_UBSAN "Enable UndefinedBehaviorSanitizer (UBSan) for debugging" OFF) |
| 18 | option(ENABLE_MSAN "Enable MemorySanitizer (MSan) for debugging (not recommended to run with ASAN)" OFF) |
| 19 | |
| 20 | # Shared library is always PIC. Static library should be PIC too if linked into a shared library |
| 21 | option(WITH_PIC "Compile static library as position-independent code" OFF) |
| 22 | option(BUILD_SHARED_LIBS "Build raylib as a shared library" OFF) |
| 23 | cmake_dependent_option(USE_AUDIO "Build raylib with audio module" ON CUSTOMIZE_BUILD ON) |
| 24 | |
| 25 | enum_option(USE_EXTERNAL_GLFW "OFF;IF_POSSIBLE;ON" "Link raylib against system GLFW instead of embedded one") |
| 26 | |
| 27 | # GLFW build options |
| 28 | option(GLFW_BUILD_WAYLAND "Build the bundled GLFW with Wayland support" OFF) |
| 29 | option(GLFW_BUILD_X11 "Build the bundled GLFW with X11 support" ON) |
| 30 | |
| 31 | option(INCLUDE_EVERYTHING "Include everything disabled by default (for CI usage)" OFF) |
| 32 | set(OFF ${INCLUDE_EVERYTHING} CACHE INTERNAL "Replace any OFF by default with \${OFF} to have it covered by this option") |
| 33 | |
| 34 | include(ParseConfigHeader) |
| 35 | |
| 36 | foreach(FLAG IN LISTS CONFIG_HEADER_FLAGS) |
| 37 | string(REGEX MATCH "([^=]+)=(.+)" _ ${FLAG}) |
| 38 | cmake_dependent_option(${CMAKE_MATCH_1} "" ${CMAKE_MATCH_2} CUSTOMIZE_BUILD ${CMAKE_MATCH_2}) |
| 39 | endforeach() |