Get building with latest SDK

This commit is contained in:
2026-06-12 16:46:18 -04:00
parent 81311cc9d9
commit dce5b2e249
11 changed files with 139 additions and 78 deletions
+7
View File
@@ -0,0 +1,7 @@
---
BasedOnStyle: LLVM
TabWidth: 4
IndentWidth: 4
UseTab: ForIndentation
ColumnLimit: 0
...
+4
View File
@@ -0,0 +1,4 @@
/build
/.clangd
/.lock-waf*
/package-lock.json
-40
View File
@@ -1,40 +0,0 @@
{
"resources": {
"media": [
{
"type": "png-trans",
"file": "images/action_icon_minus.png",
"name": "MINUS"
},
{
"type": "png-trans",
"file": "images/action_icon_plus.png",
"name": "PLUS"
},
{
"type": "png-trans",
"file": "images/reset.png",
"name": "RESET"
},
{
"type": "png",
"file": "images/icon.png",
"name": "ICON",
"menuIcon": true
}
]
},
"versionCode": 1,
"shortName": "counter",
"capabilities": [
""
],
"versionLabel": "1.0",
"longName": "Counter is a multipurpose counting app with applications ranging from lap tracking to card counting.",
"uuid": "36bab645-70c5-472b-b99f-afc9f8656c70",
"appKeys": {},
"companyName": "matthewbauer",
"watchapp": {
"watchface": false
}
}
Executable
+20
View File
@@ -0,0 +1,20 @@
#!/usr/bin/env zsh
echo "CompileFlags:
Add:
[
-DPBL_DISPLAY_WIDTH=200,
-DPBL_DISPLAY_HEIGHT=228,
-xc,
-nostdinc,
-DPBL_COLOR,
-DPBL_RECT,
-I${HOME}/.pebble-sdk/SDKs/current/sdk-core/pebble/emery/include,
-include$(pwd)/build/include/message_keys.auto.h,
-I$(pwd)/build/emery,
-include${HOME}/.pebble-sdk/SDKs/current/toolchain/arm-none-eabi/arm-none-eabi/include/stdint.h,
-include${HOME}/.pebble-sdk/SDKs/current/toolchain/arm-none-eabi/arm-none-eabi/include/stdlib.h,
-include${HOME}/.pebble-sdk/SDKs/current/toolchain/arm-none-eabi/arm-none-eabi/include/time.h,
-include${HOME}/.pebble-sdk/SDKs/current/toolchain/arm-none-eabi/arm-none-eabi/include/string.h,
-include${HOME}/.pebble-sdk/SDKs/current/toolchain/arm-none-eabi/lib/gcc/arm-none-eabi/14.2.1/include/stddef.h,
-include${HOME}/.pebble-sdk/SDKs/current/toolchain/arm-none-eabi/lib/gcc/arm-none-eabi/14.2.1/include/stdbool.h,
]" > ./.clangd
+62
View File
@@ -0,0 +1,62 @@
{
"name": "recounter",
"author": "RandyTheSilly",
"version": "1.0.0",
"keywords": [
"counter",
"touch",
"simple"
],
"private": true,
"dependencies": {},
"pebble": {
"displayName": "REcounter",
"uuid": "36bab645-70c5-472b-b99f-afc9f8656c71",
"sdkVersion": "3",
"enableMultiJS": false,
"targetPlatforms": [
"aplite",
"basalt",
"diorite",
"flint",
"emery"
],
"watchapp": {
"watchface": false
},
"messageKeys": [],
"resources": {
"media": [
{
"file": "action_icon_minus.png",
"memoryFormat": "Smallest",
"name": "MINUS",
"spaceOptimization": "storage",
"type": "bitmap"
},
{
"file": "action_icon_plus.png",
"memoryFormat": "Smallest",
"name": "PLUS",
"spaceOptimization": "storage",
"type": "bitmap"
},
{
"file": "reset.png",
"memoryFormat": "Smallest",
"name": "RESET",
"spaceOptimization": "storage",
"type": "bitmap"
},
{
"file": "icon.png",
"memoryFormat": "Smallest",
"name": "ICON",
"spaceOptimization": "storage",
"type": "bitmap",
"menuIcon": true
}
]
}
}
}

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Before

Width:  |  Height:  |  Size: 249 B

After

Width:  |  Height:  |  Size: 249 B

Before

Width:  |  Height:  |  Size: 320 B

After

Width:  |  Height:  |  Size: 320 B

+10 -10
View File
@@ -49,9 +49,9 @@ void up_click_handler(ClickRecognizerRef recognizer, void *context) {
}
void click_config_provider(void *context) {
window_single_repeating_click_subscribe(BUTTON_ID_SELECT, REPEAT_INTERVAL, (ClickHandler) select_click_handler);
window_single_repeating_click_subscribe(BUTTON_ID_UP, REPEAT_INTERVAL, (ClickHandler) up_click_handler);
window_single_repeating_click_subscribe(BUTTON_ID_DOWN, REPEAT_INTERVAL, (ClickHandler) down_click_handler);
window_single_repeating_click_subscribe(BUTTON_ID_SELECT, REPEAT_INTERVAL, (ClickHandler)select_click_handler);
window_single_repeating_click_subscribe(BUTTON_ID_UP, REPEAT_INTERVAL, (ClickHandler)up_click_handler);
window_single_repeating_click_subscribe(BUTTON_ID_DOWN, REPEAT_INTERVAL, (ClickHandler)down_click_handler);
}
void window_load(Window *window) {
@@ -81,16 +81,16 @@ void window_unload(Window *window) {
}
void init() {
action_icon_plus = gbitmap_create_with_resource(RESOURCE_ID_PLUS_WHITE);
action_icon_minus = gbitmap_create_with_resource(RESOURCE_ID_MINUS_WHITE);
action_icon_reset = gbitmap_create_with_resource(RESOURCE_ID_RESET_WHITE);
action_icon_plus = gbitmap_create_with_resource(RESOURCE_ID_PLUS);
action_icon_minus = gbitmap_create_with_resource(RESOURCE_ID_MINUS);
action_icon_reset = gbitmap_create_with_resource(RESOURCE_ID_RESET);
window = window_create();
window_set_window_handlers(window, (WindowHandlers) {
.load = window_load,
.unload = window_unload,
});
window_set_window_handlers(window, (WindowHandlers){
.load = window_load,
.unload = window_unload,
});
count = persist_exists(COUNT_PKEY) ? persist_read_int(COUNT_PKEY) : COUNT_DEFAULT;
+35 -27
View File
@@ -1,46 +1,54 @@
#
# This file is the default set of rules to compile a Pebble project.
# This file is the default set of rules to compile a Pebble application.
#
# Feel free to customize this to your needs.
#
try:
from sh import CommandNotFound, jshint, cat, ErrorReturnCode_2
hint = jshint
except (ImportError, CommandNotFound):
hint = None
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')
global hint
if hint is not None:
hint = hint.bake(['--config', 'pebble-jshintrc'])
def build(ctx):
if False and hint is not None:
try:
hint([node.abspath() for node in ctx.path.ant_glob("src/**/*.js")], _tty_out=False) # no tty because there are none in the cloudpebble sandbox.
except ErrorReturnCode_2 as e:
ctx.fatal("\nJavaScript linting failed (you can disable this in Project Settings):\n" + e.stdout)
# Concatenate all our JS files (but not recursively), and only if any JS exists in the first place.
ctx.path.make_node('src/js/').mkdir()
js_paths = [node.abspath() for node in ctx.path.ant_glob("src/*.js")]
if js_paths:
ctx.exec_command(['cat'] + js_paths, stdout=open('src/js/pebble-js-app.js', 'a'))
ctx.load('pebble_sdk')
ctx.pbl_program(source=ctx.path.ant_glob('src/**/*.c'),
target='pebble-app.elf')
build_worker = os.path.exists('worker_src')
binaries = []
ctx.pbl_bundle(elf='pebble-app.elf',
js=ctx.path.ant_glob('src/js/**/*.js'))
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')