forked from weihuayi/fealpy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,3 +40,4 @@ dist | |
*.png | ||
*.fig | ||
*.vtk | ||
*.so |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
cmake_minimum_required(VERSUION 3.0) | ||
project(fealpy_extent CXX) | ||
add_subdirectory(src) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
from setuptools import Extension, setup | ||
|
||
class get_pybind_include: | ||
"""Helper class to determine the pybind11 include path. The purpose of this class is | ||
to postpone importing pybind11 until it is actually installed, so that the | ||
``get_include()`` method can be invoked. | ||
""" | ||
def __init__(self, user=False): | ||
self.user = user | ||
|
||
def __str__(self): | ||
import pybind11 | ||
return pybind11.get_include(self.user) | ||
|
||
ext_modules = [ | ||
Extension( | ||
"fealpy_extent", | ||
[ | ||
"src/pybind11.cpp", | ||
], | ||
language="C++", | ||
include_dirs=[ | ||
get_pybind_include(), | ||
get_pybind_include(user=True) | ||
], | ||
libraries=["stdc++"], | ||
) | ||
] | ||
|
||
if __name__ == "__main__": | ||
setup(name='fealpy', | ||
version='1.0', | ||
description='FEALPy: Finite Element Analysis Library in Python', | ||
url='http://github.com/weihuayi/fealpy', | ||
author='Huayi Wei', | ||
author_email='[email protected]', | ||
license='GNU', | ||
packages=['fealpy'], | ||
install_requires=[ | ||
'numpy', | ||
'scipy', | ||
'matplotlib', | ||
'pyamg', | ||
'meshpy', | ||
'meshio' | ||
], | ||
ext_modules = ext_modules | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
find_package(pybind11 REQUIRED) | ||
FILE(GLOB SRCS "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp") | ||
pybind11_add_module(fealpy_extent ${SRCS}) | ||
target_link_libraries(fealpy_extent PRIVATE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include <pybind11/pybind11.h> | ||
#include <pybind11/stl.h> | ||
|
||
namespace py = pybind11; | ||
|
||
int add(int i, int j) { | ||
return i + j; | ||
} | ||
|
||
PYBIND11_MODULE(fealpy_extent, m){ | ||
m.doc() = "My first pybind11 example!"; | ||
m.def("add", &add, "A function which adds two numbers"); | ||
} |