allow for easier editing of style in Xcode
* write protobuf directly to file instead of stdout (for Gyp) * add style.js to editable sources * add build phases for pbf conversion & resources updates * update README style directions
This commit is contained in:
@@ -111,7 +111,7 @@ proto/style.proto. The reason for doing so is that we don't have to ship with a
|
||||
JSON/yaml parser. To test the conversion script, run
|
||||
|
||||
```
|
||||
bin/convert-style.js | protoc --decode=style proto/style.proto
|
||||
bin/convert-style.js && cat resources/style.pbf | protoc --decode=style proto/style.proto
|
||||
```
|
||||
|
||||
You should see a nicely formatted hierarchical output of the converted style.
|
||||
@@ -120,9 +120,10 @@ You should see a nicely formatted hierarchical output of the converted style.
|
||||
To update the included default style, use
|
||||
|
||||
```
|
||||
bin/convert-style.js > resources/style.pbf && bin/build-style.js
|
||||
bin/convert-style.js && bin/build-style.js
|
||||
```
|
||||
|
||||
This is automatically taken care of as a build phase if you are using the Xcode projects.
|
||||
|
||||
# Usage
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
var style = require('./style.js');
|
||||
var Protobuf = require('./protobuf.js');
|
||||
var fs = require('fs');
|
||||
|
||||
// var fs = require('fs');
|
||||
|
||||
@@ -212,4 +213,4 @@ for (var i = 0; i < style.classes.length; i++) {
|
||||
pbf.writeMessage(3 /* class */, createClass(klass));
|
||||
}
|
||||
|
||||
process.stdout.write(pbf.finish());
|
||||
fs.writeFileSync('resources/style.pbf', pbf.finish());
|
||||
|
||||
48
llmr.gyp
48
llmr.gyp
@@ -11,7 +11,8 @@
|
||||
'sources': [
|
||||
'<!@(find src -name "*.cpp")',
|
||||
'<!@(find include -name "*.hpp")',
|
||||
'<!@(find src -name "*.glsl")'
|
||||
'<!@(find src -name "*.glsl")',
|
||||
'bin/style.js'
|
||||
],
|
||||
'actions': [
|
||||
{
|
||||
@@ -25,6 +26,27 @@
|
||||
],
|
||||
'action': ['bin/build-shaders.js'],
|
||||
},
|
||||
{
|
||||
'action_name': 'Convert Style to Protobuf',
|
||||
'inputs': [
|
||||
'bin/style.js'
|
||||
],
|
||||
'outputs': [
|
||||
'resources/style.pbf'
|
||||
],
|
||||
'action': ['bin/convert-style.js'],
|
||||
},
|
||||
{
|
||||
'action_name': 'Update Style Resources',
|
||||
'inputs': [
|
||||
'resources/style.pbf'
|
||||
],
|
||||
'outputs': [
|
||||
'include/llmr/style/resources.hpp',
|
||||
'src/style/resources.cpp'
|
||||
],
|
||||
'action': ['bin/build-style.js']
|
||||
}
|
||||
],
|
||||
'xcode_settings': {
|
||||
'SDKROOT': 'macosx',
|
||||
@@ -75,7 +97,8 @@
|
||||
'sources': [
|
||||
'<!@(find src -name "*.cpp")',
|
||||
'<!@(find include -name "*.hpp")',
|
||||
'<!@(find src -name "*.glsl")'
|
||||
'<!@(find src -name "*.glsl")',
|
||||
'bin/style.js'
|
||||
],
|
||||
'actions': [
|
||||
{
|
||||
@@ -89,6 +112,27 @@
|
||||
],
|
||||
'action': ['bin/build-shaders.js'],
|
||||
},
|
||||
{
|
||||
'action_name': 'Convert Style to Protobuf',
|
||||
'inputs': [
|
||||
'bin/style.js'
|
||||
],
|
||||
'outputs': [
|
||||
'resources/style.pbf'
|
||||
],
|
||||
'action': ['bin/convert-style.js'],
|
||||
},
|
||||
{
|
||||
'action_name': 'Update Style Resources',
|
||||
'inputs': [
|
||||
'resources/style.pbf'
|
||||
],
|
||||
'outputs': [
|
||||
'include/llmr/style/resources.hpp',
|
||||
'src/style/resources.cpp'
|
||||
],
|
||||
'action': ['bin/build-style.js']
|
||||
}
|
||||
],
|
||||
'xcode_settings': {
|
||||
'SDKROOT': 'iphoneos',
|
||||
|
||||
Reference in New Issue
Block a user