- Create print_test standalone app testing wxPrintout, wxPrintPreview, wxPrinter, and browser print via window.print() - Add 8 E2E tests for printing functionality (all pass) - Update WHATWORKS.md: printing now works, 127 total tests, 14 standalone apps - Remove wxRichTextCtrl from untested (disabled, KiCad doesn't use it) Key findings: - Printing infrastructure works out of the box in WASM - wxPrintout callbacks fire correctly (OnBeginPrinting, OnPrintPage, etc.) - wxPrintPreview renders preview frame - Browser Print triggers native print dialog via window.print() 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
211 lines
7.1 KiB
Text
211 lines
7.1 KiB
Text
# Makefile for wxWidgets WASM test apps
|
|
# Uses the local wxWidgets build
|
|
#
|
|
# Usage:
|
|
# make -f Makefile.wasm # Optimized release build
|
|
# make -f Makefile.wasm DEBUG=1 # Debug build with DWARF symbols and source maps
|
|
|
|
WXCONFIG = ../../build-wasm/wxwidgets-universal/wx-config
|
|
TOOLS_ROOT = ../../wxwidgets/build/wasm
|
|
|
|
CXX = em++
|
|
WX_CXXFLAGS := $(shell $(WXCONFIG) --cxxflags)
|
|
|
|
# Libraries for GL apps (minimal_test uses OpenGL)
|
|
WX_LDFLAGS_GL := $(shell $(WXCONFIG) --libs base,core,gl,aui)
|
|
|
|
# Libraries for non-GL apps (standalone tests don't need GL)
|
|
WX_LDFLAGS_NOGL := $(shell $(WXCONFIG) --libs base,core,aui)
|
|
|
|
# Libraries for HTML apps (htmlwin_test needs html)
|
|
WX_LDFLAGS_HTML := $(shell $(WXCONFIG) --libs base,core,html)
|
|
|
|
# Libraries for STC apps (stc_test needs stc)
|
|
WX_LDFLAGS_STC := $(shell $(WXCONFIG) --libs base,core,stc)
|
|
|
|
# Debug or Release build
|
|
ifdef DEBUG
|
|
# Debug: DWARF info, source maps, minimal optimization
|
|
CXXFLAGS = -g -O0 $(WX_CXXFLAGS)
|
|
DEBUG_LDFLAGS = -g -gsource-map
|
|
else
|
|
# Release: optimized
|
|
CXXFLAGS = -O2 $(WX_CXXFLAGS)
|
|
DEBUG_LDFLAGS =
|
|
endif
|
|
|
|
# Base Emscripten flags (for all apps)
|
|
# ASYNCIFY enables blocking modal dialogs (ShowModal waits for user)
|
|
# ASYNCIFY_IMPORTS tells Emscripten which imported JS functions can unwind the stack
|
|
# - startModal: for modal dialogs
|
|
# - js_writeTextToClipboard, js_readTextFromClipboard, js_clipboardHasText, js_clearClipboard: for clipboard
|
|
BASE_LDFLAGS = -sALLOW_MEMORY_GROWTH -sERROR_ON_UNDEFINED_SYMBOLS=0 \
|
|
-s "EXPORTED_RUNTIME_METHODS=['HEAPU8','HEAP8','HEAP32','ccall']" \
|
|
-sASYNCIFY=1 \
|
|
-sASYNCIFY_STACK_SIZE=8192 \
|
|
-sASYNCIFY_IMPORTS=['startModal','js_writeTextToClipboard','js_readTextFromClipboard','js_clipboardHasText','js_clearClipboard']
|
|
|
|
# GL-specific flags
|
|
EM_GL_FLAGS = -sLEGACY_GL_EMULATION -sMAX_WEBGL_VERSION=2
|
|
GL_SHIM = ../../lib/gl_immediate_shim.js
|
|
|
|
# LDFLAGS for GL apps (minimal_test)
|
|
LDFLAGS_GL = $(DEBUG_LDFLAGS) $(BASE_LDFLAGS) $(EM_GL_FLAGS) --js-library=$(GL_SHIM) $(WX_LDFLAGS_GL)
|
|
|
|
# LDFLAGS for non-GL apps (standalone tests)
|
|
LDFLAGS_NOGL = $(DEBUG_LDFLAGS) $(BASE_LDFLAGS) $(WX_LDFLAGS_NOGL)
|
|
|
|
# LDFLAGS for HTML apps (htmlwin_test)
|
|
LDFLAGS_HTML = $(DEBUG_LDFLAGS) $(BASE_LDFLAGS) $(WX_LDFLAGS_HTML)
|
|
|
|
# LDFLAGS for STC apps (stc_test)
|
|
LDFLAGS_STC = $(DEBUG_LDFLAGS) $(BASE_LDFLAGS) $(WX_LDFLAGS_STC)
|
|
|
|
JS = $(TOOLS_ROOT)/wx.js
|
|
HTML = $(TOOLS_ROOT)/template.html
|
|
|
|
# Standalone directories
|
|
S = standalone
|
|
|
|
all: minimal_test.html \
|
|
$(S)/menu/menu_test.html \
|
|
$(S)/clipboard/clipboard_test.html \
|
|
$(S)/filedialog/filedialog_test.html \
|
|
$(S)/layout/layout_test.html \
|
|
$(S)/aui/aui_test.html \
|
|
$(S)/toolbar/toolbar_test.html \
|
|
$(S)/grid/grid_test.html \
|
|
$(S)/dialog/dialog_test.html \
|
|
$(S)/timer/timer_test.html \
|
|
$(S)/tree/tree_test.html \
|
|
$(S)/dataview/dataview_test.html \
|
|
$(S)/htmlwin/htmlwin_test.html \
|
|
$(S)/stc/stc_test.html \
|
|
$(S)/print/print_test.html
|
|
|
|
# Main test app (uses GL)
|
|
minimal_test.o: minimal_test.cpp
|
|
$(CXX) -c $(CXXFLAGS) $< -o $@
|
|
|
|
minimal_test.html: minimal_test.o
|
|
$(CXX) $< $(LDFLAGS_GL) --pre-js $(JS) --shell-file $(HTML) -o $@
|
|
|
|
# Menu test (no GL)
|
|
$(S)/menu/menu_test.o: $(S)/menu/menu_test.cpp
|
|
$(CXX) -c $(CXXFLAGS) $< -o $@
|
|
|
|
$(S)/menu/menu_test.html: $(S)/menu/menu_test.o
|
|
$(CXX) $< $(LDFLAGS_NOGL) --pre-js $(JS) --shell-file $(HTML) -o $@
|
|
|
|
# Clipboard test (no GL)
|
|
$(S)/clipboard/clipboard_test.o: $(S)/clipboard/clipboard_test.cpp
|
|
$(CXX) -c $(CXXFLAGS) $< -o $@
|
|
|
|
$(S)/clipboard/clipboard_test.html: $(S)/clipboard/clipboard_test.o
|
|
$(CXX) $< $(LDFLAGS_NOGL) --pre-js $(JS) --shell-file $(HTML) -o $@
|
|
|
|
# FileDialog test (no GL)
|
|
$(S)/filedialog/filedialog_test.o: $(S)/filedialog/filedialog_test.cpp
|
|
$(CXX) -c $(CXXFLAGS) $< -o $@
|
|
|
|
$(S)/filedialog/filedialog_test.html: $(S)/filedialog/filedialog_test.o
|
|
$(CXX) $< $(LDFLAGS_NOGL) --pre-js $(JS) --shell-file $(HTML) -o $@
|
|
|
|
# Layout test (no GL)
|
|
$(S)/layout/layout_test.o: $(S)/layout/layout_test.cpp
|
|
$(CXX) -c $(CXXFLAGS) $< -o $@
|
|
|
|
$(S)/layout/layout_test.html: $(S)/layout/layout_test.o
|
|
$(CXX) $< $(LDFLAGS_NOGL) --pre-js $(JS) --shell-file $(HTML) -o $@
|
|
|
|
# AUI test (no GL)
|
|
$(S)/aui/aui_test.o: $(S)/aui/aui_test.cpp
|
|
$(CXX) -c $(CXXFLAGS) $< -o $@
|
|
|
|
$(S)/aui/aui_test.html: $(S)/aui/aui_test.o
|
|
$(CXX) $< $(LDFLAGS_NOGL) --pre-js $(JS) --shell-file $(HTML) -o $@
|
|
|
|
# Toolbar test (no GL)
|
|
$(S)/toolbar/toolbar_test.o: $(S)/toolbar/toolbar_test.cpp
|
|
$(CXX) -c $(CXXFLAGS) $< -o $@
|
|
|
|
$(S)/toolbar/toolbar_test.html: $(S)/toolbar/toolbar_test.o
|
|
$(CXX) $< $(LDFLAGS_NOGL) --pre-js $(JS) --shell-file $(HTML) -o $@
|
|
|
|
# Grid test (no GL)
|
|
$(S)/grid/grid_test.o: $(S)/grid/grid_test.cpp
|
|
$(CXX) -c $(CXXFLAGS) $< -o $@
|
|
|
|
$(S)/grid/grid_test.html: $(S)/grid/grid_test.o
|
|
$(CXX) $< $(LDFLAGS_NOGL) --pre-js $(JS) --shell-file $(HTML) -o $@
|
|
|
|
# Dialog test (no GL)
|
|
$(S)/dialog/dialog_test.o: $(S)/dialog/dialog_test.cpp
|
|
$(CXX) -c $(CXXFLAGS) $< -o $@
|
|
|
|
$(S)/dialog/dialog_test.html: $(S)/dialog/dialog_test.o
|
|
$(CXX) $< $(LDFLAGS_NOGL) --pre-js $(JS) --shell-file $(HTML) -o $@
|
|
|
|
# Timer test (no GL)
|
|
$(S)/timer/timer_test.o: $(S)/timer/timer_test.cpp
|
|
$(CXX) -c $(CXXFLAGS) $< -o $@
|
|
|
|
$(S)/timer/timer_test.html: $(S)/timer/timer_test.o
|
|
$(CXX) $< $(LDFLAGS_NOGL) --pre-js $(JS) --shell-file $(HTML) -o $@
|
|
|
|
# Tree test (no GL)
|
|
$(S)/tree/tree_test.o: $(S)/tree/tree_test.cpp
|
|
$(CXX) -c $(CXXFLAGS) $< -o $@
|
|
|
|
$(S)/tree/tree_test.html: $(S)/tree/tree_test.o
|
|
$(CXX) $< $(LDFLAGS_NOGL) --pre-js $(JS) --shell-file $(HTML) -o $@
|
|
|
|
# DataView test (no GL)
|
|
$(S)/dataview/dataview_test.o: $(S)/dataview/dataview_test.cpp
|
|
$(CXX) -c $(CXXFLAGS) $< -o $@
|
|
|
|
$(S)/dataview/dataview_test.html: $(S)/dataview/dataview_test.o
|
|
$(CXX) $< $(LDFLAGS_NOGL) --pre-js $(JS) --shell-file $(HTML) -o $@
|
|
|
|
# HtmlWindow test (needs HTML library)
|
|
$(S)/htmlwin/htmlwin_test.o: $(S)/htmlwin/htmlwin_test.cpp
|
|
$(CXX) -c $(CXXFLAGS) $< -o $@
|
|
|
|
$(S)/htmlwin/htmlwin_test.html: $(S)/htmlwin/htmlwin_test.o
|
|
$(CXX) $< $(LDFLAGS_HTML) --pre-js $(JS) --shell-file $(HTML) -o $@
|
|
|
|
# StyledTextCtrl test (needs STC library)
|
|
$(S)/stc/stc_test.o: $(S)/stc/stc_test.cpp
|
|
$(CXX) -c $(CXXFLAGS) $< -o $@
|
|
|
|
$(S)/stc/stc_test.html: $(S)/stc/stc_test.o
|
|
$(CXX) $< $(LDFLAGS_STC) --pre-js $(JS) --shell-file $(HTML) -o $@
|
|
|
|
# Print test (no GL)
|
|
$(S)/print/print_test.o: $(S)/print/print_test.cpp
|
|
$(CXX) -c $(CXXFLAGS) $< -o $@
|
|
|
|
$(S)/print/print_test.html: $(S)/print/print_test.o
|
|
$(CXX) $< $(LDFLAGS_NOGL) --pre-js $(JS) --shell-file $(HTML) -o $@
|
|
|
|
# Convenience targets
|
|
menu: $(S)/menu/menu_test.html
|
|
clipboard: $(S)/clipboard/clipboard_test.html
|
|
filedialog: $(S)/filedialog/filedialog_test.html
|
|
layout: $(S)/layout/layout_test.html
|
|
aui: $(S)/aui/aui_test.html
|
|
toolbar: $(S)/toolbar/toolbar_test.html
|
|
grid: $(S)/grid/grid_test.html
|
|
dialog: $(S)/dialog/dialog_test.html
|
|
timer: $(S)/timer/timer_test.html
|
|
tree: $(S)/tree/tree_test.html
|
|
dataview: $(S)/dataview/dataview_test.html
|
|
htmlwin: $(S)/htmlwin/htmlwin_test.html
|
|
stc: $(S)/stc/stc_test.html
|
|
print: $(S)/print/print_test.html
|
|
|
|
clean:
|
|
rm -f minimal_test.o minimal_test.html minimal_test.js minimal_test.wasm
|
|
rm -f $(S)/*/*.o $(S)/*/*.html $(S)/*/*.js $(S)/*/*.wasm
|
|
|
|
.PHONY: all clean menu clipboard filedialog layout aui toolbar grid dialog timer tree dataview htmlwin stc print
|