forked from softwareQinc/qpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
42 lines (36 loc) · 1.14 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
import subprocess
import sys
from glob import glob
from pybind11.setup_helpers import Pybind11Extension
from setuptools import setup
p = subprocess.Popen("cmake pyqpp",
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
prefix = "Detecting Eigen3 - done (in "
eigen_path = None
print("Running cmake pyqpp")
for line in p.stdout.read().decode('ascii').split('\n'):
print(line)
pos = line.find(prefix)
if pos != -1:
eigen_path = line[pos + len(prefix):-1]
break
if eigen_path is None:
raise Exception('Eigen3 not found!')
source_files = [f for f in sorted(glob("pyqpp/**/*.cpp", recursive=True))]
ext_modules = [
Pybind11Extension(
"pyqpp",
source_files,
extra_compile_args=["-Ilibs", "-Iinclude", "-Iqasmtools/include",
"-Ipyqpp/include",
"-I" + eigen_path,
"-DQPP_IDX_DEFAULT",
"-DQPP_BIGINT_DEFAULT",
"-DQPP_FP_DEFAULT"],
cxx_std=17,
include_pybind11=False,
),
]
setup()