pcbjam/wasm/kiplatform/app.cpp
Viktor Vaczi 3034d9d76f Add KiCad WASM build infrastructure and dependency scripts
- Add build environment setup (scripts/common/env.sh, versions.sh, functions.sh)
- Add dependency build scripts for Zstd, GLM, FreeType, HarfBuzz, Pixman, Cairo
- Add placeholder scripts for OpenCASCADE, ngspice, protobuf
- Add WASM compatibility layer (wasm/kiplatform/, wasm/libcontext/)
- Add CMake modules for KiCad WASM cross-compilation
- Add PCBnew test infrastructure (tests/kicad/)
- Add build plan documentation

Successfully tested builds: Zstd 1.5.5, GLM 0.9.9.8, FreeType 2.13.2,
HarfBuzz 8.3.0, Pixman 0.42.2, Cairo 1.18.0

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 13:15:04 +01:00

87 lines
1.6 KiB
C++

/*
* WASM implementation of kiplatform/app.h
* Provides application lifecycle functions for browser environment
*/
#include <kiplatform/app.h>
#include <wx/string.h>
#include <wx/window.h>
#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#endif
namespace KIPLATFORM
{
namespace APP
{
bool Init()
{
// WASM initialization - nothing special needed
return true;
}
bool AttachConsole( bool aTryAlloc )
{
// Console is always available via browser dev tools
return true;
}
bool IsOperatingSystemUnsupported()
{
// WASM/browser is supported
return false;
}
bool RegisterApplicationRestart( const wxString& aCommandLine )
{
// No restart registration in browser
return false;
}
bool UnregisterApplicationRestart()
{
// No restart registration in browser
return true;
}
bool SupportsShutdownBlockReason()
{
// Browser handles page unload via beforeunload event
return false;
}
void SetShutdownBlockReason( wxWindow* aWindow, const wxString& aReason )
{
// Could implement via beforeunload event if needed
#ifdef __EMSCRIPTEN__
EM_ASM({
window.onbeforeunload = function() {
return UTF8ToString($0);
};
}, aReason.utf8_str().data());
#endif
}
void RemoveShutdownBlockReason( wxWindow* aWindow )
{
#ifdef __EMSCRIPTEN__
EM_ASM({
window.onbeforeunload = null;
});
#endif
}
void ForceTimerMessagesToBeCreatedIfNecessary()
{
// Not needed in browser - timers work differently
}
void AddDynamicLibrarySearchPath( const wxString& aPath )
{
// No dynamic library loading in WASM
}
} // namespace APP
} // namespace KIPLATFORM