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
|
|
|
/*
|
|
|
|
|
* WASM implementation of kiplatform/io.h
|
|
|
|
|
* Provides file I/O functions for WASM virtual filesystem
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <kiplatform/io.h>
|
|
|
|
|
#include <wx/string.h>
|
|
|
|
|
#include <wx/filename.h>
|
2026-06-23 21:23:20 +02:00
|
|
|
#include <wx/dir.h>
|
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
|
|
|
#include <stdio.h>
|
2026-06-23 21:23:20 +02:00
|
|
|
#include <sys/stat.h>
|
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
|
|
|
|
|
|
|
|
namespace KIPLATFORM
|
|
|
|
|
{
|
|
|
|
|
namespace IO
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
FILE* SeqFOpen( const wxString& aPath, const wxString& mode )
|
|
|
|
|
{
|
|
|
|
|
// WASM doesn't have special sequential read hints
|
|
|
|
|
// Just use standard fopen
|
|
|
|
|
return fopen( aPath.utf8_str(), mode.utf8_str() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool DuplicatePermissions( const wxString& aSrc, const wxString& aDest )
|
|
|
|
|
{
|
|
|
|
|
// WASM virtual filesystem doesn't have detailed permissions
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool MakeWriteable( const wxString& aFilePath )
|
|
|
|
|
{
|
|
|
|
|
// All files in WASM virtual filesystem are writeable
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool IsFileHidden( const wxString& aFileName )
|
|
|
|
|
{
|
|
|
|
|
// Check for Unix-style hidden files (starting with .)
|
|
|
|
|
wxFileName fn( aFileName );
|
|
|
|
|
wxString name = fn.GetFullName();
|
|
|
|
|
return !name.IsEmpty() && name[0] == '.';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LongPathAdjustment( wxFileName& aFilename )
|
|
|
|
|
{
|
|
|
|
|
// No-op on non-Windows platforms
|
|
|
|
|
}
|
|
|
|
|
|
2026-06-23 21:23:20 +02:00
|
|
|
long long TimestampDir( const wxString& aDirPath, const wxString& aFilespec )
|
|
|
|
|
{
|
|
|
|
|
// Mirror the native implementations: accumulate (mtime, size) over files
|
|
|
|
|
// matching the spec so callers can detect library-directory changes. The
|
|
|
|
|
// Emscripten virtual filesystem supports stat(), so this works for MEMFS-
|
|
|
|
|
// backed local libraries (git/network libraries are handled JS-side).
|
|
|
|
|
long long timestamp = 0;
|
|
|
|
|
|
|
|
|
|
wxDir dir( aDirPath );
|
|
|
|
|
|
|
|
|
|
if( !dir.IsOpened() )
|
|
|
|
|
return timestamp;
|
|
|
|
|
|
|
|
|
|
wxString filename;
|
|
|
|
|
bool cont = dir.GetFirst( &filename, aFilespec, wxDIR_FILES );
|
|
|
|
|
|
|
|
|
|
while( cont )
|
|
|
|
|
{
|
|
|
|
|
wxString fullPath = aDirPath + wxFILE_SEP_PATH + filename;
|
|
|
|
|
struct stat entryStat;
|
|
|
|
|
|
|
|
|
|
if( stat( fullPath.fn_str(), &entryStat ) == 0 )
|
|
|
|
|
{
|
|
|
|
|
timestamp += static_cast<long long>( entryStat.st_mtime ) * 1000;
|
|
|
|
|
timestamp += entryStat.st_size;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cont = dir.GetNext( &filename );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return timestamp;
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
} // namespace IO
|
|
|
|
|
} // namespace KIPLATFORM
|