Skip to content

Commit 06a7c45

Browse files
rossburtonkraj
authored andcommitted
libclc: 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 d4cf955 commit 06a7c45

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

libclc/utils/CMakeLists.txt

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,21 @@ set( LLVM_LINK_COMPONENTS
88
)
99

1010
if( LIBCLC_STANDALONE_BUILD )
11-
add_llvm_executable( prepare_builtins prepare-builtins.cpp )
12-
set( prepare_builtins_exe prepare_builtins PARENT_SCOPE )
13-
set( prepare_builtins_target prepare_builtins PARENT_SCOPE )
11+
message("cross ${CMAKE_CROSSCOMPILING}")
12+
if(CMAKE_CROSSCOMPILING)
13+
find_program(PREPARE_BUILTINS prepare_builtins REQUIRED)
14+
message("found ${PREPARE_BUILTINS}")
15+
set( prepare_builtins_exe ${PREPARE_BUILTINS} )
16+
else()
17+
add_llvm_executable( prepare_builtins prepare-builtins.cpp )
18+
set( prepare_builtins_exe prepare_builtins PARENT_SCOPE )
19+
set( prepare_builtins_target prepare_builtins PARENT_SCOPE )
20+
# These were not properly reported in early LLVM and we don't need them
21+
target_compile_options( prepare_builtins PRIVATE -fno-rtti -fno-exceptions )
22+
endif()
1423
else()
1524
add_llvm_utility( prepare_builtins prepare-builtins.cpp )
1625
setup_host_tool( prepare_builtins PREPARE_BUILTINS prepare_builtins_exe prepare_builtins_target )
26+
# These were not properly reported in early LLVM and we don't need them
27+
target_compile_options( prepare_builtins PRIVATE -fno-rtti -fno-exceptions )
1728
endif()
18-
19-
# These were not properly reported in early LLVM and we don't need them
20-
target_compile_options( prepare_builtins PRIVATE -fno-rtti -fno-exceptions )

0 commit comments

Comments
 (0)