source: js/sdk/README.txt @ 1139

Last change on this file since 1139 was 865, checked in by Maciej Komosinski, 6 years ago

Added files needed to compile Framsticks SDK to JavaScript? using Emscripten

File size: 1.7 KB
Line 
1Framsticks SDK in JavaScript
2----------------------------
3
4Note: Emscripten does not like spaces in paths.
5In order to compile the Framsticks SDK properly, ensure you don't have spaces in directory names.
6
7To generate the newest JavaScript version of the Framsticks SDK, you need to have the latest version
8of Emscripten installed. To perform a compilation, you first need to activate the Emscripten SDK:
9
10On Windows:
11        emsdk.bat activate latest
12
13On Linux:
14        emsdk activate latest
15
16The emsdk script should be available in your Emscripten install directory.
17"latest" can be replaced by any name of the Emscripten version installed.
18After activating the Emscripten SDK, to compile Framsticks SDK you need to call:
19
20On Windows:
21        emmake.bat mingw32-make.exe -j8 --directory=../../cpp -f ../js/sdk/Makefile-SDK-Emscripten.mak
22
23On Linux:
24        $EMSCRIPTEN/emmake make --directory=../../cpp -f ../js/sdk/Makefile-SDK-Emscripten.mak
25
26After completing this, the JavaScript version of Framsticks SDK should be available as frams-sdk.js.
27
28
29
30Classes, methods and fields available in JavaScript Framsticks SDK are defined in js_interface/js_interface.idl.
31To access them from a JavaScript app, you need to include the JavaScript version of Framsticks SDK file in HTML:
32        <script src="sdk/frams-sdk.js"></script>
33
34and then you can access Framsticks classes in JavaScript files using the Module variable like that:
35        let gcm = new Module.DefaultGenoConvManager();
36        gcm.addDefaultConverters();
37        let dummyGeno = new Module.Geno().useConverters(gcm);
38        Module.destroy(dummyGeno);
39        let validators = new Module.Validators();
40        dummyGeno = new Module.Geno().useValidators(validators);
41        Module.destroy(dummyGeno);
42        let modelValidator = new Module.ModelGenoValidator();
43        validators.append(modelValidator);
Note: See TracBrowser for help on using the repository browser.