A fork of llvm/llvm-project with reflection features added to Clang.
Originally implemented in matus-chochlik/llvm-project. llvm version updated to 17 in kongr45gpen/llvm-project.
Follow the original LLVM building instructions.
The following pipeline is suggested for this repository:
# You can add --depth=1 to make the clone slightly faster
git clone https://github.com/kongr45gpen/llvm-project.git
cd llvm-project
cmake -S llvm -B build -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang" -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" -DLLVM_TARGETS_TO_BUILD=X86
cmake --build build -- -j 8 clang # 8 parallel jobs
After running this:
- The
clang++
toolchain should be available inbuild/bin
- The
libcxx
implementation of the standard library will be available inbuild/libcxx
To compile with a reflection-enabled compiler and all modern C++ features, you need to make sure to include the correct compiler file, and standard C++ library. Make sure to include the proper command line arguments to enable reflection and reflection extensions as well:
/path/to/llvm-project/build/bin/clang++ -freflection-ts -freflection-ext -stdlib=libc++
To link with libcxx dynamically, add it to your LD_LIBRARY_PATH:
LD_LIBRARY_PATH="/path/to/llvm-project/build/lib/x86_64-linux-gnu"
To link with libcxx statically, add the following arguments:
-static -lc++abi -fuse-ld=lld
See kongr45gpen/ok-serializer for an example project of this.