Mercurial > hg > CbC > CbC_llvm
annotate projects/compiler-rt/cmake/base-config-ix.cmake @ 225:f7655407a6ba
remove unnecessary files
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 19 Jul 2021 03:48:36 +0900 |
parents | f476a9ba4795 |
children |
rev | line source |
---|---|
131
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
1 # The CompilerRT build system requires CMake version 2.8.8 or higher in order |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
2 # to use its support for building convenience "libraries" as a collection of |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
3 # .o files. This is particularly useful in producing larger, more complex |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
4 # runtime libraries. |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
5 |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
6 include(CheckIncludeFile) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
7 include(CheckCXXSourceCompiles) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
8 |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
9 check_include_file(unwind.h HAVE_UNWIND_H) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
10 |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
11 # Top level target used to build all compiler-rt libraries. |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
12 add_custom_target(compiler-rt ALL) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
13 add_custom_target(install-compiler-rt) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
14 add_custom_target(install-compiler-rt-stripped) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
15 set_target_properties(compiler-rt PROPERTIES FOLDER "Compiler-RT Misc") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
16 |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
17 # Setting these variables from an LLVM build is sufficient that compiler-rt can |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
18 # construct the output paths, so it can behave as if it were in-tree here. |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
19 if (LLVM_LIBRARY_OUTPUT_INTDIR AND LLVM_RUNTIME_OUTPUT_INTDIR AND PACKAGE_VERSION) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
20 set(LLVM_TREE_AVAILABLE On) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
21 endif() |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
22 |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
23 if (LLVM_TREE_AVAILABLE) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
24 # Compute the Clang version from the LLVM version. |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
25 # FIXME: We should be able to reuse CLANG_VERSION variable calculated |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
26 # in Clang cmake files, instead of copying the rules here. |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
27 string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
28 ${PACKAGE_VERSION}) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
29 # Setup the paths where compiler-rt runtimes and headers should be stored. |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
30 set(COMPILER_RT_OUTPUT_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
31 set(COMPILER_RT_EXEC_OUTPUT_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR}) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
32 set(COMPILER_RT_INSTALL_PATH lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
33 option(COMPILER_RT_INCLUDE_TESTS "Generate and build compiler-rt unit tests." |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
34 ${LLVM_INCLUDE_TESTS}) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
35 option(COMPILER_RT_ENABLE_WERROR "Fail and stop if warning is triggered" |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
36 ${LLVM_ENABLE_WERROR}) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
37 # Use just-built Clang to compile/link tests on all platforms, except for |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
38 # Windows where we need to use clang-cl instead. |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
39 if(NOT MSVC) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
40 set(COMPILER_RT_TEST_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
41 set(COMPILER_RT_TEST_CXX_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
42 else() |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
43 set(COMPILER_RT_TEST_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang.exe) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
44 set(COMPILER_RT_TEST_CXX_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++.exe) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
45 endif() |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
46 else() |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
47 # Take output dir and install path from the user. |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
48 set(COMPILER_RT_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
49 "Path where built compiler-rt libraries should be stored.") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
50 set(COMPILER_RT_EXEC_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/bin CACHE PATH |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
51 "Path where built compiler-rt executables should be stored.") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
52 set(COMPILER_RT_INSTALL_PATH ${CMAKE_INSTALL_PREFIX} CACHE PATH |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
53 "Path where built compiler-rt libraries should be installed.") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
54 option(COMPILER_RT_INCLUDE_TESTS "Generate and build compiler-rt unit tests." OFF) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
55 option(COMPILER_RT_ENABLE_WERROR "Fail and stop if warning is triggered" OFF) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
56 # Use a host compiler to compile/link tests. |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
57 set(COMPILER_RT_TEST_COMPILER ${CMAKE_C_COMPILER} CACHE PATH "Compiler to use for testing") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
58 set(COMPILER_RT_TEST_CXX_COMPILER ${CMAKE_CXX_COMPILER} CACHE PATH "C++ Compiler to use for testing") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
59 endif() |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
60 |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
61 if("${COMPILER_RT_TEST_COMPILER}" MATCHES "clang[+]*$") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
62 set(COMPILER_RT_TEST_COMPILER_ID Clang) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
63 elseif("${COMPILER_RT_TEST_COMPILER}" MATCHES "clang.*.exe$") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
64 set(COMPILER_RT_TEST_COMPILER_ID Clang) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
65 else() |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
66 set(COMPILER_RT_TEST_COMPILER_ID GNU) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
67 endif() |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
68 |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
69 if(NOT DEFINED COMPILER_RT_OS_DIR) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
70 string(TOLOWER ${CMAKE_SYSTEM_NAME} COMPILER_RT_OS_DIR) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
71 endif() |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
72 set(COMPILER_RT_LIBRARY_OUTPUT_DIR |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
73 ${COMPILER_RT_OUTPUT_DIR}/lib/${COMPILER_RT_OS_DIR}) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
74 set(COMPILER_RT_LIBRARY_INSTALL_DIR |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
75 ${COMPILER_RT_INSTALL_PATH}/lib/${COMPILER_RT_OS_DIR}) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
76 |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
77 if(APPLE) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
78 # On Darwin if /usr/include doesn't exist, the user probably has Xcode but not |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
79 # the command line tools. If this is the case, we need to find the OS X |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
80 # sysroot to pass to clang. |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
81 if(NOT EXISTS /usr/include) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
82 execute_process(COMMAND xcodebuild -version -sdk macosx Path |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
83 OUTPUT_VARIABLE OSX_SYSROOT |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
84 ERROR_QUIET |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
85 OUTPUT_STRIP_TRAILING_WHITESPACE) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
86 set(OSX_SYSROOT_FLAG "-isysroot${OSX_SYSROOT}") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
87 endif() |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
88 |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
89 option(COMPILER_RT_ENABLE_IOS "Enable building for iOS" On) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
90 option(COMPILER_RT_ENABLE_WATCHOS "Enable building for watchOS - Experimental" Off) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
91 option(COMPILER_RT_ENABLE_TVOS "Enable building for tvOS - Experimental" Off) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
92 |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
93 else() |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
94 option(COMPILER_RT_DEFAULT_TARGET_ONLY "Build builtins only for the default target" Off) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
95 endif() |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
96 |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
97 if(WIN32 AND NOT MINGW AND NOT CYGWIN) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
98 set(CMAKE_SHARED_LIBRARY_PREFIX_C "") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
99 set(CMAKE_SHARED_LIBRARY_PREFIX_CXX "") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
100 set(CMAKE_STATIC_LIBRARY_PREFIX_C "") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
101 set(CMAKE_STATIC_LIBRARY_PREFIX_CXX "") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
102 set(CMAKE_STATIC_LIBRARY_SUFFIX_C ".lib") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
103 set(CMAKE_STATIC_LIBRARY_SUFFIX_CXX ".lib") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
104 endif() |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
105 |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
106 macro(test_targets) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
107 # Find and run MSVC (not clang-cl) and get its version. This will tell clang-cl |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
108 # what version of MSVC to pretend to be so that the STL works. |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
109 set(MSVC_VERSION_FLAG "") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
110 if (MSVC) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
111 # Find and run MSVC (not clang-cl) and get its version. This will tell |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
112 # clang-cl what version of MSVC to pretend to be so that the STL works. |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
113 execute_process(COMMAND "$ENV{VSINSTALLDIR}/VC/bin/cl.exe" |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
114 OUTPUT_QUIET |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
115 ERROR_VARIABLE MSVC_COMPAT_VERSION |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
116 ) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
117 string(REGEX REPLACE "^.*Compiler Version ([0-9.]+) for .*$" "\\1" |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
118 MSVC_COMPAT_VERSION "${MSVC_COMPAT_VERSION}") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
119 if (MSVC_COMPAT_VERSION MATCHES "^[0-9].+$") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
120 set(MSVC_VERSION_FLAG "-fms-compatibility-version=${MSVC_COMPAT_VERSION}") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
121 # Add this flag into the host build if this is clang-cl. |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
122 if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
123 append("${MSVC_VERSION_FLAG}" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
124 elseif (COMPILER_RT_TEST_COMPILER_ID MATCHES "Clang") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
125 # Add this flag to test compiles to suppress clang's auto-detection |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
126 # logic. |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
127 append("${MSVC_VERSION_FLAG}" COMPILER_RT_TEST_COMPILER_CFLAGS) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
128 endif() |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
129 endif() |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
130 endif() |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
131 |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
132 # Generate the COMPILER_RT_SUPPORTED_ARCH list. |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
133 if(ANDROID) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
134 # Examine compiler output to determine target architecture. |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
135 detect_target_arch() |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
136 set(COMPILER_RT_OS_SUFFIX "-android") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
137 elseif(NOT APPLE) # Supported archs for Apple platforms are generated later |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
138 if(COMPILER_RT_DEFAULT_TARGET_ONLY) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
139 add_default_target_arch(${COMPILER_RT_DEFAULT_TARGET_ARCH}) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
140 elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "i[2-6]86|x86|amd64") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
141 if(NOT MSVC) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
142 test_target_arch(x86_64 "" "-m64") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
143 test_target_arch(i386 __i386__ "-m32") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
144 else() |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
145 if (CMAKE_SIZEOF_VOID_P EQUAL 4) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
146 test_target_arch(i386 "" "") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
147 else() |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
148 test_target_arch(x86_64 "" "") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
149 endif() |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
150 endif() |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
151 elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "powerpc") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
152 # Strip out -nodefaultlibs when calling TEST_BIG_ENDIAN. Configuration |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
153 # will fail with this option when building with a sanitizer. |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
154 cmake_push_check_state() |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
155 string(REPLACE "-nodefaultlibs" "" CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
156 TEST_BIG_ENDIAN(HOST_IS_BIG_ENDIAN) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
157 cmake_pop_check_state() |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
158 |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
159 if(HOST_IS_BIG_ENDIAN) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
160 test_target_arch(powerpc64 "" "-m64") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
161 else() |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
162 test_target_arch(powerpc64le "" "-m64") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
163 endif() |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
164 elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "s390x") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
165 test_target_arch(s390x "" "") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
166 elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "mipsel|mips64el") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
167 # Gcc doesn't accept -m32/-m64 so we do the next best thing and use |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
168 # -mips32r2/-mips64r2. We don't use -mips1/-mips3 because we want to match |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
169 # clang's default CPU's. In the 64-bit case, we must also specify the ABI |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
170 # since the default ABI differs between gcc and clang. |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
171 # FIXME: Ideally, we would build the N32 library too. |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
172 test_target_arch(mipsel "" "-mips32r2" "--target=mipsel-linux-gnu") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
173 test_target_arch(mips64el "" "-mips64r2" "--target=mips64el-linux-gnu" "-mabi=64") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
174 elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "mips") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
175 test_target_arch(mips "" "-mips32r2" "--target=mips-linux-gnu") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
176 test_target_arch(mips64 "" "-mips64r2" "--target=mips64-linux-gnu" "-mabi=64") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
177 elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "arm") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
178 if(WIN32) |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
179 test_target_arch(arm "" "" "") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
180 else() |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
181 test_target_arch(arm "" "-march=armv7-a" "-mfloat-abi=soft") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
182 test_target_arch(armhf "" "-march=armv7-a" "-mfloat-abi=hard") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
183 test_target_arch(armv6m "" "-march=armv6m" "-mfloat-abi=soft") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
184 endif() |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
185 elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "aarch32") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
186 test_target_arch(aarch32 "" "-march=armv8-a") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
187 elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "aarch64") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
188 test_target_arch(aarch64 "" "-march=armv8-a") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
189 elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "wasm32") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
190 test_target_arch(wasm32 "" "--target=wasm32-unknown-unknown") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
191 elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "wasm64") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
192 test_target_arch(wasm64 "" "--target=wasm64-unknown-unknown") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
193 endif() |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
194 set(COMPILER_RT_OS_SUFFIX "") |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
195 endif() |
f476a9ba4795
http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff
changeset
|
196 endmacro() |