clean-up of build system

This commit is contained in:
Eyck Jentzsch 2020-04-23 16:11:34 +02:00
parent 7f096a7d87
commit 19d76c2948
5 changed files with 15 additions and 90 deletions

View File

@ -4,8 +4,11 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${C
project(SCC_Test)
set(ENABLE_SCV TRUE CACHE BOOL "Enable use of SCV")
set(ENABLE_SHARED TRUE CACHE BOOL "Build shared libraries")
set(NO_SUBMODULE_CHECK FALSE CACHE BOOL "Disable the submodule check")
include(GitFunctions)
get_branch_from_git()
@ -33,12 +36,13 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
if(COMPILER_SUPPORTS_MARCH_NATIVE)
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
elseif(NOT(${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo"))
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
endif()
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
elseif(NOT(${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo"))
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
endif()
endif()
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
@ -57,29 +61,10 @@ find_package(Boost COMPONENTS program_options filesystem system thread REQUIRED)
# set-up SystemC and SCV
find_package(OSCISystemC)
if(SystemC_FOUND)
add_definitions(-DWITH_SYSTEMC)
include_directories(${SystemC_INCLUDE_DIRS})
link_directories(${SystemC_LIBRARY_DIRS})
else()
if(NOT SystemC_FOUND)
message( FATAL_ERROR "SystemC library not found." )
endif()
if(CCI_FOUND)
include_directories(${CCI_INCLUDE_DIRS})
link_directories(${CCI_LIBRARY_DIRS})
else()
message( FATAL_ERROR "SystemC CCI library not found." )
endif()
if(SCV_FOUND)
add_definitions(-DWITH_SCV)
link_directories(${SCV_LIBRARY_DIRS})
endif()
set(PROJECT_3PARTY_DIRS external sr_report sr_signal)
include(sc-components/cmake/clang-format.cmake)
add_subdirectory(sc-components)
add_subdirectory(examples)
add_subdirectory(tests)

View File

@ -1,39 +1,7 @@
cmake_minimum_required(VERSION 3.3)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/../cmake) # main (top) cmake dir
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) # project specific cmake dir
project (sc-components)
# Set the version number of your project here (format is MAJOR.MINOR.PATCHLEVEL - e.g. 1.0.0)
set(VERSION_MAJOR "0")
set(VERSION_MINOR "0")
set(VERSION_PATCH "1")
set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
include(Common)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
find_package(Threads)
find_package(OSCISystemC REQUIRED)
find_package(ZLIB)
if(SystemC_FOUND)
include_directories(${SystemC_INCLUDE_DIRS})
link_directories(${SystemC_LIBRARY_DIRS}
)
else()
message( FATAL_ERROR "SystemC library not found." )
endif()
if(ZLIB_FOUND)
include_directories( ${ZLIB_INCLUDE_DIRS} )
endif(ZLIB_FOUND)
cmake_minimum_required(VERSION 3.12)
if(SCV_FOUND)
add_definitions(-DWITH_SCV)
include_directories(${SCV_INCLUDE_DIRS})
link_directories(${SCV_LIBRARY_DIRS})
add_subdirectory(transaction_recording)
endif(SCV_FOUND)
endif()
add_subdirectory(simple_system)

View File

@ -1,6 +1,4 @@
cmake_minimum_required(VERSION 3.3)
# Add executable called "simple_system" that is built from the source files
# "scv_tr_recording_example.cpp". The extensions are automatically found.
cmake_minimum_required(VERSION 3.12)
add_executable (simple_system
plic.cpp
uart.cpp
@ -10,14 +8,5 @@ add_executable (simple_system
simple_system.cpp
sc_main.cpp
)
# Link the executable to the sc_components library. Since the sc_components library has
# public include directories we will use those link directories when building
# simple_system
target_link_libraries (simple_system LINK_PUBLIC scc)
#target_link_libraries (simple_system LINK_PUBLIC ${SystemC_LIBRARIES})
#target_link_libraries (simple_system LINK_PUBLIC ${SCV_LIBRARIES})
target_link_libraries (simple_system LINK_PUBLIC ${Boost_LIBRARIES} )
#target_link_libraries (simple_system LINK_PUBLIC ${CONAN_LIBS_LEVELDB})
#target_link_libraries (simple_system LINK_PUBLIC ${CMAKE_THREAD_LIBS_INIT})
#target_link_libraries (simple_system LINK_PUBLIC ${ZLIB_LIBRARY})
#target_link_libraries (simple_system LINK_PUBLIC ${CMAKE_DL_LIBS})

View File

@ -1,15 +1,5 @@
cmake_minimum_required(VERSION 3.3)
# Add executable called "transaction_recording" that is built from the source files
# "scv_tr_recording_example.cpp". The extensions are automatically found.
cmake_minimum_required(VERSION 3.12)
add_executable (transaction_recording
scv_tr_recording_example.cpp
)
# Link the executable to the sc_components library. Since the sc_components library has
# public include directories we will use those link directories when building
# transaction_recording
target_link_libraries (transaction_recording LINK_PUBLIC scc)
#target_link_libraries (transaction_recording LINK_PUBLIC ${Boost_LIBRARIES} )
#target_link_libraries (transaction_recording LINK_PUBLIC ${CONAN_LIBS_LEVELDB})
#target_link_libraries (transaction_recording LINK_PUBLIC ${ZLIB_LIBRARIES} )
#target_link_libraries (transaction_recording LINK_PUBLIC ${CMAKE_THREAD_LIBS_INIT})
#target_link_libraries (transaction_recording LINK_PUBLIC ${CMAKE_DL_LIBS})

View File

@ -1,12 +1,5 @@
cmake_minimum_required(VERSION 3.3)
cmake_minimum_required(VERSION 3.12)
add_executable (io_redirector_test
main.cpp
)
target_link_libraries (io_redirector_test LINK_PUBLIC scc)
#target_link_libraries (io_redirector_test LINK_PUBLIC ${SystemC_LIBRARIES})
#target_link_libraries (io_redirector_test LINK_PUBLIC ${SCV_LIBRARIES})
#target_link_libraries (io_redirector_test LINK_PUBLIC ${Boost_LIBRARIES} )
#target_link_libraries (io_redirector_test LINK_PUBLIC ${CONAN_LIBS_LEVELDB})
#target_link_libraries (io_redirector_test LINK_PUBLIC ${ZLIB_LIBRARIES} )
#target_link_libraries (io_redirector_test LINK_PUBLIC ${CMAKE_THREAD_LIBS_INIT})
#target_link_libraries (io_redirector_test LINK_PUBLIC ${CMAKE_DL_LIBS})