Skip to content

Commit 8e7b898

Browse files
rossburtonkraj
authored andcommitted
allow external prepare_builtins
In standalone cross builds, libclc can't build a native prepare_builtins. Hack the CMake to allow it to use an existing binary, which we build in the recipe. Upstream-Status: Inappropriate [discussion for a proper fix in llvm#149814] Signed-off-by: Ross Burton <[email protected]>
1 parent 58c7e9b commit 8e7b898

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

libclc/CMakeLists.txt

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,17 +181,28 @@ set(LLVM_LINK_COMPONENTS
181181
IRReader
182182
Support
183183
)
184+
184185
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 )
186+
message("cross ${CMAKE_CROSSCOMPILING}")
187+
if(CMAKE_CROSSCOMPILING)
188+
find_program(PREPARE_BUILTINS prepare_builtins REQUIRED)
189+
message("found ${PREPARE_BUILTINS}")
190+
set( prepare_builtins_exe ${PREPARE_BUILTINS} )
191+
else()
192+
add_llvm_executable( prepare_builtins utils/prepare-builtins.cpp )
193+
set( prepare_builtins_exe prepare_builtins )
194+
set( prepare_builtins_target prepare_builtins )
195+
target_compile_definitions( prepare_builtins PRIVATE ${LLVM_VERSION_DEFINE} )
196+
# These were not properly reported in early LLVM and we don't need them
197+
target_compile_options( prepare_builtins PRIVATE -fno-rtti -fno-exceptions )
198+
endif()
188199
else()
189200
add_llvm_utility( prepare_builtins utils/prepare-builtins.cpp )
190201
setup_host_tool( prepare_builtins PREPARE_BUILTINS prepare_builtins_exe prepare_builtins_target )
202+
target_compile_definitions( prepare_builtins PRIVATE ${LLVM_VERSION_DEFINE} )
203+
# These were not properly reported in early LLVM and we don't need them
204+
target_compile_options( prepare_builtins PRIVATE -fno-rtti -fno-exceptions )
191205
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 )
195206

196207
# Setup arch devices
197208
set( r600--_devices cedar cypress barts cayman )

0 commit comments

Comments
 (0)