Browse Source

Patch auto-deps for Windows CXX (#18721)

Victor Oliveira 4 years ago
parent
commit
cea097df83
No account linked to committer's email address
1 changed files with 27 additions and 2 deletions
  1. 27
    2
      buildroot/share/PlatformIO/scripts/common-features-dependencies.py

+ 27
- 2
buildroot/share/PlatformIO/scripts/common-features-dependencies.py View File

@@ -93,6 +93,29 @@ def install_features_dependencies():
93 93
 			proj.set("env:" + env["PIOENV"], "src_filter", src_filter)
94 94
 			env.Replace(SRC_FILTER=src_filter)
95 95
 
96
+# search the current compiler, considering the OS
97
+def search_compiler():
98
+	if env['PLATFORM'] == 'win32':
99
+		# the first path have the compiler
100
+		compiler_path = None
101
+		for path in env['ENV']['PATH'].split(';'):
102
+			if re.search(r'platformio\\packages.*\\bin', path):
103
+				compiler_path = path
104
+				break
105
+		if compiler_path == None:
106
+			print("Could not find the g++ path")
107
+			return None
108
+		
109
+		print(compiler_path)
110
+		for file in os.listdir(compiler_path):
111
+			if file.endswith("g++.exe"):
112
+				return file
113
+		print("Could not find the g++")
114
+		return None
115
+	else:
116
+		return env.get('CXX')
117
+
118
+
96 119
 # load marlin features
97 120
 def load_marlin_features():
98 121
 	if "MARLIN_FEATURES" in env:
@@ -102,7 +125,10 @@ def load_marlin_features():
102 125
 	# print(env.Dump())
103 126
 	build_flags = env.get('BUILD_FLAGS')
104 127
 	build_flags = env.ParseFlagsExtended(build_flags)
105
-	cmd = []
128
+
129
+	cxx = search_compiler()
130
+	cmd = [cxx]
131
+
106 132
 	# build flags from board.json
107 133
 	# if 'BOARD' in env:
108 134
 	# 	cmd += [env.BoardConfig().get("build.extra_flags")]
@@ -113,7 +139,6 @@ def load_marlin_features():
113 139
 			cmd += ['-D' + s]
114 140
 	# cmd += ['-w -dM -E -x c++ Marlin/src/inc/MarlinConfigPre.h']
115 141
 	cmd += ['-w -dM -E -x c++ buildroot/share/PlatformIO/scripts/common-features-dependencies.h']
116
-	cmd = [env.get('CXX')] + cmd
117 142
 	cmd = ' '.join(cmd)
118 143
 	print(cmd)
119 144
 	define_list = subprocess.check_output(cmd, shell=True).splitlines()

Loading…
Cancel
Save