(build_dir, force_object_files=False, preprocess=True)
| 58 | |
| 59 | |
| 60 | def get_base_cflags(build_dir, force_object_files=False, preprocess=True): |
| 61 | # Always build system libraries with debug information. Non-debug builds |
| 62 | # will ignore this at link time because we link with `-strip-debug`. |
| 63 | flags = ['-g', '-sSTRICT', '-Werror'] |
| 64 | if settings.LTO and not force_object_files: |
| 65 | flags += ['-flto=' + settings.LTO] |
| 66 | if settings.MAIN_MODULE or settings.SIDE_MODULE: |
| 67 | # Explicitly include `-sMAIN_MODULE` when building system libraries. |
| 68 | # `-fPIC` alone is not enough to configure trigger the building and |
| 69 | # caching of `pic` libraries (see `get_lib_dir` in `cache.py`) |
| 70 | # FIXME(sbc): `-fPIC` should really be enough here. |
| 71 | flags += ['-fPIC', '-sMAIN_MODULE'] |
| 72 | if preprocess: |
| 73 | flags += ['-DEMSCRIPTEN_DYNAMIC_LINKING'] |
| 74 | if settings.MEMORY64: |
| 75 | flags += ['-m64'] |
| 76 | |
| 77 | source_dir = utils.path_from_root() |
| 78 | relative_source_dir = os.path.relpath(source_dir, build_dir) |
| 79 | flags += [f'-ffile-prefix-map={source_dir}={DETERMINISTIC_PREFIX}', |
| 80 | f'-ffile-prefix-map={relative_source_dir}={DETERMINISTIC_PREFIX}', |
| 81 | f'-fdebug-compilation-dir={DETERMINISTIC_PREFIX}'] |
| 82 | return flags |
| 83 | |
| 84 | |
| 85 | def get_build_dir(): |
no outgoing calls
no test coverage detected