Skip to content

Commit f75b10f

Browse files
committed
Add external custom modules in vcxproj
Update methods.py
1 parent 09ea7bc commit f75b10f

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

methods.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -990,6 +990,15 @@ def glob_recursive_2(pattern, dirs, node="."):
990990
results += r
991991
return results
992992

993+
def glob_current_and_custom(pattern, dirs):
994+
paths = ["."]
995+
if env["custom_modules"]:
996+
paths = paths + env["custom_modules"].split(",")
997+
results = []
998+
for p in paths:
999+
results = results + glob_recursive_2(pattern, dirs, p)
1000+
return results
1001+
9931002
def get_bool(args, option, default):
9941003
from SCons.Variables.BoolVariable import _text2bool
9951004

@@ -1120,19 +1129,19 @@ def get_dependencies(file, env, exts, headers, sources, others):
11201129
headers = []
11211130
headers_dirs = []
11221131
for ext in extensions["headers"]:
1123-
for file in glob_recursive_2("*" + ext, headers_dirs):
1132+
for file in glob_current_and_custom("*" + ext, headers_dirs):
11241133
headers.append(str(file).replace("/", "\\"))
11251134

11261135
sources = []
11271136
sources_dirs = []
11281137
for ext in extensions["sources"]:
1129-
for file in glob_recursive_2("*" + ext, sources_dirs):
1138+
for file in glob_current_and_custom("*" + ext, sources_dirs):
11301139
sources.append(str(file).replace("/", "\\"))
11311140

11321141
others = []
11331142
others_dirs = []
11341143
for ext in extensions["others"]:
1135-
for file in glob_recursive_2("*" + ext, others_dirs):
1144+
for file in glob_current_and_custom("*" + ext, others_dirs):
11361145
others.append(str(file).replace("/", "\\"))
11371146

11381147
skip_filters = False
@@ -1214,7 +1223,7 @@ def get_dependencies(file, env, exts, headers, sources, others):
12141223
set_sources = set(sources_active)
12151224
set_others = set(others_active)
12161225
for file in headers:
1217-
base_path = os.path.dirname(file).replace("\\", "_")
1226+
base_path = os.path.dirname(file).replace("\\", "_").replace(":", "")
12181227
all_items.append(f'<ClInclude Include="{file}">')
12191228
all_items.append(
12201229
f" <ExcludedFromBuild Condition=\"!$(ActiveProjectItemList_{base_path}.Contains(';{file};'))\">true</ExcludedFromBuild>"
@@ -1224,7 +1233,7 @@ def get_dependencies(file, env, exts, headers, sources, others):
12241233
activeItems.append(file)
12251234

12261235
for file in sources:
1227-
base_path = os.path.dirname(file).replace("\\", "_")
1236+
base_path = os.path.dirname(file).replace("\\", "_").replace(":", "")
12281237
all_items.append(f'<ClCompile Include="{file}">')
12291238
all_items.append(
12301239
f" <ExcludedFromBuild Condition=\"!$(ActiveProjectItemList_{base_path}.Contains(';{file};'))\">true</ExcludedFromBuild>"
@@ -1234,7 +1243,7 @@ def get_dependencies(file, env, exts, headers, sources, others):
12341243
activeItems.append(file)
12351244

12361245
for file in others:
1237-
base_path = os.path.dirname(file).replace("\\", "_")
1246+
base_path = os.path.dirname(file).replace("\\", "_").replace(":", "")
12381247
all_items.append(f'<None Include="{file}">')
12391248
all_items.append(
12401249
f" <ExcludedFromBuild Condition=\"!$(ActiveProjectItemList_{base_path}.Contains(';{file};'))\">true</ExcludedFromBuild>"
@@ -1253,7 +1262,7 @@ def get_dependencies(file, env, exts, headers, sources, others):
12531262
condition = "'$(GodotConfiguration)|$(GodotPlatform)'=='" + vsconf + "'"
12541263
itemlist = {}
12551264
for item in activeItems:
1256-
key = os.path.dirname(item).replace("\\", "_")
1265+
key = os.path.dirname(item).replace("\\", "_").replace(":", "")
12571266
if key not in itemlist:
12581267
itemlist[key] = [item]
12591268
else:

0 commit comments

Comments
 (0)