2011-03-13 23:10:24 +08:00
|
|
|
set(SOURCES
|
2011-07-10 04:00:58 +08:00
|
|
|
ARCMigrate.cpp
|
Add an option to allow Clang verify source files for a module only once during
the build
When Clang loads the module, it verifies the user source files that the module
was built from. If any file was changed, the module is rebuilt. There are two
problems with this:
1. correctness: we don't verify system files (there are too many of them, and
stat'ing all of them would take a lot of time);
2. performance: the same module file is verified again and again during a
single build.
This change allows the build system to optimize source file verification. The
idea is based on the fact that while the project is being built, the source
files don't change. This allows us to verify the module only once during a
single build session. The build system passes a flag,
-fbuild-session-timestamp=, to inform Clang of the time when the build started.
The build system also requests to enable this feature by passing
-fmodules-validate-once-per-build-session. If these flags are not passed, the
behavior is not changed. When Clang verifies the module the first time, it
writes out a timestamp file. Then, when Clang loads the module the second
time, it finds a timestamp file, so it can compare the verification timestamp
of the module with the time when the build started. If the verification
timestamp is too old, the module is verified again, and the timestamp file is
updated.
llvm-svn: 201224
2014-02-12 18:33:14 +08:00
|
|
|
BuildSystem.cpp
|
2010-01-06 03:32:54 +08:00
|
|
|
CIndex.cpp
|
2010-08-28 05:34:58 +08:00
|
|
|
CIndexCXX.cpp
|
2010-01-06 06:06:45 +08:00
|
|
|
CIndexCodeCompletion.cpp
|
2010-01-28 08:27:43 +08:00
|
|
|
CIndexDiagnostic.cpp
|
2011-10-06 15:00:54 +08:00
|
|
|
CIndexHigh.cpp
|
2010-01-27 03:31:51 +08:00
|
|
|
CIndexInclusionStack.cpp
|
2010-01-06 06:06:45 +08:00
|
|
|
CIndexUSRs.cpp
|
2010-01-06 03:32:54 +08:00
|
|
|
CIndexer.cpp
|
2012-07-21 05:34:34 +08:00
|
|
|
CXComment.cpp
|
2010-01-16 04:35:54 +08:00
|
|
|
CXCursor.cpp
|
2012-07-01 04:43:43 +08:00
|
|
|
CXCompilationDatabase.cpp
|
2011-11-10 16:43:12 +08:00
|
|
|
CXLoadedDiagnostic.cpp
|
2011-11-01 06:05:42 +08:00
|
|
|
CXSourceLocation.cpp
|
2011-11-01 05:40:19 +08:00
|
|
|
CXStoredDiagnostic.cpp
|
2010-11-16 09:56:27 +08:00
|
|
|
CXString.cpp
|
2010-08-26 09:42:22 +08:00
|
|
|
CXType.cpp
|
2011-10-18 03:48:19 +08:00
|
|
|
IndexBody.cpp
|
|
|
|
IndexDecl.cpp
|
|
|
|
IndexTypeSourceInfo.cpp
|
|
|
|
Indexing.cpp
|
|
|
|
IndexingContext.cpp
|
2014-01-20 18:24:05 +08:00
|
|
|
|
|
|
|
ADDITIONAL_HEADERS
|
|
|
|
CIndexDiagnostic.h
|
|
|
|
CIndexer.h
|
|
|
|
CXCursor.h
|
|
|
|
CXLoadedDiagnostic.h
|
|
|
|
CXSourceLocation.h
|
|
|
|
CXString.h
|
|
|
|
CXTranslationUnit.h
|
|
|
|
CXType.h
|
|
|
|
Index_Internal.h
|
2011-11-01 05:40:19 +08:00
|
|
|
IndexingContext.h
|
2010-02-18 12:01:41 +08:00
|
|
|
../../include/clang-c/Index.h
|
2011-03-13 23:10:24 +08:00
|
|
|
)
|
2011-03-13 06:01:58 +08:00
|
|
|
|
2014-07-15 06:17:16 +08:00
|
|
|
set(LIBS
|
|
|
|
clangAST
|
|
|
|
clangBasic
|
|
|
|
clangFrontend
|
|
|
|
clangIndex
|
|
|
|
clangLex
|
|
|
|
clangSema
|
|
|
|
clangTooling
|
|
|
|
)
|
|
|
|
|
|
|
|
if (CLANG_ENABLE_ARCMT)
|
|
|
|
list(APPEND LIBS clangARCMigrate)
|
|
|
|
endif ()
|
|
|
|
|
2015-01-21 05:10:35 +08:00
|
|
|
find_library(DL_LIBRARY_PATH dl)
|
|
|
|
if (DL_LIBRARY_PATH)
|
|
|
|
list(APPEND LIBS dl)
|
|
|
|
endif()
|
|
|
|
|
2014-01-23 23:33:50 +08:00
|
|
|
option(LIBCLANG_BUILD_STATIC
|
|
|
|
"Build libclang as a static library (in addition to a shared one)" OFF)
|
|
|
|
|
2013-12-30 03:31:48 +08:00
|
|
|
set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/libclang.exports)
|
2013-11-06 16:37:50 +08:00
|
|
|
|
2014-01-22 21:02:59 +08:00
|
|
|
if(MSVC)
|
|
|
|
# Avoid LNK4197 not to spceify libclang.def here.
|
|
|
|
# Each functions is exported as "dllexport" in include/clang-c.
|
|
|
|
# KB835326
|
|
|
|
set(LLVM_EXPORTED_SYMBOL_FILE)
|
|
|
|
endif()
|
|
|
|
|
2011-03-13 23:10:24 +08:00
|
|
|
if( LLVM_ENABLE_PIC )
|
2014-02-21 23:34:01 +08:00
|
|
|
set(ENABLE_SHARED SHARED)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if((NOT LLVM_ENABLE_PIC OR LIBCLANG_BUILD_STATIC) AND NOT WIN32)
|
|
|
|
set(ENABLE_STATIC STATIC)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
set(output_name "libclang")
|
|
|
|
else()
|
|
|
|
set(output_name "clang")
|
|
|
|
endif()
|
2011-03-13 06:01:58 +08:00
|
|
|
|
2014-02-21 23:34:01 +08:00
|
|
|
add_clang_library(libclang ${ENABLE_SHARED} ${ENABLE_STATIC}
|
|
|
|
OUTPUT_NAME ${output_name}
|
|
|
|
${SOURCES}
|
|
|
|
DEPENDS clang-headers
|
|
|
|
|
|
|
|
LINK_LIBS
|
2014-07-15 06:17:16 +08:00
|
|
|
${LIBS}
|
2014-02-21 23:34:01 +08:00
|
|
|
|
|
|
|
LINK_COMPONENTS
|
2015-07-08 10:06:29 +08:00
|
|
|
${LLVM_TARGETS_TO_BUILD}
|
2014-08-02 14:58:39 +08:00
|
|
|
Core
|
2014-02-21 23:34:01 +08:00
|
|
|
Support
|
|
|
|
)
|
|
|
|
|
|
|
|
if(ENABLE_SHARED)
|
2012-05-15 16:58:48 +08:00
|
|
|
if(WIN32)
|
|
|
|
set_target_properties(libclang
|
|
|
|
PROPERTIES
|
|
|
|
VERSION ${LIBCLANG_LIBRARY_VERSION}
|
|
|
|
DEFINE_SYMBOL _CINDEX_LIB_)
|
2015-11-12 08:46:57 +08:00
|
|
|
elseif(APPLE)
|
2013-12-30 11:43:30 +08:00
|
|
|
set(LIBCLANG_LINK_FLAGS " -Wl,-compatibility_version -Wl,1")
|
2015-10-14 15:50:47 +08:00
|
|
|
set(LIBCLANG_LINK_FLAGS "${LIBCLANG_LINK_FLAGS} -Wl,-current_version -Wl,${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}")
|
2013-11-06 16:37:50 +08:00
|
|
|
|
|
|
|
set_property(TARGET libclang APPEND_STRING PROPERTY
|
|
|
|
LINK_FLAGS ${LIBCLANG_LINK_FLAGS})
|
2015-11-12 08:46:57 +08:00
|
|
|
else()
|
|
|
|
set_target_properties(libclang
|
|
|
|
PROPERTIES
|
|
|
|
VERSION ${LIBCLANG_LIBRARY_VERSION}
|
|
|
|
DEFINE_SYMBOL _CINDEX_LIB_)
|
2011-03-13 23:10:24 +08:00
|
|
|
endif()
|
|
|
|
endif()
|