2017-08-27 12:10:38 +02:00
|
|
|
# library files
|
|
|
|
FILE(GLOB RiscVHeaders *.h)
|
2018-04-24 10:26:55 +02:00
|
|
|
FILE(GLOB IssSources iss/*.cpp internal/*.cpp)
|
|
|
|
|
|
|
|
|
2017-08-27 12:10:38 +02:00
|
|
|
set(LIB_HEADERS ${RiscVHeaders} )
|
|
|
|
set(LIB_SOURCES
|
2018-04-24 10:26:55 +02:00
|
|
|
${IssSources}
|
2018-02-11 22:23:26 +01:00
|
|
|
plugin/instruction_count.cpp
|
2018-03-30 17:59:40 +02:00
|
|
|
plugin/cycle_estimate.cpp
|
2017-08-27 12:10:38 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
set(APP_HEADERS )
|
|
|
|
|
2017-09-21 20:29:23 +02:00
|
|
|
set(APP_SOURCES main.cpp)
|
2017-08-27 12:10:38 +02:00
|
|
|
|
|
|
|
# Define two variables in order not to repeat ourselves.
|
2018-07-28 09:45:49 +02:00
|
|
|
set(LIBRARY_NAME riscv)
|
2017-08-27 12:10:38 +02:00
|
|
|
|
|
|
|
# Define the library
|
2017-12-15 14:13:22 +01:00
|
|
|
#add_library(${LIBRARY_NAME} SHARED ${LIB_SOURCES})
|
|
|
|
add_library(${LIBRARY_NAME} ${LIB_SOURCES})
|
2017-09-26 17:10:10 +02:00
|
|
|
SET(${LIBRARY_NAME} -Wl,-whole-archive -l${LIBRARY_NAME} -Wl,-no-whole-archive)
|
2017-08-27 12:10:38 +02:00
|
|
|
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-sim)
|
2017-08-27 12:10:38 +02:00
|
|
|
|
|
|
|
add_executable(${APPLICATION_NAME} ${APP_SOURCES})
|
|
|
|
|
|
|
|
# Links the target exe against the libraries
|
|
|
|
target_link_libraries(${APPLICATION_NAME} ${LIBRARY_NAME})
|
|
|
|
target_link_libraries(${APPLICATION_NAME} dbt-core)
|
2018-04-24 10:26:55 +02:00
|
|
|
target_link_libraries(${APPLICATION_NAME} softfloat)
|
2017-08-27 12:10:38 +02:00
|
|
|
target_link_libraries(${APPLICATION_NAME} sc-components)
|
|
|
|
target_link_libraries(${APPLICATION_NAME} external)
|
|
|
|
target_link_libraries(${APPLICATION_NAME} ${llvm_libs})
|
|
|
|
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-08-27 12:10:38 +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
|
|
|
|
)
|
|
|
|
|