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

CMakeLists.txt 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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. FILE(GLOB LibHeaders incl/*.h incl/*/*.h)
  26. set(LIB_HEADERS ${LibHeaders} )
  27. set(LIB_SOURCES
  28. src/sc_logic_7.cpp
  29. src/utilities.cpp
  30. src/report.cpp
  31. src/perf_estimator.cpp
  32. src/io-redirector.cpp
  33. src/ordered_semaphore.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/configurer.cpp
  41. src/jsoncpp.cpp
  42. src/value_registry.cpp
  43. )
  44. endif()
  45. if(SCV_FOUND)
  46. if(ZLIB_FOUND)
  47. set(LIB_SOURCES ${LIB_SOURCES} src/scv_tr_compressed.cpp)
  48. endif(ZLIB_FOUND)
  49. if(FALSE)
  50. set(LIB_SOURCES ${LIB_SOURCES} src/scv_tr_binary/scv_tr_binary.cpp)
  51. if(CONAN_LEVELDB_ROOT)
  52. set(LIB_SOURCES ${LIB_SOURCES} src/scv_tr_ldb/scv_tr_ldb.cpp )
  53. endif()
  54. endif()
  55. set(LIB_SOURCES ${LIB_SOURCES} src/scv_tr_sqlite/scv_tr_sqlite.cpp src/scv_tr_sqlite/sqlite3.c )
  56. endif(SCV_FOUND)
  57. # Define two variables in order not to repeat ourselves.
  58. set(LIBRARY_NAME scc)
  59. if(${CMAKE_VERSION} VERSION_LESS "3.13.0")
  60. link_directories(${SystemC_LIBRARY_DIRS})
  61. endif()
  62. # Define the scc library
  63. add_library(${LIBRARY_NAME} ${LIB_SOURCES})
  64. target_include_directories (${LIBRARY_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/incl)
  65. set_target_properties(${LIBRARY_NAME} PROPERTIES
  66. VERSION ${VERSION} # ${VERSION} was defined in the main CMakeLists.
  67. FRAMEWORK FALSE
  68. PUBLIC_HEADER "${LIB_HEADERS}" # specify the public headers
  69. )
  70. target_link_libraries(${LIBRARY_NAME} scc-util )
  71. if(CCI_FOUND)
  72. target_compile_definitions(${LIBRARY_NAME} PUBLIC -DWITH_CCI)
  73. target_include_directories (${LIBRARY_NAME} PUBLIC ${CCI_INCLUDE_DIRS})
  74. target_link_libraries(${LIBRARY_NAME} ${CCI_LIBRARIES} )
  75. if(NOT ${CMAKE_VERSION} VERSION_LESS "3.13.0")
  76. target_link_directories(${LIBRARY_NAME} PUBLIC ${CCI_LIBRARY_DIRS})
  77. endif()
  78. endif()
  79. if(SCV_FOUND)
  80. target_compile_definitions(${LIBRARY_NAME} PUBLIC -DWITH_SCV)
  81. target_include_directories (${LIBRARY_NAME} PUBLIC ${SCV_INCLUDE_DIRS})
  82. target_link_libraries (${LIBRARY_NAME} ${SCV_LIBRARIES})
  83. if(NOT ${CMAKE_VERSION} VERSION_LESS "3.13.0")
  84. target_link_directories(${LIBRARY_NAME} PUBLIC ${SCV_LIBRARY_DIRS})
  85. endif()
  86. endif()
  87. if(ZLIB_FOUND)
  88. target_link_libraries (${LIBRARY_NAME} ${ZLIB_LIBRARIES})
  89. endif(ZLIB_FOUND)
  90. target_include_directories (${LIBRARY_NAME} PUBLIC ${SystemC_INCLUDE_DIRS})
  91. target_link_libraries(${LIBRARY_NAME} ${SystemC_LIBRARIES} )
  92. if(NOT ${CMAKE_VERSION} VERSION_LESS "3.13.0")
  93. target_link_directories(${LIBRARY_NAME} PUBLIC ${SystemC_LIBRARY_DIRS})
  94. endif()
  95. # build a separate JSON library for the use in non-systemc based systems
  96. add_library(jsoncpp STATIC src/jsoncpp.cpp)
  97. target_include_directories (jsoncpp PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/incl)
  98. FILE(GLOB JsonLibHeaders incl/json/*.h)
  99. set_target_properties(jsoncpp PROPERTIES
  100. VERSION ${VERSION} # ${VERSION} was defined in the main CMakeLists.
  101. FRAMEWORK FALSE
  102. PUBLIC_HEADER "${JsonLibHeaders}" # specify the public headers
  103. )
  104. install(TARGETS ${LIBRARY_NAME} jsoncpp scc-util
  105. RUNTIME DESTINATION bin
  106. LIBRARY DESTINATION lib
  107. ARCHIVE DESTINATION lib/static
  108. PUBLIC_HEADER DESTINATION include)