diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index 7bd3efbd7..4d5a781a6 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -1,4 +1,4 @@ -name: C/C++ CI +name: Checkers on: [push, pull_request] diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index bcb5701e4..bea97e11a 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,22 +1,36 @@ -name: Documentation on github.io +name: Docs, Webverion and Deploy -on: - push: - branches: [ master ] +on: [push, pull_request] jobs: - build-documentation: + build: runs-on: ubuntu-latest steps: - name: checkout uses: actions/checkout@v4 - - name: apt-update - run: sudo apt-get update -qq - - name: apt-get doxygen - run: sudo apt-get install -y doxygen + #Documentation + - name: Install packages for docs + run: | + sudo apt-get update -qq + sudo apt-get install -y doxygen - name: build doc run: make docs - - name: deploy + #Webversion + - name: Install packages for webver + run: | + sudo apt-get update -qq + sudo apt-get install -y make + - name: Setup Emscripten SDK + uses: mymindstorm/setup-emsdk@v14 + - name: Verify Emscripten + run: emcc -v + - name: Build SDL3 port for Emscripten + run: embuilder build sdl3 + - name: Build webversion + run: make webver + #Deploy to GitHub Pages + - name: Deploy to GitHub Pages + if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/feat/webver') }} uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/Makefile b/Makefile index 0bf29ab51..bbbe5eeed 100644 --- a/Makefile +++ b/Makefile @@ -5,9 +5,18 @@ ## path stuff DOCS_PATH:=./doc +# Convenience shortcut to docs output path (as defined in Doxyfile) +DOCS_OUT:=$(DOCS_PATH)/html + DEMO_PATH=demo SRC_PATH=src +WEBVER_BACKEND:=./demo/sdl3_renderer +WEBVER_SITE:=./webver/site +WEBVER_OUT:=$(DOCS_OUT)/webver +WEBVER_CFLAGS:=-O2 -DINCLUDE_ALL -sEXPORTED_RUNTIME_METHODS=requestFullscreen +#Possible choice: ccall,cwrap,requestFullscreen,FS +WEBVER_CFLAGS+=${CFLAGS} ## Documents settings DOXYFILE:=$(DOCS_PATH)/Doxyfile @@ -37,15 +46,16 @@ DEMO_LIST = $(shell find $(DEMO_PATH) -type f -name Makefile -printf "%h ") ###################################################################################### -.PHONY: usage all demos $(DEMO_LIST) +.PHONY: usage all demos webver $(DEMO_LIST) usage: - echo "make docs to create documentation" - echo "make nuke to rebuild the single header nuklear.h from source" - echo "make demos to build all of the demos" - echo "make all to re-pack the header and create documentation" + @echo "make docs to create documentation" + @echo "make webver to build webversion on SDL3 + Emscripten (try to run 'embuilder build sdl3' if first time)" + @echo "make nuke to rebuild the single header nuklear.h from source" + @echo "make demos to build all of the demos" + @echo "make all to re-pack the header and create documentation" -all: docs nuke demos +all: docs webver nuke demos demos: $(DEMO_LIST) @@ -57,14 +67,12 @@ nuke: $(addprefix $(SRC_PATH)/, $(SRC)) - - ######################################################################################## ## Docs -docs: $(DOCS_PATH)/html/index.html +docs: $(DOCS_OUT)/index.html -$(DOCS_PATH)/html/index.html: $(DOCS_PATH)/doxygen-awesome-css/doxygen-awesome.css $(DOXYFILE) +$(DOCS_OUT)/index.html: $(DOCS_PATH)/doxygen-awesome-css/doxygen-awesome.css $(DOXYFILE) doxygen $(DOXYFILE) $(DOXYFILE): @@ -75,6 +83,16 @@ $(DOCS_PATH)/doxygen-awesome-css/doxygen-awesome.css: +######################################################################################## +## webver + +webver: + mkdir -p $(WEBVER_OUT) + emmake make -C $(WEBVER_BACKEND) CFLAGS="$(WEBVER_CFLAGS)" BIN=$(abspath $(WEBVER_OUT)/demo_sdl3_renderer.js) TEMPDIR=$(abspath $(WEBVER_OUT)) + cp -r $(WEBVER_SITE)/* $(WEBVER_OUT)/ +#[NOTE]We pass TEMPDIR directly for hide a potential issue + + ######################################################################################## ## Demos @@ -87,4 +105,4 @@ $(DEMO_LIST): ## Utility helpers clean: - rm -rf $(DOCS_PATH)/html $(OUTPUT) + rm -rf $(DOCS_OUT) $(OUTPUT) diff --git a/Readme.md b/Readme.md index e535a5ec7..b109adc9f 100644 --- a/Readme.md +++ b/Readme.md @@ -11,6 +11,8 @@ draw commands describing primitive shapes as output. So instead of providing a layered library that tries to abstract over a number of platform and render backends, it focuses only on the actual UI. +Try Nuklear in Browser + ## Features - Immediate-mode graphical user interface toolkit diff --git a/src/HEADER.md b/src/HEADER.md index 60b24788c..33b081a61 100644 --- a/src/HEADER.md +++ b/src/HEADER.md @@ -34,6 +34,10 @@ commands describing primitive shapes as output. So instead of providing a layered library that tries to abstract over a number of platform and render backends it only focuses on the actual UI. +Try Nuklear in Browser + +Nuklear in a minimal shell is also provided for compatibility and testing + ## Highlights - Graphical user interface toolkit - Single header library diff --git a/webver/Readme.md b/webver/Readme.md new file mode 100644 index 000000000..24f41826d --- /dev/null +++ b/webver/Readme.md @@ -0,0 +1,22 @@ +Webversion notes +=== + +## Terminology + +**Webversion** (or **webver** for short) is a demonstration of Nuklear being run in the browser via Emscripten. +Currently it supports only the SDL3 backend, but long-term, additional backends may be added. + +We use the consistent term **webversion** because it is already referenced across other files and may appear in user-created issues and pull requests. + +## Folder Structure + +We use the `site` subfolder to store all public webversion files. +Current folder contains **internal** files for webversion support that do not need to be published. + +## Update Policy + +The webversion is auto-updated through CI/CD workflow scripts. Any push triggers an automated build and deployment process, so no manual steps are required. + +## About Logo + +The Nuklear logo was suggested by RafaƂ Jopek and published in [issue #401](https://github.com/Immediate-Mode-UI/Nuklear/issues/401#issuecomment-2066737874) diff --git a/webver/site/emscripten_logo.png b/webver/site/emscripten_logo.png new file mode 100644 index 000000000..8bb832f34 Binary files /dev/null and b/webver/site/emscripten_logo.png differ diff --git a/webver/site/favicon.ico b/webver/site/favicon.ico new file mode 100644 index 000000000..1263aeb15 Binary files /dev/null and b/webver/site/favicon.ico differ diff --git a/webver/site/index.html b/webver/site/index.html new file mode 100644 index 000000000..9de4c3404 --- /dev/null +++ b/webver/site/index.html @@ -0,0 +1,295 @@ + + + + + + Nuklear Emscripten Demo + + + + + + + + + + + +
+ +
+
+ +
+
+ +
+ + + diff --git a/webver/site/minshell.html b/webver/site/minshell.html new file mode 100644 index 000000000..ead8a0724 --- /dev/null +++ b/webver/site/minshell.html @@ -0,0 +1,67 @@ + + + + + + Nuklear Emscripten Demo with minimal shell + + + + + + + + + +
+ +
+ + diff --git a/webver/site/nuklear_logo.png b/webver/site/nuklear_logo.png new file mode 100644 index 000000000..ceaa00977 Binary files /dev/null and b/webver/site/nuklear_logo.png differ