build system: add ability to specifiy config file
This commit is contained in:
parent
d7a0b46006
commit
6d323aa485
|
|
@ -26,6 +26,7 @@ endif()
|
||||||
|
|
||||||
option(INCLUDE_EVERYTHING "Include everything disabled by default (for CI usage" OFF)
|
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")
|
set(OFF ${INCLUDE_EVERYTHING} CACHE INTERNAL "Replace any OFF by default with \${OFF} to have it covered by this option")
|
||||||
|
set(EXTERNAL_CONFIG_FILE "" CACHE STRING "Change default config.h by config file at path")
|
||||||
|
|
||||||
# raylib modules included
|
# raylib modules included
|
||||||
cmake_dependent_option(SUPPORT_MODULE_RSHAPES "Include module: rshapes" ON CUSTOMIZE_BUILD ON)
|
cmake_dependent_option(SUPPORT_MODULE_RSHAPES "Include module: rshapes" ON CUSTOMIZE_BUILD ON)
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,11 @@ function(define_if target variable)
|
||||||
endif ()
|
endif ()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
if (NOT ${EXTERNAL_CONFIG_FILE} STREQUAL "")
|
||||||
|
message(STATUS "Config file: ${EXTERNAL_CONFIG_FILE}")
|
||||||
|
target_compile_definitions("raylib" PUBLIC EXTERNAL_CONFIG_FILE=<${EXTERNAL_CONFIG_FILE}>)
|
||||||
|
endif ()
|
||||||
|
|
||||||
if (${CUSTOMIZE_BUILD})
|
if (${CUSTOMIZE_BUILD})
|
||||||
target_compile_definitions("raylib" PUBLIC EXTERNAL_CONFIG_FLAGS)
|
target_compile_definitions("raylib" PUBLIC EXTERNAL_CONFIG_FLAGS)
|
||||||
define_if("raylib" USE_AUDIO)
|
define_if("raylib" USE_AUDIO)
|
||||||
|
|
|
||||||
17
src/Makefile
17
src/Makefile
|
|
@ -72,6 +72,10 @@ RAYLIB_RES_FILE ?= ./raylib.dll.rc.data
|
||||||
# if NONE, default config.h flags are used
|
# if NONE, default config.h flags are used
|
||||||
RAYLIB_CONFIG_FLAGS ?= NONE
|
RAYLIB_CONFIG_FLAGS ?= NONE
|
||||||
|
|
||||||
|
# Define external config file
|
||||||
|
# NOTE: Will load supplied fine instead of default ./config.h
|
||||||
|
RAYLIB_CONFIG_FILE ?= NONE
|
||||||
|
|
||||||
# To define additional cflags: Use make CUSTOM_CFLAGS=""
|
# To define additional cflags: Use make CUSTOM_CFLAGS=""
|
||||||
|
|
||||||
# Include raylib modules on compilation
|
# Include raylib modules on compilation
|
||||||
|
|
@ -311,17 +315,22 @@ endif
|
||||||
# -fno-strict-aliasing jar_xm.h does shady stuff (breaks strict aliasing)
|
# -fno-strict-aliasing jar_xm.h does shady stuff (breaks strict aliasing)
|
||||||
CFLAGS = -Wall -D_DEFAULT_SOURCE -D$(PLATFORM) -D$(GRAPHICS) -Wno-missing-braces -Werror=pointer-arith -fno-strict-aliasing $(CUSTOM_CFLAGS)
|
CFLAGS = -Wall -D_DEFAULT_SOURCE -D$(PLATFORM) -D$(GRAPHICS) -Wno-missing-braces -Werror=pointer-arith -fno-strict-aliasing $(CUSTOM_CFLAGS)
|
||||||
|
|
||||||
ifneq ($(RAYLIB_CONFIG_FLAGS), NONE)
|
ifneq ($(RAYLIB_CONFIG_FLAGS),NONE)
|
||||||
CFLAGS += -DEXTERNAL_CONFIG_FLAGS $(RAYLIB_CONFIG_FLAGS)
|
CFLAGS += -DEXTERNAL_CONFIG_FLAGS=$(RAYLIB_CONFIG_FLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(PLATFORM), PLATFORM_WEB)
|
ifneq ($(RAYLIB_CONFIG_FILE),NONE)
|
||||||
|
$(warning $(RAYLIB_CONFIG_FILE))
|
||||||
|
CFLAGS += -DEXTERNAL_CONFIG_FILE="<$(RAYLIB_CONFIG_FILE)>"
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
CFLAGS += -std=gnu99
|
CFLAGS += -std=gnu99
|
||||||
else
|
else
|
||||||
CFLAGS += -std=c99
|
CFLAGS += -std=c99
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(PLATFORM_OS), LINUX)
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
CFLAGS += -fPIC
|
CFLAGS += -fPIC
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -75,8 +75,10 @@
|
||||||
#else
|
#else
|
||||||
#include "raylib.h" // Declares module functions
|
#include "raylib.h" // Declares module functions
|
||||||
// Check if config flags have been externally provided on compilation line
|
// Check if config flags have been externally provided on compilation line
|
||||||
#if !defined(EXTERNAL_CONFIG_FLAGS)
|
#if !defined(EXTERNAL_CONFIG_FLAGS) && !defined(EXTERNAL_CONFIG_FILE)
|
||||||
#include "config.h" // Defines module configuration flags
|
#include "config.h" // Defines module configuration flags
|
||||||
|
#elif defined(EXTERNAL_CONFIG_FILE)
|
||||||
|
#include EXTERNAL_CONFIG_FILE // Defines module configuration flags in macro specified path
|
||||||
#endif
|
#endif
|
||||||
#include "utils.h" // Required for: fopen() Android mapping
|
#include "utils.h" // Required for: fopen() Android mapping
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -115,8 +115,10 @@
|
||||||
#include "raylib.h" // Declares module functions
|
#include "raylib.h" // Declares module functions
|
||||||
|
|
||||||
// Check if config flags have been externally provided on compilation line
|
// Check if config flags have been externally provided on compilation line
|
||||||
#if !defined(EXTERNAL_CONFIG_FLAGS)
|
#if !defined(EXTERNAL_CONFIG_FLAGS) && !defined(EXTERNAL_CONFIG_FILE)
|
||||||
#include "config.h" // Defines module configuration flags
|
#include "config.h" // Defines module configuration flags
|
||||||
|
#elif defined(EXTERNAL_CONFIG_FILE)
|
||||||
|
#include EXTERNAL_CONFIG_FILE // Defines module configuration flags in macro specified path
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "utils.h" // Required for: TRACELOG() macros
|
#include "utils.h" // Required for: TRACELOG() macros
|
||||||
|
|
|
||||||
|
|
@ -43,8 +43,10 @@
|
||||||
#include "raylib.h" // Declares module functions
|
#include "raylib.h" // Declares module functions
|
||||||
|
|
||||||
// Check if config flags have been externally provided on compilation line
|
// Check if config flags have been externally provided on compilation line
|
||||||
#if !defined(EXTERNAL_CONFIG_FLAGS)
|
#if !defined(EXTERNAL_CONFIG_FLAGS) && !defined(EXTERNAL_CONFIG_FILE)
|
||||||
#include "config.h" // Defines module configuration flags
|
#include "config.h" // Defines module configuration flags
|
||||||
|
#elif defined(EXTERNAL_CONFIG_FILE)
|
||||||
|
#include EXTERNAL_CONFIG_FILE // Defines module configuration flags in macro specified path
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(SUPPORT_MODULE_RMODELS)
|
#if defined(SUPPORT_MODULE_RMODELS)
|
||||||
|
|
|
||||||
|
|
@ -48,8 +48,10 @@
|
||||||
#include "raylib.h" // Declares module functions
|
#include "raylib.h" // Declares module functions
|
||||||
|
|
||||||
// Check if config flags have been externally provided on compilation line
|
// Check if config flags have been externally provided on compilation line
|
||||||
#if !defined(EXTERNAL_CONFIG_FLAGS)
|
#if !defined(EXTERNAL_CONFIG_FLAGS) && !defined(EXTERNAL_CONFIG_FILE)
|
||||||
#include "config.h" // Defines module configuration flags
|
#include "config.h" // Defines module configuration flags
|
||||||
|
#elif defined(EXTERNAL_CONFIG_FILE)
|
||||||
|
#include EXTERNAL_CONFIG_FILE // Defines module configuration flags in macro specified path
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(SUPPORT_MODULE_RSHAPES)
|
#if defined(SUPPORT_MODULE_RSHAPES)
|
||||||
|
|
|
||||||
|
|
@ -52,8 +52,10 @@
|
||||||
#include "raylib.h" // Declares module functions
|
#include "raylib.h" // Declares module functions
|
||||||
|
|
||||||
// Check if config flags have been externally provided on compilation line
|
// Check if config flags have been externally provided on compilation line
|
||||||
#if !defined(EXTERNAL_CONFIG_FLAGS)
|
#if !defined(EXTERNAL_CONFIG_FLAGS) && !defined(EXTERNAL_CONFIG_FILE)
|
||||||
#include "config.h" // Defines module configuration flags
|
#include "config.h" // Defines module configuration flags
|
||||||
|
#elif defined(EXTERNAL_CONFIG_FILE)
|
||||||
|
#include EXTERNAL_CONFIG_FILE // Defines module configuration flags in macro specified path
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(SUPPORT_MODULE_RTEXT)
|
#if defined(SUPPORT_MODULE_RTEXT)
|
||||||
|
|
|
||||||
|
|
@ -64,8 +64,10 @@
|
||||||
#include "raylib.h" // Declares module functions
|
#include "raylib.h" // Declares module functions
|
||||||
|
|
||||||
// Check if config flags have been externally provided on compilation line
|
// Check if config flags have been externally provided on compilation line
|
||||||
#if !defined(EXTERNAL_CONFIG_FLAGS)
|
#if !defined(EXTERNAL_CONFIG_FLAGS) && !defined(EXTERNAL_CONFIG_FILE)
|
||||||
#include "config.h" // Defines module configuration flags
|
#include "config.h" // Defines module configuration flags
|
||||||
|
#elif defined(EXTERNAL_CONFIG_FILE)
|
||||||
|
#include EXTERNAL_CONFIG_FILE // Defines module configuration flags in macro specified path
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(SUPPORT_MODULE_RTEXTURES)
|
#if defined(SUPPORT_MODULE_RTEXTURES)
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,10 @@
|
||||||
#include "raylib.h" // WARNING: Required for: LogType enum
|
#include "raylib.h" // WARNING: Required for: LogType enum
|
||||||
|
|
||||||
// Check if config flags have been externally provided on compilation line
|
// Check if config flags have been externally provided on compilation line
|
||||||
#if !defined(EXTERNAL_CONFIG_FLAGS)
|
#if !defined(EXTERNAL_CONFIG_FLAGS) && !defined(EXTERNAL_CONFIG_FILE)
|
||||||
#include "config.h" // Defines module configuration flags
|
#include "config.h" // Defines module configuration flags
|
||||||
|
#elif defined(EXTERNAL_CONFIG_FILE)
|
||||||
|
#include EXTERNAL_CONFIG_FILE // Defines module configuration flags in macro specified path
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user