From 72b6d6ad43215f289c8441b6543d3584626a75fb Mon Sep 17 00:00:00 2001 From: jaby Date: Fri, 9 Feb 2024 15:35:25 -0500 Subject: [PATCH] Improve custom configuration support --- examples/PoolBox/PoolBox.code-workspace | 10 +++++----- mkfile/PSEXETarget.mk | 11 ++--------- mkfile/common/CustomConfigHelper.mk | 5 +++++ src/Library/Library.code-workspace | 19 ++++--------------- src/Library/Makefile | 10 ++-------- 5 files changed, 18 insertions(+), 37 deletions(-) create mode 100644 mkfile/common/CustomConfigHelper.mk diff --git a/examples/PoolBox/PoolBox.code-workspace b/examples/PoolBox/PoolBox.code-workspace index 77107f0f..6c83356f 100644 --- a/examples/PoolBox/PoolBox.code-workspace +++ b/examples/PoolBox/PoolBox.code-workspace @@ -11,11 +11,11 @@ { "label": "build", "type": "shell", - "windows": { // v re-export for WSL v re-export for WSL - "command": "wsl make ${input:project}_${input:target} BUILD_PROFILE=${input:build profile} REGION=${input:region} ${input:test} PSX_LICENSE_PATH=$(wslpath ${env:PSX_LICENSE_PATH}) JABY_ENGINE_DIR=$(wslpath ${env:JABY_ENGINE_PATH})", + "windows": { // v re-export for WSL v re-export for WSL + "command": "wsl make ${input:project}_${input:target} BUILD_PROFILE=${input:build profile} REGION=${input:region} CUSTOM_CONFIG=${input:custom config} PSX_LICENSE_PATH=$(wslpath ${env:PSX_LICENSE_PATH}) JABY_ENGINE_DIR=$(wslpath ${env:JABY_ENGINE_PATH})", }, "linux": { - "command": "make ${input:project}_${input:target} BUILD_PROFILE=${input:build profile} REGION=${input:region}", + "command": "make ${input:project}_${input:target} BUILD_PROFILE=${input:build profile} REGION=${input:region} CUSTOM_CONFIG=${input:custom config}", }, "group": { "kind": "build", @@ -69,9 +69,9 @@ "description": "Region profile to use" }, { - "id": "test", + "id": "custom config", "type": "pickString", - "options": ["", "CUSTOM_CONFIG=MyConfig"], + "options": ["", "MyConfig"], "default": "", "description": "Simple custom config test" }, diff --git a/mkfile/PSEXETarget.mk b/mkfile/PSEXETarget.mk index adefbfd4..5292afd5 100644 --- a/mkfile/PSEXETarget.mk +++ b/mkfile/PSEXETarget.mk @@ -2,16 +2,9 @@ AUTO_OVERLAY_DIR = $(OUTPUT_DIR)/auto_overlay include $(AUTO_OVERLAY_DIR)/Overlays.mk +include $(JABY_ENGINE_DIR)/mkfile/common/CustomConfigHelper.mk -#We use the JabyEngine so we will include ourselves -ifdef CUSTOM_CONFIG - CCFLAGS += -I$(JABY_ENGINE_DIR)/config/$(CUSTOM_CONFIG) -imacros $(JABY_ENGINE_DIR)/config/$(CUSTOM_CONFIG)/jabyengine_custom_defines.hpp - # TODO: v can this be empty maybe?? - JABY_ENGINE_LIB_DIR = $(JABY_ENGINE_DIR)/lib/PSX-$(BUILD_PROFILE)/$(CUSTOM_CONFIG) -else - JABY_ENGINE_LIB_DIR = $(JABY_ENGINE_DIR)/lib/PSX-$(BUILD_PROFILE) -endif - +JABY_ENGINE_LIB_DIR = $(JABY_ENGINE_DIR)/lib/PSX-$(BUILD_PROFILE)/$(CUSTOM_CONFIG) JABY_ENGINE_SUPPORT_LIB_DIR = $(JABY_ENGINE_DIR)/Support/lib/PSX-$(BUILD_PROFILE) JABY_ENGINE_SUPPORT_LIBS = $(addprefix -l,$(SUPPORT_LIBS)) JABY_ENGINE_SUPPORT_DEPS = $(addsuffix .a,$(addprefix $(JABY_ENGINE_SUPPORT_LIB_DIR)/lib,$(SUPPORT_LIBS))) diff --git a/mkfile/common/CustomConfigHelper.mk b/mkfile/common/CustomConfigHelper.mk new file mode 100644 index 00000000..b9f64446 --- /dev/null +++ b/mkfile/common/CustomConfigHelper.mk @@ -0,0 +1,5 @@ +JABY_ENGINE_CONFIG_DIR = $(JABY_ENGINE_DIR)config +ifdef CUSTOM_CONFIG + # TODO: Use same header for -I and -imacros? + CCFLAGS += -I$(JABY_ENGINE_CONFIG_DIR)/$(CUSTOM_CONFIG) -imacros $(JABY_ENGINE_CONFIG_DIR)/$(CUSTOM_CONFIG)/jabyengine_custom_defines.hpp +endif \ No newline at end of file diff --git a/src/Library/Library.code-workspace b/src/Library/Library.code-workspace index 8c588e6e..73af75bb 100644 --- a/src/Library/Library.code-workspace +++ b/src/Library/Library.code-workspace @@ -19,17 +19,6 @@ { "label": "make", "type": "shell", - "windows": { - "command": "wsl make ${input:target} BUILD_PROFILE=${input:build cfg} TV_FORMAT=${input:tv format}", - }, - "linux": { - "command": "make ${input:target} BUILD_PROFILE=${input:build cfg} TV_FORMAT=${input:tv format}", - }, - "group": "build" - }, - { - "label": "make custom config", - "type": "shell", "windows": { "command": "wsl make ${input:target} BUILD_PROFILE=${input:build cfg} TV_FORMAT=${input:tv format} CUSTOM_CONFIG=${input:custom config}", }, @@ -42,10 +31,10 @@ "label": "combi make", "type": "shell", "windows": { - "command": "wsl make -f CombiMake.mk ${input:target} BUILD_PROFILE=${input:build cfg}", + "command": "wsl make -f CombiMake.mk ${input:target} BUILD_PROFILE=${input:build cfg} CUSTOM_CONFIG=${input:custom config}", }, "linux": { - "command": "make -f CombiMake.mk ${input:target} BUILD_PROFILE=${input:build cfg}", + "command": "make -f CombiMake.mk ${input:target} BUILD_PROFILE=${input:build cfg} CUSTOM_CONFIG=${input:custom config}", }, "group": "build" }, @@ -68,8 +57,8 @@ { "id": "custom config", "type": "pickString", - "options": ["MyConfig"], - "default": "MyConfig", + "options": ["", "MyConfig"], + "default": "", "description": "The custom configuration to use for this build" }, { diff --git a/src/Library/Makefile b/src/Library/Makefile index 480ce4e6..df9c5e92 100644 --- a/src/Library/Makefile +++ b/src/Library/Makefile @@ -10,14 +10,8 @@ SPLASH_IMAGE_NTSC = src/BootLoader/splash_image_ntsc_boot.hpp CCFLAGS += -Iinclude -I../../include -D__friends=public CCFLAGS += -save-temps=obj -ifdef CUSTOM_CONFIG - #TODO: Custom config build var - CCFLAGS += -I../../config/$(CUSTOM_CONFIG) -imacros ../../config/$(CUSTOM_CONFIG)/jabyengine_custom_defines.hpp - #TODO: v Or here? v Do we want this here? - CONFIG_NAME = $(PLATFORM)-$(BUILD_PROFILE)/$(CUSTOM_CONFIG) -else - CONFIG_NAME = $(PLATFORM)-$(BUILD_PROFILE) -endif +include ../../mkfile/common/CustomConfigHelper.mk +CONFIG_NAME = $(PLATFORM)-$(BUILD_PROFILE)/$(CUSTOM_CONFIG) include ../../mkfile/Wildcard.mk SRCS = $(call rwildcard, src, c cpp s)