From 8819ef1b9fff749df18670a81e4e3bc6521d5bd0 Mon Sep 17 00:00:00 2001 From: Wolfie Date: Sat, 16 Feb 2019 14:17:17 -0400 Subject: [PATCH 1/7] Implemented a new sample as a proof of concept source / output split. --- splitout/Makefile | 42 +++++++++++++++++++++++++++++++++++ splitout/Splitout.hx | 21 ++++++++++++++++++ splitout/SplitoutModule.hx | 36 ++++++++++++++++++++++++++++++ splitout/index.html | 8 +++++++ splitout/point.cpp | 6 +++++ splitout/point.h | 22 ++++++++++++++++++ splitout/point.idl | 10 +++++++++ splitout/webRoot/favicon.ico | Bin 0 -> 1150 bytes splitout/webRoot/index.html | 8 +++++++ splitout/webidl.json | 7 ++++++ webidl/Generate.hx | 21 ++++++++++++------ webidl/Options.hx | 1 + 12 files changed, 175 insertions(+), 7 deletions(-) create mode 100644 splitout/Makefile create mode 100644 splitout/Splitout.hx create mode 100644 splitout/SplitoutModule.hx create mode 100644 splitout/index.html create mode 100644 splitout/point.cpp create mode 100644 splitout/point.h create mode 100644 splitout/point.idl create mode 100644 splitout/webRoot/favicon.ico create mode 100644 splitout/webRoot/index.html create mode 100644 splitout/webidl.json diff --git a/splitout/Makefile b/splitout/Makefile new file mode 100644 index 0000000..c66b536 --- /dev/null +++ b/splitout/Makefile @@ -0,0 +1,42 @@ +all: + +OUT = "./webRoot/" + +clean: + if [ -f $(OUT)libpoint.cpp ]; then rm $(OUT)libpoint.cpp; fi; + if [ -f $(OUT)libpoint.bc ]; then rm $(OUT)libpoint.bc; fi; + if [ -f $(OUT)libpoint.js ]; then rm $(OUT)libpoint.js; fi; + if [ -f $(OUT)libpoint.wasm ]; then rm $(OUT)libpoint.wasm; fi; + if [ -f $(OUT)splitout.js ]; then rm $(OUT)splitout.js; fi; + if [ -f $(OUT)point.bc ]; then rm $(OUT)point.bc; fi; + +libpoint.cpp: + haxe -lib webidl --macro "SplitoutModule.buildLibCpp()" + +libpoint.js: libpoint.cpp + haxe -lib webidl --macro "SplitoutModule.buildLibJS()" + +js: libpoint.js + haxe -js $(OUT)splitout.js -lib webidl -main Splitout -dce full + +# ---- HL PART + +ifndef HLPATH +HLPATH = /path/to/hl +endif + +libpoint.hdll: libpoint.cpp + $(CC) -o libpoint.hdll -shared -Wall -O3 -I . -I $(HLPATH) libpoint.cpp point.cpp -lstdc++ -lhl + +libpoint_win: libpoint.cpp + cl /olibpoint.hdll /LD /EHsc /I $(HLPATH) /DYNAMICBASE libhl.lib libpoint.cpp point.cpp + +hl: libpoint.hdll + haxe -hl splitout.hl -lib webidl -main Splitout + +.PHONY: libpoint.cpp libpoint.js + +.SUFFIXES : .cpp .o + +.cpp.o: + $CC \ No newline at end of file diff --git a/splitout/Splitout.hx b/splitout/Splitout.hx new file mode 100644 index 0000000..bfdbe6f --- /dev/null +++ b/splitout/Splitout.hx @@ -0,0 +1,21 @@ +import SplitoutModule.Point; +import SplitoutModule.Init as SplitoutModuleInit; + +class Splitout { + + public static function main() { + SplitoutModuleInit.init(startApp); + } + + public static function startApp() { + var p1 = new Point(); + p1.x = 4; + p1.y = 5; + var p2 = new Point(7,8); + var p = p1.op_add(p2); + trace('Result = ${p.x},${p.y} len=${p.length()}'); + p1.delete(); + p2.delete(); + p.delete(); + } +} \ No newline at end of file diff --git a/splitout/SplitoutModule.hx b/splitout/SplitoutModule.hx new file mode 100644 index 0000000..1e3866c --- /dev/null +++ b/splitout/SplitoutModule.hx @@ -0,0 +1,36 @@ +#if !macro +private typedef Import = haxe.macro.MacroType<[SplitoutModule.build()]>; +#else + +class SplitoutModule { + + static var json = { + var cc = sys.io.File.getBytes("./webidl.json"); + var obj = haxe.Json.parse(cc.toString()); + obj; + } + + static var config : webidl.Options = json; + + public static function build() { + return webidl.Module.build(config); + } + + public static function buildLibCpp() { + webidl.Generate.generateCpp(config); + } + + public static function buildLibJS() { + var sourceFiles = ["point.cpp"]; + webidl.Generate.generateJs(config, sourceFiles); + } +} + +#end + +//static var config : webidl.Options = { +// idlFile : "point.idl", +// nativeLib : "libpoint", +// includeCode : "#include \"point.h\"", +// autoGC : false, +//}; \ No newline at end of file diff --git a/splitout/index.html b/splitout/index.html new file mode 100644 index 0000000..e6600ea --- /dev/null +++ b/splitout/index.html @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/splitout/point.cpp b/splitout/point.cpp new file mode 100644 index 0000000..540392c --- /dev/null +++ b/splitout/point.cpp @@ -0,0 +1,6 @@ +#include +#include "point.h" + +double Point::length() { + return sqrt(x * x + y * y); +} diff --git a/splitout/point.h b/splitout/point.h new file mode 100644 index 0000000..f1d333b --- /dev/null +++ b/splitout/point.h @@ -0,0 +1,22 @@ + +class Point { +public: + int x; + int y; + Point() { + x = 0; + y = 0; + } + Point(const Point &p) { + x = p.x; + y = p.y; + } + Point(int x, int y) { + this->x = x; + this->y = y; + } + Point operator +( const Point &p ) { + return Point(x + p.x, y + p.y); + } + double length(); +}; diff --git a/splitout/point.idl b/splitout/point.idl new file mode 100644 index 0000000..7dfbea3 --- /dev/null +++ b/splitout/point.idl @@ -0,0 +1,10 @@ + +interface Point { + attribute long x; + attribute long y; + void Point(); + void Point( long x, long y ); + [Operator="*",Ref] Point op_add( [Const,Ref] Point p ); + double length(); +}; + diff --git a/splitout/webRoot/favicon.ico b/splitout/webRoot/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..9ae83d351afd49157fa6f577c99390d845dcfbb0 GIT binary patch literal 1150 zcmaKsJxc>Y5QZltc!dg)5Rs^7ayI@L8?n)UU<5IZbz)i@@dHKd6cH`7(=yuFs9XZQJS#)L2 z0@P#j=oh0s?m=_RJ^m@UJKvaFuN$GW;r=8*)|lRE){kE*nE57wi z?`GA;g*Cd5^mVH@ug>ZFe*EwQ`lI)qS)MU{8uZnP^3EgHhF&nnoWA0(c + + + + + + + \ No newline at end of file diff --git a/splitout/webidl.json b/splitout/webidl.json new file mode 100644 index 0000000..a04d4c3 --- /dev/null +++ b/splitout/webidl.json @@ -0,0 +1,7 @@ +{ + "idlFile": "point.idl", + "nativeLib": "libpoint", + "includeCode": "#include \"point.h\"", + "autoGC": false, + "out": "./webRoot" +} \ No newline at end of file diff --git a/webidl/Generate.hx b/webidl/Generate.hx index 2656bc2..7b9491e 100644 --- a/webidl/Generate.hx +++ b/webidl/Generate.hx @@ -380,7 +380,7 @@ template pref *_alloc_const( const T *value ) { add("}"); // extern C - sys.io.File.saveContent(opts.nativeLib+".cpp", output.toString()); + sys.io.File.saveContent(opts.out + "/" + opts.nativeLib+".cpp", output.toString()); } static function command( cmd, args : Array ) { @@ -411,18 +411,26 @@ template pref *_alloc_const( const T *value ) { var outFiles = []; sources.push(lib+".cpp"); for( cfile in sources ) { - var out = cfile.substr(0, -4) + ".bc"; - var args = params.concat(["-c", cfile, "-o", out]); + var sourcePath = if(sys.FileSystem.exists(opts.out+ "/" + cfile)){ + opts.out + "/" + cfile; + } else { cfile; } + + //var out = cfile.substr(0, -4) + ".bc"; + var out = opts.out + "/" + cfile.substr(0, -4) + ".bc"; + //var args = params.concat(["-c", cfile, "-o", out]); + var args = params.concat(["-c", sourcePath, "-o", out, "-I" + Sys.getCwd()]); command( emcc, args); outFiles.push(out); } // link : because too many files, generate Makefile var tmp = "Makefile.tmp"; + var libPath = opts.out + "/" + lib; + var args = params.concat([ "-s", 'EXPORT_NAME="\'$lib\'"', "-s", "MODULARIZE=1", "--memory-init-file", "0", - "-o", '$lib.js' + "-o", '$libPath.js' ]); var output = "SOURCES = " + outFiles.join(" ") + "\n"; output += "all:\n"; @@ -430,7 +438,6 @@ template pref *_alloc_const( const T *value ) { sys.io.File.saveContent(tmp, output); command("make", ["-f", tmp]); sys.FileSystem.deleteFile(tmp); + sys.io.File.copy("index.html", opts.out+"/index.html"); } - - -} +} \ No newline at end of file diff --git a/webidl/Options.hx b/webidl/Options.hx index 26354da..335121e 100644 --- a/webidl/Options.hx +++ b/webidl/Options.hx @@ -6,4 +6,5 @@ typedef Options = { @:optional var includeCode : String; @:optional var chopPrefix : String; @:optional var autoGC : Bool; + @:optional var out: String; } \ No newline at end of file From e758a27fd631a9f92153bc29e4a0ee82a1254567 Mon Sep 17 00:00:00 2001 From: Wolfie Date: Sat, 16 Feb 2019 17:32:02 -0400 Subject: [PATCH 2/7] Consolidating the various options that are sent to the Generator. --- .vscode/c_cpp_properties.json | 16 ++++ splitout/SplitoutModule.hx | 14 +--- splitout/context.cpp | 6 ++ splitout/context.h | 9 +++ splitout/context.idl | 4 + splitout/point.idl | 3 +- splitout/webidl.json | 2 +- webidl/Generate.hx | 134 +++++++++++++++++----------------- webidl/Options.hx | 2 +- 9 files changed, 110 insertions(+), 80 deletions(-) create mode 100644 .vscode/c_cpp_properties.json create mode 100644 splitout/context.cpp create mode 100644 splitout/context.h create mode 100644 splitout/context.idl diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..ee202d8 --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,16 @@ +{ + "configurations": [ + { + "name": "Linux", + "includePath": [ + "${workspaceFolder}/**" + ], + "defines": [], + "compilerPath": "/usr/bin/clang", + "cStandard": "c11", + "cppStandard": "c++17", + "intelliSenseMode": "clang-x64" + } + ], + "version": 4 +} \ No newline at end of file diff --git a/splitout/SplitoutModule.hx b/splitout/SplitoutModule.hx index 1e3866c..3c643bd 100644 --- a/splitout/SplitoutModule.hx +++ b/splitout/SplitoutModule.hx @@ -10,7 +10,7 @@ class SplitoutModule { obj; } - static var config : webidl.Options = json; + static var config: webidl.Options = json; public static function build() { return webidl.Module.build(config); @@ -21,16 +21,8 @@ class SplitoutModule { } public static function buildLibJS() { - var sourceFiles = ["point.cpp"]; - webidl.Generate.generateJs(config, sourceFiles); + webidl.Generate.generateJs(config); } } -#end - -//static var config : webidl.Options = { -// idlFile : "point.idl", -// nativeLib : "libpoint", -// includeCode : "#include \"point.h\"", -// autoGC : false, -//}; \ No newline at end of file +#end \ No newline at end of file diff --git a/splitout/context.cpp b/splitout/context.cpp new file mode 100644 index 0000000..64e6f7d --- /dev/null +++ b/splitout/context.cpp @@ -0,0 +1,6 @@ +#include "context.h" +#include "stdio.h" + +void Context::test(){ + printf("%s", "This is test!"); +} diff --git a/splitout/context.h b/splitout/context.h new file mode 100644 index 0000000..160d508 --- /dev/null +++ b/splitout/context.h @@ -0,0 +1,9 @@ +#include "stdio.h" + +class Context { +public: + Context(){ + printf("%s", "This is Context!"); + } + void test(); +} \ No newline at end of file diff --git a/splitout/context.idl b/splitout/context.idl new file mode 100644 index 0000000..694a7ea --- /dev/null +++ b/splitout/context.idl @@ -0,0 +1,4 @@ +interface Context { + void Context(); + void test(); +}; \ No newline at end of file diff --git a/splitout/point.idl b/splitout/point.idl index 7dfbea3..c9f3517 100644 --- a/splitout/point.idl +++ b/splitout/point.idl @@ -6,5 +6,4 @@ interface Point { void Point( long x, long y ); [Operator="*",Ref] Point op_add( [Const,Ref] Point p ); double length(); -}; - +}; \ No newline at end of file diff --git a/splitout/webidl.json b/splitout/webidl.json index a04d4c3..fb9356c 100644 --- a/splitout/webidl.json +++ b/splitout/webidl.json @@ -1,7 +1,7 @@ { "idlFile": "point.idl", "nativeLib": "libpoint", - "includeCode": "#include \"point.h\"", + "sourceFiles": ["point.cpp"], "autoGC": false, "out": "./webRoot" } \ No newline at end of file diff --git a/webidl/Generate.hx b/webidl/Generate.hx index d79264e..500cfda 100644 --- a/webidl/Generate.hx +++ b/webidl/Generate.hx @@ -2,77 +2,66 @@ package webidl; import webidl.Data; class Generate { - static var HEADER_EMSCRIPTEN = " - -#include -#define HL_PRIM -#define HL_NAME(n) EMSCRIPTEN_KEEPALIVE eb_##n -#define DEFINE_PRIM(ret, name, args) -#define _OPT(t) t* -#define _GET_OPT(value,t) *value - - -"; + #include + #define HL_PRIM + #define HL_NAME(n) EMSCRIPTEN_KEEPALIVE eb_##n + #define DEFINE_PRIM(ret, name, args) + #define _OPT(t) t* + #define _GET_OPT(value,t) *value + "; static var HEADER_HL = " - -#include -#define _IDL _BYTES -#define _OPT(t) vdynamic * -#define _GET_OPT(value,t) (value)->v.t - - -"; + #include + #define _IDL _BYTES + #define _OPT(t) vdynamic * + #define _GET_OPT(value,t) (value)->v.t + "; static var HEADER_NO_GC = " - -#define alloc_ref(r, _) r -#define alloc_ref_const(r,_) r -#define _ref(t) t -#define _unref(v) v -#define free_ref(v) delete (v) -#define HL_CONST const - + #define alloc_ref(r, _) r + #define alloc_ref_const(r,_) r + #define _ref(t) t + #define _unref(v) v + #define free_ref(v) delete (v) + #define HL_CONST const "; static var HEADER_GC = " + template struct pref { + void *finalize; + T *value; + }; + + #define _ref(t) pref + #define _unref(v) v->value + #define alloc_ref(r,t) _alloc_ref(r,finalize_##t) + #define alloc_ref_const(r, _) _alloc_const(r) + #define HL_CONST + + template void free_ref( pref *r ) { + if( !r->finalize ) return; + delete r->value; + r->value = NULL; + r->finalize = NULL; + } -template struct pref { - void *finalize; - T *value; -}; - -#define _ref(t) pref -#define _unref(v) v->value -#define alloc_ref(r,t) _alloc_ref(r,finalize_##t) -#define alloc_ref_const(r, _) _alloc_const(r) -#define HL_CONST - -template void free_ref( pref *r ) { - if( !r->finalize ) return; - delete r->value; - r->value = NULL; - r->finalize = NULL; -} - -template pref *_alloc_ref( T *value, void (*finalize)( pref * ) ) { - pref *r = (pref*)hl_gc_alloc_finalizer(sizeof(r)); - r->finalize = finalize; - r->value = value; - return r; -} - -template pref *_alloc_const( const T *value ) { - pref *r = (pref*)hl_gc_alloc_noptr(sizeof(r)); - r->finalize = NULL; - r->value = (T*)value; - return r; -} - -"; - - public static function generateCpp( opts : Options ) { + template pref *_alloc_ref( T *value, void (*finalize)( pref * ) ) { + pref *r = (pref*)hl_gc_alloc_finalizer(sizeof(r)); + r->finalize = finalize; + r->value = value; + return r; + } + + template pref *_alloc_const( const T *value ) { + pref *r = (pref*)hl_gc_alloc_noptr(sizeof(r)); + r->finalize = NULL; + r->value = (T*)value; + return r; + } + "; + + public static function generateCpp(opts : Options) { var file = opts.idlFile; var content = sys.io.File.getBytes(file); var parse = new webidl.Parser(); @@ -99,10 +88,23 @@ template pref *_alloc_const( const T *value ) { add(StringTools.trim(gc ? HEADER_GC : HEADER_NO_GC)); add(""); add("#endif"); - if( opts.includeCode != null ) { + + /* Handle Includes **/ + for(sFile in opts.sourceFiles){ + var sourcePath = if(sys.FileSystem.exists(opts.out+ "/" + sFile)){ + opts.out + "/" + sFile; + } else { sFile; } + var source = sys.io.File.getBytes(sourcePath).toString(); + var lines = source.split("\n"); + add(""); - add(StringTools.trim(opts.includeCode)); + for(l in lines){ + if(StringTools.startsWith(l, "#include")){ + add(StringTools.trim(l)); + } + } } + add(""); add('extern "C" {'); add(""); @@ -390,7 +392,9 @@ template pref *_alloc_const( const T *value ) { if( ret != 0 ) throw "Command '" + cmd + "' has exit with error code " + ret; } - public static function generateJs( opts : Options, sources : Array, ?params : Array ) { + public static function generateJs(opts : Options, ?params : Array) { + var sources = opts.sourceFiles; + if( params == null ) params = []; diff --git a/webidl/Options.hx b/webidl/Options.hx index 335121e..7cf3d29 100644 --- a/webidl/Options.hx +++ b/webidl/Options.hx @@ -3,7 +3,7 @@ package webidl; typedef Options = { var idlFile : String; var nativeLib : String; - @:optional var includeCode : String; + var sourceFiles: Array; @:optional var chopPrefix : String; @:optional var autoGC : Bool; @:optional var out: String; From f3642426777c8cfec3b67e8c842fc01ccea9c9aa Mon Sep 17 00:00:00 2001 From: Wolfie Date: Sat, 16 Feb 2019 18:10:45 -0400 Subject: [PATCH 3/7] Compiling Multiple c++ targets --- splitout/Makefile | 4 +- splitout/Splitout.hx | 4 ++ splitout/context.cpp | 2 +- splitout/context.h | 4 +- splitout/context.idl | 4 -- splitout/point.idl | 5 ++ splitout/webRoot/libpoint.cpp | 100 +++++++++++++++++++++++++++++++++ splitout/webRoot/libpoint.wasm | Bin 0 -> 12124 bytes splitout/webidl.json | 2 +- webidl/Generate.hx | 12 ++-- 10 files changed, 119 insertions(+), 18 deletions(-) delete mode 100644 splitout/context.idl create mode 100644 splitout/webRoot/libpoint.cpp create mode 100644 splitout/webRoot/libpoint.wasm diff --git a/splitout/Makefile b/splitout/Makefile index c66b536..fb16869 100644 --- a/splitout/Makefile +++ b/splitout/Makefile @@ -26,10 +26,10 @@ HLPATH = /path/to/hl endif libpoint.hdll: libpoint.cpp - $(CC) -o libpoint.hdll -shared -Wall -O3 -I . -I $(HLPATH) libpoint.cpp point.cpp -lstdc++ -lhl + $(CC) -o libpoint.hdll -shared -Wall -O3 -I . -I $(HLPATH) libpoint.cpp point.cpp context.cpp -lstdc++ -lhl libpoint_win: libpoint.cpp - cl /olibpoint.hdll /LD /EHsc /I $(HLPATH) /DYNAMICBASE libhl.lib libpoint.cpp point.cpp + cl /olibpoint.hdll /LD /EHsc /I $(HLPATH) /DYNAMICBASE libhl.lib libpoint.cpp point.cpp context.cpp hl: libpoint.hdll haxe -hl splitout.hl -lib webidl -main Splitout diff --git a/splitout/Splitout.hx b/splitout/Splitout.hx index bfdbe6f..9604f9e 100644 --- a/splitout/Splitout.hx +++ b/splitout/Splitout.hx @@ -1,4 +1,5 @@ import SplitoutModule.Point; +import SplitoutModule.Context; import SplitoutModule.Init as SplitoutModuleInit; class Splitout { @@ -17,5 +18,8 @@ class Splitout { p1.delete(); p2.delete(); p.delete(); + + var c1 = new Context(); + c1.test(); } } \ No newline at end of file diff --git a/splitout/context.cpp b/splitout/context.cpp index 64e6f7d..7515ea4 100644 --- a/splitout/context.cpp +++ b/splitout/context.cpp @@ -2,5 +2,5 @@ #include "stdio.h" void Context::test(){ - printf("%s", "This is test!"); + printf("%s\n", "This is test!"); } diff --git a/splitout/context.h b/splitout/context.h index 160d508..52e70d2 100644 --- a/splitout/context.h +++ b/splitout/context.h @@ -3,7 +3,7 @@ class Context { public: Context(){ - printf("%s", "This is Context!"); + printf("%s\n", "This is Context!"); } void test(); -} \ No newline at end of file +}; \ No newline at end of file diff --git a/splitout/context.idl b/splitout/context.idl deleted file mode 100644 index 694a7ea..0000000 --- a/splitout/context.idl +++ /dev/null @@ -1,4 +0,0 @@ -interface Context { - void Context(); - void test(); -}; \ No newline at end of file diff --git a/splitout/point.idl b/splitout/point.idl index c9f3517..562c5c8 100644 --- a/splitout/point.idl +++ b/splitout/point.idl @@ -6,4 +6,9 @@ interface Point { void Point( long x, long y ); [Operator="*",Ref] Point op_add( [Const,Ref] Point p ); double length(); +}; + +interface Context { + void Context(); + void test(); }; \ No newline at end of file diff --git a/splitout/webRoot/libpoint.cpp b/splitout/webRoot/libpoint.cpp new file mode 100644 index 0000000..6c87a46 --- /dev/null +++ b/splitout/webRoot/libpoint.cpp @@ -0,0 +1,100 @@ +#ifdef EMSCRIPTEN + +#include + #define HL_PRIM + #define HL_NAME(n) EMSCRIPTEN_KEEPALIVE eb_##n + #define DEFINE_PRIM(ret, name, args) + #define _OPT(t) t* + #define _GET_OPT(value,t) *value +#define alloc_ref(r, _) r + #define alloc_ref_const(r,_) r + #define _ref(t) t + #define _unref(v) v + #define free_ref(v) delete (v) + #define HL_CONST const + +#else + +#define HL_NAME(x) libpoint_##x +#include + #define _IDL _BYTES + #define _OPT(t) vdynamic * + #define _GET_OPT(value,t) (value)->v.t +#define alloc_ref(r, _) r + #define alloc_ref_const(r,_) r + #define _ref(t) t + #define _unref(v) v + #define free_ref(v) delete (v) + #define HL_CONST const + +#endif + +#include +#include "point.h" + +#include "context.h" +#include "stdio.h" + +extern "C" { + +static void finalize_Point( _ref(Point)* _this ) { free_ref(_this); } +HL_PRIM void HL_NAME(Point_delete)( _ref(Point)* _this ) { + free_ref(_this); +} +DEFINE_PRIM(_VOID, Point_delete, _IDL); +static void finalize_Context( _ref(Context)* _this ) { free_ref(_this); } +HL_PRIM void HL_NAME(Context_delete)( _ref(Context)* _this ) { + free_ref(_this); +} +DEFINE_PRIM(_VOID, Context_delete, _IDL); +HL_PRIM int HL_NAME(Point_get_x)( _ref(Point)* _this ) { + return _unref(_this)->x; +} +HL_PRIM int HL_NAME(Point_set_x)( _ref(Point)* _this, int value ) { + _unref(_this)->x = (value); + return value; +} +DEFINE_PRIM(_I32,Point_get_x,_IDL); +DEFINE_PRIM(_I32,Point_set_x,_IDL _I32); + +HL_PRIM int HL_NAME(Point_get_y)( _ref(Point)* _this ) { + return _unref(_this)->y; +} +HL_PRIM int HL_NAME(Point_set_y)( _ref(Point)* _this, int value ) { + _unref(_this)->y = (value); + return value; +} +DEFINE_PRIM(_I32,Point_get_y,_IDL); +DEFINE_PRIM(_I32,Point_set_y,_IDL _I32); + +HL_PRIM _ref(Point)* HL_NAME(Point_new0)() { + return alloc_ref((new Point()),Point); +} +DEFINE_PRIM(_IDL, Point_new0,); + +HL_PRIM _ref(Point)* HL_NAME(Point_new2)(int x, int y) { + return alloc_ref((new Point(x, y)),Point); +} +DEFINE_PRIM(_IDL, Point_new2, _I32 _I32); + +HL_PRIM _ref(Point)* HL_NAME(Point_op_add1)(_ref(Point)* _this, _ref(Point)* p) { + return alloc_ref(new Point(*_unref(_this) + (*_unref(p))),Point); +} +DEFINE_PRIM(_IDL, Point_op_add1, _IDL _IDL); + +HL_PRIM double HL_NAME(Point_length0)(_ref(Point)* _this) { + return _unref(_this)->length(); +} +DEFINE_PRIM(_F64, Point_length0, _IDL); + +HL_PRIM _ref(Context)* HL_NAME(Context_new0)() { + return alloc_ref((new Context()),Context); +} +DEFINE_PRIM(_IDL, Context_new0,); + +HL_PRIM void HL_NAME(Context_test0)(_ref(Context)* _this) { + _unref(_this)->test(); +} +DEFINE_PRIM(_VOID, Context_test0, _IDL); + +} diff --git a/splitout/webRoot/libpoint.wasm b/splitout/webRoot/libpoint.wasm new file mode 100644 index 0000000000000000000000000000000000000000..62b99409b2df2298d5a4905e96f1a88c1ecf8862 GIT binary patch literal 12124 zcmcJVPlzPfeaBzDs_O2U>e=o2BYU*7@mBY)t&t+f>!3^=VaPn}-Sv7cOR)q=4q>#r zYD?R_+S%#pjCX^{Oo9(45kVw6=pe8UJ_uuo2!iM!$U;OgK@brX&_M?sbkIQu1#Du7 zlFjG)dsRI>vyx3nB(zh%epTn%czt90%AfRI zu7y7}egEn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)zZ0b6D zA4PEljOwM#RD1c(;)nw3U{Y7VXcTgao8v?(+|aVorBfw!`qY7pu|bsKU@Rhdy0hHz zma83T8)xY{Tav3~2XZxYO66)~YRdeqZklQvQ>8`}feC=1Ru_ZH7KP2^YQ_bpnp6q< zae}ZdilT3(G@TwGEpcA@aN?oM`oTL_E|iqLDMYXj2JC4I{STMAPI5?Ut7uq+Z+z+; zuJ|2&-~niqZiRY+cSN1f_Vm`!<>5zn@xN&+F1H&R^9d~qYX=s^Kc#ve=elJdWr4V~ z4V!%Rfj8(|8`6K(1N3xgy77kyH-*~Q7anvjGd*eFHSv9in6M9abdl5YE-`*}m4@%C zYr4+&XIh}lzrkGQ!CKUcjG&Cb#wft}0!Mc_xusmFjy||DYDxZK)UvE&)bZ*AomF41 z`7(~3vJd(+m*QZlgHCEbv=qlKx6^9FdW~rv z+cBFJ&wITSGHWSg;ES-X)c=pNs@A}Ck?DOS*-ZSHx4`PHcEZ@ zqOr`w&3|Pk#X`JP-Y@GgDARC}UAXA0DK4@Ims9Z~TkuPU;36w@m^Lb=#X&4_ON)^z5_dH2@M~&pp~yN-+f*FtZ&xViI$mTq1~a$j4LM{ z3479x6~~d+X( Dedup? **/ for(sFile in opts.sourceFiles){ - var sourcePath = if(sys.FileSystem.exists(opts.out+ "/" + sFile)){ - opts.out + "/" + sFile; - } else { sFile; } - var source = sys.io.File.getBytes(sourcePath).toString(); - var lines = source.split("\n"); - add(""); - for(l in lines){ + for(l in sys.io.File.getBytes(if(sys.FileSystem.exists(opts.out+ "/" + sFile)){ + opts.out + "/" + sFile; + } else { sFile; }).toString().split("\n")){ if(StringTools.startsWith(l, "#include")){ add(StringTools.trim(l)); } From 60d390b1efe8e95ceeabebc482e4299560aa76c5 Mon Sep 17 00:00:00 2001 From: Wolfie Date: Sat, 16 Feb 2019 18:25:42 -0400 Subject: [PATCH 4/7] small fixes --- .gitignore | 1 + splitout/Makefile | 1 + splitout/webRoot/libpoint.cpp | 100 --------------------------------- splitout/webRoot/libpoint.wasm | Bin 12124 -> 0 bytes 4 files changed, 2 insertions(+), 100 deletions(-) delete mode 100644 splitout/webRoot/libpoint.cpp delete mode 100644 splitout/webRoot/libpoint.wasm diff --git a/.gitignore b/.gitignore index 327cacb..a1f02ea 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ *.hl *.js *.bc +.vscode diff --git a/splitout/Makefile b/splitout/Makefile index fb16869..89ad087 100644 --- a/splitout/Makefile +++ b/splitout/Makefile @@ -9,6 +9,7 @@ clean: if [ -f $(OUT)libpoint.wasm ]; then rm $(OUT)libpoint.wasm; fi; if [ -f $(OUT)splitout.js ]; then rm $(OUT)splitout.js; fi; if [ -f $(OUT)point.bc ]; then rm $(OUT)point.bc; fi; + if [ -f $(OUT)context.bc ]; then rm $(OUT)context.bc; fi; libpoint.cpp: haxe -lib webidl --macro "SplitoutModule.buildLibCpp()" diff --git a/splitout/webRoot/libpoint.cpp b/splitout/webRoot/libpoint.cpp deleted file mode 100644 index 6c87a46..0000000 --- a/splitout/webRoot/libpoint.cpp +++ /dev/null @@ -1,100 +0,0 @@ -#ifdef EMSCRIPTEN - -#include - #define HL_PRIM - #define HL_NAME(n) EMSCRIPTEN_KEEPALIVE eb_##n - #define DEFINE_PRIM(ret, name, args) - #define _OPT(t) t* - #define _GET_OPT(value,t) *value -#define alloc_ref(r, _) r - #define alloc_ref_const(r,_) r - #define _ref(t) t - #define _unref(v) v - #define free_ref(v) delete (v) - #define HL_CONST const - -#else - -#define HL_NAME(x) libpoint_##x -#include - #define _IDL _BYTES - #define _OPT(t) vdynamic * - #define _GET_OPT(value,t) (value)->v.t -#define alloc_ref(r, _) r - #define alloc_ref_const(r,_) r - #define _ref(t) t - #define _unref(v) v - #define free_ref(v) delete (v) - #define HL_CONST const - -#endif - -#include -#include "point.h" - -#include "context.h" -#include "stdio.h" - -extern "C" { - -static void finalize_Point( _ref(Point)* _this ) { free_ref(_this); } -HL_PRIM void HL_NAME(Point_delete)( _ref(Point)* _this ) { - free_ref(_this); -} -DEFINE_PRIM(_VOID, Point_delete, _IDL); -static void finalize_Context( _ref(Context)* _this ) { free_ref(_this); } -HL_PRIM void HL_NAME(Context_delete)( _ref(Context)* _this ) { - free_ref(_this); -} -DEFINE_PRIM(_VOID, Context_delete, _IDL); -HL_PRIM int HL_NAME(Point_get_x)( _ref(Point)* _this ) { - return _unref(_this)->x; -} -HL_PRIM int HL_NAME(Point_set_x)( _ref(Point)* _this, int value ) { - _unref(_this)->x = (value); - return value; -} -DEFINE_PRIM(_I32,Point_get_x,_IDL); -DEFINE_PRIM(_I32,Point_set_x,_IDL _I32); - -HL_PRIM int HL_NAME(Point_get_y)( _ref(Point)* _this ) { - return _unref(_this)->y; -} -HL_PRIM int HL_NAME(Point_set_y)( _ref(Point)* _this, int value ) { - _unref(_this)->y = (value); - return value; -} -DEFINE_PRIM(_I32,Point_get_y,_IDL); -DEFINE_PRIM(_I32,Point_set_y,_IDL _I32); - -HL_PRIM _ref(Point)* HL_NAME(Point_new0)() { - return alloc_ref((new Point()),Point); -} -DEFINE_PRIM(_IDL, Point_new0,); - -HL_PRIM _ref(Point)* HL_NAME(Point_new2)(int x, int y) { - return alloc_ref((new Point(x, y)),Point); -} -DEFINE_PRIM(_IDL, Point_new2, _I32 _I32); - -HL_PRIM _ref(Point)* HL_NAME(Point_op_add1)(_ref(Point)* _this, _ref(Point)* p) { - return alloc_ref(new Point(*_unref(_this) + (*_unref(p))),Point); -} -DEFINE_PRIM(_IDL, Point_op_add1, _IDL _IDL); - -HL_PRIM double HL_NAME(Point_length0)(_ref(Point)* _this) { - return _unref(_this)->length(); -} -DEFINE_PRIM(_F64, Point_length0, _IDL); - -HL_PRIM _ref(Context)* HL_NAME(Context_new0)() { - return alloc_ref((new Context()),Context); -} -DEFINE_PRIM(_IDL, Context_new0,); - -HL_PRIM void HL_NAME(Context_test0)(_ref(Context)* _this) { - _unref(_this)->test(); -} -DEFINE_PRIM(_VOID, Context_test0, _IDL); - -} diff --git a/splitout/webRoot/libpoint.wasm b/splitout/webRoot/libpoint.wasm deleted file mode 100644 index 62b99409b2df2298d5a4905e96f1a88c1ecf8862..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12124 zcmcJVPlzPfeaBzDs_O2U>e=o2BYU*7@mBY)t&t+f>!3^=VaPn}-Sv7cOR)q=4q>#r zYD?R_+S%#pjCX^{Oo9(45kVw6=pe8UJ_uuo2!iM!$U;OgK@brX&_M?sbkIQu1#Du7 zlFjG)dsRI>vyx3nB(zh%epTn%czt90%AfRI zu7y7}egEnH)0eN`+_-e*N#}I))6+Lcea*7@&f8s+;^Avwxp?i`=J?!b^E(gqpWYnZ zjCbK~eDTuN{>G(?+x>Lc);sdmKm2BR==@h6d-#!!M;`lDHQHcXruk&g@7cn+O-!yQ z&1SlKkI&Oany213^Njzzb3S+8dHtX2SJvW^G?vocU+s_k?nq~P@LK;nr`^%{>7j9d zdwkk;?6F5SuUy-oc~pt%i%&f9Mfa(xwecKw`}Coan{GMZ`1YvZcb{u+JdGc1UUr{_GV{7sqnPRL%{R6$ zjfU>N*(Yvd#;aF1u3T}y-roPg&--WUpF8gJi)a9&UfF)?(ecI0!$+@QyxezlvkYDy z2HR$~Z9l%ngPWtiYtPuvM=$R5T`@D4xRb7E{>I&3IJWYc)3bl~`}eFQ$?nOto0RTk zIyjY{OvBMZxW08NEt4W+tZ2B>ol1*YyOhbPteAs5ldT^uO4s>ZvA_Z$>D<$G;jd;o zr;e4bXt}T_vS{+;s%JyHW`#DhkzP_JS4Cw#Ze1Px{SS&|t<&n<({sVCc}8`~SZ#8{ zmv+OKiEjAfbmDDBmm929Cj1$6)6#xA{d5DZIWjtBx$*iX--5hS&75ezuL%_se^_>UyXA~RkF%w+KthJ2?RMbt<) zW$P#-0>}|^J(ms3l$S-MBWpP#eQLD&3jh)Tp%7rPelihUXHtRBM` z;vGW@qHxgltXo_m0@27nyFm~B(7%j{-ft&^(Sy#Jy?Z#}mO_kiGrdKbJfg)^F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jg(Hd2=MX$O9mS7LXx3GmbK%f`` zl^I~IPbsMDyUMBSOjZCYV7HLgtdO3YOO7eQwNy<@MKssWQ6I{i>@Ew^NZNrn(A4@$ zR+3m{((cu7v+7JXt25bBZ&v{Xg9=hS0S7~ra$)z+~UMe(78Ha3$;Xm#fDiyYM-Q+dR(%6o?imx5_y zp`#pF>4frJjyux zl|E%2Wv{WSCbWWpsg*~`pX5%~eKr|QypMOM%FSwb!ixkMybJ_glQ41kZ0KcqE^?&Xzn~MP>$|VRA0|+^28@C_>iLaZiIaH-|aD2EhBEg)zZ0b6D zA4PEljOwM#RD1c(;)nw3U{Y7VXcTgao8v?(+|aVorBfw!`qY7pu|bsKU@Rhdy0hHz zma83T8)xY{Tav3~2XZxYO66)~YRdeqZklQvQ>8`}feC=1Ru_ZH7KP2^YQ_bpnp6q< zae}ZdilT3(G@TwGEpcA@aN?oM`oTL_E|iqLDMYXj2JC4I{STMAPI5?Ut7uq+Z+z+; zuJ|2&-~niqZiRY+cSN1f_Vm`!<>5zn@xN&+F1H&R^9d~qYX=s^Kc#ve=elJdWr4V~ z4V!%Rfj8(|8`6K(1N3xgy77kyH-*~Q7anvjGd*eFHSv9in6M9abdl5YE-`*}m4@%C zYr4+&XIh}lzrkGQ!CKUcjG&Cb#wft}0!Mc_xusmFjy||DYDxZK)UvE&)bZ*AomF41 z`7(~3vJd(+m*QZlgHCEbv=qlKx6^9FdW~rv z+cBFJ&wITSGHWSg;ES-X)c=pNs@A}Ck?DOS*-ZSHx4`PHcEZ@ zqOr`w&3|Pk#X`JP-Y@GgDARC}UAXA0DK4@Ims9Z~TkuPU;36w@m^Lb=#X&4_ON)^z5_dH2@M~&pp~yN-+f*FtZ&xViI$mTq1~a$j4LM{ z3479x6~~d+X( Date: Mon, 18 Feb 2019 14:20:17 -0400 Subject: [PATCH 5/7] Merged samples --- sample/Makefile | 32 ------------- sample/SampleModule.hx | 29 ----------- sample/sample.html | 2 - samples/simple/Makefile | 45 ++++++++++++++++++ samples/simple/README.md | 1 + sample/Sample.hx => samples/simple/Simple.hx | 16 +++++-- samples/simple/SimpleModule.hx | 28 +++++++++++ samples/simple/context.cpp | 6 +++ samples/simple/context.h | 13 +++++ samples/simple/index.html | 9 ++++ {sample => samples/simple}/point.cpp | 0 {sample => samples/simple}/point.h | 0 sample/point.idl => samples/simple/simple.idl | 5 +- samples/simple/webRoot/favicon.ico | Bin 0 -> 1150 bytes samples/simple/webRoot/index.html | 9 ++++ samples/simple/webidl.json | 7 +++ 16 files changed, 133 insertions(+), 69 deletions(-) delete mode 100644 sample/Makefile delete mode 100644 sample/SampleModule.hx delete mode 100644 sample/sample.html create mode 100644 samples/simple/Makefile create mode 100644 samples/simple/README.md rename sample/Sample.hx => samples/simple/Simple.hx (54%) create mode 100644 samples/simple/SimpleModule.hx create mode 100644 samples/simple/context.cpp create mode 100644 samples/simple/context.h create mode 100644 samples/simple/index.html rename {sample => samples/simple}/point.cpp (100%) rename {sample => samples/simple}/point.h (100%) rename sample/point.idl => samples/simple/simple.idl (76%) create mode 100644 samples/simple/webRoot/favicon.ico create mode 100644 samples/simple/webRoot/index.html create mode 100644 samples/simple/webidl.json diff --git a/sample/Makefile b/sample/Makefile deleted file mode 100644 index 9c4cb54..0000000 --- a/sample/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -all: - -libpoint.cpp: - haxe -lib webidl --macro "SampleModule.buildLibCpp()" - -libpoint.js: libpoint.cpp - haxe -lib webidl --macro "SampleModule.buildLibJS()" - -js: libpoint.js - haxe -js sample.js -lib webidl -main Sample -dce full - -# ---- HL PART - -ifndef HLPATH -HLPATH = /path/to/hl -endif - -libpoint.hdll: libpoint.cpp - $(CC) -o libpoint.hdll -shared -Wall -O3 -I . -I $(HLPATH) libpoint.cpp point.cpp -lstdc++ -lhl - -libpoint_win: libpoint.cpp - cl /olibpoint.hdll /LD /EHsc /I $(HLPATH) /DYNAMICBASE libhl.lib libpoint.cpp point.cpp - -hl: libpoint.hdll - haxe -hl sample.hl -lib webidl -main Sample - -.PHONY: libpoint.cpp libpoint.js - -.SUFFIXES : .cpp .o - -.cpp.o: - $CC \ No newline at end of file diff --git a/sample/SampleModule.hx b/sample/SampleModule.hx deleted file mode 100644 index da773b0..0000000 --- a/sample/SampleModule.hx +++ /dev/null @@ -1,29 +0,0 @@ -#if !macro -private typedef Import = haxe.macro.MacroType<[SampleModule.build()]>; -#else - -class SampleModule { - - static var config : webidl.Options = { - idlFile : "point.idl", - nativeLib : "libpoint", - includeCode : "#include \"point.h\"", - autoGC : false, - }; - - public static function build() { - return webidl.Module.build(config); - } - - public static function buildLibCpp() { - webidl.Generate.generateCpp(config); - } - - public static function buildLibJS() { - var sourceFiles = ["point.cpp"]; - webidl.Generate.generateJs(config, sourceFiles); - } - -} - -#end \ No newline at end of file diff --git a/sample/sample.html b/sample/sample.html deleted file mode 100644 index 0da1f6a..0000000 --- a/sample/sample.html +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/samples/simple/Makefile b/samples/simple/Makefile new file mode 100644 index 0000000..c64b633 --- /dev/null +++ b/samples/simple/Makefile @@ -0,0 +1,45 @@ +all: + +OUT = "./webRoot/" + +clean: + if [ -f $(OUT)lib_simple.bc ]; then rm $(OUT)lib_simple.bc; fi; + if [ -f $(OUT)lib_simple.cpp ]; then rm $(OUT)lib_simple.cpp; fi; + if [ -f $(OUT)lib_simple.js ]; then rm $(OUT)lib_simple.js; fi; + if [ -f $(OUT)lib_simple.wasm ]; then rm $(OUT)lib_simple.wasm; fi; + + if [ -f $(OUT)simple.js ]; then rm $(OUT)simple.js; fi; + + if [ -f $(OUT)point.bc ]; then rm $(OUT)point.bc; fi; + if [ -f $(OUT)context.bc ]; then rm $(OUT)context.bc; fi; + +lib_simple.cpp: + haxe -lib webidl --macro "SimpleModule.buildLibCpp()" + +lib_simple.js: lib_simple.cpp + haxe -lib webidl --macro "SimpleModule.buildLibJS()" + +js: lib_simple.js + haxe -js $(OUT)simple.js -lib webidl -main Simple -dce full + +# ---- HL PART + +ifndef HLPATH +HLPATH = /path/to/hl +endif + +lib_simple.hdll: lib_simple.cpp + $(CC) -o lib_simple.hdll -shared -Wall -O0 -I . -I $(HLPATH) lib_simple.cpp -lstdc++ -lhl + +lib_simple: lib_simple.cpp + cl /olib_simple.hdll /LD /EHsc /I $(HLPATH) /DYNAMICBASE libhl.lib lib_simple.cpp + +hl: lib_simple.hdll + haxe -hl simple.hl -lib webidl -main Simple + +.PHONY: lib_simple.cpp lib_simple.js + +.SUFFIXES : .cpp .o + +.cpp.o: + $CC \ No newline at end of file diff --git a/samples/simple/README.md b/samples/simple/README.md new file mode 100644 index 0000000..eb7e3e7 --- /dev/null +++ b/samples/simple/README.md @@ -0,0 +1 @@ +# Simple example \ No newline at end of file diff --git a/sample/Sample.hx b/samples/simple/Simple.hx similarity index 54% rename from sample/Sample.hx rename to samples/simple/Simple.hx index d772f67..a6dd911 100644 --- a/sample/Sample.hx +++ b/samples/simple/Simple.hx @@ -1,13 +1,15 @@ -import SampleModule.Point; -import SampleModule.Init as SampleModuleInit; +import SimpleModule.Point; +import SimpleModule.Context; +import SimpleModule.Init as SimpleModuleInit; -class Sample { +class Simple { public static function main() { - SampleModuleInit.init(startApp); + SimpleModuleInit.init(startApp); } public static function startApp() { + /** Point */ var p1 = new Point(); p1.x = 4; p1.y = 5; @@ -17,5 +19,9 @@ class Sample { p1.delete(); p2.delete(); p.delete(); + + /** Context */ + var context = new Context(); + context.test(); } -} +} \ No newline at end of file diff --git a/samples/simple/SimpleModule.hx b/samples/simple/SimpleModule.hx new file mode 100644 index 0000000..7304c11 --- /dev/null +++ b/samples/simple/SimpleModule.hx @@ -0,0 +1,28 @@ +#if !macro +private typedef Import = haxe.macro.MacroType<[SimpleModule.build()]>; +#else + +class SimpleModule { + + static var json = { + var cc = sys.io.File.getBytes("./webidl.json"); + var obj = haxe.Json.parse(cc.toString()); + obj; + } + + static var config: webidl.Options = json; + + public static function build() { + return webidl.Module.build(config); + } + + public static function buildLibCpp() { + webidl.Generate.generateCpp(config); + } + + public static function buildLibJS() { + webidl.Generate.generateJs(config); + } +} + +#end \ No newline at end of file diff --git a/samples/simple/context.cpp b/samples/simple/context.cpp new file mode 100644 index 0000000..105632e --- /dev/null +++ b/samples/simple/context.cpp @@ -0,0 +1,6 @@ +#include "context.h" +#include "stdio.h" + +void Context::test(){ + printf("%s\n", "This is Context::test()"); +} \ No newline at end of file diff --git a/samples/simple/context.h b/samples/simple/context.h new file mode 100644 index 0000000..5744a86 --- /dev/null +++ b/samples/simple/context.h @@ -0,0 +1,13 @@ +#include "stdio.h" + +#include "emscripten.h" +#include +#include + +class Context { + public: + Context(){ + printf("%s\n", "Context Initialized"); + } + void test(); +}; \ No newline at end of file diff --git a/samples/simple/index.html b/samples/simple/index.html new file mode 100644 index 0000000..25369e3 --- /dev/null +++ b/samples/simple/index.html @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/sample/point.cpp b/samples/simple/point.cpp similarity index 100% rename from sample/point.cpp rename to samples/simple/point.cpp diff --git a/sample/point.h b/samples/simple/point.h similarity index 100% rename from sample/point.h rename to samples/simple/point.h diff --git a/sample/point.idl b/samples/simple/simple.idl similarity index 76% rename from sample/point.idl rename to samples/simple/simple.idl index 7dfbea3..264bc04 100644 --- a/sample/point.idl +++ b/samples/simple/simple.idl @@ -1,4 +1,3 @@ - interface Point { attribute long x; attribute long y; @@ -8,3 +7,7 @@ interface Point { double length(); }; +interface Context { + void Context(); + void test(); +}; \ No newline at end of file diff --git a/samples/simple/webRoot/favicon.ico b/samples/simple/webRoot/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..9ae83d351afd49157fa6f577c99390d845dcfbb0 GIT binary patch literal 1150 zcmaKsJxc>Y5QZltc!dg)5Rs^7ayI@L8?n)UU<5IZbz)i@@dHKd6cH`7(=yuFs9XZQJS#)L2 z0@P#j=oh0s?m=_RJ^m@UJKvaFuN$GW;r=8*)|lRE){kE*nE57wi z?`GA;g*Cd5^mVH@ug>ZFe*EwQ`lI)qS)MU{8uZnP^3EgHhF&nnoWA0(c + + + + + + + + \ No newline at end of file diff --git a/samples/simple/webidl.json b/samples/simple/webidl.json new file mode 100644 index 0000000..fc90333 --- /dev/null +++ b/samples/simple/webidl.json @@ -0,0 +1,7 @@ +{ + "idlFile": "simple.idl", + "nativeLib": "lib_simple", + "sourceFiles": ["point.cpp", "context.cpp"], + "autoGC": false, + "out": "./webRoot" +} \ No newline at end of file From 6a3a5040d54bbbd139aba1b8dd65415ce499d3e2 Mon Sep 17 00:00:00 2001 From: Wolfie Date: Mon, 18 Feb 2019 14:20:34 -0400 Subject: [PATCH 6/7] more --- splitout/Makefile | 43 ----------------------------------- splitout/Splitout.hx | 25 -------------------- splitout/SplitoutModule.hx | 28 ----------------------- splitout/context.cpp | 6 ----- splitout/context.h | 9 -------- splitout/index.html | 8 ------- splitout/point.cpp | 6 ----- splitout/point.h | 22 ------------------ splitout/point.idl | 14 ------------ splitout/webRoot/favicon.ico | Bin 1150 -> 0 bytes splitout/webRoot/index.html | 8 ------- splitout/webidl.json | 7 ------ webidl/Generate.hx | 7 +++--- 13 files changed, 3 insertions(+), 180 deletions(-) delete mode 100644 splitout/Makefile delete mode 100644 splitout/Splitout.hx delete mode 100644 splitout/SplitoutModule.hx delete mode 100644 splitout/context.cpp delete mode 100644 splitout/context.h delete mode 100644 splitout/index.html delete mode 100644 splitout/point.cpp delete mode 100644 splitout/point.h delete mode 100644 splitout/point.idl delete mode 100644 splitout/webRoot/favicon.ico delete mode 100644 splitout/webRoot/index.html delete mode 100644 splitout/webidl.json diff --git a/splitout/Makefile b/splitout/Makefile deleted file mode 100644 index 89ad087..0000000 --- a/splitout/Makefile +++ /dev/null @@ -1,43 +0,0 @@ -all: - -OUT = "./webRoot/" - -clean: - if [ -f $(OUT)libpoint.cpp ]; then rm $(OUT)libpoint.cpp; fi; - if [ -f $(OUT)libpoint.bc ]; then rm $(OUT)libpoint.bc; fi; - if [ -f $(OUT)libpoint.js ]; then rm $(OUT)libpoint.js; fi; - if [ -f $(OUT)libpoint.wasm ]; then rm $(OUT)libpoint.wasm; fi; - if [ -f $(OUT)splitout.js ]; then rm $(OUT)splitout.js; fi; - if [ -f $(OUT)point.bc ]; then rm $(OUT)point.bc; fi; - if [ -f $(OUT)context.bc ]; then rm $(OUT)context.bc; fi; - -libpoint.cpp: - haxe -lib webidl --macro "SplitoutModule.buildLibCpp()" - -libpoint.js: libpoint.cpp - haxe -lib webidl --macro "SplitoutModule.buildLibJS()" - -js: libpoint.js - haxe -js $(OUT)splitout.js -lib webidl -main Splitout -dce full - -# ---- HL PART - -ifndef HLPATH -HLPATH = /path/to/hl -endif - -libpoint.hdll: libpoint.cpp - $(CC) -o libpoint.hdll -shared -Wall -O3 -I . -I $(HLPATH) libpoint.cpp point.cpp context.cpp -lstdc++ -lhl - -libpoint_win: libpoint.cpp - cl /olibpoint.hdll /LD /EHsc /I $(HLPATH) /DYNAMICBASE libhl.lib libpoint.cpp point.cpp context.cpp - -hl: libpoint.hdll - haxe -hl splitout.hl -lib webidl -main Splitout - -.PHONY: libpoint.cpp libpoint.js - -.SUFFIXES : .cpp .o - -.cpp.o: - $CC \ No newline at end of file diff --git a/splitout/Splitout.hx b/splitout/Splitout.hx deleted file mode 100644 index 9604f9e..0000000 --- a/splitout/Splitout.hx +++ /dev/null @@ -1,25 +0,0 @@ -import SplitoutModule.Point; -import SplitoutModule.Context; -import SplitoutModule.Init as SplitoutModuleInit; - -class Splitout { - - public static function main() { - SplitoutModuleInit.init(startApp); - } - - public static function startApp() { - var p1 = new Point(); - p1.x = 4; - p1.y = 5; - var p2 = new Point(7,8); - var p = p1.op_add(p2); - trace('Result = ${p.x},${p.y} len=${p.length()}'); - p1.delete(); - p2.delete(); - p.delete(); - - var c1 = new Context(); - c1.test(); - } -} \ No newline at end of file diff --git a/splitout/SplitoutModule.hx b/splitout/SplitoutModule.hx deleted file mode 100644 index 3c643bd..0000000 --- a/splitout/SplitoutModule.hx +++ /dev/null @@ -1,28 +0,0 @@ -#if !macro -private typedef Import = haxe.macro.MacroType<[SplitoutModule.build()]>; -#else - -class SplitoutModule { - - static var json = { - var cc = sys.io.File.getBytes("./webidl.json"); - var obj = haxe.Json.parse(cc.toString()); - obj; - } - - static var config: webidl.Options = json; - - public static function build() { - return webidl.Module.build(config); - } - - public static function buildLibCpp() { - webidl.Generate.generateCpp(config); - } - - public static function buildLibJS() { - webidl.Generate.generateJs(config); - } -} - -#end \ No newline at end of file diff --git a/splitout/context.cpp b/splitout/context.cpp deleted file mode 100644 index 7515ea4..0000000 --- a/splitout/context.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "context.h" -#include "stdio.h" - -void Context::test(){ - printf("%s\n", "This is test!"); -} diff --git a/splitout/context.h b/splitout/context.h deleted file mode 100644 index 52e70d2..0000000 --- a/splitout/context.h +++ /dev/null @@ -1,9 +0,0 @@ -#include "stdio.h" - -class Context { -public: - Context(){ - printf("%s\n", "This is Context!"); - } - void test(); -}; \ No newline at end of file diff --git a/splitout/index.html b/splitout/index.html deleted file mode 100644 index e6600ea..0000000 --- a/splitout/index.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/splitout/point.cpp b/splitout/point.cpp deleted file mode 100644 index 540392c..0000000 --- a/splitout/point.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include -#include "point.h" - -double Point::length() { - return sqrt(x * x + y * y); -} diff --git a/splitout/point.h b/splitout/point.h deleted file mode 100644 index f1d333b..0000000 --- a/splitout/point.h +++ /dev/null @@ -1,22 +0,0 @@ - -class Point { -public: - int x; - int y; - Point() { - x = 0; - y = 0; - } - Point(const Point &p) { - x = p.x; - y = p.y; - } - Point(int x, int y) { - this->x = x; - this->y = y; - } - Point operator +( const Point &p ) { - return Point(x + p.x, y + p.y); - } - double length(); -}; diff --git a/splitout/point.idl b/splitout/point.idl deleted file mode 100644 index 562c5c8..0000000 --- a/splitout/point.idl +++ /dev/null @@ -1,14 +0,0 @@ - -interface Point { - attribute long x; - attribute long y; - void Point(); - void Point( long x, long y ); - [Operator="*",Ref] Point op_add( [Const,Ref] Point p ); - double length(); -}; - -interface Context { - void Context(); - void test(); -}; \ No newline at end of file diff --git a/splitout/webRoot/favicon.ico b/splitout/webRoot/favicon.ico deleted file mode 100644 index 9ae83d351afd49157fa6f577c99390d845dcfbb0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1150 zcmaKsJxc>Y5QZltc!dg)5Rs^7ayI@L8?n)UU<5IZbz)i@@dHKd6cH`7(=yuFs9XZQJS#)L2 z0@P#j=oh0s?m=_RJ^m@UJKvaFuN$GW;r=8*)|lRE){kE*nE57wi z?`GA;g*Cd5^mVH@ug>ZFe*EwQ`lI)qS)MU{8uZnP^3EgHhF&nnoWA0(c - - - - - - - \ No newline at end of file diff --git a/splitout/webidl.json b/splitout/webidl.json deleted file mode 100644 index 67fd51f..0000000 --- a/splitout/webidl.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "idlFile": "point.idl", - "nativeLib": "libpoint", - "sourceFiles": ["point.cpp", "context.cpp"], - "autoGC": false, - "out": "./webRoot" -} \ No newline at end of file diff --git a/webidl/Generate.hx b/webidl/Generate.hx index 7e5e744..e366fc1 100644 --- a/webidl/Generate.hx +++ b/webidl/Generate.hx @@ -399,7 +399,7 @@ class Generate { if( p.substr(0, 2) == "-O" ) hasOpt = true; if( !hasOpt ) - params.push("-O2"); + params.push("-O0"); var lib = opts.nativeLib; @@ -416,9 +416,7 @@ class Generate { opts.out + "/" + cfile; } else { cfile; } - //var out = cfile.substr(0, -4) + ".bc"; var out = opts.out + "/" + cfile.substr(0, -4) + ".bc"; - //var args = params.concat(["-c", cfile, "-o", out]); var args = params.concat(["-c", sourcePath, "-o", out, "-I" + Sys.getCwd()]); command( emcc, args); outFiles.push(out); @@ -429,7 +427,8 @@ class Generate { var libPath = opts.out + "/" + lib; var args = params.concat([ - "-s", 'EXPORT_NAME="\'$lib\'"', "-s", "MODULARIZE=1", + //"-s", 'EXPORT_NAME="\'$lib\'"', "-s", "MODULARIZE=1", "-O0", "-s", "USE_WEBGL2=1", "-s", "FULL_ES3=1", "-s", "NO_EXIT_RUNTIME=1", + "-s", 'EXPORT_NAME="\'$lib\'"', "-s", "MODULARIZE=1", "-O0", "-s", "NO_EXIT_RUNTIME=1", "--memory-init-file", "0", "-o", '$libPath.js' ]); From 8c4c91aa63048ec2d4a5637f113ff377af41a432 Mon Sep 17 00:00:00 2001 From: Zicklag Date: Tue, 19 Feb 2019 20:08:41 -0400 Subject: [PATCH 7/7] Update samples/simple/SimpleModule.hx Co-Authored-By: WolfieWerewolf --- samples/simple/SimpleModule.hx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/simple/SimpleModule.hx b/samples/simple/SimpleModule.hx index 7304c11..869bd49 100644 --- a/samples/simple/SimpleModule.hx +++ b/samples/simple/SimpleModule.hx @@ -4,7 +4,7 @@ private typedef Import = haxe.macro.MacroType<[SimpleModule.build()]>; class SimpleModule { - static var json = { + static var json = haxe.Json.parse(sys.io.File.getContent("./webidl.json")); var cc = sys.io.File.getBytes("./webidl.json"); var obj = haxe.Json.parse(cc.toString()); obj; @@ -25,4 +25,4 @@ class SimpleModule { } } -#end \ No newline at end of file +#end