File: WasmBuildOptions.cmake

package info (click to toggle)
xeus 5.2.6-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 9,764 kB
  • sloc: cpp: 7,406; makefile: 157; python: 25
file content (74 lines) | stat: -rw-r--r-- 3,422 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
############################################################################
# Copyright (c) 2016, Johan Mabille, Sylvain Corlay, Martin Renou          #
# Copyright (c) 2016, QuantStack                                           #
#                                                                          #
# Distributed under the terms of the BSD 3-Clause License.                 #
#                                                                          #
# The full license is in the file LICENSE, distributed with this software. #
############################################################################

if (EMSCRIPTEN_VERSION VERSION_LESS "4.0.0")
    message(STATUS "Emscripten version < 4.0.0")
    function(xeus_wasm_compile_options target)
        target_compile_options("${target}"
            PUBLIC --std=c++17
            PUBLIC -Wno-deprecated
            PUBLIC "SHELL: -fexceptions"
        )
        set_property(TARGET ${target} PROPERTY POSITION_INDEPENDENT_CODE ON)
    endfunction()

    function(xeus_wasm_link_options target environment)
        target_link_options("${target}"
            PUBLIC --bind
            PUBLIC -Wno-unused-command-line-argument
            PUBLIC "SHELL: -fexceptions"
            PUBLIC "SHELL: -s MODULARIZE=1"
            PUBLIC "SHELL: -s EXPORT_NAME=\"createXeusModule\""
            PUBLIC "SHELL: -s EXPORT_ES6=0"
            PUBLIC "SHELL: -s ASSERTIONS=0"
            PUBLIC "SHELL: -s ALLOW_MEMORY_GROWTH=1"
            PUBLIC "SHELL: -s EXIT_RUNTIME=1"
            PUBLIC "SHELL: -s WASM=1"
            PUBLIC "SHELL: -s ENVIRONMENT=${environment}"
            PUBLIC "SHELL: -s STACK_SIZE=32mb"
            PUBLIC "SHELL: -s INITIAL_MEMORY=128mb"
            PUBLIC "SHELL: -s WASM_BIGINT"
            PUBLIC "SHELL: -s EXPORTED_RUNTIME_METHODS='[\"FS\",\"ENV\",\"PATH\",\"LDSO\",\"loadDynamicLibrary\",\"ERRNO_CODES\"]'"
            PUBLIC "SHELL: -s FORCE_FILESYSTEM"
            PUBLIC "SHELL: -s MAIN_MODULE=1"
        )
    endfunction()
else()
    message(STATUS "Emscripten version >= 4.0.0")
    function(xeus_wasm_compile_options target)
        target_compile_options("${target}"
            PUBLIC --std=c++17
            PUBLIC -Wno-deprecated
            PUBLIC "SHELL: -fwasm-exceptions"
        )
        set_property(TARGET ${target} PROPERTY POSITION_INDEPENDENT_CODE ON)
    endfunction()

    function(xeus_wasm_link_options target environment)
        target_link_options("${target}"
            PUBLIC -Wno-unused-command-line-argument
            PUBLIC "SHELL: -lembind"
            PUBLIC "SHELL: -fwasm-exceptions"
            PUBLIC "SHELL: -s MODULARIZE=1"
            PUBLIC "SHELL: -s EXPORT_NAME=\"createXeusModule\""
            PUBLIC "SHELL: -s EXPORT_ES6=0"
            PUBLIC "SHELL: -s ASSERTIONS=0"
            PUBLIC "SHELL: -s ALLOW_MEMORY_GROWTH=1"
            PUBLIC "SHELL: -s EXIT_RUNTIME=1"
            PUBLIC "SHELL: -s WASM=1"
            PUBLIC "SHELL: -s ENVIRONMENT=${environment}"
            PUBLIC "SHELL: -s STACK_SIZE=32mb"
            PUBLIC "SHELL: -s INITIAL_MEMORY=128mb"
            PUBLIC "SHELL: -s WASM_BIGINT"
            PUBLIC "SHELL: -s EXPORTED_RUNTIME_METHODS='[\"FS\",\"ENV\",\"PATH\",\"ERRNO_CODES\",\"getExceptionMessage\",\"getCppExceptionTag\"]'"
            PUBLIC "SHELL: -s FORCE_FILESYSTEM"
            PUBLIC "SHELL: -s MAIN_MODULE=1"
        )
    endfunction()
endif()