wscript

 1import os.path
 2
 3top = '.'
 4out = 'build'
 5
 6
 7def options(ctx):
 8    ctx.load('pebble_sdk')
 9
10
11def configure(ctx):
12    ctx.load('pebble_sdk')
13
14
15def build(ctx):
16    ctx.load('pebble_sdk')
17
18    build_worker = os.path.exists('worker_src')
19    binaries = []
20
21    cached_env = ctx.env
22    for platform in ctx.env.TARGET_PLATFORMS:
23        ctx.env = ctx.all_envs[platform]
24        ctx.set_group(ctx.env.PLATFORM_NAME)
25        app_elf = '{}/pebble-app.elf'.format(ctx.env.BUILD_DIR)
26        ctx.pbl_build(source=ctx.path.ant_glob('src/c/**/*.c'),
27                      target=app_elf, bin_type='app')
28
29        if build_worker:
30            worker_elf = '{}/pebble-worker.elf'.format(ctx.env.BUILD_DIR)
31            binaries.append({'platform': platform, 'app_elf': app_elf,
32                             'worker_elf': worker_elf})
33            ctx.pbl_build(source=ctx.path.ant_glob('worker_src/c/**/*.c'),
34                          target=worker_elf, bin_type='worker')
35        else:
36            binaries.append({'platform': platform, 'app_elf': app_elf})
37    ctx.env = cached_env
38
39    ctx.set_group('bundle')
40    ctx.pbl_bundle(binaries=binaries,
41                   js=ctx.path.ant_glob(['src/pkjs/**/*.js',
42                                         'src/pkjs/**/*.json']),
43                   js_entry_file='src/pkjs/index.js')