mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-28 16:28:58 +00:00
llvm-build: Factor out duplicate cmake export listing. Patch by
Brad King. The write_cmake_fragment and write_cmake_exports_fragment methods share some logic for selecting libraries that CMake needs to know about. Factor it out into a helper to avoid duplication. llvm-svn: 245716
This commit is contained in:
parent
2e11124ece
commit
8de69c75c0
@ -501,6 +501,28 @@ subdirectories = %s
|
|||||||
if (path.startswith(self.source_root) and os.path.exists(path)):
|
if (path.startswith(self.source_root) and os.path.exists(path)):
|
||||||
yield path
|
yield path
|
||||||
|
|
||||||
|
def foreach_cmake_library(self, f,
|
||||||
|
enabled_optional_components,
|
||||||
|
skip_disabled):
|
||||||
|
for ci in self.ordered_component_infos:
|
||||||
|
# Skip optional components which are not enabled.
|
||||||
|
if ci.type_name == 'OptionalLibrary' \
|
||||||
|
and ci.name not in enabled_optional_components:
|
||||||
|
continue
|
||||||
|
|
||||||
|
# We only write the information for libraries currently.
|
||||||
|
if ci.type_name not in ('Library', 'OptionalLibrary'):
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Skip disabled targets.
|
||||||
|
if skip_disabled:
|
||||||
|
tg = ci.get_parent_target_group()
|
||||||
|
if tg and not tg.enabled:
|
||||||
|
continue
|
||||||
|
|
||||||
|
f(ci)
|
||||||
|
|
||||||
|
|
||||||
def write_cmake_fragment(self, output_path, enabled_optional_components):
|
def write_cmake_fragment(self, output_path, enabled_optional_components):
|
||||||
"""
|
"""
|
||||||
write_cmake_fragment(output_path) -> None
|
write_cmake_fragment(output_path) -> None
|
||||||
@ -569,21 +591,17 @@ configure_file(\"%s\"
|
|||||||
# The following property assignments effectively create a map from component
|
# The following property assignments effectively create a map from component
|
||||||
# names to required libraries, in a way that is easily accessed from CMake.
|
# names to required libraries, in a way that is easily accessed from CMake.
|
||||||
""")
|
""")
|
||||||
for ci in self.ordered_component_infos:
|
self.foreach_cmake_library(
|
||||||
# Skip optional components which are not enabled.
|
lambda ci:
|
||||||
if ci.type_name == 'OptionalLibrary' \
|
f.write("""\
|
||||||
and ci.name not in enabled_optional_components:
|
|
||||||
continue
|
|
||||||
|
|
||||||
# We only write the information for certain components currently.
|
|
||||||
if ci.type_name not in ('Library', 'OptionalLibrary'):
|
|
||||||
continue
|
|
||||||
|
|
||||||
f.write("""\
|
|
||||||
set_property(GLOBAL PROPERTY LLVMBUILD_LIB_DEPS_%s %s)\n""" % (
|
set_property(GLOBAL PROPERTY LLVMBUILD_LIB_DEPS_%s %s)\n""" % (
|
||||||
ci.get_prefixed_library_name(), " ".join(sorted(
|
ci.get_prefixed_library_name(), " ".join(sorted(
|
||||||
dep.get_prefixed_library_name()
|
dep.get_prefixed_library_name()
|
||||||
for dep in self.get_required_libraries_for_component(ci)))))
|
for dep in self.get_required_libraries_for_component(ci)))))
|
||||||
|
,
|
||||||
|
enabled_optional_components,
|
||||||
|
skip_disabled = False
|
||||||
|
)
|
||||||
|
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
@ -608,26 +626,17 @@ set_property(GLOBAL PROPERTY LLVMBUILD_LIB_DEPS_%s %s)\n""" % (
|
|||||||
# The following property assignments tell CMake about link
|
# The following property assignments tell CMake about link
|
||||||
# dependencies of libraries imported from LLVM.
|
# dependencies of libraries imported from LLVM.
|
||||||
""")
|
""")
|
||||||
for ci in self.ordered_component_infos:
|
self.foreach_cmake_library(
|
||||||
# Skip optional components which are not enabled.
|
lambda ci:
|
||||||
if ci.type_name == 'OptionalLibrary' \
|
f.write("""\
|
||||||
and ci.name not in enabled_optional_components:
|
|
||||||
continue
|
|
||||||
|
|
||||||
# We only write the information for libraries currently.
|
|
||||||
if ci.type_name not in ('Library', 'OptionalLibrary'):
|
|
||||||
continue
|
|
||||||
|
|
||||||
# Skip disabled targets.
|
|
||||||
tg = ci.get_parent_target_group()
|
|
||||||
if tg and not tg.enabled:
|
|
||||||
continue
|
|
||||||
|
|
||||||
f.write("""\
|
|
||||||
set_property(TARGET %s PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES %s)\n""" % (
|
set_property(TARGET %s PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES %s)\n""" % (
|
||||||
ci.get_prefixed_library_name(), " ".join(sorted(
|
ci.get_prefixed_library_name(), " ".join(sorted(
|
||||||
dep.get_prefixed_library_name()
|
dep.get_prefixed_library_name()
|
||||||
for dep in self.get_required_libraries_for_component(ci)))))
|
for dep in self.get_required_libraries_for_component(ci)))))
|
||||||
|
,
|
||||||
|
enabled_optional_components,
|
||||||
|
skip_disabled = True
|
||||||
|
)
|
||||||
|
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user