From 1a6f1ea3b76c3ed4cad5aba5502af390ce50a2c0 Mon Sep 17 00:00:00 2001 From: rtk0c Date: Sat, 28 May 2022 20:52:42 -0700 Subject: Changeset: 42 Change codegen input parsing to lookahead based; lookup table infra; input/output decl infra --- buildtools/codegen/CodegenConfig.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 buildtools/codegen/CodegenConfig.hpp (limited to 'buildtools/codegen/CodegenConfig.hpp') diff --git a/buildtools/codegen/CodegenConfig.hpp b/buildtools/codegen/CodegenConfig.hpp new file mode 100644 index 0000000..4ed576a --- /dev/null +++ b/buildtools/codegen/CodegenConfig.hpp @@ -0,0 +1,9 @@ +#pragma once + +#define CODEGEN_DEBUG_PRINT 1 + +#if CODEGEN_DEBUG_PRINT +# define DEBUG_PRINTF(...) printf(__VA_ARGS__) +#else +# define DEBUG_PRINTF(...) +#endif -- cgit v1.2.3-70-g09d2 From cdd84f25ab1d2a57ee5c7b4c954e35a8d7e2dca3 Mon Sep 17 00:00:00 2001 From: rtk0c Date: Sun, 29 May 2022 22:04:13 -0700 Subject: Changeset: 50 Fix buildsystem mistakes in changeset 49, add debug print option --- CMakeLists.txt | 11 ++++++++--- buildtools/codegen/CodegenConfig.hpp | 4 +++- buildtools/codegen/main.cpp | 2 +- source-codegen-base/MetadataBase.cpp | 1 + 4 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 source-codegen-base/MetadataBase.cpp (limited to 'buildtools/codegen/CodegenConfig.hpp') diff --git a/CMakeLists.txt b/CMakeLists.txt index 0e8dc26..55db14b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,12 +57,17 @@ target_link_libraries(codegen PRIVATE target_flag_rtti(codegen OFF) +option(BRUSSEL_CODEGEN_DEBUG_PRINT "Enable debug printing in the code generator or not." OFF) +if(BRUSSEL_CODEGEN_DEBUG_PRINT) + target_compile_definitions(codegen PRIVATE CODEGEN_DEBUG_PRINT=1) +endif() + # ============================================================================== -file(GLOB_RECURSE things_codegen_base_SOURCES source-common/*.c source-common/*.cpp) +file(GLOB_RECURSE things_codegen_base_SOURCES source-codegen-base/*.c source-codegen-base/*.cpp) add_library(things_codegen_base OBJECT ${things_codegen_base_SOURCES}) -set_target_properties(things_common PROPERTIES +set_target_properties(things_codegen_base PROPERTIES CXX_STANDARD 20 CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF @@ -116,7 +121,7 @@ target_link_libraries(${PROJECT_NAME} PRIVATE # Project internal components things_common - things_metadata + things_codegen_base ) option(BRUSSEL_ENABLE_PROFILING "Whether profiling support is enabled or not." OFF) diff --git a/buildtools/codegen/CodegenConfig.hpp b/buildtools/codegen/CodegenConfig.hpp index 4ed576a..b9dc56c 100644 --- a/buildtools/codegen/CodegenConfig.hpp +++ b/buildtools/codegen/CodegenConfig.hpp @@ -1,6 +1,8 @@ #pragma once -#define CODEGEN_DEBUG_PRINT 1 +#ifndef CODEGEN_DEBUG_PRINT +# define CODEGEN_DEBUG_PRINT 0 +#endif #if CODEGEN_DEBUG_PRINT # define DEBUG_PRINTF(...) printf(__VA_ARGS__) diff --git a/buildtools/codegen/main.cpp b/buildtools/codegen/main.cpp index e759c31..298f19e 100644 --- a/buildtools/codegen/main.cpp +++ b/buildtools/codegen/main.cpp @@ -674,7 +674,7 @@ where : the directory to write generated contents to. This will N } const char* outputDir = argv[1]; - DEBUG_PRINTF("Outputting to directory %s.\n", outputDirPath); + DEBUG_PRINTF("Outputting to directory %s.\n", outputDir); { char path[2048]; diff --git a/source-codegen-base/MetadataBase.cpp b/source-codegen-base/MetadataBase.cpp new file mode 100644 index 0000000..3ccf870 --- /dev/null +++ b/source-codegen-base/MetadataBase.cpp @@ -0,0 +1 @@ +#include "MetadataBase.hpp" -- cgit v1.2.3-70-g09d2