17
17
import os
18
18
import platform
19
19
20
+ # Get description from README.md
20
21
with open ("README.md" , encoding = "utf-8" ) as f :
21
22
LONG_DESCRIPTION = f .read ()
22
23
24
+ # Setup parallel compilation
23
25
if os .environ .get ("NPY_NUM_BUILD_JOBS" ):
24
- ParallelCompile ("NPY_NUM_BUILD_JOBS" ,
25
- needs_recompile = naive_recompile ).install ()
26
+ ParallelCompile ("NPY_NUM_BUILD_JOBS" , needs_recompile = naive_recompile ).install ()
26
27
else :
27
28
ParallelCompile (needs_recompile = naive_recompile ).install ()
28
29
29
- __version__ = "unknown"
30
+ # Default version
31
+ __version__ = "0.0.0"
30
32
for l in open ("include/SiPM.h" ).readlines ():
31
33
if "SIPM_VERSION" in l .split ():
32
34
__version__ = l .split ()[- 1 ].strip ('"' )
33
35
break
34
36
37
+ # Optimize for modern CPUs
35
38
extra_compile_args = [
36
39
"-DNDEBUG" ,
37
40
"-O3" ,
40
43
"-mfma" ,
41
44
"-mavx2" ,
42
45
]
43
- extra_link_args = []
44
46
47
+ # Custom compile flags for Mac-OS
45
48
if platform .system () == "Darwin" :
46
49
# On MacOS
47
50
extra_compile_args .append ("-fno-aligned-allocation" )
48
51
52
+ # Get files
49
53
sources = []
50
54
sources .extend (glob ("src/*.cpp" ))
51
55
sources .extend (glob ("python/*.cpp" ))
@@ -76,9 +80,7 @@ def __str__(self):
76
80
get_pybind_include (),
77
81
get_pybind_include (user = True ),
78
82
],
79
- define_macros = [("SIPM_VERSION" , __version__ )],
80
83
extra_compile_args = extra_compile_args ,
81
- extra_link_args = extra_link_args ,
82
84
language = "c++" ,
83
85
),
84
86
]
@@ -105,5 +107,6 @@ def __str__(self):
105
107
"License :: OSI Approved :: MIT License" ,
106
108
"Topic :: Scientific/Engineering :: Physics" ,
107
109
"Programming Language :: Python :: 3" ,
110
+ "Programming Language :: C++" ,
108
111
],
109
112
)
0 commit comments