clean up build system and reuse previously built libraries in other targets
This commit is contained in:
16
.travis.yml
16
.travis.yml
@@ -9,9 +9,21 @@ before_install:
|
||||
- sudo add-apt-repository --yes ppa:boost-latest/ppa
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get -y install gcc-4.8 g++-4.8
|
||||
- sudo apt-get -y install pkg-config nodejs
|
||||
- sudo apt-get -y install pkg-config nodejs cmake
|
||||
- sudo apt-get -y install libboost1.55-dev libpng-dev libcurl4-openssl-dev
|
||||
- sudo apt-get -y install libglu1-mesa-dev
|
||||
- sudo apt-get -y install libxi-dev libglu1-mesa-dev x11proto-randr-dev x11proto-xext-dev libxrandr-dev x11proto-xf86vidmode-dev libxxf86vm-dev libxcursor-dev
|
||||
|
||||
install:
|
||||
- export CURRENT_DIR=$(pwd)
|
||||
- git clone https://github.com/glfw/glfw.git
|
||||
- cd glfw
|
||||
- git checkout -qf 3.0.4
|
||||
- mkdir build
|
||||
- cd build
|
||||
- cmake ../ -DCMAKE_C_COMPILER_ENV_VAR=gcc-4.8 -DGLFW_BUILD_EXAMPLES=off -DGLFW_BUILD_TESTS=off -DGLFW_BUILD_DOCS=off
|
||||
- make
|
||||
- sudo make install
|
||||
- cd ${CURRENT_DIR}
|
||||
|
||||
before_script:
|
||||
- export CXX="g++-4.8"
|
||||
|
||||
98
Makefile
98
Makefile
@@ -6,81 +6,45 @@ V ?= 1
|
||||
|
||||
all: llmr
|
||||
|
||||
llmr: config.gypi src llmr.gyp
|
||||
deps/run_gyp llmr.gyp -Goutput_dir=./out/ --depth=. --generator-output=./out -f make
|
||||
make -j8 -C out BUILDTYPE=Release V=$(V) llmr-x86
|
||||
|
||||
gtest: config.gypi src llmr.gyp
|
||||
deps/run_gyp llmr.gyp -Goutput_dir=./out/ --depth=. --generator-output=./build/gtest -f make
|
||||
make -C build/gtest gtest V=$(V)
|
||||
|
||||
# build OS X app with pure make
|
||||
app: config.gypi src macosx/llmr-app.gyp
|
||||
deps/run_gyp macosx/llmr-app.gyp -Goutput_dir=./out/ --depth=. --generator-output=./build/macosx-make -f make
|
||||
make -C build/macosx-make V=$(V)
|
||||
open build/macosx-make/out/Release/llmr.app
|
||||
|
||||
linux: config.gypi src linux/llmr-app.gyp
|
||||
deps/run_gyp linux/llmr-app.gyp -Goutput_dir=./out/ --depth=. --generator-output=./build/linux-make -f make
|
||||
make -C build/linux-make V=$(V)
|
||||
./build/linux-make/out/Release/llmr.app
|
||||
# Builds the regular library
|
||||
llmr: config.gypi llmr.gyp
|
||||
deps/run_gyp llmr.gyp --depth=. -Goutput_dir=.. --generator-output=./build/llmr -f make
|
||||
make -C build/llmr V=$(V) llmr-x86
|
||||
|
||||
|
||||
# build OS X app with Xcode
|
||||
lproj: config.gypi src linux/llmr-app.gyp
|
||||
deps/run_gyp linux/llmr-app.gyp -Goutput_dir=./out/ --depth=. --generator-output=./ -f xcode
|
||||
open ./linux/llmr-app.xcodeproj
|
||||
##### Test cases ###############################################################
|
||||
|
||||
# build just xcode project for libllmr
|
||||
xcode: config.gypi llmr.gyp
|
||||
deps/run_gyp llmr.gyp -Goutput_dir=./out/ --depth=. --generator-output=./ -f xcode
|
||||
# Runs the test cases
|
||||
test: config.gypi test/test.gyp
|
||||
deps/run_gyp test/test.gyp --depth=. -Goutput_dir=.. --generator-output=./build/test -f make
|
||||
make -C build/test V=$(V) test
|
||||
|
||||
# build OS X app with Xcode
|
||||
xproj: config.gypi src macosx/llmr-app.gyp
|
||||
deps/run_gyp macosx/llmr-app.gyp -Goutput_dir=./out/ --depth=. --generator-output=./ -f xcode
|
||||
open ./macosx/llmr-app.xcodeproj
|
||||
|
||||
# build OS X app with xcodebuild
|
||||
xapp: config.gypi src macosx/llmr-app.gyp
|
||||
deps/run_gyp macosx/llmr-app.gyp -Goutput_dir=./out/ --depth=. --generator-output=./ -f xcode
|
||||
xcodebuild -project ./macosx/llmr-app.xcodeproj
|
||||
open macosx/build/Release/llmr.app
|
||||
|
||||
# build iOS app with Xcode
|
||||
iproj: config.gypi src ios/llmr-app.gyp
|
||||
deps/run_gyp ios/llmr-app.gyp -Goutput_dir=./out/ --depth=. --generator-output=./ -f xcode
|
||||
open ./ios/llmr-app.xcodeproj
|
||||
|
||||
# build iOS app with xcodebuild
|
||||
iapp: config.gypi src ios/llmr-app.gyp
|
||||
deps/run_gyp ios/llmr-app.gyp -Goutput_dir=./out/ --depth=. --generator-output=./ -f xcode
|
||||
xcodebuild -project ./ios/llmr-app.xcodeproj
|
||||
# launch app with ios-sim?
|
||||
|
||||
isim: config.gypi src ios/llmr-app.gyp
|
||||
deps/run_gyp ios/llmr-app.gyp -Goutput_dir=./out/ --depth=. --generator-output=./ -f xcode
|
||||
xcodebuild -project ./ios/llmr-app.xcodeproj -arch i386 -sdk iphonesimulator
|
||||
# does not work
|
||||
#"/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app/Contents/MacOS/iPhone Simulator" -SimulateApplication ios/build/Release-iphonesimulator/llmr.app/llmr
|
||||
|
||||
test: config.gypi src test/test.gyp
|
||||
deps/run_gyp test/test.gyp -Goutput_dir=. --depth=. --generator-output=./build/test -f make
|
||||
make -C build/test V=$(V)
|
||||
@for FILE in build/test/Release/test_*; do \
|
||||
run-tests: test
|
||||
@for FILE in build/Release/test_*; do \
|
||||
$${FILE}; \
|
||||
done
|
||||
|
||||
|
||||
##### Makefile builds ##########################################################
|
||||
|
||||
|
||||
# Builds the linux app with make. This is also used by Travis CI
|
||||
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
|
||||
run-linux: linux
|
||||
build/Release/llmr
|
||||
|
||||
|
||||
|
||||
##### Maintenace operations ####################################################
|
||||
|
||||
clean:
|
||||
-rm -rf out
|
||||
-rm -rf build
|
||||
-rm -rf macosx/build
|
||||
-rm -rf ios/build
|
||||
-rm -rf build/Release
|
||||
|
||||
distclean:
|
||||
-rm -f config.gypi
|
||||
-rm -f config.mk
|
||||
-rm -rf llmr.xcodeproj
|
||||
-rm -rf macosx/llmr-app.xcodeproj
|
||||
-rm -rf ios/llmr-app.xcodeproj
|
||||
-rm -rf build
|
||||
|
||||
.PHONY: test linux
|
||||
.PHONY: llmr test linux
|
||||
|
||||
BIN
bin/._.DS_Store
Normal file
BIN
bin/._.DS_Store
Normal file
Binary file not shown.
@@ -3,10 +3,11 @@
|
||||
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var lazy_update = require('./lazy-update');
|
||||
|
||||
try { var glsl = require('glsl-optimizer'); } catch(err) {}
|
||||
|
||||
module.exports = function(shader_type, root) {
|
||||
module.exports = function(shader_type) {
|
||||
var name;
|
||||
var shaders = {};
|
||||
|
||||
@@ -101,7 +102,6 @@ module.exports = function(shader_type, root) {
|
||||
header += '}\n';
|
||||
header += '\n';
|
||||
header += '#endif\n';
|
||||
fs.writeFileSync('include/llmr/shader/shaders.hpp', header);
|
||||
|
||||
|
||||
var code = '// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED.\n';
|
||||
@@ -113,10 +113,9 @@ module.exports = function(shader_type, root) {
|
||||
code += lines.join(',\n');
|
||||
code += '\n};\n';
|
||||
|
||||
fs.writeFileSync(path.join(root, 'src/shader/shaders_' + shader_type + '.cpp'), code);
|
||||
|
||||
lazy_update('include/llmr/shader/shaders.hpp', header);
|
||||
lazy_update('src/shader/shaders_' + shader_type + '.cpp', code);
|
||||
};
|
||||
|
||||
var root = path.resolve(process.argv[2] || '.');
|
||||
module.exports('gl', root);
|
||||
module.exports('gles2', root);
|
||||
module.exports('gl');
|
||||
module.exports('gles2');
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
|
||||
var fs = require('fs');
|
||||
var lazy_update = require('./lazy-update');
|
||||
|
||||
var name = 'style';
|
||||
var data = JSON.stringify(require('./style'));
|
||||
@@ -22,7 +22,8 @@ header += '}\n';
|
||||
header += '}\n';
|
||||
header += '\n';
|
||||
header += '#endif\n';
|
||||
fs.writeFileSync('include/llmr/style/resources.hpp', header);
|
||||
|
||||
lazy_update('include/llmr/style/resources.hpp', header);
|
||||
|
||||
var code = '// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED.\n';
|
||||
code += '#include <llmr/style/resources.hpp>\n';
|
||||
@@ -32,5 +33,5 @@ code += '\n';
|
||||
code += 'const unsigned char resources::' + name + '[] = R"JSON(' + data + ')JSON";\n';
|
||||
code += 'const unsigned long resources::' + name + '_size = sizeof(resources::' + name + ');\n';
|
||||
|
||||
fs.writeFileSync('src/style/resources.cpp', code);
|
||||
lazy_update('src/style/resources.cpp', code);
|
||||
|
||||
|
||||
12
bin/lazy-update.js
Normal file
12
bin/lazy-update.js
Normal file
@@ -0,0 +1,12 @@
|
||||
var fs = require('fs');
|
||||
|
||||
module.exports = function(file, content) {
|
||||
try {
|
||||
var existing = fs.readFileSync(file, 'utf8');
|
||||
if (existing != content) {
|
||||
fs.writeFileSync(file, content);
|
||||
}
|
||||
} catch(err) {
|
||||
fs.writeFileSync(file, content);
|
||||
}
|
||||
};
|
||||
@@ -1,6 +1,8 @@
|
||||
#include <iostream>
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <llmr/text/rotation_range.hpp>
|
||||
|
||||
using namespace llmr;
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
"target_name": "rotation_range",
|
||||
"product_name": "test_rotation_range",
|
||||
"type": "executable",
|
||||
"libraries": [
|
||||
"-lpthread",
|
||||
],
|
||||
"sources": [
|
||||
"./main.cpp",
|
||||
"./rotation_range.cpp",
|
||||
@@ -17,5 +20,12 @@
|
||||
"../llmr.gyp:llmr-x86"
|
||||
]
|
||||
},
|
||||
{
|
||||
"target_name": "test",
|
||||
"type": "none",
|
||||
"dependencies": [
|
||||
"rotation_range"
|
||||
],
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user