@@ -1215,6 +1215,13 @@ def get_dependencies(file, env, exts, headers, sources, others):
1215
1215
activeItems .append (file )
1216
1216
1217
1217
if vs_configuration :
1218
+ if not env .msvc :
1219
+ # tell Rider at least not to use MSVC rules for the code analysis.
1220
+ # theoretically env["CC"] can be mapped to a PlatformToolset to have most accurate analysis rules
1221
+ # like all *gcc are likely Linux, clang should be ClangOnLinux, ClangOnWindows, ClangOnMac
1222
+ # I am not sure, if this may have recognizable impact, Unknown seem to work good for now
1223
+ properties .append ("<PlatformToolset>Unknown</PlatformToolset>" )
1224
+
1218
1225
vsconf = ""
1219
1226
for a in vs_configuration ["arches" ]:
1220
1227
if arch == a ["architecture" ]:
@@ -1234,12 +1241,11 @@ def get_dependencies(file, env, exts, headers, sources, others):
1234
1241
properties .append (
1235
1242
"<ActiveProjectItemList_%s>;%s;</ActiveProjectItemList_%s>" % (x , ";" .join (itemlist [x ]), x )
1236
1243
)
1237
- output = f "bin\\ godot{ env ['PROGSUFFIX' ]} "
1244
+ output = os . path . join ( "bin" , f" godot{ env ['PROGSUFFIX' ]} ")
1238
1245
1239
1246
with open ("misc/msvs/props.template" , "r" , encoding = "utf-8" ) as file :
1240
1247
props_template = file .read ()
1241
1248
1242
- props_template = props_template .replace ("%%VSCONF%%" , vsconf )
1243
1249
props_template = props_template .replace ("%%CONDITION%%" , condition )
1244
1250
props_template = props_template .replace ("%%PROPERTIES%%" , "\n " .join (properties ))
1245
1251
props_template = props_template .replace ("%%EXTRA_ITEMS%%" , "\n " .join (extraItems ))
@@ -1252,6 +1258,7 @@ def get_dependencies(file, env, exts, headers, sources, others):
1252
1258
1253
1259
proplist = [str (j ) for j in env ["CPPPATH" ]]
1254
1260
proplist += [str (j ) for j in env .get ("VSHINT_INCLUDES" , [])]
1261
+ proplist += [str (j ) for j in get_default_include_paths (env )]
1255
1262
props_template = props_template .replace ("%%INCLUDES%%" , ";" .join (proplist ))
1256
1263
1257
1264
proplist = env ["CCFLAGS" ]
@@ -1287,17 +1294,17 @@ def get_dependencies(file, env, exts, headers, sources, others):
1287
1294
1288
1295
commands = "scons"
1289
1296
if len (common_build_prefix ) == 0 :
1290
- commands = "echo Starting SCons && cmd /V /C " + commands
1297
+ commands = "echo Starting SCons &" + commands
1291
1298
else :
1292
- common_build_prefix [0 ] = "echo Starting SCons && cmd /V /C " + common_build_prefix [0 ]
1299
+ common_build_prefix [0 ] = "echo Starting SCons &" + common_build_prefix [0 ]
1293
1300
1294
- cmd = " ^& " .join (common_build_prefix + [" " .join ([commands ] + common_build_postfix )])
1301
+ cmd = " " .join (common_build_prefix + [" " .join ([commands ] + common_build_postfix )])
1295
1302
props_template = props_template .replace ("%%BUILD%%" , cmd )
1296
1303
1297
- cmd = " ^& " .join (common_build_prefix + [" " .join ([commands ] + cmd_rebuild )])
1304
+ cmd = " " .join (common_build_prefix + [" " .join ([commands ] + cmd_rebuild )])
1298
1305
props_template = props_template .replace ("%%REBUILD%%" , cmd )
1299
1306
1300
- cmd = " ^& " .join (common_build_prefix + [" " .join ([commands ] + cmd_clean )])
1307
+ cmd = " " .join (common_build_prefix + [" " .join ([commands ] + cmd_clean )])
1301
1308
props_template = props_template .replace ("%%CLEAN%%" , cmd )
1302
1309
1303
1310
with open (
@@ -1586,3 +1593,18 @@ def to_raw_cstring(value: Union[str, List[str]]) -> str:
1586
1593
else :
1587
1594
# Wrap multiple segments in parenthesis to suppress `string-concatenation` warnings on clang.
1588
1595
return "({})" .format (" " .join (f'R"<!>({ segment .decode ()} )<!>"' for segment in split ))
1596
+
1597
+
1598
+ def get_default_include_paths (env ):
1599
+ if env .msvc :
1600
+ return []
1601
+ compiler = env .subst ("$CXX" )
1602
+ target = os .path .join (env .Dir ("#main" ).abspath , "main.cpp" )
1603
+ args = [compiler , target , "-x" , "c++" , "-v" ]
1604
+ ret = subprocess .run (args , stdout = subprocess .PIPE , stderr = subprocess .STDOUT , text = True )
1605
+ output = ret .stdout
1606
+ match = re .search (r"#include <\.\.\.> search starts here:([\S\s]*)End of search list." , output )
1607
+ if not match :
1608
+ print_warning ("Failed to find the include paths in the compiler output." )
1609
+ return []
1610
+ return [x .strip () for x in match [1 ].strip ().splitlines ()]
0 commit comments