File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Make sure to add these compile options:
2+ # build/emscripten-cxx/host-bin/mruby-config --cxxflags
3+ #
4+ # Make sure to add these link options:
5+ # build/emscripten-cxx/host-bin/mruby-config --ldflags --libs
6+ MRuby ::CrossBuild . new ( 'emscripten-cxx' ) do |conf |
7+ conf . toolchain :emscripten
8+
9+ conf . gembox 'default'
10+
11+ conf . enable_cxx_abi
12+ end
Original file line number Diff line number Diff line change 1+ # Make sure to add these compile options:
2+ # build/emscripten/host-bin/mruby-config --cflags
3+ #
4+ # Make sure to add these link options:
5+ # build/emscripten/host-bin/mruby-config --ldflags --libs
6+ MRuby ::CrossBuild . new ( 'emscripten' ) do |conf |
7+ conf . toolchain :emscripten
8+
9+ conf . gembox 'default'
10+ end
Original file line number Diff line number Diff line change @@ -92,7 +92,9 @@ CXDIVc(mrb_complex a, mrb_complex b)
9292
9393#else
9494
95- #if defined(__cplusplus ) && (defined(__APPLE__ ) || (defined(__clang__ ) && (defined(__FreeBSD__ ) || defined(__OpenBSD__ ))))
95+ #if defined(__cplusplus ) && \
96+ (defined(__APPLE__ ) || defined(__EMSCRIPTEN__ ) || \
97+ (defined(__clang__ ) && (defined(__FreeBSD__ ) || defined(__OpenBSD__ ))))
9698
9799#ifdef MRB_USE_FLOAT32
98100typedef std ::complex < float > mrb_complex ;
Original file line number Diff line number Diff line change 1+ MRuby ::Toolchain . new ( :emscripten ) do |conf |
2+ toolchain :clang
3+
4+ # See:
5+ # - https://emscripten.org/docs/tools_reference/emcc.html
6+ # - https://emscripten.org/docs/tools_reference/settings_reference.html
7+ # - https://github.com/emscripten-core/emscripten/blob/main/src/settings.js
8+ compile_and_link_flags = [
9+ ]
10+ compile_flags = [
11+ *compile_and_link_flags ,
12+ '-Wno-unused-but-set-variable' ,
13+ ]
14+ link_flags = [
15+ *compile_and_link_flags ,
16+ ]
17+
18+ conf . cc do |cc |
19+ cc . command = 'emcc'
20+ cc . flags . concat ( compile_flags ) unless ENV [ 'CFLAGS' ]
21+ end
22+
23+ conf . cxx do |cxx |
24+ cxx . command = 'em++'
25+ cxx . flags . concat ( compile_flags ) unless ENV [ 'CXXFLAGS' ] || ENV [ 'CFLAGS' ]
26+ end
27+
28+ conf . linker do |linker |
29+ linker . command = 'emcc'
30+ linker . flags . concat ( link_flags ) unless ENV [ 'LDFLAGS' ]
31+ end
32+
33+ conf . archiver do |archiver |
34+ archiver . command = 'emar'
35+ end
36+ end
You can’t perform that action at this time.
0 commit comments