Chad Rosier | bf40d6b | 2012-08-09 17:17:01 +0000 | [diff] [blame] | 1 | set(LLVM_LINK_COMPONENTS |
NAKAMURA Takumi | ac851792 | 2013-12-10 12:40:37 +0000 | [diff] [blame] | 2 | BitReader |
| 3 | Support |
Michael J. Spencer | 0947621 | 2010-09-13 23:54:41 +0000 | [diff] [blame] | 4 | ) |
| 5 | |
Oscar Fuentes | 7221610 | 2011-03-13 15:10:24 +0000 | [diff] [blame] | 6 | set(SOURCES |
Argyrios Kyrtzidis | 7fbd97f | 2011-07-09 20:00:58 +0000 | [diff] [blame] | 7 | ARCMigrate.cpp |
Dmitri Gribenko | f430da4 | 2014-02-12 10:33:14 +0000 | [diff] [blame^] | 8 | BuildSystem.cpp |
Ted Kremenek | 0ec2cca | 2010-01-05 19:32:54 +0000 | [diff] [blame] | 9 | CIndex.cpp |
Ted Kremenek | ae9e221 | 2010-08-27 21:34:58 +0000 | [diff] [blame] | 10 | CIndexCXX.cpp |
Ted Kremenek | 9cd9f6d | 2010-01-05 22:06:45 +0000 | [diff] [blame] | 11 | CIndexCodeCompletion.cpp |
Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 12 | CIndexDiagnostic.cpp |
Argyrios Kyrtzidis | cddafd3 | 2011-10-06 07:00:54 +0000 | [diff] [blame] | 13 | CIndexHigh.cpp |
Ted Kremenek | 0b86e3a | 2010-01-26 19:31:51 +0000 | [diff] [blame] | 14 | CIndexInclusionStack.cpp |
Ted Kremenek | 9cd9f6d | 2010-01-05 22:06:45 +0000 | [diff] [blame] | 15 | CIndexUSRs.cpp |
Ted Kremenek | 0ec2cca | 2010-01-05 19:32:54 +0000 | [diff] [blame] | 16 | CIndexer.cpp |
Dmitri Gribenko | 5e4fe00 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 17 | CXComment.cpp |
Ted Kremenek | 87553c4 | 2010-01-15 20:35:54 +0000 | [diff] [blame] | 18 | CXCursor.cpp |
Arnaud A. de Grandmaison | 2b3c860 | 2012-06-30 20:43:43 +0000 | [diff] [blame] | 19 | CXCompilationDatabase.cpp |
Ted Kremenek | d010ba4 | 2011-11-10 08:43:12 +0000 | [diff] [blame] | 20 | CXLoadedDiagnostic.cpp |
Ted Kremenek | 4c4f08d | 2011-10-31 22:05:42 +0000 | [diff] [blame] | 21 | CXSourceLocation.cpp |
Ted Kremenek | bb2c710 | 2011-10-31 21:40:19 +0000 | [diff] [blame] | 22 | CXStoredDiagnostic.cpp |
Ted Kremenek | 4b4f369 | 2010-11-16 01:56:27 +0000 | [diff] [blame] | 23 | CXString.cpp |
Ted Kremenek | a594082 | 2010-08-26 01:42:22 +0000 | [diff] [blame] | 24 | CXType.cpp |
Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 25 | IndexBody.cpp |
| 26 | IndexDecl.cpp |
| 27 | IndexTypeSourceInfo.cpp |
| 28 | Indexing.cpp |
| 29 | IndexingContext.cpp |
NAKAMURA Takumi | bf6d1ef | 2014-01-20 10:24:05 +0000 | [diff] [blame] | 30 | |
| 31 | ADDITIONAL_HEADERS |
| 32 | CIndexDiagnostic.h |
| 33 | CIndexer.h |
| 34 | CXCursor.h |
| 35 | CXLoadedDiagnostic.h |
| 36 | CXSourceLocation.h |
| 37 | CXString.h |
| 38 | CXTranslationUnit.h |
| 39 | CXType.h |
| 40 | Index_Internal.h |
Ted Kremenek | bb2c710 | 2011-10-31 21:40:19 +0000 | [diff] [blame] | 41 | IndexingContext.h |
Douglas Gregor | 4db3023 | 2010-02-18 04:01:41 +0000 | [diff] [blame] | 42 | ../../include/clang-c/Index.h |
Oscar Fuentes | 7221610 | 2011-03-13 15:10:24 +0000 | [diff] [blame] | 43 | ) |
Douglas Gregor | 43bc1a7 | 2009-09-25 06:35:15 +0000 | [diff] [blame] | 44 | |
Chandler Carruth | 28969b4 | 2012-06-21 01:30:21 +0000 | [diff] [blame] | 45 | set(LIBRARIES |
| 46 | clangARCMigrate |
Chandler Carruth | 28969b4 | 2012-06-21 01:30:21 +0000 | [diff] [blame] | 47 | clangAST |
Chandler Carruth | 28969b4 | 2012-06-21 01:30:21 +0000 | [diff] [blame] | 48 | clangBasic |
NAKAMURA Takumi | ac851792 | 2013-12-10 12:40:37 +0000 | [diff] [blame] | 49 | clangFrontend |
| 50 | clangIndex |
| 51 | clangLex |
| 52 | clangSema |
| 53 | clangTooling |
Chandler Carruth | 28969b4 | 2012-06-21 01:30:21 +0000 | [diff] [blame] | 54 | ) |
| 55 | |
NAKAMURA Takumi | a9a35c6 | 2012-07-27 06:17:56 +0000 | [diff] [blame] | 56 | set(GENERATED_HEADERS |
| 57 | ClangAttrClasses |
| 58 | ClangAttrList |
| 59 | ClangAttrParsedAttrList |
NAKAMURA Takumi | 518490b | 2014-01-24 13:40:37 +0000 | [diff] [blame] | 60 | ClangAttrVisitor |
| 61 | ClangCommentCommandList |
NAKAMURA Takumi | a9a35c6 | 2012-07-27 06:17:56 +0000 | [diff] [blame] | 62 | ClangCommentNodes |
| 63 | ClangDiagnosticCommon |
| 64 | ClangDiagnosticFrontend |
| 65 | ClangDeclNodes |
| 66 | ClangStmtNodes |
| 67 | ) |
| 68 | |
NAKAMURA Takumi | 742b90c | 2014-01-23 15:33:50 +0000 | [diff] [blame] | 69 | option(LIBCLANG_BUILD_STATIC |
| 70 | "Build libclang as a static library (in addition to a shared one)" OFF) |
| 71 | |
Nico Weber | 5f676dc | 2013-12-29 19:31:48 +0000 | [diff] [blame] | 72 | set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/libclang.exports) |
Argyrios Kyrtzidis | 08b0418 | 2013-11-06 08:37:50 +0000 | [diff] [blame] | 73 | |
NAKAMURA Takumi | 9f2538d | 2014-01-22 13:02:59 +0000 | [diff] [blame] | 74 | if(MSVC) |
| 75 | # Avoid LNK4197 not to spceify libclang.def here. |
| 76 | # Each functions is exported as "dllexport" in include/clang-c. |
| 77 | # KB835326 |
| 78 | set(LLVM_EXPORTED_SYMBOL_FILE) |
| 79 | endif() |
| 80 | |
Oscar Fuentes | 7221610 | 2011-03-13 15:10:24 +0000 | [diff] [blame] | 81 | if( LLVM_ENABLE_PIC ) |
NAKAMURA Takumi | ac3ff26 | 2014-01-23 15:33:44 +0000 | [diff] [blame] | 82 | add_clang_library(libclang SHARED ${SOURCES}) |
Chandler Carruth | 28969b4 | 2012-06-21 01:30:21 +0000 | [diff] [blame] | 83 | target_link_libraries(libclang ${LIBRARIES}) |
Argyrios Kyrtzidis | 4168648 | 2013-03-29 21:51:40 +0000 | [diff] [blame] | 84 | add_dependencies(libclang ${GENERATED_HEADERS} clang-headers) |
Douglas Gregor | b1cf1ca | 2010-08-02 20:52:32 +0000 | [diff] [blame] | 85 | |
Manuel Klimek | 4fa6b60 | 2012-05-15 08:58:48 +0000 | [diff] [blame] | 86 | if(WIN32) |
| 87 | set_target_properties(libclang |
| 88 | PROPERTIES |
| 89 | OUTPUT_NAME "libclang" |
| 90 | VERSION ${LIBCLANG_LIBRARY_VERSION} |
| 91 | DEFINE_SYMBOL _CINDEX_LIB_) |
| 92 | else() |
| 93 | set_target_properties(libclang |
| 94 | PROPERTIES |
| 95 | OUTPUT_NAME "clang" |
| 96 | VERSION ${LIBCLANG_LIBRARY_VERSION} |
| 97 | DEFINE_SYMBOL _CINDEX_LIB_) |
| 98 | endif() |
Oscar Fuentes | 7221610 | 2011-03-13 15:10:24 +0000 | [diff] [blame] | 99 | |
| 100 | if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") |
Nico Weber | 194c009 | 2013-12-30 03:43:30 +0000 | [diff] [blame] | 101 | set(LIBCLANG_LINK_FLAGS " -Wl,-compatibility_version -Wl,1") |
Argyrios Kyrtzidis | 08b0418 | 2013-11-06 08:37:50 +0000 | [diff] [blame] | 102 | if (DEFINED ${LLVM_SUBMIT_VERSION}) |
| 103 | set(LIBCLANG_LINK_FLAGS |
| 104 | "${LIBCLANG_LINK_FLAGS} -Wl,-current_version -Wl,${LLVM_SUBMIT_VERSION}.${LLVM_SUBMIT_SUBVERSION}") |
| 105 | endif() |
| 106 | |
| 107 | set_property(TARGET libclang APPEND_STRING PROPERTY |
| 108 | LINK_FLAGS ${LIBCLANG_LINK_FLAGS}) |
Oscar Fuentes | 7221610 | 2011-03-13 15:10:24 +0000 | [diff] [blame] | 109 | set_target_properties(libclang |
| 110 | PROPERTIES |
Argyrios Kyrtzidis | 08b0418 | 2013-11-06 08:37:50 +0000 | [diff] [blame] | 111 | INSTALL_NAME_DIR "@rpath") |
Oscar Fuentes | 7221610 | 2011-03-13 15:10:24 +0000 | [diff] [blame] | 112 | endif() |
| 113 | |
Oscar Fuentes | 7221610 | 2011-03-13 15:10:24 +0000 | [diff] [blame] | 114 | |
| 115 | set(LIBCLANG_STATIC_TARGET_NAME libclang_static) |
| 116 | else() |
| 117 | set(LIBCLANG_STATIC_TARGET_NAME libclang) |
Douglas Gregor | 43bc1a7 | 2009-09-25 06:35:15 +0000 | [diff] [blame] | 118 | endif() |
Douglas Gregor | 629f481 | 2009-10-05 22:25:29 +0000 | [diff] [blame] | 119 | |
Argyrios Kyrtzidis | f7b32a0 | 2013-06-06 19:51:37 +0000 | [diff] [blame] | 120 | if( (NOT LLVM_ENABLE_PIC OR LIBCLANG_BUILD_STATIC) AND NOT WIN32 ) |
Oscar Fuentes | 7221610 | 2011-03-13 15:10:24 +0000 | [diff] [blame] | 121 | add_clang_library(${LIBCLANG_STATIC_TARGET_NAME} STATIC ${SOURCES}) |
Chandler Carruth | 28969b4 | 2012-06-21 01:30:21 +0000 | [diff] [blame] | 122 | target_link_libraries(${LIBCLANG_STATIC_TARGET_NAME} ${LIBRARIES}) |
Argyrios Kyrtzidis | 4168648 | 2013-03-29 21:51:40 +0000 | [diff] [blame] | 123 | add_dependencies(${LIBCLANG_STATIC_TARGET_NAME} ${GENERATED_HEADERS} clang-headers) |
Douglas Gregor | be8705b | 2011-02-25 19:24:02 +0000 | [diff] [blame] | 124 | |
Oscar Fuentes | 7221610 | 2011-03-13 15:10:24 +0000 | [diff] [blame] | 125 | set_target_properties(${LIBCLANG_STATIC_TARGET_NAME} |
| 126 | PROPERTIES |
Manuel Klimek | 4fa6b60 | 2012-05-15 08:58:48 +0000 | [diff] [blame] | 127 | OUTPUT_NAME "clang") |
Oscar Fuentes | 7221610 | 2011-03-13 15:10:24 +0000 | [diff] [blame] | 128 | endif() |