Replies: 4 comments 1 reply
-
Adding the following line doesn't seem to work (on Mac) CPMAddPackage("gh:accellera-official/systemc-common-practices#v0.1.0") I get this: [cmake] -- CPM: Adding package [email protected] (v0.1.0)
[cmake] CMake Warning (dev) at build/_deps/cpm-cmake-src/cmake/CPM.cmake:36 (message):
[cmake] CPM: A dependency is using a more recent CPM version
[cmake] (1.0.0-development-version) than the current project (0.40.2). It is
[cmake] recommended to upgrade CPM to the most recent version. See
[cmake] https://github.com/cpm-cmake/CPM.cmake for more information.
[cmake] Call Stack (most recent call first):
[cmake] build/_deps/systemc-common-practices-src/CMakeLists.txt:19 (include)
[cmake] This warning is for project developers. Use -Wno-dev to suppress it.
[cmake]
[cmake] -- CPM: Adding package [email protected] (v1.4.1)
[cmake] -- CPM: Adding package SystemCLanguage@ (master)
[cmake] [ 11%] Performing download step (git clone) for 'systemclanguage-populate'
[cmake] Cloning into 'systemclanguage-src'...
[cmake] fatal: invalid reference: master
[cmake] CMake Error at systemclanguage-subbuild/systemclanguage-populate-prefix/tmp/systemclanguage-populate-gitclone.cmake:61 (message):
[cmake] Failed to checkout tag: 'master'
[cmake]
[cmake]
[cmake] make[2]: *** [systemclanguage-populate-prefix/src/systemclanguage-populate-stamp/systemclanguage-populate-download] Error 1
[cmake] make[1]: *** [CMakeFiles/systemclanguage-populate.dir/all] Error 2
[cmake] make: *** [all] Error 2 |
Beta Was this translation helpful? Give feedback.
-
Here is my complete cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
project(FirstSystemCProject)
# System C 3 requires C++17
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Add the executable
add_executable(first_systemc main.cc)
# download CPM.cmake
file(
DOWNLOAD
https://github.com/cpm-cmake/CPM.cmake/releases/download/v0.40.2/CPM.cmake
${CMAKE_CURRENT_BINARY_DIR}/cmake/CPM.cmake
#EXPECTED_HASH SHA256=cc155ce02e7945e7b8967ddfaff0b050e958a723ef7aad3766d368940cb15494
)
include(build/cmake/CPM.cmake)
# Google Test Start
# include(FetchContent)
# FetchContent_Declare(
# googletest
# # Specify the commit you depend on and update it regularly.
# URL https://github.com/google/googletest/archive/5376968f6948923e2411081fd9372e71a59d8e77.zip
# )
# For Windows: Prevent overriding the parent project's compiler/linker settings
#set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
#FetchContent_MakeAvailable(googletest)
CPMAddPackage(
NAME gtest
GITHUB_REPOSITORY google/googletest
GIT_TAG v1.15.2
VERSION 1.15.2
OPTIONS
"INSTALL_GTEST OFF"
"gtest_force_shared_crt ON"
)
# Google Test End
# SCP start
CPMAddPackage("gh:accellera-official/systemc-common-practices#v0.1.0")
# SCP E
# Set the SystemC include and library directories
set(SYSTEMC_INCLUDE_DIR $ENV{SYSTEMC_HOME}/include)
set(SYSTEMC_LIBRARY_DIR $ENV{SYSTEMC_HOME}/lib)
# Build shared libary - this is what we ship
# Link against SystemC
target_include_directories(first_systemc PRIVATE ${SYSTEMC_INCLUDE_DIR})
target_link_libraries(first_systemc ${SYSTEMC_LIBRARY_DIR}/libsystemc${CMAKE_SHARED_LIBRARY_SUFFIX})
# Google Test
# Create GoogleTest environment
enable_testing()
add_executable(simple_module_unittest simple_module_unittest.cc)
target_include_directories(simple_module_unittest PRIVATE ${SYSTEMC_INCLUDE_DIR})
target_include_directories(simple_module_unittest PRIVATE ${spdlog_git_SRC_DIR}/include)
target_include_directories(
simple_module_unittest PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
target_link_libraries(simple_module_unittest gtest)
target_link_libraries(simple_module_unittest ${SYSTEMC_LIBRARY_DIR}/libsystemc${CMAKE_SHARED_LIBRARY_SUFFIX})
include(GoogleTest)
gtest_discover_tests(simple_module_unittest) And the file work when I don't try to add the system common practices. |
Beta Was this translation helpful? Give feedback.
-
I muked around a bit with this to optionally 1) Remove need for SystemC, 2) Remove need to use CCI. I've verified that it works in my minimal environment (with setting Change to set(WITH_SYSTEMC "true" CACHE STRING "Include SYSTEMC library")
if(WITH_SYSTEMC)
cpmaddpackage(
NAME SystemCLanguage
GIT_REPOSITORY ${GITHUB}accellera-official/systemc.git
GIT_SHALLOW True
GIT_TAG main
)
endif()
# ...
set(WITH_CCI "true" CACHE STRING "Include CCI library")
if(WITH_CCI)
cpmaddpackage(
NAME SystemCCCI
GIT_REPOSITORY ${GITHUB}accellera-official/cci.git
GIT_SHALLOW True
GIT_TAG main
)
endif() I also did the following changes to #include <set>
#include <map>
// ...
#ifdef HAS_CCI
sc_core::sc_verbosity cci_lookup(cci::cci_broker_handle broker,
std::string name) {
auto param_name = (name.empty()) ? SCP_LOG_LEVEL_PARAM_NAME
: name + "." SCP_LOG_LEVEL_PARAM_NAME;
auto h = broker.get_param_handle(param_name);
if (h.is_valid()) {
return verbosity.at(std::min<unsigned>(h.get_cci_value().get_int(),
verbosity.size() - 1));
} else {
auto val = broker.get_preset_cci_value(param_name);
if (val.is_int()) {
broker.lock_preset_value(param_name);
return verbosity.at(
std::min<unsigned>(val.get_int(), verbosity.size() - 1));
}
}
return sc_core::SC_UNSET;
}
#endif Happy to provide a pull request if changes makes sense. |
Beta Was this translation helpful? Give feedback.
-
Thanks for letting us know. We'll review ! |
Beta Was this translation helpful? Give feedback.
-
Hello,
I'm setting up a new SystemC environment and want to use
scp/report
. How do I modify myCMakeLists.txt
to automatically download and link it?/Robert
Beta Was this translation helpful? Give feedback.
All reactions