summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e74ba3a)
raw | patch | inline | side by side (parent: e74ba3a)
author | Preston Gurd <preston.gurd@intel.com> | |
Mon, 7 May 2012 19:38:40 +0000 (19:38 +0000) | ||
committer | Preston Gurd <preston.gurd@intel.com> | |
Mon, 7 May 2012 19:38:40 +0000 (19:38 +0000) |
optional library support to the llvm-build tool:
- Add new command line parameter to llvm-build: “--enable-optional-libraries”
- Add handing of new llvm-build library type “OptionalLibrary”
- Update Cmake and automake build systems to pass correct flags to llvm-build
based on configuration
Patch by Dan Malea!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156319 91177308-0d34-0410-b5e6-96231b3b80d8
- Add new command line parameter to llvm-build: “--enable-optional-libraries”
- Add handing of new llvm-build library type “OptionalLibrary”
- Update Cmake and automake build systems to pass correct flags to llvm-build
based on configuration
Patch by Dan Malea!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156319 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b1344565cafa1fd1f03dee201474c7fd29bbadc7..9fcdd247ec15eaac8d53c91c01cfb4b6f63fed84 100644 (file)
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
"${LLVM_BINARY_DIR}/tools/llvm-config/LibraryDependencies.inc")
set(LLVMBUILDCMAKEFRAG
"${LLVM_BINARY_DIR}/LLVMBuild.cmake")
+
+# Create the list of optional components that are enabled
+if (LLVM_USE_INTEL_JITEVENTS)
+ set(LLVMOPTIONALCOMPONENTS IntelJITEvents)
+endif (LLVM_USE_INTEL_JITEVENTS)
+if (LLVM_USE_OPROFILE)
+ set(LLVMOPTIONALCOMPONENTS ${LLVMOPTIONALCOMPONENTS} OProfileJIT)
+endif (LLVM_USE_OPROFILE)
+
message(STATUS "Constructing LLVMBuild project information")
execute_process(
COMMAND ${PYTHON_EXECUTABLE} ${LLVMBUILDTOOL}
--native-target "${LLVM_NATIVE_ARCH}"
--enable-targets "${LLVM_TARGETS_TO_BUILD}"
+ --enable-optional-components "${LLVMOPTIONALCOMPONENTS}"
--write-library-table ${LLVMCONFIGLIBRARYDEPENDENCIESINC}
--write-cmake-fragment ${LLVMBUILDCMAKEFRAG}
ERROR_VARIABLE LLVMBUILDOUTPUT
diff --git a/Makefile.config.in b/Makefile.config.in
index 33fbb2ad4ca94fed6112c48980bd0153c552d36e..2ffdacbe90bec92695c118ed9c549f4459297cc8 100644 (file)
--- a/Makefile.config.in
+++ b/Makefile.config.in
# Flags to control building support for OProfile JIT API
USE_OPROFILE := @USE_OPROFILE@
+
+ifeq ($(USE_INTEL_JITEVENTS), 1)
+ OPTIONAL_COMPONENTS += IntelJITEvents
+endif
+ifeq ($(USE_OPROFILE), 1)
+ OPTIONAL_COMPONENTS += OProfileJIT
+endif
diff --git a/Makefile.rules b/Makefile.rules
index 13dbbddf9c0a193fe664c972e1dc32dcc9edb6bf..8d0013ffd1e8b550a667da42a4b3508a163b0551 100644 (file)
--- a/Makefile.rules
+++ b/Makefile.rules
$(Verb) $(LLVMBuildTool) \
--native-target "$(TARGET_NATIVE_ARCH)" \
--enable-targets "$(TARGETS_TO_BUILD)" \
+ --enable-optional-components "$(OPTIONAL_COMPONENTS)" \
--write-library-table $(LLVMConfigLibraryDependenciesInc) \
--write-make-fragment $(LLVMBuildMakeFrag)
diff --git a/lib/ExecutionEngine/IntelJITEvents/LLVMBuild.txt b/lib/ExecutionEngine/IntelJITEvents/LLVMBuild.txt
index 80d22732644190140133c2945de8a1b3b74cbac8..9c06fdae8689df8b05a34cde3a201af4761df661 100644 (file)
[common]
[component_0]
-type = Library
+type = OptionalLibrary
name = IntelJITEvents
parent = ExecutionEngine
diff --git a/lib/ExecutionEngine/OProfileJIT/LLVMBuild.txt b/lib/ExecutionEngine/OProfileJIT/LLVMBuild.txt
index 4516dfa2dab203198a96b799d0881a143fd7d912..e30516eb3b0100aa3e52d43157b9c15b7d9147f6 100644 (file)
[common]
[component_0]
-type = Library
+type = OptionalLibrary
name = OProfileJIT
parent = ExecutionEngine
diff --git a/utils/llvm-build/llvmbuild/componentinfo.py b/utils/llvm-build/llvmbuild/componentinfo.py
index 230ae219f2f218adcc28fd05da4d8c61f67e30a3..737b857dfbbafd17ffcf5941b442906d6eed50a9 100644 (file)
type_name = 'Library'
@staticmethod
- def parse(subpath, items):
+ def parse_items(items):
kwargs = ComponentInfo.parse_items(items)
kwargs['library_name'] = items.get_optional_string('library_name')
kwargs['required_libraries'] = items.get_list('required_libraries')
kwargs['add_to_library_groups'] = items.get_list(
'add_to_library_groups')
+ return kwargs
+
+ @staticmethod
+ def parse(subpath, items):
+ kwargs = LibraryComponentInfo.parse_items(items)
return LibraryComponentInfo(subpath, **kwargs)
def __init__(self, subpath, name, dependencies, parent, library_name,
def get_llvmconfig_component_name(self):
return self.get_library_name().lower()
+class OptionalLibraryComponentInfo(LibraryComponentInfo):
+ type_name = "OptionalLibrary"
+
+ @staticmethod
+ def parse(subpath, items):
+ kwargs = LibraryComponentInfo.parse_items(items)
+ return OptionalLibraryComponentInfo(subpath, **kwargs)
+
+ def __init__(self, subpath, name, dependencies, parent, library_name,
+ required_libraries, add_to_library_groups):
+ LibraryComponentInfo.__init__(self, subpath, name, dependencies, parent,
+ library_name, required_libraries,
+ add_to_library_groups)
+
class LibraryGroupComponentInfo(ComponentInfo):
type_name = 'LibraryGroup'
for t in (GroupComponentInfo,
LibraryComponentInfo, LibraryGroupComponentInfo,
ToolComponentInfo, BuildToolComponentInfo,
- TargetGroupComponentInfo))
+ TargetGroupComponentInfo, OptionalLibraryComponentInfo))
def load_from_path(path, subpath):
# Load the LLVMBuild.txt file as an .ini format file.
parser = ConfigParser.RawConfigParser()
index 36bca872e5f1f51db65300adfa909aa3f228614d..2be9cd6b4465e6b703faf5987cb5db7b1b8a0932 100644 (file)
f.close()
- def write_library_table(self, output_path):
+ def write_library_table(self, output_path, enabled_optional_components):
# Write out the mapping from component names to required libraries.
#
# We do this in topological order so that we know we can append the
# dependencies for added library groups.
entries = {}
for c in self.ordered_component_infos:
+ # Skip optional components which are not enabled
+ if c.type_name == 'OptionalLibrary' \
+ and c.name not in enabled_optional_components:
+ continue
+
# Only certain components are in the table.
- if c.type_name not in ('Library', 'LibraryGroup', 'TargetGroup'):
+ if c.type_name not in ('Library', 'OptionalLibrary', \
+ 'LibraryGroup', 'TargetGroup'):
continue
# Compute the llvm-config "component name". For historical reasons,
llvmconfig_component_name = c.get_llvmconfig_component_name()
# Get the library name, or None for LibraryGroups.
- if c.type_name == 'Library':
+ if c.type_name == 'Library' or c.type_name == 'OptionalLibrary':
library_name = c.get_prefixed_library_name()
else:
library_name = None
help=("Enable the given space or semi-colon separated "
"list of targets, or all targets if not present"),
action="store", default=None)
+ group.add_option("", "--enable-optional-components",
+ dest="optional_components", metavar="NAMES",
+ help=("Enable the given space or semi-colon separated "
+ "list of optional components"),
+ action="store", default=None)
parser.add_option_group(group)
(opts, args) = parser.parse_args()
# Write out the required library table, if requested.
if opts.write_library_table:
- project_info.write_library_table(opts.write_library_table)
+ project_info.write_library_table(opts.write_library_table,
+ opts.optional_components)
# Write out the make fragment, if requested.
if opts.write_make_fragment: