Improvements based on review.
This commit is contained in:
parent
6d5844a059
commit
428f1bbcf8
|
|
@ -15,9 +15,12 @@ endif()
|
||||||
include(CompilerFlags)
|
include(CompilerFlags)
|
||||||
|
|
||||||
# Registers build options that are exposed to cmake
|
# Registers build options that are exposed to cmake
|
||||||
|
include(CMakeOptions.txt)
|
||||||
|
|
||||||
|
# Checks a few environment and compiler configurations
|
||||||
include(BuildOptions)
|
include(BuildOptions)
|
||||||
|
|
||||||
# Main sources directory
|
# Main sources directory (the second parameter sets the output directory name to raylib)
|
||||||
add_subdirectory(src raylib)
|
add_subdirectory(src raylib)
|
||||||
|
|
||||||
if (${BUILD_EXAMPLES})
|
if (${BUILD_EXAMPLES})
|
||||||
|
|
|
||||||
87
CMakeOptions.txt
Normal file
87
CMakeOptions.txt
Normal file
|
|
@ -0,0 +1,87 @@
|
||||||
|
### Config options ###
|
||||||
|
include(CMakeDependentOption)
|
||||||
|
include(EnumOption)
|
||||||
|
|
||||||
|
enum_option(PLATFORM "Desktop;Web;Android;Raspberry Pi;DRM" "Platform to build for.")
|
||||||
|
|
||||||
|
enum_option(OPENGL_VERSION "OFF;3.3;2.1;1.1;ES 2.0" "Force a specific OpenGL Version?")
|
||||||
|
|
||||||
|
# Configuration options
|
||||||
|
option(BUILD_EXAMPLES "Build the examples." ${RAYLIB_IS_MAIN})
|
||||||
|
option(ENABLE_ASAN "Enable AddressSanitizer (ASAN) for debugging (degrades performance)" OFF)
|
||||||
|
option(ENABLE_UBSAN "Enable UndefinedBehaviorSanitizer (UBSan) for debugging" OFF)
|
||||||
|
option(ENABLE_MSAN "Enable MemorySanitizer (MSan) for debugging (not recommended to run with ASAN)" OFF)
|
||||||
|
|
||||||
|
# Shared library is always PIC. Static library should be PIC too if linked into a shared library
|
||||||
|
option(WITH_PIC "Compile static library as position-independent code" OFF)
|
||||||
|
option(SHARED "Build raylib as a dynamic library" OFF)
|
||||||
|
option(STATIC "Build raylib as a static library" ON)
|
||||||
|
option(MACOS_FATLIB "Build fat library for both i386 and x86_64 on macOS" OFF)
|
||||||
|
option(USE_AUDIO "Build raylib with audio module" ON)
|
||||||
|
|
||||||
|
enum_option(USE_EXTERNAL_GLFW "OFF;IF_POSSIBLE;ON" "Link raylib against system GLFW instead of embedded one")
|
||||||
|
if(UNIX AND NOT APPLE)
|
||||||
|
option(USE_WAYLAND "Use Wayland for window creation" OFF)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
option(INCLUDE_EVERYTHING "Include everything disabled by default (for CI usage" OFF)
|
||||||
|
set(OFF ${INCLUDE_EVERYTHING} CACHE INTERNAL "Replace any OFF by default with \${OFF} to have it covered by this option")
|
||||||
|
|
||||||
|
# core.c
|
||||||
|
option(SUPPORT_CAMERA_SYSTEM "Provide camera module (camera.h) with multiple predefined cameras: free, 1st/3rd person, orbital" ON)
|
||||||
|
option(SUPPORT_GESTURES_SYSTEM "Gestures module is included (gestures.h) to support gestures detection: tap, hold, swipe, drag" ON)
|
||||||
|
option(SUPPORT_MOUSE_GESTURES "Mouse gestures are directly mapped like touches and processed by gestures system" ON)
|
||||||
|
option(SUPPORT_SSH_KEYBOARD_RPI "Reconfigure standard input to receive key inputs, works with SSH connection" OFF)
|
||||||
|
option(SUPPORT_DEFAULT_FONT "Default font is loaded on window initialization to be available for the user to render simple text. If enabled, uses external module functions to load default raylib font (module: text)" ON)
|
||||||
|
option(SUPPORT_SCREEN_CAPTURE "Allow automatic screen capture of current screen pressing F12, defined in KeyCallback()" ON)
|
||||||
|
option(SUPPORT_GIF_RECORDING "Allow automatic gif recording of current screen pressing CTRL+F12, defined in KeyCallback()" ON)
|
||||||
|
option(SUPPORT_BUSY_WAIT_LOOP "Use busy wait loop for timing sync instead of a high-resolution timer" OFF)
|
||||||
|
option(SUPPORT_EVENTS_WAITING "Wait for events passively (sleeping while no events) instead of polling them actively every frame" OFF)
|
||||||
|
option(SUPPORT_HIGH_DPI "Support high DPI displays" OFF)
|
||||||
|
|
||||||
|
# rlgl.h
|
||||||
|
option(SUPPORT_VR_SIMULATOR "Support VR simulation functionality (stereo rendering)" ON)
|
||||||
|
|
||||||
|
# shapes.c
|
||||||
|
option(SUPPORT_FONT_TEXTURE "Draw rectangle shapes using font texture white character instead of default white texture. Allows drawing rectangles and text with a single draw call, very useful for GUI systems!" ON)
|
||||||
|
option(SUPPORT_QUADS_DRAW_MODE "Use QUADS instead of TRIANGLES for drawing when possible. Some lines-based shapes could still use lines" ON)
|
||||||
|
|
||||||
|
# textures.c
|
||||||
|
option(SUPPORT_IMAGE_EXPORT "Support image exporting to file" ON)
|
||||||
|
option(SUPPORT_IMAGE_GENERATION "Support procedural image generation functionality (gradient, spot, perlin-noise, cellular)" ON)
|
||||||
|
option(SUPPORT_IMAGE_MANIPULATION "Support multiple image editing functions to scale, adjust colors, flip, draw on images, crop... If not defined only three image editing functions supported: ImageFormat(), ImageAlphaMask(), ImageToPOT()" ON)
|
||||||
|
option(SUPPORT_FILEFORMAT_PNG "Support loading PNG as textures" ON)
|
||||||
|
option(SUPPORT_FILEFORMAT_DDS "Support loading DDS as textures" ON)
|
||||||
|
option(SUPPORT_FILEFORMAT_HDR "Support loading HDR as textures" ON)
|
||||||
|
option(SUPPORT_FILEFORMAT_KTX "Support loading KTX as textures" ON)
|
||||||
|
option(SUPPORT_FILEFORMAT_ASTC "Support loading ASTC as textures" ON)
|
||||||
|
option(SUPPORT_FILEFORMAT_BMP "Support loading BMP as textures" ${OFF})
|
||||||
|
option(SUPPORT_FILEFORMAT_TGA "Support loading TGA as textures" ${OFF})
|
||||||
|
option(SUPPORT_FILEFORMAT_JPG "Support loading JPG as textures" ${OFF})
|
||||||
|
option(SUPPORT_FILEFORMAT_GIF "Support loading GIF as textures" ${OFF})
|
||||||
|
option(SUPPORT_FILEFORMAT_PSD "Support loading PSD as textures" ${OFF})
|
||||||
|
option(SUPPORT_FILEFORMAT_PKM "Support loading PKM as textures" ${OFF})
|
||||||
|
option(SUPPORT_FILEFORMAT_PVR "Support loading PVR as textures" ${OFF})
|
||||||
|
|
||||||
|
# text.c
|
||||||
|
option(SUPPORT_FILEFORMAT_FNT "Support loading fonts in FNT format" ON)
|
||||||
|
option(SUPPORT_FILEFORMAT_TTF "Support loading font in TTF/OTF format" ON)
|
||||||
|
option(SUPPORT_TEXT_MANIPULATION "Support text manipulation functions" ON)
|
||||||
|
|
||||||
|
# models.c
|
||||||
|
option(SUPPORT_MESH_GENERATION "Support procedural mesh generation functions, uses external par_shapes.h library. NOTE: Some generated meshes DO NOT include generated texture coordinates" ON)
|
||||||
|
option(SUPPORT_FILEFORMAT_OBJ "Support loading OBJ file format" ON)
|
||||||
|
option(SUPPORT_FILEFORMAT_MTL "Support loading MTL file format" ON)
|
||||||
|
option(SUPPORT_FILEFORMAT_IQM "Support loading IQM file format" ON)
|
||||||
|
option(SUPPORT_FILEFORMAT_GLTF "Support loading GLTF file format" ON)
|
||||||
|
|
||||||
|
# raudio.c
|
||||||
|
option(SUPPORT_FILEFORMAT_WAV "Support loading WAV for sound" ON)
|
||||||
|
option(SUPPORT_FILEFORMAT_OGG "Support loading OGG for sound" ON)
|
||||||
|
option(SUPPORT_FILEFORMAT_XM "Support loading XM for sound" ON)
|
||||||
|
option(SUPPORT_FILEFORMAT_MOD "Support loading MOD for sound" ON)
|
||||||
|
option(SUPPORT_FILEFORMAT_MP3 "Support loading MP3 for sound" ON)
|
||||||
|
option(SUPPORT_FILEFORMAT_FLAC "Support loading FLAC for sound" ${OFF})
|
||||||
|
|
||||||
|
# utils.c
|
||||||
|
option(SUPPORT_TRACELOG "Show TraceLog() output messages. NOTE: By default LOG_DEBUG traces not shown" ON)
|
||||||
|
|
@ -1,98 +1,3 @@
|
||||||
### Config options ###
|
|
||||||
include(CMakeDependentOption)
|
|
||||||
include(EnumOption)
|
|
||||||
|
|
||||||
enum_option(PLATFORM "Desktop;Web;Android;Raspberry Pi;DRM" "Platform to build for.")
|
|
||||||
|
|
||||||
enum_option(OPENGL_VERSION "OFF;3.3;2.1;1.1;ES 2.0" "Force a specific OpenGL Version?")
|
|
||||||
|
|
||||||
# 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()
|
|
||||||
|
|
||||||
# Configuration options
|
|
||||||
option(BUILD_EXAMPLES "Build the examples." ${RAYLIB_IS_MAIN})
|
|
||||||
option(ENABLE_ASAN "Enable AddressSanitizer (ASAN) for debugging (degrades performance)" OFF)
|
|
||||||
option(ENABLE_UBSAN "Enable UndefinedBehaviorSanitizer (UBSan) for debugging" OFF)
|
|
||||||
option(ENABLE_MSAN "Enable MemorySanitizer (MSan) for debugging (not recommended to run with ASAN)" OFF)
|
|
||||||
|
|
||||||
# Shared library is always PIC. Static library should be PIC too if linked into a shared library
|
|
||||||
option(WITH_PIC "Compile static library as position-independent code" OFF)
|
|
||||||
option(SHARED "Build raylib as a dynamic library" OFF)
|
|
||||||
option(STATIC "Build raylib as a static library" ON)
|
|
||||||
option(MACOS_FATLIB "Build fat library for both i386 and x86_64 on macOS" OFF)
|
|
||||||
option(USE_AUDIO "Build raylib with audio module" ON)
|
|
||||||
|
|
||||||
enum_option(USE_EXTERNAL_GLFW "OFF;IF_POSSIBLE;ON" "Link raylib against system GLFW instead of embedded one")
|
|
||||||
if(UNIX AND NOT APPLE)
|
|
||||||
option(USE_WAYLAND "Use Wayland for window creation" OFF)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
option(INCLUDE_EVERYTHING "Include everything disabled by default (for CI usage" OFF)
|
|
||||||
set(OFF ${INCLUDE_EVERYTHING} CACHE INTERNAL "Replace any OFF by default with \${OFF} to have it covered by this option")
|
|
||||||
|
|
||||||
# core.c
|
|
||||||
option(SUPPORT_CAMERA_SYSTEM "Provide camera module (camera.h) with multiple predefined cameras: free, 1st/3rd person, orbital" ON)
|
|
||||||
option(SUPPORT_GESTURES_SYSTEM "Gestures module is included (gestures.h) to support gestures detection: tap, hold, swipe, drag" ON)
|
|
||||||
option(SUPPORT_MOUSE_GESTURES "Mouse gestures are directly mapped like touches and processed by gestures system" ON)
|
|
||||||
option(SUPPORT_SSH_KEYBOARD_RPI "Reconfigure standard input to receive key inputs, works with SSH connection" OFF)
|
|
||||||
option(SUPPORT_DEFAULT_FONT "Default font is loaded on window initialization to be available for the user to render simple text. If enabled, uses external module functions to load default raylib font (module: text)" ON)
|
|
||||||
option(SUPPORT_SCREEN_CAPTURE "Allow automatic screen capture of current screen pressing F12, defined in KeyCallback()" ON)
|
|
||||||
option(SUPPORT_GIF_RECORDING "Allow automatic gif recording of current screen pressing CTRL+F12, defined in KeyCallback()" ON)
|
|
||||||
option(SUPPORT_BUSY_WAIT_LOOP "Use busy wait loop for timing sync instead of a high-resolution timer" OFF)
|
|
||||||
option(SUPPORT_EVENTS_WAITING "Wait for events passively (sleeping while no events) instead of polling them actively every frame" OFF)
|
|
||||||
option(SUPPORT_HIGH_DPI "Support high DPI displays" OFF)
|
|
||||||
|
|
||||||
# rlgl.h
|
|
||||||
option(SUPPORT_VR_SIMULATOR "Support VR simulation functionality (stereo rendering)" ON)
|
|
||||||
|
|
||||||
# shapes.c
|
|
||||||
option(SUPPORT_FONT_TEXTURE "Draw rectangle shapes using font texture white character instead of default white texture. Allows drawing rectangles and text with a single draw call, very useful for GUI systems!" ON)
|
|
||||||
option(SUPPORT_QUADS_DRAW_MODE "Use QUADS instead of TRIANGLES for drawing when possible. Some lines-based shapes could still use lines" ON)
|
|
||||||
|
|
||||||
# textures.c
|
|
||||||
option(SUPPORT_IMAGE_EXPORT "Support image exporting to file" ON)
|
|
||||||
option(SUPPORT_IMAGE_GENERATION "Support procedural image generation functionality (gradient, spot, perlin-noise, cellular)" ON)
|
|
||||||
option(SUPPORT_IMAGE_MANIPULATION "Support multiple image editing functions to scale, adjust colors, flip, draw on images, crop... If not defined only three image editing functions supported: ImageFormat(), ImageAlphaMask(), ImageToPOT()" ON)
|
|
||||||
option(SUPPORT_FILEFORMAT_PNG "Support loading PNG as textures" ON)
|
|
||||||
option(SUPPORT_FILEFORMAT_DDS "Support loading DDS as textures" ON)
|
|
||||||
option(SUPPORT_FILEFORMAT_HDR "Support loading HDR as textures" ON)
|
|
||||||
option(SUPPORT_FILEFORMAT_KTX "Support loading KTX as textures" ON)
|
|
||||||
option(SUPPORT_FILEFORMAT_ASTC "Support loading ASTC as textures" ON)
|
|
||||||
option(SUPPORT_FILEFORMAT_BMP "Support loading BMP as textures" ${OFF})
|
|
||||||
option(SUPPORT_FILEFORMAT_TGA "Support loading TGA as textures" ${OFF})
|
|
||||||
option(SUPPORT_FILEFORMAT_JPG "Support loading JPG as textures" ${OFF})
|
|
||||||
option(SUPPORT_FILEFORMAT_GIF "Support loading GIF as textures" ${OFF})
|
|
||||||
option(SUPPORT_FILEFORMAT_PSD "Support loading PSD as textures" ${OFF})
|
|
||||||
option(SUPPORT_FILEFORMAT_PKM "Support loading PKM as textures" ${OFF})
|
|
||||||
option(SUPPORT_FILEFORMAT_PVR "Support loading PVR as textures" ${OFF})
|
|
||||||
|
|
||||||
# text.c
|
|
||||||
option(SUPPORT_FILEFORMAT_FNT "Support loading fonts in FNT format" ON)
|
|
||||||
option(SUPPORT_FILEFORMAT_TTF "Support loading font in TTF/OTF format" ON)
|
|
||||||
option(SUPPORT_TEXT_MANIPULATION "Support text manipulation functions" ON)
|
|
||||||
|
|
||||||
# models.c
|
|
||||||
option(SUPPORT_MESH_GENERATION "Support procedural mesh generation functions, uses external par_shapes.h library. NOTE: Some generated meshes DO NOT include generated texture coordinates" ON)
|
|
||||||
option(SUPPORT_FILEFORMAT_OBJ "Support loading OBJ file format" ON)
|
|
||||||
option(SUPPORT_FILEFORMAT_MTL "Support loading MTL file format" ON)
|
|
||||||
option(SUPPORT_FILEFORMAT_IQM "Support loading IQM file format" ON)
|
|
||||||
option(SUPPORT_FILEFORMAT_GLTF "Support loading GLTF file format" ON)
|
|
||||||
|
|
||||||
# raudio.c
|
|
||||||
option(SUPPORT_FILEFORMAT_WAV "Support loading WAV for sound" ON)
|
|
||||||
option(SUPPORT_FILEFORMAT_OGG "Support loading OGG for sound" ON)
|
|
||||||
option(SUPPORT_FILEFORMAT_XM "Support loading XM for sound" ON)
|
|
||||||
option(SUPPORT_FILEFORMAT_MOD "Support loading MOD for sound" ON)
|
|
||||||
option(SUPPORT_FILEFORMAT_MP3 "Support loading MP3 for sound" ON)
|
|
||||||
option(SUPPORT_FILEFORMAT_FLAC "Support loading FLAC for sound" ${OFF})
|
|
||||||
|
|
||||||
# utils.c
|
|
||||||
option(SUPPORT_TRACELOG "Show TraceLog() output messages. NOTE: By default LOG_DEBUG traces not shown" ON)
|
|
||||||
|
|
||||||
if(NOT (STATIC OR SHARED))
|
if(NOT (STATIC OR SHARED))
|
||||||
message(FATAL_ERROR "Nothing to do if both -DSHARED=OFF and -DSTATIC=OFF...")
|
message(FATAL_ERROR "Nothing to do if both -DSHARED=OFF and -DSTATIC=OFF...")
|
||||||
endif()
|
endif()
|
||||||
|
|
@ -124,4 +29,11 @@ if(${PLATFORM} MATCHES "Desktop" AND APPLE)
|
||||||
endif()
|
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
|
# vim: ft=cmake
|
||||||
|
|
|
||||||
|
|
@ -36,12 +36,13 @@ set(raylib_sources
|
||||||
utils.c
|
utils.c
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# cmake/GlfwImport.cmake handles the details around the inclusion of glfw
|
||||||
include(GlfwImport)
|
include(GlfwImport)
|
||||||
|
|
||||||
|
|
||||||
if (USE_AUDIO)
|
if (USE_AUDIO)
|
||||||
MESSAGE(STATUS "Audio Backend: miniaudio")
|
MESSAGE(STATUS "Audio Backend: miniaudio")
|
||||||
list(APPEND raylib_sources ${CMAKE_CURRENT_SOURCE_DIR}/raudio.c)
|
list(APPEND raylib_sources raudio.c)
|
||||||
else ()
|
else ()
|
||||||
MESSAGE(STATUS "Audio Backend: None (-DUSE_AUDIO=OFF)")
|
MESSAGE(STATUS "Audio Backend: None (-DUSE_AUDIO=OFF)")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user