Allow user to pass code generation input to Makefile
This commit is contained in:
4
Makefile
4
Makefile
@@ -7,6 +7,7 @@ AR = ar
|
|||||||
BUILD_TYPE = Debug
|
BUILD_TYPE = Debug
|
||||||
BUILD_DIR = libwapp-build/$(PLATFORM)-$(BUILD_TYPE)
|
BUILD_DIR = libwapp-build/$(PLATFORM)-$(BUILD_TYPE)
|
||||||
INSTALL_PREFIX = dist
|
INSTALL_PREFIX = dist
|
||||||
|
CODEGEN_INPUT = ""
|
||||||
|
|
||||||
# Internal variables
|
# Internal variables
|
||||||
override CFLAGS = -Wall -Wextra -Werror -pedantic -Isrc
|
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_TYPE Build type. Choose from \`Debug\`, \`RelWithDebInfo\` or \`Release\` (Default: Debug)."
|
||||||
@echo " BUILD_DIR Directory where build files will be written."
|
@echo " BUILD_DIR Directory where build files will be written."
|
||||||
@echo " INSTALL_PREFIX Prefix where library and include files will be installed."
|
@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
|
||||||
@echo "Available targets:"
|
@echo "Available targets:"
|
||||||
@echo " make Build, install and test the full wapp library."
|
@echo " make Build, install and test the full wapp library."
|
||||||
@@ -113,7 +115,7 @@ run-cc-test: build-cc-test
|
|||||||
@rm $(TEST_CXX_OUT)
|
@rm $(TEST_CXX_OUT)
|
||||||
|
|
||||||
codegen:
|
codegen:
|
||||||
python3 -m codegen
|
python3 -m codegen -f $(CODEGEN_INPUT)
|
||||||
|
|
||||||
install: build-lib
|
install: build-lib
|
||||||
@mkdir -p $(LIB_INSTALL)
|
@mkdir -p $(LIB_INSTALL)
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ def main(types_file: Path | None):
|
|||||||
dbl_list_datatypes: Dict[CDataType, DblListData] = {}
|
dbl_list_datatypes: Dict[CDataType, DblListData] = {}
|
||||||
array_datatypes: Dict[CDataType, ArrayData] = {}
|
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:
|
with types_file.open("r") as infile:
|
||||||
datatypes = json.load(infile)
|
datatypes = json.load(infile)
|
||||||
dbl_list_data = datatypes.get(DBL_LIST_DATA)
|
dbl_list_data = datatypes.get(DBL_LIST_DATA)
|
||||||
|
|||||||
Reference in New Issue
Block a user