pcbjam/wasm/stubs/nng/nng.h
Viktor Vaczi 898e079ef2 Enable 3D viewer in KiCad WASM build
Build the 3D viewer code for WASM instead of stubbing it out.
This is simpler to maintain than complex header stubs.

Changes:
- Enable KICAD_BUILD_3D_VIEWER_WASM=ON in build script
- Remove -gsource-map to avoid OOM in wasm-emscripten-finalize
- Add OpenGL stubs for fixed-function pipeline (WebGL ES 2.0 only)
- Add GLU stub for gluErrorString
- Add NNG stub for IPC API (sockets don't work in WASM)
- Add PCBnew scripting stub
- Expand curl and libgit2 stubs

The 3D viewer code compiles but won't render at runtime since
OpenGL GAL is disabled and Cairo GAL is used instead.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 14:21:29 +01:00

47 lines
1.1 KiB
C

/*
* NNG stub header for KiCad WASM build
* Socket-based IPC is not supported in browsers, so we provide stub implementations
* that compile but don't do anything.
*/
#ifndef NNG_NNG_H
#define NNG_NNG_H
#include <stddef.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
// Error codes
#define NNG_ETIMEDOUT 5
#define NNG_ECLOSED 6
#define NNG_ENOENT 7
// Options
#define NNG_OPT_RECVTIMEO "recv-timeout"
// Flags
#define NNG_FLAG_ALLOC 1
// Opaque types
typedef struct nng_socket_s { int id; } nng_socket;
typedef struct nng_listener_s { int id; } nng_listener;
typedef int nng_duration;
// NNG function stubs - all return error codes indicating "not supported"
int nng_rep0_open(nng_socket *s);
int nng_listener_create(nng_listener *l, nng_socket s, const char *url);
int nng_socket_set_ms(nng_socket s, const char *opt, nng_duration dur);
int nng_listener_start(nng_listener l, int flags);
int nng_recv(nng_socket s, void *data, size_t *sizep, int flags);
int nng_send(nng_socket s, void *data, size_t size, int flags);
int nng_close(nng_socket s);
void nng_free(void *ptr, size_t size);
#ifdef __cplusplus
}
#endif
#endif // NNG_NNG_H