-
Notifications
You must be signed in to change notification settings - Fork 38
/
setup.py
98 lines (89 loc) · 2.68 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext
from halo import Halo
__version__ = '3.1.0'
class get_pybind_include(object):
"""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)
cirkit_modules = [
Extension(
'cirkit',
['cli/cirkit.cpp',
'lib/mockturtle/lib/abcsat/satSolver.cpp',
'lib/mockturtle/lib/abcsat/satStore.cpp'],
include_dirs=[
get_pybind_include(),
get_pybind_include(user=True),
"cli",
"lib/alice/",
"lib/any",
"lib/cli11",
"lib/mockturtle/lib/abcsat",
"lib/mockturtle/lib/ez",
"lib/mockturtle/lib/fmt",
"lib/mockturtle/lib/json",
"lib/mockturtle/lib/kitty",
"lib/mockturtle/lib/lorina",
"lib/mockturtle/lib/percy",
"lib/mockturtle/lib/rang",
"lib/mockturtle/lib/sparsepp",
"lib/mockturtle/include"
],
define_macros=[
('ALICE_PYTHON', '1'),
('FMT_HEADER_ONLY', '1'),
('DISABLE_NAUTY', '1'),
('LIN64', '1'),
('ABC_NAMESPACE', 'pabc'),
('ABC_NO_USE_READLINE', '1')
],
language='c++'
)
]
class BuildExt(build_ext):
"""A custom build extension for adding compiler-specific options."""
@Halo(text='Compiling C++ sources... (be patient, this may take a few minutes)', spinner='dots')
def build_extensions(self):
ct = self.compiler.compiler_type
opts = []
if ct == 'unix':
opts.append('-O2')
opts.append('-DNDEBUG')
opts.append('-std=c++17')
opts.append('-Wno-register')
opts.append('-Wno-unknown-pragmas')
opts.append('-Wno-unused-function')
opts.append('-Wno-unused-variable')
opts.append('-Wno-deprecated-declarations')
opts.append('-Wno-switch')
else:
opts.append('/std:c++17')
for ext in self.extensions:
ext.extra_compile_args = opts
build_ext.build_extensions(self)
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name='cirkit',
version=__version__,
author='Mathias Soeken',
author_email='mathias.soeken@epfl.ch',
url='https://msoeken.github.io/cirkit.html',
description='A C++ logic synthesis framework',
long_description=long_description,
ext_modules=cirkit_modules,
install_requires=['pybind11>=2.2'],
cmdclass={'build_ext': BuildExt},
zip_safe=False,
classifiers=(
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent"
)
)