summaryrefslogtreecommitdiff
path: root/src/base/CMakeLists.txt
diff options
context:
space:
mode:
authorGereon Kremer <gereon.kremer@cs.rwth-aachen.de>2021-03-01 22:17:54 +0100
committerGitHub <noreply@github.com>2021-03-01 22:17:54 +0100
commit752fce1e326f16723ebb78812a3b2dc41a595b36 (patch)
tree55929a49800250bdae9375187b71ebef5fd68539 /src/base/CMakeLists.txt
parent7029d2c168cb49d3b9552f505a00cc7f538bc100 (diff)
Refactor collection of debug and trace tags (#5996)
We have a mechanism to collect all debug and trace tags used throughout the code base to allow checking for valid tags. This mechanism relies on a collection of more or less readable shell scripts. #5921 hinted to a problem with the current setup, as it passes all source files via command line. This PR refactors this setup so that the scripts collect the files internally, and only the base directory is passed on the command line. As I was touching this code anyway, I ported everything to python and combined it into a single script, in the hope to make it more maintainable. Fixes #5921.
Diffstat (limited to 'src/base/CMakeLists.txt')
-rw-r--r--src/base/CMakeLists.txt38
1 files changed, 5 insertions, 33 deletions
diff --git a/src/base/CMakeLists.txt b/src/base/CMakeLists.txt
index e28bd78cc..e73c82d76 100644
--- a/src/base/CMakeLists.txt
+++ b/src/base/CMakeLists.txt
@@ -40,9 +40,7 @@ libcvc4_add_sources(GENERATED git_versioninfo.cpp)
#-----------------------------------------------------------------------------#
# Generate code for debug/trace tags
-set(gentmptags_script ${CMAKE_CURRENT_LIST_DIR}/gentmptags.sh)
-set(gentags_script ${CMAKE_CURRENT_LIST_DIR}/gentags.sh)
-set(genheader_script ${CMAKE_CURRENT_LIST_DIR}/genheader.sh)
+set(collect_tags_script ${CMAKE_CURRENT_LIST_DIR}/collect_tags.py)
file(GLOB_RECURSE source_files
${PROJECT_SOURCE_DIR}/src/*.cpp
@@ -52,41 +50,15 @@ file(GLOB_RECURSE source_files
string(REPLACE ";" " " source_files_list "${source_files}")
add_custom_command(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Debug_tags.tmp
- COMMAND
- ${gentmptags_script} ${CMAKE_CURRENT_LIST_DIR} Debug ${source_files_list}
- DEPENDS mktags ${gentmptags_script} ${source_files}
-)
-
-add_custom_command(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Trace_tags.tmp
- COMMAND
- ${gentmptags_script} ${CMAKE_CURRENT_LIST_DIR} Trace ${source_files_list}
- DEPENDS mktags ${gentmptags_script} ${source_files}
-)
-
-add_custom_command(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Debug_tags
- COMMAND ${gentags_script} Debug
- DEPENDS ${gentags_script} ${CMAKE_CURRENT_BINARY_DIR}/Debug_tags.tmp
-)
-
-add_custom_command(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Trace_tags
- COMMAND ${gentags_script} Trace
- DEPENDS ${gentags_script} ${CMAKE_CURRENT_BINARY_DIR}/Trace_tags.tmp
-)
-
-add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Debug_tags.h
- COMMAND ${genheader_script} ${CMAKE_CURRENT_LIST_DIR} Debug
- DEPENDS mktagheaders ${genheader_script} ${CMAKE_CURRENT_BINARY_DIR}/Debug_tags
+ COMMAND ${PYTHON_EXECUTABLE} ${collect_tags_script} ${CMAKE_CURRENT_BINARY_DIR}/ Debug ${PROJECT_SOURCE_DIR}/src
+ DEPENDS ${collect_tags_script} ${source_files}
)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Trace_tags.h
- COMMAND ${genheader_script} ${CMAKE_CURRENT_LIST_DIR} Trace
- DEPENDS mktagheaders ${genheader_script} ${CMAKE_CURRENT_BINARY_DIR}/Trace_tags
+ COMMAND ${PYTHON_EXECUTABLE} ${collect_tags_script} ${CMAKE_CURRENT_BINARY_DIR}/ Trace ${PROJECT_SOURCE_DIR}/src
+ DEPENDS ${collect_tags_script} ${source_files}
)
add_custom_target(gen-tags
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback