Commit 1dfa3b2c authored by Andreas Dedner's avatar Andreas Dedner
Browse files

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

Feature/cmake python overhaul

See merge request extensions/dune-vtk!31
parents 0a1aad4d 0b8555c6
......@@ -29,7 +29,6 @@ add_subdirectory(cmake/modules)
# if Python bindings are enabled, include necessary sub directories.
if( DUNE_ENABLE_PYTHONBINDINGS )
add_subdirectory(python)
dune_python_install_package(PATH python)
endif()
# finalize the dune project, e.g. generating config.h etc.
......
add_subdirectory(dune)
configure_file(setup.py.in setup.py)
dune_python_install_package(
PATH "." # relative path containing the package
DEPENDS _vtk
CMAKE_METADATA_FILE dune/vtk/metadata.cmake # metadata file to generate
CMAKE_METADATA_FLAGS DUNE_OPTS_FILE
)
if(POLICY CMP0087)
cmake_policy(SET CMP0087 NEW)
endif()
__import__('pkg_resources').declare_namespace(__name__)
......@@ -3,3 +3,6 @@ add_python_targets(vtk
)
dune_add_pybind11_module(NAME _vtk)
set_property(TARGET _vtk PROPERTY LINK_LIBRARIES dunecommon dunegeometry dunegrid dunevtk APPEND)
if(SKBUILD)
install(TARGETS _vtk LIBRARY DESTINATION python/dune/vtk)
endif()
......@@ -18,17 +18,17 @@ def load(includes, typeName):
allCollectors = {
"continuous":
lambda grid:
"ContinuousDataCollector<"+grid._typeName+">",
"ContinuousDataCollector<"+grid.cppTypeName+">",
"lagrange":
lambda grid, **kwargs:
"Dune::Vtk::LagrangeDataCollector<"+grid._typeName+","+str(kwargs["order"])+">"
"Dune::Vtk::LagrangeDataCollector<"+grid.cppTypeName+","+str(kwargs["order"])+">"
}
allWriters = {
"default": [ lambda grid:
"Dune::VtkUnstructuredGridWriter<"+grid._typeName+">",
"Dune::VtkUnstructuredGridWriter<"+grid.cppTypeName+">",
["dune/vtk/writers/vtkunstructuredgridwriter.hh"] ],
"lagrange": [ lambda grid, **kwargs:
"Dune::VtkUnstructuredGridWriter<"+grid._typeName+","+\
"Dune::VtkUnstructuredGridWriter<"+grid.cppTypeName+","+\
allCollectors["lagrange"](grid,**kwargs)+">",
["dune/vtk/writers/vtkunstructuredgridwriter.hh",
"dune/vtk/datacollectors/lagrangedatacollector.hh"] ]
......
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
)
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