diff options
author | Brad King <brad.king@kitware.com> | 2022-12-06 13:04:07 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2022-12-06 13:04:18 (GMT) |
commit | f1f064b7b2c93048897014e096217e1a00f668c7 (patch) | |
tree | 6cd0ff2dbc453a45105743af22556072a1231ada /.gitlab/ci | |
parent | 85d89ca88586be09e940fea938d2a2add5dd4425 (diff) | |
parent | 2c558cfd1b26e879bf6acce619255ca7b1ba0425 (diff) | |
download | CMake-f1f064b7b2c93048897014e096217e1a00f668c7.zip CMake-f1f064b7b2c93048897014e096217e1a00f668c7.tar.gz CMake-f1f064b7b2c93048897014e096217e1a00f668c7.tar.bz2 |
Merge topic 'cxx-module-map-clang'
2c558cfd1b gitlab-ci: add CI jobs for Clang with C++20 modules
abd42e9cfc ci: add a Docker container for clang support of C++20 modules
51093f3002 Clang-FindBinUtils: also find `clang-scan-deps`
0b333de923 ci: add C++ module rules file for Clang
21b9fb1e8c cmCxxModuleMapper: support the `clang` module map format
9c66224668 cmNinjaTargetGenerator: skip setting `depfile` for `none` scantypes
9123a0991f cmNinjaTargetGenerator: use `.clear()` to empty out some strings
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Cristian Adam <cristian.adam@gmail.com>
Merge-request: !7978
Diffstat (limited to '.gitlab/ci')
7 files changed, 90 insertions, 0 deletions
diff --git a/.gitlab/ci/configure_linux_clang_cxx_modules_ninja.cmake b/.gitlab/ci/configure_linux_clang_cxx_modules_ninja.cmake new file mode 100644 index 0000000..43bccdb --- /dev/null +++ b/.gitlab/ci/configure_linux_clang_cxx_modules_ninja.cmake @@ -0,0 +1,4 @@ +set(CMake_TEST_MODULE_COMPILATION "named,partitions,internal_partitions,export_bmi,install_bmi,shared" CACHE STRING "") +set(CMake_TEST_MODULE_COMPILATION_RULES "${CMAKE_CURRENT_LIST_DIR}/cxx_modules_rules_clang.cmake" CACHE STRING "") + +include("${CMAKE_CURRENT_LIST_DIR}/configure_external_test.cmake") diff --git a/.gitlab/ci/configure_linux_clang_cxx_modules_ninja_multi.cmake b/.gitlab/ci/configure_linux_clang_cxx_modules_ninja_multi.cmake new file mode 100644 index 0000000..43bccdb --- /dev/null +++ b/.gitlab/ci/configure_linux_clang_cxx_modules_ninja_multi.cmake @@ -0,0 +1,4 @@ +set(CMake_TEST_MODULE_COMPILATION "named,partitions,internal_partitions,export_bmi,install_bmi,shared" CACHE STRING "") +set(CMake_TEST_MODULE_COMPILATION_RULES "${CMAKE_CURRENT_LIST_DIR}/cxx_modules_rules_clang.cmake" CACHE STRING "") + +include("${CMAKE_CURRENT_LIST_DIR}/configure_external_test.cmake") diff --git a/.gitlab/ci/cxx_modules_rules_clang.cmake b/.gitlab/ci/cxx_modules_rules_clang.cmake new file mode 100644 index 0000000..9d75880 --- /dev/null +++ b/.gitlab/ci/cxx_modules_rules_clang.cmake @@ -0,0 +1,16 @@ +set(CMake_TEST_CXXModules_UUID "a246741c-d067-4019-a8fb-3d16b0c9d1d3") + +set(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP 1) +string(CONCAT CMAKE_EXPERIMENTAL_CXX_SCANDEP_SOURCE + "${CMAKE_CXX_COMPILER_CLANG_SCAN_DEPS}" + " -format=p1689 --p1689-targeted-file-name=<SOURCE> --p1689-targeted-output=<OBJECT> --" + " <DEFINES> <INCLUDES> <FLAGS> -x c++ <SOURCE>" + " > <DYNDEP_FILE>") +# No support for `-MF` discovered dependencies in `clang-scan-deps`. +set(CMAKE_EXPERIMENTAL_CXX_SCANDEP_DEPFILE_FORMAT "none") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_MAP_FORMAT "clang") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_MAP_FLAG "@<MODULE_MAP_FILE>") + +# Default to C++ extensions being off. Clang's modules support have trouble +# with extensions right now. +set(CMAKE_CXX_EXTENSIONS OFF) diff --git a/.gitlab/ci/docker/clang_cxx_modules/Dockerfile b/.gitlab/ci/docker/clang_cxx_modules/Dockerfile new file mode 100644 index 0000000..4e58125 --- /dev/null +++ b/.gitlab/ci/docker/clang_cxx_modules/Dockerfile @@ -0,0 +1,13 @@ +FROM fedora:37 +MAINTAINER Ben Boeckel <ben.boeckel@kitware.com> + +# Install build dependencies for packages. +COPY install_deps.sh /root/install_deps.sh +RUN sh /root/install_deps.sh + +COPY install_llvm.sh /root/install_llvm.sh +RUN sh /root/install_llvm.sh + +# Install build dependencies for CMake's CI. +COPY install_cmake_deps.sh /root/install_cmake_deps.sh +RUN sh /root/install_cmake_deps.sh diff --git a/.gitlab/ci/docker/clang_cxx_modules/install_cmake_deps.sh b/.gitlab/ci/docker/clang_cxx_modules/install_cmake_deps.sh new file mode 100755 index 0000000..465e125 --- /dev/null +++ b/.gitlab/ci/docker/clang_cxx_modules/install_cmake_deps.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +set -e + +dnf install -y --setopt=install_weak_deps=False \ + file git-core +dnf clean all diff --git a/.gitlab/ci/docker/clang_cxx_modules/install_deps.sh b/.gitlab/ci/docker/clang_cxx_modules/install_deps.sh new file mode 100755 index 0000000..c1957c3 --- /dev/null +++ b/.gitlab/ci/docker/clang_cxx_modules/install_deps.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +set -e + +dnf install -y --setopt=install_weak_deps=False \ + gcc-c++ cmake ninja-build +dnf clean all diff --git a/.gitlab/ci/docker/clang_cxx_modules/install_llvm.sh b/.gitlab/ci/docker/clang_cxx_modules/install_llvm.sh new file mode 100755 index 0000000..09d0106 --- /dev/null +++ b/.gitlab/ci/docker/clang_cxx_modules/install_llvm.sh @@ -0,0 +1,39 @@ +#!/bin/sh + +set -e + +readonly revision="p1689r5-cmake-ci-20221201" # ae3b5489585b60a2b7f090ebb9e1e8729b811253 +readonly tarball="https://github.com/mathstuf/llvm-project/archive/$revision.tar.gz" + +readonly workdir="$HOME/llvm" +readonly srcdir="$workdir/llvm" +readonly builddir="$workdir/build" + +mkdir -p "$workdir" +cd "$workdir" +curl -L "$tarball" > "llvm-$revision.tar.gz" +tar xf "llvm-$revision.tar.gz" +mv "llvm-project-$revision" "$srcdir" +mkdir -p "$builddir" +cd "$builddir" +cmake -GNinja \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_SHARED_LIBS=ON \ + -DLLVM_ENABLE_BINDINGS=OFF \ + -DLLVM_INCLUDE_BENCHMARKS=OFF \ + -DLLVM_INCLUDE_DOCS=OFF \ + -DLLVM_INCLUDE_EXAMPLES=OFF \ + -DLLVM_INCLUDE_RUNTIMES=OFF \ + -DLLVM_INCLUDE_TESTS=OFF \ + -DLLVM_INCLUDE_UTILS=OFF \ + -DLLVM_TARGETS_TO_BUILD=X86 \ + -DLLVM_TOOL_CLANG_BUILD=ON \ + -DLLVM_USE_SYMLINKS=ON \ + "-DLLVM_EXTERNAL_CLANG_SOURCE_DIR=$srcdir/clang" \ + -DLLVM_PARALLEL_LINK_JOBS=1 \ + -DCLANG_BUILD_TOOLS=ON \ + "-DCMAKE_INSTALL_PREFIX=/opt/llvm-p1689" \ + "$srcdir/llvm" +ninja +ninja install/strip +rm -rf "$workdir" |