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
 			proj.set("env:" + env["PIOENV"], "src_filter", src_filter)
93
 			proj.set("env:" + env["PIOENV"], "src_filter", src_filter)
94
 			env.Replace(SRC_FILTER=src_filter)
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
 # load marlin features
119
 # load marlin features
97
 def load_marlin_features():
120
 def load_marlin_features():
98
 	if "MARLIN_FEATURES" in env:
121
 	if "MARLIN_FEATURES" in env:
102
 	# print(env.Dump())
125
 	# print(env.Dump())
103
 	build_flags = env.get('BUILD_FLAGS')
126
 	build_flags = env.get('BUILD_FLAGS')
104
 	build_flags = env.ParseFlagsExtended(build_flags)
127
 	build_flags = env.ParseFlagsExtended(build_flags)
105
-	cmd = []
128
+
129
+	cxx = search_compiler()
130
+	cmd = [cxx]
131
+
106
 	# build flags from board.json
132
 	# build flags from board.json
107
 	# if 'BOARD' in env:
133
 	# if 'BOARD' in env:
108
 	# 	cmd += [env.BoardConfig().get("build.extra_flags")]
134
 	# 	cmd += [env.BoardConfig().get("build.extra_flags")]
113
 			cmd += ['-D' + s]
139
 			cmd += ['-D' + s]
114
 	# cmd += ['-w -dM -E -x c++ Marlin/src/inc/MarlinConfigPre.h']
140
 	# cmd += ['-w -dM -E -x c++ Marlin/src/inc/MarlinConfigPre.h']
115
 	cmd += ['-w -dM -E -x c++ buildroot/share/PlatformIO/scripts/common-features-dependencies.h']
141
 	cmd += ['-w -dM -E -x c++ buildroot/share/PlatformIO/scripts/common-features-dependencies.h']
116
-	cmd = [env.get('CXX')] + cmd
117
 	cmd = ' '.join(cmd)
142
 	cmd = ' '.join(cmd)
118
 	print(cmd)
143
 	print(cmd)
119
 	define_list = subprocess.check_output(cmd, shell=True).splitlines()
144
 	define_list = subprocess.check_output(cmd, shell=True).splitlines()

Loading…
Cancel
Save