Skip to content

Commit f9c3480

Browse files
author
Michael Kuperstein
committedOct 29, 2014
Fix build with CMake if LLVM_USE_INTEL_JITEVENTS option is enabled
* Added LLVM libraries required for IntelJITEvents to LLVMBuild.txt. * Removed 'jit' library from llvm-jitlistener. * Added support for OptionalLibraries to llvm-build cmake files generator. Patch by aleksey.a.bader@intel.com Differential Revision: http://reviews.llvm.org/D5646 llvm-svn: 220848
1 parent f3f23c1 commit f9c3480

File tree

3 files changed

+24
-12
lines changed

3 files changed

+24
-12
lines changed
 

‎llvm/lib/ExecutionEngine/IntelJITEvents/LLVMBuild.txt

+1
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@
2121
type = OptionalLibrary
2222
name = IntelJITEvents
2323
parent = ExecutionEngine
24+
required_libraries = Core DebugInfo Support

‎llvm/tools/llvm-jitlistener/CMakeLists.txt

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ set(LLVM_LINK_COMPONENTS
1010
inteljitevents
1111
interpreter
1212
irreader
13-
jit
1413
mcjit
1514
nativecodegen
1615
object

‎llvm/utils/llvm-build/llvmbuild/main.py

+23-11
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def mk_quote_string_for_target(value):
4141
"""
4242
mk_quote_string_for_target(target_name) -> str
4343
44-
Return a quoted form of the given target_name suitable for including in a
44+
Return a quoted form of the given target_name suitable for including in a
4545
Makefile as a target name.
4646
"""
4747

@@ -340,7 +340,7 @@ def write_library_table(self, output_path, enabled_optional_components):
340340
# Compute the llvm-config "component name". For historical reasons,
341341
# this is lowercased based on the library name.
342342
llvmconfig_component_name = c.get_llvmconfig_component_name()
343-
343+
344344
# Get the library name, or None for LibraryGroups.
345345
if c.type_name == 'Library' or c.type_name == 'OptionalLibrary':
346346
library_name = c.get_prefixed_library_name()
@@ -430,14 +430,14 @@ def get_required_libraries_for_component(self, ci, traverse_groups = False):
430430
traversed to include their required libraries.
431431
"""
432432

433-
assert ci.type_name in ('Library', 'LibraryGroup', 'TargetGroup')
433+
assert ci.type_name in ('Library', 'OptionalLibrary', 'LibraryGroup', 'TargetGroup')
434434

435435
for name in ci.required_libraries:
436436
# Get the dependency info.
437437
dep = self.component_info_map[name]
438438

439439
# If it is a library, yield it.
440-
if dep.type_name == 'Library':
440+
if dep.type_name == 'Library' or dep.type_name == 'OptionalLibrary':
441441
yield dep
442442
continue
443443

@@ -492,7 +492,7 @@ def get_fragment_dependencies(self):
492492
if (path.startswith(self.source_root) and os.path.exists(path)):
493493
yield path
494494

495-
def write_cmake_fragment(self, output_path):
495+
def write_cmake_fragment(self, output_path, enabled_optional_components):
496496
"""
497497
write_cmake_fragment(output_path) -> None
498498
@@ -561,8 +561,13 @@ def write_cmake_fragment(self, output_path):
561561
# names to required libraries, in a way that is easily accessed from CMake.
562562
""")
563563
for ci in self.ordered_component_infos:
564-
# We only write the information for libraries currently.
565-
if ci.type_name != 'Library':
564+
# Skip optional components which are not enabled.
565+
if ci.type_name == 'OptionalLibrary' \
566+
and ci.name not in enabled_optional_components:
567+
continue
568+
569+
# We only write the information for certain components currently.
570+
if ci.type_name not in ('Library', 'OptionalLibrary'):
566571
continue
567572

568573
f.write("""\
@@ -573,7 +578,7 @@ def write_cmake_fragment(self, output_path):
573578

574579
f.close()
575580

576-
def write_cmake_exports_fragment(self, output_path):
581+
def write_cmake_exports_fragment(self, output_path, enabled_optional_components):
577582
"""
578583
write_cmake_exports_fragment(output_path) -> None
579584
@@ -595,8 +600,13 @@ def write_cmake_exports_fragment(self, output_path):
595600
# dependencies of libraries imported from LLVM.
596601
""")
597602
for ci in self.ordered_component_infos:
603+
# Skip optional components which are not enabled.
604+
if ci.type_name == 'OptionalLibrary' \
605+
and ci.name not in enabled_optional_components:
606+
continue
607+
598608
# We only write the information for libraries currently.
599-
if ci.type_name != 'Library':
609+
if ci.type_name not in ('Library', 'OptionalLibrary'):
600610
continue
601611

602612
# Skip disabled targets.
@@ -905,9 +915,11 @@ def main():
905915

906916
# Write out the cmake fragment, if requested.
907917
if opts.write_cmake_fragment:
908-
project_info.write_cmake_fragment(opts.write_cmake_fragment)
918+
project_info.write_cmake_fragment(opts.write_cmake_fragment,
919+
opts.optional_components)
909920
if opts.write_cmake_exports_fragment:
910-
project_info.write_cmake_exports_fragment(opts.write_cmake_exports_fragment)
921+
project_info.write_cmake_exports_fragment(opts.write_cmake_exports_fragment,
922+
opts.optional_components)
911923

912924
# Configure target definition files, if requested.
913925
if opts.configure_target_def_files:

0 commit comments

Comments
 (0)
Please sign in to comment.