Skip to content

Commit

Permalink
[libcxx] Add a CI configuration for standalone building in llvm-proje…
Browse files Browse the repository at this point in the history
…ct/runtimes

Generate the llvm-lit script in runtimes/CmakeFiles.txt unless invoked
from llvm/runtimes.

Differential Revision: https://reviews.llvm.org/D109593
  • Loading branch information
mstorsjo committed Sep 29, 2021
1 parent 2240deb commit 565d455
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 0 deletions.
13 changes: 13 additions & 0 deletions libcxx/utils/ci/buildkite-pipeline.yml
Expand Up @@ -479,6 +479,19 @@ steps:
limit: 2
timeout_in_minutes: 120

- label: "New standalone runtimes build"
command: "libcxx/utils/ci/run-buildbot new-standalone"
artifact_paths:
- "**/test-results.xml"
agents:
queue: "libcxx-builders"
os: "linux"
retry:
automatic:
- exit_status: -1 # Agent was lost
limit: 2
timeout_in_minutes: 120

- label: "Runtimes build"
command: "libcxx/utils/ci/run-buildbot runtimes-build"
artifact_paths:
Expand Down
16 changes: 16 additions & 0 deletions libcxx/utils/ci/run-buildbot
Expand Up @@ -430,6 +430,22 @@ unified-standalone)

check-cxx-cxxabi
;;
new-standalone)

clean

echo "--- Generating CMake"
${CMAKE} \
-S "${MONOREPO_ROOT}/runtimes" \
-B "${BUILD_DIR}" \
-GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
-DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \
-DLIBCXX_TEST_CONFIG="${MONOREPO_ROOT}/libcxx/test/configs/libcxx-trunk-shared.cfg.in"

check-cxx-cxxabi
;;
runtimes-build)
clean

Expand Down
5 changes: 5 additions & 0 deletions llvm/runtimes/CMakeLists.txt
Expand Up @@ -13,6 +13,7 @@ set(LLVM_ENABLE_RUNTIMES "" CACHE STRING
if(LLVM_ENABLE_RUNTIMES STREQUAL "all" )
set(LLVM_ENABLE_RUNTIMES ${LLVM_ALL_RUNTIMES})
endif()
set(COMMON_CMAKE_ARGS "-DHAVE_LLVM_LIT=ON")
foreach(proj ${LLVM_ENABLE_RUNTIMES})
set(proj_dir "${CMAKE_CURRENT_SOURCE_DIR}/../../${proj}")
if(IS_DIRECTORY ${proj_dir} AND EXISTS ${proj_dir}/CMakeLists.txt)
Expand Down Expand Up @@ -87,6 +88,7 @@ function(builtin_default_target compiler_rt_path)
-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=${LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default}
-DCMAKE_C_COMPILER_WORKS=ON
-DCMAKE_ASM_COMPILER_WORKS=ON
${COMMON_CMAKE_ARGS}
${BUILTINS_CMAKE_ARGS}
PASSTHROUGH_PREFIXES COMPILER_RT
USE_TOOLCHAIN
Expand Down Expand Up @@ -119,6 +121,7 @@ function(builtin_register_target compiler_rt_path target)
-DCMAKE_C_COMPILER_WORKS=ON
-DCMAKE_ASM_COMPILER_WORKS=ON
-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON
${COMMON_CMAKE_ARGS}
${${target}_extra_args}
USE_TOOLCHAIN
TARGET_TRIPLE ${target}
Expand Down Expand Up @@ -236,6 +239,7 @@ function(runtime_default_target)
-DCMAKE_C_COMPILER_WORKS=ON
-DCMAKE_CXX_COMPILER_WORKS=ON
-DCMAKE_ASM_COMPILER_WORKS=ON
${COMMON_CMAKE_ARGS}
${RUNTIMES_CMAKE_ARGS}
PASSTHROUGH_PREFIXES LLVM_ENABLE_RUNTIMES
${ARG_PREFIXES}
Expand Down Expand Up @@ -338,6 +342,7 @@ function(runtime_register_target name target)
-DCMAKE_ASM_COMPILER_WORKS=ON
-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON
-DLLVM_RUNTIMES_TARGET=${name}
${COMMON_CMAKE_ARGS}
${${name}_extra_args}
EXTRA_TARGETS ${${name}_extra_targets}
${${name}_test_targets}
Expand Down
10 changes: 10 additions & 0 deletions runtimes/CMakeLists.txt
Expand Up @@ -116,6 +116,8 @@ if (NOT LLVM_DEFAULT_TARGET_TRIPLE)
get_host_triple(LLVM_DEFAULT_TARGET_TRIPLE)
endif()

option(LLVM_INCLUDE_TESTS "Generate build targets for the runtimes unit tests." ON)

# Use libtool instead of ar if you are both on an Apple host, and targeting Apple.
if(CMAKE_HOST_APPLE AND APPLE)
include(UseLibtool)
Expand Down Expand Up @@ -184,6 +186,14 @@ if(LLVM_INCLUDE_TESTS)
ARGS ${RUNTIMES_LIT_EXTRA_ARGS}
)
add_custom_target(runtimes-test-depends DEPENDS ${RUNTIMES_LIT_DEPENDS})

if (NOT HAVE_LLVM_LIT)
# If built by manually invoking cmake on this directory, we don't have
# llvm-lit. If invoked via llvm/runtimes, the toplevel llvm cmake
# invocation already generated the llvm-lit script.
add_subdirectory(${LLVM_MAIN_SRC_DIR}/utils/llvm-lit
${CMAKE_CURRENT_BINARY_DIR}/llvm-lit)
endif()
endif()

get_property(SUB_COMPONENTS GLOBAL PROPERTY SUB_COMPONENTS)
Expand Down

0 comments on commit 565d455

Please sign in to comment.