diff --git a/Makefile b/Makefile index 3b264e853..b47e84c8d 100644 --- a/Makefile +++ b/Makefile @@ -33,18 +33,35 @@ linux: config.gypi linux/llmr-app.gyp deps/run_gyp linux/llmr-app.gyp --depth=. -Goutput_dir=.. --generator-output=./build/linux -f make make -C build/linux V=$(V) linuxapp -# Executes the linux binary +# Executes the Linux binary run-linux: linux build/Release/llmr +##### Xcode projects ########################################################### + +# build Mac OS X project for Xcode +xproj: config.gypi macosx/llmr-app.gyp + deps/run_gyp macosx/llmr-app.gyp --depth=. --generator-output=./build -f xcode + open ./build/macosx/llmr-app.xcodeproj + +# build iOS project for Xcode +iproj: config.gypi ios/llmr-app.gyp + deps/run_gyp ios/llmr-app.gyp --depth=. --generator-output=./build -f xcode + open ./build/ios/llmr-app.xcodeproj + +# build Linux project for Xcode (Runs on Mac OS X too, but without platform-specific code) +lproj: config.gypi linux/llmr-app.gyp + deps/run_gyp linux/llmr-app.gyp --depth=. --generator-output=./build -f xcode + open ./build/linux/llmr-app.xcodeproj + ##### Maintenace operations #################################################### clean: - -rm -rf build/Release + -rm -rf ./build/Release -distclean: - -rm -rf build +distclean: clean + -rm -rf ./build .PHONY: llmr test linux diff --git a/bin/build-shaders.js b/bin/build-shaders.js index 7201a0019..3e0fbe8b6 100755 --- a/bin/build-shaders.js +++ b/bin/build-shaders.js @@ -7,7 +7,7 @@ var lazy_update = require('./lazy-update'); try { var glsl = require('glsl-optimizer'); } catch(err) {} -module.exports = function(shader_type) { +module.exports = function(shader_type, prefix, suffix) { var name; var shaders = {}; @@ -105,6 +105,8 @@ module.exports = function(shader_type) { var code = '// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED.\n'; + code += '#include \n'; + code += prefix + '\n'; code += '#include \n'; code += '\n'; code += 'using namespace llmr;\n'; @@ -112,10 +114,12 @@ module.exports = function(shader_type) { code += 'const shader_source llmr::shaders[SHADER_COUNT] = {\n'; code += lines.join(',\n'); code += '\n};\n'; + code += suffix + '\n'; + lazy_update('include/llmr/shader/shaders.hpp', header); lazy_update('src/shader/shaders_' + shader_type + '.cpp', code); }; -module.exports('gl'); -module.exports('gles2'); +module.exports('gl', '#ifndef GL_ES_VERSION_2_0', '#endif'); +module.exports('gles2', '#ifdef GL_ES_VERSION_2_0', '#endif'); diff --git a/configure b/configure index 2fa0a149a..88f9dcf90 100755 --- a/configure +++ b/configure @@ -59,12 +59,17 @@ def configure_llmr(o): o['variables']['node'] = 'node' o['target_defaults']['default_configuration'] = 'Debug' if options.debug else 'Release' + +def fix_frameworks(libs): + # don't split "-framework Foo" + return re.split('(? +#ifndef GL_ES_VERSION_2_0 #include using namespace llmr; @@ -37,3 +39,4 @@ const shader_source llmr::shaders[SHADER_COUNT] = { "#version 120\nuniform sampler2D u_texture;\nuniform vec4 u_color;\nuniform float u_buffer;\nuniform float u_gamma;\nvarying vec2 v_tex;\nvarying float v_alpha;\nvoid main ()\n{\n float edge0_1;\n edge0_1 = (u_buffer - u_gamma);\n float tmpvar_2;\n tmpvar_2 = clamp (((texture2D (u_texture, v_tex).w - edge0_1) / (\n (u_buffer + u_gamma)\n - edge0_1)), 0.0, 1.0);\n gl_FragColor = (u_color * ((tmpvar_2 * \n (tmpvar_2 * (3.0 - (2.0 * tmpvar_2)))\n ) * v_alpha));\n}\n\n", } }; +#endif diff --git a/src/shader/shaders_gles2.cpp b/src/shader/shaders_gles2.cpp index 95d21581f..e30b650bd 100644 --- a/src/shader/shaders_gles2.cpp +++ b/src/shader/shaders_gles2.cpp @@ -1,4 +1,6 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. +#include +#ifdef GL_ES_VERSION_2_0 #include using namespace llmr; @@ -37,3 +39,4 @@ const shader_source llmr::shaders[SHADER_COUNT] = { "precision highp float;\nuniform sampler2D u_texture;\nuniform vec4 u_color;\nuniform float u_buffer;\nuniform float u_gamma;\nvarying vec2 v_tex;\nvarying float v_alpha;\nvoid main ()\n{\n float edge0_1;\n edge0_1 = (u_buffer - u_gamma);\n lowp float tmpvar_2;\n tmpvar_2 = clamp (((texture2D (u_texture, v_tex).w - edge0_1) / (\n (u_buffer + u_gamma)\n - edge0_1)), 0.0, 1.0);\n lowp vec4 tmpvar_3;\n tmpvar_3 = (u_color * ((tmpvar_2 * \n (tmpvar_2 * (3.0 - (2.0 * tmpvar_2)))\n ) * v_alpha));\n gl_FragColor = tmpvar_3;\n}\n\n", } }; +#endif