Skip to content

Commit

Permalink
Merge branch 'cda-tum:main' into Adding-Original-SyReC-synthesizer
Browse files Browse the repository at this point in the history
  • Loading branch information
SmaranTum authored Sep 5, 2022
2 parents df5f02d + f898102 commit acbd748
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[build-system]
requires = [
"setuptools<64",
"setuptools>=45",
"setuptools_scm>=6.4",
"wheel>=0.37",
"ninja>=1.10; sys_platform != 'win32'",
Expand Down
17 changes: 11 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,17 @@


class CMakeExtension(Extension):
def __init__(self, name, sourcedir='', namespace=''):
def __init__(self, name, sourcedir=''):
Extension.__init__(self, name, sources=[])
self.sourcedir = os.path.abspath(sourcedir)
self.namespace = namespace


class CMakeBuild(build_ext):
def build_extension(self, ext):
from setuptools_scm import get_version
version = get_version(root='.', relative_to=__file__)

extdir = os.path.abspath(os.path.dirname(self.get_ext_fullpath(ext.namespace + ext.name)))
extdir = os.path.abspath(os.path.dirname(self.get_ext_fullpath(ext.name)))
# required for auto-detection of auxiliary "native" libs
if not extdir.endswith(os.path.sep):
extdir += os.path.sep
Expand Down Expand Up @@ -78,9 +77,15 @@ def build_extension(self, ext):
if not os.path.exists(self.build_temp):
os.makedirs(self.build_temp)
else:
os.remove(self.build_temp + "/CMakeCache.txt")
try:
os.remove(os.path.join(self.build_temp, "CMakeCache.txt"))
except OSError:
pass
subprocess.check_call(['cmake', ext.sourcedir] + cmake_args, cwd=self.build_temp)
subprocess.check_call(['cmake', '--build', '.', '--target', ext.name] + build_args, cwd=self.build_temp)
subprocess.check_call(
["cmake", "--build", ".", "--target", ext.name.split(".")[-1]] + build_args,
cwd=self.build_temp,
)


README_PATH = os.path.join(os.path.abspath(os.path.dirname(__file__)),
Expand All @@ -98,7 +103,7 @@ def build_extension(self, ext):
python_requires='>=3.7',
license="MIT",
# url="",
ext_modules=[CMakeExtension('pysyrec', namespace='mqt.syrec.')],
ext_modules=[CMakeExtension('mqt.syrec.pysyrec')],
cmdclass={"build_ext": CMakeBuild},
zip_safe=False,
packages=find_namespace_packages(include=['mqt.*']),
Expand Down

0 comments on commit acbd748

Please sign in to comment.