1 parent 6dabb04 commit f2c320aCopy full SHA for f2c320a
1 file changed
setup.py
@@ -29,6 +29,11 @@
29
BUILD_DOCS = os.getenv('BUILD_DOCS', '0') == '1'
30
31
32
+def get_openmp_flag():
33
+ default_flag = '-fopenmp' if sys.platform != 'win32' else '/openmp'
34
+ return os.getenv("OPENMP_FLAG", default_flag)
35
+
36
37
def get_extensions():
38
extensions = []
39
@@ -52,11 +57,8 @@ def get_extensions():
52
57
info = parallel_info()
53
58
if ('backend: OpenMP' in info and 'OpenMP not found' not in info
54
59
and sys.platform != 'darwin'):
55
- extra_compile_args['cxx'] += ['-DAT_PARALLEL_OPENMP']
56
- if sys.platform == 'win32':
- extra_compile_args['cxx'] += ['/openmp']
- else:
- extra_compile_args['cxx'] += ['-fopenmp']
60
+ extra_compile_args['cxx'] += ['-DAT_PARALLEL_OPENMP',
61
+ get_openmp_flag()]
62
else:
63
print('Compiling without OpenMP...')
64
0 commit comments