Commit e4f25850 authored by Andreas Dedner's avatar Andreas Dedner
Browse files

Merge branch 'feature/cmake-python-overhaul' into 'master'

refactor the way python is used in dune

See merge request !192
parents 3636466d 4f8f0868
Pipeline #40628 passed with stage
in 30 minutes and 46 seconds
......@@ -12,21 +12,21 @@ before_script:
- duneci-install-module https://gitlab.dune-project.org/core/dune-common.git
- duneci-install-module https://gitlab.dune-project.org/core/dune-geometry.git
debian-11-gcc-9-17-python:
image: registry.dune-project.org/docker/ci/debian:11
# no numpy version available for this image on the gitlab registry
# disable python bindings for now
ubuntu:18.04 clang-6-17:
image: registry.dune-project.org/docker/ci/ubuntu:18.04
script: duneci-standard-test
stage: test
variables:
DUNECI_TOOLCHAIN: gcc-9-17
# so we need some variables to build the dune-py module during execution of the first python test:
# we need to find the dune mdoule
DUNE_CONTROL_PATH: /duneci/modules:$CI_PROJECT_DIR
# the position for the dune-py module
DUNE_PY_DIR: /duneci/modules/dune-py
# during dune-py build this variable is used - do know a way to access
# the CMAKE_FLAGS used to build the modules...
DUNE_CMAKE_FLAGS: "-DCMAKE_CXX_COMPILER=g++-9 -DCMAKE_C_COMPILER=gcc-9 -DCMAKE_CXX_FLAGS='-std=c++17 -O2 -g -Wall -fdiagnostics-color=always' -DDUNE_ENABLE_PYTHONBINDINGS=ON -DDUNE_MAX_TEST_CORES=4 -DBUILD_SHARED_LIBS=TRUE -DDUNE_PYTHON_INSTALL_LOCATION=none -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE -DCMAKE_DISABLE_FIND_PACKAGE_LATEX=TRUE -DCMAKE_DISABLE_FIND_PACKAGE_Alberta=TRUE -DCMAKE_DISABLE_FIND_PACKAGE_Vc=TRUE -DCMAKE_DISABLE_DOCUMENTATION=TRUE"
# cmake flags we use for all dune moudle - important is that build shared libs is set (need some better way of doing this)
DUNECI_CMAKE_FLAGS: $DUNE_CMAKE_FLAGS
# finally set the python path to all modules
PYTHONPATH: /duneci/modules/dune-common/build-cmake/python:/duneci/modules/dune-geometry/build-cmake/python:$CI_PROJECT_DIR/build-cmake/python
DUNECI_TOOLCHAIN: clang-6-17
DUNECI_CMAKE_FLAGS: "-DDUNE_ENABLE_PYTHONBINDINGS=OFF"
tags: [duneci]
ubuntu:18.04 clang-5-17:
image: registry.dune-project.org/docker/ci/ubuntu:18.04
script: duneci-standard-test
stage: test
variables:
DUNECI_TOOLCHAIN: clang-5-17
DUNECI_CMAKE_FLAGS: "-DDUNE_ENABLE_PYTHONBINDINGS=OFF"
tags: [duneci]
......@@ -27,7 +27,6 @@ add_subdirectory(dune)
if( DUNE_ENABLE_PYTHONBINDINGS )
add_subdirectory(python)
dune_python_install_package(PATH python)
endif()
......
[build-system]
requires = ['setuptools', 'wheel', 'scikit-build', 'cmake', 'ninja', 'requests', 'dune-geometry>=2.8.0.dev0']
requires = ['dune-geometry>=2.8.0.dev0', 'pip', 'setuptools', 'wheel', 'scikit-build', 'cmake', 'ninja', 'requests']
build-backend = 'setuptools.build_meta'
add_subdirectory(dune)
configure_file(setup.py.in setup.py)
dune_python_install_package(
PATH "."
CMAKE_METADATA_FILE dune/localfunctions/metadata.cmake
DEPENDS _localfunctions
CMAKE_METADATA_FLAGS DUNE_OPTS_FILE
)
if(POLICY CMP0087)
cmake_policy(SET CMP0087 NEW)
endif()
add_subdirectory(localfunctions)
add_python_targets(dune
__init__
)
__import__('pkg_resources').declare_namespace(__name__)
......@@ -3,3 +3,7 @@ add_python_targets(localfunctions
)
dune_add_pybind11_module(NAME _localfunctions)
set_property(TARGET _localfunctions PROPERTY LINK_LIBRARIES dunecommon dunegeometry APPEND)
if(SKBUILD)
install(TARGETS _localfunctions LIBRARY DESTINATION python/dune/localfunctions)
endif()
from setuptools import setup, find_packages
pkg = [m for m in "${ProjectPythonRequires}".split(' ') if "dune" not in m]
setup(name="${ProjectName}",
namespace_packages=['dune'],
description="${ProjectDescription}",
version="${ProjectVersionString}",
author="${ProjectAuthor}",
author_email="${ProjectMaintainerEmail}",
packages = find_packages(),
zip_safe = 0,
package_data = {'': ['*.so']},
install_requires = pkg
)
import os, sys
try:
from dune.packagemetadata import metaData
except ImportError:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment