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)
|
||||
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
|
||||
cmake_dependent_option(SUPPORT_MODULE_RSHAPES "Include module: rshapes" ON CUSTOMIZE_BUILD ON)
|
||||
|
|
|
|||
|
|
@ -9,6 +9,11 @@ function(define_if target variable)
|
|||
endif ()
|
||||
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})
|
||||
target_compile_definitions("raylib" PUBLIC EXTERNAL_CONFIG_FLAGS)
|
||||
define_if("raylib" USE_AUDIO)
|
||||
|
|
|
|||
11
src/Makefile
11
src/Makefile
|
|
@ -72,6 +72,10 @@ RAYLIB_RES_FILE ?= ./raylib.dll.rc.data
|
|||
# if NONE, default config.h flags are used
|
||||
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=""
|
||||
|
||||
# Include raylib modules on compilation
|
||||
|
|
@ -312,7 +316,12 @@ endif
|
|||
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)
|
||||
CFLAGS += -DEXTERNAL_CONFIG_FLAGS $(RAYLIB_CONFIG_FLAGS)
|
||||
CFLAGS += -DEXTERNAL_CONFIG_FLAGS=$(RAYLIB_CONFIG_FLAGS)
|
||||
endif
|
||||
|
||||
ifneq ($(RAYLIB_CONFIG_FILE),NONE)
|
||||
$(warning $(RAYLIB_CONFIG_FILE))
|
||||
CFLAGS += -DEXTERNAL_CONFIG_FILE="<$(RAYLIB_CONFIG_FILE)>"
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||
|
|
|
|||
|
|
@ -75,8 +75,10 @@
|
|||
#else
|
||||
#include "raylib.h" // Declares module functions
|
||||
// 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
|
||||
#elif defined(EXTERNAL_CONFIG_FILE)
|
||||
#include EXTERNAL_CONFIG_FILE // Defines module configuration flags in macro specified path
|
||||
#endif
|
||||
#include "utils.h" // Required for: fopen() Android mapping
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -115,8 +115,10 @@
|
|||
#include "raylib.h" // Declares module functions
|
||||
|
||||
// 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
|
||||
#elif defined(EXTERNAL_CONFIG_FILE)
|
||||
#include EXTERNAL_CONFIG_FILE // Defines module configuration flags in macro specified path
|
||||
#endif
|
||||
|
||||
#include "utils.h" // Required for: TRACELOG() macros
|
||||
|
|
|
|||
|
|
@ -43,8 +43,10 @@
|
|||
#include "raylib.h" // Declares module functions
|
||||
|
||||
// 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
|
||||
#elif defined(EXTERNAL_CONFIG_FILE)
|
||||
#include EXTERNAL_CONFIG_FILE // Defines module configuration flags in macro specified path
|
||||
#endif
|
||||
|
||||
#if defined(SUPPORT_MODULE_RMODELS)
|
||||
|
|
|
|||
|
|
@ -48,8 +48,10 @@
|
|||
#include "raylib.h" // Declares module functions
|
||||
|
||||
// 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
|
||||
#elif defined(EXTERNAL_CONFIG_FILE)
|
||||
#include EXTERNAL_CONFIG_FILE // Defines module configuration flags in macro specified path
|
||||
#endif
|
||||
|
||||
#if defined(SUPPORT_MODULE_RSHAPES)
|
||||
|
|
|
|||
|
|
@ -52,8 +52,10 @@
|
|||
#include "raylib.h" // Declares module functions
|
||||
|
||||
// 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
|
||||
#elif defined(EXTERNAL_CONFIG_FILE)
|
||||
#include EXTERNAL_CONFIG_FILE // Defines module configuration flags in macro specified path
|
||||
#endif
|
||||
|
||||
#if defined(SUPPORT_MODULE_RTEXT)
|
||||
|
|
|
|||
|
|
@ -64,8 +64,10 @@
|
|||
#include "raylib.h" // Declares module functions
|
||||
|
||||
// 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
|
||||
#elif defined(EXTERNAL_CONFIG_FILE)
|
||||
#include EXTERNAL_CONFIG_FILE // Defines module configuration flags in macro specified path
|
||||
#endif
|
||||
|
||||
#if defined(SUPPORT_MODULE_RTEXTURES)
|
||||
|
|
|
|||
|
|
@ -33,8 +33,10 @@
|
|||
#include "raylib.h" // WARNING: Required for: LogType enum
|
||||
|
||||
// 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
|
||||
#elif defined(EXTERNAL_CONFIG_FILE)
|
||||
#include EXTERNAL_CONFIG_FILE // Defines module configuration flags in macro specified path
|
||||
#endif
|
||||
|
||||
#include "utils.h"
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user