diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index c4f241b7..51ffdc57 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -19,7 +19,7 @@ jobs: - name: Install & upgrade pip3 run: | apt-get -yy update - apt-get install -y python3-pip + apt-get install -y python3-pip pkg-config rm -rf /var/lib/apt/lists/* pip3 install --upgrade --user pip - name: Install dependencies @@ -41,7 +41,7 @@ jobs: - name: Install & upgrade pip3 run: | apt-get -yy update - apt-get install -y python3-pip + apt-get install -y python3-pip pkg-config rm -rf /var/lib/apt/lists/* pip3 install --upgrade --user pip - name: Install dependencies @@ -64,7 +64,7 @@ jobs: - name: Install & upgrade pip3 run: | apt-get -yy update - apt-get install -y python3-pip + apt-get install -y python3-pip pkg-config rm -rf /var/lib/apt/lists/* pip3 install --upgrade --user pip - name: Install dependencies @@ -84,7 +84,7 @@ jobs: - name: Install OpenMPI run: | sudo apt-get -yy update - sudo apt-get install -y libopenmpi-dev + sudo apt-get install -y libopenmpi-dev cmake libboost-all-dev libeigen3-dev pkg-config sudo rm -rf /var/lib/apt/lists/* - uses: BSFishy/pip-action@v1 with: @@ -94,10 +94,16 @@ jobs: git clone https://github.com/precice/precice.git precice-core mkdir -p precice cp precice-core/src/precice/SolverInterface.hpp precice/SolverInterface.hpp + cd precice-core + mkdir build && cd build + cmake .. -DPRECICE_MPICommunication=OFF -DPRECICE_PETScMapping=OFF -DPRECICE_PythonActions=OFF -DBUILD_TESTING=OFF - name: Install dependencies run: | python3 -c 'import toml; c = toml.load("pyproject.toml"); print("\n".join(c["build-system"]["requires"]))' | pip3 install -r /dev/stdin - name: Run setup test + env: + PKG_CONFIG_PATH: "precice-core/build" + PKG_CONFIG_SYSTEM_INCLUDE_PATH: 1 run: | export CFLAGS=-I$GITHUB_WORKSPACE python3 setup.py test @@ -113,7 +119,7 @@ jobs: - name: Install & upgrade pip3 run: | apt-get -yy update - apt-get install -y python3-pip + apt-get install -y python3-pip pkg-config rm -rf /var/lib/apt/lists/* pip3 install --upgrade --user pip - name: Run pip install @@ -132,7 +138,7 @@ jobs: - name: Install & upgrade pip3 run: | apt-get -yy update - apt-get install -y python3-pip + apt-get install -y python3-pip pkg-config rm -rf /var/lib/apt/lists/* pip3 install --upgrade --user pip - name: Run pip install diff --git a/.github/workflows/run-solverdummy.yml b/.github/workflows/run-solverdummy.yml index 60e83cf6..8003ef7f 100644 --- a/.github/workflows/run-solverdummy.yml +++ b/.github/workflows/run-solverdummy.yml @@ -17,7 +17,7 @@ jobs: - name: Install Dependencies run: | apt-get -qq update - apt-get -qq install software-properties-common python3-dev python3-pip git apt-utils + apt-get -qq install software-properties-common python3-dev python3-pip git apt-utils pkg-config rm -rf /var/lib/apt/lists/* - name: Install bindings run: pip3 install --user . diff --git a/cyprecice/cyprecice.pyx b/cyprecice/cyprecice.pyx index 52dc6f03..7d84c4ce 100644 --- a/cyprecice/cyprecice.pyx +++ b/cyprecice/cyprecice.pyx @@ -1207,7 +1207,7 @@ cdef class Interface: >>> vertex_id = 5 >>> value = interface.read_scalar_data(data_id, vertex_id) """ - cdef double _value + cdef double _value = 0 self.thisptr.readScalarData (data_id, vertex_id, _value) return _value diff --git a/pyproject.toml b/pyproject.toml index 0e050577..a618c480 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,3 @@ [build-system] # PEP 518 - minimum build system requirements -requires = ["setuptools", "wheel", "Cython>=0.29", "packaging", "pip>=19.0.0", "numpy", "mpi4py"] +requires = ["setuptools", "wheel", "Cython>=0.29", "packaging", "pip>=19.0.0", "numpy", "mpi4py", "pkgconfig"] diff --git a/setup.py b/setup.py index b6efc9ff..adbb8d37 100644 --- a/setup.py +++ b/setup.py @@ -52,6 +52,7 @@ from Cython.Distutils.build_ext import new_build_ext as build_ext from Cython.Build import cythonize import numpy +import pkgconfig # name of Interfacing API @@ -69,8 +70,10 @@ def get_extensions(is_test): bindings_sources = [os.path.join(PYTHON_BINDINGS_PATH, "cyprecice", "cyprecice" + ".pyx")] + compile_args += pkgconfig.cflags('libprecice').split() + if not is_test: - link_args.append("-lprecice") + link_args.append(pkgconfig.libs('libprecice')) if is_test: bindings_sources.append(os.path.join(PYTHON_BINDINGS_PATH, "test", "SolverInterface.cpp"))