Compare commits
3 Commits
Author | SHA1 | Date |
---|---|---|
Eyck Jentzsch | 775872b190 | |
Eyck Jentzsch | 965a10c2f2 | |
Eyck Jentzsch | d620bea112 |
|
@ -3,13 +3,12 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${C
|
||||||
|
|
||||||
project(pysysc-sc)
|
project(pysysc-sc)
|
||||||
|
|
||||||
option(INSTALL_DEPENDENCIES "Should dependencies be installed when installing SCC" OFF)
|
set(ENABLE_SHARED TRUE CACHE BOOL "Build shared libraries")
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
include(BuildType)
|
include(BuildType)
|
||||||
include(clang-format)
|
include(clang-format)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 11)
|
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||||
|
@ -32,57 +31,56 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
||||||
set(warnings "/W4 /WX /EHsc")
|
set(warnings "/W4 /WX /EHsc")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
|
||||||
|
|
||||||
include(ConanInline)
|
include(ConanInline)
|
||||||
conan_check()
|
conan_check()
|
||||||
if(EXISTS /etc/redhat-release)
|
set(BOOST_OPTIONS
|
||||||
# Boost on CentOS quirks: the b2 of conan-center is build against a newer libstdc++ and therefore does not run
|
boost:fPIC=True
|
||||||
# with the oooooold libs on CentOS 7. Therefore we build our own version of b2 if it is not there
|
boost:shared=True
|
||||||
set(B2_VERSION 4.9.2)
|
boost:header_only=False
|
||||||
set(B2_META $ENV{HOME}/.conan/data/b2/${B2_VERSION}/_/_/metadata.json)
|
boost:without_context=True
|
||||||
if(DEFINED ENV{CONAN_USER_HOME})
|
boost:without_contract=True
|
||||||
set(B2_META $ENV{CONAN_USER_HOME}/.conan/data/b2/${B2_VERSION}/_/_/metadata.json)
|
boost:without_coroutine=True
|
||||||
endif()
|
boost:without_fiber=True
|
||||||
if(NOT EXISTS ${B2_META})
|
boost:without_graph=True
|
||||||
conan_configure(REQUIRES b2/${B2_VERSION})
|
boost:without_graph_parallel=True
|
||||||
conan_cmake_autodetect(settings)
|
boost:without_iostreams=True
|
||||||
conan_cmake_install(PATH_OR_REFERENCE . BUILD b2 SETTINGS ${settings})
|
boost:without_json=True
|
||||||
endif()
|
boost:without_locale=True
|
||||||
# Boost on CentOS quirks end
|
boost:without_log=True
|
||||||
endif()
|
boost:without_math=True
|
||||||
set(CONAN_PACKAGE_LIST fmt/8.0.1 spdlog/1.9.2 zlib/1.2.11 boost/1.75.0 yaml-cpp/0.7.0 lz4/1.9.3)
|
boost:without_mpi=True
|
||||||
if(BUILD_SCC_DOCUMENTATION)
|
boost:without_nowide=True
|
||||||
list(APPEND CONAN_PACKAGE_LIST doxygen/1.9.2)
|
boost:without_python=True
|
||||||
endif()
|
boost:without_random=True
|
||||||
set(CONAN_PACKAGE_OPTIONS fmt:header_only=True spdlog:header_only=True boost:without_stacktrace=True boost:shared=False boost:header_only=False)
|
boost:without_regex=True
|
||||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
boost:without_serialization=True
|
||||||
list(APPEND CONAN_PACKAGE_OPTIONS boost:fPIC=True)
|
boost:without_stacktrace=True
|
||||||
endif()
|
boost:without_test=True
|
||||||
|
boost:without_timer=True
|
||||||
|
boost:without_type_erasure=True
|
||||||
|
boost:without_wave=True
|
||||||
|
)
|
||||||
|
set(CONAN_PACKAGE_LIST fmt/8.0.1 spdlog/1.9.2 zlib/1.2.11 boost/1.75.0 yaml-cpp/0.7.0 jsoncpp/1.9.5 lz4/1.9.3)
|
||||||
|
set(CONAN_PACKAGE_OPTIONS fmt:header_only=True spdlog:header_only=True ${BOOST_OPTIONS})
|
||||||
if(NOT USE_CWR_SYSTEMC AND NOT USE_NCSC_SYSTEMC AND NOT DEFINED ENV{SYSTEMC_HOME})
|
if(NOT USE_CWR_SYSTEMC AND NOT USE_NCSC_SYSTEMC AND NOT DEFINED ENV{SYSTEMC_HOME})
|
||||||
set(CONAN_PACKAGE_LIST ${CONAN_PACKAGE_LIST} systemc/2.3.3 systemc-cci/1.0.0)
|
set(CONAN_PACKAGE_LIST ${CONAN_PACKAGE_LIST} systemc/2.3.3 systemc-cci/1.0.0)
|
||||||
set(CONAN_PACKAGE_OPTIONS ${CONAN_PACKAGE_OPTIONS} systemc-cci:shared=False)
|
set(CONAN_PACKAGE_OPTIONS ${CONAN_PACKAGE_OPTIONS} systemc-cci:shared=False)
|
||||||
endif()
|
endif()
|
||||||
|
conan_configure(REQUIRES ${CONAN_PACKAGE_LIST}
|
||||||
conan_configure(REQUIRES ${CONAN_PACKAGE_LIST} GENERATORS cmake_find_package OPTIONS ${CONAN_PACKAGE_OPTIONS})
|
GENERATORS cmake_find_package
|
||||||
if(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
|
OPTIONS ${CONAN_PACKAGE_OPTIONS}
|
||||||
conan_install(BUILD_TYPE Release)
|
)
|
||||||
else()
|
conan_install()
|
||||||
conan_install()
|
|
||||||
endif()
|
|
||||||
set(CONAN_CMAKE_SILENT_OUTPUT ON)
|
set(CONAN_CMAKE_SILENT_OUTPUT ON)
|
||||||
|
|
||||||
set(Boost_NO_BOOST_CMAKE ON) # Don't do a find_package in config mode before searching for a regular boost install.
|
|
||||||
|
|
||||||
# This line finds the boost lib and headers.
|
# This line finds the boost lib and headers.
|
||||||
set(Boost_NO_BOOST_CMAKE ON) # Don't do a find_package in config mode before searching for a regular boost install.
|
set(Boost_NO_BOOST_CMAKE ON) # Don't do a find_package in config mode before searching for a regular boost install.
|
||||||
find_package(Boost COMPONENTS program_options system thread REQUIRED)
|
find_package(Boost COMPONENTS program_options system thread REQUIRED)
|
||||||
find_package(spdlog REQUIRED)
|
|
||||||
find_package(lz4 REQUIRED)
|
|
||||||
find_package(fmt REQUIRED)
|
|
||||||
find_package(yaml-cpp REQUIRED)
|
|
||||||
|
|
||||||
include(SystemCPackage)
|
include(SystemCPackage)
|
||||||
|
find_package(spdlog REQUIRED)
|
||||||
|
find_package(fmt REQUIRED)
|
||||||
|
find_package(yaml-cpp REQUIRED)
|
||||||
|
find_package(lz4 REQUIRED)
|
||||||
|
|
||||||
add_subdirectory(scc)
|
add_subdirectory(scc)
|
||||||
add_subdirectory(vp_components)
|
add_subdirectory(vp_components)
|
||||||
|
|
|
@ -3,30 +3,31 @@ import logging
|
||||||
from cppyy import gbl as cpp
|
from cppyy import gbl as cpp
|
||||||
import pysysc
|
import pysysc
|
||||||
import pysysc.structural as struct
|
import pysysc.structural as struct
|
||||||
|
import pysysc.scc as scc
|
||||||
from pysysc.structural import Connection, Module, Signal, Simulation
|
from pysysc.structural import Connection, Module, Signal, Simulation
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# setup and load
|
# setup and load
|
||||||
###############################################################################
|
###############################################################################
|
||||||
logging.basicConfig(level=logging.INFO)
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
build_type='Debug'
|
build_type='Debug'
|
||||||
###############################################################################
|
###############################################################################
|
||||||
myDir = os.path.dirname( os.path.realpath(__file__))
|
myDir = os.path.dirname( os.path.realpath(__file__))
|
||||||
pysysc.load_systemc()
|
pysysc.load_systemc()
|
||||||
###############################################################################
|
###############################################################################
|
||||||
logging.debug("Loading SC-Components lib")
|
logging.debug("Loading SC-Components lib")
|
||||||
pysysc.add_include_path(os.path.join(myDir, 'scc/src/sysc'))
|
#pysysc.add_include_path(os.path.join(myDir, '../install/include'))
|
||||||
pysysc.add_include_path(os.path.join(myDir, 'scc/src/common'))
|
#pysysc.add_library('scc_util.h', os.path.join(myDir, '../install/lib64/libscc-util.so'))
|
||||||
pysysc.add_include_path(os.path.join(myDir, 'scc/third_party'))
|
#pysysc.add_library('scc_sysc.h', os.path.join(myDir, '../install/lib64/libscc-sysc.so'))
|
||||||
pysysc.add_library('scc_sysc.h', os.path.join(myDir, 'build/%s/scc/src/sysc/libscc-sysc.so'%build_type))
|
scc.load_lib(os.path.join(myDir, '../install'))
|
||||||
###############################################################################
|
###############################################################################
|
||||||
logging.debug("Loading Components lib")
|
logging.debug("Loading Components lib")
|
||||||
pysysc.add_include_path(os.path.join(myDir, 'vp_components'))
|
pysysc.add_include_path(os.path.join(myDir, 'vp_components'))
|
||||||
pysysc.add_library('components.h', os.path.join(myDir, 'build/%s/vp_components/libvp_components.so'%build_type))
|
pysysc.add_library('components.h', os.path.join(myDir, 'build/vp_components/libvp_components.so'))
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# configure
|
# configure
|
||||||
###############################################################################
|
###############################################################################
|
||||||
Simulation.setup(logging.root.level)
|
scc.setup(logging.root.level)
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# instantiate
|
# instantiate
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -51,6 +52,6 @@ struct.dump_structure()
|
||||||
simcontext = cpp.sc_core.sc_get_curr_simcontext()
|
simcontext = cpp.sc_core.sc_get_curr_simcontext()
|
||||||
objects = cpp.sc_core.sc_get_top_level_objects(simcontext)
|
objects = cpp.sc_core.sc_get_top_level_objects(simcontext)
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
Simulation.configure(enable_vcd=True)
|
scc.configure(enable_trace=True)
|
||||||
Simulation.run()
|
Simulation.run()
|
||||||
logging.debug("Done")
|
logging.debug("Done")
|
||||||
|
|
2
scc
2
scc
|
@ -1 +1 @@
|
||||||
Subproject commit f1d272d59fb597a1eb616a02ec6c0cf8684716df
|
Subproject commit d6b718cebd9712374b0fbe145da2920800480fac
|
|
@ -1,26 +1,13 @@
|
||||||
set(LIB_SOURCES
|
set(LIB_SOURCES
|
||||||
|
initiator.cpp
|
||||||
)
|
|
||||||
|
|
||||||
# Define the library
|
|
||||||
add_library(vp_components
|
|
||||||
initiator.cpp
|
|
||||||
target.cpp
|
target.cpp
|
||||||
clkgen.cpp
|
clkgen.cpp
|
||||||
resetgen.cpp)
|
resetgen.cpp
|
||||||
target_link_libraries(vp_components LINK_PUBLIC scc)
|
)
|
||||||
target_include_directories(vp_components PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
|
||||||
|
|
||||||
install(TARGETS vp_components
|
|
||||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
||||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
||||||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
|
||||||
)
|
|
||||||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/
|
|
||||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} # target directory
|
|
||||||
FILES_MATCHING # install only matched files
|
|
||||||
PATTERN "*.h" # select header files
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
|
# Define two variables in order not to repeat ourselves.
|
||||||
|
set(LIBRARY_NAME vp_components)
|
||||||
|
# Define the library
|
||||||
|
add_library(${LIBRARY_NAME} SHARED ${LIB_SOURCES})
|
||||||
|
target_link_libraries (${LIBRARY_NAME} LINK_PUBLIC scc)
|
||||||
|
target_include_directories (${LIBRARY_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
Loading…
Reference in New Issue