This wrapper is intended to be used via emscripten to interface with OpenEXR from JavaScript. It has the following dependencies:
- emscripten: To compile the dependencies and the wrapper itself. Tested version is emscripten-1.38.12.
- OpenEXR: The main library. Tested version is 2.2.1. Both the openexr and the ilmbase libraries are required.
- zlib: Dependency for OpenEXR. Tested version is 1.2.11.
In general, compiling with emscripten is quite annoying. The emconfigure and emmake
tools can help building the dependencies. To run the compiled javascript applications,
node, which is also part of emscripten, can be used. The result of the build process is a
pair of files, exr-wrap.js and exr-wrap.wasm. LTO and other options can be set for
more optimization, but their use is somewhat questionable.
- Prepare
0.
mkdir install0.export WRAPPER_INSTALL=$(pwd)/install - Building zlib
0.
cd $zlibdiremconfigure ./configure --prefix $WRAPPER_INSTALL- Edit the Makefile:
AR=emar,ARFLAGS=r,CFLAGS+=-O3 - Optionally add
--llvm-lto 1to CFLAGS emmake make -j12 && make install
- Building ilmbase
0.
cd $ilmbasedir && mkdir build && cd buildemconfigure cmake .. -DCMAKE_INSTALL_PREFIX=$WRAPPER_INSTALL -DCMAKE_BUILD_TYPE=Release- Possibly remove incorrect quotes around the node path in CMakeLists.txt
- Edit
config/IlmBaseConfig.h, settingHAVE_PTHREAD 0. - Optionally add
--llvm-lto 1to compiler and linker flags and set-O3. emmake make -j12 && make install
- Building openexr
0. cd openexr && mkdir build && cd build
emconfigure cmake .. -DCMAKE_INSTALL_PREFIX=$WRAPPER_INSTALL -DCMAKE_BUILD_TYPE=Release -DILMBASE_PACKAGE_PREFIX=$WRAPPER_INSTALL- Possibly set
ZLIB_LIBRARYandZLIB_INCLUDE_DIR - Optionally add
--llvm-lto 1to compiler and linker flags and set-O3. emmake make -j12 && make install- Building the
dwaLookups.handb44ExpLogTable.hheaders requires using node to run the javascript programs built for this purpose. Building withmake VERBOSE=1can help figuring out the exact parameters. Use node to run the created .js programs. Alternatively, copy the two headers from a native build.
- Building the wrapper
0.
cd wrappmake