This component should take a CMakeLists.txt file and return a list of NodeExecutable instances. Each NodeExecutable should describe:
the type of executable (i.e., Python/C++)
the name of the executable
a list of sources for the executable
The easiest and most robust way to implement the above is by using a visitor over the CMake AST [https://github.com/polysquare/cmake-ast]. The visitor need only visit two sorts of AST nodes:
those that define node executables (e.g., catkin_add_executable)
set(...) commands, which define CMake variables
The visitor can use a dictionary to maintain the state of all CMake variables. Upon visiting a set command, we write to the dictionary. Upon encountering a variable access (e.g., {SOURCES}), we use the dictionary to obtain the value for that variable.
To allow maximum code reuse (e.g., for ros-anatomy), it would be great if this code wasn't coupled to a running container (e.g., by running over the text contents of a CMakeLists.txt file).
This component should take a CMakeLists.txt file and return a list of NodeExecutable instances. Each NodeExecutable should describe:
The easiest and most robust way to implement the above is by using a visitor over the CMake AST [https://github.com/polysquare/cmake-ast]. The visitor need only visit two sorts of AST nodes:
set(...)
commands, which define CMake variablesThe visitor can use a dictionary to maintain the state of all CMake variables. Upon visiting a
set
command, we write to the dictionary. Upon encountering a variable access (e.g.,{SOURCES}
), we use the dictionary to obtain the value for that variable.To allow maximum code reuse (e.g., for ros-anatomy), it would be great if this code wasn't coupled to a running container (e.g., by running over the text contents of a CMakeLists.txt file).