Skip to content

Commit 8a7a648

Browse files
authored
[libclc] Move CMake for prepare_builtins to a subdirectory (#148815)
This simply makes things better self-contained.
1 parent b3240b4 commit 8a7a648

File tree

2 files changed

+26
-22
lines changed

2 files changed

+26
-22
lines changed

libclc/CMakeLists.txt

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -164,34 +164,14 @@ endif()
164164

165165
list( SORT LIBCLC_TARGETS_TO_BUILD )
166166

167-
# Construct LLVM version define
168-
set( LLVM_VERSION_DEFINE "-DHAVE_LLVM=0x${LLVM_VERSION_MAJOR}0${LLVM_VERSION_MINOR}" )
169-
170167
# This needs to be set before any target that needs it
171168
# We need to use LLVM_INCLUDE_DIRS here, because if we are linking to an
172169
# llvm build directory, this includes $src/llvm/include which is where all the
173170
# headers are not $build/include/ which is what LLVM_INCLUDE_DIR is set to.
174171
include_directories( ${LLVM_INCLUDE_DIRS} )
175172

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 )
173+
# Configure prepare_builtins
174+
add_subdirectory( utils )
195175

196176
# Setup arch devices
197177
set( r600--_devices cedar cypress barts cayman )

libclc/utils/CMakeLists.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Construct LLVM version define
2+
set( LLVM_VERSION_DEFINE "-DHAVE_LLVM=0x${LLVM_VERSION_MAJOR}0${LLVM_VERSION_MINOR}" )
3+
4+
# Setup prepare_builtins tools
5+
set( LLVM_LINK_COMPONENTS
6+
BitReader
7+
BitWriter
8+
Core
9+
IRReader
10+
Support
11+
)
12+
13+
if( LIBCLC_STANDALONE_BUILD )
14+
add_llvm_executable( prepare_builtins prepare-builtins.cpp )
15+
set( prepare_builtins_exe prepare_builtins )
16+
set( prepare_builtins_target prepare_builtins )
17+
else()
18+
add_llvm_utility( prepare_builtins prepare-builtins.cpp )
19+
setup_host_tool( prepare_builtins PREPARE_BUILTINS prepare_builtins_exe prepare_builtins_target )
20+
endif()
21+
22+
target_compile_definitions( prepare_builtins PRIVATE ${LLVM_VERSION_DEFINE} )
23+
# These were not properly reported in early LLVM and we don't need them
24+
target_compile_options( prepare_builtins PRIVATE -fno-rtti -fno-exceptions )

0 commit comments

Comments
 (0)