ladybug-tools / bsdf-viewer

🎇 A web-based viewer for BSDF files
https://www.ladybug.tools/bsdf-viewer/
GNU General Public License v3.0
3 stars 3 forks source link

Compile Radiance C code to WebAssembly #8

Open mostaphaRoudsari opened 5 years ago

mostaphaRoudsari commented 5 years ago

Documentation: https://developer.mozilla.org/en-US/docs/WebAssembly/C_to_wasm

From Greg's email to @andyrew:

Hi Andy,

Your required header file list should just be the first 9 you listed:

hilbert.h fvect.h ccolor.h bsdf_t.h bsdf_m.h bsdf.h platform.h rtio.h ezxml.h

Plus additional ones needed by the routines added below:

copyright.h random.h

The rest should have older access dates than your compile. And yes, you do need to include all the bsdf*.c files, along with a few other support routines. Here's the list of required C modules:

bsdf.c bsdf_m.c bsdf_t.c ccolor.c disk2square.c ezxml.c fvect.c hilbert.c words.c

I hope I'm not forgetting anything. I know it's a lot, but still much less than the entire Radiance common library. A good test that you got everything is to compile these modules together to create testBSDF:

cc -o testBSDF testBSDF.c bsdf*.c fvect.c ccolor.c ezxml.c hilbert.c disk2square.c words.c -lm

Seems to work when I run it, and then "ls -ltu *.h" gives a complete list.