Skip to content

Commit 5e221df

Browse files
aus-inteligcbot
authored andcommitted
Move handling of LLVM libs to IGC cmakes
This does not belong to external LLVM cmakes.
1 parent e4666bc commit 5e221df

File tree

3 files changed

+77
-50
lines changed

3 files changed

+77
-50
lines changed

IGC/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,6 +1255,7 @@ endif()
12551255
# ==================================== LLVM package ====================================================
12561256

12571257
include("${CMAKE_CURRENT_SOURCE_DIR}/../external/llvm/llvm.cmake")
1258+
include(igc_llvm)
12581259

12591260
# ==================================== WrapperLLVM package =============================================
12601261

IGC/cmake/igc_llvm.cmake

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
#=========================== begin_copyright_notice ============================
2+
#
3+
# Copyright (c) 2021-2021 Intel Corporation
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining a copy
6+
# of this software and associated documentation files (the "Software"),
7+
# to deal in the Software without restriction, including without limitation
8+
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
9+
# and/or sell copies of the Software, and to permit persons to whom
10+
# the Software is furnished to do so, subject to the following conditions:
11+
#
12+
# The above copyright notice and this permission notice shall be included
13+
# in all copies or substantial portions of the Software.
14+
#
15+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20+
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21+
# IN THE SOFTWARE.
22+
#
23+
#============================ end_copyright_notice =============================
24+
25+
include_guard(DIRECTORY)
26+
27+
if(LLVM_LINK_LLVM_DYLIB)
28+
# LLVM was built and configured in a way that tools (in our case IGC) should be linked
29+
# against single LLVM dynamic library.
30+
set(IGC_BUILD__LLVM_LIBS_TO_LINK "LLVM")
31+
message(STATUS "[IGC] Link against LLVM dynamic library")
32+
else()
33+
# LLVM was built into multiple libraries (static or shared).
34+
message(STATUS "[IGC] Link against LLVM static or shared component libs")
35+
36+
# Link targets/dependencies (in required link order).
37+
# NOTE: Since the libraries are grouped in the same link group (in GCC/CLANG),
38+
# there is no longer need to order in most dependant first manner.
39+
set(IGC_BUILD__LLVM_LIBS_TO_LINK
40+
"LLVMipo"
41+
"LLVMIRReader"
42+
"LLVMBitWriter"
43+
"LLVMBinaryFormat"
44+
"LLVMAsmParser"
45+
"LLVMBitReader"
46+
"LLVMLinker"
47+
"LLVMCodeGen"
48+
"LLVMScalarOpts"
49+
"LLVMTransformUtils"
50+
"LLVMAnalysis"
51+
"LLVMTarget"
52+
"LLVMObjCARCOpts"
53+
"LLVMVectorize"
54+
"LLVMInstrumentation"
55+
"LLVMObject"
56+
"LLVMMCParser"
57+
"LLVMProfileData"
58+
"LLVMMC"
59+
"LLVMCore"
60+
"LLVMSupport"
61+
"LLVMDemangle"
62+
)
63+
64+
if(LLVM_VERSION_MAJOR GREATER_EQUAL 8)
65+
list(APPEND IGC_BUILD__LLVM_LIBS_TO_LINK
66+
"LLVMInstCombine"
67+
)
68+
endif()
69+
70+
if(LLVM_VERSION_MAJOR GREATER_EQUAL 9)
71+
list(APPEND IGC_BUILD__LLVM_LIBS_TO_LINK
72+
"LLVMBitstreamReader"
73+
)
74+
endif()
75+
endif()
76+

external/llvm/llvm.cmake

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -115,53 +115,3 @@ if(IGC_OPTION__LLVM_FROM_SYSTEM OR IGC_USES_SYSTEM_LLVM)
115115
set(IGC_OPTION__LLVM_FROM_SYSTEM ON)
116116
endif()
117117

118-
119-
if(LLVM_LINK_LLVM_DYLIB)
120-
# LLVM was built and configured in a way that tools (in our case IGC) should be linked
121-
# against single LLVM dynamic library.
122-
set(IGC_BUILD__LLVM_LIBS_TO_LINK "LLVM")
123-
message(STATUS "[IGC] Link against LLVM dynamic library")
124-
else()
125-
# LLVM was built into multiple libraries (static or shared).
126-
message(STATUS "[IGC] Link against LLVM static or shared component libs")
127-
128-
# Link targets/dependencies (in required link order).
129-
# NOTE: Since the libraries are grouped in the same link group (in GCC/CLANG),
130-
# there is no longer need to order in most dependant first manner.
131-
set(IGC_BUILD__LLVM_LIBS_TO_LINK
132-
"LLVMipo"
133-
"LLVMIRReader"
134-
"LLVMBitWriter"
135-
"LLVMBinaryFormat"
136-
"LLVMAsmParser"
137-
"LLVMBitReader"
138-
"LLVMLinker"
139-
"LLVMCodeGen"
140-
"LLVMScalarOpts"
141-
"LLVMTransformUtils"
142-
"LLVMAnalysis"
143-
"LLVMTarget"
144-
"LLVMObjCARCOpts"
145-
"LLVMVectorize"
146-
"LLVMInstrumentation"
147-
"LLVMObject"
148-
"LLVMMCParser"
149-
"LLVMProfileData"
150-
"LLVMMC"
151-
"LLVMCore"
152-
"LLVMSupport"
153-
"LLVMDemangle"
154-
)
155-
156-
if(LLVM_VERSION_MAJOR GREATER_EQUAL 8)
157-
list(APPEND IGC_BUILD__LLVM_LIBS_TO_LINK
158-
"LLVMInstCombine"
159-
)
160-
endif()
161-
162-
if(LLVM_VERSION_MAJOR GREATER_EQUAL 9)
163-
list(APPEND IGC_BUILD__LLVM_LIBS_TO_LINK
164-
"LLVMBitstreamReader"
165-
)
166-
endif()
167-
endif()

0 commit comments

Comments
 (0)