• 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)
56
57  # Being able to force-set the SVN revision in cases where it isn't available
58  # is useful for performance tracking, and matches compatibility from autoconf.
59  if(SVN_REVISION)
60    set_source_files_properties(Version.cpp
61      PROPERTIES COMPILE_DEFINITIONS "SVN_REVISION=\"${SVN_REVISION}\"")
62  endif()
63endif()
64
65add_clang_library(clangBasic
66  Attributes.cpp
67  Builtins.cpp
68  CharInfo.cpp
69  Cuda.cpp
70  Diagnostic.cpp
71  DiagnosticIDs.cpp
72  DiagnosticOptions.cpp
73  FileManager.cpp
74  FileSystemStatCache.cpp
75  IdentifierTable.cpp
76  LangOptions.cpp
77  Module.cpp
78  ObjCRuntime.cpp
79  OpenMPKinds.cpp
80  OperatorPrecedence.cpp
81  SanitizerBlacklist.cpp
82  Sanitizers.cpp
83  SourceLocation.cpp
84  SourceManager.cpp
85  TargetInfo.cpp
86  Targets.cpp
87  TokenKinds.cpp
88  Version.cpp
89  VersionTuple.cpp
90  VirtualFileSystem.cpp
91  Warnings.cpp
92  ${version_inc}
93  )
94
95