fastled 1.2.40__tar.gz → 1.2.42__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fastled-1.2.40 → fastled-1.2.42}/.github/workflows/build_multi_docker_image.yml +8 -22
- fastled-1.2.42/Dockerfile +205 -0
- {fastled-1.2.40 → fastled-1.2.42}/PKG-INFO +3 -1
- {fastled-1.2.40 → fastled-1.2.42}/README.md +2 -0
- fastled-1.2.42/compiler/.dockerignore +2 -0
- fastled-1.2.42/compiler/CMakeLists.txt +139 -0
- fastled-1.2.42/compiler/arduino-pre-process.sh +3 -0
- fastled-1.2.42/compiler/build.sh +3 -0
- fastled-1.2.42/compiler/build_archive.sh +28 -0
- fastled-1.2.42/compiler/build_fast.sh +54 -0
- fastled-1.2.42/compiler/code_sync.py +76 -0
- fastled-1.2.42/compiler/compile.py +683 -0
- fastled-1.2.42/compiler/compile_lock.py +3 -0
- fastled-1.2.42/compiler/entrypoint.sh +7 -0
- fastled-1.2.42/compiler/extra/100dots.html +186 -0
- fastled-1.2.42/compiler/extra/demo_threejs.html +216 -0
- fastled-1.2.42/compiler/extra/webgl_postprocessing_unreal_bloom.html +191 -0
- fastled-1.2.42/compiler/final_prewarm.sh +26 -0
- fastled-1.2.42/compiler/index.css +288 -0
- fastled-1.2.42/compiler/index.html +191 -0
- fastled-1.2.42/compiler/index.js +492 -0
- fastled-1.2.42/compiler/init_runtime.py +67 -0
- fastled-1.2.42/compiler/install-arduino-cli.sh +41 -0
- fastled-1.2.42/compiler/modules/graphics_manager.js +279 -0
- fastled-1.2.42/compiler/modules/graphics_manager_threejs.js +375 -0
- fastled-1.2.42/compiler/modules/ui_manager.js +252 -0
- fastled-1.2.42/compiler/platformio.ini +19 -0
- fastled-1.2.42/compiler/pre-process.sh +27 -0
- fastled-1.2.42/compiler/prewarm.sh +43 -0
- fastled-1.2.42/compiler/process-ino.py +124 -0
- fastled-1.2.42/compiler/requirements.txt +12 -0
- fastled-1.2.42/compiler/run.py +125 -0
- fastled-1.2.42/compiler/server.py +773 -0
- fastled-1.2.42/compiler/sketch_hasher.py +254 -0
- fastled-1.2.42/compiler/wasm_compiler_flags.py +154 -0
- fastled-1.2.42/docker-compose.yml +9 -0
- {fastled-1.2.40 → fastled-1.2.42}/src/fastled/__init__.py +5 -186
- {fastled-1.2.40 → fastled-1.2.42}/src/fastled/app.py +6 -0
- {fastled-1.2.40 → fastled-1.2.42}/src/fastled/compile_server_impl.py +0 -1
- {fastled-1.2.40 → fastled-1.2.42}/src/fastled/docker_manager.py +3 -1
- fastled-1.2.42/src/fastled/interactive_srcs.py +5 -0
- {fastled-1.2.40 → fastled-1.2.42}/src/fastled/parse_args.py +4 -0
- {fastled-1.2.40 → fastled-1.2.42}/src/fastled.egg-info/PKG-INFO +3 -1
- {fastled-1.2.40 → fastled-1.2.42}/src/fastled.egg-info/SOURCES.txt +34 -2
- fastled-1.2.42/tests/test_ino/embedded/data/bigdata.dat +0 -0
- fastled-1.2.40/src/fastled/interactive_srcs.py +0 -5
- fastled-1.2.40/tests/test_build_from_docker.py +0 -49
- fastled-1.2.40/tests/test_build_from_github.py +0 -49
- {fastled-1.2.40 → fastled-1.2.42}/.aiderignore +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/.github/workflows/build_webpage.yml +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/.github/workflows/lint.yml +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/.github/workflows/publish_release.yml +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/.github/workflows/test_build_exe.yml +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/.github/workflows/test_macos.yml +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/.github/workflows/test_ubuntu.yml +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/.github/workflows/test_win.yml +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/.gitignore +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/.pylintrc +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/.vscode/launch.json +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/.vscode/settings.json +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/.vscode/tasks.json +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/LICENSE +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/MANIFEST.in +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/RELEASE.md +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/TODO.md +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/build_exe.py +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/build_site.py +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/clean +0 -0
- /fastled-1.2.40/tests/test_ino/embedded/data/bigdata.dat → /fastled-1.2.42/compiler/__init__.py +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/install +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/install_linux.sh +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/lint +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/pyproject.toml +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/requirements.testing.txt +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/setup.cfg +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/setup.py +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/src/fastled/assets/example.txt +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/src/fastled/cli.py +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/src/fastled/client_server.py +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/src/fastled/compile_server.py +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/src/fastled/filewatcher.py +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/src/fastled/keyboard.py +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/src/fastled/live_client.py +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/src/fastled/open_browser.py +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/src/fastled/open_browser2.py +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/src/fastled/paths.py +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/src/fastled/project_init.py +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/src/fastled/select_sketch_directory.py +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/src/fastled/settings.py +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/src/fastled/site/build.py +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/src/fastled/sketch.py +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/src/fastled/spinner.py +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/src/fastled/string_diff.py +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/src/fastled/test/can_run_local_docker_tests.py +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/src/fastled/test/examples.py +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/src/fastled/types.py +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/src/fastled/util.py +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/src/fastled/web_compile.py +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/src/fastled.egg-info/dependency_links.txt +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/src/fastled.egg-info/entry_points.txt +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/src/fastled.egg-info/requires.txt +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/src/fastled.egg-info/top_level.txt +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/test +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/tests/html/index.html +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/tests/test_api.py +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/tests/test_bad_ino.py +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/tests/test_build_examples.py +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/tests/test_cli.py +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/tests/test_compile_server.py +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/tests/test_docker_linux_on_windows.py +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/tests/test_embedded_data.py +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/tests/test_examples.py +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/tests/test_filechanger.py +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/tests/test_http_server.py +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/tests/test_ino/bad/bad.ino +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/tests/test_ino/bad_platformio/bad_platformio.ino +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/tests/test_ino/bad_platformio/platformio.ini +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/tests/test_ino/embedded/wasm.ino +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/tests/test_ino/wasm/wasm.ino +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/tests/test_project_init.py +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/tests/test_server_and_client_seperatly.py +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/tests/test_webcompile.py +0 -0
- {fastled-1.2.40 → fastled-1.2.42}/upload_package.sh +0 -0
@@ -20,27 +20,13 @@ jobs:
|
|
20
20
|
uses: actions/checkout@v4
|
21
21
|
with:
|
22
22
|
fetch-depth: 2
|
23
|
-
- name: Check FastLED repo
|
24
|
-
uses: actions/checkout@v4
|
25
|
-
with:
|
26
|
-
repository: fastled/fastled
|
27
|
-
path: fastled
|
28
23
|
- id: check
|
29
24
|
run: |
|
30
25
|
# Check if there are any changes in workflow repository
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
FASTLED_CHANGED=$(git log --since="24 hours ago" --oneline | wc -l)
|
36
|
-
|
37
|
-
if [[ -n "$WORKFLOW_CHANGED" ]] || [[ "$FASTLED_CHANGED" -gt 0 ]]; then
|
38
|
-
echo "Changes detected in workflow repository or FastLED in last 24h"
|
39
|
-
echo "should_run=true" >> $GITHUB_OUTPUT
|
40
|
-
else
|
41
|
-
echo "No recent changes detected"
|
42
|
-
echo "should_run=false" >> $GITHUB_OUTPUT
|
43
|
-
fi
|
26
|
+
# At this point always run, this used to trigger on changes to fastled repo (mostly for the compiler stuff)
|
27
|
+
# but that has been moved to this repo.
|
28
|
+
echo "should_run=true" >> $GITHUB_OUTPUT
|
29
|
+
|
44
30
|
|
45
31
|
build-amd64:
|
46
32
|
needs: check-if-changed
|
@@ -73,8 +59,8 @@ jobs:
|
|
73
59
|
uses: docker/build-push-action@v6
|
74
60
|
with:
|
75
61
|
platforms: ${{ matrix.platform }}
|
76
|
-
context: https://github.com/
|
77
|
-
file:
|
62
|
+
context: https://github.com/zackees/fastled-wasm.git
|
63
|
+
file: Dockerfile
|
78
64
|
labels: ${{ steps.meta.outputs.labels }}
|
79
65
|
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
|
80
66
|
build-args: |
|
@@ -125,8 +111,8 @@ jobs:
|
|
125
111
|
uses: docker/build-push-action@v6
|
126
112
|
with:
|
127
113
|
platforms: ${{ matrix.platform }}
|
128
|
-
context: https://github.com/
|
129
|
-
file:
|
114
|
+
context: https://github.com/zackees/fastled-wasm.git
|
115
|
+
file: Dockerfile
|
130
116
|
labels: ${{ steps.meta.outputs.labels }}
|
131
117
|
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
|
132
118
|
build-args: |
|
@@ -0,0 +1,205 @@
|
|
1
|
+
# Overview of this docker file
|
2
|
+
# This is a emscripten docker file that is used to compile FastLED for the web assembly platform.
|
3
|
+
# The goals of this docker are:
|
4
|
+
# * Compile the inputs as quickly as possible.
|
5
|
+
# * Be very fast to rebuild
|
6
|
+
# Container size is important, but not the primary goal.
|
7
|
+
#
|
8
|
+
# The emscripten build is based on emscripten. We create a custom `wasm_compiler_flags.py``
|
9
|
+
# that performs the necessary transformations to make this work.
|
10
|
+
#
|
11
|
+
# Maximizing compiler speed
|
12
|
+
# First let's talk about why platformio is typically slow
|
13
|
+
# * Network checking to see if the repo's are up to date
|
14
|
+
# * Unnecessary recompilation of cpp files that haven't changed.
|
15
|
+
#
|
16
|
+
# We address these slow compiler speeds via a few tricks
|
17
|
+
# * The emscripten compiler is wrapped in ccache so that identical compilations are cached.
|
18
|
+
# * We prewarm the ccache with a pre-compile of an example
|
19
|
+
# * This will generate the initial cache and also install the necessary tools.
|
20
|
+
#
|
21
|
+
# Pre-warming the cache
|
22
|
+
# * We have two pre-warm cycles. We do this for speed reasons.
|
23
|
+
# * The first pre-warm is done with a copy of fastled downloaded from the github repo
|
24
|
+
# * Docker is very relaxed on invalidating a cache layer for statements cloning a github repo. We want this.
|
25
|
+
# * So we clone the repo early in the docker image build cycle. Then we run a pre-warm compile.
|
26
|
+
# * This is the slowest pre-warm, and once built, tends to always be cached. However, it tends to go out of date
|
27
|
+
# quickly, which will make the cache be less effective.
|
28
|
+
# * The second pre-warm is done with a fresh copy of the fastled repo from the host machine that is copied over the
|
29
|
+
# git hub repo. We copy directories piece by piece to maximize the cache hit rate. Core files then platform files.
|
30
|
+
# * During developement when many files are changed, this second pre-warm will almost always be invalidated, however
|
31
|
+
# it is very fast to rebuild because the initial tool download of platformio has already been done with the first pre-warm.
|
32
|
+
# * After this second pre-warm, the ccache will have the exact state of the repo in it's cache.
|
33
|
+
#
|
34
|
+
# Final state
|
35
|
+
# * The final state of the docker image is a pre-warmed cached with the entire instance ready to compile.
|
36
|
+
# * The calling code is expected to provide volume mapped directory that will be inserted into the docker image when it runs.
|
37
|
+
# * However, this is not true when using this in server mode (see server.py) where the code to be compiled is injected into the
|
38
|
+
# container instance via a FastAPI route, the compilation is performed. Typically the web compiler is much better at holding
|
39
|
+
# on the cached files. Server.py will also periodically git pull the fastled repo to keep in sync with the latest changes.
|
40
|
+
|
41
|
+
|
42
|
+
# This will be set to arm64 to support MacOS M1+ devices (and Linux-based arm64 devices)
|
43
|
+
ARG PLATFORM_TAG=""
|
44
|
+
|
45
|
+
# Use only Emscripten base image
|
46
|
+
FROM emscripten/emsdk:3.1.70${PLATFORM_TAG}
|
47
|
+
|
48
|
+
|
49
|
+
ENV DEBIAN_FRONTEND=noninteractive
|
50
|
+
|
51
|
+
# Update the apt-get package list. This takes a long time, so we do it first to maximize cache hits.
|
52
|
+
# Also install apt-fast first
|
53
|
+
RUN apt-get update
|
54
|
+
|
55
|
+
RUN apt-get install -y software-properties-common
|
56
|
+
|
57
|
+
RUN add-apt-repository ppa:apt-fast/stable -y && \
|
58
|
+
apt-get update && \
|
59
|
+
apt-get -y install apt-fast
|
60
|
+
|
61
|
+
# Update apt and install required packages
|
62
|
+
RUN apt-fast install -y \
|
63
|
+
git \
|
64
|
+
gawk \
|
65
|
+
nano \
|
66
|
+
ca-certificates \
|
67
|
+
python3 \
|
68
|
+
python3-pip \
|
69
|
+
dos2unix \
|
70
|
+
tar \
|
71
|
+
wget \
|
72
|
+
unzip \
|
73
|
+
make \
|
74
|
+
cmake \
|
75
|
+
ninja-build \
|
76
|
+
ccache \
|
77
|
+
zlib1g \
|
78
|
+
zlib1g-dev \
|
79
|
+
gcc \
|
80
|
+
g++ \
|
81
|
+
rsync \
|
82
|
+
&& rm -rf /var/lib/apt/lists/*
|
83
|
+
|
84
|
+
|
85
|
+
# /container/bin contains symbolic links to python3 and pip3 as python and pip that we use for the compiler.
|
86
|
+
RUN mkdir -p /container/bin && \
|
87
|
+
ln -s /usr/bin/python3 /container/bin/python && \
|
88
|
+
ln -s /usr/bin/pip3 /container/bin/pip
|
89
|
+
|
90
|
+
|
91
|
+
# Add Python and Emscripten to PATH
|
92
|
+
ENV PATH="/container/bin:/usr/local/bin:/usr/bin:/emsdk:/emsdk/upstream/emscripten:${PATH}"
|
93
|
+
ENV CCACHE_DIR=/ccache
|
94
|
+
ENV CCACHE_MAXSIZE=1G
|
95
|
+
|
96
|
+
# Create a custom print script
|
97
|
+
RUN echo '#!/bin/sh' > /usr/bin/print && \
|
98
|
+
echo 'echo "$@"' >> /usr/bin/print && \
|
99
|
+
chmod +x /usr/bin/print
|
100
|
+
|
101
|
+
# Add print function (which seems to be missing, strangly) and PATH modifications to /etc/profile
|
102
|
+
RUN echo 'print() { echo "$@"; }' >> /etc/profile && \
|
103
|
+
echo 'export -f print' >> /etc/profile && \
|
104
|
+
echo 'export PATH="/container/bin:/usr/bin:/emsdk:/emsdk/upstream/emscripten:$PATH"' >> /etc/profile && \
|
105
|
+
echo 'source /emsdk/emsdk_env.sh' >> /etc/profile
|
106
|
+
|
107
|
+
# This was added to try and fix formatting issues. It didn't fix it but it's better to force everything to use
|
108
|
+
# utf-8, as god intended it.
|
109
|
+
ENV LANG=en_US.UTF-8
|
110
|
+
ENV LC_CTYPE=UTF-8
|
111
|
+
RUN echo 'export LANG=en_US.UTF-8' >> /etc/profile && \
|
112
|
+
echo 'export LC_CTYPE=UTF-8' >> /etc/profile
|
113
|
+
|
114
|
+
# This is disabled code to try and use the arduino-cli to transform an *.ino file into a cpp file
|
115
|
+
# to enable the auto-predeclaration of missing functions. However, Arduino-cli is absolutely gigantic
|
116
|
+
# and requires that we compile it against one of the platforms. This doesn't work for us because
|
117
|
+
# we don't want a compile failure because of something weird in the platform we are compiling against, which
|
118
|
+
# isn't wasm.
|
119
|
+
#COPY compiler/install-arduino-cli.sh /install-arduino-cli.sh
|
120
|
+
#RUN chmod +x /install-arduino-cli.sh && /install-arduino-cli.sh || echo "Failed to install Arduino CLI"
|
121
|
+
|
122
|
+
RUN pip install uv==0.5.6
|
123
|
+
|
124
|
+
# Get the compiler requirements and install them.
|
125
|
+
COPY compiler/requirements.txt /install/requirements.txt
|
126
|
+
RUN uv pip install --system -r /install/requirements.txt
|
127
|
+
|
128
|
+
RUN pio settings set check_platformio_interval 9999
|
129
|
+
RUN pio settings set enable_telemetry 0
|
130
|
+
|
131
|
+
# FIRST PRE-WARM CYCLE and initial setup: Download the fastled repo from the github and pre-warm the cache with a compilation.
|
132
|
+
# This is by far the most expensive part of the build, because platformio needs to download initial tools. This
|
133
|
+
# pre-warm cycle is "sticky" and tends to stay in the cache for a long time since docker is very relaxed about
|
134
|
+
# invalidating cache layers that clone a github repo.
|
135
|
+
|
136
|
+
ARG FASTLED_BUILD_DAY=echo $(date +'%Y-%m-%d')
|
137
|
+
ENV FASTLED_BUILD_DAY=${FASTLED_BUILD_DAY}
|
138
|
+
|
139
|
+
ARG FASTLED_VERSION=master
|
140
|
+
ENV FASTLED_VERSION=${FASTLED_VERSION}
|
141
|
+
RUN git clone -b ${FASTLED_VERSION} https://github.com/fastled/FastLED.git --depth 1 /git/fastled && \
|
142
|
+
mkdir -p /js/fastled && \
|
143
|
+
rsync -a /git/fastled/ /js/fastled/ --exclude='.git'
|
144
|
+
|
145
|
+
# Create symlinks for wasm platform files.
|
146
|
+
COPY compiler/init_runtime.py /js/init_runtime.py
|
147
|
+
COPY compiler/prewarm.sh /js/prewarm.sh
|
148
|
+
|
149
|
+
WORKDIR /js
|
150
|
+
|
151
|
+
ARG NO_PREWARM=0
|
152
|
+
ENV NO_PREWARM=${NO_PREWARM}
|
153
|
+
|
154
|
+
RUN python /js/init_runtime.py || true
|
155
|
+
|
156
|
+
|
157
|
+
# First pre-warm cycle - always do it as part of the build.
|
158
|
+
RUN mkdir -p /logs
|
159
|
+
|
160
|
+
# Force a build if the compiler flags change.
|
161
|
+
COPY compiler/wasm_compiler_flags.py /trash/wasm_compiler_flags.py
|
162
|
+
COPY compiler/CMakeLists.txt /trash/CMakeLists.txt
|
163
|
+
RUN rm -rf /trash
|
164
|
+
|
165
|
+
RUN chmod +x /js/prewarm.sh && \
|
166
|
+
cat /js/prewarm.sh >> /logs/prewarm.log.0
|
167
|
+
RUN /js/prewarm.sh --force >> /logs/prewarm.log.1 || true
|
168
|
+
|
169
|
+
|
170
|
+
# # Copy the fastled repo from the host machine and prepare for pre-warm
|
171
|
+
# # Make sure and delete files that have been removed so that we don't get
|
172
|
+
# # duplicate symbols from stale files.
|
173
|
+
# COPY *.json /host/fastled/
|
174
|
+
# COPY src/*.* /host/fastled/src/
|
175
|
+
# COPY examples /host/fastled/examples
|
176
|
+
# COPY src/fx /host/fastled/src/fx
|
177
|
+
# COPY src/fl /host/fastled/src/fl
|
178
|
+
# COPY src/lib8tion /host/fastled/src/lib8tion
|
179
|
+
# COPY src/third_party /host/fastled/src/third_party
|
180
|
+
# COPY src/sensors /host/fastled/src/sensors
|
181
|
+
# COPY src/platforms /host/fastled/src/platforms
|
182
|
+
|
183
|
+
COPY compiler /js/compiler
|
184
|
+
|
185
|
+
COPY compiler/entrypoint.sh /entrypoint.sh
|
186
|
+
RUN chmod +x /entrypoint.sh && dos2unix /entrypoint.sh
|
187
|
+
|
188
|
+
# RSYNC DISABLED FOR NOW
|
189
|
+
# now sync local to the source directory.
|
190
|
+
# RUN rsync -av /host/fastled/ /js/fastled/ && rm -rf /host/fastled
|
191
|
+
|
192
|
+
RUN python /js/init_runtime.py || true
|
193
|
+
|
194
|
+
|
195
|
+
# SECOND PRE-WARM CYCLE: Copy the fastled repo from the host machine and pre-warm the cache with that compilation. This will
|
196
|
+
# be much quicker than the first pre-warm cycle.
|
197
|
+
RUN /js/prewarm.sh --force > /logs/prewarm.log.2 || true
|
198
|
+
|
199
|
+
# Now timestamp the image and store it at the end of the build.
|
200
|
+
RUN date > /image_timestamp.txt
|
201
|
+
|
202
|
+
ENTRYPOINT ["/entrypoint.sh"]
|
203
|
+
CMD ["python", "/js/run.py", "server"]
|
204
|
+
|
205
|
+
# CMD ["/bin/bash", "/entrypoint.sh"]
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: fastled
|
3
|
-
Version: 1.2.
|
3
|
+
Version: 1.2.42
|
4
4
|
Summary: FastLED Wasm Compiler
|
5
5
|
Home-page: https://github.com/zackees/fastled-wasm
|
6
6
|
Maintainer: Zachary Vorhies
|
@@ -294,6 +294,8 @@ A: `delay()` will block `loop()` which blocks the main thread of the browser. Th
|
|
294
294
|
Q: How can I get the compiled size of my FastLED sketch smaller?
|
295
295
|
A: A big chunk of space is being used by unnecessary javascript `emscripten` bundling. The wasm_compiler_settings.py file in the FastLED repo can tweak this.
|
296
296
|
|
297
|
+
|
298
|
+
|
297
299
|
# Revisions
|
298
300
|
|
299
301
|
* 1.2.31 - Bunch of fixes and ease of use while compiling code in the repo.
|
@@ -268,6 +268,8 @@ A: `delay()` will block `loop()` which blocks the main thread of the browser. Th
|
|
268
268
|
Q: How can I get the compiled size of my FastLED sketch smaller?
|
269
269
|
A: A big chunk of space is being used by unnecessary javascript `emscripten` bundling. The wasm_compiler_settings.py file in the FastLED repo can tweak this.
|
270
270
|
|
271
|
+
|
272
|
+
|
271
273
|
# Revisions
|
272
274
|
|
273
275
|
* 1.2.31 - Bunch of fixes and ease of use while compiling code in the repo.
|
@@ -0,0 +1,139 @@
|
|
1
|
+
cmake_minimum_required(VERSION 3.10)
|
2
|
+
project(FastLED_WASM)
|
3
|
+
|
4
|
+
# Enable verbose makefile output for all compiled sources
|
5
|
+
set(CMAKE_VERBOSE_MAKEFILE ON)
|
6
|
+
|
7
|
+
# --- Set Emscripten as the Compiler ---
|
8
|
+
set(CMAKE_C_COMPILER "emcc")
|
9
|
+
set(CMAKE_CXX_COMPILER "em++")
|
10
|
+
set(CMAKE_AR "emar")
|
11
|
+
set(CMAKE_RANLIB "emranlib")
|
12
|
+
|
13
|
+
# Use ccache as a compiler launcher (requires CMake 3.4 or newer)
|
14
|
+
set(CMAKE_C_COMPILER_LAUNCHER "ccache")
|
15
|
+
set(CMAKE_CXX_COMPILER_LAUNCHER "ccache")
|
16
|
+
|
17
|
+
# --- Build Mode and Optimization Level ---
|
18
|
+
if(NOT DEFINED ENV{BUILD_MODE})
|
19
|
+
set(BUILD_MODE "QUICK")
|
20
|
+
else()
|
21
|
+
set(BUILD_MODE $ENV{BUILD_MODE})
|
22
|
+
endif()
|
23
|
+
|
24
|
+
if(BUILD_MODE STREQUAL "QUICK")
|
25
|
+
set(OPT_LEVEL "-O0")
|
26
|
+
elseif(BUILD_MODE STREQUAL "DEBUG")
|
27
|
+
set(OPT_LEVEL "-Og")
|
28
|
+
else() # RELEASE
|
29
|
+
set(OPT_LEVEL "-Oz")
|
30
|
+
endif()
|
31
|
+
|
32
|
+
# --- Common Compiler and Linker Flags ---
|
33
|
+
set(COMMON_COMPILE_FLAGS
|
34
|
+
-DFASTLED_ENGINE_EVENTS_MAX_LISTENERS=50
|
35
|
+
-DFASTLED_FORCE_NAMESPACE=1
|
36
|
+
-DFASTLED_NO_FORCE_INLINE
|
37
|
+
-DFASTLED_USE_PROGMEM=0
|
38
|
+
-DDISABLE_EXCEPTION_CATCHING=1
|
39
|
+
-fno-exceptions
|
40
|
+
-fno-rtti
|
41
|
+
-DEMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0
|
42
|
+
-std=gnu++17
|
43
|
+
-fpermissive
|
44
|
+
-fno-inline
|
45
|
+
-Wno-constant-logical-operand
|
46
|
+
-Wnon-c-typedef-for-linkage
|
47
|
+
-Werror=bad-function-cast
|
48
|
+
-Werror=cast-function-type
|
49
|
+
-sUSE_PTHREADS=0 # Disable threading support
|
50
|
+
${OPT_LEVEL}
|
51
|
+
)
|
52
|
+
|
53
|
+
# (Optional: PROFILE flags can be added here if needed)
|
54
|
+
|
55
|
+
set(COMMON_LINK_FLAGS
|
56
|
+
-sALLOW_MEMORY_GROWTH=0
|
57
|
+
-sDISABLE_EXCEPTION_CATCHING=1
|
58
|
+
-sDISABLE_EXCEPTION_THROWING=0
|
59
|
+
-sWASM_BIGINT
|
60
|
+
--bind
|
61
|
+
-DUSE_OFFSET_CONVERTER=0
|
62
|
+
-sINITIAL_MEMORY=134217728
|
63
|
+
-fuse-ld=lld
|
64
|
+
--no-entry
|
65
|
+
-sMODULARIZE=1
|
66
|
+
)
|
67
|
+
|
68
|
+
set(LIBRARY_LINK_FLAGS
|
69
|
+
${COMMON_LINK_FLAGS}
|
70
|
+
)
|
71
|
+
|
72
|
+
set(SKETCH_LINK_FLAGS
|
73
|
+
${COMMON_LINK_FLAGS}
|
74
|
+
-sEXPORTED_RUNTIME_METHODS=['ccall','cwrap','stringToUTF8','lengthBytesUTF8']
|
75
|
+
-sEXPORTED_FUNCTIONS=['_malloc','_free','_extern_setup','_extern_loop','_fastled_declare_files']
|
76
|
+
-sEXPORT_NAME=fastled
|
77
|
+
-o fastled.js
|
78
|
+
)
|
79
|
+
|
80
|
+
if(BUILD_MODE STREQUAL "DEBUG")
|
81
|
+
list(APPEND COMMON_COMPILE_FLAGS
|
82
|
+
-g3
|
83
|
+
-fsanitize=address
|
84
|
+
-fsanitize=undefined
|
85
|
+
)
|
86
|
+
set(DEBUG_LINK_FLAGS
|
87
|
+
-gsource-map
|
88
|
+
--emit-symbol-map
|
89
|
+
-sSTACK_OVERFLOW_CHECK=2
|
90
|
+
-ASSERTIONS=1
|
91
|
+
)
|
92
|
+
list(APPEND LIBRARY_LINK_FLAGS ${DEBUG_LINK_FLAGS})
|
93
|
+
list(APPEND SKETCH_LINK_FLAGS ${DEBUG_LINK_FLAGS})
|
94
|
+
endif()
|
95
|
+
|
96
|
+
# --- FASTLED LIBRARY SETUP ---
|
97
|
+
set(LIBFASTLED_PATH /precompiled/libfastled.a)
|
98
|
+
|
99
|
+
if(EXISTS ${LIBFASTLED_PATH})
|
100
|
+
message(STATUS "Found prebuilt libfastled.a at ${LIBFASTLED_PATH}, skipping build of FastLED library.")
|
101
|
+
add_library(fastled STATIC IMPORTED)
|
102
|
+
set_target_properties(fastled PROPERTIES IMPORTED_LOCATION ${LIBFASTLED_PATH})
|
103
|
+
else()
|
104
|
+
message(FATAL_ERROR "Did not find precompiled libfastled.a at ${LIBFASTLED_PATH}. Please build the library first.")
|
105
|
+
endif()
|
106
|
+
|
107
|
+
if(TARGET fastled)
|
108
|
+
set_target_properties(fastled PROPERTIES
|
109
|
+
CXX_STANDARD 17
|
110
|
+
CXX_STANDARD_REQUIRED ON
|
111
|
+
POSITION_INDEPENDENT_CODE ON
|
112
|
+
)
|
113
|
+
endif()
|
114
|
+
|
115
|
+
# --- LIBRARY TARGET: sketch_lib ---
|
116
|
+
file(GLOB_RECURSE ALL_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
|
117
|
+
message(STATUS "All sources: ${ALL_SOURCES}")
|
118
|
+
|
119
|
+
add_library(sketch_lib STATIC ${ALL_SOURCES})
|
120
|
+
|
121
|
+
target_compile_options(sketch_lib PRIVATE ${COMMON_COMPILE_FLAGS})
|
122
|
+
target_compile_definitions(sketch_lib PRIVATE SKETCH_COMPILE)
|
123
|
+
target_include_directories(sketch_lib PRIVATE
|
124
|
+
${CMAKE_CURRENT_SOURCE_DIR}/src
|
125
|
+
"/precompiled/include"
|
126
|
+
)
|
127
|
+
set_target_properties(sketch_lib PROPERTIES
|
128
|
+
CXX_STANDARD 17
|
129
|
+
CXX_STANDARD_REQUIRED ON
|
130
|
+
)
|
131
|
+
|
132
|
+
# ── FINAL LINKING STEP: Produce fastled.js ──
|
133
|
+
# This custom target invokes em++ to link the static library (sketch_lib)
|
134
|
+
# with the precompiled libfastled.a into the final binary fastled.js.
|
135
|
+
add_custom_target(final_wasm ALL
|
136
|
+
COMMAND em++ ${SKETCH_LINK_FLAGS} -Wl,--whole-archive $<TARGET_FILE:sketch_lib> -Wl,--no-whole-archive /precompiled/libfastled.a
|
137
|
+
DEPENDS sketch_lib fastled
|
138
|
+
COMMENT "Linking final wasm binary to fastled.js"
|
139
|
+
)
|
@@ -0,0 +1,28 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
set -e # Exit immediately if a command exits with a non-zero status
|
3
|
+
set -x
|
4
|
+
|
5
|
+
# if /include does not exist
|
6
|
+
if [ ! -d "/precompiled/include" ]; then
|
7
|
+
echo "include directory does not exist, copying header include tree"
|
8
|
+
# echo "include directory does not exist, copying header include tree"
|
9
|
+
# copy *.h,*.hpp files from fastled/src/** to /include
|
10
|
+
mkdir -p /precompiled/include
|
11
|
+
cd fastled/src
|
12
|
+
find . -name "*.h*" -exec cp --parents {} /precompiled/include \;
|
13
|
+
cd ../../
|
14
|
+
fi
|
15
|
+
|
16
|
+
# if /precompiled/libfastled.a does not exist
|
17
|
+
if [ ! -f "/precompiled/libfastled.a" ]; then
|
18
|
+
# echo "libfastled.a does not exist, compiling static library"
|
19
|
+
echo "libfastled.a does not exist, compiling static library"
|
20
|
+
cd fastled/src/platforms/wasm/compiler/lib
|
21
|
+
mkdir -p build
|
22
|
+
cd build
|
23
|
+
emcmake cmake -DCMAKE_VERBOSE_MAKEFILE=ON ..
|
24
|
+
emmake cmake --build . -v -j
|
25
|
+
cp fastled/libfastled.a /precompiled/libfastled.a
|
26
|
+
cd ../../../../../
|
27
|
+
fi
|
28
|
+
|
@@ -0,0 +1,54 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
set -e # Exit immediately if a command exits with a non-zero status
|
3
|
+
set -x
|
4
|
+
|
5
|
+
#################################
|
6
|
+
# Compile fastled lib
|
7
|
+
#################################
|
8
|
+
|
9
|
+
|
10
|
+
./build_archive.sh
|
11
|
+
|
12
|
+
# first compile if build doesn't exist
|
13
|
+
first_compile=false
|
14
|
+
|
15
|
+
# if build directory doesn't exist
|
16
|
+
if [ ! -d "build" ]; then
|
17
|
+
# Create the build directory if it doesn't exist and mark as first compile.
|
18
|
+
mkdir -p build
|
19
|
+
# if /js/src/CMakeCache.txt exists then delete it
|
20
|
+
|
21
|
+
first_compile=true
|
22
|
+
fi
|
23
|
+
|
24
|
+
cd build
|
25
|
+
|
26
|
+
# Set build mode: QUICK, DEBUG, or RELEASE (default is QUICK)
|
27
|
+
export BUILD_MODE=${1:-QUICK}
|
28
|
+
|
29
|
+
# Check for an optional second parameter to activate PROFILE
|
30
|
+
# PROFILE_FLAG="-DPROFILE=ON"
|
31
|
+
|
32
|
+
# touch CMakeLists.txt to force reconfigure
|
33
|
+
touch /js/CMakeLists.txt
|
34
|
+
|
35
|
+
|
36
|
+
# always delete CMakeCache.txt
|
37
|
+
if [ -f "/js/fastled/src/CMakeCache.txt" ]; then
|
38
|
+
rm -rf /js/fastled/src/CMakeCache.txt
|
39
|
+
fi
|
40
|
+
|
41
|
+
|
42
|
+
if [ "$first_compile" = true ]; then
|
43
|
+
# Configure with CMake
|
44
|
+
# If you want verbose build output, you can enable CMAKE_VERBOSE_MAKEFILE.
|
45
|
+
echo "Configuring build with CMake..."
|
46
|
+
emcmake cmake -DCMAKE_VERBOSE_MAKEFILE=ON ..
|
47
|
+
else
|
48
|
+
# If the build directory already exists, reconfigure with CMake.
|
49
|
+
echo "Skipping CMake configuration as build directory already exists."
|
50
|
+
fi
|
51
|
+
|
52
|
+
# Build the project using CMake
|
53
|
+
emmake cmake --build . -v -j
|
54
|
+
|
@@ -0,0 +1,76 @@
|
|
1
|
+
|
2
|
+
import os
|
3
|
+
from pathlib import Path
|
4
|
+
from typing import Callable
|
5
|
+
import subprocess
|
6
|
+
import time
|
7
|
+
|
8
|
+
from compile_lock import COMPILE_LOCK
|
9
|
+
|
10
|
+
VOLUME_MAPPED_SRC = Path("/host/fastled/src")
|
11
|
+
RSYNC_DEST = Path("/js/fastled/src")
|
12
|
+
TIME_START = time.time()
|
13
|
+
|
14
|
+
def sync_src_to_target(
|
15
|
+
src: Path, dst: Path, callback: Callable[[], None] | None = None
|
16
|
+
) -> bool:
|
17
|
+
"""Sync the volume mapped source directory to the FastLED source directory."""
|
18
|
+
suppress_print = (
|
19
|
+
TIME_START + 30 > time.time()
|
20
|
+
) # Don't print during initial volume map.
|
21
|
+
if not src.exists():
|
22
|
+
# Volume is not mapped in so we don't rsync it.
|
23
|
+
print(f"Skipping rsync, as fastled src at {src} doesn't exist")
|
24
|
+
return False
|
25
|
+
try:
|
26
|
+
exclude_hidden = "--exclude=.*/" # suppresses folders like .mypy_cache/
|
27
|
+
print("\nSyncing source directories...")
|
28
|
+
with COMPILE_LOCK:
|
29
|
+
# Use rsync to copy files, preserving timestamps and deleting removed files
|
30
|
+
cp: subprocess.CompletedProcess = subprocess.run(
|
31
|
+
["rsync", "-av", "--info=NAME", "--delete", f"{src}/", f"{dst}/", exclude_hidden],
|
32
|
+
check=True,
|
33
|
+
text=True,
|
34
|
+
capture_output=True,
|
35
|
+
)
|
36
|
+
if cp.returncode == 0:
|
37
|
+
changed = False
|
38
|
+
changed_lines: list[str] = []
|
39
|
+
lines = cp.stdout.split("\n")
|
40
|
+
for line in lines:
|
41
|
+
suffix = line.strip().split(".")[-1]
|
42
|
+
if suffix in ["cpp", "h", "hpp", "ino", "py", "js", "html", "css"]:
|
43
|
+
if not suppress_print:
|
44
|
+
print(f"Changed file: {line}")
|
45
|
+
changed = True
|
46
|
+
changed_lines.append(line)
|
47
|
+
if changed:
|
48
|
+
if not suppress_print:
|
49
|
+
print(f"FastLED code had updates: {changed_lines}")
|
50
|
+
if callback:
|
51
|
+
callback()
|
52
|
+
return True
|
53
|
+
print("Source directory synced successfully with no changes")
|
54
|
+
return False
|
55
|
+
else:
|
56
|
+
print(f"Error syncing directories: {cp.stdout}\n\n{cp.stderr}")
|
57
|
+
return False
|
58
|
+
|
59
|
+
except subprocess.CalledProcessError as e:
|
60
|
+
print(f"Error syncing directories: {e.stdout}\n\n{e.stderr}")
|
61
|
+
except Exception as e:
|
62
|
+
print(f"Error syncing directories: {e}")
|
63
|
+
return False
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
def sync_source_directory_if_volume_is_mapped(
|
68
|
+
callback: Callable[[], None] | None = None
|
69
|
+
) -> bool:
|
70
|
+
"""Sync the volume mapped source directory to the FastLED source directory."""
|
71
|
+
if not VOLUME_MAPPED_SRC.exists():
|
72
|
+
# Volume is not mapped in so we don't rsync it.
|
73
|
+
print("Skipping rsync, as fastled src volume not mapped")
|
74
|
+
return False
|
75
|
+
print("Syncing source directories because host is mapped in")
|
76
|
+
return sync_src_to_target(VOLUME_MAPPED_SRC, RSYNC_DEST, callback=callback)
|