Allow user to pass code generation input to Makefile

This commit is contained in:
2025-11-08 00:06:48 +00:00
parent 0354c7b485
commit 725955cb2e
2 changed files with 4 additions and 2 deletions

View File

@@ -7,6 +7,7 @@ AR = ar
BUILD_TYPE = Debug
BUILD_DIR = libwapp-build/$(PLATFORM)-$(BUILD_TYPE)
INSTALL_PREFIX = dist
CODEGEN_INPUT = ""
# Internal variables
override CFLAGS = -Wall -Wextra -Werror -pedantic -Isrc
@@ -54,6 +55,7 @@ help:
@echo " BUILD_TYPE Build type. Choose from \`Debug\`, \`RelWithDebInfo\` or \`Release\` (Default: Debug)."
@echo " BUILD_DIR Directory where build files will be written."
@echo " INSTALL_PREFIX Prefix where library and include files will be installed."
@echo " CODEGEN_INPUT Input file for code generation (See codegen_custom_data_example.json for an example)."
@echo
@echo "Available targets:"
@echo " make Build, install and test the full wapp library."
@@ -113,7 +115,7 @@ run-cc-test: build-cc-test
@rm $(TEST_CXX_OUT)
codegen:
python3 -m codegen
python3 -m codegen -f $(CODEGEN_INPUT)
install: build-lib
@mkdir -p $(LIB_INSTALL)

View File

@@ -11,7 +11,7 @@ def main(types_file: Path | None):
dbl_list_datatypes: Dict[CDataType, DblListData] = {}
array_datatypes: Dict[CDataType, ArrayData] = {}
if types_file is not None:
if types_file is not None and types_file.is_file() and "json" in types_file.suffix.lower():
with types_file.open("r") as infile:
datatypes = json.load(infile)
dbl_list_data = datatypes.get(DBL_LIST_DATA)