@@ -164,14 +164,34 @@ endif()
164
164
165
165
list ( SORT LIBCLC_TARGETS_TO_BUILD )
166
166
167
+ # Construct LLVM version define
168
+ set ( LLVM_VERSION_DEFINE "-DHAVE_LLVM=0x${LLVM_VERSION_MAJOR} 0${LLVM_VERSION_MINOR} " )
169
+
167
170
# This needs to be set before any target that needs it
168
171
# We need to use LLVM_INCLUDE_DIRS here, because if we are linking to an
169
172
# llvm build directory, this includes $src/llvm/include which is where all the
170
173
# headers are not $build/include/ which is what LLVM_INCLUDE_DIR is set to.
171
174
include_directories ( ${LLVM_INCLUDE_DIRS} )
172
175
173
- # Configure prepare_builtins
174
- add_subdirectory ( utils )
176
+ # Setup prepare_builtins tools
177
+ set (LLVM_LINK_COMPONENTS
178
+ BitReader
179
+ BitWriter
180
+ Core
181
+ IRReader
182
+ Support
183
+ )
184
+ if ( LIBCLC_STANDALONE_BUILD )
185
+ add_llvm_executable ( prepare_builtins utils/prepare-builtins.cpp )
186
+ set ( prepare_builtins_exe prepare_builtins )
187
+ set ( prepare_builtins_target prepare_builtins )
188
+ else ()
189
+ add_llvm_utility ( prepare_builtins utils/prepare-builtins.cpp )
190
+ setup_host_tool ( prepare_builtins PREPARE_BUILTINS prepare_builtins_exe prepare_builtins_target )
191
+ endif ()
192
+ target_compile_definitions ( prepare_builtins PRIVATE ${LLVM_VERSION_DEFINE} )
193
+ # These were not properly reported in early LLVM and we don't need them
194
+ target_compile_options ( prepare_builtins PRIVATE -fno-rtti -fno-exceptions )
175
195
176
196
# Setup arch devices
177
197
set ( r600--_devices cedar cypress barts cayman )
0 commit comments