This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "gl.h" | |
mat4 &mat4::transpose() { | |
std::swap(m01, m10); std::swap(m02, m20); std::swap(m03, m30); | |
std::swap(m12, m21); std::swap(m13, m31); std::swap(m23, m32); | |
return *this; | |
} | |
mat4 &mat4::rotateX(float degrees) { | |
float radians = degrees * (M_PI / 180); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SDK = ~/nacl_sdk/pepper_canary | |
build: | |
$(SDK)/toolchain/mac_pnacl/bin/pnacl-clang++ -o filtering.bc filtering.cpp -O2 -I $(SDK)/include -L $(SDK)/lib/pnacl/Release -lppapi_cpp -lppapi | |
$(SDK)/toolchain/mac_pnacl/bin/pnacl-finalize -o filtering.pexe filtering.bc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Foo { | |
x: int | |
} | |
impl Drop for Foo { | |
fn drop(&mut self) { | |
println!("drop {}", self.x); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SOURCES = \ | |
main.cpp | |
CPP_FLAGS = \ | |
-fno-exceptions \ | |
-fno-rtti \ | |
-Wall \ | |
-Wextra | |
JS_FLAGS = \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SDK = ~/.emsdk_portable | |
JS_FLAGS = -s ASM_JS=1 -O1 | |
CPP_FLAGS = -std=c++11 -fno-rtti -fno-exceptions | |
EMSCRIPTEN_PATH = $(shell $(SDK)/emsdk active_path emscripten-1.7.8) | |
CLANG_PATH = $(shell dirname $(shell PATH=$(shell $(SDK)/emsdk active_path clang-3.2-64bit):$(PATH) which clang)) | |
EMCC = LLVM=$(CLANG_PATH) python $(shell PATH=$(EMSCRIPTEN_PATH):$(PATH) which emcc) | |
EMLINK = LLVM=$(CLANG_PATH) python $(shell dirname $(shell PATH=$(EMSCRIPTEN_PATH):$(PATH) which emcc))/emlink.py | |
default: cpp_simple cpp_modules js_simple js_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SDK = ~/.emsdk_portable | |
EMSCRIPTEN_PATH = $(shell $(SDK)/emsdk active_path emscripten-1.7.8) | |
CLANG_PATH = $(shell dirname $(shell PATH=$(shell $(SDK)/emsdk active_path clang-3.2-64bit):$(PATH) which clang)) | |
EMCC = LLVM=$(CLANG_PATH) python $(shell PATH=$(EMSCRIPTEN_PATH):$(PATH) which emcc) | |
default: build | |
build: | |
$(EMCC) main.cpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
java \ | |
-jar compiler.jar \ | |
--js main.js \ | |
--compilation_level ADVANCED_OPTIMIZATIONS \ | |
--js_output_file main.min.js \ | |
--create_source_map main.min.js.map \ | |
--source_map_format V3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import re | |
import json | |
import base64 | |
path = 'compiled.js.mem' | |
data = open('compiled.js.mem', 'rb').read() | |
print 'data length:', len(data) | |
def tinystr(s): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
build: | |
emcc -O1 -fno-rtti -fno-exceptions temp.c -o temp.js |
OlderNewer