Browse Source

upate build system

master
Eyck Jentzsch 1 month ago
parent
commit
12bfeb1b76
2 changed files with 21 additions and 8 deletions
  1. +3
    -1
      CMakeLists.txt
  2. +18
    -7
      cmake/FindVerilator.cmake

+ 3
- 1
CMakeLists.txt View File

@ -122,7 +122,7 @@ if(SCV_FOUND )
endif()
endif()
set(LIB_SOURCES ${LIB_SOURCES} src/scv_tr_sqlite/scv_tr_sqlite.cpp src/scv_tr_sqlite/sqlite3.c )
endif(SCV_FOUND)
endif()
# Define two variables in order not to repeat ourselves.
if(${CMAKE_VERSION} VERSION_LESS "3.13.0")
@ -142,6 +142,7 @@ target_link_libraries(scc PUBLIC ${FMT_TARGET} ${SPDLOG_TARGET})
target_link_libraries(scc PUBLIC Threads::Threads)
if(CCI_FOUND)
message("Building SCC with CCI support")
target_compile_definitions(scc PUBLIC -DWITH_CCI)
target_include_directories (scc PUBLIC ${CCI_INCLUDE_DIRS})
target_link_libraries(scc PUBLIC ${CCI_LIBRARIES} )
@ -151,6 +152,7 @@ if(CCI_FOUND)
endif()
if(SCV_FOUND)
message("Building SCC with SCV support")
target_compile_definitions(scc PUBLIC -DWITH_SCV)
target_include_directories (scc PUBLIC ${SCV_INCLUDE_DIRS})
target_link_libraries (scc PUBLIC ${SCV_LIBRARIES})

+ 18
- 7
cmake/FindVerilator.cmake View File

@ -28,7 +28,17 @@ if (VERILATOR_FOUND)
endif()
find_package(PackageHandleStandardArgs REQUIRED)
find_package(OSCISystemC)
if(NOT SystemCPackage)
if(TARGET SystemC::SystemC)
set(SystemCPackage SystemC)
else()
set(SystemCPackage OSCISystemC)
endif()
endif()
message("Using ${SystemCPackage} package in verilator")
find_package(${SystemCPackage} REQUIRED)
find_program(VERILATOR_EXECUTABLE verilator
HINTS $ENV{VERILATOR_ROOT}
@ -74,8 +84,6 @@ set(SOURCES
add_library(verilated STATIC ${SOURCES})
target_link_libraries(verilated PRIVATE systemc)
set_target_properties(verilated PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
@ -84,8 +92,8 @@ set_target_properties(verilated PROPERTIES
target_include_directories(verilated SYSTEM PUBLIC
${VERILATOR_INCLUDE_DIR}/vltstd
${VERILATOR_INCLUDE_DIR}
${SYSTEMC_INCLUDE_DIRS}
)
target_include_directories (verilated PUBLIC ${SystemC_INCLUDE_DIRS})
if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
target_compile_options(verilated PRIVATE
@ -119,9 +127,10 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES Clang)
target_compile_options(verilated PRIVATE -Wno-everything)
endif()
add_library(verilated_custom STATIC ${SOURCES})
target_link_libraries(verilated PUBLIC ${SystemC_LIBRARIES} )
target_link_libraries(verilated_custom PRIVATE systemc)
add_library(verilated_custom STATIC ${SOURCES})
set_target_properties(verilated_custom PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
@ -131,8 +140,8 @@ set_target_properties(verilated_custom PROPERTIES
target_include_directories(verilated_custom SYSTEM PUBLIC
${VERILATOR_INCLUDE_DIR}/vltstd
${VERILATOR_INCLUDE_DIR}
${SYSTEMC_INCLUDE_DIRS}
)
target_include_directories (verilated_custom PUBLIC ${SystemC_INCLUDE_DIRS})
target_compile_definitions(verilated_custom PRIVATE VL_USER_FINISH VL_USER_STOP VL_USER_FATAL)
if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
@ -166,3 +175,5 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
elseif (CMAKE_CXX_COMPILER_ID MATCHES Clang)
target_compile_options(verilated_custom PRIVATE -Wno-everything)
endif()
target_link_libraries(verilated_custom PUBLIC ${SystemC_LIBRARIES} )

Loading…
Cancel
Save