diff --git a/projects/eudsl-llvmpy/CMakeLists.txt b/projects/eudsl-llvmpy/CMakeLists.txt index b6ba28f7e..ae28f4dd3 100644 --- a/projects/eudsl-llvmpy/CMakeLists.txt +++ b/projects/eudsl-llvmpy/CMakeLists.txt @@ -41,7 +41,8 @@ add_definitions(${LLVM_DEFINITIONS}) # C++ source coverage (llvm-cov). When ON, the extension is built with # instrumentation; scripts/cpp_coverage.sh runs the test suite (which imports # the .so) under LLVM_PROFILE_FILE, merges the profraw, and enforces a -# src/IR + src/MIR line-coverage threshold via scripts/check_coverage.py. +# src/IR + src/MIR line-coverage threshold via the repo-root +# scripts/check_coverage.py. option(EUDSL_LLVMPY_ENABLE_COVERAGE "Instrument eudslllvm_ext for llvm-cov" OFF) if(EUDSL_LLVMPY_ENABLE_COVERAGE) message(STATUS "EUDSL_LLVMPY: C++ coverage instrumentation enabled") diff --git a/projects/eudsl-llvmpy/README.md b/projects/eudsl-llvmpy/README.md index 26827b433..8ae10702d 100644 --- a/projects/eudsl-llvmpy/README.md +++ b/projects/eudsl-llvmpy/README.md @@ -268,7 +268,7 @@ Python coverage is gated in `pyproject.toml` (`--cov=llvm`, branch coverage, fail under 99%). C++ coverage runs through `scripts/cpp_coverage.sh`, which builds the extension instrumented, runs the suite under `LLVM_PROFILE_FILE`, merges the profile, and enforces a `src/IR` line-coverage threshold with -`scripts/check_coverage.py`: +the repo-root `scripts/check_coverage.py` (shared with other projects): ```bash COVERAGE_THRESHOLD=100 bash scripts/cpp_coverage.sh diff --git a/projects/eudsl-llvmpy/scripts/cpp_coverage.sh b/projects/eudsl-llvmpy/scripts/cpp_coverage.sh index 64b5fbb17..36a68cd5a 100755 --- a/projects/eudsl-llvmpy/scripts/cpp_coverage.sh +++ b/projects/eudsl-llvmpy/scripts/cpp_coverage.sh @@ -67,7 +67,7 @@ if [[ -z "$SO" || ! -f "$SO" ]]; then fi echo ">> checking src/IR + src/MIR coverage (threshold=${THRESHOLD}%)" -"$PY" "${PROJ_DIR}/scripts/check_coverage.py" \ +"$PY" "${PROJ_DIR}/../../scripts/check_coverage.py" \ --llvm-cov "$LLVM_COV" \ --profdata "${COV_DIR}/eudslllvm.profdata" \ --objects "$SO" \ diff --git a/projects/eudsl-llvmpy/scripts/check_coverage.py b/scripts/check_coverage.py similarity index 100% rename from projects/eudsl-llvmpy/scripts/check_coverage.py rename to scripts/check_coverage.py diff --git a/scripts/cmake/llvm_cache.cmake b/scripts/cmake/llvm_cache.cmake index 45b018a77..15ff57761 100644 --- a/scripts/cmake/llvm_cache.cmake +++ b/scripts/cmake/llvm_cache.cmake @@ -9,6 +9,21 @@ include(CMakePrintHelpers) set(LLVM_ENABLE_PROJECTS "llvm;mlir;clang" CACHE STRING "") +if (NOT WIN32) + # compiler-rt builtins only (built by the separate `builtins` sub-build); + # every compiler-rt runtime is off. + set(LLVM_ENABLE_RUNTIMES "compiler-rt" CACHE STRING "") + set(COMPILER_RT_BUILD_BUILTINS ON CACHE BOOL "") + foreach(_crt SANITIZERS XRAY LIBFUZZER PROFILE MEMPROF CTX_PROFILE ORC GWP_ASAN) + set(COMPILER_RT_BUILD_${_crt} OFF CACHE BOOL "") + endforeach() + set(COMPILER_RT_INCLUDE_TESTS OFF CACHE BOOL "") + # macOS only; avoids needing iOS/watchOS/tvOS/visionOS SDKs. + foreach(_os IOS WATCHOS TVOS XROS) + set(COMPILER_RT_ENABLE_${_os} OFF CACHE BOOL "") + endforeach() +endif() + # LLVM options set(LLVM_BUILD_TOOLS ON CACHE BOOL "") @@ -63,6 +78,7 @@ set(LLVM_ENABLE_CRASH_OVERRIDES OFF CACHE BOOL "") set(LLVM_ENABLE_Z3_SOLVER OFF CACHE BOOL "") set(LLVM_ENABLE_ZLIB OFF CACHE BOOL "") set(LLVM_ENABLE_ZSTD OFF CACHE BOOL "") +set(LLVM_ENABLE_LZMA OFF CACHE BOOL "") set(LLVM_INCLUDE_BENCHMARKS OFF CACHE BOOL "") set(LLVM_INCLUDE_DOCS OFF CACHE BOOL "") set(LLVM_INCLUDE_EXAMPLES OFF CACHE BOOL "") @@ -81,9 +97,10 @@ set(MLIR_INCLUDE_TESTS ${RUN_TESTS} CACHE BOOL "") set(LLVM_INSTALL_TOOLCHAIN_ONLY OFF CACHE BOOL "") set(LLVM_DISTRIBUTIONS MlirDevelopment CACHE STRING "") -set(LLVM_MlirDevelopment_DISTRIBUTION_COMPONENTS +set(_mlir_dev_components clang-libraries clang-headers + clang-resource-headers # triggers ClangConfig.cmake and etc clang-cmake-exports # triggers ClangMlirDevelopmentTargets.cmake @@ -118,12 +135,16 @@ set(LLVM_MlirDevelopment_DISTRIBUTION_COMPONENTS mlir-reduce mlir-tblgen mlir-translate - CACHE STRING "") +) if (NOT WIN32) - list(APPEND LLVM_MlirDevelopment_DISTRIBUTION_COMPONENTS LLVM MLIR) + list(APPEND _mlir_dev_components LLVM MLIR builtins) endif() +# Only cache entries survive a -C script, so the list must be complete before +# it is cached (appending to the variable afterwards has no effect). +set(LLVM_MlirDevelopment_DISTRIBUTION_COMPONENTS ${_mlir_dev_components} CACHE STRING "") + get_cmake_property(_variableNames VARIABLES) list(SORT _variableNames) cmake_print_variables(${_variableNames})