mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 04:02:41 +01:00
[LLVM] Allow modulemap installation
Summary: Currently we can't install the modulemaps provided by LLVM, since they are not structured to support headers generated as part of the build (ex. `llvm/IR/Attributes.gen`). This patch restructures the module maps in order to support installation. Modules containing generated headers are defined in the new `module.extern.modulemap` file, and are referenced from the main `module.modulemap` using `extern module`. There are two versions of the `module.extern.modulemap` file; one used when building and another, `module.install.modulemap`, which is re-named during installation. Users can opt-into module map installation using `-DLLVM_INSTALL_MODULEMAPS=ON`. The default value is `OFF` due to llvm.org/PR31905. Reviewers: rsmith, mehdi_amini, bruno, EricWF Reviewed By: EricWF Subscribers: tschuett, chapuni, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D53510 llvm-svn: 347420
This commit is contained in:
parent
d3de0c70b1
commit
155ac280ff
@ -187,6 +187,11 @@ option(LLVM_INSTALL_UTILS "Include utility binaries in the 'install' target." OF
|
|||||||
|
|
||||||
option(LLVM_INSTALL_TOOLCHAIN_ONLY "Only include toolchain files in the 'install' target." OFF)
|
option(LLVM_INSTALL_TOOLCHAIN_ONLY "Only include toolchain files in the 'install' target." OFF)
|
||||||
|
|
||||||
|
# Unfortunatly Clang is too eager to search directories for module maps, which can cause the
|
||||||
|
# installed version of the maps to be found when building LLVM from source. Therefore we turn off
|
||||||
|
# the installation by default. See llvm.org/PR31905.
|
||||||
|
option(LLVM_INSTALL_MODULEMAPS "Install the modulemap files in the 'install' target." OFF)
|
||||||
|
|
||||||
option(LLVM_USE_FOLDERS "Enable solution folders in Visual Studio. Disable for Express versions." ON)
|
option(LLVM_USE_FOLDERS "Enable solution folders in Visual Studio. Disable for Express versions." ON)
|
||||||
if ( LLVM_USE_FOLDERS )
|
if ( LLVM_USE_FOLDERS )
|
||||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||||
@ -973,6 +978,20 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
|
|||||||
PATTERN ".svn" EXCLUDE
|
PATTERN ".svn" EXCLUDE
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (LLVM_INSTALL_MODULEMAPS)
|
||||||
|
install(DIRECTORY include/llvm include/llvm-c
|
||||||
|
DESTINATION include
|
||||||
|
COMPONENT llvm-headers
|
||||||
|
FILES_MATCHING
|
||||||
|
PATTERN "module.modulemap"
|
||||||
|
)
|
||||||
|
install(FILES include/llvm/module.install.modulemap
|
||||||
|
DESTINATION include/llvm
|
||||||
|
COMPONENT llvm-headers
|
||||||
|
RENAME "module.extern.modulemap"
|
||||||
|
)
|
||||||
|
endif(LLVM_INSTALL_MODULEMAPS)
|
||||||
|
|
||||||
# Installing the headers needs to depend on generating any public
|
# Installing the headers needs to depend on generating any public
|
||||||
# tablegen'd headers.
|
# tablegen'd headers.
|
||||||
add_custom_target(llvm-headers DEPENDS intrinsics_gen)
|
add_custom_target(llvm-headers DEPENDS intrinsics_gen)
|
||||||
|
5
include/llvm/module.extern.modulemap
Normal file
5
include/llvm/module.extern.modulemap
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
module LLVM_Extern_Config_Def {}
|
||||||
|
module LLVM_Extern_IR_Attributes_Gen {}
|
||||||
|
module LLVM_Extern_IR_Intrinsics_Gen {}
|
||||||
|
module LLVM_Extern_IR_Intrinsics_Enum {}
|
||||||
|
module LLVM_Extern_Utils_DataTypes {}
|
27
include/llvm/module.install.modulemap
Normal file
27
include/llvm/module.install.modulemap
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
|
||||||
|
module LLVM_Extern_Config_Def {
|
||||||
|
textual header "Config/AsmParsers.def"
|
||||||
|
textual header "Config/AsmPrinters.def"
|
||||||
|
textual header "Config/Disassemblers.def"
|
||||||
|
textual header "Config/Targets.def"
|
||||||
|
export *
|
||||||
|
}
|
||||||
|
|
||||||
|
module LLVM_Extern_IR_Attributes_Gen {
|
||||||
|
textual header "IR/Attributes.gen"
|
||||||
|
textual header "IR/Attributes.inc"
|
||||||
|
}
|
||||||
|
|
||||||
|
module LLVM_Extern_IR_Intrinsics_Gen {
|
||||||
|
textual header "IR/Intrinsics.gen"
|
||||||
|
textual header "IR/Intrinsics.inc"
|
||||||
|
}
|
||||||
|
|
||||||
|
module LLVM_Extern_IR_Intrinsics_Enum {
|
||||||
|
textual header "IR/IntrinsicEnums.inc"
|
||||||
|
}
|
||||||
|
|
||||||
|
module LLVM_Extern_Utils_DataTypes {
|
||||||
|
header "Support/DataTypes.h"
|
||||||
|
export *
|
||||||
|
}
|
@ -36,6 +36,7 @@ module LLVM_Backend {
|
|||||||
|
|
||||||
module LLVM_Bitcode { requires cplusplus umbrella "Bitcode" module * { export * } }
|
module LLVM_Bitcode { requires cplusplus umbrella "Bitcode" module * { export * } }
|
||||||
|
|
||||||
|
|
||||||
module LLVM_BinaryFormat {
|
module LLVM_BinaryFormat {
|
||||||
requires cplusplus
|
requires cplusplus
|
||||||
umbrella "BinaryFormat" module * { export * }
|
umbrella "BinaryFormat" module * { export * }
|
||||||
@ -63,7 +64,12 @@ module LLVM_BinaryFormat {
|
|||||||
textual header "BinaryFormat/MsgPack.def"
|
textual header "BinaryFormat/MsgPack.def"
|
||||||
}
|
}
|
||||||
|
|
||||||
module LLVM_Config { requires cplusplus umbrella "Config" module * { export * } }
|
module LLVM_Config {
|
||||||
|
requires cplusplus
|
||||||
|
umbrella "Config"
|
||||||
|
extern module LLVM_Extern_Config_Def "module.extern.modulemap"
|
||||||
|
module * { export * }
|
||||||
|
}
|
||||||
|
|
||||||
module LLVM_DebugInfo {
|
module LLVM_DebugInfo {
|
||||||
requires cplusplus
|
requires cplusplus
|
||||||
@ -181,7 +187,11 @@ module LLVM_intrinsic_gen {
|
|||||||
|
|
||||||
// Attributes.h
|
// Attributes.h
|
||||||
module IR_Argument { header "IR/Argument.h" export * }
|
module IR_Argument { header "IR/Argument.h" export * }
|
||||||
module IR_Attributes { header "IR/Attributes.h" export * }
|
module IR_Attributes {
|
||||||
|
header "IR/Attributes.h"
|
||||||
|
extern module LLVM_Extern_IR_Attributes_Gen "module.extern.modulemap"
|
||||||
|
export *
|
||||||
|
}
|
||||||
module IR_CallSite { header "IR/CallSite.h" export * }
|
module IR_CallSite { header "IR/CallSite.h" export * }
|
||||||
module IR_ConstantFolder { header "IR/ConstantFolder.h" export * }
|
module IR_ConstantFolder { header "IR/ConstantFolder.h" export * }
|
||||||
module IR_GlobalVariable { header "IR/GlobalVariable.h" export * }
|
module IR_GlobalVariable { header "IR/GlobalVariable.h" export * }
|
||||||
@ -207,7 +217,12 @@ module LLVM_intrinsic_gen {
|
|||||||
module IR_Verifier { header "IR/Verifier.h" export * }
|
module IR_Verifier { header "IR/Verifier.h" export * }
|
||||||
module IR_InstIterator { header "IR/InstIterator.h" export * }
|
module IR_InstIterator { header "IR/InstIterator.h" export * }
|
||||||
module IR_InstVisitor { header "IR/InstVisitor.h" export * }
|
module IR_InstVisitor { header "IR/InstVisitor.h" export * }
|
||||||
module IR_Intrinsics { header "IR/Intrinsics.h" export * }
|
module IR_Intrinsics {
|
||||||
|
header "IR/Intrinsics.h"
|
||||||
|
extern module LLVM_Extern_IR_Intricsics_Gen "module.extern.modulemap"
|
||||||
|
extern module LLVM_Extern_IR_Intrinsics_Enum "module.extern.modulemap"
|
||||||
|
export *
|
||||||
|
}
|
||||||
module IR_IntrinsicInst { header "IR/IntrinsicInst.h" export * }
|
module IR_IntrinsicInst { header "IR/IntrinsicInst.h" export * }
|
||||||
module IR_PatternMatch { header "IR/PatternMatch.h" export * }
|
module IR_PatternMatch { header "IR/PatternMatch.h" export * }
|
||||||
module IR_Statepoint { header "IR/Statepoint.h" export * }
|
module IR_Statepoint { header "IR/Statepoint.h" export * }
|
||||||
@ -284,6 +299,8 @@ module LLVM_Transforms {
|
|||||||
module * { export * }
|
module * { export * }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern module LLVM_Extern_Utils_DataTypes "module.extern.modulemap"
|
||||||
|
|
||||||
// A module covering ADT/ and Support/. These are intertwined and
|
// A module covering ADT/ and Support/. These are intertwined and
|
||||||
// codependent, and notionally form a single module.
|
// codependent, and notionally form a single module.
|
||||||
module LLVM_Utils {
|
module LLVM_Utils {
|
||||||
|
Loading…
Reference in New Issue
Block a user