Skip to content

Commit

Permalink
minor fixes for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesneimog committed Sep 7, 2023
1 parent 6cb0719 commit 2af594b
Showing 1 changed file with 38 additions and 29 deletions.
67 changes: 38 additions & 29 deletions pd2wasm/PdWebCompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,10 @@ def emccCompile(self):
self.libpd_dir = self.PdWebCompilearPath + '/libpd'
self.src_files = 'webpatch/main.c'
memory = 32 # we start with 32mb, for big patches you should increase this value
emcc = self.PdWebCompilearPath + '/emsdk/upstream/emscripten/emcc'
if platform.system() == "Windows":
emcc = '"' + self.PdWebCompilearPath + '\\emsdk\\upstream\\emscripten\\emcc"'
else:
emcc = self.PdWebCompilearPath + '/emsdk/upstream/emscripten/emcc'

command = [emcc,
"-I", "webpatch/includes/",
Expand Down Expand Up @@ -808,35 +811,41 @@ def emccCompile(self):
print("")
self.print(" " + " ".join(command), color='blue')
print("")
process = subprocess.Popen(
command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
_, stderr = process.communicate()
if stderr:
if "warning" in stderr:
# split by new line
stderr = stderr.split("\n")
for line in stderr:
if "warning:" in line:
print("")
self.print(" " + line, color='yellow')
print("")
else:
print(" " + line)
if "error" in stderr:
stderr = stderr.split("\n")
for line in stderr:
if "error:" in line:
print("")
self.print(" " + line, color='red')
print("")
sys.exit(-1)
else:
self.print(line, color='red')
else:
self.print(" " + ("=" * 10) +
" Compiled with success " + ("=" * 10), color='green')

if platform.system() == "Windows":
os.system(" ".join(command))


else:
process = subprocess.Popen(
command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
_, stderr = process.communicate()
if stderr:
if "warning" in stderr:
# split by new line
stderr = stderr.split("\n")
for line in stderr:
if "warning:" in line:
print("")
self.print(" " + line, color='yellow')
print("")
else:
print(" " + line)
if "error" in stderr:
stderr = stderr.split("\n")
for line in stderr:
if "error:" in line:
print("")
self.print(" " + line, color='red')
print("")
sys.exit(-1)
else:
self.print(line, color='red')
else:
self.print(" " + ("=" * 10) +
" Compiled with success " + ("=" * 10), color='green')

process.wait()
process.wait()
if isinstance(self.html, str):
shutil.copy(self.html, "webpatch")

Expand Down

0 comments on commit 2af594b

Please sign in to comment.