update build system

This commit is contained in:
Eyck Jentzsch 2021-07-26 12:03:40 +02:00
parent d0f3a120fd
commit fc1ae4d57d
1 changed files with 18 additions and 11 deletions

View File

@ -4,9 +4,6 @@ project(dbt-core-tgc VERSION 1.0.0)
include(GNUInstallDirs)
conan_basic_setup()
find_package(Boost COMPONENTS program_options system thread filesystem REQUIRED)
if(WITH_LLVM)
if(DEFINED ENV{LLVM_HOME})
find_path (LLVM_DIR LLVM-Config.cmake $ENV{LLVM_HOME}/lib/cmake/llvm)
@ -57,13 +54,21 @@ target_compile_options(${PROJECT_NAME} PRIVATE -Wno-shift-count-overflow)
target_include_directories(${PROJECT_NAME} PUBLIC incl)
target_link_libraries(${PROJECT_NAME} PUBLIC softfloat scc-util jsoncpp)
target_link_libraries(${PROJECT_NAME} PUBLIC -Wl,--whole-archive dbt-core -Wl,--no-whole-archive)
target_link_libraries(${PROJECT_NAME} PUBLIC ${Boost_LIBRARIES} )
if(TARGET CONAN_PKG::elfio)
target_link_libraries(${PROJECT_NAME} PUBLIC CONAN_PKG::elfio)
elseif(TARGET elfio::elfio)
target_link_libraries(${PROJECT_NAME} PUBLIC elfio::elfio)
else()
message(FATAL_ERROR "No elfio library found, maybe a find_package() call is missing")
endif()
#target_link_libraries(${PROJECT_NAME} PUBLIC ${Boost_program_options_LIBRARY} ${Boost_system_LIBRARY} ${Boost_thread_LIBRARY} ${Boost_filesystem_LIBRARY} )
set_target_properties(${PROJECT_NAME} PROPERTIES
VERSION ${PROJECT_VERSION}
FRAMEWORK FALSE
PUBLIC_HEADER "${LIB_HEADERS}" # specify the public headers
)
include(FindSystemCPackage)
if(SystemC_FOUND)
add_library(${PROJECT_NAME}_sc src/sysc/core_complex.cpp)
target_compile_definitions(${PROJECT_NAME}_sc PUBLIC WITH_SYSTEMC)
@ -77,12 +82,6 @@ if(SystemC_FOUND)
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/incl/iss/arch/tgc_d.h)
target_compile_definitions(${PROJECT_NAME}_sc PRIVATE CORE_TGC_D)
endif()
target_include_directories(${PROJECT_NAME}_sc PUBLIC ../incl ${SystemC_INCLUDE_DIRS} ${CCI_INCLUDE_DIRS})
if(SCV_FOUND)
target_compile_definitions(${PROJECT_NAME}_sc PUBLIC WITH_SCV)
target_include_directories(${PROJECT_NAME}_sc PUBLIC ${SCV_INCLUDE_DIRS})
endif()
target_link_libraries(${PROJECT_NAME}_sc PUBLIC ${PROJECT_NAME} scc)
if(WITH_LLVM)
target_link_libraries(${PROJECT_NAME}_sc PUBLIC ${llvm_libs})
@ -95,6 +94,8 @@ if(SystemC_FOUND)
endif()
project(tgc-sim)
find_package(Boost COMPONENTS program_options system thread filesystem REQUIRED)
add_executable(${PROJECT_NAME} src/main.cpp)
# This sets the include directory for the reference project. This is the -I flag in gcc.
target_compile_definitions(${PROJECT_NAME} PRIVATE CORE_${CORE_NAME})
@ -105,7 +106,13 @@ endif()
# Links the target exe against the libraries
target_link_libraries(${PROJECT_NAME} dbt-core-tgc)
target_link_libraries(${PROJECT_NAME} jsoncpp)
target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES} )
if(TARGET Boost::program_options)
target_link_libraries(${PROJECT_NAME} Boost::program_options Boost::thread)
else()
target_link_libraries(${PROJECT_NAME} ${BOOST_program_options_LIBRARY} ${BOOST_thread_LIBRARY})
endif()
#target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES}) #${Boost_program_options_LIBRARY} ${Boost_system_LIBRARY} ${Boost_filesystem_LIBRARY} ${Boost_thread_LIBRARY} )
target_link_libraries(${PROJECT_NAME} ${CMAKE_DL_LIBS})
if (Tcmalloc_FOUND)
target_link_libraries(${PROJECT_NAME} ${Tcmalloc_LIBRARIES})
endif(Tcmalloc_FOUND)