esruby 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/esruby/build.rb +15 -4
- data/resources/cpp/main.cpp +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bf021af36d9a903dcc2b8e518ccbb3d38c694eef0d9f649ce93a169ac0aafd0
|
4
|
+
data.tar.gz: 8bae64f3191ca9ddcfa223eb1dfd104e39ee6aec9aa4d123b8923289012c7638
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8dc47a21efba8732a65b644609b56fdf5e07acc7ca7870c6d0cac68eb2f9d34c0bfed27f664a9b78684a686c4b2fe27fa4d9de42be91a85e510383d12bfa5c99
|
7
|
+
data.tar.gz: c3d78c1c8ec27d9627d88219d8c67889db89c4af56d6f92ada2d3962f7f3329fa493a3b9d70638075517850728b389c3652d9575313ec1b3f67ba8f704d65758
|
data/lib/esruby/build.rb
CHANGED
@@ -34,7 +34,6 @@ module ESRuby
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def load_gems
|
37
|
-
gem_paths = JSON.parse(File.read(gem_paths_file))
|
38
37
|
gem_paths.each do |gem_path|
|
39
38
|
esruby_spec_path = "#{gem_path}/esruby_gem"
|
40
39
|
load(esruby_spec_path) if File.file?(esruby_spec_path)
|
@@ -42,10 +41,22 @@ module ESRuby
|
|
42
41
|
nil
|
43
42
|
end
|
44
43
|
|
44
|
+
def gem_paths
|
45
|
+
JSON.parse(File.read(gem_paths_file))
|
46
|
+
end
|
47
|
+
|
45
48
|
def gem_paths_file
|
46
49
|
"#{build_directory}/gem_paths.json"
|
47
50
|
end
|
48
51
|
|
52
|
+
def cxx_include_argument
|
53
|
+
paths = []
|
54
|
+
paths << "#{mruby_directory}/include"
|
55
|
+
paths += gem_paths.map { |gem_path| "#{gem_path}/include" }
|
56
|
+
arguments = paths.map { |path| "-I #{path}" }
|
57
|
+
argument = arguments.join(" ")
|
58
|
+
end
|
59
|
+
|
49
60
|
def prepended_js_sources
|
50
61
|
js_files = []
|
51
62
|
Gem::Specification.specifications.each do |specification|
|
@@ -125,9 +136,9 @@ module ESRuby
|
|
125
136
|
js_arguments += " "
|
126
137
|
js_arguments += appended_js_sources.map { |path| "--post-js #{path}" }.join(" ")
|
127
138
|
RakeFileUtils.sh "#{mrbc} -B app -o #{build_directory}/app.c #{ruby_sources.join(" ")}"
|
128
|
-
RakeFileUtils.sh "emcc --bind
|
129
|
-
RakeFileUtils.sh "emcc -std=c++11 --bind
|
130
|
-
RakeFileUtils.sh "emcc --bind
|
139
|
+
RakeFileUtils.sh "emcc --bind #{cxx_include_argument} #{build_directory}/app.c -o #{build_directory}/app.o #{build_directory}/emscripten/lib/libmruby.a -lm #{js_arguments} #{optimization_argument} #{closure_argument} #{debug_argument} -s ALLOW_MEMORY_GROWTH=1"
|
140
|
+
RakeFileUtils.sh "emcc -std=c++11 --bind #{cxx_include_argument} #{gem_directory}/resources/cpp/main.cpp -o #{build_directory}/main.o #{build_directory}/emscripten/lib/libmruby.a -lm #{js_arguments} #{optimization_argument} #{closure_argument} #{debug_argument} -s ALLOW_MEMORY_GROWTH=1"
|
141
|
+
RakeFileUtils.sh "emcc --bind #{cxx_include_argument} -o #{build_directory}/output.js #{build_directory}/app.o #{build_directory}/main.o #{build_directory}/emscripten/lib/libmruby.a -lm #{js_arguments} #{optimization_argument} #{closure_argument} #{debug_argument} -s ALLOW_MEMORY_GROWTH=1"
|
131
142
|
#if build.build_mode == 'production'
|
132
143
|
# ENV["EMCC_CLOSURE_ARGS"] = "--language_in=ECMASCRIPT6" #possibly allow setting output: --language_out=ECMASCRIPT6
|
133
144
|
# sh "java -jar #{PROJECT_DIRECTORY}/emsdk/emscripten/incoming/third_party/closure-compiler/compiler.jar --js #{build.absolute_build_directory}/output.js --js_output_file #{build.absolute_output}"
|
data/resources/cpp/main.cpp
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
#include "
|
1
|
+
#include "esruby.hpp"
|
2
2
|
|
3
3
|
// we need to load the esruby bindings here, see issue:
|
4
4
|
// https://github.com/kripken/emscripten/issues/5537
|
5
5
|
// although you can observe that the bindings in esruby-bind do work
|
6
6
|
// so im not sure what the problem is
|
7
|
-
// idealy i would like to use a compiler option like EXPORTED_FUNCTIONS, for classes
|
7
|
+
// idealy i would like to use a compiler option like EXPORTED_FUNCTIONS, but for classes
|
8
8
|
EMSCRIPTEN_BINDINGS(esruby)
|
9
9
|
{
|
10
10
|
emscripten::class_<ESRuby>("ESRuby")
|