-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Split source / output #13
base: master
Are you sure you want to change the base?
Changes from 7 commits
8819ef1
e890be1
e758a27
f364242
60d390b
ffdd9d8
6a3a504
8c4c91a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ | |
*.hl | ||
*.js | ||
*.bc | ||
.vscode |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"configurations": [ | ||
{ | ||
"name": "Linux", | ||
"includePath": [ | ||
"${workspaceFolder}/**" | ||
], | ||
"defines": [], | ||
"compilerPath": "/usr/bin/clang", | ||
"cStandard": "c11", | ||
"cppStandard": "c++17", | ||
"intelliSenseMode": "clang-x64" | ||
} | ||
], | ||
"version": 4 | ||
} |
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Simple example |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,28 @@ | ||||||
#if !macro | ||||||
private typedef Import = haxe.macro.MacroType<[SimpleModule.build()]>; | ||||||
#else | ||||||
|
||||||
class SimpleModule { | ||||||
|
||||||
static var json = { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm thinking we can simplify this block like so:
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The GitHub auto-commit thing won't remove the 4 lines below, so we'll need to do that manually. |
||||||
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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#include "context.h" | ||
#include "stdio.h" | ||
|
||
void Context::test(){ | ||
printf("%s\n", "This is Context::test()"); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include "stdio.h" | ||
|
||
#include "emscripten.h" | ||
#include <GLES3/gl3.h> | ||
#include <emscripten/html5.h> | ||
|
||
class Context { | ||
public: | ||
Context(){ | ||
printf("%s\n", "Context Initialized"); | ||
} | ||
void test(); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!doctype html> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well I like to not edit anything in webRoot directly and treat it all as generated.. You'll notice that the new build copies the index.html from the source root (which is still the project root) every time you compile.. so changes should be made in sources not in webRoot (output). |
||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<link rel="shortcut icon" href="/favicon.ico?" /> | ||
<script src="lib_simple.js"></script> | ||
<script src="simple.js"></script> | ||
</head> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<link rel="shortcut icon" href="/favicon.ico?" /> | ||
<script src="lib_simple.js"></script> | ||
<script src="simple.js"></script> | ||
</head> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"idlFile": "simple.idl", | ||
"nativeLib": "lib_simple", | ||
"sourceFiles": ["point.cpp", "context.cpp"], | ||
zicklag marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"autoGC": false, | ||
"out": "./webRoot" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming this file wasn't meant to be in here as you added
.vscode
to the.gitignore
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct.. I should not have pushed that.