[CMake] Get rid of explicit dependencies to include/clang/*.inc and introduce CLANG_TABLEGEN_TARGETS.

This does;
  - clang_tablegen() adds each tblgen'd target to global property CLANG_TABLEGEN_TARGETS as list.
  - List of targets is added to LLVM_COMMON_DEPENDS.
  - all clang libraries and targets depend on generated headers.

You might wonder this would be regression, but in fact, this is little loss.
  - Almost all of clang libraries depend on tblgen'd files and clang-tblgen.
  - clang-tblgen may cause short stall-out but doesn't cause unconditional rebuild.
  - Each library's dependencies to tblgen'd files might vary along headers' structure.
    It made hard to track and update *really optimal* dependencies.

Each dependency to intrinsics_gen and ClangSACheckers is left as DEPENDS.

llvm-svn: 201842
This commit is contained in:
NAKAMURA Takumi 2014-02-21 07:59:59 +00:00
parent 07334d37de
commit 7da9487dd4
26 changed files with 12 additions and 276 deletions

View File

@ -268,6 +268,7 @@ function(clang_tablegen)
if( CTG_TARGET )
add_custom_target( ${CTG_TARGET} DEPENDS ${output_file} ${CTG_DEPENDS} )
set_target_properties( ${CTG_TARGET} PROPERTIES FOLDER "Clang tablegenning")
set_property(GLOBAL APPEND PROPERTY CLANG_TABLEGEN_TARGETS ${CTG_TARGET})
endif()
endfunction(clang_tablegen)
@ -405,6 +406,11 @@ mark_as_advanced(CLANG_EXECUTABLE_VERSION LIBCLANG_LIBRARY_VERSION)
add_subdirectory(utils/TableGen)
add_subdirectory(include)
# All targets below may depend on all tablegen'd files.
get_property(CLANG_TABLEGEN_TARGETS GLOBAL PROPERTY CLANG_TABLEGEN_TARGETS)
list(APPEND LLVM_COMMON_DEPENDS ${CLANG_TABLEGEN_TARGETS})
add_subdirectory(lib)
add_subdirectory(tools)
add_subdirectory(runtime)

View File

@ -10,13 +10,3 @@ if( NOT WIN32 ) # Win32 mangles symbols differently, and
endif()
add_llvm_loadable_module(PrintFunctionNames PrintFunctionNames.cpp)
add_dependencies(PrintFunctionNames
ClangAttrClasses
ClangAttrList
ClangCommentCommandList
ClangCommentNodes
ClangDeclNodes
ClangDiagnosticCommon
ClangStmtNodes
)

View File

@ -1,11 +1 @@
add_llvm_loadable_module(SampleAnalyzerPlugin MainCallChecker.cpp)
add_dependencies(SampleAnalyzerPlugin
ClangAttrClasses
ClangAttrList
ClangCommentCommandList
ClangCommentNodes
ClangDeclNodes
ClangDiagnosticCommon
ClangStmtNodes
)

View File

@ -25,18 +25,6 @@ add_clang_library(clangARCMigrate
Transforms.cpp
)
add_dependencies(clangARCMigrate
ClangAttrClasses
ClangAttrList
ClangAttrParsedAttrList
ClangCommentNodes
ClangDeclNodes
ClangDiagnosticCommon
ClangDiagnosticGroups
ClangDiagnosticSema
ClangStmtNodes
)
target_link_libraries(clangARCMigrate
clangAST
clangAnalysis

View File

@ -59,27 +59,6 @@ add_clang_library(clangAST
VTTBuilder.cpp
)
add_dependencies(clangAST
ClangARMNeon
ClangAttrClasses
ClangAttrList
ClangAttrImpl
ClangAttrDump
ClangAttrVisitor
ClangCommentCommandInfo
ClangCommentCommandList
ClangCommentNodes
ClangCommentHTMLTags
ClangCommentHTMLTagsProperties
ClangCommentHTMLNamedCharacterReferences
ClangDeclNodes
ClangDiagnosticAST
ClangDiagnosticComment
ClangDiagnosticCommon
ClangDiagnosticSema
ClangStmtNodes
)
target_link_libraries(clangAST
clangBasic
clangLex

View File

@ -7,16 +7,6 @@ add_clang_library(clangASTMatchers
ASTMatchersInternal.cpp
)
add_dependencies(clangASTMatchers
ClangAttrClasses
ClangAttrImpl
ClangAttrList
ClangCommentNodes
ClangDeclNodes
ClangDiagnosticCommon
ClangStmtNodes
)
target_link_libraries(clangASTMatchers
clangAST
)

View File

@ -26,16 +26,6 @@ add_clang_library(clangAnalysis
UninitializedValues.cpp
)
add_dependencies(clangAnalysis
ClangAttrClasses
ClangAttrList
ClangCommentNodes
ClangDiagnosticCommon
ClangDeclNodes
ClangDiagnosticAnalysis
ClangStmtNodes
)
target_link_libraries(clangAnalysis
clangBasic
clangAST

View File

@ -51,20 +51,3 @@ if (Subversion_FOUND AND EXISTS "${CLANG_SOURCE_DIR}/.svn")
PROPERTIES COMPILE_DEFINITIONS "HAVE_SVN_VERSION_INC")
endif()
add_dependencies(clangBasic
ClangARMNeon
ClangAttrList
ClangDiagnosticAnalysis
ClangDiagnosticAST
ClangDiagnosticComment
ClangDiagnosticCommon
ClangDiagnosticDriver
ClangDiagnosticFrontend
ClangDiagnosticGroups
ClangDiagnosticIndexName
ClangDiagnosticLex
ClangDiagnosticParse
ClangDiagnosticSema
ClangDiagnosticSerialization
)

View File

@ -60,17 +60,6 @@ add_clang_library(clangCodeGen
TargetInfo.cpp
)
add_dependencies(clangCodeGen
ClangARMNeon
ClangAttrClasses
ClangAttrList
ClangCommentNodes
ClangDeclNodes
ClangDiagnosticCommon
ClangDiagnosticFrontend
ClangStmtNodes
)
target_link_libraries(clangCodeGen
clangBasic
clangAST

View File

@ -20,13 +20,9 @@ add_clang_library(clangDriver
WindowsToolChain.cpp
Tools.cpp
Types.cpp
)
add_dependencies(clangDriver
ClangAttrList
DEPENDS
ClangCC1AsOptions
ClangDiagnosticCommon
ClangDiagnosticDriver
ClangDriverOptions
)

View File

@ -8,15 +8,6 @@ add_clang_library(clangEdit
RewriteObjCFoundationAPI.cpp
)
add_dependencies(clangEdit
ClangAttrClasses
ClangAttrList
ClangCommentNodes
ClangDeclNodes
ClangDiagnosticCommon
ClangStmtNodes
)
target_link_libraries(clangEdit
clangBasic
clangAST

View File

@ -10,15 +10,6 @@ add_clang_library(clangFormat
WhitespaceManager.cpp
)
add_dependencies(clangFormat
ClangAttrClasses
ClangAttrList
ClangDeclNodes
ClangDiagnosticCommon
ClangDiagnosticFrontend
ClangStmtNodes
)
target_link_libraries(clangFormat
clangBasic
clangLex

View File

@ -35,22 +35,6 @@ add_clang_library(clangFrontend
Warnings.cpp
)
add_dependencies(clangFrontend
ClangAttrClasses
ClangAttrList
ClangAttrParsedAttrList
ClangCommentNodes
ClangDeclNodes
ClangDiagnosticAST
ClangDiagnosticCommon
ClangDiagnosticDriver
ClangDiagnosticFrontend
ClangDiagnosticLex
ClangDiagnosticSema
ClangDriverOptions
ClangStmtNodes
)
target_link_libraries(clangFrontend
clangAST
clangBasic

View File

@ -7,12 +7,6 @@ add_clang_library(clangFrontendTool
ExecuteCompilerInvocation.cpp
)
add_dependencies(clangFrontendTool
ClangDiagnosticCommon
ClangDiagnosticFrontend
ClangDriverOptions
)
target_link_libraries(clangFrontendTool
clangBasic
clangCodeGen

View File

@ -27,12 +27,6 @@ add_clang_library(clangLex
TokenLexer.cpp
)
add_dependencies(clangLex
ClangAttrSpellings
ClangDiagnosticCommon
ClangDiagnosticLex
)
target_link_libraries(clangLex
clangBasic
)

View File

@ -21,18 +21,6 @@ add_clang_library(clangParse
Parser.cpp
)
add_dependencies(clangParse
ClangAttrClasses
ClangAttrParserStringSwitches
ClangAttrList
ClangAttrParsedAttrList
ClangCommentNodes
ClangDeclNodes
ClangDiagnosticCommon
ClangDiagnosticParse
ClangStmtNodes
)
target_link_libraries(clangParse
clangBasic
clangAST

View File

@ -10,17 +10,6 @@ add_clang_library(clangRewriteCore
TokenRewriter.cpp
)
add_dependencies(clangRewriteCore
ClangAttrClasses
ClangAttrList
ClangAttrParsedAttrList
ClangCommentNodes
ClangDeclNodes
ClangDiagnosticCommon
ClangDiagnosticFrontend
ClangStmtNodes
)
target_link_libraries(clangRewriteCore
clangAST
clangBasic

View File

@ -13,17 +13,6 @@ add_clang_library(clangRewriteFrontend
RewriteTest.cpp
)
add_dependencies(clangRewriteFrontend
ClangAttrClasses
ClangAttrList
ClangAttrParsedAttrList
ClangCommentNodes
ClangDeclNodes
ClangDiagnosticCommon
ClangDiagnosticFrontend
ClangStmtNodes
)
target_link_libraries(clangRewriteFrontend
clangAST
clangBasic

View File

@ -50,25 +50,6 @@ add_clang_library(clangSema
TypeLocBuilder.cpp
)
add_dependencies(clangSema
ClangARMNeon
ClangAttrClasses
ClangAttrList
ClangAttrParsedAttrList
ClangAttrParsedAttrKinds
ClangAttrParsedAttrImpl
ClangAttrSpellingListIndex
ClangAttrTemplateInstantiate
ClangCommentNodes
ClangDeclNodes
ClangDiagnosticAST
ClangDiagnosticComment
ClangDiagnosticCommon
ClangDiagnosticParse
ClangDiagnosticSema
ClangStmtNodes
)
target_link_libraries(clangSema
clangAST
clangAnalysis

View File

@ -22,21 +22,6 @@ add_clang_library(clangSerialization
ASTReaderInternals.h
)
add_dependencies(clangSerialization
ClangAttrClasses
ClangAttrList
ClangAttrParsedAttrList
ClangAttrPCHRead
ClangAttrPCHWrite
ClangCommentNodes
ClangDeclNodes
ClangDiagnosticCommon
ClangDiagnosticLex
ClangDiagnosticSema
ClangDiagnosticSerialization
ClangStmtNodes
)
target_link_libraries(clangSerialization
clangAST
clangBasic

View File

@ -74,15 +74,8 @@ add_clang_library(clangStaticAnalyzerCheckers
UnreachableCodeChecker.cpp
VLASizeChecker.cpp
VirtualCallChecker.cpp
)
add_dependencies(clangStaticAnalyzerCheckers
ClangAttrClasses
ClangAttrList
ClangCommentNodes
ClangDeclNodes
ClangDiagnosticCommon
ClangStmtNodes
DEPENDS
ClangSACheckers
)

View File

@ -41,15 +41,6 @@ add_clang_library(clangStaticAnalyzerCore
SymbolManager.cpp
)
add_dependencies(clangStaticAnalyzerCore
ClangAttrClasses
ClangAttrList
ClangCommentNodes
ClangDeclNodes
ClangDiagnosticCommon
ClangStmtNodes
)
target_link_libraries(clangStaticAnalyzerCore
clangAST
clangAnalysis

View File

@ -10,16 +10,6 @@ add_clang_library(clangStaticAnalyzerFrontend
FrontendActions.cpp
)
add_dependencies(clangStaticAnalyzerFrontend
ClangAttrClasses
ClangAttrList
ClangCommentNodes
ClangDeclNodes
ClangDiagnosticCommon
ClangDiagnosticFrontend
ClangStmtNodes
)
target_link_libraries(clangStaticAnalyzerFrontend
clangAST
clangAnalysis

View File

@ -11,15 +11,6 @@ add_clang_library(clangTooling
Tooling.cpp
)
add_dependencies(clangTooling
ClangAttrClasses
ClangAttrList
ClangDeclNodes
ClangDiagnosticCommon
ClangDiagnosticFrontend
ClangStmtNodes
)
target_link_libraries(clangTooling
clangAST
clangASTMatchers

View File

@ -11,10 +11,6 @@ add_clang_executable(diagtool
TreeView.cpp
)
add_dependencies(diagtool
ClangDiagnosticIndexName
)
target_link_libraries(diagtool
clangBasic
clangFrontend

View File

@ -53,19 +53,6 @@ set(LIBRARIES
clangTooling
)
set(GENERATED_HEADERS
ClangAttrClasses
ClangAttrList
ClangAttrParsedAttrList
ClangAttrVisitor
ClangCommentCommandList
ClangCommentNodes
ClangDiagnosticCommon
ClangDiagnosticFrontend
ClangDeclNodes
ClangStmtNodes
)
option(LIBCLANG_BUILD_STATIC
"Build libclang as a static library (in addition to a shared one)" OFF)
@ -79,9 +66,11 @@ if(MSVC)
endif()
if( LLVM_ENABLE_PIC )
add_clang_library(libclang SHARED ${SOURCES})
add_clang_library(libclang SHARED
${SOURCES}
DEPENDS clang-headers
)
target_link_libraries(libclang ${LIBRARIES})
add_dependencies(libclang ${GENERATED_HEADERS} clang-headers)
if(WIN32)
set_target_properties(libclang
@ -120,7 +109,6 @@ endif()
if( (NOT LLVM_ENABLE_PIC OR LIBCLANG_BUILD_STATIC) AND NOT WIN32 )
add_clang_library(${LIBCLANG_STATIC_TARGET_NAME} STATIC ${SOURCES})
target_link_libraries(${LIBCLANG_STATIC_TARGET_NAME} ${LIBRARIES})
add_dependencies(${LIBCLANG_STATIC_TARGET_NAME} ${GENERATED_HEADERS} clang-headers)
set_target_properties(${LIBCLANG_STATIC_TARGET_NAME}
PROPERTIES