Skip to content

Commit

Permalink
FORMATTED.
Browse files Browse the repository at this point in the history
  • Loading branch information
leake committed Dec 5, 2023
1 parent 6e82873 commit 39865ab
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@

# Get long description
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
with open(path.join(this_directory, "README.md"), encoding="utf-8") as f:
long_description = f.read()
long_description = long_description.replace('<img src="https://github.com/leakec/tfc/blob/main/docs/Univariate_TFC_Animation.gif" width="600" height="467">',"",1)
long_description = long_description.replace(
'<img src="https://github.com/leakec/tfc/blob/main/docs/Univariate_TFC_Animation.gif" width="600" height="467">',
"",
1,
)

# Get numpy directory
try:
Expand All @@ -18,38 +22,40 @@

# Get version info
version_dict = {}
with open('src/tfc/version.py') as f:
exec(f.read(), version_dict)
version = version_dict["__version__"]
with open("src/tfc/version.py") as f:
exec(f.read(), version_dict)
version = version_dict["__version__"]

# In the future, can add -DHAS_CUDA to this to enable GPU support
if name == 'nt':
if name == "nt":
# Windows compile flags
cxxFlags = ["/O2", "/std:c++17", "/Wall", "/DWINDOWS_MSVC"]
else:
cxxFlags = ["-O3", "-std=c++17", "-Wall", "-Wextra", "-Wno-unused-parameter", "-fPIC"]

if sys.version_info >= (3, 8):
numpy_version = "numpy>=1.23.0"
else:
numpy_version = "numpy>=1.21.0"
if sys.version_info >= (3, 8):
numpy_version = "numpy>=1.23.0"
else:
numpy_version = "numpy>=1.21.0"

# Create basis function c++ extension
BF = Extension(
"tfc.utils.BF._BF",
sources=["src/tfc/utils/BF/BF.i","src/tfc/utils/BF/BF.cxx"],
sources=["src/tfc/utils/BF/BF.i", "src/tfc/utils/BF/BF.cxx"],
include_dirs=["src/tfc/utils/BF", numpy_include],
swig_opts=["-c++", "-doxygen", "-O", "-olddefs"],
extra_compile_args=cxxFlags,
extra_link_args=cxxFlags,
)


# Custom build options to include swig Python files
class build_py(_build_py):
def run(self):
self.run_command("build_ext")
super(build_py, self).run()


# Setup
setup(
name="tfc",
Expand All @@ -58,13 +64,13 @@ def run(self):
author_email="leakec57@gmail.com",
description="Theory of Functional Connections (TFC): A functional interpolation framework with applications in differential equations.",
long_description=long_description,
long_description_content_type='text/markdown',
long_description_content_type="text/markdown",
url="https://github.com/leakec/tfc.git",
license="MIT",
packages=find_packages("src"),
package_dir={"": "src"},
package_data={"": ["src/tfc/py.typed"]},
python_requires='>=3.9',
python_requires=">=3.9",
include_package_data=True,
ext_modules=[BF],
install_requires=[
Expand Down

0 comments on commit 39865ab

Please sign in to comment.