diff options
-rwxr-xr-x | emcc | 10 | ||||
-rw-r--r-- | tools/shared.py | 20 |
2 files changed, 26 insertions, 4 deletions
@@ -499,6 +499,12 @@ Options that are modified or new in %s include: --proxy-to-worker Generates both html and js files. The main program is in js, and the html proxies to/from it. + --em-config Specifies the location of the .emscripten configuration + file for the current compiler run. If not specified, + the environment variable EM_CONFIG is read for this + file, and if that is not set, the default location + ~/.emscripten is assumed. + The target file, if specified (-o <target>), defines what will be generated: @@ -963,6 +969,10 @@ try: if not absolute_warning_shown and os.path.isabs(path_name): logging.warning ('-I or -L of an absolute path "' + newargs[i] + '" encountered. If this is to a local system header/library, it may cause problems (local system files make sense for compiling natively on your system, but not necessarily to JavaScript). Pass \'-Wno-warn-absolute-paths\' to emcc to hide this warning.') # Of course an absolute path to a non-system-specific library or header is fine, and you can ignore this warning. The danger are system headers that are e.g. x86 specific and nonportable. The emscripten bundled headers are modified to be portable, local system ones are generally not absolute_warning_shown = True + elif newargs[i] == '--em-config': + # This option is parsed in tools/shared.py, here only clean it up from being passed to clang. + newargs[i] = '' + newargs[i+1] = '' newargs = [ arg for arg in newargs if arg is not '' ] # If user did not specify a default -std for C++ code, specify the emscripten default. diff --git a/tools/shared.py b/tools/shared.py index 3456ab18..e4fb7e08 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -176,13 +176,25 @@ if WINDOWS: else: logging.StreamHandler.emit = add_coloring_to_emit_ansi(logging.StreamHandler.emit) -# Emscripten configuration is done through the EM_CONFIG environment variable. -# If the string value contained in this environment variable contains newline -# separated definitions, then these definitions will be used to configure +# Emscripten configuration is done through the --em-config command line option or +# the EM_CONFIG environment variable. If the specified string value contains newline +# or semicolon-separated definitions, then these definitions will be used to configure # Emscripten. Otherwise, the string is understood to be a path to a settings # file that contains the required definitions. -EM_CONFIG = os.environ.get('EM_CONFIG') +try: + EM_CONFIG = sys.argv[sys.argv.index('--em-config')+1] +except: + EM_CONFIG = os.environ.get('EM_CONFIG') + +if EM_CONFIG and not os.path.isfile(EM_CONFIG): + if EM_CONFIG.startswith('-'): + raise Exception('Passed --em-config without an argument. Usage: --em-config /path/to/.emscripten or --em-config EMSCRIPTEN_ROOT=/path/;LLVM_ROOT=/path;...') + if not '=' in EM_CONFIG: + raise Exception('File ' + EM_CONFIG + ' passed to --em-config does not exist!') + else: + EM_CONFIG = EM_CONFIG.replace(';', '\n') + '\n' + if not EM_CONFIG: EM_CONFIG = '~/.emscripten' if '\n' in EM_CONFIG: |