Skip to content

Instantly share code, notes, and snippets.

Last active September 7, 2023 07:59
Show Gist options
  • Save aras-p/6497703c9b52f67761e6191343e43f7b to your computer and use it in GitHub Desktop.
Save aras-p/6497703c9b52f67761e6191343e43f7b to your computer and use it in GitHub Desktop.
Building OpenImageIO from source locally


OIIO build instructions currently just say this for Windows:

Method 1 - from source I really need someone to write correct, modern docs about how to build from source on Windows.

So I decided to figure that out.

Easiest: get Blender first :)

Get Blender codebase

OIIO needs a handful of dependencies to be available/built/installed (OpenEXR, libTIFF, zlib, ...). For me, the easiest was to get and setup Blender codebase; just the "git clone + make update" steps. That checks out a bunch of precompiled libraries that Blender needs... among which is the subset that OIIO needs as well.

If you picked {BLENDER_ROOT} as your base Blender codbase folder, then you'd end up with {BLENDER_ROOT}/blender folder where the git checkout is, and {BLENDER_ROOT}/lib/win64_vc15 with the 3rd party libraries, that is a result of make update.

Get OIIO codebase

git clone .
mkdir build

Initial CMake step to generate Visual Studio project

Replace {BLENDER_ROOT} below with your actual Blender root folder. Then also copy Blender's zlib static library into a name that OIIO build scripts expect, otherwise they won't find it.

cd OIIO_ROOT\build
set BLENDER={BLENDER_ROOT}\lib\win64_vc15
copy %BLENDER%\zlib\lib\libz_st.lib %BLENDER%\zlib\lib\zlibstatic.lib
  -DOpenEXR_ROOT=%BLENDER%\openexr ^
  -DImath_DIR=%BLENDER%\imath\lib\cmake\Imath ^

This will produce {OIIO_ROOT}/build/OpenImageIO.sln that can be opened in Visual Studio. Note that the solution will be only for the Intel x64 architecture only; and will only target "min-spec" (SSE2) SIMD instruction set.

The above command line also includes PNG support; this is not strictly necessary for OIIO but since Blender libraries already have it, then why not.

Working within Visual Studio

Open {OIIO_ROOT}/build/OpenImageIO.sln and pick Release build configuration. If you pick Debug, you might need to re-run the CMake command above with -DCMAKE_BUILD_TYPE=Debug, I'm not totally sure.

The main project that builds the library is OpenImageIO. The library is built into {OIIO_ROOT}/build/lib/{CONFIG} folder.

The various OIIO command line tools (oiiotool, iconvert, iinfo etc.) are projects under Tools subfolder in VS IDE solution explorer. They all build into {OIIO_ROOT}/build/bin/{CONFIG} folder.

There's a CMakePredefinedTargets/INSTALL project that you can build to produce a {OIIO_ROOT}/dist folder with bin, include, lib, share folders as a sort of "OIIO build ready for consumption from elsewhere" distribution.

Note: building INSTALL target will also build the test executables, and in Release config building simd_test takes forever.

Harder: Build Dependencies Yourself

The minimal set of dependencies for OIIO is: Boost, zlib, libTIFF, OpenEXR, and either libjpeg or libjpeg-turbo.


Get the boost source archive, extract into {BOOST_ROOT}



This will build it, and then delete the non-static libraries, so they don't get picked up.

git clone .
mkdir build
cd build
cmake --build . --config Release --target install
del lib\zlib.lib


git clone .
cd build
cmake --build . --target install


git clone .
mkdir build
cd build
cmake --build . --config Release --target install


You'll have to point it to your {ZLIB_ROOT} location from the above.

git clone .
  -DZLIB_ROOT={ZLIB_ROOT}\build ..
cmake --build . --target install --config Release

One-time OIIO CMake configuration

This is similar to the "use libraries from Blender" case above, instead it will point to individual locations where you have built the dependencies yourself.

cd {OIIO_ROOT}\build
  -DOpenEXR_ROOT={EXR_ROOT}\build\dist ^
  -DImath_DIR={EXR_ROOT}\build\dist\lib\cmake\Imath ^

And the rest is then the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment