-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmruby_wasm_config.rb
43 lines (35 loc) · 975 Bytes
/
mruby_wasm_config.rb
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
# frozen_string_literal: true
MRuby::Build.new do |conf|
if ENV['VisualStudioVersion'] || ENV['VSINSTALLDIR']
toolchain :visualcpp
else
toolchain :gcc
end
conf.gembox 'default'
end
MRuby::CrossBuild.new('wasm') do |conf|
toolchain :clang
# C compiler settings
conf.cc do |cc|
cc.command = 'emcc'
cc.compile_options = '%<flags>s -s WASM=1 -o %<outfile>s ' \
'-c %<infile>s -Oz --llvm-opts 3'
end
# Linker settings
conf.linker do |linker|
linker.command = 'emcc'
linker.link_options = '%<flags>s -o %<outfile>s %<objs>s %<libs>s'
end
# Archiver settings
conf.archiver do |archiver|
archiver.command = 'emcc'
archiver.archive_options = '%<objs>s -s WASM=1 -o %<outfile>s'
end
# file extensions
conf.exts do |exts|
exts.object = '.bc'
exts.executable = '' # '.exe' if Windows
exts.library = '.bc'
end
conf.gembox File.expand_path('wasm', File.dirname(__FILE__))
end