|
65 | 65 | C_ENDINGS = C_ENDINGS + SPECIAL_ENDINGLESS_FILENAMES # consider the special endingless filenames like /dev/null to be C
|
66 | 66 |
|
67 | 67 | JS_CONTAINING_ENDINGS = ('.js', '.mjs', '.html')
|
| 68 | +EXECUTABLE_ENDINGS = JS_CONTAINING_ENDINGS + ('.wasm',) |
68 | 69 | BITCODE_ENDINGS = ('.bc', '.o', '.obj', '.lo')
|
69 | 70 | DYNAMICLIB_ENDINGS = ('.dylib', '.so') # Windows .dll suffix is not included in this list, since those are never linked to directly on the command line.
|
70 | 71 | STATICLIB_ENDINGS = ('.a',)
|
@@ -1080,6 +1081,13 @@ def check(input_file):
|
1080 | 1081 | # Note the exports the user requested
|
1081 | 1082 | shared.Building.user_requested_exports = shared.Settings.EXPORTED_FUNCTIONS[:]
|
1082 | 1083 |
|
| 1084 | + compile_only = has_dash_c or has_dash_S or final_suffix not in EXECUTABLE_ENDINGS |
| 1085 | + |
| 1086 | + # If we are using embind and linking, now is the time to link in bind.cpp |
| 1087 | + if shared.Settings.EMBIND and not compile_only: |
| 1088 | + input_files.append((next_arg_index, shared.path_from_root('system', 'lib', 'embind', 'bind.cpp'))) |
| 1089 | + next_arg_index += 1 |
| 1090 | + |
1083 | 1091 | # -s ASSERTIONS=1 implies the heaviest stack overflow check mode. Set the implication here explicitly to avoid having to
|
1084 | 1092 | # do preprocessor "#if defined(ASSERTIONS) || defined(STACK_OVERFLOW_CHECK)" in .js files, which is not supported.
|
1085 | 1093 | if shared.Settings.ASSERTIONS:
|
@@ -1175,7 +1183,7 @@ def check(input_file):
|
1175 | 1183 | shared.Settings.WORKAROUND_IOS_9_RIGHT_SHIFT_BUG = 0
|
1176 | 1184 | shared.Settings.WORKAROUND_OLD_WEBGL_UNIFORM_UPLOAD_IGNORED_OFFSET_BUG = 0
|
1177 | 1185 |
|
1178 |
| - if shared.Settings.STB_IMAGE and final_suffix in JS_CONTAINING_ENDINGS: |
| 1186 | + if shared.Settings.STB_IMAGE and not compile_only: |
1179 | 1187 | input_files.append((next_arg_index, shared.path_from_root('third_party', 'stb_image.c')))
|
1180 | 1188 | next_arg_index += 1
|
1181 | 1189 | shared.Settings.EXPORTED_FUNCTIONS += ['_stbi_load', '_stbi_load_from_memory', '_stbi_image_free']
|
@@ -1204,9 +1212,6 @@ def check(input_file):
|
1204 | 1212 | shared.Settings.EXPORTED_FUNCTIONS += ['___cxa_demangle']
|
1205 | 1213 | forced_stdlibs.append('libc++abi')
|
1206 | 1214 |
|
1207 |
| - if shared.Settings.EMBIND: |
1208 |
| - forced_stdlibs.append('libembind') |
1209 |
| - |
1210 | 1215 | if not shared.Settings.ONLY_MY_CODE and not shared.Settings.MINIMAL_RUNTIME:
|
1211 | 1216 | # Always need malloc and free to be kept alive and exported, for internal use and other modules
|
1212 | 1217 | shared.Settings.EXPORTED_FUNCTIONS += ['_malloc', '_free']
|
@@ -1884,9 +1889,6 @@ def compile_source_file(i, input_file):
|
1884 | 1889 | temp_files[pos] = (temp_files[pos][0], new_temp_file)
|
1885 | 1890 |
|
1886 | 1891 | # Decide what we will link
|
1887 |
| - executable_endings = JS_CONTAINING_ENDINGS + ('.wasm',) |
1888 |
| - compile_only = final_suffix not in executable_endings or has_dash_c or has_dash_S |
1889 |
| - |
1890 | 1892 | if compile_only or not shared.Settings.WASM_BACKEND:
|
1891 | 1893 | # Filter link flags, keeping only those that shared.Building.link knows
|
1892 | 1894 | # how to deal with. We currently can't handle flags with options (like
|
|
0 commit comments