CMakeLists.txt 2.57 KB
Newer Older
Anirudh Kaushik's avatar
Anirudh Kaushik committed
1 2
cmake_minimum_required(VERSION 2.6)
  project(systemc-clang)
rmrf's avatar
rmrf committed
3 4
  # Use C++ standard version to c++17
  set(CMAKE_CXX_STANDARD 17)
rmrf's avatar
rmrf committed
5 6
  # Always keep it on
  set(CMAKE_CXX_STANDARD_REQUIRED ON)
Anirudh Kaushik's avatar
Anirudh Kaushik committed
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38

  option (USE_SAUTO
      "Use suspension-automata library." OFF
      )
  set (ROOT_CPP
      driver-tooling.cpp
#      ToolingTest.cpp
#      ToolingTutorial.cpp
      )

#  set (CLANG_SRC_DIR
#      $ENV{CLANG_SRC_DIR}
#      )
#  set (LLVM_SRC_DIR
#      $ENV{LLVM_SRC_DIR}
#      )
 
  set (LLVM_BUILD_DIR
      $ENV{LLVM_BUILD_DIR}
      )
  set (CMAKE_CXX_FLAGS
      "$ENV{LLVM_CXX_FLAGS} $ENV{CMAKE_CXX_FLAGS} -DUSE_SAUTO=off"
      )

if (USE_SAUTO)
  set (CMAKE_CXX_FLAGS
      "-DUSE_SAUTO=on ${CMAKE_CXX_FLAGS}"
      )
endif(USE_SAUTO)


  set (LLVM_LD_FLAGS
rmrf's avatar
rmrf committed
39
      "$ENV{LLVM_LD_FLAGS} -lpthread"
Anirudh Kaushik's avatar
Anirudh Kaushik committed
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
      )

  set (LLVM_LIBS
      $ENV{LLVM_LIBS}
      )

#set (LLVM_LD_LIBS LLVMCppBackendCodeGen LLVMCppBackendInfo LLVMTarget LLVMCore LLVMMC LLVMObject LLVMSupport)

#LLVMJIT LLVMX86CodeGen LLVMX86AsmParser LLVMX86Disassembler LLVMExecutionEngine LLVMAsmPrinter LLVMSelectionDAG LLVMX86AsmPrinter LLVMX86Info LLVMMCParser LLVMCodeGen LLVMX86Utils LLVMScalarOpts LLVMInstCombine LLVMTransformUtils LLVMipa LLVMAnalysis LLVMTarget LLVMCore LLVMMC LLVMSupport

  set (CLANG_LIBS
  	clangTooling
			clangFrontendTool
				clangFrontend
				clangDriver
				clangSerialization
				clangCodeGen
				clangParse
				clangSema
				clangStaticAnalyzerFrontend
				clangStaticAnalyzerCheckers
				clangStaticAnalyzerCore
				clangAnalysis
				clangARCMigrate
				clangRewriteFrontend
65
				clangRewrite
Anirudh Kaushik's avatar
Anirudh Kaushik committed
66 67 68 69
				clangEdit
				clangAST
				clangLex
				clangBasic
rmrf's avatar
rmrf committed
70
                clangASTMatchers
Anirudh Kaushik's avatar
Anirudh Kaushik committed
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
   )


  set (CMAKE_MODULE_LINKER_FLAGS 
      $ENV{LLVM_LD_FLAGS}
      )

  set (TARGET
      "systemc-clang"
      )


  include_directories( 
      "${LLVM_BUILD_DIR}/include"
      src
if (USE_SAUTO)
      sauto
endif (USE_SAUTO)
     
      )


  link_directories( 
      ${LLVM_BUILD_DIR}/lib 
      )

  add_subdirectory(src)
if (USE_SAUTO)
  add_subdirectory(sauto)
endif (USE_SAUTO)


  set( SRC_LIB libsystemc-clang)
if (USE_SAUTO)
  set( SAUTO_LIB libsauto )
endif (USE_SAUTO)
  add_executable( 
      ${TARGET} 
      ${ROOT_CPP} )
  
  target_link_libraries(${TARGET} ${SRC_LIB})
  target_link_libraries(${TARGET} ${SAUTO_LIB})

  foreach (clang_lib ${CLANG_LIBS})
    target_link_libraries( ${TARGET} ${clang_lib} )
  endforeach()

rmrf's avatar
rmrf committed
118 119 120 121
  foreach (ld_flag ${LLVM_LD_FLAGS})
    target_link_libraries( ${TARGET} ${ld_flag} )
  endforeach()

Anirudh Kaushik's avatar
Anirudh Kaushik committed
122 123 124 125 126 127
  foreach (llvm_lib ${LLVM_LIBS})
    target_link_libraries( ${TARGET} ${llvm_lib} )
  endforeach()