Skip to content
UNDER THE HOOD

Build structure

  • The top-level CMakeLists.txt builds lib/ (Core, Frontend), tools/, runtime/ and, with WEAVEC_BUILD_TESTS, unittests/ and test/.
  • cmake/WeaveCLLVM.cmake finds LLVM and Clang and provides the weavec::llvm interface target and weavec_link_llvm/weavec_link_clang, which respect LLVM_LINK_LLVM_DYLIB and CLANG_LINK_CLANG_DYLIB.
  • cmake/WeaveCHelpers.cmake provides weavec_add_library and weavec_add_executable. Only USES_LLVM targets get LLVM’s include paths, and Core is not one of them.
  • lib/Core/CMakeLists.txt embeds LibrarySpec.txt as a byte array at configure time; editing the table re-runs the configure step.
  • runtime/CMakeLists.txt builds libweavec_rt.a and libweavec_alloc.a into the build tree’s lib/weavec, position-independent, never as LTO bitcode, and always with -O2 and without the allocation builtins, whatever the build type. With WEAVEC_BUILD_TESTS it also builds weavec_rt_test, which test/CMakeLists.txt registers as the CTest runtime.
  • A CMake package config (find_package(WeaveC)) exports weavec::Core and weavec::Frontend to external tools.