Home | History | Annotate | Download | only in Basic
      1 set(LLVM_LINK_COMPONENTS
      2   Core
      3   MC
      4   Support
      5   )
      6 
      7 # Figure out if we can track VC revisions.
      8 function(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()
     15 endfunction()
     16 
     17 macro(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     )
     23 endmacro()
     24 
     25 find_first_existing_vc_file(llvm_vc "${LLVM_MAIN_SRC_DIR}")
     26 find_first_existing_vc_file(clang_vc "${CLANG_SOURCE_DIR}")
     27 
     28 # The VC revision include that we want to generate.
     29 set(version_inc "${CMAKE_CURRENT_BINARY_DIR}/SVNVersion.inc")
     30 
     31 set(get_svn_script "${LLVM_MAIN_SRC_DIR}/cmake/modules/GetSVN.cmake")
     32 
     33 if(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")
     53 else()
     54   # Not producing a VC revision include.
     55   set(version_inc)
     56 endif()
     57 
     58 add_clang_library(clangBasic
     59   Attributes.cpp
     60   Builtins.cpp
     61   CharInfo.cpp
     62   Diagnostic.cpp
     63   DiagnosticIDs.cpp
     64   FileManager.cpp
     65   FileSystemStatCache.cpp
     66   IdentifierTable.cpp
     67   LangOptions.cpp
     68   Module.cpp
     69   ObjCRuntime.cpp
     70   OpenMPKinds.cpp
     71   OperatorPrecedence.cpp
     72   SanitizerBlacklist.cpp
     73   Sanitizers.cpp
     74   SourceLocation.cpp
     75   SourceManager.cpp
     76   TargetInfo.cpp
     77   Targets.cpp
     78   TokenKinds.cpp
     79   Version.cpp
     80   VersionTuple.cpp
     81   VirtualFileSystem.cpp
     82   Warnings.cpp
     83   ${version_inc}
     84   )
     85 
     86