Add runtime resource loading and fix Docker incremental builds
- Build images.tar.gz bitmap archive for KiCad icons - Fetch resources at runtime via HTTP instead of bundling in WASM - Write to Emscripten virtual FS at compile-time KICAD_DATA path - Fix rsync timestamp handling for correct make change detection - Update kicad submodule with WASM settings manager fix 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
c72ca06132
commit
b5d379fe70
7 changed files with 64 additions and 7 deletions
|
|
@ -105,9 +105,43 @@
|
|||
document.getElementById('status').style.display = 'none';
|
||||
};
|
||||
|
||||
// Pre-fetched resource data (fetched before pcbnew.js loads)
|
||||
var resourceData = null;
|
||||
|
||||
// Start fetching images.tar.gz immediately (runs in parallel with WASM loading)
|
||||
fetch('images.tar.gz')
|
||||
.then(function(response) {
|
||||
if (!response.ok) throw new Error('HTTP ' + response.status);
|
||||
return response.arrayBuffer();
|
||||
})
|
||||
.then(function(buffer) {
|
||||
resourceData = new Uint8Array(buffer);
|
||||
console.log('[KICAD] Prefetched images.tar.gz (' + resourceData.length + ' bytes)');
|
||||
})
|
||||
.catch(function(err) {
|
||||
console.warn('[KICAD] Could not prefetch images.tar.gz:', err.message);
|
||||
});
|
||||
|
||||
// Write pre-fetched resources to FS (called in preRun after FS is available)
|
||||
var writeResources = function() {
|
||||
// Create directory structure matching KiCad's compiled-in KICAD_DATA path
|
||||
// This path is baked in during CMake configuration
|
||||
var resourcePath = '/workspace/build-wasm/sysroot/share/kicad/resources';
|
||||
FS.mkdirTree(resourcePath);
|
||||
|
||||
// Write pre-fetched data if available
|
||||
if (resourceData) {
|
||||
FS.writeFile(resourcePath + '/images.tar.gz', resourceData);
|
||||
console.log('[KICAD] Wrote images.tar.gz to ' + resourcePath);
|
||||
} else {
|
||||
console.warn('[KICAD] images.tar.gz not ready yet (WASM loaded faster than fetch)');
|
||||
}
|
||||
};
|
||||
|
||||
var Module = {
|
||||
thisProgram: '/usr/bin/pcbnew', // Fake absolute path for argv[0] (KiCad DEBUG check)
|
||||
preRun: [createCanvas],
|
||||
|
||||
preRun: [createCanvas, writeResources],
|
||||
postRun: [],
|
||||
|
||||
print: function(text) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue