[AMDGPU][True16][CodeGen] true16 codegen pattern for v_med3_u/i16 (#121850)
[llvm-project.git] / clang / tools / driver / CMakeLists.txt
bloba4debc2dd2e895dcf8969d25219e88d13a744c64
1 set( LLVM_LINK_COMPONENTS
2   ${LLVM_TARGETS_TO_BUILD}
3   Analysis
4   CodeGen
5   Core
6   IPO
7   AggressiveInstCombine
8   InstCombine
9   Instrumentation
10   MC
11   MCParser
12   ObjCARCOpts
13   Option
14   ScalarOpts
15   Support
16   TargetParser
17   TransformUtils
18   Vectorize
19   )
21 # Support plugins.
22 if(CLANG_PLUGIN_SUPPORT)
23   set(support_plugins SUPPORT_PLUGINS)
24 endif()
26 add_clang_tool(clang
27   driver.cpp
28   cc1_main.cpp
29   cc1as_main.cpp
30   cc1gen_reproducer_main.cpp
32   DEPENDS
33   intrinsics_gen
34   # These generated headers are included transitively.
35   ARMTargetParserTableGen
36   AArch64TargetParserTableGen
37   ${support_plugins}
38   GENERATE_DRIVER
39   )
41 setup_host_tool(clang CLANG clang_exe clang_target)
43 clang_target_link_libraries(clang
44   PRIVATE
45   clangBasic
46   clangCodeGen
47   clangDriver
48   clangFrontend
49   clangFrontendTool
50   clangSerialization
51   )
53 if(WIN32 AND NOT CYGWIN)
54   # Prevent versioning if the buildhost is targeting for Win32.
55 else()
56   set_target_properties(clang PROPERTIES VERSION ${CLANG_EXECUTABLE_VERSION})
57 endif()
59 # Support plugins.
60 if(CLANG_PLUGIN_SUPPORT)
61   export_executable_symbols_for_plugins(clang)
62 endif()
64 add_dependencies(clang clang-resource-headers)
66 if(NOT CLANG_LINKS_TO_CREATE)
67   set(CLANG_LINKS_TO_CREATE clang++ clang-cl clang-cpp)
68 endif()
70 if (CLANG_ENABLE_HLSL)
71   set(HLSL_LINK clang-dxc)
72 endif()
74 foreach(link ${CLANG_LINKS_TO_CREATE} ${HLSL_LINK})
75   add_clang_symlink(${link} clang)
76 endforeach()
78 # Configure plist creation for OS X.
79 set (TOOL_INFO_PLIST "Info.plist" CACHE STRING "Plist name")
80 if (APPLE)
81   if (CLANG_VENDOR)
82     set(TOOL_INFO_NAME "${CLANG_VENDOR} clang")
83   else()
84     set(TOOL_INFO_NAME "clang")
85   endif()
87   set(TOOL_INFO_UTI "${CLANG_VENDOR_UTI}")
88   set(TOOL_INFO_VERSION "${CLANG_VERSION}")
89   set(TOOL_INFO_BUILD_VERSION "${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}")
91   set(TOOL_INFO_PLIST_OUT "${CMAKE_CURRENT_BINARY_DIR}/${TOOL_INFO_PLIST}")
93   if(LLVM_TOOL_LLVM_DRIVER_BUILD AND clang IN_LIST LLVM_DRIVER_TOOLS)
94     set(TARGET_NAME llvm-driver)
95   else()
96     set(TARGET_NAME clang)
97   endif()
99   target_link_libraries(${TARGET_NAME}
100     PRIVATE
101     "-Wl,-sectcreate,__TEXT,__info_plist,\"${TOOL_INFO_PLIST_OUT}\"")
102   configure_file("${TOOL_INFO_PLIST}.in" "${TOOL_INFO_PLIST_OUT}" @ONLY)
104   set(TOOL_INFO_UTI)
105   set(TOOL_INFO_NAME)
106   set(TOOL_INFO_VERSION)
107   set(TOOL_INFO_BUILD_VERSION)
108 endif()
110 if(CLANG_ORDER_FILE AND
111     (LLVM_LINKER_IS_APPLE OR LLVM_LINKER_IS_GOLD OR LLVM_LINKER_IS_LLD))
112   include(CheckLinkerFlag)
114   if (LLVM_LINKER_IS_APPLE OR (LLVM_LINKER_IS_LLD AND APPLE))
115     set(LINKER_ORDER_FILE_OPTION "-Wl,-order_file,${CLANG_ORDER_FILE}")
116   elseif (LLVM_LINKER_IS_GOLD)
117     set(LINKER_ORDER_FILE_OPTION "-Wl,--section-ordering-file,${CLANG_ORDER_FILE}")
118   elseif (LLVM_LINKER_IS_LLD)
119     set(LINKER_ORDER_FILE_OPTION "-Wl,--symbol-ordering-file,${CLANG_ORDER_FILE}")
120   endif()
122   # This is a test to ensure the actual order file works with the linker.
123   check_linker_flag(CXX ${LINKER_ORDER_FILE_OPTION} LINKER_ORDER_FILE_WORKS)
125   # Passing an empty order file disables some linker layout optimizations.
126   # To work around this and enable workflows for re-linking when the order file
127   # changes we check during configuration if the file is empty, and make it a
128   # configuration dependency.
129   file(READ ${CLANG_ORDER_FILE} ORDER_FILE LIMIT 20)
130   if("${ORDER_FILE}" STREQUAL "\n")
131     set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${CLANG_ORDER_FILE})
132   elseif(LINKER_ORDER_FILE_WORKS)
133     target_link_libraries(clang PRIVATE ${LINKER_ORDER_FILE_OPTION})
134     set_target_properties(clang PROPERTIES LINK_DEPENDS ${CLANG_ORDER_FILE})
135   endif()
136 endif()