Reflection code generator for Pupil Reflection.
- Parse syntax tree to get the meta information.
- Automatically generate corresponding reflection code (for Pupil Reflection).
- Custom annotation for UI or other purposes:
- meta: Identify the fields that need to be reflected.
- range: Determine the variable range of the field.
- info: Brief description.
- step: Step size of variable increase or decrease.
- ...
- Windows 10
- Visual Studio 2019
- MSVC 19.29.30146.0
- CMake 3.22.0
- C++ 17
- clone LLVM:
git clone --config core.autocrlf=false https://github.com/mchenwang/llvm-project.git --recursive
- checkout branch:
git checkout PupilReflTool
- generate:
- turn to project root directory
mkdir build
cd build
cmake -DLLVM_ENABLE_PROJECTS=clang -G "Visual Studio 16 2019" -A x64 -Thost=x64 ..\llvm
- build:
- open LLVM.sln
- set
PupilReflTool
as startup project(underClang executables
directory) - make sure that
PupilReflTool
project has enabled Run-Time Type Information(/GR)- because
dynamic_cast
is used in the project
- because
- run build
An executable file PupilReflTool.exe
will be generated after building successfully.
Just copy PupilReflTool.exe
to your project and run command PupilReflTool.exe target\path\file.h
before compiling to generate the reflection code for target file.
Take CMake as an example, add the following code to the CMakeLists.txt
:
add_custom_target(PRE ALL
COMMAND ${CMAKE_COMMAND} -E echo "=============== [Precompile] BEGIN "
COMMAND ${PROJECT_ROOT}/tool/PupilReflTool.exe ${REFLECT_FILE}
COMMAND ${CMAKE_COMMAND} -E echo "=============== [Precompile] FINISHED"
)
More information about Pupil Reflection: https://github.com/mchenwang/PupilReflect