• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1set(LLVM_LINK_COMPONENTS
2  Core
3  MC
4  Support
5  )
6
7# Figure out if we can track VC revisions.
8function(find_first_existing_file out_var)
9  foreach(file ${ARGN})
10    if(EXISTS "${file}")
11      set(${out_var} "${file}" PARENT_SCOPE)
12      return()
13    endif()
14  endforeach()
15endfunction()
16
17macro(find_first_existing_vc_file out_var path)
18  find_first_existing_file(${out_var}
19    "${path}/.git/logs/HEAD" # Git
20    "${path}/.svn/wc.db"     # SVN 1.7
21    "${path}/.svn/entries"   # SVN 1.6
22    )
23endmacro()
24
25find_first_existing_vc_file(llvm_vc "${LLVM_MAIN_SRC_DIR}")
26find_first_existing_vc_file(clang_vc "${CLANG_SOURCE_DIR}")
27
28# The VC revision include that we want to generate.
29set(version_inc "${CMAKE_CURRENT_BINARY_DIR}/SVNVersion.inc")
30
31set(get_svn_script "${LLVM_MAIN_SRC_DIR}/cmake/modules/GetSVN.cmake")
32
33if(DEFINED llvm_vc AND DEFINED clang_vc)
34  # Create custom target to generate the VC revision include.
35  add_custom_command(OUTPUT "${version_inc}"
36    DEPENDS "${llvm_vc}" "${clang_vc}" "${get_svn_script}"
37    COMMAND
38    ${CMAKE_COMMAND} "-DFIRST_SOURCE_DIR=${LLVM_MAIN_SRC_DIR}"
39                     "-DFIRST_NAME=LLVM"
40                     "-DSECOND_SOURCE_DIR=${CLANG_SOURCE_DIR}"
41                     "-DSECOND_NAME=SVN"
42                     "-DHEADER_FILE=${version_inc}"
43                     -P "${get_svn_script}")
44
45  # Mark the generated header as being generated.
46  set_source_files_properties("${version_inc}"
47    PROPERTIES GENERATED TRUE
48               HEADER_FILE_ONLY TRUE)
49
50  # Tell Version.cpp that it needs to build with -DHAVE_SVN_VERSION_INC.
51  set_source_files_properties(Version.cpp
52    PROPERTIES COMPILE_DEFINITIONS "HAVE_SVN_VERSION_INC")
53else()
54  # Not producing a VC revision include.
55  set(version_inc)
56endif()
57
58add_clang_library(clangBasic
59  Attributes.cpp
60  Builtins.cpp
61  CharInfo.cpp
62  Diagnostic.cpp
63  DiagnosticIDs.cpp
64  DiagnosticOptions.cpp
65  FileManager.cpp
66  FileSystemStatCache.cpp
67  IdentifierTable.cpp
68  LangOptions.cpp
69  Module.cpp
70  ObjCRuntime.cpp
71  OpenMPKinds.cpp
72  OperatorPrecedence.cpp
73  SanitizerBlacklist.cpp
74  Sanitizers.cpp
75  SourceLocation.cpp
76  SourceManager.cpp
77  TargetInfo.cpp
78  Targets.cpp
79  TokenKinds.cpp
80  Version.cpp
81  VersionTuple.cpp
82  VirtualFileSystem.cpp
83  Warnings.cpp
84  ${version_inc}
85  )
86
87