Previously I used automatically generated wscript files, so I didn't
include them in the repositories. However with SDK 4, the source layout
expected by the default wscript doesn't match that of my projects, so
instead I'm putting a wscript taken from SDK 3.14.
| 4 | 3 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,50 @@ |
| 1 |
+# |
|
| 2 |
+# This file is the default set of rules to compile a Pebble application. |
|
| 3 |
+# |
|
| 4 |
+# Feel free to customize this to your needs. |
|
| 5 |
+# |
|
| 6 |
+import os.path |
|
| 7 |
+ |
|
| 8 |
+top = '.' |
|
| 9 |
+out = 'build' |
|
| 10 |
+ |
|
| 11 |
+ |
|
| 12 |
+def options(ctx): |
|
| 13 |
+ ctx.load('pebble_sdk')
|
|
| 14 |
+ |
|
| 15 |
+ |
|
| 16 |
+def configure(ctx): |
|
| 17 |
+ """ |
|
| 18 |
+ This method is used to configure your build. ctx.load(`pebble_sdk`) automatically configures |
|
| 19 |
+ a build for each valid platform in `targetPlatforms`. Platform-specific configuration: add your |
|
| 20 |
+ change after calling ctx.load('pebble_sdk') and make sure to set the correct environment first.
|
|
| 21 |
+ Universal configuration: add your change prior to calling ctx.load('pebble_sdk').
|
|
| 22 |
+ """ |
|
| 23 |
+ ctx.load('pebble_sdk')
|
|
| 24 |
+ |
|
| 25 |
+ |
|
| 26 |
+def build(ctx): |
|
| 27 |
+ ctx.load('pebble_sdk')
|
|
| 28 |
+ |
|
| 29 |
+ build_worker = os.path.exists('worker_src')
|
|
| 30 |
+ binaries = [] |
|
| 31 |
+ |
|
| 32 |
+ cached_env = ctx.env |
|
| 33 |
+ for platform in ctx.env.TARGET_PLATFORMS: |
|
| 34 |
+ ctx.env = ctx.all_envs[platform] |
|
| 35 |
+ ctx.set_group(ctx.env.PLATFORM_NAME) |
|
| 36 |
+ app_elf = '{}/pebble-app.elf'.format(ctx.env.BUILD_DIR)
|
|
| 37 |
+ ctx.pbl_program(source=ctx.path.ant_glob('src/**/*.c'), target=app_elf)
|
|
| 38 |
+ |
|
| 39 |
+ if build_worker: |
|
| 40 |
+ worker_elf = '{}/pebble-worker.elf'.format(ctx.env.BUILD_DIR)
|
|
| 41 |
+ binaries.append({'platform': platform, 'app_elf': app_elf, 'worker_elf': worker_elf})
|
|
| 42 |
+ ctx.pbl_worker(source=ctx.path.ant_glob('worker_src/**/*.c'), target=worker_elf)
|
|
| 43 |
+ else: |
|
| 44 |
+ binaries.append({'platform': platform, 'app_elf': app_elf})
|
|
| 45 |
+ ctx.env = cached_env |
|
| 46 |
+ |
|
| 47 |
+ ctx.set_group('bundle')
|
|
| 48 |
+ ctx.pbl_bundle(binaries=binaries, |
|
| 49 |
+ js=ctx.path.ant_glob(['src/js/**/*.js', 'src/js/**/*.json']), |
|
| 50 |
+ js_entry_file='src/js/app.js') |