2017-09-21 20:29:23 +02:00
|
|
|
# library files
|
2018-11-08 13:31:28 +01:00
|
|
|
FILE(GLOB RiscVSCHeaders ${PROJECT_SOURCE_DIR}/incl/sysc/*.h ${PROJECT_SOURCE_DIR}/incl/sysc/*/*.h)
|
2017-09-21 20:29:23 +02:00
|
|
|
set(LIB_HEADERS ${RiscVSCHeaders} )
|
2018-11-08 13:31:28 +01:00
|
|
|
set(LIB_SOURCES
|
|
|
|
sysc/aon.cpp
|
|
|
|
sysc/BLDC.cpp
|
|
|
|
sysc/clint.cpp
|
|
|
|
sysc/dcmotor.cpp
|
|
|
|
sysc/gpio.cpp
|
|
|
|
sysc/h_bridge.cpp
|
|
|
|
sysc/hifive1.cpp
|
|
|
|
sysc/fe310.cpp
|
|
|
|
sysc/mcp_adc.cpp
|
|
|
|
sysc/plic.cpp
|
|
|
|
sysc/prci.cpp
|
|
|
|
sysc/pwm.cpp
|
|
|
|
sysc/sc_comm_singleton.cpp
|
|
|
|
sysc/spi.cpp
|
|
|
|
sysc/system.cpp
|
|
|
|
sysc/terminal.cpp
|
|
|
|
sysc/uart.cpp
|
|
|
|
CLIParser.cpp )
|
2017-09-21 20:29:23 +02:00
|
|
|
|
2018-07-13 20:04:07 +02:00
|
|
|
set(APP_SOURCES sc_main.cpp)
|
2017-09-21 20:29:23 +02:00
|
|
|
|
|
|
|
# Define two variables in order not to repeat ourselves.
|
2018-07-28 09:45:49 +02:00
|
|
|
set(LIBRARY_NAME platform)
|
2017-09-21 20:29:23 +02:00
|
|
|
|
2018-07-13 20:04:07 +02:00
|
|
|
## the following setting needs to be consistent with the library
|
|
|
|
#add_definitions(-DSC_DEFAULT_WRITER_POLICY=SC_MANY_WRITERS)
|
|
|
|
|
2017-09-21 20:29:23 +02:00
|
|
|
# Define the library
|
|
|
|
add_library(${LIBRARY_NAME} ${LIB_SOURCES})
|
|
|
|
|
|
|
|
set_target_properties(${LIBRARY_NAME} PROPERTIES
|
|
|
|
VERSION ${VERSION} # ${VERSION} was defined in the main CMakeLists.
|
|
|
|
FRAMEWORK FALSE
|
|
|
|
PUBLIC_HEADER "${LIB_HEADERS}" # specify the public headers
|
|
|
|
)
|
|
|
|
|
|
|
|
# This is a make target, so you can do a "make riscv-sc"
|
2018-07-28 09:45:49 +02:00
|
|
|
set(APPLICATION_NAME riscv.vp)
|
2017-09-21 20:29:23 +02:00
|
|
|
|
2018-11-08 13:31:28 +01:00
|
|
|
include_directories(${PROJECT_SOURCE_DIR}/incl)
|
2017-11-16 00:37:10 +01:00
|
|
|
include_directories(${CONAN_INCLUDE_DIRS_SEASOCKS})
|
2018-11-08 13:31:28 +01:00
|
|
|
add_definitions(-DWITH_SYSTEMC) # or -DSC_NO_WRITE_CHECK
|
2017-11-16 00:37:10 +01:00
|
|
|
include_directories(${SystemC_INCLUDE_DIRS})
|
2018-03-27 19:49:11 +02:00
|
|
|
include_directories(${CCI_INCLUDE_DIRS})
|
2018-11-08 13:31:28 +01:00
|
|
|
if(SCV_FOUND)
|
|
|
|
add_definitions(-DWITH_SCV)
|
|
|
|
include_directories(${SCV_INCLUDE_DIRS})
|
|
|
|
endif()
|
|
|
|
|
2017-11-16 00:37:10 +01:00
|
|
|
|
2018-11-08 13:31:28 +01:00
|
|
|
link_directories(${SystemC_LIBRARY_DIRS})
|
|
|
|
link_directories(${CCI_LIBRARY_DIRS})
|
2017-11-16 00:37:10 +01:00
|
|
|
link_directories(${CONAN_LIB_DIRS_SEASOCKS})
|
2017-10-05 14:53:52 +02:00
|
|
|
|
2017-09-21 20:29:23 +02:00
|
|
|
add_executable(${APPLICATION_NAME} ${APP_SOURCES})
|
2018-11-08 13:31:28 +01:00
|
|
|
# include files for this application
|
|
|
|
target_include_directories(${APPLICATION_NAME} SYSTEM PRIVATE ${LLVM_INCLUDE_DIRS})
|
2017-09-21 20:29:23 +02:00
|
|
|
# Links the target exe against the libraries
|
|
|
|
target_link_libraries(${APPLICATION_NAME} ${LIBRARY_NAME})
|
2018-07-28 09:45:49 +02:00
|
|
|
target_link_libraries(${APPLICATION_NAME} riscv)
|
2017-09-21 20:29:23 +02:00
|
|
|
target_link_libraries(${APPLICATION_NAME} dbt-core)
|
2018-04-24 10:26:55 +02:00
|
|
|
target_link_libraries(${APPLICATION_NAME} softfloat)
|
2017-09-21 20:29:23 +02:00
|
|
|
target_link_libraries(${APPLICATION_NAME} sc-components)
|
2017-11-16 00:37:10 +01:00
|
|
|
target_link_libraries(${APPLICATION_NAME} ${CONAN_LIBS_SEASOCKS})
|
2017-09-21 20:29:23 +02:00
|
|
|
target_link_libraries(${APPLICATION_NAME} external)
|
|
|
|
target_link_libraries(${APPLICATION_NAME} ${llvm_libs})
|
2018-03-27 19:49:11 +02:00
|
|
|
target_link_libraries(${APPLICATION_NAME} ${CCI_LIBRARIES} )
|
2017-09-21 20:29:23 +02:00
|
|
|
target_link_libraries(${APPLICATION_NAME} ${SystemC_LIBRARIES} )
|
|
|
|
if(SCV_FOUND)
|
2017-10-29 20:56:20 +01:00
|
|
|
link_directories(${SCV_LIBRARY_DIRS})
|
2017-09-21 20:29:23 +02:00
|
|
|
target_link_libraries (${APPLICATION_NAME} ${SCV_LIBRARIES})
|
|
|
|
endif()
|
|
|
|
target_link_libraries(${APPLICATION_NAME} ${Boost_LIBRARIES} )
|
2017-09-25 20:38:40 +02:00
|
|
|
if (Tcmalloc_FOUND)
|
|
|
|
target_link_libraries(${APPLICATION_NAME} ${Tcmalloc_LIBRARIES})
|
|
|
|
endif(Tcmalloc_FOUND)
|
2017-09-21 20:29:23 +02:00
|
|
|
|
|
|
|
# Says how and where to install software
|
|
|
|
# Targets:
|
|
|
|
# * <prefix>/lib/<libraries>
|
|
|
|
# * header location after install: <prefix>/include/<project>/*.h
|
|
|
|
# * headers can be included by C++ code `#<project>/Bar.hpp>`
|
|
|
|
install(TARGETS ${LIBRARY_NAME} ${APPLICATION_NAME}
|
|
|
|
EXPORT ${PROJECT_NAME}Targets # for downstream dependencies
|
|
|
|
ARCHIVE DESTINATION lib COMPONENT libs # static lib
|
|
|
|
RUNTIME DESTINATION bin COMPONENT libs # binaries
|
|
|
|
LIBRARY DESTINATION lib COMPONENT libs # shared lib
|
|
|
|
FRAMEWORK DESTINATION bin COMPONENT libs # for mac
|
|
|
|
PUBLIC_HEADER DESTINATION incl/${PROJECT_NAME} COMPONENT devel # headers for mac (note the different component -> different package)
|
|
|
|
INCLUDES DESTINATION incl # headers
|
|
|
|
)
|
|
|
|
|