Skip to content

Commit 8b9a130

Browse files
authored
docs: Update Windows build instructions to rely on deps auto-build (#4769)
The INSTALL.md Windows building instructions were out of date in two important ways: (1) they neglected to mention OpenColorIO as a (newly) required dependency nor give instructions for how to build it; (2) it doesn't mention the new BUILD_MISSING_DEPS capabilities. So basically, this PR modifies our Windows build guidance to set OpenImageIO_BUILD_MISSING_DEPS=all and rely on that without needing to document any additional steps for dependencies. --------- Signed-off-by: Larry Gritz <[email protected]>
1 parent caa665d commit 8b9a130

File tree

1 file changed

+61
-54
lines changed

1 file changed

+61
-54
lines changed

INSTALL.md

Lines changed: 61 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ NEW or CHANGED MINIMUM dependencies since the last major release are **bold**.
1717
* C++17 or higher (also builds with C++20)
1818
* The default build mode is C++17. This can be controlled by via the
1919
CMake configuration flag: `-DCMAKE_CXX_STANDARD=20`, etc.
20-
* Compilers: gcc 9.3 - 14.2, clang 5 - 19, MSVS 2017 - 2019 (v19.14
20+
* Compilers: gcc 9.3 - 14.2, clang 5 - 19, MSVS 2017 - 2022 (v19.14
2121
and up), Intel icc 19+, Intel OneAPI C++ compiler 2022+.
2222
* CMake >= 3.18.2 (tested through 4.0)
2323
* Imath >= 3.1 (tested through 3.1.x and main)
@@ -280,64 +280,71 @@ Building on Windows
280280

281281
You will need to have Git, CMake and Visual Studio installed.
282282

283-
The minimal set of dependencies for OIIO is: zlib, libTIFF, Imath, OpenEXR, and libjpeg or libjpeg-turbo. If you have them built somewhere then you skip
284-
the section below, and will only have to point OIIO build process so their locations.
285-
286-
* zlib: this will build it, and then delete the non-static library, so they don't get picked up:
287-
```
288-
cd {ZLIB_ROOT}
289-
git clone https://github.com/madler/zlib .
290-
cmake -S . -B build -DCMAKE_INSTALL_PREFIX=.
291-
cmake --build build --config Release --target install
292-
del build\Release\zlib.lib
293-
```
294-
* libTIFF:
295-
```
296-
cd {TIFF_ROOT}
297-
git clone https://gitlab.com/libtiff/libtiff.git .
298-
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=.
299-
cmake --build build --config Release --target install
300-
```
301-
* libjpeg-turbo:
302-
```
303-
cd {JPEG_ROOT}
304-
git clone https://github.com/libjpeg-turbo/libjpeg-turbo .
305-
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DENABLE_SHARED=OFF -DCMAKE_INSTALL_PREFIX=.
306-
cmake --build build --config Release --target install
307-
```
308-
* OpenEXR: you'll have to point it to your `{ZLIB_ROOT}` location from the above. If copy-pasting the multi-line command (with lines ending in `^`) into
309-
cmd.exe prompt, make sure to copy all the lines at once.
310-
```
311-
cd {EXR_ROOT}
312-
git clone https://github.com/AcademySoftwareFoundation/openexr .
313-
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=dist ^
314-
-DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=OFF -DOPENEXR_BUILD_TOOLS=OFF ^
315-
-DOPENEXR_INSTALL_TOOLS=OFF -DOPENEXR_INSTALL_EXAMPLES=OFF ^
316-
-DZLIB_ROOT={ZLIB_ROOT}\build
317-
cmake --build build --target install --config Release
318-
```
319-
320-
Now get the OIIO source and do one-time CMake configuration step. Replace `{*_ROOT}` below with folders where you have put the 3rd party
321-
dependencies.
322-
323-
Note: For the `Imath_LIBRARY`, you might need to correct the `Imath-*.lib` file name that was built on your machine.
283+
The minimal set of dependencies for OIIO is: zlib, libTIFF, Imath, OpenEXR,
284+
OpenColorIO, and libjpeg or libjpeg-turbo. If you have them built somewhere
285+
then if you set the environment variable `CMAKE_PREFIX_PATH` to include those
286+
areas so CMake will find them, the OpenImageIO build will find those pre-built
287+
packages and use them. If you don't have them build, or are unsure, the
288+
`OpenImageIO_BUILD_MISSING_DEPS=all` CMake option will cause the build process
289+
to download the sources of those dependencies, build them, and use them.
290+
291+
To build OpenImageIO, you first need to clone the OIIO repository
292+
and check out the desired branch or tag:
293+
324294
```
325295
cd {OIIO_ROOT}
326296
git clone https://github.com/AcademySoftwareFoundation/OpenImageIO .
327-
cmake -S . -B build -DVERBOSE=ON -DCMAKE_BUILD_TYPE=Release ^
328-
-DZLIB_ROOT={ZLIB_ROOT}\build ^
329-
-DTIFF_ROOT={TIFF_ROOT} ^
330-
-DOpenEXR_ROOT={EXR_ROOT}\dist ^
331-
-DImath_DIR={EXR_ROOT}\dist\lib\cmake\Imath ^
332-
-DImath_INCLUDE_DIR={EXR_ROOT}\dist\include\Imath ^
333-
-DImath_LIBRARY={EXR_ROOT}\dist\lib\Imath-3_2.lib ^
334-
-DJPEG_ROOT={JPEG_ROOT} ^
335-
-Dlibjpeg-turbo_ROOT={JPEG_ROOT} ^
336-
-DUSE_PYTHON=0 -DUSE_QT=0 -DBUILD_SHARED_LIBS=0 -DLINKSTATIC=1
297+
git checkout release
298+
```
299+
300+
OIIO_ROOT is the directory where you want to place the OIIO source code.
301+
302+
Note the `git checkout release` line. There are a few choices here:
303+
- `release` - always will be the latest stable supported release, which is the
304+
recommended choice for most users.
305+
- `v3.0.3.0` - a specific release version, which is the recommended choice for
306+
most users who want to use a specific version of OIIO. Note that this is
307+
just an example, and by the time you are reading these instructions, it will
308+
likely be out of date. Adjust the version number to match the one you want.
309+
Note that `release` is a shortcut for the latest stable release, if you
310+
aren't sure which version you want.
311+
- `main` - the latest development version, which may be unstable, but is
312+
probably what you want if you are a developer and are working on new
313+
contributions to OIIO.
314+
315+
Next, you need to do the "cmake configure" step:
316+
317+
```
318+
cmake -S . -B build -DOpenImageIO_BUILD_MISSING_DEPS=all ^
319+
-DBUILD_SHARED_LIBS=0 -DLINKSTATIC=1
337320
```
338321

339-
This will produce `{OIIO_ROOT}/build/OpenImageIO.sln` that can be opened in Visual Studio IDE. Note that the solution will be
340-
only for the Intel x64 architecture only; and will only target "min-spec" (SSE2) SIMD instruction set.
322+
If that command succeeds, you can either do the full build and install
323+
from the command line, or open the generated Visual Studio solution.
324+
325+
Note that you can speed up the build by disabling certain components if you
326+
know you won't need them: Adding `-DUSE_PYTHON=0` to the command above will
327+
skip building the Python bindings, `-DUSE_QT=0` will disable looking for and
328+
using Qt (needed only for the `iv` viewer), and `-DOIIO_BUILD_TESTS=0` will
329+
skip building certain unit tests (which you only need if you want to OIIO's
330+
tests).
331+
332+
If you just want a one-step build/install from the command line, you can run:
333+
334+
```
335+
cmake --build build --target install --config Release
336+
```
337+
338+
and that will build the package and install it into the `{OIIO_ROOT/dist`
339+
area. (If you instead wanted the install to end up elsewhere, the easiest way
340+
is on the earlier config step, to add the option
341+
`-DCMAKE_INSTALL_PREFIX=somewhere_else`.)
342+
343+
On the other hand, if you would prefer to open the generated Visual Studio
344+
solution, the "cmake configure" will have produced
345+
`{OIIO_ROOT}/build/OpenImageIO.sln` that can be opened in Visual Studio IDE.
346+
Note that the solution will be only for the Intel x64 architecture only; and
347+
will only target "min-spec" (SSE2) SIMD instruction set.
341348

342349
Optional packages that OIIO can use (e.g. libpng, Qt) can be build and pointed to OIIO build process in a similar way.
343350

0 commit comments

Comments
 (0)