@@ -924,47 +924,6 @@ def parse_s_args(args):
924
924
return (settings_changes , newargs )
925
925
926
926
927
- def emsdk_cflags (user_args ):
928
- cflags = ['--sysroot=' + cache .get_sysroot (absolute = True )]
929
-
930
- def array_contains_any_of (hay , needles ):
931
- for n in needles :
932
- if n in hay :
933
- return True
934
-
935
- if array_contains_any_of (user_args , SIMD_INTEL_FEATURE_TOWER ) or array_contains_any_of (user_args , SIMD_NEON_FLAGS ):
936
- if '-msimd128' not in user_args and '-mrelaxed-simd' not in user_args :
937
- exit_with_error ('Passing any of ' + ', ' .join (SIMD_INTEL_FEATURE_TOWER + SIMD_NEON_FLAGS ) + ' flags also requires passing -msimd128 (or -mrelaxed-simd)!' )
938
- cflags += ['-D__SSE__=1' ]
939
-
940
- if array_contains_any_of (user_args , SIMD_INTEL_FEATURE_TOWER [1 :]):
941
- cflags += ['-D__SSE2__=1' ]
942
-
943
- if array_contains_any_of (user_args , SIMD_INTEL_FEATURE_TOWER [2 :]):
944
- cflags += ['-D__SSE3__=1' ]
945
-
946
- if array_contains_any_of (user_args , SIMD_INTEL_FEATURE_TOWER [3 :]):
947
- cflags += ['-D__SSSE3__=1' ]
948
-
949
- if array_contains_any_of (user_args , SIMD_INTEL_FEATURE_TOWER [4 :]):
950
- cflags += ['-D__SSE4_1__=1' ]
951
-
952
- # Handle both -msse4.2 and its alias -msse4.
953
- if array_contains_any_of (user_args , SIMD_INTEL_FEATURE_TOWER [5 :]):
954
- cflags += ['-D__SSE4_2__=1' ]
955
-
956
- if array_contains_any_of (user_args , SIMD_INTEL_FEATURE_TOWER [7 :]):
957
- cflags += ['-D__AVX__=1' ]
958
-
959
- if array_contains_any_of (user_args , SIMD_NEON_FLAGS ):
960
- cflags += ['-D__ARM_NEON__=1' ]
961
-
962
- if not settings .USE_SDL :
963
- cflags += ['-Xclang' , '-iwithsysroot' + os .path .join ('/include' , 'fakesdl' )]
964
-
965
- return cflags + ['-Xclang' , '-iwithsysroot' + os .path .join ('/include' , 'compat' )]
966
-
967
-
968
927
def get_target_flags ():
969
928
return ['-target' , shared .get_llvm_target ()]
970
929
@@ -1020,6 +979,7 @@ def get_cflags(user_args, is_cxx):
1020
979
# Flags we pass to the compiler when building C/C++ code
1021
980
# We add these to the user's flags (newargs), but not when building .s or .S assembly files
1022
981
cflags = get_clang_flags (user_args )
982
+ cflags .append ('--sysroot=' + cache .get_sysroot (absolute = True ))
1023
983
1024
984
if settings .EMSCRIPTEN_TRACING :
1025
985
cflags .append ('-D__EMSCRIPTEN_TRACING__=1' )
@@ -1048,10 +1008,43 @@ def get_cflags(user_args, is_cxx):
1048
1008
1049
1009
ports .add_cflags (cflags , settings )
1050
1010
1051
- if '-nostdinc' in user_args :
1052
- return cflags
1011
+ def array_contains_any_of (hay , needles ):
1012
+ for n in needles :
1013
+ if n in hay :
1014
+ return True
1015
+
1016
+ if array_contains_any_of (user_args , SIMD_INTEL_FEATURE_TOWER ) or array_contains_any_of (user_args , SIMD_NEON_FLAGS ):
1017
+ if '-msimd128' not in user_args and '-mrelaxed-simd' not in user_args :
1018
+ exit_with_error ('Passing any of ' + ', ' .join (SIMD_INTEL_FEATURE_TOWER + SIMD_NEON_FLAGS ) + ' flags also requires passing -msimd128 (or -mrelaxed-simd)!' )
1019
+ cflags += ['-D__SSE__=1' ]
1020
+
1021
+ if array_contains_any_of (user_args , SIMD_INTEL_FEATURE_TOWER [1 :]):
1022
+ cflags += ['-D__SSE2__=1' ]
1023
+
1024
+ if array_contains_any_of (user_args , SIMD_INTEL_FEATURE_TOWER [2 :]):
1025
+ cflags += ['-D__SSE3__=1' ]
1026
+
1027
+ if array_contains_any_of (user_args , SIMD_INTEL_FEATURE_TOWER [3 :]):
1028
+ cflags += ['-D__SSSE3__=1' ]
1029
+
1030
+ if array_contains_any_of (user_args , SIMD_INTEL_FEATURE_TOWER [4 :]):
1031
+ cflags += ['-D__SSE4_1__=1' ]
1032
+
1033
+ # Handle both -msse4.2 and its alias -msse4.
1034
+ if array_contains_any_of (user_args , SIMD_INTEL_FEATURE_TOWER [5 :]):
1035
+ cflags += ['-D__SSE4_2__=1' ]
1036
+
1037
+ if array_contains_any_of (user_args , SIMD_INTEL_FEATURE_TOWER [7 :]):
1038
+ cflags += ['-D__AVX__=1' ]
1039
+
1040
+ if array_contains_any_of (user_args , SIMD_NEON_FLAGS ):
1041
+ cflags += ['-D__ARM_NEON__=1' ]
1042
+
1043
+ if '-nostdinc' not in user_args :
1044
+ if not settings .USE_SDL :
1045
+ cflags += ['-Xclang' , '-iwithsysroot' + os .path .join ('/include' , 'fakesdl' )]
1046
+ cflags += ['-Xclang' , '-iwithsysroot' + os .path .join ('/include' , 'compat' )]
1053
1047
1054
- cflags += emsdk_cflags (user_args )
1055
1048
return cflags
1056
1049
1057
1050
0 commit comments