diff options
Diffstat (limited to 'tools/shared.py')
-rw-r--r-- | tools/shared.py | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/tools/shared.py b/tools/shared.py index 007c2ee8..f6d0ff4f 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -286,7 +286,7 @@ def check_node_version(): EMSCRIPTEN_VERSION = '1.5.3' def generate_sanity(): - return EMSCRIPTEN_VERSION + '|' + get_llvm_target() + return EMSCRIPTEN_VERSION + '|' + get_llvm_target() + '|' + LLVM_ROOT def check_sanity(force=False): try: @@ -360,8 +360,15 @@ def check_sanity(force=False): # Tools/paths -LLVM_ADD_VERSION = os.getenv('LLVM_ADD_VERSION') -CLANG_ADD_VERSION = os.getenv('CLANG_ADD_VERSION') +try: + LLVM_ADD_VERSION +except NameError: + LLVM_ADD_VERSION = os.getenv('LLVM_ADD_VERSION') + +try: + CLANG_ADD_VERSION +except NameError: + CLANG_ADD_VERSION = os.getenv('CLANG_ADD_VERSION') # Some distributions ship with multiple llvm versions so they add # the version to the binaries, cope with that @@ -509,6 +516,7 @@ COMPILER_OPTS = COMPILER_OPTS + ['-m32', '-U__i386__', '-U__i386', '-Ui386', '-target', LLVM_TARGET] if LLVM_TARGET == 'le32-unknown-nacl': + COMPILER_OPTS = filter(lambda opt: opt != '-m32', COMPILER_OPTS) # le32 target is 32-bit anyhow, no need for -m32 COMPILER_OPTS += ['-U__native_client__', '-U__pnacl__', '-U__ELF__'] # The nacl target is originally used for Google Native Client. Emscripten is not NaCl, so remove the platform #define, when using their triple. USE_EMSDK = not os.environ.get('EMMAKEN_NO_SDK') @@ -516,7 +524,7 @@ USE_EMSDK = not os.environ.get('EMMAKEN_NO_SDK') if USE_EMSDK: # Disable system C and C++ include directories, and add our own (using -idirafter so they are last, like system dirs, which # allows projects to override them) - EMSDK_OPTS = ['-nostdinc', '-nostdinc++', '-Xclang', '-nobuiltininc', '-Xclang', '-nostdsysteminc', + EMSDK_OPTS = ['-nostdinc', '-Xclang', '-nobuiltininc', '-Xclang', '-nostdsysteminc', '-Xclang', '-isystem' + path_from_root('system', 'local', 'include'), '-Xclang', '-isystem' + path_from_root('system', 'include', 'libcxx'), '-Xclang', '-isystem' + path_from_root('system', 'include'), @@ -529,9 +537,14 @@ if USE_EMSDK: ] + [ '-U__APPLE__', '-U__linux__' ] + if LLVM_TARGET != 'le32-unknown-nacl': + EMSDK_CXX_OPTS = ['-nostdinc++'] # le32 target does not need -nostdinc++ + else: + EMSDK_CXX_OPTS = [] COMPILER_OPTS += EMSDK_OPTS else: EMSDK_OPTS = [] + EMSDK_CXX_OPTS = [] #print >> sys.stderr, 'SDK opts', ' '.join(EMSDK_OPTS) #print >> sys.stderr, 'Compiler opts', ' '.join(COMPILER_OPTS) @@ -593,7 +606,7 @@ def line_splitter(data): return out -def limit_size(string, MAX=80*20): +def limit_size(string, MAX=120*20): if len(string) < MAX: return string return string[0:MAX/2] + '\n[..]\n' + string[-MAX/2:] @@ -870,7 +883,10 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS e @staticmethod def link(files, target, force_archive_contents=False): actual_files = [] - unresolved_symbols = set(['main']) # tracking unresolveds is necessary for .a linking, see below. (and main is always a necessary symbol) + # Tracking unresolveds is necessary for .a linking, see below. + # Specify all possible entry points to seed the linking process. + # For a simple application, this would just be "main". + unresolved_symbols = set([func[1:] for func in Settings.EXPORTED_FUNCTIONS]) resolved_symbols = set() temp_dirs = [] files = map(os.path.abspath, files) |