updating README and tests/examples
This commit is contained in:
parent
d41d409dec
commit
0672081c61
40
README.md
40
README.md
|
@ -16,22 +16,52 @@ articel under https://blog.ducthinh.net/gcc-no-such-file-python-h.
|
||||||
```
|
```
|
||||||
# create virtual environment
|
# create virtual environment
|
||||||
python3 -m venv pysysc-env
|
python3 -m venv pysysc-env
|
||||||
# and enable it
|
# and avtivate it
|
||||||
. pysysc-env/bin/activate
|
. pysysc-env/bin/activate
|
||||||
# install needed packages
|
# install needed packages
|
||||||
pip install --upgrade pip
|
python3 -m pip install --upgrade pip
|
||||||
|
# install wheel package
|
||||||
python3 -m pip install wheel
|
python3 -m pip install wheel
|
||||||
# install cppyy, C++ std version needs to match the version used to build the SystemC library
|
# install cppyy, C++ std version needs to match the version used to build the SystemC library
|
||||||
STDCXX=11 python3 -m pip install cppyy
|
STDCXX=11 python3 -m pip install cppyy
|
||||||
# clone of PySysC
|
# clone of PySysC
|
||||||
git clone https://git.minres.com/SystemC/PySysC.git
|
git clone https://git.minres.com/SystemC/PySysC.git
|
||||||
# install PySysC, for development PySysC use 'python3 -m pip install -e`
|
# install PySysC, for development PySysC use 'python3 -m pip install -e`
|
||||||
python3 -m pip install -e PySysC
|
SYSTEMC_HOME=<path to SystemC> python3 -m pip install -e PySysC
|
||||||
```
|
```
|
||||||
|
|
||||||
## Testing (preliminary)
|
## Running the example
|
||||||
|
|
||||||
To use the tests you also need to clone and build the PySysC-SC repo as sibling of PySysC. It contains the the code and libraries being used in the test.
|
To run the example you also need to clone and build the PySysC-SC repo. It contains the the code and libraries being used in the example. This project uses Conan.io as package manager so it should be installed (see down below).
|
||||||
|
To deactivate conan and use a SystemC installation just comment out the line `setup_conan()` in CMakeLists.txt and set the environment variable SYSTEMC_HOME.
|
||||||
|
|
||||||
|
### Run the router_eample.py
|
||||||
|
|
||||||
|
```
|
||||||
|
# get the PySysC-SC repo
|
||||||
|
git clone --recursive https://git.minres.com/SystemC/PySysC-SC.git
|
||||||
|
# build the project libraries as shared libs
|
||||||
|
cd PySysC-SC
|
||||||
|
mkdir -p build/Debug
|
||||||
|
cd build/Debug
|
||||||
|
cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=ON ../..
|
||||||
|
make -j components
|
||||||
|
cd ../..
|
||||||
|
# now we are ready to run the example
|
||||||
|
python3 router_eample.py
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
### Installing conan
|
||||||
|
|
||||||
|
```
|
||||||
|
# install conan into our virtual environment pysysc-env
|
||||||
|
python3 -m pip install conan
|
||||||
|
# create the default profile
|
||||||
|
conan profile new default --detect
|
||||||
|
# add the repo for SystemC packages used in the project
|
||||||
|
conan remote add minres https://api.bintray.com/conan/minres/conan-repo
|
||||||
|
```
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
|
|
|
@ -138,6 +138,16 @@ def _load_pythonization_lib():
|
||||||
if os.path.isfile(full_path):
|
if os.path.isfile(full_path):
|
||||||
cppyy.include(full_path)
|
cppyy.include(full_path)
|
||||||
return
|
return
|
||||||
|
# could not be found in sintall, maybe development environment
|
||||||
|
pkgDir = os.path.join(os.path.dirname( os.path.realpath(__file__)), '..')
|
||||||
|
for file in os.listdir(pkgDir):
|
||||||
|
if re.match(r'pysyscsc.*\.so', file):
|
||||||
|
cppyy.load_library(os.path.join(pkgDir, file))
|
||||||
|
full_path = os.path.join(pkgDir, 'PyScModule.h')
|
||||||
|
if os.path.isfile(full_path):
|
||||||
|
cppyy.include(full_path)
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def add_library(file, lib):
|
def add_library(file, lib):
|
||||||
|
|
|
@ -13,7 +13,7 @@ from cppyy import gbl as cpp
|
||||||
proj_home='../../PySysC-SC'
|
proj_home='../../PySysC-SC'
|
||||||
conan_res = scpy.read_config_from_conan(os.path.join(proj_home, 'conanfile.txt'))
|
conan_res = scpy.read_config_from_conan(os.path.join(proj_home, 'conanfile.txt'))
|
||||||
scpy.load_systemc()
|
scpy.load_systemc()
|
||||||
scpy.add_include_path(os.path.join(proj_home, 'sc-components/incl'))
|
scpy.add_include_path(os.path.join(proj_home, 'scc/incl'))
|
||||||
scpy.add_library('scc.h', os.path.join(proj_home, 'build/Debug/lib/libscc.so'))
|
scpy.add_library('scc.h', os.path.join(proj_home, 'build/Debug/lib/libscc.so'))
|
||||||
scpy.add_include_path(os.path.join(proj_home, 'components'))
|
scpy.add_include_path(os.path.join(proj_home, 'components'))
|
||||||
scpy.add_library('components.h', os.path.join(proj_home, 'build/Debug/lib/libcomponents.so'))
|
scpy.add_library('components.h', os.path.join(proj_home, 'build/Debug/lib/libcomponents.so'))
|
||||||
|
|
|
@ -22,7 +22,7 @@ class Test(unittest.TestCase):
|
||||||
conan_path=os.path.join(proj_home, 'conanfile.txt')
|
conan_path=os.path.join(proj_home, 'conanfile.txt')
|
||||||
conan_res = scpy.read_config_from_conan(conan_path)
|
conan_res = scpy.read_config_from_conan(conan_path)
|
||||||
scpy.load_systemc()
|
scpy.load_systemc()
|
||||||
scpy.add_include_path(os.path.join(proj_home, 'sc-components/incl'))
|
scpy.add_include_path(os.path.join(proj_home, 'scc/incl'))
|
||||||
scpy.add_library('scc.h', os.path.join(proj_home, 'build/Debug/lib/libscc.so'))
|
scpy.add_library('scc.h', os.path.join(proj_home, 'build/Debug/lib/libscc.so'))
|
||||||
scpy.add_include_path(os.path.join(proj_home, 'components'))
|
scpy.add_include_path(os.path.join(proj_home, 'components'))
|
||||||
scpy.add_library('components.h', os.path.join(proj_home, 'build/Debug/lib/libcomponents.so'))
|
scpy.add_library('components.h', os.path.join(proj_home, 'build/Debug/lib/libcomponents.so'))
|
||||||
|
|
Loading…
Reference in New Issue