Skip to content

Commit 4b9adb4

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 bd20fd8 commit 4b9adb4

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
@@ -178,17 +178,28 @@ set(LLVM_LINK_COMPONENTS
178178
IRReader
179179
Support
180180
)
181+
181182
if( LIBCLC_STANDALONE_BUILD )
182-
add_llvm_executable( prepare_builtins utils/prepare-builtins.cpp )
183-
set( prepare_builtins_exe prepare_builtins )
184-
set( prepare_builtins_target prepare_builtins )
183+
message("cross ${CMAKE_CROSSCOMPILING}")
184+
if(CMAKE_CROSSCOMPILING)
185+
find_program(PREPARE_BUILTINS prepare_builtins REQUIRED)
186+
message("found ${PREPARE_BUILTINS}")
187+
set( prepare_builtins_exe ${PREPARE_BUILTINS} )
188+
else()
189+
add_llvm_executable( prepare_builtins utils/prepare-builtins.cpp )
190+
set( prepare_builtins_exe prepare_builtins )
191+
set( prepare_builtins_target prepare_builtins )
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 )
195+
endif()
185196
else()
186197
add_llvm_utility( prepare_builtins utils/prepare-builtins.cpp )
187198
setup_host_tool( prepare_builtins PREPARE_BUILTINS prepare_builtins_exe prepare_builtins_target )
199+
target_compile_definitions( prepare_builtins PRIVATE ${LLVM_VERSION_DEFINE} )
200+
# These were not properly reported in early LLVM and we don't need them
201+
target_compile_options( prepare_builtins PRIVATE -fno-rtti -fno-exceptions )
188202
endif()
189-
target_compile_definitions( prepare_builtins PRIVATE ${LLVM_VERSION_DEFINE} )
190-
# These were not properly reported in early LLVM and we don't need them
191-
target_compile_options( prepare_builtins PRIVATE -fno-rtti -fno-exceptions )
192203

193204
# Setup arch devices
194205
set( r600--_devices cedar cypress barts cayman )

0 commit comments

Comments
 (0)