@@ -182,25 +182,34 @@ def check_reinstall_framework() -> bool:
182
182
def shorthen_includes (env , node ):
183
183
"""Optimize include paths for Windows builds."""
184
184
if IS_INTEGRATION_DUMP :
185
+ # Don't shorten include paths for IDE integrations
185
186
return node
186
187
187
- includes = [fs .to_unix_path (inc ) for inc in env .get ("CPPPATH" , [])]
188
+ # Local references for better performance
189
+ env_get = env .get
190
+ to_unix_path = fs .to_unix_path
191
+ ccflags = env ["CCFLAGS" ]
192
+ asflags = env ["ASFLAGS" ]
193
+
194
+ includes = [to_unix_path (inc ) for inc in env_get ("CPPPATH" , [])]
188
195
shortened_includes = []
189
196
generic_includes = []
190
197
191
198
for inc in includes :
192
199
if is_framework_subfolder (inc ):
193
- rel_path = fs .to_unix_path (os .path .relpath (inc , FRAMEWORK_SDK_DIR ))
194
- shortened_includes .append (f"-iwithprefix/{ rel_path } " )
200
+ shortened_includes .append (
201
+ "-iwithprefix/" + to_unix_path (relpath (inc , FRAMEWORK_SDK_DIR ))
202
+ )
195
203
else :
196
204
generic_includes .append (inc )
197
205
198
206
common_flags = ["-iprefix" , FRAMEWORK_SDK_DIR ] + shortened_includes
207
+
199
208
return env .Object (
200
209
node ,
201
210
CPPPATH = generic_includes ,
202
- CCFLAGS = env [ "CCFLAGS" ] + common_flags ,
203
- ASFLAGS = env [ "ASFLAGS" ] + common_flags ,
211
+ CCFLAGS = ccflags + common_flags ,
212
+ ASFLAGS = asflags + common_flags ,
204
213
)
205
214
206
215
def is_framework_subfolder (potential_subfolder : str ) -> bool :
0 commit comments