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

CMakeLists.txt 4.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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. src/configurer.cpp
  33. src/jsoncpp.cpp
  34. )
  35. if(CCI_FOUND)
  36. set(LIB_SOURCES ${LIB_SOURCES}
  37. src/tracer_base.cpp
  38. src/tracer.cpp
  39. src/configurable_tracer.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 ${CMAKE_DL_LIBS})
  70. if(${CMAKE_VERSION} VERSION_LESS "3.2.0")
  71. target_link_libraries(${LIBRARY_NAME} ${CMAKE_THREAD_LIBS_INIT})
  72. else()
  73. target_link_libraries(${LIBRARY_NAME} Threads::Threads)
  74. endif()
  75. if(CCI_FOUND)
  76. target_compile_definitions(${LIBRARY_NAME} PUBLIC -DWITH_CCI)
  77. target_include_directories (${LIBRARY_NAME} PUBLIC ${CCI_INCLUDE_DIRS})
  78. target_link_libraries(${LIBRARY_NAME} ${CCI_LIBRARIES} )
  79. if(NOT ${CMAKE_VERSION} VERSION_LESS "3.13.0")
  80. target_link_directories(${LIBRARY_NAME} PUBLIC ${CCI_LIBRARY_DIRS})
  81. endif()
  82. endif()
  83. if(SCV_FOUND)
  84. target_compile_definitions(${LIBRARY_NAME} PUBLIC -DWITH_SCV)
  85. target_include_directories (${LIBRARY_NAME} PUBLIC ${SCV_INCLUDE_DIRS})
  86. target_link_libraries (${LIBRARY_NAME} ${SCV_LIBRARIES})
  87. if(NOT ${CMAKE_VERSION} VERSION_LESS "3.13.0")
  88. target_link_directories(${LIBRARY_NAME} PUBLIC ${SCV_LIBRARY_DIRS})
  89. endif()
  90. endif()
  91. if(ZLIB_FOUND)
  92. target_link_libraries (${LIBRARY_NAME} ${ZLIB_LIBRARIES})
  93. endif(ZLIB_FOUND)
  94. target_include_directories (${LIBRARY_NAME} PUBLIC ${SystemC_INCLUDE_DIRS})
  95. target_link_libraries(${LIBRARY_NAME} ${SystemC_LIBRARIES} )
  96. if(NOT ${CMAKE_VERSION} VERSION_LESS "3.13.0")
  97. target_link_directories(${LIBRARY_NAME} PUBLIC ${SystemC_LIBRARY_DIRS})
  98. endif()
  99. # build a separate JSON library for the use in non-systemc based systems
  100. add_library(jsoncpp STATIC src/jsoncpp.cpp)
  101. target_include_directories (jsoncpp PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/incl)
  102. FILE(GLOB JsonLibHeaders incl/json/*.h)
  103. set_target_properties(jsoncpp PROPERTIES
  104. VERSION ${VERSION} # ${VERSION} was defined in the main CMakeLists.
  105. FRAMEWORK FALSE
  106. PUBLIC_HEADER "${JsonLibHeaders}" # specify the public headers
  107. )
  108. install(TARGETS jsoncpp
  109. RUNTIME DESTINATION bin
  110. LIBRARY DESTINATION lib
  111. ARCHIVE DESTINATION lib/static
  112. PUBLIC_HEADER DESTINATION include/json
  113. )
  114. install(TARGETS scc-util
  115. RUNTIME DESTINATION bin
  116. LIBRARY DESTINATION lib
  117. ARCHIVE DESTINATION lib/static
  118. PUBLIC_HEADER DESTINATION include/util
  119. )
  120. install(TARGETS ${LIBRARY_NAME}
  121. RUNTIME DESTINATION bin
  122. LIBRARY DESTINATION lib
  123. ARCHIVE DESTINATION lib/static
  124. PUBLIC_HEADER DESTINATION include
  125. )
  126. install(
  127. DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/incl/
  128. DESTINATION include
  129. FILES_MATCHING PATTERN "*")