Skip to content

Instantly share code, notes, and snippets.

@KiruyaMomochi
Last active March 27, 2022 23:50
Show Gist options
  • Save KiruyaMomochi/228fb8fda90c0428dd3ca19e26652b4d to your computer and use it in GitHub Desktop.
Save KiruyaMomochi/228fb8fda90c0428dd3ca19e26652b4d to your computer and use it in GitHub Desktop.
Fix emsdk cros compile
diff --git a/emsdk.py b/emsdk.py
index c4fc19b..e618e37 100644
--- a/emsdk.py
+++ b/emsdk.py
@@ -2461,7 +2461,7 @@ def process_tool_list(tools_to_activate):
def write_set_env_script(env_string):
- assert(WINDOWS)
+ assert(CMD or POWERSHELL)
open(EMSDK_SET_ENV, 'w').write(env_string)
@@ -2478,18 +2478,18 @@ def set_active_tools(tools_to_activate, permanently_activate, system):
generate_dot_emscripten(tools_to_activate)
- # Construct a .bat script that will be invoked to set env. vars and PATH
- # We only do this on windows since emsdk.bat is able to modify the
- # calling shell environment. On other platform `source emsdk_env.sh` is
+ # Construct a .bat or .ps1 script that will be invoked to set env. vars and PATH
+ # We only do this on cmd or powershell since emsdk.bat/ps1 is able to modify the
+ # calling shell environment. On other shell `source emsdk_env.sh` is
# required.
- if WINDOWS:
+ if CMD or POWERSHELL:
# always set local environment variables since permanently activating will only set the registry settings and
# will not affect the current session
env_vars_to_add = get_env_vars_to_add(tools_to_activate, system, user=permanently_activate)
env_string = construct_env_with_vars(env_vars_to_add)
write_set_env_script(env_string)
- if permanently_activate:
+ if WINDOWS and permanently_activate:
win_set_environment_variables(env_vars_to_add, system, user=permanently_activate)
return tools_to_activate
@@ -3101,7 +3101,7 @@ def main(args):
tools_to_activate = currently_active_tools()
tools_to_activate = process_tool_list(tools_to_activate)
env_string = construct_env(tools_to_activate, arg_system, arg_permanent)
- if WINDOWS and not BASH:
+ if CMD or POWERSHELL:
write_set_env_script(env_string)
else:
sys.stdout.write(env_string)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment