Add standalone core library with kimath and sexpr (Phase 2 Step 1)

Create standalone build system for KiCad's core computation libraries
that compiles without wxWidgets, targeting both native and WebAssembly.

Key additions:
- wx_shim.h: ~250 lines replacing wx utilities with standard C++
  - wxString class with Format() method
  - wxFFile for file I/O
  - wxASSERT, wxCHECK, wxFAIL_MSG macros
  - wxLog stubs
- Stub headers: wx/debug.h, wx/log.h, wx/string.h, wx/file.h, etc.
- config.h, advanced_config.h: Platform and triangulation config
- CMakeLists.txt: Builds kimath, sexpr, clipper2, rtree

Build results:
- Native: libkimath.a (1.4MB), libsexpr.a, test passes
- WASM: test_kimath.wasm (867KB), runs in Node.js

Test verifies:
- VECTOR2I, SEG, SHAPE_POLY_SET geometry operations
- S-expression parsing of .kicad_pcb format

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Viktor Vaczi 2025-11-26 17:39:53 +01:00
commit 92faf7c082
17 changed files with 1068 additions and 0 deletions

View file

@ -0,0 +1,19 @@
/*
* string_utils.h - Minimal stub for kicad-core
*
* The sexpr library only uses From_UTF8() which is defined in wx_shim.h
*/
#ifndef KICAD_CORE_STRING_UTILS_H
#define KICAD_CORE_STRING_UTILS_H
#include "wx_shim.h"
// From_UTF8 is already defined in wx_shim.h
// Additional string utilities that might be needed
inline std::string To_UTF8(const wxString& str) {
return str;
}
#endif // KICAD_CORE_STRING_UTILS_H