55 lines · plain
1include(BuiltinTests)2include(CheckCSourceCompiles)3 4# Make all the tests only check the compiler5set(TEST_COMPILE_ONLY On)6 7builtin_check_c_compiler_flag(-fPIC COMPILER_RT_HAS_FPIC_FLAG)8builtin_check_c_compiler_flag(-std=c11 COMPILER_RT_HAS_STD_C11_FLAG)9builtin_check_c_compiler_flag(-Wno-pedantic COMPILER_RT_HAS_WNO_PEDANTIC)10builtin_check_c_compiler_flag(-fno-lto COMPILER_RT_HAS_FNO_LTO_FLAG)11builtin_check_c_compiler_flag(-fno-profile-generate COMPILER_RT_HAS_FNO_PROFILE_GENERATE_FLAG)12builtin_check_c_compiler_flag(-fno-profile-instr-generate COMPILER_RT_HAS_FNO_PROFILE_INSTR_GENERATE_FLAG)13builtin_check_c_compiler_flag(-fno-profile-instr-use COMPILER_RT_HAS_FNO_PROFILE_INSTR_USE_FLAG)14 15if(ANDROID)16 set(OS_NAME "Android")17else()18 set(OS_NAME "${CMAKE_SYSTEM_NAME}")19endif()20 21set(ARM64 aarch64)22set(ARM32 arm armhf)23set(HEXAGON hexagon)24set(X86 i386)25set(X86_64 x86_64)26set(LOONGARCH64 loongarch64)27set(MIPS32 mips mipsel)28set(MIPS64 mips64 mips64el)29set(PPC32 powerpc powerpcspe)30set(PPC64 powerpc64 powerpc64le)31set(RISCV32 riscv32)32set(RISCV64 riscv64)33set(VE ve)34 35set(ALL_CRT_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${PPC32}36 ${PPC64} ${RISCV32} ${RISCV64} ${VE} ${HEXAGON} ${LOONGARCH64}37 ${MIPS32} ${MIPS64} ${SPARC} ${SPARCV9})38 39include(CompilerRTUtils)40 41if(NOT APPLE)42 if(COMPILER_RT_CRT_STANDALONE_BUILD)43 test_targets()44 endif()45 # Architectures supported by compiler-rt crt library.46 filter_available_targets(CRT_SUPPORTED_ARCH ${ALL_CRT_SUPPORTED_ARCH})47 message(STATUS "Supported architectures for crt: ${CRT_SUPPORTED_ARCH}")48endif()49 50if (CRT_SUPPORTED_ARCH AND OS_NAME MATCHES "Linux|SerenityOS" AND NOT LLVM_USE_SANITIZER)51 set(COMPILER_RT_HAS_CRT TRUE)52else()53 set(COMPILER_RT_HAS_CRT FALSE)54endif()55