aboutsummaryrefslogtreecommitdiff
path: root/wscript
diff options
context:
space:
mode:
authorReiner Herrmann <reiner@reiner-h.de>2026-01-10 18:45:29 +0100
committerReiner Herrmann <reiner@reiner-h.de>2026-01-10 18:46:14 +0100
commit0aac353f636126a809a4b3c521d64e576682019c (patch)
tree277bbecbb6a2c4e1ba0d0e967e75d3cf61b54833 /wscript
initial commit
Diffstat (limited to 'wscript')
-rw-r--r--wscript54
1 files changed, 54 insertions, 0 deletions
diff --git a/wscript b/wscript
new file mode 100644
index 0000000..5238bc8
--- /dev/null
+++ b/wscript
@@ -0,0 +1,54 @@
+#
+# This file is the default set of rules to compile a Pebble application.
+#
+# Feel free to customize this to your needs.
+#
+import os.path
+
+top = '.'
+out = 'build'
+
+
+def options(ctx):
+ ctx.load('pebble_sdk')
+
+
+def configure(ctx):
+ """
+ This method is used to configure your build. ctx.load(`pebble_sdk`) automatically configures
+ a build for each valid platform in `targetPlatforms`. Platform-specific configuration: add your
+ change after calling ctx.load('pebble_sdk') and make sure to set the correct environment first.
+ Universal configuration: add your change prior to calling ctx.load('pebble_sdk').
+ """
+ ctx.load('pebble_sdk')
+
+
+def build(ctx):
+ ctx.load('pebble_sdk')
+
+ build_worker = os.path.exists('worker_src')
+ binaries = []
+
+ cached_env = ctx.env
+ for platform in ctx.env.TARGET_PLATFORMS:
+ ctx.env = ctx.all_envs[platform]
+ ctx.set_group(ctx.env.PLATFORM_NAME)
+ app_elf = '{}/pebble-app.elf'.format(ctx.env.BUILD_DIR)
+ ctx.pbl_build(source=ctx.path.ant_glob('src/c/**/*.c'), target=app_elf, bin_type='app')
+
+ if build_worker:
+ worker_elf = '{}/pebble-worker.elf'.format(ctx.env.BUILD_DIR)
+ binaries.append({'platform': platform, 'app_elf': app_elf, 'worker_elf': worker_elf})
+ ctx.pbl_build(source=ctx.path.ant_glob('worker_src/c/**/*.c'),
+ target=worker_elf,
+ bin_type='worker')
+ else:
+ binaries.append({'platform': platform, 'app_elf': app_elf})
+ ctx.env = cached_env
+
+ ctx.set_group('bundle')
+ ctx.pbl_bundle(binaries=binaries,
+ js=ctx.path.ant_glob(['src/pkjs/**/*.js',
+ 'src/pkjs/**/*.json',
+ 'src/common/**/*.js']),
+ js_entry_file='src/pkjs/index.js')