A SystemC productivity library for virtual platform development utilizing SCV and TLM2.0 https://www.minres.com/#opensource
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CMakeLists.txt 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. cmake_minimum_required(VERSION 2.8)
  2. set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) # project specific cmake dir
  3. # Set the version number of your project here (format is MAJOR.MINOR.PATCHLEVEL - e.g. 1.0.0)
  4. set(VERSION_MAJOR "0")
  5. set(VERSION_MINOR "0")
  6. set(VERSION_PATCH "1")
  7. set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
  8. if(${CMAKE_VERSION} VERSION_LESS "3.0")
  9. project(scc)
  10. else()
  11. if(POLICY CMP0048)
  12. cmake_policy(SET CMP0048 NEW) # CMake 3.0.0
  13. endif()
  14. project(scc VERSION ${VERSION})
  15. endif()
  16. include(Common)
  17. # build a separate SCC-UTIL library for the use in non-systemc based systems
  18. add_library(scc-util STATIC src/io-redirector.cpp)
  19. target_include_directories (scc-util PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/incl)
  20. FILE(GLOB SccUtilHeaders incl/util/*.h)
  21. set_target_properties(scc-util PROPERTIES
  22. VERSION ${VERSION} # ${VERSION} was defined in the main CMakeLists.
  23. FRAMEWORK FALSE
  24. PUBLIC_HEADER "${SccUtilHeaders}" # specify the public headers
  25. )
  26. if(NOT SystemCPackage)
  27. set(SystemCPackage SystemC)
  28. endif()
  29. find_package(Threads)
  30. find_package(ZLIB)
  31. find_package(${SystemCPackage} REQUIRED)
  32. set(CLANG_FORMAT_EXCLUDE_PATTERNS "/spdlog/" "/json/" "jsoncpp.cpp" "sqlite3")
  33. find_package(ClangFormat)
  34. include(CheckSymbolExists)
  35. # Check for function getenv()
  36. check_symbol_exists(getenv "stdlib.h" HAVE_GETENV)
  37. set(LIB_SOURCES
  38. src/sc_logic_7.cpp
  39. src/utilities.cpp
  40. src/report.cpp
  41. src/perf_estimator.cpp
  42. src/io-redirector.cpp
  43. src/ordered_semaphore.cpp
  44. src/configurer.cpp
  45. src/jsoncpp.cpp
  46. src/tlm_ahb_bfm_initiator.cpp
  47. src/tlm_ahb_bfm_target.cpp
  48. src/tracer_base.cpp
  49. src/tracer.cpp
  50. )
  51. if(CCI_FOUND)
  52. set(LIB_SOURCES ${LIB_SOURCES}
  53. src/configurable_tracer.cpp
  54. src/value_registry.cpp
  55. )
  56. endif()
  57. if(SCV_FOUND)
  58. if(ZLIB_FOUND)
  59. set(LIB_SOURCES ${LIB_SOURCES} src/scv_tr_compressed.cpp)
  60. endif(ZLIB_FOUND)
  61. if(FALSE)
  62. set(LIB_SOURCES ${LIB_SOURCES} src/scv_tr_binary/scv_tr_binary.cpp)
  63. if(CONAN_LEVELDB_ROOT)
  64. set(LIB_SOURCES ${LIB_SOURCES} src/scv_tr_ldb/scv_tr_ldb.cpp )
  65. endif()
  66. endif()
  67. set(LIB_SOURCES ${LIB_SOURCES} src/scv_tr_sqlite/scv_tr_sqlite.cpp src/scv_tr_sqlite/sqlite3.c )
  68. endif(SCV_FOUND)
  69. # Define two variables in order not to repeat ourselves.
  70. if(${CMAKE_VERSION} VERSION_LESS "3.13.0")
  71. link_directories(${SystemC_LIBRARY_DIRS})
  72. endif()
  73. # Define the scc library
  74. add_library(scc ${LIB_SOURCES})
  75. target_include_directories (scc PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/incl)
  76. if(HAVE_GETENV)
  77. target_compile_definitions(scc PUBLIC HAVE_GETENV)
  78. endif()
  79. FILE(GLOB LibHeaders incl/*.h)
  80. set_target_properties(scc PROPERTIES
  81. VERSION ${VERSION} # ${VERSION} was defined in the main CMakeLists.
  82. FRAMEWORK FALSE
  83. PUBLIC_HEADER "${LibHeaders}" # specify the public headers
  84. )
  85. target_link_libraries(scc scc-util ${CMAKE_DL_LIBS})
  86. if(${CMAKE_VERSION} VERSION_LESS "3.2.0")
  87. target_link_libraries(scc ${CMAKE_THREAD_LIBS_INIT})
  88. else()
  89. target_link_libraries(scc Threads::Threads)
  90. endif()
  91. if(CCI_FOUND)
  92. target_compile_definitions(scc PUBLIC -DWITH_CCI)
  93. target_include_directories (scc PUBLIC ${CCI_INCLUDE_DIRS})
  94. target_link_libraries(scc ${CCI_LIBRARIES} )
  95. if(NOT ${CMAKE_VERSION} VERSION_LESS "3.13.0")
  96. target_link_directories(scc PUBLIC ${CCI_LIBRARY_DIRS})
  97. endif()
  98. endif()
  99. if(SCV_FOUND)
  100. target_compile_definitions(scc PUBLIC -DWITH_SCV)
  101. target_include_directories (scc PUBLIC ${SCV_INCLUDE_DIRS})
  102. target_link_libraries (scc ${SCV_LIBRARIES})
  103. if(NOT ${CMAKE_VERSION} VERSION_LESS "3.13.0")
  104. target_link_directories(scc PUBLIC ${SCV_LIBRARY_DIRS})
  105. endif()
  106. endif()
  107. if(ZLIB_FOUND)
  108. target_link_libraries (scc ${ZLIB_LIBRARIES})
  109. endif(ZLIB_FOUND)
  110. target_include_directories (scc PUBLIC ${SystemC_INCLUDE_DIRS})
  111. target_link_libraries(scc ${SystemC_LIBRARIES} )
  112. if(NOT ${CMAKE_VERSION} VERSION_LESS "3.13.0")
  113. target_link_directories(scc PUBLIC ${SystemC_LIBRARY_DIRS})
  114. endif()
  115. # build a separate JSON library for the use in non-systemc based systems
  116. add_library(jsoncpp STATIC src/jsoncpp.cpp)
  117. target_include_directories (jsoncpp PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/incl)
  118. FILE(GLOB JsonLibHeaders incl/json/*.h)
  119. set_target_properties(jsoncpp PROPERTIES
  120. VERSION ${VERSION} # ${VERSION} was defined in the main CMakeLists.
  121. FRAMEWORK FALSE
  122. PUBLIC_HEADER "${JsonLibHeaders}" # specify the public headers
  123. )
  124. install(TARGETS jsoncpp
  125. RUNTIME DESTINATION bin
  126. LIBRARY DESTINATION lib
  127. ARCHIVE DESTINATION lib/static
  128. PUBLIC_HEADER DESTINATION include/json
  129. )
  130. install(TARGETS scc-util
  131. RUNTIME DESTINATION bin
  132. LIBRARY DESTINATION lib
  133. ARCHIVE DESTINATION lib/static
  134. PUBLIC_HEADER DESTINATION include/util
  135. )
  136. install(TARGETS scc
  137. RUNTIME DESTINATION bin
  138. LIBRARY DESTINATION lib
  139. ARCHIVE DESTINATION lib/static
  140. PUBLIC_HEADER DESTINATION include
  141. )
  142. install(
  143. DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/incl/
  144. DESTINATION include
  145. FILES_MATCHING PATTERN "*")