diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2016-08-17 19:35:22 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2016-08-17 19:35:22 +0000 |
commit | b5f99338f6073aeb6e393caea8ac1148af69bf2c (patch) | |
tree | 73503b1588d85bf45474c2d732c7c96a5d350647 /cmake | |
parent | 6f08730ec5f639f05f2f15354171e4a3c9af9dc1 (diff) | |
download | src-b5f99338f6073aeb6e393caea8ac1148af69bf2c.tar.gz src-b5f99338f6073aeb6e393caea8ac1148af69bf2c.zip |
Vendor import of compiler-rt release_39 branch r278877:vendor/compiler-rt/compiler-rt-release_39-r278877
Notes
Notes:
svn path=/vendor/compiler-rt/dist/; revision=304302
svn path=/vendor/compiler-rt/compiler-rt-release_39-r278877/; revision=304303; tag=vendor/compiler-rt/compiler-rt-release_39-r278877
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/Modules/BuiltinTests.cmake | 23 | ||||
-rw-r--r-- | cmake/builtin-config-ix.cmake | 10 |
2 files changed, 30 insertions, 3 deletions
diff --git a/cmake/Modules/BuiltinTests.cmake b/cmake/Modules/BuiltinTests.cmake index 1b03e94acf12..a229145d9b91 100644 --- a/cmake/Modules/BuiltinTests.cmake +++ b/cmake/Modules/BuiltinTests.cmake @@ -2,11 +2,15 @@ # This function takes an OS and a list of architectures and identifies the # subset of the architectures list that the installed toolchain can target. function(try_compile_only output) + cmake_parse_arguments(ARG "" "" "SOURCE;FLAGS" ${ARGN}) + if(NOT ARG_SOURCE) + set(ARG_SOURCE "int foo(int x, int y) { return x + y; }\n") + endif() set(SIMPLE_C ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/src.c) - file(WRITE ${SIMPLE_C} "int foo(int x, int y) { return x + y; }\n") + file(WRITE ${SIMPLE_C} "${ARG_SOURCE}\n") string(REGEX MATCHALL "<[A-Za-z0-9_]*>" substitutions ${CMAKE_C_COMPILE_OBJECT}) - string(REPLACE ";" " " extra_flags "${ARGN}") + string(REPLACE ";" " " extra_flags "${ARG_FLAGS}") set(test_compile_command "${CMAKE_C_COMPILE_OBJECT}") foreach(substitution ${substitutions}) @@ -51,7 +55,20 @@ endfunction() function(builtin_check_c_compiler_flag flag output) if(NOT DEFINED ${output}) message(STATUS "Performing Test ${output}") - try_compile_only(result ${flag}) + try_compile_only(result FLAGS ${flag}) + set(${output} ${result} CACHE INTERNAL "Compiler supports ${flag}") + if(${result}) + message(STATUS "Performing Test ${output} - Success") + else() + message(STATUS "Performing Test ${output} - Failed") + endif() + endif() +endfunction() + +function(builtin_check_c_compiler_source output source) + if(NOT DEFINED ${output}) + message(STATUS "Performing Test ${output}") + try_compile_only(result SOURCE ${source}) set(${output} ${result} CACHE INTERNAL "Compiler supports ${flag}") if(${result}) message(STATUS "Performing Test ${output} - Success") diff --git a/cmake/builtin-config-ix.cmake b/cmake/builtin-config-ix.cmake index 432b1fadb177..83466d81bd2f 100644 --- a/cmake/builtin-config-ix.cmake +++ b/cmake/builtin-config-ix.cmake @@ -1,4 +1,5 @@ include(BuiltinTests) +include(CheckCSourceCompiles) # Make all the tests only check the compiler set(TEST_COMPILE_ONLY On) @@ -14,6 +15,15 @@ builtin_check_c_compiler_flag(-mfloat-abi=soft COMPILER_RT_HAS_FLOAT_ABI_SO builtin_check_c_compiler_flag(-mfloat-abi=hard COMPILER_RT_HAS_FLOAT_ABI_HARD_FLAG) builtin_check_c_compiler_flag(-static COMPILER_RT_HAS_STATIC_FLAG) +builtin_check_c_compiler_source(COMPILER_RT_SUPPORTS_ATOMIC_KEYWORD +" +int foo(int x, int y) { + _Atomic int result = x * y; + return result; +} +") + + set(ARM64 aarch64) set(ARM32 arm armhf) set(X86 i386 i686) |