@@ -71,7 +71,7 @@ libs_bindings_all:
7171ibex_build :
7272 mkdir -p build_ibex_ems && \
7373 cd build_ibex_ems && \
74- source ~/ emsdk/ emsdk_env.sh && \
74+ if [ -f ~ / emsdk / emsdk_env.sh ]; then source ~/ emsdk/ emsdk_env.sh; fi && \
7575 emcmake cmake .. -DCMAKE_BUILD_TYPE=Release -DIMMVISION_FETCH_OPENCV=ON && \
7676 make -j
7777
@@ -108,7 +108,7 @@ ibex_serve:
108108imex_ems_build :
109109 mkdir -p build_imex_ems && \
110110 cd build_imex_ems && \
111- source ~/ emsdk/ emsdk_env.sh && \
111+ if [ -f ~ / emsdk / emsdk_env.sh ]; then source ~/ emsdk/ emsdk_env.sh; fi && \
112112 emcmake cmake .. -DCMAKE_BUILD_TYPE=Release \
113113 - DIMGUI_BUNDLE_BUILD_IMGUI_EXPLORER_APP=ON -DIMGUI_BUNDLE_WITH_IMANIM=OFF -DIMGUI_BUNDLE_BUILD_DEMOS=OFF -DIMGUI_BUNDLE_WITH_IMMVISION=OFF && \
114114 cmake --build . -j 8
@@ -245,6 +245,65 @@ pyodide_deploy_imgui_bundle_online:
245245 echo " Deployed to https://traineq.org/imgui_bundle_online/"
246246
247247
248+ # ==============================================================
249+ # Cloudflare Pages deploy (to https://imgui-bundle.pages.dev/)
250+ # ==============================================================
251+ # See docs/book/devel_docs/cloudflare_deploy.md for the full workflow.
252+ #
253+ # imgui-bundle.pages.dev/ landing page (links)
254+ # imgui-bundle.pages.dev/playground_python/ pyodide playground
255+ # imgui-bundle.pages.dev/min_pyodide_app/ minimal pyodide sample
256+ # imgui-bundle.pages.dev/local_wheels/ shared wheel (referenced as ../local_wheels/)
257+ # imgui-bundle.pages.dev/explorer/ ibex
258+ #
259+ # Requires: wrangler (`npm i -g wrangler`) and either
260+ # - env vars CLOUDFLARE_API_TOKEN + CLOUDFLARE_ACCOUNT_ID, or
261+ # - `wrangler login` / `wrangler whoami` auth
262+ _CF_STAGING := " pyodide_projects/_cf_staging"
263+ _CF_PROJECT := " imgui-bundle"
264+
265+ # populates pyodide_projects/_cf_staging which is what will be uploaded to imgui-bundle.pages.dev/
266+ [group (' cloudflare' )]
267+ cf_stage :
268+ # 0. Make dir pyodide_projects/_cf_staging (gitignored)
269+ mkdir -p {{ _CF_STAGING}}
270+ # 1. Copy landing page and CF _headers file
271+ # ------------------------------------------------------------
272+ cp pyodide_projects/ cf_landing.html {{ _CF_STAGING}} / index.html
273+ cp pyodide_projects/ cf_headers {{ _CF_STAGING}} / _headers
274+ # 2. Copy min_pyodide_app
275+ # ------------------------------------------------------------
276+ rm -rf {{ _CF_STAGING}} / min_pyodide_app
277+ cd pyodide_projects/ projects/ min_bundle_pyodide_app && cp -f demo_heart.html demo_heart.source.txt
278+ rsync -a pyodide_projects/ projects/ min_bundle_pyodide_app/ {{ _CF_STAGING}} / min_pyodide_app/
279+ # 3. Copy python playground
280+ # ------------------------------------------------------------
281+ # --copy-unsafe-links resolves the examples/ symlink (points outside the tree)
282+ rm -rf {{ _CF_STAGING}} / playground_python {{ _CF_STAGING}} / local_wheels
283+ rsync -a --copy-unsafe-links pyodide_projects/ projects/ imgui_bundle_playground/ {{ _CF_STAGING}} / playground_python/
284+ rsync -a pyodide_projects/ projects/ local_wheels/ {{ _CF_STAGING}} / local_wheels/
285+ # 4. Copy bundle explorer (ibex)
286+ # ------------------------------------------------------------
287+ rm -rf {{ _CF_STAGING}} / explorer
288+ rsync -a --exclude=' *.gz' build_ibex_ems/ bin/ {{ _CF_STAGING}} / explorer/
289+ cp build_ibex_ems/ bin/ demo_imgui_bundle.html {{ _CF_STAGING}} / explorer/ index.html
290+
291+ # Upload the current staging dir to Cloudflare Pages (the whole site snapshot)
292+ [group (' cloudflare' )]
293+ cf_deploy :
294+ wrangler pages deploy {{ _CF_STAGING}} --project-name={{ _CF_PROJECT}} --commit-dirty=true
295+ echo " Deployed to https://imgui-bundle.pages.dev/"
296+
297+ # Wipe staging
298+ [group (' cloudflare' )]
299+ cf_clean :
300+ rm -rf {{ _CF_STAGING}}
301+
302+ # Serves locally the current staging dir (add coi headers for the explorer)
303+ [group (' cloudflare' )]
304+ cf_serve_local :
305+ cd {{ _CF_STAGING}} && python ../ ../ ci_scripts/ webserver_multithread_policy.py -p 8765 --coi-prefix=/ explorer/
306+
248307# ==============================================================
249308# Tests
250309# ==============================================================
0 commit comments