Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions arm-software/embedded/arm-multilib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ set(ENABLE_VARIANTS "all" CACHE STRING "Semicolon separated list of variants to
set(C_LIBRARY "picolibc" CACHE STRING "Which C library to use.")
set_property(CACHE C_LIBRARY PROPERTY STRINGS picolibc newlib newlib-nano llvmlibc)
set(PROJECT_PREFIX "${CMAKE_BINARY_DIR}/lib-builds" CACHE STRING "Directory to build subprojects in.")
set(LLVM_LIBC_TEST_SYSROOT "${PROJECT_PREFIX}/test-sysroot" CACHE PATH "Build-tree package-style sysroot for LLVM libc tests.")
option(
NUMERICAL_BUILD_NAMES
"Instead of using the full variant name to label build directories, use an index number. This may help shorten paths."
Expand Down Expand Up @@ -121,6 +122,24 @@ add_dependencies(
check-unwind
)

if(C_LIBRARY STREQUAL llvmlibc)
if(ENABLE_MULTILIB_HEADER_OPTIMISATION)
set(LLVM_LIBC_TEST_SYSROOT_SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/multilib-optimised")
else()
set(LLVM_LIBC_TEST_SYSROOT_SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/multilib")
endif()
list(APPEND passthrough_dirs "-DLLVM_LIBC_TEST_SYSROOT=${LLVM_LIBC_TEST_SYSROOT}")
add_custom_target(
llvmlibc-test-sysroot
COMMAND ${CMAKE_COMMAND} -E rm -rf "${LLVM_LIBC_TEST_SYSROOT}"
COMMAND ${CMAKE_COMMAND} -E make_directory "${LLVM_LIBC_TEST_SYSROOT}"
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${LLVM_LIBC_TEST_SYSROOT_SOURCE_DIR}"
"${LLVM_LIBC_TEST_SYSROOT}"
COMMENT "Generating llvm-libc test sysroot"
)
endif()

if(ENABLE_PARALLEL_LIB_CONFIG OR ENABLE_PARALLEL_LIB_BUILD)
# Additional targets to build the variant subprojects in parallel.
# The build steps can use multible jobs to compile in parallel, but
Expand Down Expand Up @@ -247,6 +266,7 @@ foreach(lib_idx RANGE ${lib_count_dec})
${passthrough_dirs}
${additional_cmake_args}
-DVARIANT_JSON=${variant_json_file}
-DVARIANT_MULTILIB_FLAGS=${variant_multilib_flags}
-DC_LIBRARY=${C_LIBRARY}
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
-DPROJECT_PREFIX=${PROJECT_PREFIX}
Expand Down Expand Up @@ -334,6 +354,13 @@ foreach(lib_idx RANGE ${lib_count_dec})
${check_target}
runtimes-${variant}-build
)
if(C_LIBRARY STREQUAL llvmlibc AND check_target STREQUAL check-llvmlibc)
ExternalProject_Add_StepDependencies(
runtimes-${variant}
${check_target}
llvmlibc-test-sysroot
)
endif()
add_custom_target(${check_target}-${variant})
add_dependencies(${check_target} runtimes-${variant}-${check_target})
add_dependencies(${check_target}-${variant} runtimes-${variant}-${check_target})
Expand Down Expand Up @@ -432,3 +459,11 @@ if(ENABLE_MULTILIB_HEADER_OPTIMISATION)
DESTINATION .
)
endif()

if(C_LIBRARY STREQUAL llvmlibc)
if(ENABLE_MULTILIB_HEADER_OPTIMISATION)
add_dependencies(llvmlibc-test-sysroot generate-multilib-common-headers)
else()
add_dependencies(llvmlibc-test-sysroot ${all_runtime_targets} multilib-yaml)
endif()
endif()
15 changes: 15 additions & 0 deletions arm-software/embedded/arm-runtimes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ endif()
set(TARGET_ARCH ${TARGET_ARCH_def} CACHE STRING "Architecture being targetted.")
set(VARIANT ${VARIANT_def} CACHE STRING "Name for the variant, usually architecture + suffix.")
set(COMPILE_FLAGS ${COMPILE_FLAGS_def} CACHE STRING "Flags required to build the variant.")
set(VARIANT_MULTILIB_FLAGS "" CACHE STRING "Flags that select this variant in multilib.yaml.")
set(TEST_EXECUTOR ${TEST_EXECUTOR_def} CACHE STRING "Program used to run tests.")
set_property(CACHE TEST_EXECUTOR PROPERTY STRINGS fvp qemu)
set(FVP_MODEL ${FVP_MODEL_def} CACHE STRING "FVP model to use, if FVP is the test executor.")
Expand Down Expand Up @@ -100,6 +101,7 @@ set(ENABLE_LIBC_TESTS ${ENABLE_LIBC_TESTS_def} CACHE BOOL "Enable libc tests (pi
set(ENABLE_COMPILER_RT_TESTS ${ENABLE_COMPILER_RT_TESTS_def} CACHE BOOL "Enable compiler-rt tests.")
set(ENABLE_LIBCXX_TESTS ${ENABLE_LIBCXX_TESTS_def} CACHE BOOL "Enable libcxx tests.")
set(LLVM_BINARY_DIR "" CACHE PATH "Path to LLVM toolchain root to build libraries with")
set(LLVM_LIBC_TEST_SYSROOT "" CACHE PATH "Build-tree package-style sysroot for LLVM libc tests.")
option(LLVM_USE_RELATIVE_PATHS_IN_MACROS "Use relative paths in macro expansions" ON)

set(PROJECT_PREFIX "subproj" CACHE STRING "Directory to build subprojects in.")
Expand Down Expand Up @@ -798,6 +800,18 @@ if(C_LIBRARY STREQUAL llvmlibc)
-T
llvmlibc.ld
)
set(llvmlibc_test_compile_options "")
if(LLVM_LIBC_TEST_SYSROOT)
set(llvmlibc_test_sysroot "--sysroot=${LLVM_LIBC_TEST_SYSROOT}")
list(APPEND llvmlibc_test_compile_options ${llvmlibc_test_sysroot})
list(APPEND llvmlibc_test_link_options ${llvmlibc_test_sysroot})
endif()
if(VARIANT_MULTILIB_FLAGS)
separate_arguments(llvmlibc_test_multilib_flags NATIVE_COMMAND ${VARIANT_MULTILIB_FLAGS})
list(APPEND llvmlibc_test_compile_options ${llvmlibc_test_multilib_flags})
list(APPEND llvmlibc_test_link_options ${llvmlibc_test_multilib_flags})
endif()
list(JOIN llvmlibc_test_compile_options "," llvmlibc_test_compile_options_default)
if(NOT target_supports_lock_free_atomics)
list(APPEND llvmlibc_test_link_options -latomic-fallback)
endif()
Expand Down Expand Up @@ -882,6 +896,7 @@ if(C_LIBRARY STREQUAL llvmlibc)
-DLLVM_ENABLE_RUNTIMES=libc
-DLLVM_LIBC_ALL_HEADERS=ON
-DLLVM_LIBC_FULL_BUILD=ON
-DLIBC_TEST_COMPILE_OPTIONS_DEFAULT=${llvmlibc_test_compile_options_default}
-DLIBC_TEST_LINK_OPTIONS_DEFAULT=${llvmlibc_test_link_options_default}
-DLIBC_TEST_CMD=${test_cmd}
-DLIBC_TEST_HERMETIC_ONLY=ON
Expand Down