From d2f4e5ea6e980e48c292f5ca250e99377e3ee111 Mon Sep 17 00:00:00 2001 From: Oscar Fuentes Date: Sun, 26 Oct 2008 00:56:18 +0000 Subject: [PATCH] CMake: Builds and installs clang binary and libs (no docs yet). It must be under the `tools' subdirectory of the LLVM *source* tree. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58180 91177308-0d34-0410-b5e6-96231b3b80d8 --- CMakeLists.txt | 26 ++++++++++++++++++++++++ Driver/CMakeLists.txt | 40 +++++++++++++++++++++++++++++++++++++ lib/AST/CMakeLists.txt | 28 ++++++++++++++++++++++++++ lib/Analysis/CMakeLists.txt | 31 ++++++++++++++++++++++++++++ lib/Basic/CMakeLists.txt | 13 ++++++++++++ lib/CMakeLists.txt | 10 ++++++++++ lib/CodeGen/CMakeLists.txt | 22 ++++++++++++++++++++ lib/Driver/CMakeLists.txt | 8 ++++++++ lib/Headers/CMakeLists.txt | 25 +++++++++++++++++++++++ lib/Lex/CMakeLists.txt | 21 +++++++++++++++++++ lib/Parse/CMakeLists.txt | 18 +++++++++++++++++ lib/Rewrite/CMakeLists.txt | 9 +++++++++ lib/Sema/CMakeLists.txt | 20 +++++++++++++++++++ 13 files changed, 271 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 Driver/CMakeLists.txt create mode 100644 lib/AST/CMakeLists.txt create mode 100644 lib/Analysis/CMakeLists.txt create mode 100644 lib/Basic/CMakeLists.txt create mode 100644 lib/CMakeLists.txt create mode 100644 lib/CodeGen/CMakeLists.txt create mode 100644 lib/Driver/CMakeLists.txt create mode 100644 lib/Headers/CMakeLists.txt create mode 100644 lib/Lex/CMakeLists.txt create mode 100644 lib/Parse/CMakeLists.txt create mode 100644 lib/Rewrite/CMakeLists.txt create mode 100644 lib/Sema/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000000..ccc1158376 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,26 @@ +macro(add_clang_library name) + add_library( ${name} ${ARGN} ) + if( LLVM_COMMON_DEPENDS ) + add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} ) + endif( LLVM_COMMON_DEPENDS ) + install(TARGETS ${name} + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +endmacro(add_clang_library) + +macro(add_clang_executable name) + add_llvm_executable( ${name} ${ARGN} ) + install(TARGETS ${name} + RUNTIME DESTINATION bin) +endmacro(add_clang_executable) + +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR}/include + ) + +add_definitions( -D_GNU_SOURCE ) + +add_subdirectory(lib) +add_subdirectory(Driver) + +# TODO: docs. diff --git a/Driver/CMakeLists.txt b/Driver/CMakeLists.txt new file mode 100644 index 0000000000..f0d8ae7d83 --- /dev/null +++ b/Driver/CMakeLists.txt @@ -0,0 +1,40 @@ +set(LLVM_NO_RTTI 1) + +set( LLVM_USED_LIBS + clangCodeGen + clangAnalysis + clangRewrite + clangSema + clangDriver + clangAST + clangParse + clangLex + clangBasic + ) + +set( LLVM_LINK_COMPONENTS + ${LLVM_TARGETS_TO_BUILD} + bitreader + bitwriter + codegen + ipo + selectiondag + ) + +add_clang_executable(clang + AnalysisConsumer.cpp + ASTConsumers.cpp + Backend.cpp + CacheTokens.cpp + clang.cpp + DependencyFile.cpp + DiagChecker.cpp + HTMLPrint.cpp + PrintParserCallbacks.cpp + PrintPreprocessedOutput.cpp + RewriteBlocks.cpp + RewriteMacros.cpp + RewriteObjC.cpp + RewriteTest.cpp + SerializationTest.cpp + ) diff --git a/lib/AST/CMakeLists.txt b/lib/AST/CMakeLists.txt new file mode 100644 index 0000000000..a58b3b162f --- /dev/null +++ b/lib/AST/CMakeLists.txt @@ -0,0 +1,28 @@ +set(LLVM_NO_RTTI 1) + +add_clang_library(clangAST + ASTConsumer.cpp + ASTContext.cpp + Builtins.cpp + CFG.cpp + DeclBase.cpp + Decl.cpp + DeclCXX.cpp + DeclGroup.cpp + DeclObjC.cpp + DeclSerialization.cpp + ExprConstant.cpp + Expr.cpp + ExprCXX.cpp + InheritViz.cpp + ParentMap.cpp + Stmt.cpp + StmtDumper.cpp + StmtIterator.cpp + StmtPrinter.cpp + StmtSerialization.cpp + StmtViz.cpp + TranslationUnit.cpp + Type.cpp + TypeSerialization.cpp + ) diff --git a/lib/Analysis/CMakeLists.txt b/lib/Analysis/CMakeLists.txt new file mode 100644 index 0000000000..626087aebf --- /dev/null +++ b/lib/Analysis/CMakeLists.txt @@ -0,0 +1,31 @@ +set(LLVM_NO_RTTI 1) + +add_clang_library(clangAnalysis + BasicConstraintManager.cpp + BasicObjCFoundationChecks.cpp + BasicStore.cpp + BasicValueFactory.cpp + BugReporter.cpp + CFRefCount.cpp + CheckDeadStores.cpp + CheckNSError.cpp + CheckObjCDealloc.cpp + CheckObjCInstMethSignature.cpp + CheckObjCUnusedIVars.cpp + Environment.cpp + ExplodedGraph.cpp + GRBlockCounter.cpp + GRCoreEngine.cpp + GRExprEngine.cpp + GRExprEngineInternalChecks.cpp + GRSimpleVals.cpp + GRState.cpp + GRTransferFuncs.cpp + LiveVariables.cpp + MemRegion.cpp + PathDiagnostic.cpp + RegionStore.cpp + SVals.cpp + SymbolManager.cpp + UninitializedValues.cpp + ) diff --git a/lib/Basic/CMakeLists.txt b/lib/Basic/CMakeLists.txt new file mode 100644 index 0000000000..37fa210df8 --- /dev/null +++ b/lib/Basic/CMakeLists.txt @@ -0,0 +1,13 @@ +set(LLVM_NO_RTTI 1) + +add_clang_library(clangBasic + Diagnostic.cpp + FileManager.cpp + IdentifierTable.cpp + LangOptions.cpp + SourceLocation.cpp + SourceManager.cpp + TargetInfo.cpp + Targets.cpp + TokenKinds.cpp + ) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt new file mode 100644 index 0000000000..d2fafb3927 --- /dev/null +++ b/lib/CMakeLists.txt @@ -0,0 +1,10 @@ +add_subdirectory(Headers) +add_subdirectory(Basic) +add_subdirectory(Lex) +add_subdirectory(Parse) +add_subdirectory(AST) +add_subdirectory(Sema) +add_subdirectory(CodeGen) +add_subdirectory(Analysis) +add_subdirectory(Rewrite) +add_subdirectory(Driver) diff --git a/lib/CodeGen/CMakeLists.txt b/lib/CodeGen/CMakeLists.txt new file mode 100644 index 0000000000..c59853a1b7 --- /dev/null +++ b/lib/CodeGen/CMakeLists.txt @@ -0,0 +1,22 @@ +set(LLVM_NO_RTTI 1) + +add_clang_library(clangCodeGen + CGBuiltin.cpp + CGCall.cpp + CGCXX.cpp + CGDebugInfo.cpp + CGDecl.cpp + CGExprAgg.cpp + CGExprComplex.cpp + CGExprConstant.cpp + CGExpr.cpp + CGExprScalar.cpp + CGObjC.cpp + CGObjCGNU.cpp + CGObjCMac.cpp + CGStmt.cpp + CodeGenFunction.cpp + CodeGenModule.cpp + CodeGenTypes.cpp + ModuleBuilder.cpp + ) diff --git a/lib/Driver/CMakeLists.txt b/lib/Driver/CMakeLists.txt new file mode 100644 index 0000000000..0caa90cbb4 --- /dev/null +++ b/lib/Driver/CMakeLists.txt @@ -0,0 +1,8 @@ +set(LLVM_NO_RTTI 1) + +add_clang_library(clangDriver + HTMLDiagnostics.cpp + InitHeaderSearch.cpp + TextDiagnosticBuffer.cpp + TextDiagnosticPrinter.cpp + ) diff --git a/lib/Headers/CMakeLists.txt b/lib/Headers/CMakeLists.txt new file mode 100644 index 0000000000..3c42167e5a --- /dev/null +++ b/lib/Headers/CMakeLists.txt @@ -0,0 +1,25 @@ +set(files + iso646.h + mmintrin.h + stdarg.h + stdbool.h + stddef.h + ) + +set(output_dir ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/../Headers) + +foreach( f ${files} ) + set( src ${CMAKE_CURRENT_SOURCE_DIR}/${f} ) + set( dst ${output_dir}/${f} ) + add_custom_command(OUTPUT ${dst} + DEPENDS ${src} + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst} + COMMENT "Copying clang's ${f}...") +endforeach( f ) + +add_custom_target(clang_headers ALL + DEPENDS ${files}) + +install(FILES ${files} + PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ + DESTINATION Headers) diff --git a/lib/Lex/CMakeLists.txt b/lib/Lex/CMakeLists.txt new file mode 100644 index 0000000000..684867d87d --- /dev/null +++ b/lib/Lex/CMakeLists.txt @@ -0,0 +1,21 @@ +set(LLVM_NO_RTTI 1) + +# TODO: Add -maltivec when ARCH is PowerPC. + +add_clang_library(clangLex + HeaderMap.cpp + HeaderSearch.cpp + Lexer.cpp + LiteralSupport.cpp + MacroArgs.cpp + MacroInfo.cpp + PPCaching.cpp + PPDirectives.cpp + PPExpressions.cpp + PPLexerChange.cpp + PPMacroExpansion.cpp + Pragma.cpp + Preprocessor.cpp + ScratchBuffer.cpp + TokenLexer.cpp + ) diff --git a/lib/Parse/CMakeLists.txt b/lib/Parse/CMakeLists.txt new file mode 100644 index 0000000000..1682bcdd16 --- /dev/null +++ b/lib/Parse/CMakeLists.txt @@ -0,0 +1,18 @@ +set(LLVM_NO_RTTI 1) + +add_clang_library(clangParse + AttributeList.cpp + DeclSpec.cpp + MinimalAction.cpp + ParseCXXInlineMethods.cpp + ParseDecl.cpp + ParseDeclCXX.cpp + ParseExpr.cpp + ParseExprCXX.cpp + ParseInit.cpp + ParseObjc.cpp + ParsePragma.cpp + Parser.cpp + ParseStmt.cpp + ParseTentative.cpp + ) diff --git a/lib/Rewrite/CMakeLists.txt b/lib/Rewrite/CMakeLists.txt new file mode 100644 index 0000000000..52670b82a2 --- /dev/null +++ b/lib/Rewrite/CMakeLists.txt @@ -0,0 +1,9 @@ +set(LLVM_NO_RTTI 1) + +add_clang_library(clangRewrite + DeltaTree.cpp + HTMLRewrite.cpp + Rewriter.cpp + RewriteRope.cpp + TokenRewriter.cpp + ) diff --git a/lib/Sema/CMakeLists.txt b/lib/Sema/CMakeLists.txt new file mode 100644 index 0000000000..2d8e3c8c3b --- /dev/null +++ b/lib/Sema/CMakeLists.txt @@ -0,0 +1,20 @@ +set(LLVM_NO_RTTI 1) + +add_clang_library(clangSema + IdentifierResolver.cpp + ParseAST.cpp + SemaChecking.cpp + Sema.cpp + SemaDeclAttr.cpp + SemaDecl.cpp + SemaDeclCXX.cpp + SemaDeclObjC.cpp + SemaExpr.cpp + SemaExprCXX.cpp + SemaExprObjC.cpp + SemaInherit.cpp + SemaInit.cpp + SemaOverload.cpp + SemaStmt.cpp + SemaType.cpp + )