Skip to content

Commit 6e96889

Browse files
committed
reorg flag setting
1 parent 9c1d113 commit 6e96889

File tree

3 files changed

+25
-27
lines changed

3 files changed

+25
-27
lines changed

mypyc/build_setup.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
try:
55
# Import setuptools so that it monkey-patch overrides distutils
6-
import setuptools
6+
import setuptools # noqa: F401
77
except ImportError:
88
pass
99

@@ -15,16 +15,16 @@
1515

1616
EXTRA_FLAGS_PER_COMPILER_TYPE_PER_PATH_COMPONENT = {
1717
"unix": {
18-
"base64/arch/ssse3": "-mssse3",
19-
"base64/arch/sse41": "-msse4.1",
20-
"base64/arch/sse42": "-msse4.2",
21-
"base64/arch/avx2": "-mavx2",
22-
"base64/arch/avx": "-mavx",
18+
"base64/arch/ssse3": ["-mssse3", "-DBASE64_WITH_SSSE3"],
19+
"base64/arch/sse41": ["-msse4.1", "-DBASE64_WITH_SSE41"],
20+
"base64/arch/sse42": ["-msse4.2", "-DBASE64_WITH_SSE42"],
21+
"base64/arch/avx2": ["-mavx2", "-DBASE64_WITH_AVX2"],
22+
"base64/arch/avx": ["-mavx", "-DBASE64_WITH_AVX"],
2323
},
2424
"msvc": {
25-
"base64/arch/sse42": "/arch:SSE4.2",
26-
"base64/arch/avx2": "/arch:AVX2",
27-
"base64/arch/avx": "/arch:AVX",
25+
"base64/arch/sse42": ["/arch:SSE4.2", "/DBASE64_WITH_SSE42"],
26+
"base64/arch/avx2": ["/arch:AVX2", "/DBASE64_WITH_AVX2"],
27+
"base64/arch/avx": ["/arch:AVX", "/DBASE64_WITH_AVX"],
2828
},
2929
}
3030

@@ -47,11 +47,13 @@ def spawn(self, cmd, **kwargs) -> None: # type: ignore[no-untyped-def]
4747
for path in extra_options.keys():
4848
if path in str(argument):
4949
if compiler_type == "bcpp":
50+
compiler = new_cmd.pop()
5051
# Borland accepts a source file name at the end,
5152
# insert the options before it
52-
new_cmd[-1:-1] = extra_options[path]
53+
new_cmd.extend(extra_options[path])
54+
new_cmd.append(compiler)
5355
else:
54-
new_cmd.append(extra_options[path])
56+
new_cmd.extend(extra_options[path])
5557

5658
# path component is found, no need to search any further
5759
break

mypyc/lib-rt/base64/config.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,16 @@
11
#ifndef BASE64_CONFIG_H
22
#define BASE64_CONFIG_H
33

4-
#define BASE64_WITH_SSSE3 1
54
#define HAVE_SSSE3 BASE64_WITH_SSSE3
65

7-
#define BASE64_WITH_SSE41 1
86
#define HAVE_SSE41 BASE64_WITH_SSE41
97

10-
#define BASE64_WITH_SSE42 1
118
#define HAVE_SSE42 BASE64_WITH_SSE42
129

13-
#define BASE64_WITH_AVX 1
1410
#define HAVE_AVX BASE64_WITH_AVX
1511

16-
#define BASE64_WITH_AVX2 1
1712
#define HAVE_AVX2 BASE64_WITH_AVX2
1813

19-
#define BASE64_WITH_AVX512 0
2014
#define HAVE_AVX512 BASE64_WITH_AVX512
2115

2216
#define BASE64_WITH_NEON32 0

mypyc/lib-rt/setup.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,16 @@
2727

2828
EXTRA_FLAGS_PER_COMPILER_TYPE_PER_PATH_COMPONENT = {
2929
"unix": {
30-
"base64/arch/ssse3": "-mssse3",
31-
"base64/arch/sse41": "-msse4.1",
32-
"base64/arch/sse42": "-msse4.2",
33-
"base64/arch/avx2": "-mavx2",
34-
"base64/arch/avx": "-mavx",
30+
"base64/arch/ssse3": ["-mssse3", "-DBASE64_WITH_SSSE3"],
31+
"base64/arch/sse41": ["-msse4.1", "-DBASE64_WITH_SSE41"],
32+
"base64/arch/sse42": ["-msse4.2", "-DBASE64_WITH_SSE42"],
33+
"base64/arch/avx2": ["-mavx2", "-DBASE64_WITH_AVX2"],
34+
"base64/arch/avx": ["-mavx", "-DBASE64_WITH_AVX"],
3535
},
3636
"msvc": {
37-
"base64/arch/sse42": "/arch:SSE4.2",
38-
"base64/arch/avx2": "/arch:AVX2",
39-
"base64/arch/avx": "/arch:AVX",
37+
"base64/arch/sse42": ["/arch:SSE4.2", "/DBASE64_WITH_SSE42"],
38+
"base64/arch/avx2": ["/arch:AVX2", "/DBASE64_WITH_AVX2"],
39+
"base64/arch/avx": ["/arch:AVX", "/DBASE64_WITH_AVX"],
4040
},
4141
}
4242

@@ -59,11 +59,13 @@ def spawn(self, cmd, **kwargs) -> None: # type: ignore[no-untyped-def]
5959
for path in extra_options.keys():
6060
if path in str(argument):
6161
if compiler_type == "bcpp":
62+
compiler = new_cmd.pop()
6263
# Borland accepts a source file name at the end,
6364
# insert the options before it
64-
new_cmd[-1:-1] = extra_options[path]
65+
new_cmd.extend(extra_options[path])
66+
new_cmd.append(compiler)
6567
else:
66-
new_cmd.append(extra_options[path])
68+
new_cmd.extend(extra_options[path])
6769

6870
# path component is found, no need to search any further
6971
break

0 commit comments

Comments
 (0)