|
11 | 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 | 12 | # See the License for the specific language governing permissions and |
13 | 13 | # limitations under the License. |
| 14 | +import sys |
14 | 15 |
|
15 | 16 | from setuptools import setup, Extension |
16 | 17 | import glob |
|
26 | 27 |
|
27 | 28 | version = '1.11.dev0' |
28 | 29 |
|
29 | | -common_compile_args = [ |
30 | | - '-std=c++11', |
31 | | - '-fno-strict-aliasing', |
32 | | - '-O3', |
33 | | - '-g0', |
34 | | - f'-DVERSION_INFO={version}', |
35 | | -] |
| 30 | +if sys.platform.startswith('win'): |
| 31 | + common_compile_args = [ |
| 32 | + '/std:c++11', |
| 33 | + '/O2', |
| 34 | + f'/DVERSION_INFO={version}', |
| 35 | + ] |
| 36 | + arch_avx = ['/arch:AVX2'] |
| 37 | + arch_sse = ['/arch:SSE2'] |
| 38 | + arch_basic = [] |
| 39 | +else: |
| 40 | + common_compile_args = [ |
| 41 | + '-std=c++11', |
| 42 | + '-fno-strict-aliasing', |
| 43 | + '-O3', |
| 44 | + '-g0', |
| 45 | + f'-DVERSION_INFO={version}', |
| 46 | + ] |
| 47 | + arch_avx = ['-mavx2'] |
| 48 | + arch_sse = ['-msse2', '-mno-avx2'] |
| 49 | + arch_basic = [] |
| 50 | + |
36 | 51 | stim_detect_machine_architecture = Extension( |
37 | 52 | 'stim._detect_machine_architecture', |
38 | 53 | sources=MUX_SOURCE_FILES, |
39 | 54 | include_dirs=[pybind11.get_include(), "src"], |
40 | 55 | language='c++', |
41 | 56 | extra_compile_args=[ |
42 | 57 | *common_compile_args, |
43 | | - '-mno-sse2', |
44 | | - '-mno-avx2', |
| 58 | + *arch_basic, |
45 | 59 | ], |
46 | 60 | ) |
47 | 61 | stim_polyfill = Extension( |
|
51 | 65 | language='c++', |
52 | 66 | extra_compile_args=[ |
53 | 67 | *common_compile_args, |
54 | | - # I would specify -mno-sse2 but that causes build failures in non-stim code...? |
55 | | - '-mno-avx2', |
| 68 | + *arch_basic, |
56 | 69 | '-DSTIM_PYBIND11_MODULE_NAME=_stim_polyfill', |
57 | 70 | ], |
58 | 71 | ) |
|
63 | 76 | language='c++', |
64 | 77 | extra_compile_args=[ |
65 | 78 | *common_compile_args, |
66 | | - '-msse2', |
67 | | - '-mno-avx2', |
| 79 | + *arch_sse, |
68 | 80 | '-DSTIM_PYBIND11_MODULE_NAME=_stim_sse2', |
69 | 81 | ], |
70 | 82 | ) |
|
77 | 89 | # language='c++', |
78 | 90 | # extra_compile_args=[ |
79 | 91 | # *common_compile_args, |
80 | | -# '-msse2', |
81 | | -# '-mavx2', |
| 92 | +# *arch_avx, |
82 | 93 | # '-DSTIM_PYBIND11_MODULE_NAME=_stim_avx2', |
83 | 94 | # ], |
84 | 95 | # ) |
|
0 commit comments