diff --git a/.cproject b/.cproject index f3b6b26..82a9744 100644 --- a/.cproject +++ b/.cproject @@ -1,134 +1,296 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml index 233e805..a6b251d 100644 --- a/.settings/language.settings.xml +++ b/.settings/language.settings.xml @@ -1,29 +1,54 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CMakeLists.txt b/CMakeLists.txt index dca1266..ec1a663 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,11 @@ -cmake_minimum_required(VERSION 3.3) +cmake_minimum_required(VERSION 3.12) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_CURRENT_SOURCE_DIR}/sc-components/cmake) +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() @@ -16,7 +18,9 @@ set(GIT_SUBMODULE_DIR_sc-components .) set(GIT_SUBMODULE_BRANCH_sc-components ${GIT_BRANCH}) include(GNUInstallDirs) -include(Submodules) +if(NOT NO_SUBMODULE_CHECK) + include(Submodules) +endif() include(Conan) include(BuildType) @@ -52,7 +56,7 @@ set(Boost_NO_BOOST_CMAKE ON) # Don't do a find_package in config mode before se find_package(Boost COMPONENTS program_options filesystem system thread REQUIRED) # set-up SystemC and SCV -find_package(SystemC) +find_package(OSCISystemC) if(SystemC_FOUND) add_definitions(-DWITH_SYSTEMC) include_directories(${SystemC_INCLUDE_DIRS}) @@ -78,7 +82,7 @@ include(sc-components/cmake/clang-format.cmake) add_subdirectory(sc-components) add_subdirectory(examples) -#add_subdirectory(test) +add_subdirectory(tests) # # SYSTEM PACKAGING (RPM, TGZ, ...) diff --git a/cmake/Conan.cmake b/cmake/Conan.cmake index 5bd9930..946ccb9 100644 --- a/cmake/Conan.cmake +++ b/cmake/Conan.cmake @@ -1,5 +1,5 @@ macro(setup_conan) - find_program(conan conan) + find_program(conan conan PATHS /usr/bin /usr/local/bin) if(NOT EXISTS ${conan}) message(FATAL_ERROR "Conan is required. Please see README.md") return() diff --git a/conanfile.txt b/conanfile.txt index 6f2500c..fab2ef6 100644 --- a/conanfile.txt +++ b/conanfile.txt @@ -1,8 +1,6 @@ [requires] gsl_microsoft/20180102@bincrafters/stable - fmt/5.2.1@bincrafters/stable - spdlog/0.16.3@bincrafters/stable - SystemC/2.3.2@minres/stable + fmt/6.1.2 SystemCVerification/2.0.1@minres/stable SystemC-CCI/1.0.0@minres/stable diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 404c47c..84e9746 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -15,7 +15,7 @@ include(Common) list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) find_package(Threads) -find_package(SystemC REQUIRED) +find_package(OSCISystemC REQUIRED) find_package(ZLIB) if(SystemC_FOUND) include_directories(${SystemC_INCLUDE_DIRS}) diff --git a/examples/simple_system/CMakeLists.txt b/examples/simple_system/CMakeLists.txt index a473f3e..7ff4ba8 100644 --- a/examples/simple_system/CMakeLists.txt +++ b/examples/simple_system/CMakeLists.txt @@ -13,11 +13,11 @@ add_executable (simple_system # 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 sc-components) -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 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}) +#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}) diff --git a/examples/simple_system/sc_main.cpp b/examples/simple_system/sc_main.cpp index 162209f..c010078 100644 --- a/examples/simple_system/sc_main.cpp +++ b/examples/simple_system/sc_main.cpp @@ -39,11 +39,6 @@ const size_t ERROR_UNHANDLED_EXCEPTION = 2; } // namespace int sc_main(int argc, char *argv[]) { - /////////////////////////////////////////////////////////////////////////// - // setup initial logging - /////////////////////////////////////////////////////////////////////////// LOGGER(DEFAULT)::reporting_level() = l; - LOGGER(DEFAULT)::reporting_level() = logging::INFO; - LOGGER(SystemC)::reporting_level() = logging::INFO; /////////////////////////////////////////////////////////////////////////// // CLI argument parsing /////////////////////////////////////////////////////////////////////////// diff --git a/examples/transaction_recording/CMakeLists.txt b/examples/transaction_recording/CMakeLists.txt index d34e774..0c577e3 100644 --- a/examples/transaction_recording/CMakeLists.txt +++ b/examples/transaction_recording/CMakeLists.txt @@ -7,11 +7,9 @@ add_executable (transaction_recording # 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 sc-components) -target_link_libraries (transaction_recording LINK_PUBLIC ${SystemC_LIBRARIES}) -target_link_libraries (transaction_recording LINK_PUBLIC ${SCV_LIBRARIES}) -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}) +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}) diff --git a/examples/transaction_recording/scv_tr_recording_example.cpp b/examples/transaction_recording/scv_tr_recording_example.cpp index e1ef212..329cc49 100644 --- a/examples/transaction_recording/scv_tr_recording_example.cpp +++ b/examples/transaction_recording/scv_tr_recording_example.cpp @@ -351,8 +351,7 @@ inline const char* init_db(char type){ int sc_main(int argc, char *argv[]) { auto start = std::chrono::system_clock::now(); scv_startup(); - scc::init_logging(logging::INFO); - LOGGER(SystemC)::print_time() = false; + scc::init_logging(scc::LogConfig().logLevel(logging::DEBUG)); const char *fileName = argc==2? init_db(argv[1][0]): "my_db.txlog"; if(argc<2) scv_tr_text_init(); scv_tr_db db(fileName); diff --git a/sc-components b/sc-components index ae1b9cc..213293b 160000 --- a/sc-components +++ b/sc-components @@ -1 +1 @@ -Subproject commit ae1b9ccfede4a5a7e12ba68416cb8a0767752887 +Subproject commit 213293bc01287e8104ca8b03e552d69376ebb7a3 diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..92ab0b1 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(io-redirector) diff --git a/tests/io-redirector/CMakeLists.txt b/tests/io-redirector/CMakeLists.txt new file mode 100644 index 0000000..f67b82a --- /dev/null +++ b/tests/io-redirector/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.3) +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}) diff --git a/tests/io-redirector/main.cpp b/tests/io-redirector/main.cpp new file mode 100644 index 0000000..e551e1f --- /dev/null +++ b/tests/io-redirector/main.cpp @@ -0,0 +1,22 @@ +/* + * main.cpp + * + * Created on: 01.01.2019 + * Author: eyck + */ + +#include +#include +#include +#include + +int main(int arcg, char* argv[]){ + IoRedirector::get().start(); + auto result1 = IoRedirector::get().get_output(); + assert(result1==""); + printf("Some output"); + std::cout<<"Some other output"<