A SystemC productivity library for virtual platform development utilizing SCV and TLM2.0 https://www.minres.com/#opensource

CMakeLists.txt 4.5KB

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