Instead of generating these files manually once in a while and fixing antlr4-python3-runtime to that version in pyproject.toml, we could let CMake do that automatically at build (actually configure) time. This could be achieved by:
add antlr4-tools to build-system.requires in pyproject.toml
write a shell script that produces the files and moves them to a certain location, for example:
#!/bin/sh
for f in *.g4; do
antlr4 "$f" -Werror -Dlanguage=Python3 -visitor || exit 1
done
mv *.py "$1" || exit 1
in cmake/tools/antlr
remove everything from the various *Expression folders and just leave a CMakeLists.txt there listing, for example:
message(STATUS "Generating parser for fluka/RegionExpression")
execute_process(COMMAND
${CMAKE_SOURCE_DIR}/cmake/tools/path/to/script.sh ${CMAKE_CURRENT_SOURCE_DIR}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/cmake/tools/RegionExpression
COMMAND_ERROR_IS_FATAL ANY
)
and add the directory in src/pyg4ometry/CMakeLists.txt
set a loose version bound to antlr4-python3-runtime in proyect.dependencies (pyproject.toml)
Instead of generating these files manually once in a while and fixing
antlr4-python3-runtime
to that version inpyproject.toml
, we could let CMake do that automatically at build (actually configure) time. This could be achieved by:antlr4-tools
tobuild-system.requires
inpyproject.toml
write a shell script that produces the files and moves them to a certain location, for example:
in
cmake/tools/antlr
remove everything from the various
*Expression
folders and just leave aCMakeLists.txt
there listing, for example:and add the directory in
src/pyg4ometry/CMakeLists.txt
antlr4-python3-runtime
inproyect.dependencies
(pyproject.toml
)