Compare commits

...
Author SHA1 Message Date
Larry Gritz 963d07d531 2.2 Beta2
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-10 22:55:55 -07:00
Larry Gritz ecbeda622f ImageCache should not close IOProxy-based files to stay in file limits (2666)
The thing about IOProxy is, once closed, it can't be reopened. So it's
important that if an IOProxy-based file is in the IC, its ImageInput
should not be reclaimed by closing it (and that might not help the
file handle count anyway, since the main use of an IOProxy under those
circumstances is probably to read an image from memory).

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-10 18:44:28 -07:00
Larry Gritz a6345e095e Fix to DPX IOProxy support (#2665)
It's important not to mess with a passed-in IOProxy* in Input::close(),
because that proxy may not still exist.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-10 18:37:32 -07:00
ra-mt 8e470c7616 Add support for reading DPX files from memory (#2659)
* Add support for reading DPX files from any IOProxy
* Replace memcpy_s function with memcpy
* Fix IOProxy bug (not just for DPX) seeking from end

Signed-off-by: ra-mt <radu.arjocu@masstech.com>
2020-08-10 18:36:37 -07:00
Larry Gritz d8810c5365 clang-format: Adjust alignment of line continuation backslashes (#2664)
I just like this better than the prior habit of putting it one PAST
the column width, which made the backslashes go in column 81, ick.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-10 17:45:54 -07:00
Larry Gritz d631f92721 bit_cast should take a reference, not a value (#2668)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-10 17:45:46 -07:00
Larry Gritz 7f71282027 SPI: Mac newer compilers
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-09 16:51:03 -07:00
Larry Gritz 4f981ba3b7 pybind11 version fix for CI
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-09 16:50:42 -07:00
Larry Gritz d0a77b9f2f Windows CI: build dependencies ourselves (#2663)
Last week, Vcpkg apparently had some flaw that recently caused it to
fail when building/installing libpng (among other things). It's been
fixed in the vcpkg main branch, but that hasn't propagated to the
vcpkg that's installed on the GitHub Actions CI runners, and that's
causing our Windows CI tests to fail.

Rather than wait out the fix, I'm just taking it into my own hands by
building all our dependencies from source on Windows. This means adding
bash scripts to download and build zlib, libpng, and libjpeg-turbo (and
maybe those will be helpful to others as well).

**Late breaking news** They beat me to it, vcpkg has been updated and
the GitHub CI Windows tests are passing again.

But I had already done this work! So I still would like to switch to
this methodology because:

* Sometimes it's faster to build ourselves rather than have vcpkg
  build, since vcpkg always builds both release and debug, but we only
  need the release builds of the dependencies.

* This makes it easier to customize the specific version of a
  dependency, or particular build options, which are hard or
  impossible to change for a vcpkg build.

* These same dependency-building scripts could be useful for people who
  are not on Windows or not interested in using vcpkg.

Also some minor changes to the build_libtiff and build_openexr scripts
to synchronize some of the idioms I use in these scripts.

Rename workflow.yml to ci.yml to adhere to convention and also make it
so we can have multiple workflows in the future.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-09 16:50:32 -07:00
ra-mt 292b6ac1c1 Fix Windows long paths when opening files (#2661)
* Disregard Windows extended-length / long path prefix ("\\?\" style) when getting the REST arguments

* Add test cases for disregarding Windows extended-length / long path prefix.
2020-08-07 17:10:48 -07:00
Brecht Van Lommel f8969b894a Fix poor performance with texture cache and HDR files (#2662)
When the texture cache reads scanlines in random order, the same pixels could
be read many times over. Now the file offset for scanlines is cached for quick
random access.
2020-08-06 15:28:21 -07:00
Biswapriyo Nath 871e88c857 Fix mingw compiler warnings (#2657)
* OpenImageIO/imagebufalgo.h: remove OIIO_API from enums
* OpenImageIO/strutil.h: remove OIIO_API from inlined lower and upper functions
* libutil/plugin.cpp: cast return value of GetProcAddress to void*
* libutil/sysutil.cpp: define _POSIX_C_SOURCE for localtime_r declaration
* libutil/thread.cpp: cast t->native_handle() to HANDLE type
* ptex.imageio/ptexinput.cpp: use perr.c_str() for %s string format
2020-08-06 09:16:09 -07:00
Larry Gritz dcf48e1f80 Minor fixes to ImageBuf error reporting (#2653)
* Fix some incorrect error calls in ImageBuf internals.
* Simplify because we know that ImageBuf::error() and warning(), with
  just one string argument, doesn't need a format command.
* Make sure that if no message bubbles up, we say "unknown error".

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-05 14:35:23 -07:00
Larry Gritz 94be07fbce Improved propagation of png write errors and fix sRGB profile check (#2655)
We weren't setting up the proper handler callbacks for libpng internal
errors to bubble up to the caller.

Tell libpng to turn off sRGB color profile check. There are many
false positives where embedded ICC profiles that don't match its
expectations (but that other people and apps consider fine) trigger
errors in libpng.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-05 13:23:51 -07:00
Larry Gritz 1d0e570a49 Fix python binding of ImageSpec.erase_attribute (#2654)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-05 10:57:58 -07:00
Larry Gritz be2c4e3198 PNG option: add "png:filter" to control PNG filter options (#2650)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-02 13:05:18 -07:00
Larry Gritz 5ba33f3886 Bump version after first beta release
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-31 14:25:23 -07:00
Larry Gritz bfa4ba5f2e Branch and beta 2.2
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-31 12:27:03 -07:00
Larry Gritz e8f1202f0f changes
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-30 18:21:21 -07:00
Larry Gritz 3082bd7f2a More gradual fmt conversion (#2649)
Another step toward switching to std::format notation.

The basic strategy is to make sure that all the classes that have
errorf (etc) methods using printf notation will also have errorfmt
(etc) methods using std::format notation. These will coexist for a
while to let people switch, before the printf ones will be marked
deprecated and then eventually removed.

In some cases where the methods aren't really part of the public
API, but only are used internally, we are already skipping to the
deprecation marking.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-30 12:47:42 -07:00
Larry Gritz 1253a034f0 Move disted but non-public headers to "detail" subdirectory (#2648)
Policy change:

There are some headers that we just have to make part of the OIIO
distribution, but they aren't officially part of the supported OIIO
public API. We are moving them into an include/OpenImageIO/detail
subdirectory.

Anything in there is, therefore, allowed to be changed arbitrarily for
any minor version numbered release, including source back-incompatible
changes that would ordinarily require a change in major release
version if they were part of the public API. They nonetheless cannot
change in patch releases in ways that would break ABI or linkage.

Initially, this includes the imported headers from fmt and pugixml,
but in possible subsequent patches, I may move other headers there, or
split some headers to have declarations be public but certain inline
implementation details split into separate files in detail.

We were also able to move SHA1.h out of the public include area and
locally into libutil, since it should only be needed by SHA1.cpp.
It was also used by imagebufalgo_compiler.cpp, but didn't need to be,
so we changed the direct use into use of the hash.h wrapper.

Also add a build_pugixml.bash to make it easier for people to install
that dependency. We will eventually migrate to a fully external
pugixml, but right now old versions of OSL depend on it being part of
OIIO. We'll change on the OIIO side after another release.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-27 20:40:25 -07:00
Larry Gritz 14ee3c30e4 Remove tinyformat (#2647)
We relied on it for years and are very thankful for its existence.

It has been optional for some time now, as we have come to use the fmt
library, which is more similar to the upcoming C++20 std::format.

Now it's time to excise tinyformat completely.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-24 17:10:59 -07:00
Larry Gritz 41fe60cf4c Eliminate some needlessly included headers to speed up build time (#2646)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-24 09:16:10 -07:00
Larry Gritz a20766cd17 Dependency testing
* Bump Linux "latest deps" to use the newly release LibRaw 0.20.
* Document that we can successfully build with CMake 3.18.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-23 15:09:01 -07:00
Larry Gritz 129728f4e8 CHANGES
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-18 15:15:32 -07:00
Larry Gritz e35dc40e7a IBA::resize: Use heap instead of stack for an allocation (#2643)
Resizing an enormous image by a large scale factor could end up having
this allocation, which is xres*ntaps*sizeof(float), end up big enough
to overflow the stack. It's only done once per thread worker, so there
is no perf penalty to making it a heap allocation just in case it's
too big.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-15 11:54:47 -07:00
Larry Gritz 3d0be6561c Typo fix -- got 'ImageBuf.writable' name wrong (#2644)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-15 11:53:59 -07:00
Larry Gritz 6f15fb343d Handy macro to construct an integer version code (#2641)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-15 09:12:43 -07:00
Larry Gritz 7eea02d2ba Python version of ImageBuf that takes an open ImageOutput (#2640)
This is the key to writing a multi-subimage file from ImageBufs.
We previously could do that from C++, but not from Python.

Add a test to testsuite/python-imagebuf. Also rearrange the python in
that test a bit to cleave off a couple pieces into separate functions.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-14 19:37:12 -07:00
Larry Gritz c47dbb566c PNG: Document the "png:compressionLevel" output hint. (#2642)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-13 21:13:08 -07:00
Larry Gritz ec1843512f Minor fix to Python binding for ParamValueList (#2638)
The `__getitem__` method taking an integer index correctly set the
return value policy so it returns in internal reference rather than
a copy, but the `__getitem__` method taking a string did not.

Also fix indentation.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-13 21:12:12 -07:00
Larry Gritz 4827c23775 Build against more recent versions of {fmt} (#2639)
fmt is supposed to (if you include fmt/ostream.h) automatically
support any user type that defines an `operator<<()`. And so it did
through version 6.1.2.

Starting with 6.2.x, the presence of `operator bool()` throws it off,
particularly for our TypeDesc, which started rendering as "true" rather
than "uint8" or whatever. It seems that the fact that it can convert
to bool takes precedence, it formats as a bool, rather than notice that
there's a stream ouput option.

In this patch, we add a custom formatter for TypeDesc, which solves
the problem for `format("{}", typedesc)`, but unfortunately not for
`sprintf("%s", typedesc)`. I've filed an issue, but in any case, the
workaround to avoid incorrect formatting when using sprintf is to be
sure to use typedesc.c_str().

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-10 16:27:16 -07:00
Larry Gritz 276ff1656f Update ref output
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-10 16:26:43 -07:00
Larry Gritz 46fdc7fc0b Update ref image for evolving libraw
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-10 10:15:45 -07:00
Larry Gritz d7427ae376 CI: Make sure all tests run for RB and master
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-10 10:15:45 -07:00
Larry Gritz eec0106ad3 CI: use python 3.8 on Mac GH CI
Trying to force 3.7 when Homebrew has moved on is swimming upstream.
VFX Platform is also talking about moving to 3.8 next year anyway.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-09 10:53:32 -07:00
Larry Gritz 73842b9968 Update ref image for debug case
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-08 23:28:52 -07:00
Larry Gritz a25c31af5b Terminal I/O of images (#2631)
This is a little kooky maybe, but it was something I was playing a couple
years ago, finally inspired by Chris to clean it up and PR it.

This patch adds a "term" format which, instead of writing files,
outputs a preview image to a true color text terminal window.

Is any of this useful? I have no idea. But it's kinda fun.

The quick demo of this is:

    oiiotool myfile.exr -o out.term

It will only do something useful if on a color terminal emulator with
24 bit color capability and Unicode. (I've tested it on the
gnome-terminal on Linux, and iTerm2 on Mac.)

The best quality results are on Mac if you are using iTerm2, it can
additionally do an actual pixel output (iTerm2 has as a nonstandard
feature the ability to send inline images to the terminal). This is
the "iterm2" method, but it's only expected to work on Mac with
iTerm2. It will automatically use this method as the default if you
are running iTerm2.

Next best is (thanks, Chris) is to display two pixels (vertically) in
each character cell, by outputting the Unicode "upper half block"
glyph (\u2508) with the foreground color set to the top pixel's color
and the background color set to the bottom pixel's color. This is the
default if you're not on a Mac running iTerm2. To demo (if you're on
have iTerm2 but want to see this method):

    oiiotool myfile.exr -attrib term:method 24bit -o out.term

But some terminals and fonts don't support unicode, or don't display
this character, or display it with an ugly border. So you can also use
an alternate method:

    oiiotool myfile.exr -attrib term:method 24bit-space -o out.term

where doesn't use the unicode trick but instead outputs a space (' ')
for each 2 vertical pixels, simply setting the background color to the
average of those two pixels.

There's also a "256color" method that just uses the 6x6x6 color space
in the 256 color palette -- which looks horrible -- and an
experimental "dither" which does a half-assed Floyd-Steinberg
dithering, horizontally only, and frankly is not an improvement unless
you squint really hard.

In all cases, the image will automatically be resized to fit in the
terminal, as well as converted to sRGB so it looks kinda ok.

Along the way, I added a new ImageOutput::supports("procedural")
query.  If the existing input supports("procedural") query says
whether the input image is being generated procedurally and doesn't
correspond to an existing file on disk being ead, then the output
supports("procedural") is the opposite -- is the output doing
something procedural that does not correspond to a file being written.
(The specific use is to use this to avoid oiiotool attempting to
rename the file to move it into its final position.)

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-08 22:16:59 -07:00
Larry Gritz d351cf3b32 Re-enable travis and include an arm64 (aka aarch64) build (#2634)
This is a step toward making sure we are habitually testing on ARM64.

It is incomplete at the moment, several individual tests fail and need
to be tracked down, so the test is marked as "allow_failures" so it
will never appear to fail.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-08 22:16:31 -07:00
Larry Gritz 1dcee8487d Adjust to API changes in OpenColorIO v2 (#2636)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-08 15:12:36 -07:00
Larry Gritz 363ed762b7 Fix build break due to pybind11 master recent change (#2637)
By using the explicit `cast<TypeDesc>()` instead of allowing the
template system to figure it out, we were losing the `const` detection
and making it fail to match templates. It used to work, but a recently
added change in pybind11's master branch caused this to finally fail.

Also change the "latest releases" to use pybind11 2.5. (Only semi-related,
2.5 was fine, it was post-2.5 where we broke.)

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-08 13:28:14 -07:00
Larry Gritz 100897491e Update ref output
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-07 23:08:10 -07:00
Larry Gritz f0c3890eb5 raw: use mutex to guard non-reentrant LibRaw constructor (#2633)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-07 12:46:56 -07:00
Larry Gritz 63ee142750 oiiotool: Fix --eraseattrib not applying to all subimages (#2632)
Either -a or optional modifier :allsubimages=1 ought to have erased
an attribute from all subimages, but it was erased from only the first.

Add a test to verify that --attrib and --eraseattrib both apply
correctly to all subimages when requested.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-07 09:25:24 -07:00
Larry Gritz 3481ab058b Disable tests when support for format is disabled (#2629)
We previously disabled tests for a format when its library was not
found, but didn't consider if the library was found but the
`ENABLE_FOO` variable was set to intentionally disable it.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-06 09:13:33 -07:00
Larry Gritz f30f2b77bc simd.h improvements (#2621)
SIMD improvements for emulating 8-wide on 4-wide HW: for many methods
on 8-wide SIMD types when running on 4-wide hardware, it's better (as
revealed by benchmarks) to implement as two 4-wide ops rather than
falling back to a purely scalar path.

Add operator*(vfloat{4,6,16}, float). On SSE, it hardly matters, no
better than letting the float be promoted to vfloat. But NEON has
vec*float.

Add NEON implementation of blend, min, max, reduce_add.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-05 21:58:10 -07:00
Larry Gritz 2b6cfc76f9 Commit ref output for openexr-damanged test for exr 2.2
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-05 14:12:17 -07:00
Larry Gritz 7c26a62201 SPI touchup
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-05 14:12:10 -07:00
Larry Gritz 7e5b841a80 Fix broken clang-format test (#2627)
A few weeks back, I rearranged a bit of ci-build-and-test.bash to invoke
cmake directly instead of the makefile wrapper. But in the process, I
accidentally caused it to always build `--target install` instead of
using the optional target `$BUILDTARGET` which is how clang-format runs
were supposed to have been triggered.

The result was the 'clang-format' test did a full *build* instead of
running clang-format. This was both much more expensive, and also
pointless: we weren't testing clang-format during CI at all.  Oops.
Thus, some recent checkouts weren't properly formatted. We also amend
the minor fixes that bring us into format compliance.

I also noticed that I can use apt-get to install OCIO on the Ubuntu
instances used by GH CI, so modify to only build OCIO from source if a
specific version is requested. This speeds up some of our CI test
cases.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-05 14:03:48 -07:00
Larry Gritz 2ebf56fa47 unordered_map_concurrent: fix missing size decrement upon erase (#2624)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-03 22:57:39 -07:00
Larry Gritz 198258fd7e argparse -- try to resolve overload ambiguity (#2622)
To help track down build issues with MSVS 2015, re-enable appveyor.
Also split GHA CI to test windows for both MSVS 2019 and 2017.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-01 15:58:08 -07:00
Larry Gritz 489b443368 SPI: update libraw 0.20 beta
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-30 13:26:55 -07:00
Larry Gritz aa12d70274 fmath: add vint versions of clamp (#2617)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-29 00:16:33 -07:00
Larry Gritz e60789f6c0 Avoid unexplained build break with VS2015 -- presumed compiler bug (#2618)
Doesn't trigger an error on other compilers, or on newer MSVS. But this
minor rearrangement makes VS2015 happy, so let's just go with it and
not look under that rug.

Partially addresses #2611

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-27 18:58:02 -07:00
Larry Gritz ea2a846b70 simd.h: More support for ARM NEON (#2614)
Was browsing some NEON docs and took the opportunity to fill in
implementations of a few more simd methods.

I don't have a way to directly test this myself, but hopefully
simd_test.cpp has enough unit tests to uncover if I've used the wrong
intrinsics for any of this.

I'm hoping that soon GitHub will add a way to run CI jobs on ARM CPUs
for Mac, if nothing else, so we'll have a way to verify this
architecture.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-27 11:56:58 -07:00
Blazej Floch 830d55b76b Fix OIIO_VERSION_RELEASE_TYPE (#2616)
Fixes typo that prevents the release type being propagated from CMake.
The definition in distributed headers is currently empty without the patch.
2020-06-27 11:56:29 -07:00
Larry Gritz 4fc8ce3a29 simd.h: add abs,sign,ceil,floor,round for float3 (#2612)
They already existed for float{4,8,16}, but were never implemented for
float3.

Add to simd_test.cpp both unit sanity checks and benchmarks for these
functions (including for the other classes where it already existed,
they were nonetheless not unit tested).

Also beef up simd_test by testing and benchmarking load/construcution
from scalar. Rename some test functions for clarity.

Along the way I realized a difference between scalar std::round and
our vector simd::round() in how they handle exact middle values
i+0.5. Because our round is more efficient (one instruction, whereas
std::round cannot be done in one op on x64, because "round midpoint
away from zero" is not a native hw rounding mode), put a big fat
comment warning about the difference.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-25 19:18:30 -07:00
Jens Lindgren 7b602c1722 update libraw longitude (#2613) 2020-06-25 13:30:20 -07:00
Larry Gritz 975ed71af5 Fix Mac GH CI: freetype already installed
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-25 09:19:59 -07:00
Larry Gritz 7d3ba8fad2 Update INSTALL to reflect working with ffmpeg 4.3
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-18 23:23:42 -07:00
Larry Gritz 42e4a0b842 Fix comment typo
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-18 23:23:42 -07:00
Larry Gritz fed34425be EXR: Stop translating "worldToNDC" to "worldtoscreen". (#2609)
This seems wrong. EXR standard metadata "worldToNDC" is exactly what it
says, not screen space. I'm not sure how we ended up with the historical
accident of reading "worldToNDC" from exr headers and auto-translating
it to "worldtoscreen".

The hope is that nearly no one is affected by any of this, since the
primary use case for these matrices was shadow maps, which were never
fully implemented in OIIO's TextureSystem anyway (they were last on
the list, and the VFX world switched to ray tracing before anybody got
angry enough at my procrastination to force me to implement it).

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-18 18:45:45 -07:00
Travis Mosley b9e6dc5a0c Updated vcpkg instructions to aid discoverability (#2610)
Added a line for vcpkg users to discover additional opencolorio features they can build with that tool. This will help avoid people trying to build manually to enable features available via that relatively obscure package manager. Looking in the vcpkg repo isn't as helpful for people unfamiliar with that package manager or how it is configured.
2020-06-18 12:53:18 -07:00
Larry Gritz 4e34d10ff4 Add more exr compliance tests and improve error messages (#2607)
Test more images that have been part of the openexr-images suite for
a while. Three cases:

  * New images that weren't in the suite when I first set up these tests.

  * Images that were "broken" because of (originally) missing features
    in our exr support, that over the years are now supported.

  * Images I was unaware of or somehow fell through the cracks.

In the process, improve and uniformize a number of error messages in
oiiotool, iinfo, openexr reading.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-12 13:06:33 -07:00
Larry Gritz ee07290c2f Use GH CI to upload test output for any job that fails tests (#2606)
This will make it much easier to investigate failures or update ref
output when failures only happen on CI -- any test that fail tests
will produce a downloadable "artifact" consisting of the outputs
of all the failed tests.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-11 22:16:38 -07:00
Larry Gritz 812b8d329b Bump version after developer preview tag
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-10 22:37:37 -07:00
Larry Gritz 23092e6271 CHANGES
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-10 13:39:08 -07:00
Larry Gritz 727c325420 Support Qt 5.15 (#2605)
Homebrew upgrade to Qt 5.15 made it more urgent to change some
deprecated calls to newer idioms.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-10 13:26:57 -07:00
Larry Gritz 5e2b5b64e4 Work around broken OpenEXR definition of OPENEXR_PACKAGE_STRING (#2604)
In at least OpenEXR 2.4 and 2.5, is it quite broken!
But OPENEXR_VERSION_STRING seems ok, so use that.
Issue filed against OpenEXR, but I don't have time to fix it myself tonight.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-10 13:26:38 -07:00
Larry Gritz 6f69687c16 Implement Python version of IBA color_range_check (#2602)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-09 17:44:23 -07:00
Larry Gritz 1b5a726656 RLA: sanity checks to detect corrupt or non-RLA files and prevent crashes (#2600)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-08 10:55:32 -07:00
Larry Gritz 9491e78bcc Document python binding of ImageBufAlgo.nonzero_region
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-06 21:25:20 -07:00
Larry Gritz 7364048e9e Use aswf/osl-2021 container to test the planned VFX Platform 2021
Also unbreak Mac on GH CI

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-04 10:33:25 -07:00
Larry Gritz 710a30ba3d CI: unbreak Mac on GH CI
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-03 23:22:11 -07:00
Larry Gritz 012d3b45e4 Filesystem::write_text_file() (#2597)
One-line utility function to open file, write a string, close file,
return if it succeeded. Analogous to the existing read_text_file().

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-03 14:22:00 -07:00
Richard 1982eba11c Use discovered python executable (#2598)
On Fedora, Python must be run using version specific binaries, python2 or python3. Since we go to the trouble of finding python for the main library, we might as well use the discovered binary name and path.
2020-06-02 00:14:51 -07:00
Larry Gritz f9c64a8a26 SPI: Make sure we're using the non-debug TBB build 2020-06-01 17:43:01 -07:00
Larry Gritz 0d49080c10 CHANGES
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-01 09:56:35 -07:00
Larry Gritz 30ce101ec1 Revise OpenEXR sorting of channel names into canonical order (#2595)
Brief background: OpenEXR sorts channel names alphabetically. Most
formats dont allow channel naming at all, let alone forcing a
particular order contrary to the order the user tries to write it to
the file. OIIO promises that if there is RGB, they will be first and
in that order, next will be alpha if present, then depth, then
everything else.

So our exr reader will reshuffle channels into this canonical order
before presenting to the calling app. In addition to literal R, G, and
B being first, also obvious synonyms are accepted and understood to be
first ("Red", "Green", "Blue", and also "Y" in case it's just a
1-channel intensity and then maybe alpha).

A user noticed an interesting edge case: what if it's a normal map or
positional info, so the channel names are x, y, z? You want it in that
order (coincidentally alphabetical), duh. But the current heuristic
will reorder it as Y (mistaking for intensity), Z (mistaking for
depth), then X (a non-special name, so goes last). Ick!

The solution is that we need a more sophisticaed heuristic. This patch
changes the logic to first just sort by layer, then within each layer,
look to see if there are channels "x", and either "y" or "z", and if
so, then we can conclude that it means something spatial and that Y
isn't really intensity and Z isn't really depth for that particular
layer, so an alternate ordering is used. In all other cases, we
continue to use the old heuristic.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-01 09:06:34 -07:00
Larry Gritz d3ab6f631d TypeDesc additional helpers: Pointer, Vector2, Float4, Vector2i (#2592)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-30 14:08:39 -07:00
Larry Gritz a5dcf08dbc Fix minor issue with fmath's OIIO::clamp (#2594)
OIIO::clamp had the property that if `val <= low`, it sets `low`.
But actually, when `val == low`, we want to use `val`, not `low`.

This may seem like the same thing, and it is for ordinary types.  But
OSL uses this clamp template for "dual" types (implementing automatic
differentiation), and it causes a case where `val == low` but `val`
carries derivatives that we want preserved, not written over by the
0-derivatives of the fixed `low` value.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-28 10:52:38 -07:00
Larry Gritz 351f3979fd Extra test for multiplication (#2593)
SSE2 lacks an instruction for 32 bit SIMD int multiply. SSE4 has
it. We simulate it with a trick using unsigned multiply on SSE2. Chris
wondered if this alternate code path was adequately tested for
negative numbers, so I added a test to be sure.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-27 16:32:53 -07:00
Larry Gritz 24dacc7bc6 oiiotool continued refactor (#2589)
* Make sure the opname is always canonicalized

* Refactor to allow setup() to call skip_impl() to skip the impl and
  copy instead.

* --ummip : make OiiotoolOp subclass (but note, it doesn't honor the
  `:subimages=` modifier).

* --chnames : now OiiotoolOp and honors the `:subimages=` modifier.

* --chsum : now OiiotoolOp and honors the `:subimages=` modifier.

* --chappend : now OiiotoolOp and honors the `:subimages=` modifier.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-27 00:32:19 -07:00
Larry Gritz 5ac50bc72d Add CI test to exercise gcc10 (#2590)
* Turns out no code changes were needed for gcc10!

* Also updated some dependency ranges in INSTALL.md.

* Make a new CI test "latest" -- using the latest supported release of
  the toolchain and dependencies. That includes gcc10 in this case.
  (This is different than the "bleeding edge" test, which tests against
  the development master of many dependencies.)

* Make several test matrix entries (including bleeding edge, static
  libs, and sanitizers) no longer test on every push. That makes
  things take too long. They all still run nightly, and if you're
  pushing a branch with the name "RB", "release", or "master", so they
  will catch problems before releases. Also, all tests run any time
  the branch name is "gh", so if you are preparing a patch
  specifically to make changes to CI, make sure to do that. We will
  probably continue to fine-tune exatly when we run all tests, versus
  the common configurations.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-26 21:46:11 -07:00
Larry Gritz 052675f162 Fix config problem
In the changes of PR #2584, set_and_check was the wrong macro to use
when the path might be empty -- because it is an error if the path
doesn't exist. The "check" part bites us. So just use a regular "set".

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-25 15:07:31 -07:00
Larry Gritz 044c1bba59 Lots of minor docs rendering fixes
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-24 21:53:45 -07:00
Larry Gritz 6326c4d97b CI fixes
* The sanitizer test was using wrong setup script -- we switched to
  using a container, but didn't change the dependency install script
  accordingly.

* Mac seems slower and less reliable on GH, so switch the clang-format
  test to run on Linux.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-24 13:32:02 -07:00
Larry Gritz 4de0652f20 CI fixes (#2588)
* Build "bleeding edge" against fmt master

* Tests that build against OpenEXR 2.4.0, bump to 2.4.1.

* The "sanitizer" test, use ane aswf/ci-osl:2020 container.  This is a
  slow test, so may as well speed it up by using the container with
  pre-installed dependencies.

* Modify ci-build-and-test.bash to use straight cmake build and install,
  not the makefile wrapper.

* No need for atomic lib check on Apple

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-23 20:30:39 -07:00
Larry Gritz 5937c5a2eb python: Fix subtle bug that lost certain string args (#2587) 2020-05-23 20:26:26 -07:00
Larry Gritz f161d93001 Overhaul oiiotool internal idioms (#2586)
oiiotool dates from pre-C++11, and has grown by accretion. As a
result, the individual actions are implemented using multiple
different idioms, and there is a lot of complex boilerplate.

A recent PR added subimage selection widely to all commands that use
the idiom of an implementation that inherits from the OiiotoolOp
class. The convinced me that we want to migrate as many actions as
possible to this idiom. I also realized that the current use of
OiiotoolOp could be greatly simplified by using lambdas in most
cases, which weren't available in the pre-C++11 ancient times when
oiiotool was first being developed.

This patch:

* Has the OiiotoolOp base class contain (and accept in its ctr) a
  std::function for the meat of the impl() and setup() methods.

* If init() and setup() are the only bits that need customization for
  a particular action, they can just be passed as lambdas rather than
  needing to subclass OiiotoolOp.

* This eliminates a huge amount of per-action boilerplate, many helper
  subclasses and macros.

* In front of every action implemetation (however it is done), I
  inserted a comment with the command line argument (e.g.,
  `--colormap`) which is an aid for me to quickly find the
  implementation in this huge file.

This patch DOES NOT change any non-OiiotoolOp action idioms to
OiiotoolOp.  That will come later, first I wanted to make these
improvements.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-20 15:48:08 -07:00
Larry Gritz c835a1a656 Put PLUGIN_SEARCH_PATH in the exported config (#2584)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-18 13:55:49 -07:00
Larry Gritz 10d8f4058a oiiotool: allow optional subimages modifier for many ops (#2582)
For a large number of oiiotool commands (anything whose implementation
inherits from the OiiotoolOp class), allow the optional modifier
`:subimages=...` to control how the operation applies to different
subimages (when dealing with multi-subimage images).

Of course, previously, the default is that most commands operate only
on the first subimage, discarding the others. The global `-a` (and for
many commands the optional `:allsubimages=1` modifier) cause all
subimages to be preserved and the operation to be performed on all of
them.

This new `subimages=...` allows more fine-grained control by
specifying which subimages will be active, as a comma-separated list
of either numeric indices (starting at 0) or subimage names. The
special string "all" means all subimages (thus `:subimages=all` is
equivalent to `:allsubimages=1`). Any subimage number or name preceded
by a "-" excludes that subimage from the active list.  The operation
is performed on only on the active subimages, with excluded subimages
merely being copied from the first input image. The presence of any
`subimages` modifier implies that all subimages should be preserved.

For example, if a.exr is a "multi-part" OpenEXR image (what OIIO calls
multi-image):

    # color convert just the first subimage, discard the rest
    oiiotool a.exr --colorconvert linear sRGB -o out.exr

    # color convert and output all subimages: -a
    oiiotool -a a.exr --colorconvert linear sRGB -o out.exr

    # color convert just the subimage named "beauty", but output them all
    oiiotool a.exr --colorconvert:subimages=beauty linear sRGB -o out.exr

    # color convert all EXCEPT the subimage named "normal"
    oiiotool a.exr --colorconvert:subimages=-normal linear sRGB -o out.exr

    # color convert subimages 1, 2, and 5, leave the others unmodified
    oiiotool a.exr --colorconvert:subimages=1,3,5 linear sRGB -o out.exr

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-13 21:20:15 -07:00
Larry Gritz 2f0021a7d4 Docs improvements to the way we discuss optional modifiers
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-11 16:03:06 -07:00
Larry Gritz 37828b8305 Important fixups of the RTD documentation (#2581)
Seems that the default version of the 'breathe' sphinx plugin is broken on
RTD.

* Change minimum breathe version to the specific one that is the most
  recent release that I verified runs correctly on our docs.

* Remove unused and rusting sphinx extensions.

* Remove obsolete Doxyfile config settings

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-10 20:39:44 -07:00
Larry Gritz a04008c48b Prepare for release of libraw 0.20 (#2580)
* Have our CI "bleeding edge" test libraw master

* Update Fuji reference image and other reference output related to changes
  in libraw.

* Update install instructions to indicate LibRaw 0.20 support

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-10 17:51:28 -07:00
Larry Gritz 5cc51b5115 oiiotool --subimage:delete=1 (#2575)
The existing `oiiotool --subimage <n>` replaces the top multi-subimage
image with a single specified subimage.

This patch adds an optional modifier, so that `--subimage:delete=1`
performs the "inverse" operation: removing just the one specified
subimage from the top multi-subimage image.

One way this could be useful is if you want to perform some operation
on just one subimage, but sill leave the others intact. For example,

    oiiotool many.exr -subimage 0 -colorconvert foo bar many.exr -subimage:delete=1 0 -siappend -o new.exr

This command loads a multi-image file, extracts just the first image,
applies a color transformation, then loads the file again and deletes
the first image, then appends the two pieces, yielding a new
multi-image file whose first image is the color corrected first
subimage, then unaltered copies of all the other subimages.

Upon adding a test case to testsuite/oiiotool, I noticed that the
existing tests for subimage operations did not have reference output
images, and thus were not being tested after all! Fixed that now.
(Those commands were all working just fine anyway, just didn't have
their tests quite enabled.)

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-09 09:03:52 -07:00
Larry Gritz ee970e87e4 Add VFXPlatform 2020 based test to CI (#2579)
Add VFXPlatform 2020 based test to CI

Use the new OpenEXR 2.5 in the ~2021 test.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-09 00:02:48 -07:00
Larry Gritz 67a86bee32 SPI fix: bump OpenVDB, fix clang path 2020-05-08 16:06:59 -07:00
Larry Gritz d72e273ac5 Avoid CMake warnings by updating naming of found variable (#2578)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-08 12:31:01 -07:00
Larry Gritz cbd390aa2b Comment to document where to find PNM format descriptions
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-07 09:41:44 -07:00
Nick Black 64de894358 Break infinite loop in FFMpeg::read_frame() (#2576)
Codecs which set the CODEC_CAP_DELAY capability led to infinite
loops during reading (see #2571). Once AVERROR_EOF is returned,
no more packets are going to be received, regardless of internal
buffering. break out of the loop in that case.

I've verified that this resolves the livelock following decoding
of the first packet in the Notcurses AVI test case which
illustrated this problem. I've also verified that said AVI
advertises the CODEC_CAP_DELAY attribute, matching the proposed
fix. In addition, I verified that OIIO continues to decode all
my other test cases without trouble. I hand-inspected the media,
and verified that the frame counts were precisely correct.

It is legal to pass NULL/0 into the decoder regardless of
CODEC_CAP_DELAY, and thus this whole conditional can really
be eliminated (I have no mention of it in my FFmpeg wrappers).
I haven't bothered to do that here, but it's a thought for the
future. Closes #2571.
2020-05-07 09:10:22 -07:00
Larry Gritz 7b6e5ed388 writeable -> writable (#2567)
Nick Black points out that in many places we have used "writeable", which
is (depending on which dictionary you check) is either a less commonly
used variant of "writable", or just an outright misspelling.

Even charitably interpreting it as an alternate spelling, let's standardize
on the more common variant.

There's only one API function where this comes into play, so to preserve
link compatibility, we'll have both ImageBuf::make_writable() and
make_writeable() as a deprecated synonym that will eventually disappear.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-06 09:46:27 -07:00
Larry Gritz 9e911bddf2 Minor formatting changes in ustring with new clang-format (#2574)
From here on, clang-format 10 will be our official reference formatter.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-05 18:32:49 -07:00
Larry Gritz a78e6f476a Whitespace fix
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-05 17:31:05 -07:00
Larry Gritz 3ec69e283c Update ref output after raw change
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-05 15:57:57 -07:00
Fabien Servant 61327af960 Add the raw:flip attribute (#2572) 2020-05-05 15:57:18 -07:00
Larry Gritz ca8ca129bb SPI fix 2020-05-05 12:57:00 -07:00
Larry Gritz 6cb51486db Bump version after dev preview release
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-04-28 11:35:09 -07:00
Larry Gritz eefe022c3e ffmpeg and openvdb finding touch-ups 2020-04-27 10:34:09 -07:00
Larry Gritz 30561b62f9 CHANGES
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-04-27 09:39:34 -07:00
Larry Gritz 74066a6fad CMake modernization and warning suppression (#2569)
We were getting warnings from newer cmake versions in cases where we
had modules named FindFoo.cmake, but the "found" variable was FOO_FOUND
(instead of matching the module/package name with Foo_FOUND).

Clean that up, as well as imposing a few more namespaced imports to
change to a more modern notation.
2020-04-27 09:22:35 -07:00
Larry Gritz 1f83602e82 Fully hide IplImage references when no OpenCV headers are included (#2568)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-04-27 09:21:51 -07:00
Nick Black 50bb052794 clean up spelling in image{buf,io}.h (#2565) 2020-04-26 12:34:32 -07:00
Christopher Kulla 74307605e2 Only add libraries from the tbb component of the TBB package for building the OpenVDB plugin (#2564) 2020-04-24 22:56:50 -07:00
Larry Gritz b37b9dfe71 GitHub Actions CI improvements (#2563)
* Use the aswf docker images to make sure we have one test that is an
  EXACT VFXPlatform 2019 test (all versions, and on CentOS image).

* The aswf docker also lets us test against g++ 4.8 on GHA, which I
  had never quite figured out before. That lets us disable the old
  Travis CI tests for now, since the only important use for them was
  to run the "oldest supported version" tests.

* In the future, we may use aswf containers for more test matrix entries,
  as they get fleshed out to support 2020 and future 2021. But for now,
  it's just 2019.

* Set up nightly CI test.

* Make CI tests skip for any pushes or PRs that consist of changes only
  to .md and .rst files (i.e., if only docs change, don't bother with
  an expensive build and test).
2020-04-22 11:28:26 -07:00
Larry Gritz 4ad6e013b2 Adjust where boost is found on GHA CI after recent change (#2562) 2020-04-22 11:27:54 -07:00
Larry Gritz 82a5af185c FindOpenJPEG.cmake: Fix incorrectly quoted variable name (#2560)
This error was preventing it from correctly identifying that a found version of libopenjpeg was too old.
2020-04-21 11:36:40 -07:00
Larry Gritz 1a105a6496 Fix all scripts to use /usr/bin/env to find bash (#2558) 2020-04-20 23:12:14 -07:00
Larry Gritz 657f3963e7 IC/TS: Plug a hole that led to redundant tile reads. (#2557)
I was investigating thread behavior while fixing a totally unrelated
bug, and I spotted a way that redundant I/O happens when the same tile
is needed by multiple threads at once. (And it really did happen, I
could see the extra reads in the stats.)

A small additional method to `unordered_map_current` allows us to
simplify the logic in `add_tile_to_cache` fully avoid the redundant
read.

Testing against our production benchmarks, this makes no measurable
difference to performance, even under heavy threading. I think that's
because we make sure that all our texture files are prepared with
'maketx', and thus are tiled, so even the presence of a few redundant
tile reads is essentially undetectable in a full render. However, for
somebody who is using untiled textures (such as jpegs), which will be
read as whole images, this might be a bigger performance gain because
those redundant reads are redundant reads of the entire file.
2020-04-20 23:12:00 -07:00
Larry Gritz 1991e28b6c Fix incorrect printf code 2020-04-19 18:55:59 -07:00
Larry Gritz bc51675223 Beef up the test of Filesystem::extension (#2552)
I suspected that extra dots within a filename was confusing `extension()`.
It's behaving correctly, it turns out. But this is a good test to add.
2020-04-19 18:53:18 -07:00
Larry Gritz 2c4c108988 Test pybind11 master on the bleeding edge CI test (#2556) 2020-04-19 18:53:02 -07:00
Larry Gritz 362162e51d Raise openjpeg minimum to 2.0 (#2555)
Openjpeg released 2.0 in 2015. Continuing to support 1.5 should not be
necessary for future releases.
2020-04-19 18:49:24 -07:00
Larry Gritz 5043b5e457 Fix compiler warning about incorrect extra braces (#2554) 2020-04-13 11:10:22 -07:00
Larry Gritz caa0760727 Improve docs of ImageInput::create and ImageOutput::create (#2551) 2020-04-12 13:35:33 -07:00
Larry Gritz b2b135284c JPEG & PNG: Fix loss of config info upon close and reopen (#2549)
Both the JPEG and PNG readers, because the can only read scanlines in
strictly ascending order, have a section where if they need to backtrack,
they do so by closing the file and re-opening.

But in this close/open, any 'config' settings they were passed when they
opened the first time would get lost. And this could include the IOProxy
they were supposed to be using.

The config info needs to be remembered and applied again if the file
is closed and reopened internal to the reader's operations.
2020-04-11 12:44:03 -07:00
Larry Gritz 547d88a21d Fix typo in license reproduction 2020-04-09 17:29:42 -07:00
Shootfast 531fdcfbd5 OCIO improvements (#2548)
* libOpenImageIO: Added OCIO Role accessors to ColorConfig

* FindOpenColorIO.cmake: Added OpenColorIO_STATIC definition (required for Windows static builds)

* py_colorconfig: Updated ColorConfig python bindings and unit tests
2020-04-09 13:58:19 -07:00
Larry Gritz 058a03ded3 Make the 'bleeding edge' CI test build libtiff and openexr from master (#2543)
The idea of this "bleeding edge" entry in the CI test matrix is to
really use the very latest toolchain, in order to spot problems long
before users will encounter them.

To that end, let's make sure we are building and testing the current
master of libtiff and OpenEXR.
2020-04-08 17:32:22 -07:00
Larry Gritz 6307f02457 Fix GH CI Mac for python (#2542)
Ugh, homebrew just updated some packages (including numpy!) to be
python 3.8-based, but the 'python' homebrew package is still 3.7.
Need to jump through some hoops to make it work.
2020-04-06 22:31:56 -07:00
Larry Gritz f657b40dd7 Fix some problems with the docs (#2541)
Some IBA functions specified the wrong version of the function, thus
leaving out the explanation from the header that was associated with
the other form of the function.

Some groups had bad identifiers, apparently, and were dropping
pieces of text.

Typo in the intro, oops!
2020-04-06 16:24:09 -07:00
Larry Gritz 706d9e9c56 TIFF: fix subtle bug when reading EXIF directory in header (#2540)
After a call to TIFFReadEXIFDirecory, we needed to call TIFFSetDirectory.
We were doing it if the call succeeded, but not if the call failed.
Also, just TIFFSetDirectory is enough, we never needed to close and reopen
the file again.

This had been asymptomatic all along, but some changes in the current
libtiff master made the problems apparent.
2020-04-06 15:23:31 -07:00
Larry Gritz cc72900b27 SPI build adjustments 2020-04-05 17:57:59 -07:00
Larry Gritz 09818a4bac Minor clarification of IC::get_pixels() and TS::get_texels() 2020-04-04 21:56:29 -07:00
Larry Gritz 571c8dd95c Protect against double definitions of GPSTAG values. (#2539)
Prerelease snapshots of libtiff now define these in tiff.h.
2020-04-03 09:47:07 -07:00
Larry Gritz c40c0d4ffe CHANGES 2020-04-01 22:17:43 -07:00
Shootfast 33b4b44c8b externalpackages.cmake: Fix static boost to not overlink (#2537)
When compiling OIIO against a static version of boost where only a subset of boost libs have been built:
(eg, boost configured with --link=static --with-filesystem --with-system --with-thread --with-headers)
We want to disable the automatic MSVC linking, which will otherwise also try to link against unused and non-existant boost libraries (such as date_time).
2020-04-01 18:04:59 -07:00
Larry Gritz 55138f5ee9 SPI changes for shifting compiler locations and versions 2020-03-31 08:50:15 -07:00
Larry Gritz 8af51a9f56 span: allow ctr from vector to allow nonstandard allocators (#2533)
A couple other spots, too.
2020-03-31 08:48:50 -07:00
Larry Gritz e81036b655 Overhaul ArgParse to make it more like python argparse (#2531)
I've been thinking about overhauling ArgParse for a couple years, and
did most of the work in December when I was home from work. Then sat
on it except for slow burn weekend tinkering, but finally got a chance
to put the final touches on and write the docs this week.

The bottom line is that this is a major rewrite of the APIs for
ArgParse to make them much richer, more flexible, and more closely
resembling those of python's argparse module.

Rather than trying to explain the syntax here, I simply will refer you
to the extensive inline documentation in argparse.h, as well as the
examples in the code base of where it's used.

It sill respects the old syntax, so this change is hoped to not alter
the behavior of any programs using the deprecated API.

Start by reading argparse.h, it's design review of the API that is the
most important for those inclined to weigh in.
2020-03-30 17:51:04 -07:00
Larry Gritz b2f0e40581 Build correctly against OCIO 2.x (in progress) (#2530)
And incorporate a build against OCIO master into the "bleeding edge"
CI test, so we don't drift out of sync again.
2020-03-30 12:25:35 -07:00
Larry Gritz 0762e96f7f AttrDelegate::as_vec<> returns the whole attribute as a std::vector (#2528) 2020-03-27 14:44:41 -07:00
Larry Gritz 0f9ed4c9eb FindOpenColorIO: set up a true target (#2529) 2020-03-27 14:44:24 -07:00
Larry Gritz 26929e9619 Add get_indexed() to ParmValueList and AttrDelegate. (#2526)
This lets you pull out a single base value from an aggregate and/or
array attribute.
2020-03-25 16:30:23 -07:00
Larry Gritz 5bcc3e1253 ParamValueList enhancements (#2527)
* New `find_pv()` method wraps `find()` but returns a pointer rather than
  an iterator, and nullptr if the attribute is not found.

* Fix `add_or_replace()` -- it was previously failing to "replace" if the
  new attribute had a different type than the existing one.
2020-03-25 11:32:09 -07:00
Larry Gritz ba42dc3f30 Strutil::upper, lower (#2525) 2020-03-24 09:02:57 -07:00
Larry Gritz c8ef50c6b3 cmake: Clean up comments and make sure to use the right enable var name. (#2523) 2020-03-24 09:02:30 -07:00
Larry Gritz 9cc19c3b64 Fix possible uncaught exceptions in Filesystem utils (#2522)
It is possible for the constructor for filesystem::directory_iterator
to throw an exception. Switch those to the ones that take an error code
reference and do not throw exceptions.

Also fix what must be a bug (how did it ever compile?) at line 208,
where we tried to find out if the status() (!!!) was a diretory, rather
than the path. Huh?

Closes #2517
2020-03-23 18:02:45 -07:00
Larry Gritz 3418f1c97e Better error messages when overscan texture is not possible (#2521)
Sometimes people try to make a texture from a source image that has
"overscan" (that is, when the pixel data window goes outside the
bounds of the "display" window that is assumed to be the 0-1 texture
space). Thiago Ize in particular noticed that this works fine when
outputting the texture as exr, but not as the default TIFF-based
mipmapped textures.

Alas, the only way this can work is if the texture file format has a
way to represent fully general display windows, and TIFF does not. So
it should never have been allowed, but there was no error message, just
strange runtime behavior.

This patch:

1. Tightens up some of the tests for whether the user is requesting an
overscan texture, so that it is an error to use overscan and the
output file type doesn't support display windows (previously this was
only checked if the sequence of operations also required an initial
resize, which was not stringent enough).

2. Fixes the TIFF output which I now believe should never have had
`supports("displaywindow")` return true; it should always have been
false.
2020-03-23 18:02:24 -07:00
Larry Gritz cc53a0eceb Comment fixes 2020-03-20 14:51:29 -07:00
Larry Gritz ebac2614e6 Make sure all build_foo.bash scripts exit upon any error. (#2520)
`set -ex` exists the whole script if any individual command fails.  I
think this will help ensure that people know when these dependency
building scripts have errors, instead of (hypothesized) seeming to
execute fully but actually the installation of that dependency was not
complete.
2020-03-20 12:07:37 -07:00
Larry Gritz 91302311fb Update build requirements for clang 10 and other things 2020-03-14 15:40:19 -07:00
Christopher Kulla a9d251597a Fix clang 10.x warnings (#2518)
Note that some of the warnings related to the dpx/cineon readers highlight suspicious code, but I've opted to retain the existing behavior. The offending variables to not appear to actually do anything, they are just carried around as metadata.
2020-03-13 14:44:07 -07:00
Larry Gritz 2deb8d9703 INSTALL cleanup 2020-03-12 10:08:56 -07:00
Larry Gritz 2c345ce943 Amend INSTALL vcpkg instructions to include tools
Thanks: Moe Myint Htet
2020-03-12 08:58:19 -07:00
Willem871 041b374b4d Fix resolution unit not properly set in JPEG export (#2516)
* Fix resolution unit not properly set in JPEG export

Bug description
-----------------
To give an indication of the physical dimensions (pixels per inch, pixels per mm,...) of the image we can set the "ResolutionUnit", "XResolution" and "YResolution" attributes in the image spec.
For instance for PNG and TIFF this works perfectly, for JPEG however the resolution unit is not properly written.

Root cause in the code
------------------------------
In jpegoutput.cpp in the open() function the "ResolutionUnit" attribute was read and set in the m_cinfo.density_unit entry. 
However this was overwritten by the jpeg_set_defaults(&m_cinfo) call. 

Fix explanation
-----------------
The resmeta_to_density() already contained the "XResolution" and "YResolution" code, but not yet the "ResolutionUnit" code.
So in this fix I moved that code into resmeta_to_density().
2020-03-12 08:43:53 -07:00
Larry Gritz 1f1c0a69db Cmake config fix: make sure Imath headers end up in config include path (#2515)
Also, for CI, some changes to the scripts that download and build some
dependencies, since CMake will give an error if you ask it to generate
configs tat have paths to within the source tree, as we were doing. Move
it out of the source tree.
2020-03-11 12:58:17 -07:00
Larry Gritz 52f2217ad6 Adjust testsuite after adding tga samples to oiio-images (#2512)
The place where the TGAUTILS samples were stored seems to have disappeared
from the web. So put them in oiio-images. Adjusted the targa-tgautils test
for the new location.

Also took the opportunity to clean up the pnm test and simplify how it's
declared.
2020-03-10 10:16:28 -07:00
Larry Gritz 636ea4eb5b Add definition of tweak in version header (#2513) 2020-03-10 10:15:19 -07:00
Larry Gritz 8853dd0b01 CI: allow homebrew field3d installation failure (#2514)
Seems that Homebrew has removed the field3d package, as its scons
build system needs discontinued python2.7 and other parts have fallen
into disrepair and are having trouble on modern compilers and cmake.
2020-03-10 10:14:56 -07:00
Larry Gritz 85b4bb66c8 SPI tweaks 2020-03-06 14:26:17 -08:00
Larry Gritz 1d2edfc349 TIFF improvements fixing some edge cases of tag retrieval (#2504)
Replace black magic with what I think is more principled and correct code,
deduced by carefully reading internals of TIFFGetField.
2020-03-05 14:25:52 -08:00
Larry Gritz 9ce868a956 cmake: Additional controls to customize required/optional dependencies (#2507)
New cmake variables `REQUIRED_DEPS` and `OPTIONAL_DEPS`.

`REQUIRED_DEPS` is a list of individual package dependencies that are
ordinarily optional (meaning, if not found, the build continues,
possibly disabling some functionality or format support), and forcing
them to be required (build failure if not found). Note that "ALL"
means everying.

`OPTIONAL_DEPS` is a list of individual package dependencies that
makes them optional even if ordinarily (or via `REQUIRED_DEPS`) would
be treated as optional. **Extreme caution necessary!** If you take
something required and force it to be optional, there's no telling
what else in the build might break as a result.

A typical use case might be if you have automated builds and want to be
sure that if for some reason they can't find all the dependencies (even the
optional ones), you will definitely fail the build. But maybe you have some
exceptions. For example,

    cmake ... -DREQUIRED_DEPS=ALL -DOPTIONAL_DEPS="DCMTK;R3DSDK"

That means that you want any missing package dependencies to cause the build
to fail, *except* for missing DCMTK and R3DSDK, which you don't care about.

Also did some cleanup to turn PNG into an optional dependency, including
graceful disabling of ICO if libpng is not found.
2020-03-05 14:25:29 -08:00
Larry Gritz 20d26c535c Make sure iinfo return code indicates failures for files that can't be opened (#2511)
Closes #2506
2020-03-05 14:23:15 -08:00
Larry Gritz 5707b804d3 fmath: change rintf to std::rint (#2510) 2020-03-05 11:15:11 -08:00
Larry Gritz 373f0c0119 Fix syntax error with R3DSDK_INCLUDE_DIR (#2509)
Changed R3DSDKK_INCLUDE_DIR to R3DSDK_INCLUDE_DIR to fix library find errors.
2020-03-04 22:04:10 -08:00
Shootfast 5a796bbee8 FindOpenEXR.cmake: Add detection of debug builds (#2505)
Debug builds of OpenEXR have an _d suffix (on Windows at least). This patch adds these file names to the searched library names.
2020-03-03 11:14:35 -08:00
Larry Gritz e29043f038 changes, and fix overdue version bumping 2020-03-02 21:52:58 -08:00
Mei Chu f3225507c4 Updated INSTALL instructions. (#2502)
* Updated INSTALL instructions.
- Include some of the various package manager that can be used to manage dependencies libraries.
- Removed some missing links in the instructions.
- Added vcpkg method for Windows build.

Signed-off-by: Mei Chu <meimchu@gmail.com>

* -INSTALL: Updated documentation per request. Now each package manager got a small section of its own that can be elaborated on in the future if necessary.

Signed-off-by: Mei Chu <meimchu@gmail.com>
2020-03-02 21:51:56 -08:00
Larry Gritz e20b956637 Build system: Revise pybind11 procedures (#2503)
The way we downloaded header-only library was a little janky inasmuch as it
did not actually "build" pybind11, which although there is nothing to compile
per se for this header-only project, nonetheless that's what would generate
the cmake config files defining the targets to import. And the presence of our
FindPybind11.cmake module inhibited cmake finding the config files even when
present elsewhere.

This patch:

* No longer automatically downloads pybind11 as part of our cmake config step.

* Eliminates FindPybind11.cmake module in favor of always expecting a
  pybind11Config.cmake as part of a true pybind11 install.

* Correctly uses the imported pybind11::pybind11 target instead of
  futzing with ${PYBIND11_INCLUDE_DIR}.

* Supplies a new src/build-scripts/build_pybind11.bash script that will do the
  download and "build" of pybind11 (into the ext/ area by default) for those
  users who need it and don't have it on their systems.
2020-03-02 14:37:05 -08:00
Larry Gritz 99886c1834 Exclude some macros from the generated documentation 2020-03-01 22:02:45 -08:00
Larry Gritz df630c0969 Protect against double definition of FMT_USE_GRISU (#2501) 2020-03-01 14:34:20 -08:00
Larry Gritz 9acae4f13b Add ext to .gitignore 2020-02-28 00:17:55 -08:00
Larry Gritz d2d93e72c5 SPI internal build tweaks 2020-02-27 15:36:13 -08:00
Larry Gritz d5c3f5adac Clarify comment persuant to Issue #2496 2020-02-27 10:29:16 -08:00
Larry Gritz a81c0f17fe Fix oiiotool --autotrim to use all subimages (#2497)
Previously, --autotrim when applied to a multi-subimage file would trim
all subimages to the nonzero region of just the first subimage.

This fixes, now examining all subimages and trimming them all to the
union of their nonzero regions (as --trim always did).

Technically, a multi-part OpenEXR can trim each subimage ("part")
separately, each having a different data window. But in practice, many
reading applications (including RV and Nuke!) seem to have trouble
reading files like that. So we go with the union approch.
2020-02-26 23:58:08 -08:00
Larry Gritz 6ed73c00fa Augment FindOpenColorIO to detect the version (#2498) 2020-02-26 23:57:46 -08:00
Larry Gritz 88feb65fc9 Backport fmath performance and other fixes from OSL (#2495)
A variety of minor rewrites of certain math functions to ensure they
generate better machine code and auto-vectorize more cleanly.

* Lots of inline -> OIIO_FORCEINLINE

* Improve clamp used in fast_sin and cos

* fast_safe_pow improve code gen with OIIO_UNLIKELY

* Introduce `OIIO_FMATH_SIMD_FRIENDLY` to allow application switching
  between implementations that give the best scalar performance versus
  sacrificing scalar perf to have the best SIMD vectorization of loops
  containing the fmath function. This is anticipated to be very rare,
  and of course we strive to be simultaneously fastest on scalar & simd,
  but we have one or two cases where such a tradeoff exists.

* Lots of additional fmath benchmarks to help us judge how good they are
  compared to std functions.

* New safe_fmod which not only prevents division by zero but even in other
  cases is much faster than std::fmod.

* New fast_neg is faster than `-float`, in cases where you are ok with
  -(0.0f) being 0.0f instead of actual floating point -0.0f. If you have
  no idea what I'm talking about or why it matters, you definitely will
  like this function!

* Most of these improvements were backported from OSL, made by Alex Wells,
  Intel.
2020-02-26 23:47:31 -08:00
Larry Gritz 7e8d5b5339 fmath.h bit_cast improvements (#2494)
* static_assert to check sizes
* use force inline
* use intrinsics where available
2020-02-25 14:37:07 -08:00
Larry Gritz b008da8bf5 Improve fmath.h madd function (#2492)
I was previously trying to use std::fma, but upon further investigation
it was turning into a single vfmadd instruction a lot less than I thought,
in many cases ending up as a function call (which itself was extra slow
when emulating fma on hardware that lacked it).

The better strategy seems to be just saying `a*b+c`, which on gcc &
icc compilers automatically turns into vfmadd when available on the
hardware, and adding a clang-specific pragma ensures this behavior for
clang as well.

Thanks to Alex Wells of Intel for pointing this out to me (in OSL land).
2020-02-23 11:59:22 -08:00
Larry Gritz 0786f5e633 Add multi-argument version of benchmark clobber() for brevity of use. (#2493) 2020-02-20 22:44:00 -08:00
Larry Gritz e7406560c8 Rewrite of clamp() from Alex Wells generates 2x faster code. (#2491)
Also add clamp unit test and benchmark, and the previously missing
implementation of clamp for vfloat16.
2020-02-19 10:02:56 -08:00
Larry Gritz bea16ced17 Comment 2020-02-17 15:41:14 -08:00
Larry Gritz 12c4a637c4 SPI touchups 2020-02-17 15:39:14 -08:00
Matteo F. Vescovi e999f405bf Fix relative path for oiiotool binary (#2489) 2020-02-17 13:28:55 -08:00
Larry Gritz dbab9b55d3 More nuance in how so name versioning works (#2488)
Versioning embedded in the shared library .so name should reflect ABI
compatibility level. For supported release branches, we guarantee
back-compatibility of the ABI, and therefore 2-digit naming
(major.minor) is appropriate, as we have always done. Changes to the
patch (and tweak) are guaranteed to not break ABI.

On the other hand, development in the master branch (as well as alpha
and probably to be safe betas also) may have ABI changes at any time,
so it is not sufficient for apps to link against libOpenImageIO.2.2.so.
They really should end up with major.minor.patch in order to not cause
trouble for people working from tagged developer previews in the
master branch. In master, "patch" level changes in master may change
ABI, but "tweak" level changes will not.
2020-02-14 10:33:51 -08:00
marsupial 99a751b857 Fix dst-stride not begin honored for format conversion. (#2487) 2020-02-12 11:53:08 -08:00
Larry Gritz e4da960d0a SPI touchups 2020-02-10 14:05:49 -08:00
Larry Gritz a2b5345c6a Fix test for whether OpenEXR has support for FloatVectorAttribute (#2486)
I was previously testing for whether the openexr version was >= 2.2,
which is when the ImfFloatVectorAttribute.h header was introduced.

BUT... OpenEXR has two build systems, and the CMake one (which I use
to build OpenEXR for OIIO's CI tests) worked fine, but the
autotools-based one had a bug that inadvertently omitted installation
of this and some other headers. This problem with openexr's buid system
was fixed in 2.4.

So my preprocessor tests for >= 2.2 was not good enough. This patch
refines the tests so that it's looking for openexr >= 2.4 (when
everything was fixed), or openexr >= 2.2 AND the header is present
(meaning it was built with cmake rather than autotools).
2020-02-10 11:24:18 -08:00
Larry Gritz 8cd5faf404 Bump version after tag 2020-02-09 11:33:32 -08:00
Larry Gritz a02eb8fd82 Overhaul rez build process for SPI 2020-02-08 13:02:13 -08:00
Larry Gritz 12af87c8a8 Add comment about FindOpenImageIO deprecation 2020-02-08 13:01:32 -08:00
Larry Gritz 42235001ee changes 2020-02-08 10:07:17 -08:00
Larry Gritz d0f865da2a Changes to build against newer libraw / support for .cr3 (#2484)
There are API changes in libraw soon-to-be 0.20.x.
Also, write a simple build_libraw.bash that can be used to build a
custom libraw from scratch (including from a specific commit, to test).

The reason I ended up down this road is because we needed to be able
to read .cr3 files, which are not in the released libraw 0.19.5, but
has initial support in the master branch.

Ref image updates for new libraw.
2020-02-07 18:46:27 -08:00
alister-chowdhury 38d4bfddf2 Use clamp wrap mode for IBA::resample() (#2481)
To avoid the black fringing and match the behavior of resize().
2020-02-04 18:07:16 -08:00
Larry Gritz 527591c4a7 Add IOProxy interface to ImageBuf (#2477)
Pass an optional IOProxy* to ImageBuf ctr for reading, supply via new
call set_write_ioproxy() to set one up for subsequent write().

This is much easier than fumbling around with a PTR attribute in the
configuration hints.

Add tests to imageinout_test to check that proxy reads and writes via
ImageBuf works for all the same file types as they did for ImageInput
and ImageOutput.

In the process, found some subtle bugs in the PNG proxy support, needs
to ensure it starts at the beginning when we open, or else multiple
open/close cycles (as will happen in some cases for ImageBuf) will
get all confused.
2020-02-01 21:44:52 -08:00
Larry Gritz 092a48ce41 Fix GH CI warning about obsolete Mac image 2020-02-01 15:39:51 -08:00
alister-chowdhury bf1a07162b Correcting documentation for opaque detection (#2483) 2020-01-31 01:20:22 -08:00
Larry Gritz 2650c9562f Overdue bump of version since the last tag 2020-01-30 22:47:03 -08:00
Larry Gritz ad31ad8ebf Docs touch-ups and cross-reference fixes 2020-01-28 10:21:42 -08:00
Larry Gritz 7fcf440112 Address strict warnings about unused parameters to functions (pt 3) (#2476) 2020-01-28 10:20:42 -08:00
Larry Gritz 8730b627b7 Add concat function to ustring and Strutil (#2478)
`concat(s,t)` is semantically equivalent to `sprintf("%s%s",s,t)`, but
concat carefully avoids copying any of the characters more than once,
and it performs at most one temporary allocation (typically it does
not allocate temp memory from the heap at all, if the sum of the
strings' lengths are not too long).

Added both a std::string-returning and a ustring-returning version.

Also reworked the implementation of `Strutil::repeat()` to similarly
perform at most one one temporary allocation (typically none) and
not perform any unnecessary copies.

Inspired by work Chris Kulla did in OSL.
2020-01-27 21:10:21 -08:00
Larry Gritz f21494e1fb More fixes for problems found by -Wextra (#2475)
More actual (unreported) buglets revealed by -Wextra pointing out function
parameters that were unused.

* Failed to properly swap endianness when decoding Canon camera info.

* ColorProcessor::apply methods were not using chanstride param.

* texture3d fixes: some deriv results dropped on the floor

* Get rid of unused parameters in some internal functions. Not a bug
  per se, but could be misleading about how the functions operate.
2020-01-27 14:22:34 -08:00
Larry Gritz 72e6a63d77 Comment typo fix 2020-01-26 12:19:07 -08:00
Larry Gritz 605ff8035a Address strict warnings about unused parameters to functions (pt 2) (#2471) 2020-01-24 12:13:29 -08:00
Larry Gritz 20fecc1da4 IBA min and max (per-pixel operations) (#2470) 2020-01-24 12:13:07 -08:00
Larry Gritz a210d86984 Fix docs typos 2020-01-24 12:05:47 -08:00
Larry Gritz 3323577dbc Refactor LICENSE-THIRD-PARTY.md (#2469)
Regroup embedded or derived-from projects by license type, with each
license text reproduced only once. I think this makes this file much
more readable, shorter, and easier to see at a glance exactly which
parts are covered by which compatible licenses.
2020-01-23 22:41:44 -08:00
Larry Gritz e081016fad farmhash cleanup (#2473)
* Remove the majority of farmhash.cpp that is about the self-test.

* Make sure absolutely everything is within the OIIO namespace.
2020-01-23 22:33:06 -08:00
Larry Gritz f0d7ef64d2 platform.h: helpful macros for dealing with pragmas (#2467)
Inspired by some work by Alex Wells in the OSL project.
2020-01-22 18:17:18 -08:00
Larry Gritz 48306822ed Work around GH CI problems building ocio
I don't know why, but in the past couple days, all the Linux tests on
GitHub CI have been failing because they can't build OCIO. Travis can do
so. Something changed on the GH end, I can tell because if I re-submit
CI for commits that passed just a few days ago, now they fail, too.

It seems to only be a problem when using Ninja. Falling back to makefiles
for just the OCIO build step appear to work fine.
2020-01-22 13:55:20 -08:00
Larry Gritz 4f220983e8 Fixes related to unused parameters. (#2465)
More exploring what -Wextra turns up.

Found several buglets!

* The string version of getsym didn't pass along report_error.

* ImageBuf::getchannel did not honor its wrap parameter.

* ImageSpec::erase_attribute did not honor its 'searchtype' parameter.

* IBA::reorient did not pass its nthreads params to its children.

* IBA::computePixelHashSHA1 did not honor its nthreads parameter.

* Get rid of useless parameter in internal helper function parse_elements.
2020-01-21 22:38:02 -08:00
Larry Gritz 95ac64fbbe Address strict warnings about unused parameters to functions (#2464)
Fool around with -Wextra (optional, off by default for now), see what
turns up.

No code changes in this batch -- just suppress warnings by commenting
out param names for functions where they are not used (often because
they are base class stubs and the like). For functions that are part
of the public API where we use Doxygen to extract the declarations, we
can't comment out the param names, so instead mark them with
OIIO_MAYBE_UNUSED (and tell Doxygen to make that word go away in the
docs).
2020-01-21 22:35:19 -08:00
Larry Gritz 8f6423487b Update gif.h from original source (#2466)
We have used this for a long time to write animated gifs. Just updating
from its git repo.

Also noticed that we neglected to list it in the docs where we
acknowledge 3rd party embedded software and licenses. Sorry.
2020-01-21 22:33:14 -08:00
Larry Gritz 9542d3e3d3 Fix broken CI when Homebrew field3d and hdf5 are updated slightly out of sync (#2468) 2020-01-20 13:28:02 -08:00
Larry Gritz 5cb002d92e First stab at support for using Conan for dependency installation (#2461)
To make the non-Conan build match the Conan build (and I rather prefer
it this way, as it more closely matches the eventual layout of the
install area), instruct to put the executables in build/bin and
libraries in build/lib.

Not all the dependencies set up right. In particular, the Conan central
repository doesn't have all the dep packages, or in some cases doesn't
have new enough versions. Still contemplating how to address that. But
this is a step in the right direction and maybe somebody with more
Conan knowledge can take it across the finish line.
2020-01-20 10:20:04 -08:00
Larry Gritz 6a43b6ecde Clarify comment 2020-01-19 11:41:50 -08:00
Larry Gritz 79ca384e70 simd: fix typo error in vbool16 == and != (#2463) 2020-01-17 11:01:35 -08:00
Larry Gritz ae331ae0f7 CI enhancements and cleanup (#2462)
* Add GH CI test for Linux + clang

* Needed to port build_llvm.bash from OSL to get the right clang.

* Some cleanup of build_ocio.bash, including renaming varibles more
  clearly and instructing the OCIO build to only make static libs if
  requested.

* Also touched up the travis -- we have recently pared the travis tests
  to just a few, so there's no perf-related reason to restrict some tests
  to just PRs, may as well do them on every push.

* GH CI: install libsquish & qt5 to get a more thorough build a tests.
2020-01-17 00:24:49 -08:00
Larry Gritz 79a5652493 Bump version after dev tag 2020-01-15 17:13:21 -08:00
Larry Gritz 3e3b1d896f SPI builds minor adjustments 2020-01-15 16:23:24 -08:00
Larry Gritz 17f8b71fc4 changes 2020-01-15 14:59:14 -08:00
Larry Gritz c3c4c371dd Extend OpenEXR to handle float vector metadata (in and out) (#2459) 2020-01-15 14:57:23 -08:00
Larry Gritz af889045e4 Fix BUILD_FMT_FORCE accidently left in the wrong position during debug 2020-01-13 16:02:07 -08:00
Larry Gritz b65466424a Remove redundant copy of install_targets macro (#2457) 2020-01-13 15:50:50 -08:00
Larry Gritz e3b92c8f76 Un-embed fmt headers, instead auto-download (#2439)
Like we do for robin-map or pybind11, auto-download the fmt headers
into ext. Remove embedded copies.

Disadvantages:

* One more build step, requires a download. Maybe additional things can
  go wrong? (Mitigating: we already do this for pybind11 and robin-map,
  with no complaints that I'm aware of.)
* This is sometimes a pain for people building behind firewalled networks
  that don't have internet access. (Mitigating: but they had to get the
  OIIO code from the net in the first place, so they could get fmt, too.)

Advantages:

* It's just bad form to fully embed other projects if you can help it.
  Some distros have rules against it, and ASWF (if we ever go that route)
  strongly discourages it.
* Makes it WAY easier for me to bump which version of fmt we prefer
  to use -- change one line with the tag we want, rather than updating
  several header files in their entirety.
* Allows users to use a system install of fmtlib, or to use a
  particular/alternate version than what we had embedded.
* Easier for us to benchmark new releases of fmtlib.
2020-01-13 15:50:27 -08:00
Larry Gritz 5b8b48a070 Slight revision of detection of C++ version (#2456)
The main change is recognizing which MSVS version is C++14 compliant.
Also fixed some comment typos, and initial support for C++20 detection.
2020-01-13 12:19:29 -08:00
Larry Gritz 0eacfc5178 Improve docs for ImageBuf, and some error detection and missing methods (#2460)
* Tried to expand and clarify explanations of the constructors and
  reset methods in particular, after an issue was filed with some
  confusion.

* Added checks to ensure that for the ctrs and reset methods that take
  an ImageSpec and allocate (or wrap) a buffer, if the spec doesn't
  have enough information to do the allocation or know the size of the
  wrapped memory (spec lacking nonzero width, height, depth,
  nchannels, and a concrete data format), the buffer stays marked as
  UNINITIALIZED.

* Added `ImageBuf::reset()` as a synonym for `clear()` and a reset
  variety corresponding to the "wrapped app buffer" constructor.
  This makes it so that every ctr has a corresponding reset method, and
  vice versa. As I was clarifying the docs, I realized that this would
  be better if fully symmetric. Because these are not virtual functions,
  these changes should not break ABI compatibility and should be safe to
  backport.

* In a few spots nearby I renamed NULL to nullptr, couldn't help myself.
2020-01-12 08:51:08 -08:00
Larry Gritz 9fedf96e50 changes 2020-01-10 22:06:42 -08:00
Larry Gritz 0ea3b4eca6 Fix typo in man pages 2020-01-09 15:12:22 -08:00
Larry Gritz b860e9f21f libatomic linkage fixes (#2455)
For apps using atomic.h, on architectures where certain atomic operations
need libatomic, they'll need to know about it. The `${GCC_ATOMIC_LIBRARIES}`
should have been a "PUBLIC" designaton for target_link_libraries, not a
private one (since atomic.h, which calls them, are public).
2020-01-07 12:20:43 -08:00
Larry Gritz d50da75fbe Use external libsquish if found (#2451)
This patch checks for libsquish already on the system, and if found,
uses it. If not found on the system, it falls back on the embedded
version in src/dds.imageio/squish. CMake option USE_EMBEDDED_LIBSQUISH
can be used to force use of the embedded version even if found on the
system.

Background: Our DDS support (by Leszek Godlewski in 2010, as a GSoC
student) relies on an embedded copy of libsquish (MIT license) for DXT
compression.  Embedding was a reasonable choice at the time, but in
2020 it's easily installed an Ubuntu, Homebrew, Vcpkg.  Furthermore,
it's also a Debian package and runs up against their rule that we
should never embed code that is available from other Debian packages
that can be used as dependencies.

This is all I want to do in this patch -- comply with Debian rules,
and also reduce OIIO build time by relying on a prebuilt libsquish if
found on the system. This won't break anybody's builds at this time if
they don't have libsquish already installed, and should be safe to
backport to 2.1 for Debian compliance.

But in the future, we might make it a purely external dependency --
expect it on the system, and if not found, simply disable DDS support
(like we do with many other optional dependency such as libwebp or
libheif).
2020-01-07 00:17:31 -08:00
Larry Gritz adc3fa4e05 Bump the minimum pybind11 that we need (#2453)
Recent changes (2347) seem to rely on some pybind declarations that
are newer than the minimum version we checked for. Bump the pybind11
required version.

If no pybind11 was found on the system, it would correctly auto-download.
I botched the test where, if a pybind11 was found but was an insufficient
version, it would not auto-download as intended. This was just an incorrect
test of PYBIND11_INCLUDES when it should have tested PYBIND11_FOUND.

I also augmented the logic to print a more helpful message pybind11
is found but is insufficient version, and furthermore if it's found
in the ext/ area (the auto-downloaded one) but still too old, it will
remind you that it needs to be blown away and refreshed. You'll see
something like this in the cmake configure output:

    -- Pybind11 was found in /Users/lg/code/oiio/oiio.lg/ext/pybind11/include
    -- ... but was version 2.4.3 (minimum is 2.4.4)
    -- Try removing ext/pybind11 and let me download a newer version.
2020-01-06 21:58:23 -08:00
Larry Gritz 191726fb82 simd: Add length(), length2() to vfloat3 to match Imath (#2452) 2020-01-06 21:31:14 -08:00
Larry Gritz e5035f712f Convert old style asserts to new style (#2435)
Lots of changes, a combination of:

* DASSERT -> OIIO_DASSERT (better name with no namespace pollution,
  same behavior as before)

* ASSERT -> OIIO_ASSERT (better name and better behavior -- no abort
  when in release mode, but error still printed; does both error and
  abort when in debug mode)

* Many cases of ASSERT -> OIIO_DASSERT, downgrading to checks that only
  need to happen in debug mode.

* Removal of a few assertions that are just not necessary nor helpful
  (e.g, return if x is null, then immediately pointlessly assert that
  x is not null).

* Change a few assertions to just plain old error handling, no assertion
  needed.
2020-01-06 21:30:49 -08:00
Larry Gritz 4bcce0fdb3 Modify ImageInput/ImageOutput APIs to directly support IOProxy (#2434)
Make it a first class thing the API knows about, not the very weird back
door of passing via configuration hint.

For the sake of backward compatibility, the "old" method of passing
config attribute "oiio:ioproxy" with a PTR data will continue to be
supported for at least a couple major releases.  But moving forward
for 2.2+ (which, remember, won't be a supported release for many
months), the preferred and documented way will be through these new
API calls.

It is still the case that only some format readers/writers support
IOProxies -- it is not only lots of work to extend support to more
formats (volunteers?) but since we rely on 3rd party libraries for
some of our important formats, if they don't have support for some way
to supply custom low level I/O function overrides, it would be very
hard to have a way for OIIO client applications to use proxies for
those formats.  So callers should always check supports("ioproxy") on
the format before relying on it.
2020-01-06 16:17:05 -08:00
Larry Gritz 14a22f40a4 Fix misdesign in unordered_map_concurrent that broke it for unordered_map (#2454)
Background: unordered_concurrent_map<> is a thread-safe map that is
parameterized by the type of the underlying "shard" maps. The default
underlying map type is std::unordered map. Though for a while, as used
by ImageCache, we have been using robin_map as the underlying map
type, having found it has superior performance.

PR 2314 improved performance even more by taking advantage of the fact
that robin_map has a find(key,hash) that lets you supply the
precomputed hash value (in situations where you already had it), thus
avoiding redundant hash computations.

BUT... we failed to notice that unordered_map doesn't have this kind
of find() variety, and so even though the u_c_m is templated on the
map type, this meant that it would no longer work with
std::unordered_map. That's especially painful since the underlying
type defaults to this.

The solution, in this patch, is to make a helper function
`find_with_hash(map, key, hash)` that uses the hash if the map type
has a find(key,hash) method, and otherwise falls back to the standard
find(key).

There is some template metaprogramming involved, and we add a couple
of handy idioms to platform.h (it sort of belongs there because the way
to express the idioms there depends on whether it's C++ 11 or 14+, and
platform.h is where we sort that kind of thing out).
2020-01-06 10:57:47 -08:00
Larry Gritz 5b868c7fef Detect whether we need to link libatomic (#2450)
* Detect whether we need to link libatomic

* Fix build errors for stb_sprintf on mips64el architecture
2020-01-03 12:18:42 -08:00
Larry Gritz d1f63a5382 repremult: Fix subtle edge case in color conversion with unpremult=1 (#2447)
Troy Sobotka pointed out to me that the implementation of colorconvert
where unpremult=1 (i.e., unpremult, then transform, then premult) was
wrong: the unpremult operation was careful to preserve the color value
of pixels where alpha==0, but the premult we did at the end was just a
straight multiply of the color by the alpha. This would have the
effect of crushing those "glow" (A==0, RGB > 0) pixels to black in
their round trip, whereas we want the original glow to be preserved.

So really, the kind of premult we want for a one-time conversion of
unpremultiplied to premultiplied is subtly different from the "re-premult"
that we want as part of a round-trip operation.

The fix in this patch is to add IBA::repremult() to do this modified
operation (multiply color by alpha, unless alpha is 0), and also that is
the correct operation to use in the unpremult-transform-repremult round
trip that we do as `colorconvert(unpremult=true)`.

Also noticed that the recent CMake overhaul inadvertently left
testsuite/oiiotool-color un-tested, so re-enable that (which also lets
us test this fix).
2020-01-02 17:23:05 -08:00
Larry Gritz bbd7675c8e Add vfloat3.normalize(), for compatibility with Imath::V3f (#2446) 2020-01-01 20:25:27 -08:00
Larry Gritz 2aae67f763 Fixes to cmake config generation (#2448)
* Relax version compatibility specification to just matching major version.
* Specify targets cmake name correctly.
* Make sure install include dir is listed in the public include dirs of the
  libraries.
* Some other cleanup and genericization.

I believe this corrects some deficiencies in the generated
OpenImageIOConfig.cmake that projects can use that exclusively (with
imported targets) and have no need for a copy of
FindOpenImageIO.cmake.
2020-01-01 20:15:33 -08:00
Larry Gritz fcd3580cca Add ImageBuf::setpixel() methods that use cspan instead of ptr/len. (#2443) 2019-12-30 12:01:44 -08:00
Larry Gritz 7357ca1bdc Extend Python ParamValueList to take lists and numpy arrays (#2437)
Previously the data passed had to be tuples.

Also add ParamValueList.attribute() variety that takes an nvalues
parameter.
2019-12-30 11:52:35 -08:00
Larry Gritz adfa94d535 Add missing include of dassert.h to refcnt.h (#2444)
We used the assertion macros, but didn't include the header. I guess
coincidentally, all other files that included refcnt happened to have
included dassert first? But 3rd party code that wants to use refcnt
for some reason shouldn't have this pop up as an error
2019-12-29 10:59:30 -08:00
Larry Gritz b350f5a88b Bump version of pybind11 that we auto-download (#2436) 2019-12-29 10:58:33 -08:00
Larry Gritz e662096012 Compensate for CI machine changs for python install (#2445)
Something changed about homebrew versons, I guess, and the combination
of python + cmake on both GitHub CI and TravisCI broke OSX. Modifying
install_homebrew_deps.bash to be sure it upgraded to the latest
version of both packages seems to solve the problem.
2019-12-28 23:00:40 -08:00
Larry Gritz ae47110077 Fix typo that set the wrong definition for static libs (#2442) 2019-12-25 10:10:43 -08:00
Larry Gritz 12dfb9a0ca Fix broken version in the built .pc file (#2441) 2019-12-24 20:47:31 -08:00
Matteo F. Vescovi ff662cb2ed Fix various typos in code and documentation (#2438) 2019-12-24 16:55:19 -08:00
Larry Gritz 78a53b9884 Fix occasional static destructor order fiasco. (#2432)
Never reported, not on CI tests, but I've seen it happen. Only on MacOS, only
for builds with EMBEDPLUGINS=0, only for tests involving Field3D files.

I seem to be able to fix it (or at least make it asymptomatic when I
run tests) by forcing all the open texture file handles to close
before the DSOs are unloaded, for a few of the utilities.
2019-12-18 18:35:12 -08:00
Larry Gritz b3f6a6824d Allow rw locking of texture caches (#2433)
To reduce thread contention on the IC/TS caches, change from unique
locks to reader-writer locks.

* unordered_map_concurrent: Change the shards from spin_lock to
  spin_rw_lock. Most operations (insert, erase, holding an iterator,
  and find, which returns an iterator) are unique (write) locks. But
  the underappreciated retrieve() method is stateless and so can be
  a reader lock!

* In imagecache.cpp, change a bunch of the find() calls and fiddling
  with iterators into simpler calls to retrieve(), which should be
  able to happen concurrently.

On a highly threaded machine (52 cores) this resulted in a 6% gain
(geometric mean) across a set of production render frames that we like
to test with, but that disguises what's really happening.  Most of the
individual tests in that suite don't change at all (or vary within the
+/- ~1% we expect from timing noise and run-to-run variation.  But a
handful of the tests sped up by 20-40%! So I think you are unlikely
to see any change for a few threads, or even many threads for most
situations. But for highly threaded renderings where the access pattern
really results in the cache locks as a major rendering bottleneck,
this should help a lot.
2019-12-18 15:30:44 -08:00
Larry Gritz 52d8934cae Fix docs typo 2019-12-16 13:55:54 -08:00
Larry Gritz 873b08b737 Replace most uses of boost::thread_specific_ptr with C++11 thread_local (#2431)
There is still one use left, in ImageCache. I'm not sure how to get rid
of that yet, because the C++11 std version only works for global or static
variables, but we are using it in a class. We'll come back to that later.
In the mean time, this gets rid of all other uses.

One thing this does is fix a link error I get on MacOS when building
with EMBEDPLUGINS=0.
2019-12-16 09:20:06 -08:00
Larry Gritz 8a4d2f933c Docs: fix some II and IO chapter examples that used old open() API 2019-12-12 10:19:27 -08:00
Larry Gritz 94174d27d8 Fix ffmpeg package availability problem on Travis (#2430)
The ffmpeg we were using was from a repo whose owner just took it offline.
This was making our TravisCI Linux builds fail. But it's well tested in
the GitHub CI matrix, so just remove it here.

Also... remove another Linux test from Travis that seems redundant, as
it is nearly an identical configuration to one in the GH test matrix.
And for that matter, we don't need to do the clang-format check on
both testing platforms, so remove it from Travis, too. Now we only use
Travis for the gcc 4.8 tests and Mac with Python 2.7 (I've had trouble
getting both of those working on GH CI).
2019-12-12 10:14:53 -08:00
Larry Gritz ad7938902d Exif read: guard better against out of range offests (#2429)
The dataptr() function returns nullptr if the offset is out of proper
range. But the array_to_spec function calling dataptr did not check for
a nullptr return, ended up segfaulting.

This can happen with JPEG files that have certain malformed (we think)
sections of their camera maker notes.
2019-12-10 09:25:32 -08:00
Larry Gritz 6879040647 docs -- edit changes, install 2019-12-08 11:29:21 -08:00
Larry Gritz ce03e8ed99 travis: switch ffmpeg source, old one no longer available 2019-12-08 10:34:40 -08:00
Larry Gritz 5133a8785f Upgrade to fmt 6.1.1, fix format mismatch, disable fmt exceptions (#2427)
* Upgrade to fmt 6.1.1 for some minor bug fixes

* Fix critical format mismatch!

* Disable fmt exceptions
2019-12-05 15:14:04 -08:00
Larry Gritz 5dcc332bf1 fmt fixes -- allow a way to fully disable it (#2426)
Oh boy, I discovered that something in the new fmt make Cuda unhappy,
and this in turn bites OSL. So I made it so that to really get out of
such a jam, one could `#define OIIO_USE_FMT 0` before including
strutil.h, and then the fmt headers will not be included nor called,
falling back on tinyformat where possible (for sprintf, to_string) and
for std::format style simply fail to format. This is sufficient for
now, we don't actually need the formatting to work from within Cuda at
the moment.

Also fixed some out of date comments while I was there.
2019-12-04 14:44:05 -08:00
Larry Gritz 302d9cc65c changes edits 2019-12-03 17:21:04 -08:00
Larry Gritz 2af3c4892f Remove obsolete pdf docs, rely on https://openimageio.readthedocs.io 2019-12-03 17:17:52 -08:00
Larry Gritz 4c3a24f7e8 changes 2019-12-03 16:01:44 -08:00
Larry Gritz 64bad0cc6f Python: add binding for missing ParamValue constructors (#2417)
We previously exposed the PV constructors from just a plain int, float,
or string, but there wasn't an easy way to construct from arbitrary data
like there is in C++.
2019-12-03 10:25:28 -08:00
Larry Gritz 479805991c Update embedded fmtlib to v6.1.0 (#2423)
This updated version of fmt has its floating point conversions locale-independent as we wanted.

Switch completely to relying on fmtlib instead of tinyformat by default, even for the printf-style formatting and to_string() implementation. (It's still controlled by a preprocessor symbol so we can switch back if there's an emergency bug.)

Be more careful about %d vs %u string formatting: tinyformat ignored the distinction, fmt does not.

Summary of performance results:

* float->string (printf style and to_string) is almost 10x faster than before, and now is ~3x faster than C++ std::sprintf to buffer.

* int->string is as fast or faster than std::sprintf to a buffer (despite also doing allocation!).

*  A 6-item conversion to string of mixed int/float/string values is 5.6x faster than before when using printf-style, 1.5x faster for fmt-style, and those two now approximately match and are each 2.7x faster than std::sprintf to pre-allocated buffer.
2019-12-03 10:24:53 -08:00
Larry Gritz 0eaa5f4810 More string format de-confusion: debug()->debugf() (#2424) 2019-12-02 15:32:59 -08:00
Larry Gritz caeb255bec Simplify isfinite idiom. (#2422)
This resulted from some post-commit discussion on issue #2301
2019-12-02 15:32:33 -08:00
Larry Gritz 47c16dea9f IC/TS option "trust_file_extensions" (#2421)
The default is 0, old behavior. If you set to nonzero, you are
promising the ImageCache that it will always be able to identify a
texture file's format based on the filename extension (e.g. ".exr"
always means it's an openexr file, ".tif" or "tx" for TIFF files, and
you will NEVER call a file ".tx" if it's really openexr, or if you do,
you are ok with it being unable to open it). When you enable it with
that promise, it can eliminate a few redundant file opens and header
reads, by not needing to verify file format types at certain stages of
processing.

I'm not sure I would recommend enabling this in general. But if you
are operating in a closed environment where you are sure that file
extensions will match their types (such as a studio with rigid naming
conventions, where all possible textures have been converted with
maketx), this can eliminate some unnecessary network traffic and file
server workload.
2019-12-02 15:32:02 -08:00
Larry Gritz e19c47a979 Fix occasional CI failure in imageinout_test (#2420)
One test is to write an image file to disk, then write the same image
as a "file" to an in-memory buffer, and make sure resulting bit patterns
match exactly.

Every once in a while, it would spuriously fail. I'm pretty sure it's
because of metadata not matching exactly if the two writes happen on
opposite sides of a minute boundary!

This patch attempts to preempt that by setting "DateTime" metadata to
a fixed value, so that individual format writers don't, in its absence,
supply the "now" value, which could vary from run to run.
2019-11-30 16:40:53 -08:00
Larry Gritz 7be26c2e22 oiiotool & ImageBuf improvements for huge images (#2414)
* Detect failed allocations when ImageBuf tries to allocate local memory
  but there is not enough memory -- catch the exception, leave the IB
  uninitialized, set an error in the IB. This at least allows oiiotool
  to issue an understandable error message if --create or --pattern fail
  because too high a resolution was specified.

* oiiotool --create and --pattern take a new optional parameter:
  `:type=name` that overrides the default behavior of allocating all
  internal buffers as float. An important application of this might be
  if you are creating a huge image that would not usually fit in memory
  as floats, might as a half or uint8. For example,

      oiiotool -pattern checker 64000x32000 3 -o big.exr

  writes a really big checkerboard, but will fail on a machine that can't
  muster an allocation of 23 GB RAM. However,

      oiiotool -pattern:type=uint8 checker 64000x32000 3 -o big.exr

  will create and write the same checkerboard using only 6 GB RAM.

* Noticed that oiiotool -o is the only command that used `:datatype=`
  as an optional type override. All others use `type=`, so change to
  that. (The old one is silently accepted as well.)
2019-11-29 14:08:38 -08:00
Larry Gritz 3c8dccd9e6 BMP fix uninitialized data in output (#2418)
Difference between padded scanline width and number of pixel values was
not properly considered or zeroed out. This was (nondeterministically)
botching occasional CI tests.
2019-11-28 10:19:43 -08:00
Larry Gritz 7c48edb09e Assertion overhaul (#2411)
The new preferred assertion macro, OIIO_ASSERT, tests a condition, and
if not true, prints an error message and aborts for debug builds. For
release builds, only tests and reports the error, but does not abort.

OIIO_DASSERT is identical for debug buils, but does nothing at all for
release builds (not even test the condition).

ASSERT and DASSERT are the old macros, but because of namespace
pollution and less desirable behavior, we consider them deprecated
want to phase out their use. (In a separate review we'll convert calls
to these.)

Moving forward, then, the attitude about assertions should be:

* OIIO_ASSERT for when you want an error message in all cases, and also
  abort for debug builds (but not release builds).

* OIIO_DASSERT when you want error/abort for debug builds, and nothing
  for release builds.

* ASSERT/DASSERT - old names and behavior, phase out over time.

* assert() - roughly equivalent to OIIO_DASSERT, ok to use as well,
  especially if you are desiring to have a particular header or module
  free of dependency on dassert.h.

* Overall: remember that you should only use assertions to test for
  "impossible" conditions that indicate a programming error. Never use
  them in place of error handling, or to detect bad input.
2019-11-27 22:35:53 -08:00
Larry Gritz e70f97d3ac ustring internals: properly guard libc++ preprocessor symbol references (#2415) 2019-11-26 20:59:40 -08:00
Larry Gritz 0ea0c7054c Better fallback for OIIO_ALIGN, rely on C++11 (#2412) 2019-11-26 20:59:07 -08:00
Larry Gritz ecbc249e5a More robust OIIO_PRETTY_FUNCTION definition (#2413) 2019-11-26 20:58:46 -08:00
Larry Gritz 227ded4afe Suppress warnings with old libraw on earlier gcc versions 2019-11-26 17:41:26 -08:00
Larry Gritz 639daadc4f Bump version to 2.2-dev after RB-2.1 branch 2019-11-19 17:38:33 -08:00
Larry Gritz 9e819babab changes and bump release designation to RC1 2019-11-19 17:34:40 -08:00
Larry Gritz e25d956ea2 Strutil::lstrip, rstrip (#2409)
We already had strip, which trims chars from both sides. Sometimes you
just want to trip the left or right.

Also add some missing unit tests. And saw a > vs >= improvement in
in string_view::substr().  (I don't think it was wrong before, just
failed to take an early out for an empty substring.)
2019-11-19 08:32:25 -08:00
Larry Gritz cb4176ea49 More care with locales -- Strutil::vsprintf was not locale independent (#2410)
We relied on vsnprintf underneath, which is locale dependent.  This is
important for OSL, which generates code that uses this (it will botch
the formatting of floating point values in OSL printf, format, error,
and other similar calls, if the user has their system set to a locale
with commas as decimal separators).

OSX, FreeBSD, and Windows have vsnprintf_l which allows passing a locale
(for which we use the "C" locale). But Linux does not.

Instead, we use the public domain stb_sprintf, which is locale independent,
for its vsnprintf implementation.

Also found a spot in rla output that could botch certain metadata when
in the wrong locale.
2019-11-18 22:29:06 -08:00
Larry Gritz d095f0da3a Reduce tile cache entry 'used' contention (#2407)
Each texture query may perform many samples, and each sample may fetch a
tile (or more). EVERY time it was making sure that the 'used' atomic int
was set to 1. That's potentially a lot of contention.

Idea: Only set it once for all those samples. We really only need to mark
it 'used' per texture call, not per sample.

So I augmented find_tile() with an optional parameter mark_same_tile_used
(defaulting to true), and the effect is that if it happens to be the
most recently used tile in the microcache, it will only call use() if
mark_same_tile_used is true. So then, when looping over sampling, it
passes sample==1 for that param, having the effect that for the first
sample only (or of course if any other tile is needed than the last one)
will it mark used and diddle the atomic variable.

In our production scene benchmarks at SPI, when run in a highly
threaded configuration with 52 cores, I'm seeing a 2% average speedup
in overall rendering time (geometric mean of many tests; on a few
tests I'm seeing up to 20% gain, which is crazy, but many other scenes
merely break even).
2019-11-18 09:47:23 -08:00
Larry Gritz 20e2430765 export.h: reverse sense of the ifdef OIIO_STATIC_DEFINE 2019-11-17 10:48:42 -08:00
Larry Gritz 6a289dd7b9 Add defined to argparse.h to test whether human readable args are supported 2019-11-17 10:48:37 -08:00
Larry Gritz 2c6787881c Improvements to Strutil::join() (#2408)
* Since it uses an ostrstream internally, make sure it is set up to be
  locale-independent (floats will always render with '.' decimal).

* Add a version with a parameter that allows you to set the number of
  items joined to something other than the length of the sequence,
  truncating or padding with default values as needed.

And I illustrate its use in make_texture.
2019-11-17 10:47:28 -08:00
Larry Gritz 3d06a4e356 Speed up hdr/rgbe read and write uncompressed by 5-10x (#2406)
It was calling fread/fwrite for each pixel! Allocate a little memory and
do just one write per scanline.
2019-11-15 23:16:26 -08:00
Larry Gritz e182f6d0b1 BMP safety for big files and int32 overflow for offsets, and speedups (#2404)
* Fix places that could overflow int32.

* Speed up read/write by about 40%, mostly by avoiding the pointless
  zeroing out of allocated memory in cerain std::vector temporary buffers.

* Replace fgetpos/fsetpos with Filesystem::ftell/fseek
2019-11-15 21:47:34 -08:00
Larry Gritz 0841e14c2d Targa big file and int overflow safety (#2405)
Several areas to be more careful, but ultimately Targa headers contain
uint16 resolution values and uint32 tag offsets within the file.
2019-11-15 16:06:11 -08:00
Larry Gritz f8807ad704 error -> errorf (#2393)
A while back we added errorf() in various places, which henceforth
will be the place to do printf-style formatting, trying to migrate to
a point where the "non-f" error() will eventually follow std::format
(python-like) formatting codes. But for now, error() and errorf() do
the same thing, we will only change the meaning of error() down the
road when it's safe.

This patch just rounds up a lot more places in the internals where
we use error() and changed to errorf().
2019-11-15 11:19:51 -08:00
Larry Gritz bf795758b0 Put checks in zfile output for largest possible resolution (#2403) 2019-11-14 23:39:03 -08:00
Larry Gritz 11f845e671 sgi: big file safety and speedups (#2402)
Watch out for int32 overflows, practice 64 bit seeking.

Also speedups by changing allocations from vector to unique_ptr
2019-11-14 23:38:28 -08:00
Larry Gritz 299fb4103d Refactor iff header reading for better error messages (#2398)
Ultimately this was to simplify the header reading and make sure that an
error message is returned to make it easier to understand where things
failed.
2019-11-13 23:52:19 -08:00
Larry Gritz c9a6e35269 Bump robin map version to latest release (#2401)
We were pegged to a fairly old commit. Also, modern versions have
changed their directory layout a bit (tsl/... -> include/tsl/..., so
compensate for that.
2019-11-13 18:16:49 -08:00
Larry Gritz 5155f94c80 IFF: be mindful of max resolution (#2397)
In the header, the total number of tiles is stored as uint16.
2019-11-13 13:47:49 -08:00
Ramon Montoya Vozmediano dcf2904888 upgrade to 3 channels when doing color conversions (#2400) 2019-11-13 13:21:22 -08:00
Larry Gritz f71328b113 unittest.h: add OIIO_CHECK_IMAGEBUF_STATUS (#2394) 2019-11-13 10:55:53 -08:00
Larry Gritz e5657f7492 Add Filesystem fseek & ftell, always are 64 bit offsets (#2399)
These utility functions are natively 64 bits, so you don't need to
worry about what nonstandard functions to call. Prefer Filesystem::fseek
and ftell over std to guarantee safety for enormous files.
2019-11-13 10:51:25 -08:00
Larry Gritz 8f2c03f02d DPX: guard against int32 overflow for very big images (#2396) 2019-11-13 10:50:30 -08:00
Larry Gritz f9b45b96ec Rename appveyor.yml to disable it in favor of GitHub CI (#2395)
Appveyor seems to have changed something on their end that is breaking
our vcpkg installs of dependencies. Now that I have GitHub CI working,
I don't feel like trying to figure out how to fix Appveyor. Let's just
retire it, since GH CI is testing the build on Windows adequately.
2019-11-11 23:47:49 -08:00
Larry Gritz 5f60237ea1 Docs typo fix
[ci skip]
2019-11-11 12:25:51 -08:00
Larry Gritz c728f433aa Enable python for windows ci test 2019-11-09 15:18:35 -08:00
Larry Gritz 8e47157088 Print defs for JPEGTurbo 2019-11-09 12:49:20 -08:00
Larry Gritz df8d37b632 Fix cast warning (#2392)
Was making lots of warnings on Windows.
2019-11-08 13:24:30 -08:00
Simone Gasparini d129c9a47c [cmake] add config based install and usage (#2387)
* [cmake] add config based install and usage

* [cmake] using OIIO_EXPORTED_TARGETS

* [cmake] cleaning and formatting

* [cmake] more comments
2019-11-08 10:23:37 -08:00
Jérôme Duval 14e174c9b6 strutil: specify the global namespace for strtof and strtod calls. (#2391)
thus avoids infinite loop.
2019-11-08 10:21:08 -08:00
Larry Gritz 4cc4b6e8d5 Disable webp for now on GH CI Mac 2019-11-08 08:31:19 -08:00
Larry Gritz e697e696b7 Bump GitHub CI on Mac image, they are obsoleting 10.14 2019-11-08 08:31:10 -08:00
Larry Gritz b09365187c We no longer need CircleCI, take it out of the test regime (#2389) 2019-11-07 14:45:42 -08:00
Christopher Kulla 4895dc0948 Switch Filesystem API to use string_view more consistently (#2388)
A number of calls in the Filesystem API were using std::string instead of
the more efficient string_view. This was leading to extra conversions in a few places in the code.

Also mask the usage of boost::system::error_code behind an alias so we can (one day) move to std::filesystem more easily.

Fix some internal roundtrip between string and path representations in the Filesystem module.
2019-11-07 12:16:20 -08:00
Larry Gritz c8ec93d515 Fix bugs in Strutil::parse_string that would fail for escaped quotes (#2386)
Two subtle bugs in Strutil::parse_string:

1. Toggling whether we are in an escape code based on the first
   character in the original string, rather than the next character to
   scan.  Big oops!

2. Not realizing that a second backslash in a row should *clear* the
   flag (i.e. `\\` does not leave you in an escaped state).

I beefed up the unit tests, looking at the example I added should
explain the edge case where this crops up -- a double-quoted string
with embedded \\\" within it, if you catch my drift. Just look at the
unit test, it explains better than I can do here. It's very hard to
talk and write (and reason correctly) about escaped strings with
embedded quotes!
2019-11-07 10:27:19 -08:00
Christopher Kulla 8fd114afef Reduce the number of stat calls when opening files (#2385)
* Simplify implementation of Filesystem wrappers

Use the version of boost::filesystem calls that return an error_code instead of catching
exceptions to make the OIIO noexcept.

Also remove extraneous calls to exists that were doubling the number of stat syscalls

* Reduce number of syscalls when opening files

Defer checking for filename existence when scanning for udim tokens in the filename

Avoid double-checking for file existence when measuring the file size, since the Filesystem wrapper already returns 0 on error
2019-11-07 08:51:16 -08:00
Larry Gritz 95cafb8725 Cleaner PIMPL idiom for ImageBuf (#2384)
This is a revision of #2350. I like this solution better.
2019-11-06 22:22:58 -08:00
Larry Gritz c1849f659e igrep and iinfo: more careful about --help returning success code (#2383) 2019-11-06 10:18:06 -08:00
Merwan Achibet fefafd5a86 Fix runtest.py copy when OIIO is a submodule (#2380) 2019-11-05 22:44:33 -08:00
Larry Gritz ae7ea1ad71 ImageCache per-thread file cache to deal with thread contention (#2379)
It's a wash for small thread counts, but for highly threaded renders,
I'm seeing 5% speedups to overall rendering across a large suite of
production scenes on a 52 core render.
2019-11-05 16:52:09 -08:00
Larry Gritz a72bbc5eaf Bug fix in deep image compare when pixels had different # of samples (#2381)
The IBA::compare for deep images A and B would loop over pixels in the
union of A's and B's ROIs (so far, so good), then for each pixel would
loop from 0 to A's number of samples in that pixel. Oops! That means
that if A had fewer samples than B (or if A had no samples but B had
samples) in that pixel, it would not notice that the images were
different.
2019-11-05 09:52:39 -08:00
Larry Gritz 02df886a2a Docs typo 2019-11-04 10:56:08 -08:00
Larry Gritz d733cb8d17 Bump version after beta tag 2019-11-01 17:05:30 -07:00
Larry Gritz 3c5b093d55 CHANGES and mark beta 2019-11-01 15:15:33 -07:00
Larry Gritz 0bc7e2bbe3 alloca cleanup (#2367)
* Make sure alloca is properly declared on all platforms

* Change all stray ALLOCA and alloca to OIIO_ALLOCA.
2019-10-31 15:54:18 -07:00
Larry Gritz d5b34df650 README fix 2019-10-31 11:55:08 -07:00
Larry Gritz 57e3cb968a FindOpenImageIO: document the imported targets 2019-10-31 11:55:08 -07:00
Larry Gritz 8248dc4fad Rig exr texture output to avoid dwa compression for 1-channel images (#2378)
We've run into bugs with DWAA/DWAB compression of OpenEXR images in
the specific case of 1-channel images where tile size is either < 16
or not a power of 2.  There was already special logic in the exr
output module that notices this problem case and switches to zip
compression.

However, in the case of outputting MIPmaps, the top level may satisfy
the conditions under which DWA compression works fine (power of 2,
tile size >= 16). But in the course of outputting the MIP levels, we
will eventually reach a tile size < 16, and the OpenEXR format doesn't
allow us to select a different tile size per MIP level (it's just
stored once in the header for the whole file).

So add some logic to our MIPmap generation (maketx, etc), so that
single channel exr texture maps preemptively switch from dwaa/dwab to
something safe. This still only affects 1-channel images, multiple
channels don't appear to tickle the bug.

I couldn't help myself, along the way I did a little refactoring,
coalescing several "if the texture is an exr..." clauses together
under one conditional, and also modernizing an initialization loop
and fixing a typo.
2019-10-31 11:23:05 -07:00
Larry Gritz 7a23ece04b Minor cosmetic touch-ups to cmake files 2019-10-29 23:40:23 -07:00
Larry Gritz eaf6f8f338 Use more standard convention for plugin_extension on OSX (#2376)
On OSX, Plugin::plugin_extension() returned "dylib". But actually, OSX
distinguishes between true shared libraries ("dylib") and what they
call "bundles" -- the latter is what we think of as a runtime-loadable
plugin and is traditionally given the extension "so".  This choice
also corresponds to what is chosen by new CMake conventions where we
use "MODULE" as the argument to add_library() when making plugins.

I apologize for not understanding this distinction previously.
2019-10-28 10:31:11 -07:00
Larry Gritz 872b2a9a54 Bump version after developer preview tag 2019-10-27 12:18:51 -07:00
Larry Gritz 94d1f5a28c Simplify Makefile wrapper a bit
Allow overrides of the build_dir and dist_dir.

For SPI, build debug & release libs in same place for better staging.
Also some other local build updates that won't affect anyone else.
2019-10-25 17:45:40 -07:00
Larry Gritz 7418ab20b5 Credits typo fix. Eyes getting old.
[ ci skip ]
2019-10-25 11:45:57 -07:00
Larry Gritz 03ac38ea44 CHANGES
[ ci skip ]
2019-10-25 11:32:25 -07:00
Harry Mallon 05cc7af9b7 Add imported library to FindOpenImageIO.cmake (#2373)
* Add macOS .DS_Store to gitignore

* Add imported library to FindOpenImageIO.cmake

* Fixes #2331
2019-10-24 22:30:36 -07:00
Larry Gritz 23f0806dfe More cmake refactoring (#2372)
* Split python utilities into its own file

* Move shrinking contents of install.cmake into compiler.cmake

* cmake refactoring: mostly moving options close to where they are used

* Comment the heck out of compiler.cmake

* Tweak build_openexr.bash - fix some 2.2 probs
2019-10-24 11:11:02 -07:00
Larry Gritz b6eee38318 ociofiletransform fixes (#2371)
* The Python bindings of both ociotransform and ociolook mixed up the
  order of inverse and unpremult params. Oh no!

* Python bindings of both ociotransform and ociolook sometimes called
  "inverse" "invert", which would be bad for named parameter binding.

* Underlying C++ IBA::ociofiletransform issued an error message when
  no color config was found. This is unnecessary, since the config is
  only used to make a processor, no color spaces need to be known
  since the LUT comes from the file.
2019-10-23 17:48:43 -07:00
Larry Gritz 00d8d7bee9 CI script touch-ups 2019-10-21 22:29:16 -07:00
Larry Gritz 94db179011 Enhancement of cut/paste functionality (#2369)
The details are below, but the summary of what this enables is that if
you have rendered "panels" yielding images A, B, ... Z that all have
nonoverlapping data windows correctly stored in each file, then you
can stitch them together into the correct composite image with:

    oiiotool A.exr B.exr ... Z.exr -paste:all=1:mergeroi=1 +0+0 -o out.exr

This works for deep files, too!

The individual changes:

* New `oiiotool --paste` optional modifiers:

  - `:all=1` Paste the entire stack of images. Normally, only the top
    two image on the stack are involved (`fg bg --paste`), but this
    allows `fg1 fg2 ... bg --paste:all=1`, which means "paste all of
    the fg images on top of bg").

  - `:mergeroi=1` Normally, the foreground image will "clip" against the
    extent of the background image's data window. This option makes the
    result of paste be sized to the *union* of the data windows fg and
    bg images.

* Extend IBA::paste() and `oiiotool --paste` to work with deep images.

* New `oiiotool --originoffset` offsets the data window origin
  relative to its previous value (versus the existing `--origin` which
  sets it to a specific value regardless of what it previously was).

* Change semantics of IBA::paste() and oiiotool --paste.

  When pasting image F on top of B at offset (x,y,z), we now clarify
  that pixel (0,0,0) of F will replace (x,y,z) in B. As before, only
  pixels within F's data window will be copied.

  Before, we were a little unclear and in fact the implementation was
  that the data origin of S would be the pixel that replaced (x,y,z) in
  B.  These two interpretations are identical for ordinary images whose
  data origin is (0,0). But for "crops" or "shrink-wrapped" images, the
  old behavior was confusing since especially in the shrink-wrap case it
  depended on the exact content of S, whereas intuitively we want the
  paste position to mean the same relative offset regardless of the
  pixel contents of F.

* Enable parallelizing of IBA::paste, making it much faster.

* oiiotool internals: give adjust_geometry an allow_size parameter,
  have it handle the warnings when sizes are specified but shouldn't
  be.

* Move the cut and paste tests from testsuite/oiiotool to
  testsuite/oiiotool-copy.
2019-10-21 21:41:00 -07:00
Larry Gritz ed46989e06 CMake touch-ups 2019-10-21 12:42:48 -07:00
Larry Gritz 828cfec4b8 Oops, disabled iv in the last round of cmake fixes 2019-10-21 12:41:39 -07:00
Larry Gritz 5c8e904583 CMake revision: Allow disabling of individual formats and utils (#2370)
* CMake revision: Allow disabling of individual formats and utils

`ENABLE_<name>=0`, as either a CMake variable or an environment
variable (or its antonym `DISABLE_<name>=1`), will turn off support
for the named format or command line utility. This is even the case if
the file-reading library is found, or if no external library is
required.

For example,

    make ENABLE_DPX=0 ENABLE_cineon=0 ENABLE_maketx=0

A compelling use case is for a package that has OIIO as a required
dependency, but only needs a subset of its features. Building a fresh
copy of OIIO is one step in a CI test and we would like to minimize
the time spent on this step, knowing that the CI tests themselves only
use a fraction of OIIOs's functionality.

Be careful, obviously if you disable enough some of the core formats
or components, you will have an OIIO that is nearly useless. The selective
disabling of components is really helpful for ephemeral builds such as

Along the way, we have some other refactoring:

* Rename macro oiio_install_targets to more generic install_targets.

* Move check_is_enabled to its own file, add ENABLE_foo synonyms and
  DISABLE_foo antonyms, in addition to USE_FOO. I'm starting to lean
  toward ENABLE_foo as the general switch name, the others may go away
  eventually.

* Move colors definitions to their own file.

* Overhaul build_openexr.bash for more options and standard nomenclature.

* Revise static compile defines
2019-10-21 00:23:57 -07:00
Larry Gritz d68ef4d258 Make DeepData more safe for huge images where pixels() could overflow an int (#2363) 2019-10-16 16:41:01 -07:00
Larry Gritz ec21cf3cab More CMake revision (#2368)
* Simplify Find cmake modules -- I now realize that many of the
  PATH_SUFFIXES I was using were redundant, specifying suffixes aleady
  appended by default by the find_*() commands.

* Make some warning suppression more targeted (push some global warning
  suppression to local to modules).

* Simplify and deprecate OIIO_BUILD_CPP macros.

* Switch to cmake idioms for symbol visibility. No more HIDE_SYMBOLS
  directive, hide by default. Expose standard CXX_VISIBILITY_PRESET
  (default to "hidden"), VISIBILITY_INLINES_HIDDEN (default to ON).

* Experimental option USE_GENERATED_EXPORT_HEADER (defaulting to OFF
  for now) uses CMake's ability to generate the export header rather
  than using our hand-coded one. I haven't decided whether to switch
  to using this or not. Will stew on it.

* Rename oiio_find_package -> checked_find_package for easier porting
  between projects

* Fix syntax error in FindOpenImageIO.cmake.

* Purge old OPENIMAGEIO_ROOT_DIR for standard OpenImageIO_ROOT

* Clean up build_openexr.bash
2019-10-16 16:33:32 -07:00
Larry Gritz d71ac830c9 Remove unnecessary comment
[ci skip]
2019-10-15 10:47:46 -07:00
Larry Gritz f68e1a4fd1 Fix docs reference 2019-10-15 10:47:31 -07:00
Larry Gritz 0a7054e442 Make all command line utilities --help return 0 exit code (#2364)
`command --help` is a well-formed command that should have a "success"
error code of 0. Most of the command line utilities returned a failure
code. (Only oiiotool got it right.)
2019-10-15 10:04:44 -07:00
Larry Gritz 7e048b1bd8 Extend oiiotool expression eval with // and % (#2362)
// is integer division (like in Python3)
% is integer modulus

Examples:

    {7/3}  --> 2.33333
    {7//3} --> 2
    {7%3}  --> 1
2019-10-15 10:04:25 -07:00
Larry Gritz e5e9e4f98d Tests: remove order dependency of some tests (#2365)
After a fresh build, sometimes a parallel test would fail because
certain tests tried to get ../oiiotool/src/... but that link is not
set up until oiiotool test runs. It is listed first, but sometimes
when doing parallel test runs (via CTEST_PARALLEL_LEVEL=...) the
timing can be just right to fail.
2019-10-15 08:29:48 -07:00
Larry Gritz b140760ec6 Fix SPI debug postfix 2019-10-10 13:39:13 -07:00
Larry Gritz 45f3d1aabb More CMake refactoring and touch-ups (#2360)
* More CMake refactoring and touch-ups

* Eschew directory-level include_directories and add_definitions in favor
  of explicitly tying them to targets and using PRIVATE/PUBLIC.

* Use standard idiom CMAKE_CXX_STANDARD instead of custom USE_CPP.

* Remove last remnants of CSTD manual settings
2019-10-10 12:30:41 -07:00
Larry Gritz ec05a3e78e Put proper copyright notice in cmake files 2019-10-09 12:15:31 -07:00
Larry Gritz 781bc97c35 More CMake revision (#2357)
* Use CMAKE_DEBUG_POSTFIX to add an optional suffix to debug libs

* For SPI, have the "spi" target build both debug and release libs, with
  a "_debug" suffix for debug libs, and dist it all.

* CMake: change obsolete COMPILE_FLAGS to modern COMPILE_OPTIONS

* Use HOMEPAGE_URL, print CMake system name
2019-10-08 13:05:59 -07:00
Larry Gritz a1ed5a1baf GitHub CI tweaks (#2356)
* Add more test matrix cases, include gcc8/9 builds.

* Fix some warnings with various compile versions.

* Remove redundant tests from Travis
2019-10-07 23:50:26 -07:00
Larry Gritz 99c137b203 Fix numpy issue on Travis 2019-10-07 22:55:02 -07:00
Larry Gritz 39e3c32e39 Python3 safety (#2358)
With this additional set of changes, we now have a 100% clean bill of
health from pylint --py3k.
2019-10-07 22:54:34 -07:00
Larry Gritz 18b8c2f9cf Python3 compatibility touch-ups (#2355) 2019-10-07 10:08:38 -07:00
Larry Gritz 12ac121b45 GH win: gif, freetype 2019-10-04 00:16:52 -07:00
Larry Gritz da8aaa406a Make sanitizers 'if' apply to the whole job, not just one step
And make it run for more branch names
2019-10-04 00:16:22 -07:00
Larry Gritz 8c340892ad CHANGES
[ci skip]
2019-10-04 00:15:15 -07:00
Larry Gritz e548a12e21 More CMake refactoring (#2352)
* CMake cleanup with shared vs static libs
  - Replace BUILDSTATIC with use of the standard BUILD_SHARED_LIBS.
  - Eschew add_library(SHARED|STATIC) and prefer relying on the automatic
    behavior of BUILD_SHARED_LIBS.
  - Get rid of my fPIC option, rely on CMake smarts to do it automatically
    for shared libs and modules.
  - Add static libs CI test to GitHub actions

* Fix: Robust to freetype not being found

* Eliminate DEBUGMODE symbol -- unneeded

* Mark library targets' target_link_libraries and target_include_directories
  with the correct PUBLIC and PRIVATE markers.

* Rely on cmake's transitive library dependencies to eliminate a lot of
  explicit library link directives.

* Eliminate almost all CMAKE_BUILD_TYPE references -- it's not
  considered safe for generators (such as MSVS and Xcode) that
  configure/generate once and then can build multiple configurations
  selectable at build time. It's still not perfect, but it's close.

* Eliminate platform.cmake -- unnecessary. Most of it worked around
  cmake limitations from long ago, or defined symbols that we didn't
  seem to actually need (and in some cases would have been
  ill-advised). The one compiler option that might be important, and a
  few helpful status messages, are moved to compiler.cmake and the
  rest is thrown off the side of the boat.

* Add a sanitizer run to GH test matrix, remove from Travis.

* Properly hint search for pybind11 and robinmap
2019-10-04 00:10:32 -07:00
Larry Gritz 2eafbec945 Define stride_t and imagesize_t in a modern way. (#2351)
In a C++11 world, we can define these using int64_t and uint64_t:
simple, standard, identical size on all platforms.

The prior convoluted definitions were from an earlier time when we
couldn't count on these being present.
2019-10-01 14:00:16 -07:00
Larry Gritz 42edb976e4 Docs: bump CMake minimum as documented in INSTALL.md 2019-09-30 15:43:47 -07:00
Larry Gritz 33838037f0 Fix undefined deleter for ImageBufImpl / MSVS errors (#2350)
This seems to have gone unnoticed by the compilers except for a very
recent update of MSVS 2019...

But the opaque class ImageBufImpl we deine publicly in imagebuf.h
in order to use PIMPL idiom has a problem where the std::unique_ptr
doesn't know what deleter to use for an incompletely declared class.

Do some magic to make a public well-defined base class with a deleter,
keeping the full ImageBufImpl private to imagebuf.cpp.
2019-09-28 12:14:04 -07:00
Larry Gritz ee9258db51 SPI: clang9 locations 2019-09-27 11:49:29 -07:00
Larry Gritz 75ecdc4d86 Bump CMake minimum to 3.12 and refactor accordingly. (#2348)
Must take steps to install a newer cmake for the one Travis matrix case
where the old "trusty" image didn't contain a new enough one. In all
the other CI cases, a new enough cmake was already present.

Get rid of legacy cmake policy directives.

With newer cmake, change many add_definitions to more proper
add_compile_options. Get rid of unnecessary cmake definitions.

Refactor Makefile wrapper with better/standard target names: install,
build, config, etc. And don't replicate code for make vs ninja --
instead, use cmake --build.

Now that CMake 3.12 is the minimum, we can count on any FindFoo.cmake
having its searches automatically include hints for having defined
`-DFoo_ROOT=...` or a defined environment variable `Foo_ROOT`, without
our needing to separately define or handle them. This leads to a huge
refactor ond simplification, as well as a normalization of this as the
one true naming convention for dependency location hints (versus a
hodgepodge of FOO_ROOT_DIR, FOOHOME, FOO_PATH, FOO_HOME, and more).

A lot of the repetitive logic of finding dependencies has been
coalesced in new oiio_find_package macro, which wraps the build-in
find_package() with some nicities, including color coded clear status
messages about which deps were found, which optional ones were not,
and which the user disabled.

Along the way, we bump the Travis macosx setup to xcode11.
2019-09-27 11:47:53 -07:00
Larry Gritz bd87d90121 Movie reader enhancement (#2349)
The original code was always asking ffmpeg to give it RGB uint8 frames.

This patch modifies it so that it asks for RGBA when alpha is present,
1-channel image when it's a greyscale movie, and retrieve as uint16
when >8 bits per channel are stored in the file.

If you are, to pick a hypothetical example at random, trying to
convert a 10 bit rgba quicktime of an fx element into individual
frames to save out as TIFF files, this will fully preserve the 10 bits
and alpha channel, whereas before you would just get back a crappy 8
bit rgb.

Also updated where the SPI build gets its ffmpeg, to pick up a newer
version.
2019-09-25 10:09:23 -07:00
Larry Gritz be0e6b96e5 Working towards Windows builds on GitHub Actions CI (#2346)
It's not entirely working yet -- I can get a more or less full build,
but am having trouble with tests. But I'd like to merge the
refactoring and progress I've made so far.
2019-09-23 09:35:29 -07:00
Larry Gritz 226e9b2788 Update pybind11 version logic to work around bugs (#2347)
The newly released pybind11 v2.4.0 and v2.4.1 are actually broken for
C++11 (accidentally used constexpr in a place where it's only valid
for C++14). Communication with the pybind11 team quickly resulted in a
v2.4.2 release that fixes the problem.

This patch adds logic to our build scripts so that if one of the two
broken versions are found on the system and we're building for C++11,
it falls back to our "download our own copy" logic. The new default
for downloading our own is updated to 2.3.0 (including updating some
ref output).
2019-09-21 18:06:04 -07:00
Larry Gritz 5ae8824c48 Bump version after developer preview release 2019-09-20 23:30:12 -07:00
Larry Gritz 9ca612087b Better CMake status messages upon config startup 2019-09-20 14:25:41 -07:00
Larry Gritz c18aa57283 Fixes that make multi-subimage and movie files faster (#2345)
Several small, subtle, interacting issues were making it particularly
difficult for oiiotool to process frames within movie files (and,
less noticeably, other multi-subimage files). The fixes:

* The ffmpeg reader had no valid_file() method, which meant it fell
  back to the default of doing a full open() and looking for success,
  which is expensive in this case. Replace it with the cheap and naive
  test of just ensuring that the file exists and its name has one of
  the proper file extensions.

* ImageCache::read_untiled(), when reading an untiled image as one
  single tile, closed the file immediately thereafter, which seems
  like a prudent thing to do because once you have read the whole
  image into the cache, you may as well free the resources associated
  with the open file, since you don't need to read any more from
  it. Except... if it's a multi-subimage file, you may need to read
  other subimages.  Especially for a movie file with many frames, you
  don't want to do a full open/close cycle for every frame
  individually just because you are using an ImageCache.

* In oiiotool, ImageRec::read was applying a heuristic to directly and
  fully read "small" images, but fall back on the ImageCache to manage
  "large" images. But it was just looking at the each subimage
  individually. For a movie file, that means that it will force read
  all the frames up front, which is silly. So adjust the heuristic to
  multiply the frame size by number of frames as a better estimate for
  the memory cost of the up-front read. This results in most movie
  files of moderate size falling back to the cache, and thus deferring
  the read until the frames are actually needed (especially helpful if
  not all frames will eventually need to be read).

* Oh boy, oiiotool was always keeping handy a config spec to pass to
  the image open, whether it was needed or not. But also some logic in
  the ImageCache was causing certain kinds of "find file" operations
  (which when asked to find an already in-cache file should just
  return it) to invalidate that previously read file and close+reopen
  when a config spec was supplied (in case the configuration hints
  were meant to change the read behavior or interpretation of the
  file from how it was opened before). These combine badly. So we
  change oiiotool to only pass the config spec when opening via the
  cache if there was a user option to actually set a configuration
  hint, and therefore when that doesn't happen, many needless cache
  invalidations were avoided.
2019-09-20 14:24:20 -07:00
Larry Gritz 46862d824d New attrib "oiio:subimages" says number of subimages, if known (#2344)
It's the number of frames for movie files, number of subimages for
other files.

Set and positive only if it can be known inexpensively from the file
header. If absent or zero, it means there was no easy way to determine
the number of frames or subimage from just reading the header (in that
case, you'll have to discover the subimages the old fashioned way,
repeatedly seeking to subimages until you fail).
2019-09-20 09:03:49 -07:00
Larry Gritz 195b3e87aa No need to set unneeded cmake variable 2019-09-17 23:04:19 -07:00
Larry Gritz d0c530901a appveyor: correctly do the install step 2019-09-17 23:00:07 -07:00
Larry Gritz 9dd7a24c73 FindOpenEXR and install_openexr cleanup (#2343)
I realized that HINTS is higher precedence than PATHS, and that
allowed some simplification of the exr finding logic.

Clean up install_openexr script, more control over the generator type
and build configuration. Use `cmake --build` instead of `make` so it
will work on all platforms and not only make.
2019-09-17 21:12:43 -07:00
Alex Hughes 32d579501c Initial R3D CMake support for OIIO (#2303) 2019-09-16 10:28:29 -07:00
Larry Gritz f1ba6fd2aa Upgraded to a more recent sha1 implementation. (#2342) 2019-09-15 21:27:57 -07:00
Larry Gritz 74267420f9 Fix lg's clang8 setup 2019-09-12 08:10:18 -07:00
Larry Gritz a21db2a06a Tested fine against clang 9 (#2340) 2019-09-11 16:41:56 -07:00
Larry Gritz e93cedacd4 Add library designation omitted from the Rez cmake (#2339) 2019-09-11 12:07:05 -07:00
Larry Gritz a902f2fb1a Update install notes 2019-09-10 12:07:58 -07:00
Larry Gritz 0d3aaa90d6 No need to vcpkg install several things needed only for Qt -- it's preinstalled 2019-09-06 20:11:26 -07:00
Larry Gritz 1ff2f4c21b Experiment with GitHub Actions Beta for CI (#2334)
Current prototype works for 2 Linux tests (default and debug), an OSX
test, and a clang-format check. I want to commit this as a basis for
moving forward, after which I'll flesh out the rest of the test matrix
(including Widows and static analysis).  I think this may be able to
eventually completely replace Travis-CI and Appveyor with an
all-GitHub solution.

Some things that came along for the ride:

* Changes to allow parallel running of tests. I didn't previously
  realize that CTest could do this, but it saves a lot of wall clock
  time in the testing phase. However, I needed to chase down some
  aspects of how I set up tests that precluded parallel execution or
  had inadvertently established order dependency to the test cases.

* For Travis as well, use Ninja to build, which is faster.

* Establish a minimum version of libgif of 4.1, and also take extra
  care on OSX not to pick up an errant version from certain Framework
  directories (such as for Mono).

* Updated ref output for yet more versions of libraw.
2019-09-06 15:09:44 -07:00
Larry Gritz 0ced42ecf1 Fix rotl<> for Cuda safety (#2335)
Two problems (sorry for not testing better):

1. I botched the template syntax for the Cuda specialization.

2. The Cuda specialization uses intrinsic __funnelshift_lc which is
   not constexpr, so let's just un-constexpr this whole thing for now.
2019-09-05 21:02:37 -07:00
Larry Gritz f5265cb2ec Fix DPX performance regression (#2333)
Quite some time ago (early in OIIO 2.0 development, after it was
separated from 1.8), we changed the ImageInput::read_native functions
to be thread-safe and stateless. This meant that a seek_subimage would
be called inside the read (which now had a lock) whereas it was
previously assumed that the user had already called it.

All good, as long as your seek_subimage checks whether it's seeking to the
subimage it's already on, in which case no work need be done.

DPX failed to do this, so every scanline read involved a costly header
examination.  Somehow nobody noticed this until now, but it's fairly
icky. It can slow down DPX reads by 2x, and this is greatly exacerbated
in a heavily multithreaded environment.

I found and fixed a similar error for psd files.

While I was at it, I also added a read_native_scanlines so it can read
multiple scanlines (the building block of read_image working efficiently)
with less work, though in my timings it's only barely worth it.
2019-09-05 13:41:21 -07:00
Larry Gritz e695e43582 Fix potential deadlock in TIFF I/O: minor flaw with threadpool method (#2327)
* Fix potential deadlock in TIFF I/O: minor flaw with threadpool method

This has *very* occasionally popped up for a while. I've only seen it
on OSX for some reason, too hard to reproduce but once every several
days.  But a totally unrelated set of changes caused me to see it
happen quite regularly and it's icky.

Long story short, our thread pool seemed to have two different ways of
finding out whether the current thread is a member of the pool, one of
them only used from the TIFF reader/writer, and they didn't match!
Specifically, the correct one tried to know if the calling thread was
doing work for the pool, either being a member of the pool itself or a
nonmember that was stealing work because the pool was too full to add
to. The other one merely said whether it was a fully fledged pool
worker thread. Turns out this difference could get you into trouble,
because you don't want to spawn new tasks from a work stealer, either.

It took me hours of debugging to isolate the trouble, it's too hard to
summarize the specific set of coincidences necessary for this
circumstance to lead to a deadlock.

* Back compatibility fix
2019-09-03 14:04:08 -07:00
Christopher Kulla d201a95e77 Avoid creating a new thread info struct while resolving udims (#2318) 2019-09-03 07:58:16 -07:00
Larry Gritz 04dc91f276 Replace python os.environ access with getenv/putenv (#2325) 2019-09-03 07:56:51 -07:00
Larry Gritz 68994151e6 Remove wayward assertion (#2328) 2019-09-03 07:56:26 -07:00
Larry Gritz 8563ac53f7 IBAprep: replace an assert with a more graceful error failure (#2326) 2019-09-02 23:55:13 -07:00
Larry Gritz ec4b371de0 Fix typo in font search path (#2324) 2019-08-31 19:49:43 -07:00
Larry Gritz d8c20bffd4 When building OpenColorIO from source, bump the default release to 1.1.1 (#2323) 2019-08-31 14:33:39 -07:00
Larry Gritz 5867a1c01f Updates after release of libheif 1.5 (#2322)
A little more flexibility in overriding where to find libheif

Update ref output after libheif 1.5 release
2019-08-31 14:32:57 -07:00
Larry Gritz cbef74aa58 Add new "turbo" color map (#2320)
It's much nicer than "jet" or the one we called "spectrum".

"Turbo" color map Copyright 2019 Google LLC.
SPDX-License-Identifier: Apache-2.0
Author: Anton Mikhailov
https://gist.github.com/mikhailov-work/6a308c20e494d9e0ccc29036b28faa7a
2019-08-23 10:28:47 -07:00
Larry Gritz 90d61babf4 Some cleanup of recent SPI-specific build scripts (#2321)
Some synchronization with OSL build scripts, including making some
places that said "OpenImageIO_blah" into "${PROJECT_NAME}_blah" and
the like, for the sake of easy sharing between the projects.

build.py turns out to no longer be needed, but a new CMakeLists.txt for
the Rez distro makes downstream Rez packages happy. From Jon Ware.
2019-08-23 10:27:00 -07:00
Larry Gritz 9c0051e397 Adjust FindOpenImageIO.cmake after recent changes to versioning digits (#2319) 2019-08-22 09:47:44 -07:00
Larry Gritz f91282bec7 Bump version after dev preview release 2019-08-20 15:18:58 -07:00
Larry Gritz 88df5a70cc SPI touchups 2019-08-20 15:16:36 -07:00
Larry Gritz 2f9f424b1f SPI docs touchups 2019-08-19 16:03:11 -07:00
Larry Gritz 6e3199cea2 CHANGES 2019-08-19 15:29:13 -07:00
Larry Gritz 5b002d10a2 Docs & comments touch-ups 2019-08-19 15:29:13 -07:00
Larry Gritz 0c386b52f0 Changes to SPI custom build scripts, versioning/disting policy changes (#2313)
This mostly concerns builds at SPI, but a tiny bit touches the generic
build scripts. Most of you will want to tune out now, unless you're
especially curious.

Changes for everybody:

* Switching to a 4-part formal version number (e.g. 2.1.3.0), so there
  is an additional (rarely used) CMake variable
  OPENIMAGEIO_VERSION_TWEAK. This gives me a little more flexibility
  with certain tags and releases in the master branch but there are
  very few contexts in which anybody will care about or refer to the
  last tweak number, and in practice we may rarely or never use it.

* New CMake option `OIIO_NAMESPACE_INCLUDE_PATCH`, if turned on, will
  make the "inner namespace" include the patch number (such as
  namespace OpenImageIO_v2_1_3), whereas the default is the usual
  major/minor (OpenImageIO_v2_1). In general, for external/supported
  releases, we want just major/minor, since within a major/minor
  family we guarantee link compatibility and specifically DON'T want
  to force a recompile for patch updates only. But for studios like
  ours who build for production directly from master, link
  compatibility is not guaranteed at any time, so we make sure even
  down to the patch level is carefully namespaced.

Changes that only have an effect if you're building at SPI:

* The *default* build (regular old "make") now uses the generic
  default namespace. If you want to make the special namespaced
  version we use for Arnold, build with `make OIIO_ARNOLD=1`.

* Change SpComp2 versioning from consecutive low integer SpComp2
  versions (like v47, v48) to canonical multidigit numbers
  corresponding to external releases, such as v20101 for OIIO 2.1.1.
  Also install the bins in the same place (even though it's
  nonstandard SpComp2 practice).

* A new build mode enabled by `make OIIO_SPIREZ=1` does the kind of
  build we want for an experimental Rez packaging. Some notable details
  and options:

    - `REZ_PACKAGE_ROOT=path` overrides the usual root area where we
      store the packages.
    - `OIIO_REZ_NAME=name` overrides the default package name for the
      Rez distribution (default is "OpenImageIO").
    - An appropriate package.py is automatically generated.
    - The Rez variants fold in the SPI compiler compatibility platform,
      Python major/minor version, and Boost version.
    - The build automatically sets the Rpath for the Rez install area
      so that nobody needs to mess with their LD_LIBRARY_PATH to get
      the libraries to be found (especially if you're just importing the
      Python module).

* Make the appcfg xml for releasing the binaries to the facility.

* Instructions for building for the facility are now in
  site/spi/README-SPI.md
2019-08-19 15:14:41 -07:00
Christopher Kulla 169ff7bce3 Improve the hash function for the tile ID (#2316)
Use all bits of the hash to pick the bin in unordered concurrent map

Minor cleanups to the TileID struct
2019-08-19 15:05:24 -07:00
Christopher Kulla c4f7bbdedd Performance tuning for ustring table (#2315)
* Tweak ustring test to avoid benchmarking sprintf and allow auto detection of thread count

* Tune the default size and shard count for ustring table to perform better on machines with many CPUs

Comment out the num_lookups variable by default (since it is not used)

Make sure ustring table mutexes are cache aligned
2019-08-19 09:42:18 -07:00
Christopher Kulla bd78907ac7 Small improvements to concurrent map (#2314)
* Use robin_map for fingerprint map

* Improve concurrent map lookups by using methods that accept a precomputed hash
2019-08-17 13:05:20 -07:00
Larry Gritz 8c24e346a3 Fix docs typos
Also fiddling with license formatting to try to get GitHub to correctly
auto-detect the BSD 3-clause license. Not consistently working.
2019-08-16 12:28:55 -07:00
Larry Gritz b4e422c5d7 ArgParse: make it easy to have human-readable parameter names (#2312)
This is back-compatible, using argument lists like "--foo %s %s" works
as it always did.

But now the argument type specifier may be followed by an optional
colon (:) and then a human-readable parameter that will be printed in
the help message. For example,

    "--foo %d:WIDTH %d:HEIGHT", ...

indicates that `--foo` takes two integer arguments, and the help message
will be rendered as:

    --foo WIDTH HEIGHT    Set the foo size

I think that makes some of the command line help messages even more clear
and self-documenting.
2019-08-09 15:23:04 -07:00
Larry Gritz b5bb48746b oiiotool --metamerge gives output merged metdata of all inputs (#2311)
Most oiiotool commands copy metadata to their result from their first
input. Using `--metamerge` causes >2 arity image ops to try to merge
metadata from all of its input images (though earlier arguments have
precedence in the case of name clashes).

Also make IBAprep utility have a bitfield flag for the same purpose,
though it's not the mechanism we use for the oiiotool calls.

Along the way, added `ParamValueList::merge()` merges two PVLs together.

Also fixed a couple typos and updated the oiiotool --help message to point
to the new online docs.
2019-08-09 11:26:45 -07:00
Larry Gritz 702013f98e oiiotool internals: overhaul optional modifier processing (#2310)
The recent AttrDelegate and other notational improvements lead to a clearer and
more compact way to express and extract modifiers as ParamValueList instead
of parsed maps of strings.
2019-08-09 11:26:25 -07:00
Larry Gritz ad1ab61a56 Fix rotl for avx512 (#2309) 2019-08-06 09:03:35 -07:00
Алексей e77e5c383d Fix using macroses for Windows targets (#2308) 2019-08-05 08:21:58 -07:00
Larry Gritz 0bbd8a1982 Clarify oiiotool help 2019-08-02 16:42:27 -07:00
Larry Gritz 717b1a7f85 Several small improvements to the ParamValueList / delegate interface (#2297)
* ParamValueList::contains() should be const

* ustring: make an explicit conversion to std::string

* AttrDelegate: make `get<string_view>()` work correctly without
  improperly referencing a temp string whose lifetime is shorter than
  the string_view.

* AttrDelegate: allow default `get()` template to return a string_view. You need
  `get<T>()` to retrieve/convert some other type.

* ParamValueList: have getattribute of string do auto conversion.

If you getattribute() of any non-string type (like an int or float),
it will try hard to convert whatever it finds to that type, even if it
was stored as a different type internally. But if you asked for a
string, it would fail unless it was stored internally as a
string. Make these symmetric by always converting if possible.
2019-08-02 16:41:59 -07:00
ttddee 46583ed4cb Added half_size and user_mul options to rawinput.cpp (#2307) 2019-08-02 15:09:46 -07:00
Larry Gritz eead8fcc89 Remove references to fields deprecated in libraw master (#2306) 2019-08-02 15:07:21 -07:00
Larry Gritz ff2264b929 Appveyor fix
Appveyor updated vcpkg yesterday in a way that breaks things. This effectively
reverts their change until it gets sorted out.
2019-08-02 14:45:08 -07:00
Larry Gritz 41e887549a rotl template, instead of rotl32/rotl64 (#2299)
This matches the C++20 std notation.

Also use the avx512vl intrinsic when available.
2019-08-02 11:32:40 -07:00
Larry Gritz 39e3414801 CHANGES 2019-08-01 21:28:32 -07:00
Алексей 24a7c1218c Some fixes to allow build with mingw (#2304) 2019-08-01 08:07:17 -07:00
Larry Gritz b66073e9f6 Clarify comment of Strutil::splits/splitsv 2019-07-28 22:27:35 -07:00
Larry Gritz 7c31377882 Fix typo in cmake message 2019-07-28 22:27:01 -07:00
Larry Gritz 20da072d71 Strutil::remove_trailing_whitespace(), trim_whitespace() (#2298) 2019-07-28 07:56:31 -07:00
Nathan Rusch afab413640 ImageBufAlgo::fixNonFinite: Fix implicit float/double casts to half (#2301) 2019-07-24 14:11:39 -07:00
Larry Gritz 00921bea82 TIFF fixes: enhance r/w of 6, 14, and 24 bit per sample images. (#2296)
In the process, move some bit depth serializing functions into fmath.h so
we can reuse it. (It's not float math exactly, but it is bit depth conversion,
which for historical reasons we also have here.)
2019-07-24 14:11:01 -07:00
Larry Gritz dfab328086 Fix new dpx test -- we were accidentally allowing oiio version in the ref output 2019-07-24 11:31:32 -07:00
Larry Gritz 449c3cd5ee DPX: add support for 1-channel (luma, etc.) dpx images (#2294)
The bones of it were there, just needed some enabling and realizing
that the ConvertToNative/ConvertToRGB (that were unaware of the
1-channel cases and returned errors) were irrelevant for
single-channel images and should simply be bypassed.

Fixes #2291

Aside: Our output of DPX doesn't currently support compression
properly. Fix that someday? (Our input of compressed DPX is fine.)
But it probably doesn't matter much, since the only compression method
DPX allows is run length encoding, which you would expect performs
poorly on real-world photographic or rendered images with infrequent
runs of identical pixel values. I had not previously appreciated this
fact about DPX.  Why, why does the industry use this terrible format?
2019-07-24 10:11:04 -07:00
Larry Gritz b3949156e6 Fix copyright notice with awkward date construct 2019-07-16 01:23:41 -04:00
Larry Gritz 156919b712 Fix not allocating enough scratch space for cmyk tiff reads (#2292) 2019-07-15 21:30:34 -07:00
Jim Hourihan b5c4d96d8d Work around find_package() failure for newer boost versions with cmake output (#2293)
The FindBoost.cmake interface is broken if it uses boost's installed cmake
output (e.g. boost 1.70.0, cmake <= 3.14) at least in the case that boost
was installed to a non-standard prefix. Specifically it fails to set
variables as indicated in FindBoost.cmake documentation. So until that's
fixed force FindBoost.cmake to use the original path which is consistent
with its docs.
2019-07-15 21:27:35 -07:00
Nathan Rusch 8c56b85de4 [nuke] txWriter knob interface updates (#2290)
- Expose highlight compensation option
- Expose constant color, monochrome, and opaque image detection options
- Remove mostly redundant (and broken) "output stats" knob
- Write OIIO and Nuke version strings to "Software" metadata
2019-07-13 12:01:49 -07:00
Larry Gritz 2e3a61dfe2 In docs generation on rtd, need os.makedirs instead of os.mkdir. 2019-07-12 15:22:17 -07:00
Larry Gritz 88be2dfe45 More docs touch-ups 2019-07-12 11:12:53 -07:00
Larry Gritz abe06efa38 TIFF: subtle bug -- re-opening forgot about rawcolor hint. (#2285)
When scanlines are accessed out of order, to emulate true random access,
sometimes we close the file and re-open. But in this one spot, instead
of calling close_tif() we called close(), and the difference is that close()
also calls init() which resets the options that might have been set by
configuration hints -- such as "oiio:RawColor" and "oiio:UnassociatedAlpha".
In this case, we may want to close/open the TIFF file itself, but we don't
want to "forget" about any configuration hints from the original open call.

The circumstances that led to this being symptomatic are obscure and amusing:

- Scanline TIFF file with CMYK color space, and opened with a
  configuration hint "oiio:RawColor" which causes the CMYK values (4
  chans) to be preserved rather than it all get auto-converted to RGB
  and appear to the app as if it were a 3 channel file.

- The image was held in an ImageCache-backed ImageBuf. And the IC has
  the "autotile" feature turned on (so it will try to break it up into
  tiles in the cache, instead of storing the whole scanline image as a
  single tile).

- An IBA function was running parallelized over multiple threads, and
  it happened that a thread needing a lower part of the image (high
  scanline number) made the request for its tile before another thread
  that needed a tile with lower scanline numbers. This caused the actual
  reads of the scanlines to not be in proper order, therefore necessitating
  a close and re-open of the file.

- Upon the re-open, it had forgotten that "oiio:RawColor" was set, so
  even though the app had asked for the pixels to be written into a 2k
  x 4 chan CMYK buffer, the confused TIFF reader thought it was in the
  mode where it was emulating a 3 channel RGB file. So it would not
  only convert to RGB when it should have left it as cmyk, but since the
  RGB is only 3 channels, the 2048 pixels only filled in the left-most
  1536 (that is, 3/4!) of the value slots in each scanline of the app's
  buffer.

- When running valgrind on the app that was reading the image (for
  unrelated reasons), it was complaining about reading uninitialized
  memory when it would get to pixel 1536, mystifying everybody.

... And I'm so glad today I work on monster movies and cartoons, and not
nuclear power plant control software or life support systems.

Additional fixes included:

* And add a test case

* Python ImageBuf: add constructor that takes a configuration hint spec

* ImageBuf: when adding file to cache, careful with configuration.
If you open an ImageCache-backed ImageBuf, close, then have another
ImageBuf opened later with a different set of "config" hints... you
may not get expected behaviors. Instead, be sure to invalidate it and
add it to the cache in "replace" mode.
2019-07-11 17:31:18 -07:00
Larry Gritz 421d147844 oiiotool: use a shared IC (#2287)
I can't think of any reason why the old code was making a custom
cache, but it interfered with setting certain cache options from
the command line.
2019-07-10 21:03:19 -07:00
Larry Gritz 9d49dd0e2c IBA::computePixelStats was not properly controlling the number of threads. (#2289)
By not passing the nthreads param to the parallel_for_chunked loop,
it was always running fully threaded instead of being controlled by
the nthreads passed to it.
2019-07-10 21:02:56 -07:00
Larry Gritz 92bf8259fd oiiotool -stats not communicating the input configuration hints (#2288) 2019-07-10 21:02:24 -07:00
Larry Gritz 91804df24f iv: Add -rawcolor option to skip auto-convert to RGB (#2286)
For better inspection of raw values of CMYK or other non-RGB color
spaces that would ordinarily be automatically converted.
2019-07-10 21:01:52 -07:00
ThiagoIze 55ffef386a As explained in https://stackoverflow.com/a/32649327, we need to link against rt on linux machines, such as centos 6, that are before glibc 2.17 (#2284) 2019-07-10 16:06:38 -07:00
Larry Gritz 998b950ebd Fix embarrassing ustring::compare(string_view) bug (#2283)
The logic was wrong in cases where the string_view was longer than the
ustring, but they has the same character sequence up to the length of
the ustring.

Add some unit tests to ferret out this case.

To do: fully flesh out unit tests for every last bit of functionality
of ustring and string_view.
2019-07-09 22:44:50 -07:00
Larry Gritz 7348b3487b RLA: fix logic for determining single best type for all channels (#2282)
Previously, any 32 bit channel would force the "single best type" to be float.
But what if it was a 32 bit int?

Instead, use our standard type_merge logic, where we've carefully considered
all the edge cases.
2019-07-09 22:44:32 -07:00
Larry Gritz 0b27ebc66e Update fmt implementation to fix windows warnings (#2280) 2019-07-08 15:53:18 -07:00
Larry Gritz bb73df72bc Make things work on readthedocs
Needed to check in the figures -- we don't want to do an entire build to
generate a working oiiotool just to make docs on runthedocs.

Add sphinxtr extensions for some handy things I want moving forward
2019-07-06 12:42:31 -07:00
Larry Gritz 830d4267b2 Sphinx docs:
* add glossary
* add stdmetadata chapter
* deduce the version automatically from CMakeLists.txt
* working on setup for readthedocs
2019-07-05 09:52:57 -07:00
Larry Gritz 5799f247e0 Docs: Clarify udim metadata retrieval 2019-07-05 09:50:13 -07:00
Larry Gritz 11c03be811 clang-format fixes 2019-07-05 09:47:20 -07:00
marsupial 5216ddefcb Reorder includes for Python.h and POSIX_C_SOURCE macro (#2281) 2019-07-05 09:40:41 -07:00
Larry Gritz 64c034049c Fix inability for python to set timecode (#2279)
It actually boiled down to trouble with setting unsigned int array attribute
from Python int tuples.

Make sure to test this in testsuite/python-imagespec
2019-07-04 12:48:32 -07:00
Larry Gritz 7c050d7d59 Fix formatting from prior commit 2019-07-02 15:28:14 -07:00
Christopher Kulla 483cff53b2 Prevent error messages from getting doubled-up in get_image_info if a handle is created during the call
Minor optimization to how errors are cleared in exists queries
2019-07-02 15:17:38 -07:00
Larry Gritz 65748fdea5 More docs overhaul -- maketx, python bindings, oiiotool, touch-ups on others
Also more work prettifying imagebufalgo.h.
2019-07-02 12:07:22 -07:00
Larry Gritz b3f47645eb vdb reader build pulled in the tbb libraries using wrong CMake variable. (#2274)
Also some adjustments for SPI only for where to find it properly, we
have weird paths.
2019-07-02 08:08:11 -07:00
Larry Gritz 0f2da3fdb5 ociodisplay: let empty display/view names mean to use the default. (#2273) 2019-07-02 08:07:56 -07:00
Larry Gritz 9dcde4e293 Protect simd.h against stray #define of True or False (#2272) 2019-06-27 12:02:48 -07:00
Larry Gritz d25b9fa7f8 New issue templates. (#2271)
GitHub lets you create issue templates, in fact multiple kinds, so
when somebody files an issue they see a menu of the categories. Each
category can have a different template.

I'm making four categories: (1) bug report, (2) feature request, (3)
build problem, and (4) question.

I'm also making it very clear for (3) and (4) that they should not
file an issue at all, but rather use the oiio-dev mail list.

Hopefully this will direct people toward filing more helpful bug reports and
feature requests, and redirect the usual build troubles or usage questions
to the mail list where they belong.
2019-06-26 09:56:27 -07:00
Larry Gritz cbb04a6c4b More Doxygen/Breathe/Sphinx: ImageBufAlgo (#2270) 2019-06-25 21:17:31 -07:00
Larry Gritz c4d020da61 More Sphinx docs: iinfo, iconvert, igrep, idiff 2019-06-22 23:46:33 -07:00
Larry Gritz dd72c6bce2 More Doxygen/Breathe/Sphinx work: ImageBuf 2019-06-22 10:23:44 -07:00
Larry Gritz 2cdc53c21a Resolve environment subimage by name, as we do for texture and texture3d (#2263) 2019-06-21 16:06:52 -07:00
Larry Gritz 3c67faad74 Change copyright notices (#2264)
Replace wordy boilerplate with SPDX license identifier and link to full license.
This is a common practice nowadays, and is a much sleeker appearance IMHO.
2019-06-21 16:06:35 -07:00
Larry Gritz e8f1e6e105 More work on Doxygen/Sphinx docs: TextureSystem (#2265) 2019-06-21 16:06:15 -07:00
Larry Gritz 2c52dbe20c Spruce up ASSERT macros (#2262)
* Use pretty function printing to show what func it failed in.

* Changing wording to more closely match built in assert().

* Make DASSERT simply define to built in assert(), which has the
 advantage compiling without warnings and running correctly with Cuda!
 The ASSERT (works in debug mode as well) and [D]ASSERT_MSG macros
 still are not Cuda friendly because they specifically mention stderr.
2019-06-21 16:06:00 -07:00
Larry Gritz 44fb05c2a0 CONTRIBUTING touch-ups 2019-06-16 20:57:17 -07:00
Larry Gritz 3c55571ae8 Bump in-progress version after developer preview tag 2019-06-12 11:02:45 -07:00
616 changed files with 46704 additions and 38757 deletions
-33
View File
@@ -1,33 +0,0 @@
version: 2
jobs:
avx2:
docker:
- image: debian:stretch
environment:
- USE_SIMD: avx2,fma,f16c
steps:
- checkout
- run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/circleci-installdeps.bash
source src/build-scripts/ci-build-and-test.bash
avx512:
docker:
- image: debian:stretch
environment:
- USE_SIMD: avx512f,avx512dq,avx512cd,avx512bw,avx512vl,fma,f16c
steps:
- checkout
- run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/circleci-installdeps.bash
source src/build-scripts/ci-build-and-test.bash
workflows:
version: 2
# Kick off parallel jobs for each build configuration.
all:
jobs:
- avx2
- avx512
+86 -77
View File
@@ -2,26 +2,30 @@ Language: Cpp
BasedOnStyle: WebKit
SpaceBeforeParens: ControlStatements
#AccessModifierOffset: -4
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
#AlignConsecutiveDeclarations: false
#AlignEscapedNewlines: Right
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
#AllowShortFunctionsOnASingleLine: All
#AllowShortIfStatementsOnASingleLine: false
#AllowShortLoopsOnASingleLine: false
#AlwaysBreakAfterDefinitionReturnType: None
AllowShortFunctionsOnASingleLine: All
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: TopLevel
#AlwaysBreakBeforeMultilineStrings: false
#AlwaysBreakTemplateDeclarations: MultiLine
#BinPackArguments: true
#BinPackParameters: true
BraceWrapping:
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: false
AfterEnum: false
@@ -37,83 +41,88 @@ BraceWrapping:
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
#BreakBeforeBinaryOperators: All
#BreakBeforeBraces: WebKit
#BreakBeforeInheritanceComma: false
#BreakInheritanceList: BeforeColon
#BreakBeforeTernaryOperators: true
#BreakConstructorInitializersBeforeComma: false
#BreakConstructorInitializers: BeforeComma
#BreakAfterJavaFieldAnnotations: false
BreakBeforeBinaryOperators: All
BreakBeforeBraces: WebKit
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeComma
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: false
ColumnLimit: 80
#CommentPragmas: '^ IWYU pragma:'
#CompactNamespaces: false
#ConstructorInitializerAllOnOneLineOrOnePerLine: false
#ConstructorInitializerIndentWidth: 4
#ContinuationIndentWidth: 4
#Cpp11BracedListStyle: false
#DerivePointerAlignment: true
#DisableFormat: false
#ExperimentalAutoDetectBinPacking: false
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: false
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
#ForEachMacros:
# - foreach
# - Q_FOREACH
# - BOOST_FOREACH
#IncludeBlocks: Preserve
#IncludeCategories:
# - Regex: '^"(llvm|llvm-c|clang|clang-c)/'
# Priority: 2
# - Regex: '^(<|"(gtest|gmock|isl|json)/)'
# Priority: 3
# - Regex: '.*'
# Priority: 1
#IncludeIsMainRegex: '(Test)?$'
#IndentCaseLabels: false
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
IndentPPDirectives: AfterHash
#IndentWidth: 4
#IndentWrappedFunctionNames: false
#JavaScriptQuotes: Leave
#JavaScriptWrapImports: true
IndentWidth: 4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
#MacroBlockBegin: ''
#MacroBlockEnd: ''
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 3
#NamespaceIndentation: Inner
#ObjCBinPackProtocolList: Auto
#ObjCBlockIndentWidth: 4
#ObjCSpaceAfterProperty: true
#ObjCSpaceBeforeProtocolList: true
NamespaceIndentation: Inner
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 4
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 40
PenaltyBreakBeforeFirstCallParameter: 100
#PenaltyBreakComment: 300
#PenaltyBreakFirstLessLess: 120
#PenaltyBreakString: 1000
#PenaltyBreakTemplateDeclaration: 10
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 75
PenaltyReturnTypeOnItsOwnLine: 50
#PointerAlignment: Left
PointerAlignment: Left
ReflowComments: false
#SortIncludes: true
#SortUsingDeclarations: true
#SpaceAfterCStyleCast: false
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
#SpaceBeforeAssignmentOperators: true
#SpaceBeforeCpp11BracedList: true
#SpaceBeforeCtorInitializerColon: true
#SpaceBeforeInheritanceColon: true
#SpaceBeforeParens: ControlStatements
#SpaceBeforeRangeBasedForLoopColon: true
#SpaceInEmptyParentheses: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: true
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
#SpacesInAngles: false
#SpacesInContainerLiterals: true
#SpacesInCStyleCastParentheses: false
#SpacesInParentheses: false
#SpacesInSquareBrackets: false
#Standard: Cpp11
#TabWidth: 8
#UseTab: Never
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseTab: Never
#...
-38
View File
@@ -1,38 +0,0 @@
<!--
Please ask questions ("how do I...?") on the [oiio-dev](http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org) mail list, not by filing issues.
Make concrete suggestions for fixing the code ("here is a patch") by filing
a pull request, not an issue.
-->
### Problem
<!-- Describe the problem or suggestion here.] -->
**Expected behavior:** <!-- What you expected to happen -->
**Actual behavior:** <!-- What actually happened -->
<!-- If your problem is a broken build, please create a -->
<!-- [gist](https://gist.github.com) that contains the _full_ verbose -->
<!-- build log, which you can create like this: -->
<!-- ```make clean ; make VERBOSE=1 > build.log``` -->
<!-- If you are reporting a problem about a release branch, have you -->
<!-- already tried the current head of `master` to see if the problem -->
<!-- has been fixed? -->
### Steps to Reproduce
1. [First Step]
2. [Second Step]
3. [and so on...]
### Versions
* OIIO branch/version:
* OS:
* C++ compiler:
+37
View File
@@ -0,0 +1,37 @@
---
name: Bug report
about: I think I have identified a legit bug and can describe it.
title: "[BUG]"
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is. What happened, and
what did you expect to happen instead.
**To Reproduce**
Steps to reproduce the behavior:
1. Do this...
2. Then this...
3. Then THIS happens (reproduce the exact error message if you can)
**Expected behavior**
A clear and concise description of what you expected to happen.
**Evidence**
Do you have error messages? (please quote exacty) Screenshots? Example
command lines or scripts that reliably reproduce the error? If it only
happens with certain image files, can you attach the smallest image you
can make that reproduces the problem?
**Platform information:**
- OIIO branch/version:
- OS:
- C++ compiler:
- Any non-default build flags when you build OIIO:
**IF YOU ALREADY HAVE A CODE FIX:** There is no need to file a separate issue,
please just go straight to making a [pull request](https://github.com/OpenImageIO/oiio/pulls).
+21
View File
@@ -0,0 +1,21 @@
---
name: Build problems
about: I'm having trouble building OIIO. Help!
title: "[BUILD]"
labels: ''
assignees: ''
---
**PLEASE DO NOT REPORT BUILD TROUBLES AS ISSUES**
The best way to get help with your build problems is to ask a question on the
[oiio-dev developer mail list](http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org).
When you email about this, please attach one or both of the following:
1. The full verbose build log, which you can create like this:
```make clean ; make VERBOSE=1 > build.log```
2. The `CMakeCache.txt` file from your build directory.
If you are pretty sure that you have identified a **BUG** in the OpenImageIO
build scripts, please file a [bug report issue](https://github.com/OpenImageIO/oiio/issues/new?template=bug_report.md).
+20
View File
@@ -0,0 +1,20 @@
---
name: Feature request
about: I have a concrete idea about how to improve OpenImageIO.
title: "[FEATURE REQUEST]"
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context about the feature request here.
+27
View File
@@ -0,0 +1,27 @@
---
name: Question
about: How do I... I need help with...
title: "[HELP]"
labels: ''
assignees: ''
---
**PLEASE DO NOT ASK USAGE QUESTIONS USING GITHUB "ISSUES"**
If you are pretty sure that you have identified a **BUG** in OpenImageIO,
please file a [bug report issue](https://github.com/OpenImageIO/oiio/issues/new?template=bug_report.md).
But if you are just asking a question:
* How do I...?
* I need help with...
* Am I doing something wrong?
* I can't build OpenImageIO
For anything of this nature, the best way to get help using OpenImageIO is
to ask a question on the [oiio-dev developer mail list](http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org).
The [documentation](https://openimageio.readthedocs.org)
is pretty comprehensive, so please check there first; you may find the answer
more quickly than you can get your question answered on the mail list.
+434
View File
@@ -0,0 +1,434 @@
# Copyright 2008-present Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
name: CI
on:
push:
# Skip jobs when only documentation files are changed
paths-ignore:
- '**.md'
- '**.rst'
pull_request:
paths-ignore:
- '**.md'
- '**.rst'
schedule:
# Full nightly build
- cron: "0 4 * * *"
jobs:
linux-gcc48:
name: "Linux 2017-ish: gcc4.8/C++11 py2.7 boost-1.66 exr-2.3"
runs-on: ubuntu-latest
container:
image: aswf/ci-osl:2019
steps:
- uses: actions/checkout@v2
- name: all
env:
CXX: /usr/bin/g++
CC: /usr/bin/gcc
CMAKE_CXX_STANDARD: 11
MY_CMAKE_FLAGS: -DBUILD_FMT_VERSION=6.2.1
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/gh-installdeps-centos.bash
source src/build-scripts/ci-build-and-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: build/*/testsuite/*/*.*
vfxplatform-2019:
name: "Linux VFX Platform 2019: gcc6/C++14 py2.7 boost-1.66 exr-2.3"
runs-on: ubuntu-latest
container:
image: aswf/ci-osl:2019
steps:
- uses: actions/checkout@v2
- name: all
env:
CXX: g++
CC: gcc
CMAKE_CXX_STANDARD: 14
USE_SIMD: sse4.2
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/gh-installdeps-centos.bash
source src/build-scripts/ci-build-and-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: build/*/testsuite/*/*.*
vfxplatform-2020:
name: "Linux VFX Platform 2020: gcc6/C++14 py3.7 boost-1.70 exr-2.4"
runs-on: ubuntu-latest
container:
image: aswf/ci-osl:2020
steps:
- uses: actions/checkout@v2
- name: all
env:
CXX: g++
CC: gcc
CMAKE_CXX_STANDARD: 14
PYTHON_VERSION: 3.7
USE_SIMD: avx
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/gh-installdeps-centos.bash
source src/build-scripts/ci-build-and-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: build/*/testsuite/*/*.*
vfxplatform-2021:
# Test what's anticipated to be VFX Platform 2021 -- mainly, that means
# gcc9 and C++17.
name: "Linux VFX Platform 2021: gcc9/C++17 py3.7 boost-1.70 exr-2.5"
runs-on: ubuntu-18.04
container:
image: aswf/ci-osl:2021
steps:
- uses: actions/checkout@v2
- name: all
env:
CXX: g++
CC: gcc
CMAKE_CXX_STANDARD: 17
PYTHON_VERSION: 3.7
USE_SIMD: avx2,f16c
OPENEXR_VERSION: v2.5.0
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/gh-installdeps-centos.bash
source src/build-scripts/ci-build-and-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: build/*/testsuite/*/*.*
linux-gcc7-cpp14-debug:
# Test against gcc7, and also at the same time, do a Debug build.
name: "Linux debug gcc7/C++14, sse4.2, exr2.4"
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: all
env:
CXX: g++-7
CMAKE_CXX_STANDARD: 14
USE_SIMD: sse4.2
DEBUG: 1
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/gh-installdeps.bash
source src/build-scripts/ci-build-and-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: build/*/testsuite/*/*.*
linux-gcc8:
# Test against gcc8.
name: "Linux gcc8: gcc8 C++17 avx exr2.5"
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: all
env:
CXX: g++-8
CMAKE_CXX_STANDARD: 17
USE_SIMD: avx
OPENEXR_VERSION: v2.5.0
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/gh-installdeps.bash
source src/build-scripts/ci-build-and-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: build/*/testsuite/*/*.*
linux-latest-releases:
# Test against latest supported releases of toolchain and dependencies.
name: "Linux latest releases: gcc10 C++17 avx2 exr2.5"
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: all
env:
CXX: g++-10
CMAKE_CXX_STANDARD: 17
USE_SIMD: avx2,f16c
OPENEXR_VERSION: v2.5.0
PYBIND11_VERSION: v2.5.0
LIBRAW_BRANCH: 0.20.0
MY_CMAKE_FLAGS: -DBUILD_FMT_VERSION=7.0.1
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/gh-installdeps.bash
source src/build-scripts/ci-build-and-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: build/*/testsuite/*/*.*
linux-bleeding-edge:
# Test against development master for relevant dependencies, latest
# supported releases of everything else.
# We don't need to run this on every push or PR -- only run on nightly
# test, or if the branch name contains certain substring: gh, release,
# bleeding.
name: "Linux bleeding edge: gcc10 C++17 avx2 OCIO/libtiff/exr master"
runs-on: ubuntu-18.04
if: github.event_name == 'schedule' || contains(github.ref, 'release') || contains(github.ref, 'gh') || contains(github.ref, 'bleeding') || contains(github.ref, 'RB') || contains(github.ref, 'master')
steps:
- uses: actions/checkout@v2
- name: all
env:
CXX: g++-10
CMAKE_CXX_STANDARD: 17
USE_SIMD: avx2,f16c
OPENEXR_VERSION: master
OCIO_BRANCH: master
LIBTIFF_BRANCH: master
PYBIND11_VERSION: master
LIBRAW_BRANCH: master
MY_CMAKE_FLAGS: -DBUILD_FMT_VERSION=master
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/gh-installdeps.bash
source src/build-scripts/ci-build-and-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: build/*/testsuite/*/*.*
linux-oldest:
# Oldest versions of the dependencies that we can muster, and various
# things disabled (no SSE, OCIO, or OpenCV, don't embed plugins).
# We don't need to run this on every push or PR -- only run on nightly
# test, or if the branch name contains certain substrings: gh, release,
# old.
name: "Linux oldest/hobbled: gcc4.8/C++11 py2.7 boost-1.66 exr-2.2 no-sse no-ocio"
if: github.event_name == 'schedule' || contains(github.ref, 'release') || contains(github.ref, 'gh') || contains(github.ref, 'RB') || contains(github.ref, 'master')
runs-on: ubuntu-latest
container:
image: aswf/ci-osl:2019
steps:
- uses: actions/checkout@v2
- name: all
env:
CXX: /usr/bin/g++
CC: /usr/bin/gcc
CMAKE_CXX_STANDARD: 11
USE_SIMD: 0
USE_JPEGTURBO: 0
USE_OPENCOLORIO: 0
USE_OPENCV: 0
EMBEDPLUGINS: 0
OPENEXR_VERSION: v2.2.0
MY_CMAKE_FLAGS: -DBUILD_FMT_VERSION=6.1.2
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/gh-installdeps-centos.bash
source src/build-scripts/ci-build-and-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: build/*/testsuite/*/*.*
macos-py37:
name: "Mac py38"
runs-on: macOS-latest
steps:
- uses: actions/checkout@v2
- name: all
env:
CXX: clang++
PYTHON_VERSION: 3.8
CMAKE_CXX_STANDARD: 14
ENABLE_FIELD3D: OFF
ENABLE_WEBP: OFF
# ^^ webp seems broken on GH CI Mac. Investigate later.
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/install_homebrew_deps.bash
pip3.8 install numpy
src/build-scripts/install_test_images.bash
export PYTHONPATH=/usr/local/lib/python3.8/site-packages:$PYTHONPATH
source src/build-scripts/ci-build-and-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: build/*/testsuite/*/*.*
windows-vs2019:
name: "Windows VS2019"
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
- name: Setup Nuget.exe
uses: warrenbuckley/Setup-Nuget@v1
- name: all
shell: bash
env:
PYTHON_VERSION: 3.6
CMAKE_GENERATOR: "Visual Studio 16 2019"
OPENEXR_VERSION: v2.4.1
SKIP_TESTS: 1
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/gh-win-installdeps.bash
source src/build-scripts/ci-build-and-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: build/*/testsuite/*/*.*
windows-vs2017:
name: "Windows VS2017"
runs-on: windows-2016
steps:
- uses: actions/checkout@v2
- name: Setup Nuget.exe
uses: warrenbuckley/Setup-Nuget@v1
- name: all
shell: bash
env:
PYTHON_VERSION: 3.6
CMAKE_GENERATOR: "Visual Studio 15 2017 Win64"
OPENEXR_VERSION: v2.4.1
SKIP_TESTS: 1
#MY_CMAKE_FLAGS: -DUSE_PYTHON=0
USE_NINJA: 0
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/gh-win-installdeps.bash
source src/build-scripts/ci-build-and-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: build/*/testsuite/*/*.*
sanitizer:
# Run sanitizers. These don't need to run on every push. Just PRs, nightly
# builds, or if the branch name contains one of several tokens: san,
# gh, RB, release, or master.
name: "Sanitizers"
runs-on: ubuntu-18.04
if: github.event_name == 'pull_request' || github.event_name == 'schedule' || contains(github.ref, 'san') || contains(github.ref, 'RB') || contains(github.ref, 'release') || contains(github.ref, 'master') || contains(github.ref, 'gh')
container:
image: aswf/ci-osl:2020
steps:
- uses: actions/checkout@v2
- name: all
env:
CXX: g++
CC: gcc
CMAKE_CXX_STANDARD: 14
PYTHON_VERSION: 3.7
USE_PYTHON: 0
SANITIZE: address
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/gh-installdeps-centos.bash
source src/build-scripts/ci-build-and-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: build/*/testsuite/*/*.*
linux-clang9:
# Test compiling with clang9 on Linux.
name: "Linux clang: clang9 C++14 avx2 exr2.4"
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: all
env:
CXX: clang++
LLVM_VERSION: 9.0.0
CMAKE_CXX_STANDARD: 14
USE_SIMD: avx2,f16c
OPENEXR_VERSION: v2.4.1
OCIO_BRANCH: 1c624651b7
# Pick an OCIO commit that includes a warning fix we need for clang
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/gh-installdeps.bash
source src/build-scripts/ci-build-and-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: build/*/testsuite/*/*.*
linux-static:
# Test building static libs. We don't need to run this on every push --
# only run on PRs, nightly test, or if the branch name contains
# "gh", "master", "release", or "static".
name: "Linux static libs: gcc7 C++14 exr2.4"
if: github.event_name == 'pull_request' || github.event_name == 'schedule' || contains(github.ref, 'static') || contains(github.ref, 'release') || contains(github.ref, 'RB') || contains(github.ref, 'master') || contains(github.ref, 'gh')
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: all
env:
CXX: g++-7
CMAKE_CXX_STANDARD: 14
BUILD_SHARED_LIBS: OFF
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/gh-installdeps.bash
source src/build-scripts/ci-build-and-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: build/*/testsuite/*/*.*
clang-format:
# Test formatting. This test entry doesn't do a full build, it just runs
# clang-format on everything, and passes if nothing is misformatted.
# Upon failure, the build artifact will be the full source code with the
# formatting fixed (diffs will also appear in the console output).
name: "clang-format verification"
runs-on: ubuntu-18.04
container:
image: aswf/ci-osl:2021
steps:
- uses: actions/checkout@v2
- name: all
env:
BUILDTARGET: clang-format
PYTHON_VERSION: 3.7
SKIP_TESTS: 1
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/gh-installdeps-centos.bash
source src/build-scripts/ci-build-and-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: src/*/*.{cpp,h}
+3 -1
View File
@@ -2,7 +2,9 @@
branches/
build/
dist/
ext/
testsuite/runtest.pyc
src/doc/figures/
.cproject
.project
.DS_Store
+21
View File
@@ -0,0 +1,21 @@
# .readthedocs.yml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
# Required
version: 2
# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: src/doc/conf.py
# Optionally build your docs in additional formats such as PDF and ePub
formats:
- pdf
# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.7
install:
- requirements: src/doc/requirements.txt
+94 -171
View File
@@ -1,3 +1,7 @@
# Copyright 2008-present Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
# .travis.yml for OIIO
language: cpp
@@ -13,18 +17,16 @@ addons:
apt:
sources: &add-sources
- ubuntu-toolchain-r-test
- sourceline: 'ppa:jonathonf/ffmpeg-3'
packages: &common-packages
- libilmbase-dev
- libopenexr-dev
- libopencolorio-dev
- libgif-dev
- libopenjpeg-dev
- libwebp-dev
- libfreetype6-dev
- libjpeg-turbo8-dev
- dcmtk
- libavcodec-dev
- libavformat-dev
- libswscale-dev
- libavutil-dev
- locales
- python-numpy
- libraw-dev
@@ -40,6 +42,12 @@ addons:
- libboost-regex1.58
- libboost-system1.58
- libboost-thread1.58
packages: &old-boost-packages
- libboost1.55-dev
- libboost-filesystem1.55
- libboost-regex1.55
- libboost-system1.55
- libboost-thread1.55
cache:
ccache: true
@@ -55,18 +63,19 @@ before_install:
- if [ "$CXX" == "g++" ]; then export CXX="g++-${WHICHGCC}" ; fi
install:
- if [ $TRAVIS_OS_NAME == osx ] ; then
source src/build-scripts/install_homebrew_deps.bash ;
elif [ $TRAVIS_OS_NAME == linux ] ; then
CXX="ccache $CXX" source src/build-scripts/build_openexr.bash ;
CXX="ccache $CXX" source src/build-scripts/build_ocio.bash ;
fi
- if [[ $TRAVIS_OS_NAME == osx ]] ; then source src/build-scripts/install_homebrew_deps.bash ; fi
- if [[ "$BUILD_CMAKE" == "1" ]] ; then source src/build-scripts/build_cmake.bash ; fi
- if [[ "$OPENEXR_VERSION" || "$OPENEXR_BRANCH" ]] ; then CXX="ccache $CXX" source src/build-scripts/build_openexr.bash ; fi
- if [[ "$OCIO_VERSION" || "$OCIO_BRANCH" ]] ; then CXX="ccache $CXX" source src/build-scripts/build_ocio.bash ; fi
- if [[ $TRAVIS_OS_NAME == linux ]] ; then source src/build-scripts/build_pybind11.bash ; fi
- src/build-scripts/install_test_images.bash
# before_script:
script:
- src/build-scripts/ci-build-and-test.bash
- export LD_LIBRARY_PATH=$OpenImageIO_ROOT/lib:$LD_LIBRARY_PATH
- export DYLD_LIBRARY_PATH=$OpenImageIO_ROOT/lib:$DYLD_LIBRARY_PATH
- source src/build-scripts/ci-build-and-test.bash
@@ -76,113 +85,37 @@ branches:
- /RB-/
- /lg-/
matrix:
jobs:
fast_finish: true
exclude:
- os: osx
compiler: gcc
- os: linux
compiler: clang
allow_failures:
- name: "Linux ARM64"
include:
# test default compile: C++11, optimized, default compilers, SSE2
- name: "VFX Platform 2017 (gcc48, py27, exr2.2)"
os: linux
dist: trusty
compiler: gcc
env: WHICHGCC=4.8 EXRBRANCH=v2.2.0
addons:
apt:
sources: *add-sources
packages:
- *common-packages
- g++-4.8
- libboost1.55-dev
- libboost-filesystem1.55
- libboost-regex1.55
- libboost-system1.55
- libboost-thread1.55
# - name: "VFX Platform 2017 (gcc48, py27, exr2.2)"
# os: linux
# dist: trusty
# compiler: gcc
# env: WHICHGCC=4.8 OPENEXR_BRANCH=v2.2.0 BUILD_CMAKE=1
# addons:
# apt:
# sources: *add-sources
# packages:
# - *common-packages
# - *old-boost-packages
# - g++-4.8
- name: "Mac (latest clang, py37)"
os: osx
compiler: clang
env: PYTHON_VERSION=3.7
# - name: "Mac (latest clang, py37)"
# os: osx
# compiler: clang
# env: PYTHON_VERSION=3.7
# Make sure Python 2.7 still works on OSX, but only for PRs, master/RB
# pushes, or if the branch name includes "python".
- name: "Mac py27 (latest clang)"
os: osx
compiler: clang
env: PYTHON_VERSION=2.7
if: branch =~ /(master|RB|travis|python)/ OR type = pull_request
# test debug build with default compiler
- name: "Linux DEBUG"
os: linux
compiler: gcc
env: DEBUG=1 WHICHGCC=6 USE_CPP=14 USE_SIMD=sse4.2 EXRBRANCH=v2.2.0
addons:
apt:
sources: *add-sources
packages:
- *common-packages
- *common-boost-packages
- g++-6
# - os: osx
# - name: "Mac py27 (latest clang)"
# os: osx
# compiler: clang
# env: DEBUG=1
# test with C++14, gcc 6, SSE 4.2
- name: "VFX Platform 2018 (gcc6, cpp14, exr2.2), sse4.2"
os: linux
compiler: gcc
env: WHICHGCC=6 USE_CPP=14 USE_SIMD=sse4.2 EXRBRANCH=v2.2.0
addons:
apt:
sources: *add-sources
packages:
- *common-packages
- *common-boost-packages
- g++-6
# test with C++14, gcc 7, latest SIMD flags supported by TravisCI VMs
- name: "gcc7, cpp14, avx, exr2.3"
os: linux
compiler: gcc
env: WHICHGCC=7 USE_CPP=14 USE_SIMD=avx,f16c
addons:
apt:
sources: *add-sources
packages:
- *common-packages
- *common-boost-packages
- g++-7
# Test LINKSTATIC on both platforms. This is incomplete and to make it
# work we still need to disable a bunch of specific plugins.
# FIXME: Don't have LINKSTATIC working on Travis for Linux, it's
# complaining about PIC issues.
# - os: linux
# compiler: gcc
# env: LINKSTATIC=1 USE_FFMPEG=0 USE_OCIO=0 USE_OPENCV=0 MY_CMAKE_FLAGS="-DUSE_fPIC=1"
##### TEMPORARILY DISABLED -- Travis upgraded some packages and this
## is having link errors. Look into fixing this later.
## - os: osx
## osx_image: xcode8.3
## compiler: clang
## env: LINKSTATIC=1 USE_FFMPEG=0 USE_OCIO=0 USE_OPENCV=0
# Dynamic analysis: build with sanitizers and run most tests.
# Because this test takes so long to run, only build for PRs, direct
# pushes to master or RB branches, or if the branch name includes
# "sanitize". Other ordinary work branch pushes don't need to run this
# every time.
- name: "Sanitizers"
os: linux
compiler: gcc
env: WHICHGCC=6 SANITIZE=address USE_PYTHON=0
if: branch =~ /(master|RB|travis|san)/ OR type = pull_request
addons:
apt:
sources: *add-sources
packages:
- *common-packages
- *common-boost-packages
- g++-6
# env: PYTHON_VERSION=2.7
# # if: branch =~ /(master|RB|travis|python)/ OR type = pull_request
# One more, just for the heck of it, turn all SIMD off, and also make
# sure we're falling back on libjpeg, not jpeg-turbo, no OCIO support,
# and don't embed the plugins (to make sure that doesn't rust away). I
@@ -191,67 +124,57 @@ matrix:
# Only build this case for PRs, direct pushes to master or RB branches,
# or if the branch name includes "simd". Other ordinary work branch
# pushes don't need to run this.
- name: "Oldest everything: gcc4.8, boost 1.55, no simd, no jpegturbo, no OCIO, dso plugins, exr2.2"
os: linux
dist: trusty
compiler: gcc
env: WHICHGCC=4.8 USE_SIMD=0 USE_JPEGTURBO=0 USE_OCIO=0 EMBEDPLUGINS=0 EXRBRANCH=v2.2.0
if: branch =~ /(master|RB|travis|simd)/ OR type = pull_request
addons:
apt:
sources: *add-sources
packages:
- *common-packages
- g++-4.8
- libboost1.55-dev
- libboost-filesystem1.55
- libboost-regex1.55
- libboost-system1.55
- libboost-thread1.55
# test with C++14, gcc 8, latest SIMD flags supported by TravisCI VMs
# Since VFXPlatform doesn't bless gcc8 yet, only build this
# case for PRs, direct pushes to master or RB branches, or if the branch
# name includes "gcc". Other ordinary work branch pushes don't
# need to run this.
- name: "Linux gcc8 cpp14 avx"
os: linux
compiler: gcc
env: WHICHGCC=8 USE_CPP=14 USE_SIMD=avx,f16c
addons:
apt:
sources: *add-sources
packages:
- *common-packages
- *common-boost-packages
- g++-8
if: branch =~ /(master|RB|travis|gcc)/ OR type = pull_request
# test with C++17, gcc 8, latest SIMD flags supported by TravisCI VMs.
# Since VFXPlatform doesn't bless C++17 or gcc8 yet, only build this
# case for PRs, direct pushes to master or RB branches, or if the branch
# name includes "17" or "gcc". Other ordinary work branch pushes don't
# need to run this.
- name: "Linux most advanced (gcc9, cpp17, avx/f16c)"
os: linux
compiler: gcc
sudo: required
env: WHICHGCC=9 USE_CPP=17 USE_SIMD=avx,f16c
addons:
apt:
sources: *add-sources
packages:
- *common-packages
- *common-boost-packages
- g++-9
if: branch =~ /(master|RB|travis|gcc|17)/ OR type = pull_request
# - name: "Oldest everything: gcc4.8, boost 1.55, no simd, no jpegturbo, no OCIO, dso plugins, exr2.2"
# os: linux
# dist: trusty
# compiler: gcc
# env: WHICHGCC=4.8 USE_SIMD=0 USE_JPEGTURBO=0 USE_OPENCOLORIO=0 EMBEDPLUGINS=0 OPENEXR_BRANCH=v2.2.0 BUILD_CMAKE=1
# # if: branch =~ /(master|RB|travis|simd)/ OR type = pull_request
# addons:
# apt:
# sources: *add-sources
# packages:
# - *common-packages
# - *old-boost-packages
# - g++-4.8
# Note: builds for AVX2, AVX512 happen on CircleCI
# test ARM64 architecture
- name: "Linux ARM64"
os: linux
arch: arm64
dist: bionic
compiler: gcc
env: WHICHGCC=7 BUILD_CMAKE=1
addons:
apt:
#sources: *add-sources
packages:
- libuv1
- rhash
- libstdc++6
- libboost-all-dev
- libtiff-dev
- libilmbase-dev
- libopenexr-dev
- libjpeg-turbo8-dev
- libgif-dev
- libopencolorio-dev
#- libopenjpeg-dev
- libwebp-dev
- libheif-dev
#- libfreetype6-dev
#- libjpeg-turbo8-dev
- libdcmtk-dev
#- locales
#- python-numpy
- libraw-dev
- ninja-build
- python3
- libpython3-dev
- libopenvdb-dev
- libsquish-dev
- qt5-default
# Just run clang-format, this test only checks formatting rule conformance
- name: "clang-format format verification"
os: osx
compiler: clang
env: BUILDTARGET=clang-format SKIP_TESTS=1 BUILD_MISSING_DEPS=0
#if: branch =~ /(master|RB|travis|simd)/ OR type = pull_request
# Static analysis: build with clang-tidy.
# Disabled -- this takes so long to run, it can't complete in Travis's
# 50 minute time limit. Left here just to show how it should work.
+961 -33
View File
File diff suppressed because it is too large Load Diff
+237 -207
View File
@@ -1,47 +1,54 @@
cmake_minimum_required (VERSION 3.2.2)
cmake_policy (SET CMP0048 NEW) # Allow VERSION specifier in project()
project (OpenImageIO
VERSION 2.1.2
# Copyright 2008-present Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
cmake_minimum_required (VERSION 3.12)
project (OpenImageIO VERSION 2.2.5.0
HOMEPAGE_URL "https://openimageio.org"
LANGUAGES CXX C)
set (PROJ_NAME OIIO) # short name, caps
string (TOLOWER ${PROJ_NAME} PROJ_NAME_LOWER) # short name lower case
set (PROJECT_VERSION_RELEASE_TYPE "dev") # "dev", "betaX", "RCY", ""
string (TOUPPER ${PROJ_NAME} PROJ_NAME_UPPER) # short name upper case
set (PROJECT_VERSION_RELEASE_TYPE "beta2") # "dev", "betaX", "RCY", ""
set (${PROJECT_NAME}_VERSION_RELEASE_TYPE ${PROJECT_VERSION_RELEASE_TYPE})
set (PROJECT_AUTHORS "Contributors to the OpenImageIO project")
set (PROJECT_URL "http://openimageio.org")
set (${PROJECT_NAME}_SUPPORTED_RELEASE 1) # Change to 1 after release branch
# If the user wants to use Conan to build dependencies, they will have done
# this prior to the cmake config:
# cd <build area>
# conan install <source area>
# and that will leave a conanbuildinfo.cmake in the build area for us.
if (EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
include (${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
message (STATUS "Using Conan for dependencies")
conan_basic_setup()
endif()
message (STATUS "Building ${PROJECT_NAME} ${PROJECT_VERSION}")
message (STATUS "CMake version is ${CMAKE_VERSION}")
cmake_policy (SET CMP0017 NEW) # Prefer files from the CMake module directory when including from there.
cmake_policy (SET CMP0025 NEW) # Detect AppleClang for new CMake
cmake_policy (SET CMP0046 OLD) # Don't error on non-existent dependency in add_dependencies.
set (CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE)
# Alternate names
set (OIIO_VERSION_PATCH ${PROJECT_VERSION_PATCH})
set (OIIO_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set (OIIO_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set (OIIO_VERSION_RELEASE_TYPE ${PROJECT_VERSION_RELEASE_TYPE})
# N.B./FIXME - after CMake 3.0 is our minimum, we should change many of the
# add_definitions to add_compile_options. In newer cmake versions, the
# former is designated for definitions (-Dblah) and the latter is for
# compile flags (-Wno-foo).
if (VERBOSE)
message (STATUS "Project source dir = ${PROJECT_SOURCE_DIR}")
endif ()
message (STATUS "Project build dir = ${CMAKE_BINARY_DIR}")
message (STATUS "Project install dir = ${CMAKE_INSTALL_PREFIX}")
if ("${PROJECT_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
message (FATAL_ERROR "Not allowed to run in-source build!")
endif ()
if (NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE "Release")
endif ()
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set (DEBUGMODE ON)
message (STATUS "Configuring ${PROJECT_NAME} ${PROJECT_VERSION}")
message (STATUS "CMake ${CMAKE_VERSION}")
message (STATUS "CMake system = ${CMAKE_SYSTEM}")
message (STATUS "CMake system name = ${CMAKE_SYSTEM_NAME}")
message (STATUS "Project source dir = ${PROJECT_SOURCE_DIR}")
message (STATUS "Project build dir = ${CMAKE_BINARY_DIR}")
message (STATUS "Project install prefix = ${CMAKE_INSTALL_PREFIX}")
message (STATUS "Configuration types = ${CMAKE_CONFIGURATION_TYPES}")
message (STATUS "Build type = ${CMAKE_BUILD_TYPE}")
# Make the build area layout look a bit more like the final dist layout
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
if ("${PROJECT_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
message (FATAL_ERROR "Not allowed to run in-source build!")
endif ()
option (CMAKE_USE_FOLDERS "Use the FOLDER target property to organize targets into folders." ON)
@@ -50,64 +57,10 @@ if (CMAKE_USE_FOLDERS)
set_property (GLOBAL PROPERTY USE_FOLDERS ON)
endif ()
include (GNUInstallDirs)
list(APPEND CMAKE_MODULE_PATH
"${PROJECT_SOURCE_DIR}/src/cmake/modules"
"${PROJECT_SOURCE_DIR}/src/cmake")
include (oiio_macros)
include (platform)
include (compiler) # All the C++ and compiler related options live here
option (VERBOSE "Print lots of messages while compiling" OFF)
set (${PROJ_NAME}_NAMESPACE ${PROJECT_NAME} CACHE STRING
"Customized outer namespace base name (version will be added)")
option (EMBEDPLUGINS "Embed format plugins in libOpenImageIO" ON)
option (OIIO_BUILD_TOOLS "Build the command-line tools" ON)
option (OIIO_BUILD_TESTS "Build the unit tests" ON)
option (USE_OPENGL "Include OpenGL support" ON)
option (USE_QT "Include Qt support" ON)
option (USE_PYTHON "Build the Python bindings" ON)
if (NOT "$ENV{OIIO_PYTHON_VERSION}" STREQUAL "")
set (PYTHON_VERSION "$ENV{OIIO_PYTHON_VERSION}" CACHE STRING "Target version of python to find")
else()
set (PYTHON_VERSION "2.7" CACHE STRING "Target version of python to find")
endif()
option (PYLIB_INCLUDE_SONAME "If ON, soname/soversion will be set for Python module library" OFF)
option (PYLIB_LIB_PREFIX "If ON, prefix the Python module with 'lib'" OFF)
set (PYMODULE_SUFFIX "" CACHE STRING "Suffix to add to Python module init namespace")
option (USE_FIELD3D "Use Field3D if found" ON)
option (USE_OPENVDB "Use OpenVDB if found" ON)
set (OPENVDB_ROOT_DIR "" CACHE STRING "Custom OpenVDB path")
option (USE_TBB "Use Intel TBB if found" ON)
set (TBB_ROOT_DIR "" CACHE STRING "Custom Intel TBB path")
option (USE_FFMPEG "Use FFmpeg if found" ON)
set (JPEG_PATH "" CACHE STRING "Custom JPEG path")
option (USE_JPEGTURBO "Use JPEG-Turbo if found" ON)
set (JPEGTURBO_PATH "" CACHE STRING "Custom JPEG-Turbo path")
option (USE_OPENJPEG "Use OpenJpeg if found" ON)
option (USE_OCIO "Use OpenColorIO for color management if found" ON)
option (USE_OPENCV "Use OpenCV if found" ON)
option (USE_FREETYPE "Use Freetype if found" ON)
option (USE_GIF "Use GIF if found" ON)
option (USE_PTEX "Use PTex if found" ON)
option (USE_WEBP "Use WebP if found" ON)
option (USE_LIBRAW "Use LibRaw if found" ON)
set (LIBRAW_PATH "" CACHE STRING "Custom LibRaw path")
option (OIIO_THREAD_ALLOW_DCLP "OIIO threads may use DCLP for speed" ON)
option (USE_NUKE "Build Nuke plugins, if Nuke is found" ON)
set (Nuke_ROOT "" CACHE STRING "Where to find Nuke installation")
set (NUKE_VERSION 7.0)
set (USE_EXTERNAL_PUGIXML OFF CACHE BOOL
"Use an externally built shared library version of the pugixml library")
set (PUGIXML_HOME "" CACHE STRING "Hint about where to find external PugiXML library")
option (USE_DICOM "Use DICOM if DCMTK is found" ON)
option (USE_HEIF "Support HEIC/HEIF files, if libheif is found)" ON)
set (TEX_BATCH_SIZE "" CACHE STRING "Force TextureSystem SIMD batch size (e.g. 16)")
set (SOVERSION ${OIIO_VERSION_MAJOR}.${OIIO_VERSION_MINOR}
CACHE STRING "Set the SO version in the SO name of the output library")
option (${PROJ_NAME}_BUILD_TOOLS "Build the command-line tools" ON)
option (${PROJ_NAME}_BUILD_TESTS "Build the unit tests" ON)
set (OIIO_LIBNAME_SUFFIX "" CACHE STRING
"Optional name appended to ${PROJECT_NAME} libraries that are built")
option (BUILD_OIIOUTIL_ONLY "If ON, will build *only* libOpenImageIO_Util" OFF)
@@ -115,42 +68,68 @@ option (BUILD_DOCS "If ON, build documentation and man pages." ON)
option (INSTALL_DOCS "If ON, install documentation and man pages." ON)
option (INSTALL_FONTS "If ON, install default fonts" ON)
option (INSTALL_CMAKE_HELPER "If On, install FindOpenImageIO.cmake" ON)
option (EMBEDPLUGINS "Embed format plugins in libOpenImageIO" ON)
set (PLUGIN_SEARCH_PATH "" CACHE STRING "Default plugin search path")
file (TO_NATIVE_PATH "${PLUGIN_SEARCH_PATH}" PLUGIN_SEARCH_PATH_NATIVE)
set (CMAKE_DEBUG_POSTFIX "" CACHE STRING "Library naming postfix for Debug builds (e.g., '_debug')")
set(OIIO_TESTSUITE_IMAGEDIR "${PROJECT_SOURCE_DIR}/.." CACHE STRING
set(OIIO_TESTSUITE_IMAGEDIR "${PROJECT_SOURCE_DIR}/.." CACHE PATH
"Location of oiio-images, openexr-images, libtiffpic, etc.." )
option (OIIO_THREAD_ALLOW_DCLP "OIIO threads may use DCLP for speed" ON)
if (NOT OIIO_THREAD_ALLOW_DCLP)
add_definitions ("-DOIIO_THREAD_ALLOW_DCLP=0")
endif ()
set (TEX_BATCH_SIZE "" CACHE STRING "Force TextureSystem SIMD batch size (e.g. 16)")
if (TEX_BATCH_SIZE)
add_definitions ("-DOIIO_TEXTURE_SIMD_BATCH_WIDTH=${TEX_BATCH_SIZE}")
endif ()
# Set the default namespace
set (${PROJ_NAME}_NAMESPACE ${PROJECT_NAME} CACHE STRING
"Customized outer namespace base name (version will be added)")
option (${PROJ_NAME}_NAMESPACE_INCLUDE_PATCH "Should the inner namespace include the patch number" OFF)
set (PROJ_NAMESPACE "${${PROJ_NAME}_NAMESPACE}")
set (PROJ_NAMESPACE_V "${PROJ_NAMESPACE}_v${PROJECT_VERSION_MAJOR}_${PROJECT_VERSION_MINOR}")
if (OIIO_NAMESPACE_INCLUDE_PATCH)
set (PROJ_NAMESPACE_V "${PROJ_NAMESPACE_V}_${PROJECT_VERSION_PATCH}")
endif ()
message(STATUS "Setting Namespace to: ${PROJ_NAMESPACE_V}")
list (APPEND CMAKE_MODULE_PATH
"${PROJECT_SOURCE_DIR}/src/cmake/modules"
"${PROJECT_SOURCE_DIR}/src/cmake")
include (GNUInstallDirs)
include (colors)
include (check_is_enabled)
# All the C++ and compiler related options and adjustments live here
include (compiler)
include (oiio_macros)
# All the dependency finding and options are here
include (externalpackages)
include (install)
# Utilities related to finding python and making python bindings
include (pythonutils)
# We want CTest for testing, so this must be added before all the calls to
# add_subdirectory, or their add_test commands will not register.
include (CTest)
include_directories (
BEFORE
"${CMAKE_SOURCE_DIR}/src/include"
"${CMAKE_BINARY_DIR}/src/include"
"${CMAKE_BINARY_DIR}/include"
)
# We want CTest for testing
# N.B. This needs to be added before any of the subdirectories, or
# their add_test commands will not register.
include (CTest)
# Tell CMake to process the sub-directories
add_subdirectory (src/libutil)
@@ -185,14 +164,14 @@ if (NOT BUILD_OIIOUTIL_ONLY)
endif ()
if (OIIO_BUILD_TOOLS AND NOT BUILD_OIIOUTIL_ONLY)
add_subdirectory (src/iconvert)
add_subdirectory (src/idiff)
add_subdirectory (src/igrep)
add_subdirectory (src/iinfo)
add_subdirectory (src/maketx)
add_subdirectory (src/oiiotool)
add_subdirectory (src/testtex)
add_subdirectory (src/iv)
add_subdirectory (src/iconvert)
add_subdirectory (src/idiff)
add_subdirectory (src/igrep)
add_subdirectory (src/iinfo)
add_subdirectory (src/maketx)
add_subdirectory (src/oiiotool)
add_subdirectory (src/testtex)
add_subdirectory (src/iv)
endif ()
# Add IO plugin directories -- if we are not embedding plugins, we need to
@@ -205,7 +184,6 @@ if (NOT EMBEDPLUGINS AND NOT BUILD_OIIOUTIL_ONLY)
endif ()
if (USE_PYTHON AND NOT BUILD_OIIOUTIL_ONLY)
find_or_download_pybind11 ()
add_subdirectory (src/python)
endif ()
@@ -214,11 +192,20 @@ if (BUILD_DOCS)
add_subdirectory (src/doc)
endif ()
add_subdirectory (src/fonts)
add_subdirectory (src/nuke)
if (NUKE_FOUND)
add_subdirectory (src/nuke/txReader)
add_subdirectory (src/nuke/txWriter)
endif ()
# Last minute site-specific instructions, if they exist
if (OIIO_SITE AND EXISTS "${PROJECT_SOURCE_DIR}/site/${OIIO_SITE}/cmake/sitecustom.cmake")
include ("${PROJECT_SOURCE_DIR}/site/${OIIO_SITE}/cmake/sitecustom.cmake")
endif ()
# install pkgconfig file
IF ( NOT WIN32 )
configure_file(src/build-scripts/OpenImageIO.pc.in "${CMAKE_BINARY_DIR}/OpenImageIO.pc" @ONLY)
IF ( NOT MSVC )
configure_file(src/build-scripts/OpenImageIO.pc.in "${CMAKE_BINARY_DIR}/OpenImageIO.pc" @ONLY)
install (FILES "${CMAKE_BINARY_DIR}/OpenImageIO.pc"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
COMPONENT developer)
@@ -229,6 +216,44 @@ install (FILES src/cmake/modules/FindOpenImageIO.cmake
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/Modules
COMPONENT cmake)
# Export the configuration files. There are also library-specific config
# exports in the CMakeLists.txt of libOpenImageIO.
include (CMakePackageConfigHelpers)
# the file containing the exported targets
set (OIIO_TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets.cmake")
# the version file
set (OIIO_VERSION_CONFIG "${CMAKE_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake")
# the config file that is actually looked for by find_package
set (OIIO_PROJECT_CONFIG "${CMAKE_BINARY_DIR}/${PROJECT_NAME}Config.cmake")
# where all these files will be installed
set (OIIO_CONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
# first generate the version file in the binary dir
write_basic_package_version_file (
${OIIO_VERSION_CONFIG}
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion)
# generate the Targets file in the binary dir using the targets collected in
# OIIO_EXPORTED_TARGETS each target is added to OIIO_EXPORTED_TARGETS
# through the macro install_target().
export (EXPORT OIIO_EXPORTED_TARGETS FILE "${CMAKE_BINARY_DIR}/${OIIO_TARGETS_EXPORT_NAME}")
# generate the config file from the template in the binary dir
configure_package_config_file ("${PROJECT_SOURCE_DIR}/src/cmake/Config.cmake.in"
"${OIIO_PROJECT_CONFIG}"
INSTALL_DESTINATION "${OIIO_CONFIG_INSTALL_DIR}")
# generate the config file from the template in the binary dir
install (FILES "${OIIO_PROJECT_CONFIG}" "${OIIO_VERSION_CONFIG}"
DESTINATION "${OIIO_CONFIG_INSTALL_DIR}")
# install targets files
install (EXPORT OIIO_EXPORTED_TARGETS
DESTINATION ${OIIO_CONFIG_INSTALL_DIR}
FILE ${OIIO_TARGETS_EXPORT_NAME}
NAMESPACE ${PROJECT_NAME}::)
#########################################################################
@@ -252,23 +277,24 @@ install (FILES src/cmake/modules/FindOpenImageIO.cmake
# Make a build/platform/testsuite directory, and copy the master runtest.py
# there. The rest is up to the tests themselves.
file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/testsuite")
add_custom_command (OUTPUT "${CMAKE_BINARY_DIR}/testsuite/runtest.py"
file (MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/testsuite")
file (COPY "${CMAKE_CURRENT_SOURCE_DIR}/testsuite/common"
DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/testsuite")
add_custom_command (OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/testsuite/runtest.py"
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${CMAKE_SOURCE_DIR}/testsuite/runtest.py"
"${CMAKE_BINARY_DIR}/testsuite/runtest.py"
MAIN_DEPENDENCY "${CMAKE_SOURCE_DIR}/testsuite/runtest.py")
add_custom_target ( CopyFiles ALL DEPENDS "${CMAKE_BINARY_DIR}/testsuite/runtest.py" )
"${CMAKE_CURRENT_SOURCE_DIR}/testsuite/runtest.py"
"${CMAKE_CURRENT_BINARY_DIR}/testsuite/runtest.py"
MAIN_DEPENDENCY "${CMAKE_CURRENT_SOURCE_DIR}/testsuite/runtest.py")
add_custom_target ( CopyFiles ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/testsuite/runtest.py" )
# Basic tests that apply even to continuous integration tests:
# Tests that require oiio-images:
oiio_add_tests (gpsread
oiiotool oiiotool-attribs oiiotool-readerror oiiotool-xform
oiiotool oiiotool-attribs oiiotool-copy
oiiotool-readerror oiiotool-xform
oiiotool-fixnan ## maketx & oiiotool-maketx depend on this
maketx oiiotool-maketx
misnamed-file
missingcolor
dpx ico iff png psd rla sgi zfile
texture-interp-bicubic
texture-blurtube
texture-crop texture-cropover
@@ -281,25 +307,20 @@ oiio_add_tests (gpsread
texture-fat texture-skinny texture-wrapfill
texture-missing texture-res texture-maxres
texture-udim texture-udim2
IMAGEDIR oiio-images
)
# Tests that require openexr-images:
oiio_add_tests (oiiotool-deep
IMAGEDIR openexr-images
)
IMAGEDIR oiio-images URL "Recent checkout of oiio-images"
)
# Remaining freestanding tests:
oiio_add_tests (nonwhole-tiles
oiiotool-composite oiiotool-copy
oiiotool-composite
oiiotool-pattern
oiiotool-subimage oiiotool-text
diff
dither dup-channels
jpeg-corrupt
null psd-colormodes
null
rational
)
)
# Travis + old libjpeg seems to not catch an error in this test, skip it
# for that case.
@@ -315,96 +336,105 @@ endif()
# We also exclude these tests if this is a sanitizer build on Linux,
# because the Python interpreter itself won't be linked with the right asan
# libraries to run correctly.
if (USE_PYTHON AND NOT BUILD_OIIOUTIL_ONLY)
if (NOT SANITIZE_ON_LINUX)
oiio_add_tests (
python-typedesc python-paramlist
python-imagespec python-roi python-deep python-colorconfig
python-imageinput python-imageoutput
python-imagebuf python-imagebufalgo
IMAGEDIR oiio-images
if (USE_PYTHON AND NOT BUILD_OIIOUTIL_ONLY AND NOT SANITIZE_ON_LINUX)
oiio_add_tests (
python-typedesc python-paramlist
python-imagespec python-roi python-deep python-colorconfig
python-imageinput python-imageoutput
python-imagebuf python-imagebufalgo
IMAGEDIR oiio-images
)
endif ()
endif ()
# Add tests that require OCIO
if (USE_OCIO AND OCIO_FOUND)
oiio_add_tests (oiiotool-color)
endif ()
oiio_add_tests (oiiotool-color
FOUNDVAR OPENCOLORIO_FOUND)
# Advanced tests that are done by hand and for releases:
# FIXME -- at some point, try to fix these or provide new ref images
if (NOT DEFINED ENV{TRAVIS})
oiio_add_tests (
texture-half texture-uint16
texture-interp-bilinear
texture-interp-closest
texture-mip-onelevel
)
oiio_add_tests (
texture-half texture-uint16
texture-interp-bilinear
texture-interp-closest
texture-mip-onelevel
)
endif ()
if (NOT DEFINED ENV{TRAVIS} AND NOT DEFINED ENV{CIRCLECI})
oiio_add_tests (texture-icwrite )
if (NOT DEFINED ENV{TRAVIS} AND NOT DEFINED ENV{CIRCLECI} AND NOT DEFINED ENV{GITHUB_ACTIONS})
oiio_add_tests (texture-icwrite)
endif ()
# List testsuites which need special external reference images from the web
# here:
# List testsuites for specific formats or features which might be not found
# or be intentionally disabled, or which need special external reference
# images from the web that if not found, should skip the tests:
oiio_add_tests (bmp
IMAGEDIR bmpsuite
URL http://entropymine.com/jason/bmpsuite/bmpsuite.zip)
oiio_add_tests (tiff-suite tiff-depths tiff-misc
IMAGEDIR libtiffpic
URL http://www.simplesystems.org/libtiff/images.html)
oiio_add_tests (openexr-suite openexr-multires openexr-chroma openexr-v2 perchannel
IMAGEDIR openexr-images
URL http://www.openexr.com/downloads.html)
oiio_add_tests (gif
FOUNDVAR GIF_FOUND
IMAGEDIR oiio-images
URL "Recent checkout of oiio-images")
oiio_add_tests (jpeg2000
FOUNDVAR OPENJPEG_FOUND
IMAGEDIR j2kp4files_v1_5
URL http://www.itu.int/net/ITU-T/sigdb/speimage/ImageForm-s.aspx?val=10100803)
oiio_add_tests (pnm
IMAGEDIR oiio-images/pnm
URL "Recent checkout of oiio-images")
oiio_add_tests (raw
FOUNDVAR LIBRAW_FOUND
IMAGEDIR oiio-images/raw
URL "Recent checkout of oiio-images")
oiio_add_tests (targa-tgautils
IMAGEDIR TGAUTILS
URL http://tgautils.inequation.org/)
ENABLEVAR ENABLE_BMP
IMAGEDIR bmpsuite
URL http://entropymine.com/jason/bmpsuite/bmpsuite.zip)
oiio_add_tests (dpx
ENABLEVAR ENABLE_DPX
IMAGEDIR oiio-images URL "Recent checkout of oiio-images")
oiio_add_tests (field3d texture-field3d
FOUNDVAR Field3D_FOUND ENABLEVAR ENABLE_FIELD3D)
oiio_add_tests (fits
IMAGEDIR fits-images
URL http://www.cv.nrao.edu/fits/data/tests/)
ENABLEVAR ENABLE_FITS
IMAGEDIR fits-images
URL http://www.cv.nrao.edu/fits/data/tests/)
oiio_add_tests (gif
FOUNDVAR GIF_FOUND ENABLEVAR ENABLE_GIF
IMAGEDIR oiio-images URL "Recent checkout of oiio-images")
oiio_add_tests (heif
FOUNDVAR LIBHEIF_FOUND
URL https://github.com/nokiatech/heif/tree/gh-pages/content)
oiio_add_tests (webp
FOUNDVAR WEBP_FOUND
IMAGEDIR oiio-images/webp
URL "Recent checkout of oiio-images")
oiio_add_tests (ptex
FOUNDVAR PTEX_FOUND)
oiio_add_tests (texture-field3d field3d
FOUNDVAR FIELD3D_FOUND)
FOUNDVAR Libheif_FOUND ENABLEVAR ENABLE_Libheif
URL https://github.com/nokiatech/heif/tree/gh-pages/content)
oiio_add_tests (ico
ENABLEVAR ENABLE_ICO
IMAGEDIR oiio-images URL "Recent checkout of oiio-images")
oiio_add_tests (iff
ENABLEVAR ENABLE_IFF
IMAGEDIR oiio-images URL "Recent checkout of oiio-images")
oiio_add_tests (jpeg2000
FOUNDVAR OPENJPEG_FOUND
IMAGEDIR j2kp4files_v1_5
URL http://www.itu.int/net/ITU-T/sigdb/speimage/ImageForm-s.aspx?val=10100803)
oiio_add_tests (openexr-suite openexr-multires openexr-chroma
openexr-v2 openexr-window openexr-damaged perchannel
oiiotool-deep
IMAGEDIR openexr-images
URL http://www.openexr.com/downloads.html)
oiio_add_tests (openvdb
FOUNDVAR OPENVDB_FOUND)
FOUNDVAR OpenVDB_FOUND ENABLEVAR ENABLE_OpenVDB)
oiio_add_tests (png
ENABLEVAR ENABLE_PNG
IMAGEDIR oiio-images URL "Recent checkout of oiio-images")
oiio_add_tests (pnm
ENABLEVAR ENABLE_PNM
IMAGEDIR oiio-images URL "Recent checkout of oiio-images")
oiio_add_tests (psd psd-colormodes
ENABLEVAR ENABLE_PSD
IMAGEDIR oiio-images URL "Recent checkout of oiio-images")
oiio_add_tests (ptex
FOUNDVAR PTEX_FOUND ENABLEVAR ENABLE_PTEX)
oiio_add_tests (raw
FOUNDVAR LIBRAW_FOUND ENABLEVAR ENABLE_LIBRAW
IMAGEDIR oiio-images/raw
URL "Recent checkout of oiio-images")
oiio_add_tests (rla
ENABLEVAR ENABLE_RLA
IMAGEDIR oiio-images URL "Recent checkout of oiio-images")
oiio_add_tests (sgi
ENABLEVAR ENABLE_SGI
IMAGEDIR oiio-images URL "Recent checkout of oiio-images")
oiio_add_tests (targa-tgautils
ENABLEVAR ENABLE_TARGA
IMAGEDIR oiio-images URL "Recent checkout of oiio-images")
oiio_add_tests (tiff-suite tiff-depths tiff-misc
IMAGEDIR libtiffpic
URL http://www.simplesystems.org/libtiff/images.html)
oiio_add_tests (webp
FOUNDVAR Webp_FOUND ENABLEVAR ENABLE_Webp
IMAGEDIR oiio-images/webp URL "Recent checkout of oiio-images")
oiio_add_tests (zfile ENABLEVAR ENABLE_ZFILE
IMAGEDIR oiio-images URL "Recent checkout of oiio-images")
if (SPI_TESTS)
oiio_add_tests (oiiotool-spi
@@ -425,7 +455,7 @@ set (CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
set (CPACK_PACKAGE_VENDOR ${PROJECT_AUTHORS})
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "OpenImageIO is an open source library for reading and writing image file formats, a nice format-agnostic image viewer, and other image-related classes and utilities.")
set (CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_SOURCE_DIR}/src/doc/Description.txt")
set (CPACK_PACKAGE_FILE_NAME ${PROJECT_NAME}-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}-${platform})
set (CPACK_PACKAGE_FILE_NAME ${PROJECT_NAME}-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR})
#SET (CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_SOURCE_DIR}")
file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/cpack")
file (COPY "${PROJECT_SOURCE_DIR}/LICENSE.md" DESTINATION "${CMAKE_BINARY_DIR}/cpack")
+13 -8
View File
@@ -23,16 +23,22 @@ For announcements about major OIIO releases or other important news.
You can sign up for these mail lists on your own using the links above.
How to Ask for Help
-------------------
If you have trouble installing, building, or using OpenImageIO, but there's
not yet reason to suspect you've encountered a genuine bug, start by posting
a question to the
[oiio-dev](http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org)
mailing list. This is the place for question such has "How do I...".
Bug Reports and Issue Tracking
------------------------------
We use GitHub's issue tracking system for bugs and enhancements:
https://github.com/OpenImageIO/oiio/issues
**If you are merely asking a question ("how do I...")**, please do not file
an issue, but instead ask the question on the
[OIIO developer mail list](http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org).
If you are submitting a bug report, please be sure to note which version of
OIIO you are using, on what platform (OS/version, which compiler you used,
and any special build flags or other unusual environmental issues). Please
@@ -42,7 +48,9 @@ give a specific an account of
* what happened
* what you expected to happen instead
with enough detail that others can reproduce the problem.
with enough detail that others can reproduce the problem. Please quote the
exact error message you received. If you are having trouble building, please
post the full cmake output of a fresh VERBOSE=1 build.
Suspected security vulnerabilities should be reported by the same process.
@@ -234,9 +242,6 @@ For public APIs we tend to use Doxygen-style comments (start with `///`).
They looks like this:
/// Explanation of a class. Note THREE slashes!
/// Also, you need at least two lines like this. If you don't have enough
/// for two lines, make one line blank like this:
///
class myclass {
....
float foo; ///< Doxygen comments on same line look like this
+15 -1
View File
@@ -7,18 +7,22 @@ lg@openimageio.org
* Akihiro Yamasaki
* Alan Jones
* Alejandro Conty
* Alex Hughes
* Alex Schworer
* Alexander Kuleshov
* Alexander Murashko
* Alexandre Gauthier
* Alexis Oblet
* Alexy Pawlow
* Aman Shah
* Ananth Garre
* Arkady Shapkin
* Basileios Anastasatos
* Bastien Montagne
* Ben De Luca
* Biswapriyo Nath
* Blair Tennessy
* Blazej Floch
* Brecht Van Lommel
* Brent Davis
* Brian Hall
@@ -43,11 +47,14 @@ lg@openimageio.org
* Dinko Galetik
* Dominik Bartkiewicz
* Duncan Chan
* Dustin Rodrigues
* Edgar Velazquez-Armendariz
* Eloi Du Bois
* Elvic Liang
* Fabien Castan
* Fabien Servant
* Frédéric Devernay
* Fredrik Averpil
* Ghislain Antony Vaillant
* Gonzalo Garramuño
* Grégoire De Lillo
@@ -56,17 +63,21 @@ lg@openimageio.org
* Hanspeter Niederstrasser
* Heiko Becker
* Henri Fousse
* Harry Mallon
* Hugh Macdonald
* Imarz
* Irena Damsky
* Ismael Cortes
* Jep Hill
* Jeph Alapat
* Jens Lindgren
* Jeremy Rose
* Jeremy Selan
* Joesph Goldstone
* Jim Hourihan
* John Burnett
* John Haddon
* Jonathan Scruggs
* Joseph Goldstone
* Julien Enche
* Justin Israel
* Justina Mikonyte
@@ -102,6 +113,7 @@ lg@openimageio.org
* Nandan Dubey
* Nathan Rusch
* Nicholas Yue
* Nick Black
* Nicolas Burtnyk
* Nixon Kwok
* Nuno Cardoso
@@ -114,6 +126,7 @@ lg@openimageio.org
* Philip Nemec
* Pino Toscano
* Puneet Jain
* Radu Arjocu
* Ramon Montoya
* Ray Molenkamp
* Richard Shaw
@@ -137,6 +150,7 @@ lg@openimageio.org
* Thiago Ize
* Thomas Dinges
* Thomas Mansencal
* Till Dechent
* Tim D. Smith
* Tim Grant
* Troy James Sobotka
+145 -48
View File
@@ -1,10 +1,66 @@
Installation instructions for OpenImageIO
=========================================
For the most up-to-date build instructions (and in any case somewhat
more detailed than here), please see our wiki:
# Table of Contents
1. [OpenImageIO's Dependences](#dependencies)
2. [Installing binaries from package managers](#installingfrompackagemanagers)
3. [Building OIIO from source](#buildingfromsource)
Dependencies
------------
NEW or CHANGED MINIMUM dependencies since the last major release are **bold**.
### Required dependencies -- OIIO will not build at all without these
* C++11 (also builds with C++14 and C++17)
* Compilers: gcc 4.8.2 - 10.2, clang 3.3 - 10.0, MSVS 2015 - 2019,
icc version 13 or higher
* CMake >= 3.12 (tested through 3.18)
* OpenEXR >= 2.0 (recommended: 2.2 or higher; tested through 2.5)
* libTIFF >= 3.9 (recommended: 4.0+; tested through 4.1.0)
### Optional dependencies -- features may be disabled if not found
* If you are building the `iv` viewer (which will be disabled if any of
these are not found):
* Qt >= 5.6 (tested through 5.15)
* OpenGL
* If you are building the Python bindings or running the testsuite:
* Python >= 2.7 (tested against 2.7, 3.6, 3.7, 3.8)
* pybind11 >= 2.4.2 (Tested through 2.5.)
* NumPy
* If you want support for camera "RAW" formats:
* LibRaw >= 0.15 (tested 0.15 - 0.20; LibRaw >= 0.18 is necessary for
ACES support and much better recognition of camera metadata)
* If you want support for a wide variety of video formats:
* ffmpeg >= 2.6 (tested through 4.3)
* If you want support for jpeg 2000 images:
* **OpenJpeg >= 2.0** (tested through 2.3)
* If you want support for Field3D files:
* Field3D
* If you want support for OpenVDB files:
* OpenVDB >= 5.0 (tested through 7.0) and Intel TBB >= 2018 (tested
through 2020_U1)
* If you want support for converting to and from OpenCV data structures,
or for capturing images from a camera:
* OpenCV 2.x, 3.x, or 4.x (tested through 4.3)
* If you want support for GIF images:
* giflib >= 4.1 (tested through 5.2; 5.0+ is strongly recommended for
stability and thread safety)
* If you want support for HEIF/HEIC images:
* libheif >= 1.3 (tested through 1.6; older versions may also work, we
haven't tested)
* If you want support for DDS files:
* libsquish >= 1.13 (tested through 1.15)
* But... if not found on the system, an embedded version will be used.
* If you want support for DICOM medical image files:
* DCMTK >= 3.6.1 (tested through 3.6.5)
* If you want support for OpenColorIO color transformations:
* OpenColorIO >= 1.1 (also tested against the current master that will
become OCIO 2.0).
https://sites.google.com/site/openimageio/checking-out-and-building-openimageio
Supported platforms at present include Linux (32 and 64 bit),
Mac OS X, and Windows.
@@ -18,54 +74,90 @@ to the 'lib' directory where OpenImageIO is installed, or else it will
not be able to find the plugins.
Dependencies
------------
Installing from package managers
================================
NEW or CHANGED MINIMUM dependencies since the last major release are **bold**.
If all you want to do is install the OIIO libraries, headers, and command
line tools as quickly as possible (don't need OIIO source or any custom
build options), maybe one of these packages managers will do it for you:
### Required dependencies -- OIIO will not build at all without these
* vckpg (https://github.com/Microsoft/vcpkg)
* https://github.com/Microsoft/vcpkg/tree/master/ports/openimageio
* `.\vcpkg install openimageio [tools]`
* For a full list of supported build features: `.\vcpkg search openimageio`
* homebrew (https://github.com/Homebrew/brew)
* https://formulae.brew.sh/formula/openimageio
* `brew install openimageio`
* macports (https://github.com/macports/macports-ports)
* https://www.macports.org/ports.php?by=name&substr=openimageio
* `port install openimageio`
* fink (https://github.com/fink/fink)
* http://pdb.finkproject.org/pdb/package.php/libopenimageio2.1-shlibs
* `fink install openimageio`
* conan (https://github.com/conan-io/conan)
* C++11 (also builds with C++14 and C++17)
* Compilers: gcc 4.8.2 - 9.1, clang 3.3 - 8.0, **MSVS 2015 - 2019**,
icc version 13 or higher
* Boost >= 1.53 (tested up through 1.70)
* CMake >= 3.2.2 (tested up through 3.14)
* OpenEXR >= 2.0 (recommended: 2.2 or 2.3)
* libTIFF >= 3.9 (recommended: 4.0+)
If these work for you and it's all you need, bingo! You are done.
Building from source
====================
Dependency control and disabling components
-------------------------------------------
**Hints for finding dependencies**
For each external dependency PkgName, our CMake build system will recognize
the following optional variable:
PkgName_ROOT=...
to specify a hint about where the package is installed. It can either be
a CMake variable (set by `-DPkgName_ROOT=...` on the CMake command line),
or an environment variable of the same name, or a variable setting on the
Make wrapper (`make PkgName_ROOT=...`).
**Disabling optional dependencies and individual components**
`USE_PYTHON=0` : Omits building the Python bindings.
`OIIO_BUILD_TESTS=0` : Omits building tests (you probably don't need them
unless you are a developer of OIIO or want to verify that your build
passes all tests).
`OIIO_BUILD_TOOLS=0` : Disables building all the command line tools (such
as iinfo, oiiotool, maketx, etc.).
`ENABLE_toolname=0` : Disables building the named command line tool (iinfo,
oiiotool, etc.). This works both as a CMake variable and also as an
environment variable.
`ENABLE_formatname=0` : Disables building support for the particular named
file format (jpeg, fits, png, etc.). This works both as a CMake variable and
also as an environment variable.
`ENABLE_PkgName=0` : Disables use of an *optional* dependency (such as
FFmpeg, Field3D, Webp, etc.) -- even if the dependency is found on the
system. This will obviously disable any functionality that requires the
dependency. This works both as a CMake variable and
also as an environment variable.
### Optional dependencies -- features may be disabled if not found
* If you are building the `iv` viewer (which will be disabled if any of
these are not found):
* Qt >= 5.6
* OpenGL
* If you are building the Python bindings or running the testsuite:
* Python >= 2.7 (tested against 2.7, 3.6, 3.7)
* **NumPy**
* **pybind11 >= 2.2.0** (but OIIO will auto-download it if not found)
* If you want support for camera "RAW" formats:
* libRaw >= 0.15 (tested 0.15 - 0.19; libRaw >= 0.18 is necessary for
ACES support and much better recognition of camera metadata)
* If you want support for a wide variety of video formats:
* ffmpeg >= 2.6 (tested through 4.1)
* If you want support for jpeg 2000 images:
* OpenJpeg >= 1.5 (tested through 2.3; version 2.0+ is strongly recommended)
* If you want support for Field3D files:
* Field3D
* If you want support for OpenVDB files:
* OpenVDB >= 5.0 and Intel TBB >= 2018
* If you want support for converting to and from OpenCV data structures,
or for capturing images from a camera:
* OpenCV 2.x, 3.x, or 4.x
* If you want support for HEIF/HEIC images:
* libheic >= 1.3 (older versions may work, we haven't tested)
Building OpenImageIO on Linux or OS X
-------------------------------------
The following dependencies must be installed to build the core of
OpenImageIO: Boost, libjpeg, libtiff, libpng and OpenEXR. These can be
installed using the standard package managers on your system.
OpenImageIO:
* Boost
* libjpeg
* libtiff
* libpng
* OpenEXR.
These can be installed using the standard package managers on your system.
Optionally, to build the image viewing tools, you will need Qt and OpenGL.
On OS X, these dependencies can be installed using Fink, MacPorts or
@@ -87,9 +179,9 @@ directories must notify the CMake system using environment variables.
For example, set QTDIR to point at the root of the Qt library location
so that CMake can find it (see CMake configuration output).
On Linux and OS X, you can build from source from the top-level
**On Linux and OS X, you can build from source from the top-level
directory by just typing 'make'. (Yes, we have a 'make' wrapper around
our CMake build, it simplifies things.)
our CMake build, it simplifies things.)**
During the make, various temporary files (object files, etc.) will
be put in build/PLATFORM, where 'PLATFORM' will be the name of the
@@ -108,7 +200,6 @@ Make targets you should know about:
| make realclean | Get rid of both build/PLATFORM and dist/PLATFORM |
| make nuke | Get rid of all build/ and dist/, for all platforms |
| make profile | Build a profilable version dist/PLATFORM.profile |
| make doxygen | Build the Doxygen docs |
| make help | Print all the make options |
Additionally, a few helpful modifiers alter some build-time options:
@@ -122,7 +213,7 @@ Additionally, a few helpful modifiers alter some build-time options:
| make USE_QT=0 ... | Skip anything that needs Qt |
| make MYCC=xx MYCXX=yy ... | Use custom compilers |
| make USE_PYTHON=0 ... | Don't build the Python binding |
| make BUILDSTATIC=1 ... | Build static library instead of shared |
| make BUILD_SHARED_LIBS=0 | Build static library instead of shared |
| make LINKSTATIC=1 ... | Link with static external libraries when possible |
| make SOVERSION=nn ... | Include the specifed major version number in the shared object metadata |
| make NAMESPACE=name | Wrap everything in another namespace |
@@ -136,7 +227,7 @@ CMake directly:
cd build
cmake ..
If the compile stops because of warnings, try again with
If the compile stops because of warnings, try again with
make nuke
make STOP_ON_WARNING=0
@@ -152,8 +243,7 @@ or, if you are using CMake directly,
Building on Windows
-------------------
See the latest Windows build docs on our web site:
https://sites.google.com/site/openimageio/building-oiio-on-windows
**Method 1 - Default**
1. Check out the trunk or a branch of your choice. The remainder of
these instructions assume that you checked out the trunk to the
@@ -239,6 +329,13 @@ D:\OIIO\external\dist\windows\zlib-1.2.3 directory. If it can't find
ZLIB and PNG, add
D:\OIIO\external\dist\windows\zlib-1.2.3;D:\OIIO\external\dist\windows\libpng-1.2.3.
**Method 2 - Using vcpkg**
1. Visit Microsoft's vcpkg GitHub page: https://github.com/Microsoft/vcpkg. Also note that the openimageio package is located here: https://github.com/Microsoft/vcpkg/tree/master/ports/openimageio
2. Follow vcpkg installation instructions and complete the install. Please note vcpkg has its own list of prerequisites listed on their page.
3. Execute the PowerShell command from where vcpkg is located in directory. ``.\vcpkg install openimageio``
Test Images
-----------
+206 -421
View File
@@ -9,40 +9,179 @@ In no particular order:
-------------------------------------------------------------------------
The initial (version 0.1) code found in imageio.h, fmath.h, filter.h,
argparse, and the JPEG reader/writer had elements derived from BSD-licensed
example code from NVIDIA's Gelato Renderer.
BSD 3-Clause License
SPDX-License-Identifier: BSD-3-Clause
It's not clear that any of that original code still survives in the modern
OIIO, but since some elements are derive works from that, we still reproduce
the original copyright here:
* Gelato, Copyright (c) 2004 by NVIDIA Corp.
Copyright (c) 2004 by NVIDIA Corp.
The initial (version 0.1) code found in imageio.h, fmath.h, filter.h,
argparse, and the JPEG reader/writer had elements derived from
BSD-licensed example code and headers from NVIDIA's Gelato Renderer. It's
not clear that any of that original code still survives in the modern
OIIO, but since some elements are derived from that, we still acknowledge
the original copyright here.
Standard 3-clause BSD license: https://opensource.org/licenses/BSD-3-Clause
* Open Shading Language. Copyright Sony Pictures Imageworks Inc.
A few parts here and there, notably parts of fmath.h and many of the CMake
files, contain code that was originally developed for Open Shading
Language but subsequently moved to OIIO.
* DPX reader/writer (c) Copyright 2009 Patrick A. Palmer.
https://github.com/patrickpalmer/dpx
* KissFFT (c) Copyright 2003-2010 Mark Borgerding
https://github.com/mborgerding/kissfft
* FindOpenVDB.cmake (c) Copyright 2015 Blender Foundation, BSD license.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-------------------------------------------------------------------------
A few parts here and there, notably parts of fmath.h and many of the
CMake files, contain code that was originally developed for Open Shading
Language but subsequently moved to OIIO. Those portions are
BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
SPDX-License-Identifier: BSD-2-Clause
Copyright (c) 2009-2014 Sony Pictures Imageworks Inc.
* xxHash - Fast Hash algorithm
Copyright (C) 2012-2014, Yann Collet.
You can contact the author at :
- xxHash source repository : https://github.com/Cyan4973/xxHash
- public discussion board : https://groups.google.com/forum/#!forum/lz4c
Standard 3-clause BSD license: https://opensource.org/licenses/BSD-3-Clause
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-------------------------------------------------------------------------
The SHA-1 implemenation we use is public domain by Dominik Reichl.
http://www.dominik-reichl.de/
MIT License
SPDX-License-Identifier: MIT
* Squish
Copyright 2006 Simon Brown si@sjbrown.co.uk
http://sjbrown.co.uk/?code=squish
* PugiXML http://pugixml.org/ https://github.com/zeux/pugixml
Copyright (c) 2006-2018 Arseny Kapoulkine
* FarmHash, by Geoff Pike https://github.com/google/farmhash
(c) Copyright 2014 Google, Inc., MIT license.
* FindTBB.cmake. Copyright (c) 2015 Justus Calvin
* {fmt} library - https://github.com/fmtlib/fmt
Copyright (c) 2012 - present, Victor Zverovich
* UTF-8 decoder function from http://bjoern.hoehrmann.de/utf-8/decoder/dfa/
Copyright (c) 2008-2009 Bjoern Hoehrmann <bjoern@hoehrmann.de>
* fasthash
Copyright (C) 2012 Zilong Tan (eric.zltan@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-------------------------------------------------------------------------
Some math functions in fmath.h are derived from the
[Sleef library](https://sleef.org), which uses the Boost license.
Apache 2.0 License.
SPDX-License-Identifier: Apache-2.0
Copyright Naoki Shibata and contributors 2010 - 2017.
https://github.com/shibatch/sleef/blob/master/LICENSE.txt
* CTPL thread pool https://github.com/vit-vit/CTPL
Copyright 2014 Vitaliy Vitsentiy.
* Droid fonts from the Android SDK. http://www.droidfonts.com
Copyright Google, Inc.
* function_view.h contains code derived from LLVM. https://llvm.org
Copyright (c) 2003-2018 University of Illinois at Urbana-Champaign.
This is licensed under the Apache 2.0 license with LLVM Exceptions.
https://llvm.org/docs/DeveloperPolicy.html#open-source-licensing-terms
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-------------------------------------------------------------------------
Boost Software License - Version 1.0
SPDX-License-Identifier: BSL-1.0
* Some math functions in fmath.h are derived from the
[Sleef library](https://sleef.org)
Copyright Naoki Shibata and contributors 2010 - 2017.
https://github.com/shibatch/sleef/blob/master/LICENSE.txt
Boost Software License - Version 1.0 - August 17th, 2003
@@ -70,410 +209,12 @@ DEALINGS IN THE SOFTWARE.
-------------------------------------------------------------------------
Squish Copyright 2006 Simon Brown, MIT license.
http://sjbrown.co.uk/?code=squish
Copyright (c) 2006 Simon Brown, si@sjbrown.co.uk
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-------------------------------------------------------------------------
PugiXML http://pugixml.org/ https://github.com/zeux/pugixml
MIT License
Copyright (c) 2006-2018 Arseny Kapoulkine
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
-------------------------------------------------------------------------
DPX reader/writer (c) Copyright 2009 Patrick A. Palmer, BSD 3-clause license.
https://github.com/patrickpalmer/dpx
Copyright (c) 2009, Patrick A. Palmer.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of Patrick A. Palmer nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-------------------------------------------------------------------------
tinyformat.h http://github.com/c42f/tinyformat
Copyright (C) 2011, Chris Foster
Boost Software License - Version 1.0
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
-------------------------------------------------------------------------
lookup3 code by Bob Jenkins, Public Domain.
http://burtleburtle.net/bob/c/lookup3.c
-------------------------------------------------------------------------
xxHash - Fast Hash algorithm
Copyright (C) 2012-2014, Yann Collet.
BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
You can contact the author at :
- xxHash source repository : https://github.com/Cyan4973/xxHash
- public discussion board : https://groups.google.com/forum/#!forum/lz4c
-------------------------------------------------------------------------
farmhash (c) Copyright 2014 Google, Inc., MIT license.
https://github.com/google/farmhash
Copyright (c) 2014 Google, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
FarmHash, by Geoff Pike
-------------------------------------------------------------------------
KissFFT (c) Copyright 2003-2010 Mark Borgerding, 3-clause BSD license.
https://github.com/mborgerding/kissfft
Copyright (c) 2003-2010 Mark Borgerding
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the author nor the names of any contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-------------------------------------------------------------------------
CTPL thread pool https://github.com/vit-vit/CTPL
Copyright 2014 Vitaliy Vitsentiy.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-------------------------------------------------------------------------
Droid fonts from the Android SDK. http://www.droidfonts.com
Copyright Google, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-------------------------------------------------------------------------
function_view.h contains code derived from LLVM. https://llvm.org
University of Illinois/NCSA Open Source License
Copyright (c) 2003-2018 University of Illinois at Urbana-Champaign.
All rights reserved.
Developed by:
LLVM Team
University of Illinois at Urbana-Champaign
http://llvm.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal with the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimers.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimers in the
documentation and/or other materials provided with the distribution.
* Neither the names of the LLVM Team, University of Illinois at
Urbana-Champaign, nor the names of its contributors may be used to
endorse or promote products derived from this Software without specific
prior written permission.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
WITH THE SOFTWARE.
-------------------------------------------------------------------------
FindOpenVDB.cmake (c) Copyright 2015 Blender Foundation, BSD license.
Copyright 2015 Blender Foundation.
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
-------------------------------------------------------------------------
FindTBB.cmake
The MIT License (MIT)
Copyright (c) 2015 Justus Calvin
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-------------------------------------------------------------------------
{fmt} library - https://github.com/fmtlib/fmt
Copyright (c) 2012 - 2016, Victor Zverovich
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-------------------------------------------------------------------------
UTF-8 decoder function from http://bjoern.hoehrmann.de/utf-8/decoder/dfa/
The MIT License
Copyright (c) 2008-2009 Bjoern Hoehrmann <bjoern@hoehrmann.de>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
-------------------------------------------------------------------------
Base-64 encoder from http://www.adp-gmbh.ch/cpp/common/base64.html
https://github.com/ReneNyffenegger/cpp-base64
Zlib license
SPDX-License-Identifier: Zlib
* Base-64 encoder from http://www.adp-gmbh.ch/cpp/common/base64.html
Copyright (C) 2004-2008 René Nyffenegger
Copyright (C) 2004-2008 René Nyffenegger
This source code is provided 'as-is', without any express or implied
warranty. In no event will the author be held liable for any damages
@@ -495,5 +236,49 @@ René Nyffenegger rene.nyffenegger@adp-gmbh.ch
-------------------------------------------------------------------------
Unlicense
SPDX-License-Identifier: Unlicense
* gif.h by Charlie Tangora. Public domain / Unlicense.
https://github.com/ginsweater/gif-h
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <http://unlicense.org>
-------------------------------------------------------------------------
Public domain
* lookup3 code by Bob Jenkins, Public Domain.
http://burtleburtle.net/bob/c/lookup3.c
* The SHA-1 implemenation we use is public domain by Dominik Reichl.
http://www.dominik-reichl.de
-------------------------------------------------------------------------
If we have left anything out, it is unintentional. Please let us know.
+18 -19
View File
@@ -1,30 +1,29 @@
Copyright 2008-present by Contributors to the OpenImageIO project.
BSD 3-Clause License
Copyright (c) 2008-present by Contributors to the OpenImageIO project.
All Rights Reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
See [LICENSE-THIRD-PARTY.md](LICENSE-THIRD-PARTY.md) for license information
about portions that have been imported from other projects.
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+88 -228
View File
@@ -2,10 +2,15 @@
#
# This is the master makefile.
# Here we put all the top-level make targets, platform-independent
# rules, etc.
# rules, etc. This is just a fancy wrapper around cmake, but for many
# people, it's a lot simpler to just type "make" and have everything
# happen automatically.
#
# Run 'make help' to list helpful targets.
#
# Copyright 2008-present Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
#########################################################################
@@ -27,32 +32,26 @@ endif
MY_MAKE_FLAGS ?=
MY_NINJA_FLAGS ?=
MY_CMAKE_FLAGS += -g3 -DSELF_CONTAINED_INSTALL_TREE:BOOL=TRUE
MY_CMAKE_FLAGS += -g3
BUILDSENTINEL ?= Makefile
NINJA ?= ninja
CMAKE ?= cmake
CMAKE_BUILD_TYPE ?= Release
# Site-specific build instructions
ifndef OPENIMAGEIO_SITE
OPENIMAGEIO_SITE := ${shell uname -n}
endif
OPENIMAGEIO_SITE ?= ${shell uname -n}
ifneq (${shell echo ${OPENIMAGEIO_SITE} | grep imageworks.com},)
include ${working_dir}/site/spi/Makefile-bits
endif
# Set up variables holding the names of platform-dependent directories --
# set these after evaluating site-specific instructions
top_build_dir := build
build_dir := ${top_build_dir}/${platform}${variant}
top_dist_dir := dist
dist_dir := ${top_dist_dir}/${platform}${variant}
top_build_dir ?= build
build_dir ?= ${top_build_dir}/${platform}${variant}
top_dist_dir ?= dist
dist_dir ?= ${top_dist_dir}/${platform}${variant}
ifndef INSTALL_PREFIX
INSTALL_PREFIX := ${working_dir}/${dist_dir}
INSTALL_PREFIX_BRIEF := ${dist_dir}
else
INSTALL_PREFIX_BRIEF := ${INSTALL_PREFIX}
endif
INSTALL_PREFIX ?= ${working_dir}/${dist_dir}
VERBOSE ?= ${SHOWCOMMANDS}
ifneq (${VERBOSE},)
@@ -71,14 +70,6 @@ ifneq (${EMBEDPLUGINS},)
MY_CMAKE_FLAGS += -DEMBEDPLUGINS:BOOL=${EMBEDPLUGINS}
endif
ifneq (${USE_OPENGL},)
MY_CMAKE_FLAGS += -DUSE_OPENGL:BOOL=${USE_OPENGL}
endif
ifneq (${USE_QT},)
MY_CMAKE_FLAGS += -DUSE_QT:BOOL=${USE_QT}
endif
ifneq (${OIIO_THREAD_ALLOW_DCLP},)
MY_CMAKE_FLAGS += -DOIIO_THREAD_ALLOW_DCLP:BOOL=${OIIO_THREAD_ALLOW_DCLP}
endif
@@ -87,10 +78,6 @@ ifneq (${NAMESPACE},)
MY_CMAKE_FLAGS += -DOIIO_NAMESPACE:STRING=${NAMESPACE}
endif
ifneq (${HIDE_SYMBOLS},)
MY_CMAKE_FLAGS += -DHIDE_SYMBOLS:BOOL=${HIDE_SYMBOLS}
endif
ifneq (${USE_PYTHON},)
MY_CMAKE_FLAGS += -DUSE_PYTHON:BOOL=${USE_PYTHON}
endif
@@ -107,116 +94,16 @@ ifneq (${PYLIB_INCLUDE_SONAME},)
MY_CMAKE_FLAGS += -DPYLIB_INCLUDE_SONAME:BOOL=${PYLIB_INCLUDE_SONAME}
endif
ifneq (${USE_FFMPEG},)
MY_CMAKE_FLAGS += -DUSE_FFMPEG:BOOL=${USE_FFMPEG}
endif
ifneq (${USE_FIELD3D},)
MY_CMAKE_FLAGS += -DUSE_FIELD3D:BOOL=${USE_FIELD3D}
endif
ifneq (${FIELD3D_HOME},)
MY_CMAKE_FLAGS += -DFIELD3D_HOME:STRING=${FIELD3D_HOME}
endif
ifneq (${USE_TBB},)
MY_CMAKE_FLAGS += -DUSE_TBB:BOOL=${USE_TBB}
endif
ifneq (${TBB_ROOT_DIR},)
MY_CMAKE_FLAGS += -DTBB_ROOT_DIR:STRING=${TBB_ROOT_DIR}
endif
ifneq (${USE_OPENVDB},)
MY_CMAKE_FLAGS += -DUSE_OPENVDB:BOOL=${USE_OPENVDB}
endif
ifneq (${OPENVDB_LOCATION},)
MY_CMAKE_FLAGS += -DOPENVDB_LOCATION:STRING=${OPENVDB_LOCATION}
endif
ifneq (${USE_OPENJPEG},)
MY_CMAKE_FLAGS += -DUSE_OPENJPEG:BOOL=${USE_OPENJPEG}
endif
ifneq (${OPENJPEG_HOME},)
MY_CMAKE_FLAGS += -DOPENJPEG_HOME:STRING=${OPENJPEG_HOME}
endif
ifneq (${USE_JPEGTURBO},)
MY_CMAKE_FLAGS += -DUSE_JPEGTURBO:BOOL=${USE_JPEGTURBO}
endif
ifneq (${JPEGTURBO_PATH},)
MY_CMAKE_FLAGS += -DJPEGTURBO_PATH:STRING=${JPEGTURBO_PATH}
endif
ifneq (${USE_GIF},)
MY_CMAKE_FLAGS += -DUSE_GIF:BOOL=${USE_GIF}
endif
ifneq (${GIF_DIR},)
MY_CMAKE_FLAGS += -DGIF_DIR:STRING=${GIF_DIR}
endif
ifneq (${USE_OCIO},)
MY_CMAKE_FLAGS += -DUSE_OCIO:BOOL=${USE_OCIO}
endif
ifneq (${USE_NUKE},)
MY_CMAKE_FLAGS += -DUSE_NUKE:BOOL=${USE_NUKE}
endif
ifneq (${USE_OPENCV},)
MY_CMAKE_FLAGS += -DUSE_OPENCV:BOOL=${USE_OPENCV}
endif
ifneq (${USE_LIBRAW},)
MY_CMAKE_FLAGS += -DUSE_LIBRAW:BOOL=${USE_LIBRAW}
endif
ifneq (${LIBRAW_PATH},)
MY_CMAKE_FLAGS += -DLIBRAW_PATH:STRING=${LIBRAW_PATH}
endif
ifneq (${USE_PTEX},)
MY_CMAKE_FLAGS += -DUSE_PTEX:BOOL=${USE_PTEX}
endif
ifneq (${USE_WEBP},)
MY_CMAKE_FLAGS += -DUSE_WEBP:BOOL=${USE_WEBP}
endif
ifneq (${USE_EXTERNAL_PUGIXML},)
MY_CMAKE_FLAGS += -DUSE_EXTERNAL_PUGIXML:BOOL=${USE_EXTERNAL_PUGIXML} -DPUGIXML_HOME=${PUGIXML_HOME}
endif
# Old names -- DEPRECATED (1.9)
ifneq (${OPENEXR_HOME},)
MY_CMAKE_FLAGS += -DOPENEXR_ROOT_DIR:STRING=${OPENEXR_HOME}
endif
ifneq (${ILMBASE_HOME},)
MY_CMAKE_FLAGS += -DILMBASE_ROOT_DIR:STRING=${ILMBASE_HOME}
ifneq (${OPENEXR_ROOT},)
MY_CMAKE_FLAGS += -DOPENEXR_ROOT:STRING=${OPENEXR_ROOT}
endif
ifneq (${OPENEXR_ROOT_DIR},)
MY_CMAKE_FLAGS += -DOPENEXR_ROOT_DIR:STRING=${OPENEXR_ROOT_DIR}
endif
ifneq (${ILMBASE_ROOT_DIR},)
MY_CMAKE_FLAGS += -DILMBASE_ROOT_DIR:STRING=${ILMBASE_ROOT_DIR}
endif
ifneq (${OCIO_HOME},)
MY_CMAKE_FLAGS += -DOCIO_PATH:STRING=${OCIO_HOME}
endif
ifneq (${BOOST_HOME},)
MY_CMAKE_FLAGS += -DBOOST_ROOT:STRING=${BOOST_HOME}
endif
ifneq (${NUKE_HOME},)
MY_CMAKE_FLAGS += -DNuke_ROOT:STRING=${NUKE_HOME}
ifneq (${ILMBASE_ROOT},)
MY_CMAKE_FLAGS += -DILMBASE_ROOT:STRING=${ILMBASE_ROOT}
endif
ifneq (${NUKE_VERSION},)
@@ -227,8 +114,8 @@ ifneq (${STOP_ON_WARNING},)
MY_CMAKE_FLAGS += -DSTOP_ON_WARNING:BOOL=${STOP_ON_WARNING}
endif
ifneq (${BUILDSTATIC},)
MY_CMAKE_FLAGS += -DBUILDSTATIC:BOOL=${BUILDSTATIC}
ifneq (${BUILD_SHARED_LIBS},)
MY_CMAKE_FLAGS += -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
endif
ifneq (${LINKSTATIC},)
@@ -256,11 +143,11 @@ MY_CMAKE_FLAGS += -DBUILD_OIIOUTIL_ONLY:BOOL=${BUILD_OIIOUTIL_ONLY}
endif
ifdef DEBUG
MY_CMAKE_FLAGS += -DCMAKE_BUILD_TYPE:STRING=Debug
CMAKE_BUILD_TYPE=Debug
endif
ifdef PROFILE
MY_CMAKE_FLAGS += -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo
CMAKE_BUILD_TYPE=RelWithDebInfo
endif
ifneq (${MYCC},)
@@ -271,7 +158,11 @@ MY_CMAKE_FLAGS += -DCMAKE_CXX_COMPILER:STRING="${MYCXX}"
endif
ifneq (${USE_CPP},)
MY_CMAKE_FLAGS += -DUSE_CPP=${USE_CPP}
MY_CMAKE_FLAGS += -DCMAKE_CXX_STANDARD=${USE_CPP}
endif
ifneq (${CMAKE_CXX_STANDARD},)
MY_CMAKE_FLAGS += -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}
endif
ifneq (${USE_LIBCPLUSPLUS},)
@@ -308,11 +199,12 @@ BUILDSENTINEL := build.ninja
endif
ifeq (${CODECOV},1)
MY_CMAKE_FLAGS += -DCMAKE_BUILD_TYPE:STRING=Debug -DCODECOV:BOOL=${CODECOV}
CMAKE_BUILD_TYPE=Debug
MY_CMAKE_FLAGS += -DCODECOV:BOOL=${CODECOV}
endif
ifneq (${SANITIZE},)
MY_CMAKE_FLAGS += -DSANITIZE=${SANITIZE}
MY_CMAKE_FLAGS += -DSANITIZE=${SANITIZE}
endif
ifneq (${CLANG_TIDY},)
@@ -337,12 +229,8 @@ ifneq (${CLANG_FORMAT_EXCLUDES},)
MY_CMAKE_FLAGS += -DCLANG_FORMAT_EXCLUDES:STRING=${CLANG_FORMAT_EXCLUDES}
endif
ifneq (${USE_FREETYPE},)
MY_CMAKE_FLAGS += -DUSE_FREETYPE:BOOL=${USE_FREETYPE}
endif
ifneq (${BUILD_MISSING_DEPS},)
MY_CMAKE_FLAGS += -DBUILD_MISSING_DEPS:BOOL=${BUILD_MISSING_DEPS}
MY_CMAKE_FLAGS += -DBUILD_MISSING_DEPS:BOOL=${BUILD_MISSING_DEPS}
endif
@@ -367,92 +255,78 @@ debug:
profile:
${MAKE} PROFILE=1 --no-print-directory
# 'make cmakesetup' constructs the build directory and runs 'cmake' there,
# 'make config' constructs the build directory and runs 'cmake' there,
# generating makefiles to build the project. For speed, it only does this when
# ${build_dir}/Makefile doesn't already exist, in which case we rely on the
# cmake generated makefiles to regenerate themselves when necessary.
cmakesetup:
config:
@ (if [ ! -e ${build_dir}/${BUILDSENTINEL} ] ; then \
${CMAKE} -E make_directory ${build_dir} ; \
cd ${build_dir} ; \
${CMAKE} -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} \
${MY_CMAKE_FLAGS} -DBOOST_ROOT=${BOOST_HOME} \
../.. ; \
${CMAKE} -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} \
-DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} \
${MY_CMAKE_FLAGS} ../.. ; \
fi)
ifeq (${USE_NINJA},1)
# 'make cmake' does a basic build (after first setting it up)
cmake: cmakesetup
@ ( cd ${build_dir} ; ${NINJA} ${MY_NINJA_FLAGS} )
# 'make build' does a basic build (after first setting it up)
build: config
@ ( cd ${build_dir} ; \
${CMAKE} --build . --config ${CMAKE_BUILD_TYPE} \
)
# 'make cmakeinstall' builds everthing and installs it in 'dist'.
# 'make install' builds everthing and installs it in 'dist'.
# Suppress pointless output from docs installation.
cmakeinstall: cmake
@ ( cd ${build_dir} ; ${NINJA} ${MY_NINJA_FLAGS} install | grep -v '^-- \(Installing\|Up-to-date\|Set runtime path\)' )
install: build
@ ( cd ${build_dir} ; \
${CMAKE} --build . --target install --config ${CMAKE_BUILD_TYPE} | grep -v '^-- \(Installing\|Up-to-date\|Set runtime path\)' \
)
# 'make package' builds everything and then makes an installable package
# (platform dependent -- may be .tar.gz, .sh, .dmg, .rpm, .deb. .exe)
package: cmakeinstall
@ ( cd ${build_dir} ; ${NINJA} ${MY_NINJA_FLAGS} package )
package: install
@ ( cd ${build_dir} ; \
${CMAKE} --build . --target package --config ${CMAKE_BUILD_TYPE} \
)
# 'make package_source' makes an installable source package
# (platform dependent -- may be .tar.gz, .sh, .dmg, .rpm, .deb. .exe)
package_source: cmakeinstall
@ ( cd ${build_dir} ; ${NINJA} ${MY_NINJA_FLAGS} package_source )
package_source: install
@ ( cd ${build_dir} ; \
${CMAKE} --build . --target package_source --config ${CMAKE_BUILD_TYPE} \
)
# 'make clang-format' runs clang-format on all source files (if it's installed)
clang-format: cmakesetup
@ ( cd ${build_dir} ; ${NINJA} ${MY_NINJA_FLAGS} clang-format )
clang-format: config
@ ( cd ${build_dir} ; \
${CMAKE} --build . --target clang-format --config ${CMAKE_BUILD_TYPE} \
)
else
# 'make cmake' does a basic build (after first setting it up)
cmake: cmakesetup
@ ( cd ${build_dir} ; ${MAKE} ${MY_MAKE_FLAGS} )
# 'make cmakeinstall' builds everthing and installs it in 'dist'.
# Suppress pointless output from docs installation.
cmakeinstall: cmake
@ ( cd ${build_dir} ; ${MAKE} ${MY_MAKE_FLAGS} install | grep -v '^-- \(Installing\|Up-to-date\|Set runtime path\)' )
# 'make package' builds everything and then makes an installable package
# (platform dependent -- may be .tar.gz, .sh, .dmg, .rpm, .deb. .exe)
package: cmakeinstall
@ ( cd ${build_dir} ; ${MAKE} ${MY_MAKE_FLAGS} package )
# 'make package_source' makes an installable source package
# (platform dependent -- may be .tar.gz, .sh, .dmg, .rpm, .deb. .exe)
package_source: cmakeinstall
@ ( cd ${build_dir} ; ${MAKE} ${MY_MAKE_FLAGS} package_source )
# 'make clang-format' runs clang-format on all source files (if it's installed)
clang-format: cmakesetup
@ ( cd ${build_dir} ; ${MAKE} ${MY_MAKE_FLAGS} clang-format )
endif
# 'make dist' is just a synonym for 'make cmakeinstall'
dist : cmakeinstall
# 'make dist' is just a synonym for 'make install'
dist : install
TEST_FLAGS += --force-new-ctest-process --output-on-failure
# 'make test' does a full build and then runs all tests
test: cmake
test: build
@ ${CMAKE} -E cmake_echo_color --switch=$(COLOR) --cyan "Running tests ${TEST_FLAGS}..."
@ ( cd ${build_dir} ; PYTHONPATH=${PWD}/${build_dir}/src/python ctest -E broken ${TEST_FLAGS} )
@ ( cd ${build_dir} ; \
PYTHONPATH=${PWD}/${build_dir}/lib/python/site-packages \
ctest -E broken ${TEST_FLAGS} \
)
@ ( if [[ "${CODECOV}" == "1" ]] ; then \
cd ${build_dir} ; \
lcov -b . -d . -c -o cov.info ; \
lcov --remove cov.info "/usr*" -o cov.info ; \
genhtml -o ./cov -t "OIIO test coverage" --num-spaces 4 cov.info ; \
genhtml -o ./cov -t "Test coverage" --num-spaces 4 cov.info ; \
fi )
# 'make testall' does a full build and then runs all tests (even the ones
# that are expected to fail on some platforms)
testall: cmake
testall: build
${CMAKE} -E cmake_echo_color --switch=$(COLOR) --cyan "Running all tests ${TEST_FLAGS}..."
( cd ${build_dir} ; PYTHONPATH=${PWD}/${build_dir}/src/python ctest ${TEST_FLAGS} )
( cd ${build_dir} ; PYTHONPATH=${PWD}/${build_dir}/lib/python/site-packages ctest ${TEST_FLAGS} )
# 'make clean' clears out the build directory for this platform
clean:
@@ -477,16 +351,18 @@ doxygen:
# 'make help' prints important make targets
help:
@echo "Targets:"
@echo " make Build optimized binaries and libraries"
@echo " make debug Build unoptimized with symbols"
@echo " make profile Build for profiling"
@echo " make Build and install optimized binaries and libraries"
@echo " make install Build and install optimized binaries and libraries"
@echo " make build Build only (no install) optimized binaries and libraries"
@echo " make config Just configure cmake, don't build"
@echo " make debug Build and install unoptimized with symbols"
@echo " make profile Build and install for profiling"
@echo " make clean Remove the temporary files in ${build_dir}"
@echo " make realclean Remove both ${build_dir} AND ${dist_dir}"
@echo " make nuke Remove ALL of build and dist (not just ${platform})"
@echo " make test Run tests"
@echo " make testall Run all tests, even broken ones"
@echo " make clang-format Run clang-format on all the source files"
@echo " make doxygen Build the Doxygen docs in ${top_build_dir}/doxygen"
@echo ""
@echo "Helpful modifiers:"
@echo " C++ compiler and build process:"
@@ -494,7 +370,7 @@ help:
@echo " STOP_ON_WARNING=0 Do not stop building if compiler warns"
@echo " OPENIMAGEIO_SITE=xx Use custom site build mods"
@echo " MYCC=xx MYCXX=yy Use custom compilers"
@echo " USE_CPP=14 Compile in C++14 mode (default is C++11)"
@echo " CMAKE_CXX_STANDARD=14 Compile in C++14 mode (default is C++11)"
@echo " USE_LIBCPLUSPLUS=1 For clang, use libc++"
@echo " GLIBCXX_USE_CXX11_ABI=1 For gcc, use the new string ABI"
@echo " EXTRA_CPP_ARGS= Additional args to the C++ command"
@@ -507,47 +383,31 @@ help:
@echo " CLANG_FORMAT_INCLUDES=... CLANG_FORMAT_EXCLUDES=..."
@echo " Customize files for 'make clang-format'"
@echo " Linking and libraries:"
@echo " HIDE_SYMBOLS=1 Hide symbols not in the public API"
@echo " SOVERSION=nn Include the specifed major version number "
@echo " in the shared object metadata"
@echo " OIIO_LIBNAME_SUFFIX=name Optional name appended to library names"
@echo " BUILDSTATIC=1 Build static library instead of shared"
@echo " BUILD_SHARED_LIBS=0 Build static library instead of shared"
@echo " LINKSTATIC=1 Link with static external libs when possible"
@echo " Dependency hints:"
@echo " For each dependeny Foo, defining ENABLE_Foo=0 disables it, even"
@echo " if found. And you can hint where to find it with Foo_ROOT=path"
@echo " Note that it is case sensitive! The list of package names is:"
@echo " DCMTK FFmpeg Field3D Freetype GIF JPEGTurbo"
@echo " LibRaw OpenColorIO OpenCV OpenGL OpenJpeg OpenVDB"
@echo " PTex R3DSDK TBB TIFF Webp"
@echo " Finding and Using Dependencies:"
@echo " BOOST_HOME=path Custom Boost installation"
@echo " OPENEXR_ROOT_DIR=path Custom OpenEXR installation"
@echo " ILMBASE_ROOT_DIR=path Custom IlmBase installation"
@echo " BOOST_ROOT=path Custom Boost installation"
@echo " OPENEXR_ROOT=path Custom OpenEXR installation"
@echo " ILMBASE_ROOT=path Custom IlmBase installation"
@echo " USE_EXTERNAL_PUGIXML=1 Use the system PugiXML, not the one in OIIO"
@echo " USE_QT=0 Skip anything that needs Qt"
@echo " USE_OPENGL=0 Skip anything that needs OpenGL"
@echo " USE_PYTHON=0 Don't build the Python binding"
@echo " PYTHON_VERSION=2.6 Specify the Python version"
@echo " USE_FIELD3D=0 Don't build the Field3D plugin"
@echo " FIELD3D_HOME=path Custom Field3D installation"
@echo " USE_OPENVDB=0 Don't build the OpenVDB plugin"
@echo " OPENVDB_LOCATION=path Custom OpenVDB installation"
@echo " USE_TBB=0 Don't use Intel TBB, though known"
@echo " dependencies (USE_OPENVDB=1) will override this"
@echo " TBB_ROOT_DIR=path Custom Intel TBB installation"
@echo " USE_FFMPEG=0 Don't build the FFmpeg plugin"
@echo " USE_JPEGTURBO=0 Don't build the JPEG-Turbo even if found"
@echo " JPEGTURBO_PATH=path Custom path for JPEG-Turbo"
@echo " USE_OPENJPEG=0 Don't build the JPEG-2000 plugin"
@echo " USE_GIF=0 Don't build the GIF plugin"
@echo " GIF_DIR=path Custom GIFLIB installation"
@echo " USE_OCIO=0 Don't use OpenColorIO even if found"
@echo " OCIO_HOME=path Custom OpenColorIO installation"
@echo " USE_NUKE=0 Don't build Nuke plugins"
@echo " NUKE_HOME=path Custom Nuke installation"
@echo " Nuke_ROOT=path Custom Nuke installation"
@echo " NUKE_VERSION=ver Custom Nuke version"
@echo " USE_LIBRAW=0 Don't use LibRaw, even if found"
@echo " LIBRAW_PATH=path Custom LibRaw installation"
@echo " USE_OPENCV=0 Skip anything that needs OpenCV"
@echo " USE_PTEX=0 Skip anything that needs PTex"
@echo " USE_WEBP=0 Skip anything that needs WebP"
@echo " USE_FREETYPE=0 Skip anything that needs Freetype"
@echo " OIIO build-time options:"
@echo " INSTALL_PREFIX=path Set installation prefix (default: ./${INSTALL_PREFIX_BRIEF})"
@echo " INSTALL_PREFIX=path Set installation prefix (default: ./${INSTALL_PREFIX})"
@echo " NAMESPACE=name Override namespace base name (default: OpenImageIO)"
@echo " EMBEDPLUGINS=0 Don't compile the plugins into libOpenImageIO"
@echo " OIIO_THREAD_ALLOW_DCLP=0 Don't allow threads.h to use DCLP"
+5 -8
View File
@@ -1,10 +1,9 @@
README for OpenImageIO
======================
[![License](https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square)](https://github.com/OpenImageIO/oiio/blob/master/LICENSE)
[![License](https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square)](https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md)
[![Build Status](https://travis-ci.org/OpenImageIO/oiio.svg?branch=master)](https://travis-ci.org/OpenImageIO/oiio)
[![Windows Build Status](https://ci.appveyor.com/api/projects/status/a0l32ti7gcoergtf/branch/master?svg=true)](https://ci.appveyor.com/api/projects/status/a0l32ti7gcoergtf/branch/master)
[![CircleCI](https://circleci.com/gh/OpenImageIO/oiio/tree/master.svg?style=svg)](https://circleci.com/gh/OpenImageIO/oiio/tree/master)
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/2694/badge)](https://bestpractices.coreinfrastructure.org/projects/2694)
@@ -67,8 +66,7 @@ OpenImageIO consists of:
Licensing
---------
OpenImageIO is (c) Copyright 2008-2019 by Larry Gritz et al.
All Rights Reserved.
OpenImageIO is (c) Copyright Contributors to the OpenImageIO project.
OpenImageIO is distributed using the [modified BSD license](LICENSE.md)
(also known as the "new BSD" or "3-clause BSD" license). The documentation
@@ -103,10 +101,9 @@ plugins.
Documentation
-------------
The primary user and programmer documentation can be found in
[src/doc/openimageio.pdf](src/doc/openimageio.pdf) (in a source
distribution) or in the share/doc/OpenImageIO/openimageio.pdf file of an
installed binary distribution.
The primary user and programmer documentation can be found
on [openimageio.readthedocs.io](https://openimageio.readthedocs.io/en/latest/)
as html or as [PDF](https://readthedocs.org/projects/openimageio/downloads/pdf/latest/).
Contact & reporting problems
+9 -12
View File
@@ -1,5 +1,5 @@
version: '{branch}-{build}'
image: Visual Studio 2015
image: Previous Visual Studio 2015
clone_folder: C:\projects\oiio
test: off
configuration:
@@ -17,6 +17,9 @@ environment:
tbs_arch: "x64"
tbs_tools: "msvc14"
tbs_static_runtime: 0
MY_CMAKE_FLAGS: -DUSE_PYTHON=0
USE_PYTHON: 0
cache:
- C:\tools\vcpkg\installed
@@ -60,16 +63,7 @@ install:
- vcpkg install openjpeg:"%platform%"-windows
- vcpkg install ptex:"%platform%"-windows
- vcpkg install libraw:x64-windows
# These are all deps for qt, install these first to isolate from the
# huge time it takes qt to build
- vcpkg install double-conversion:x64-windows
- vcpkg install harfbuzz:x64-windows
- vcpkg install libpq:x64-windows
- vcpkg install openssl:x64-windows
- vcpkg install pcre2:x64-windows
- vcpkg install ragel:x64-windows
- vcpkg install sqlite3:x64-windows
- vcpkg install pybind11:x64-windows
# Qt
- set CMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH%;C:\Qt\5.12
@@ -109,11 +103,14 @@ build_script:
- mkdir build\windows64
- cd build\windows64
- cmake -G "%CMAKE_PLATFORM%" -DCMAKE_TOOLCHAIN_FILE=c:/tools/vcpkg/scripts/buildsystems/vcpkg.cmake \
-DCMAKE_INSTALL_PREFIX=C:\projects\oiio\dist\windows64 \
-DUSE_PYTHON=0 -DUSE_PTEX=0 \
-DPYTHON_INCLUDE_DIR:PATH=%PYTHON_DIR%/include -DPYTHON_LIBRARY:FILEPATH=%PYTHON_DIR%/libs/python27.lib -DPYTHON_EXECUTABLE:FILEPATH=%PYTHON_DIR%/python.exe -DCMAKE_LIBRARY_PATH=%CMAKE_LIBRARY_PATH% -DCMAKE_INCLUDE_PATH=%CMAKE_INCLUDE_PATH% -DCMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH% -DOPENEXR_ROOT_DIR=C:\projects\oiio\ext -DVERBOSE=1 -DBUILD_MISSING_DEPS=1 ../..
- dir c:\projects\oiio
- dir c:\projects\oiio\build
- dir c:\projects\oiio\build\windows64
- cmake --build . --config %CONFIGURATION%
- cmake --build . --config %CONFIGURATION% --target install
- dir c:\projects\oiio\dist\windows64
matrix:
+34
View File
@@ -0,0 +1,34 @@
[requires]
zlib/1.2.11
libtiff/4.0.9
libpng/1.6.37
openexr/2.4.0
boost/1.70.0
libjpeg/9c
libjpeg-turbo/2.0.2
giflib/5.1.4
freetype/2.10.0
#opencv/4.1.1@conan/stable
openjpeg/2.3.1
libwebp/1.0.3
tsl-robin-map/0.6.1@tessil/stable
tbb/2020.0
# To do:
# opencolorio? not on conan?
# pybind11/2.4.3 - conan doesn't have this minimum version
# dcmtk
# ffmpeg
# field3d
# libheif
# libraw
# openvdb
# ptex
# qt5
# libsquish
[generators]
cmake
[options]
#libpng:shared=False
+183 -72
View File
@@ -3,18 +3,32 @@ ifneq (${VERBOSE},)
$(info Including spi/Makefile-bits)
endif
# For SpComp2 builds, set env OIIO_SPCOMP2=1, and either
# For SpComp2 builds, do:
#
# make OIIO_SPCOMP2=1 spcomp2_install
# or
# make OIIO_SPCOMP2=1 SPCOMP2_LOCAL_PATH=/test/path spcomp2_install_local
#
# For Arnold builds, set env OIIO_ARNOLD=1 and just do a regular
# "make". We make this the default, so if you want neither an Arnold nor
# a SpComp2, you have to set OIIO_ARNOLD=0. If both are set, SpComp2
# takes precedence.
# For Arnold builds, do:
#
# make OIIO_ARNOLD=1
#
# For a Rez-bound build, do:
#
# make OIIO_SPIREZ=1 spi
#
# (Options: OIIO_REZ_NAME=blah REZ_PACKAGE_ROOT=path)
#
# Otherwise a default 'make' will make a fully generic OIIO build.
OIIO_SPCOMP2 ?= 0
OIIO_ARNOLD ?= 1
OPENIMAGEIO_SPCOMP2_VERSION ?= 49
OIIO_ARNOLD ?= 0
OIIO_SPIREZ ?= 0
OIIO_REZ_NAME ?= OpenImageIO
OIIO_VERS = $(shell grep "OpenImageIO VERSION" CMakeLists.txt | egrep -o "[0-9.]+")
ONEVERS = $(shell site/spi/format_version.py ${OIIO_VERS})
OPENIMAGEIO_SPCOMP2_VERSION ?= ${ONEVERS}
ifeq (${OIIO_SPCOMP2},1)
$(info Building for SpComp2)
OIIO_ARNOLD := 0
@@ -25,38 +39,61 @@ ifeq (${OIIO_SPCOMP2},1)
else ifeq (${OIIO_ARNOLD},1)
$(info Building for Arnold)
NAMESPACE ?= 'OpenImageIO_Arnold'
PYLIB_LIB_PREFIX ?= 0
PYLIB_INCLUDE_SONAME ?= 0
else ifeq (${OIIO_SPIREZ},1)
$(info Building for Rez distribution)
# NAMESPACE ?= 'OpenImageIO'
MY_CMAKE_FLAGS += -DOIIO_SPIREZ=1 -DOIIO_REZ_PACKAGE_NAME=${OIIO_REZ_NAME}
MY_CMAKE_FLAGS += -DCMAKE_DEBUG_POSTFIX=_d
else
$(info Building generic OpenImageIO)
# NAMESPACE ?= 'OpenImageIO'
endif
#$(info MAKECMDGOALS = $(MAKECMDGOALS))
MY_CMAKE_FLAGS += -DEXTRA_CPP_ARGS:STRING="-DOIIO_SPI=1" -DOIIO_SITE:STRING=SPI
MY_CMAKE_FLAGS += -DSPI_TESTS=1
SPCOMP2_ROOT ?= /shots/spi/home/lib/SpComp2
## Detect which SPI platform and set $platform, $COMPILER, $SPCOMP2_COMPILER,
## and PYTHON_VERSION. Lots of other decisions are based on these.
ifeq (${SP_OS}, rhel7)
# Rhel7 (current)
platform := rhel7
SPCOMP2_COMPILER ?= gcc48m64
SPI_COMPILER_PLATFORM ?= gcc-6.3
ifeq (${SPI_COMPILER_PLATFORM},gcc-4.8)
SPCOMP2_COMPILER ?= gcc48m64
CMAKE_CXX_STANDARD ?= 11
LLVM_VERSION ?= 9.0.1-1
else
SPCOMP2_COMPILER ?= gcc63
CMAKE_CXX_STANDARD ?= 14
LLVM_VERSION ?= 10.0.0-1
endif
SP_PLATFORM ?= linux
SP_PROC ?= x86_64
SP_REZ_OS ?= CentOS-7
else ifeq (${platform}, macosx)
# Generic OSX machines (including LG's laptop)
COMPILER ?= clang
SPCOMP2_COMPILER ?= clang
PYTHON_VERSION ?= 2.6
SP_OS ?= macosx
SP_PLATFORM ?= macosx
SP_PROC ?= x86_64
SP_REZ_OS ?= MacOS
else
$(error Unknown SP_OS=${SP_OS} platform=${platform})
endif # endif ${SP_OS}
PYTHON_VERSION ?= 2.7
MY_CMAKE_FLAGS += -DSP_OS=${SP_OS} -DSP_PLATFORM=${SP_PLATFORM}
MY_CMAKE_FLAGS += -DSP_PROC=${SP_PROC} -DSP_REZ_OS=${SP_REZ_OS}
MY_CMAKE_FLAGS += -DSPI_COMPILER_PLATFORM=${SPI_COMPILER_PLATFORM}
MY_CMAKE_FLAGS += -DEXTRA_CPP_ARGS:STRING="-DOIIO_SPI=1" -DOIIO_SITE:STRING=spi
MY_CMAKE_FLAGS += -DSPI_TESTS=1
MY_CMAKE_FLAGS += -DOIIO_NAMESPACE_INCLUDE_PATCH=1
REZ_PACKAGE_ROOT ?= /shots/spi/home/software/packages
SPCOMP2_ROOT ?= /shots/spi/home/lib/SpComp2
## Rhel7 (current)
ifeq (${SP_OS}, rhel7)
USE_CPP ?= 11
USE_SIMD ?= sse4.1,aes
CMAKE ?= cmake
USE_NINJA ?= 1
@@ -69,6 +106,8 @@ ifeq (${SP_OS}, rhel7)
MY_CMAKE_FLAGS += -DCMAKE_INSTALL_LIBDIR="${INSTALL_PREFIX}/lib"
ifeq (${OIIO_SPCOMP2},1)
MY_CMAKE_FLAGS += -DPYTHON_SITE_DIR="${INSTALL_PREFIX}/python"
else ifeq (${OIIO_SPIREZ},1)
MY_CMAKE_FLAGS += -DPYTHON_SITE_DIR="${INSTALL_PREFIX}/python"
else ifeq (${OIIO_ARNOLD},1)
OIIO_LIBNAME_SUFFIX=_Arnold
endif
@@ -78,22 +117,21 @@ ifeq (${SP_OS}, rhel7)
#
# A variety of tags can be used to try specific versions of gcc or
# clang from the site-specific places we have installed them.
LLVM_DIRECTORY ?= /shots/spi/home/lib/arnold/rhel7/llvm_8.0.0
ifeq (${COMPILER},clang6)
LLVM_DIRECTORY := /shots/spi/home/lib/arnold/rhel7/llvm_6.0.1
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=${LLVM_DIRECTORY}/bin/clang -DCMAKE_CXX_COMPILER=${LLVM_DIRECTORY}/bin/clang++
MY_CMAKE_FLAGS += -DCMAKE_C_FLAGS="--gcc-toolchain=/usr" -DCMAKE_CXX_FLAGS="--gcc-toolchain=/usr"
else ifeq (${COMPILER},clang7)
LLVM_DIRECTORY ?= /shots/spi/home/software/packages/llvm/${LLVM_VERSION}/${SPI_COMPILER_PLATFORM}
ifeq (${COMPILER},clang7)
LLVM_DIRECTORY := /shots/spi/home/lib/arnold/rhel7/llvm_7.0.1
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=${LLVM_DIRECTORY}/bin/clang -DCMAKE_CXX_COMPILER=${LLVM_DIRECTORY}/bin/clang++
MY_CMAKE_FLAGS += -DCMAKE_C_FLAGS="--gcc-toolchain=/usr" -DCMAKE_CXX_FLAGS="--gcc-toolchain=/usr"
else ifeq (${COMPILER},clang7)
else ifeq (${COMPILER},clang8)
LLVM_DIRECTORY := /shots/spi/home/lib/arnold/rhel7/llvm_8.0.0
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=${LLVM_DIRECTORY}/bin/clang -DCMAKE_CXX_COMPILER=${LLVM_DIRECTORY}/bin/clang++
MY_CMAKE_FLAGS += -DCMAKE_C_FLAGS="--gcc-toolchain=/usr" -DCMAKE_CXX_FLAGS="--gcc-toolchain=/usr"
else ifeq (${COMPILER},clang9)
LLVM_DIRECTORY := /shots/spi/home/software/packages/llvm/9.0.1-1/${SPI_COMPILER_PLATFORM}
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=${LLVM_DIRECTORY}/bin/clang -DCMAKE_CXX_COMPILER=${LLVM_DIRECTORY}/bin/clang++
else ifeq (${COMPILER},clang10)
LLVM_DIRECTORY := /shots/spi/home/software/packages/llvm/10.0.0-1/${SPI_COMPILER_PLATFORM}
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=${LLVM_DIRECTORY}/bin/clang -DCMAKE_CXX_COMPILER=${LLVM_DIRECTORY}/bin/clang++
else ifeq (${COMPILER},clang)
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
MY_CMAKE_FLAGS += -DCMAKE_C_FLAGS="--gcc-toolchain=/usr" -DCMAKE_CXX_FLAGS="--gcc-toolchain=/usr"
else ifeq (${COMPILER}, gcc6)
MY_CMAKE_FLAGS += \
-DCMAKE_C_COMPILER=/opt/rh/devtoolset-6/root/usr/bin/gcc \
@@ -105,15 +143,20 @@ ifeq (${SP_OS}, rhel7)
MY_CMAKE_FLAGS += \
-DCMAKE_C_COMPILER=${LLVM_DIRECTORY}/bin/clang \
-DCMAKE_CXX_COMPILER=${LLVM_DIRECTORY}/bin/clang++
MY_CMAKE_FLAGS += -DCMAKE_C_FLAGS="--gcc-toolchain=/usr" -DCMAKE_CXX_FLAGS="--gcc-toolchain=/usr"
endif
ifeq (${SPI_COMPILER_PLATFORM},gcc-4.8)
MY_CMAKE_FLAGS += -DCMAKE_C_FLAGS="--gcc-toolchain=/usr" \
-DCMAKE_CXX_FLAGS="--gcc-toolchain=/usr" \
-DTOOLCHAIN_FLAGS="--gcc-toolchain=/usr"
endif
#
# Boost
#
BOOSTVERS ?= 1.55
BOOSTVERS ?= 1.70
BOOSTSPSUFFIX ?=
BOOSTVERSSP=${BOOSTVERS}${BOOSTSPSUFFIX}
MY_CMAKE_FLAGS += -DBOOST_VERS_SP=${BOOSTVERSSP}
# $(info BOOSTVERSSP ${BOOSTVERSSP})
ifeq (${BOOSTVERS},1.55)
SPBOOST_INC_DIR ?= /usr/include/boost_${BOOSTVERSSP}
@@ -156,8 +199,7 @@ ifeq (${SP_OS}, rhel7)
-DPYTHON_VERSION_MINOR=6 \
-DPYTHON_VERSION_PATCH=3 \
-DPython_ADDITIONAL_VERSIONS="${PYTHON_VERSION}"
endif
ifeq (${PYTHON_VERSION},3.7)
else ifeq (${PYTHON_VERSION},3.7)
# Special sauce for Python 3.7
PYTHON_INCLUDE_DIR := /usr/include/python${PYTHON_VERSION}m
PYTHON_LIBRARY := ${PYTHON_LIBRARY_DIR}/libpython${PYTHON_VERSION}m.so
@@ -168,49 +210,81 @@ ifeq (${SP_OS}, rhel7)
-DPYTHON_VERSION_MINOR=7 \
-DPYTHON_VERSION_PATCH=3 \
-DPython_ADDITIONAL_VERSIONS="${PYTHON_VERSION}"
else ifeq (${PYTHON_VERSION},2.7)
# Special sauce for Python 2.7
PYTHON_INCLUDE_DIR := /usr/include/python${PYTHON_VERSION}
PYTHON_LIBRARY := ${PYTHON_LIBRARY_DIR}/libpython${PYTHON_VERSION}.so
MY_CMAKE_FLAGS += \
-DPYTHONINTERP_FOUND=1 \
-DPYTHON_VERSION_STRING=2.7.5 \
-DPYTHON_VERSION_MAJOR=2 \
-DPYTHON_VERSION_MINOR=7 \
-DPYTHON_VERSION_PATCH=5 \
-DPython_ADDITIONAL_VERSIONS="${PYTHON_VERSION}"
endif
MY_CMAKE_FLAGS += \
-DPYTHON_INCLUDE_DIR:STRING=${PYTHON_INCLUDE_DIR} \
-DPYTHON_LIBRARY:STRING=${PYTHON_LIBRARY}
-DPYTHON_LIBRARY:STRING=${PYTHON_LIBRARY} \
-Dpybind11_ROOT:STRING=${REZ_PACKAGE_ROOT}/pybind11/2.4.3/python-${PYTHON_VERSION}
# Set our preferred OpenEXR path, but allow env variable to override
# with custom/test version.
ifeq (${OPENEXR_ROOT_DIR},)
MY_CMAKE_FLAGS += \
-DOPENEXR_INCLUDE_DIR=/usr/include/OpenEXR2 \
-DOPENEXR_LIBRARY_DIR=/usr/lib64/OpenEXR2
endif
OPENEXR_VERSION ?= 2.4.0
OpenEXR_ROOT ?= ${REZ_PACKAGE_ROOT}/OpenEXR/${OPENEXR_VERSION}/${SPI_COMPILER_PLATFORM}/python-${PYTHON_VERSION}
MY_CMAKE_FLAGS += -DOpenEXR_ROOT=${OpenEXR_ROOT}
#
# SpComp2 and other weird SPI-installed packages
#
OCIO_SPCOMP_VERSION ?= 2
OPENVDB_SPCOMP2_VERSION ?= v5020000
NUKE_VERSION ?= 11.2v3
SPCOMP2_FULLBOOST_SUFFIX = ${SP_OS}-${SPCOMP2_COMPILER}-boost${shell echo ${BOOSTVERSSP} | sed "s/\\.//"}
# $(info SPCOMP2_FULLBOOST_SUFFIX ${SPCOMP2_FULLBOOST_SUFFIX})
OCIO_PATH ?= ${SPCOMP2_ROOT}/OpenColorIO/${SP_OS}-${SPCOMP2_COMPILER}/v${OCIO_SPCOMP_VERSION}
ifneq (${OIIO_SPCOMP2},1)
ifeq (${OIIO_SPCOMP2},1)
OCIO_SPCOMP_VERSION ?= 2
OpenColorIO_ROOT ?= ${SPCOMP2_ROOT}/OpenColorIO/${SP_OS}-${SPCOMP2_COMPILER}/v${OCIO_SPCOMP_VERSION}
# OPENVDB_SPCOMP2_VERSION ?= v6020001
# OpenVDB_ROOT ?= ${SPCOMP2_ROOT}/openvdb/${SPCOMP2_FULLBOOST_SUFFIX}/${OPENVDB_SPCOMP2_VERSION}
OPENVDB_VERSION ?= 6.2.2-3
OpenVDB_ROOT ?= ${REZ_PACKAGE_ROOT}/OpenVDB/${OPENVDB_VERSION}/${SPI_COMPILER_PLATFORM}/python-${PYTHON_VERSION}/boost-${BOOSTVERS}
else
OPENCOLORIO_VERSION ?= 1.1.1-1
OpenColorIO_ROOT ?= ${REZ_PACKAGE_ROOT}/OpenColorIO/${OPENCOLORIO_VERSION}/${SPI_COMPILER_PLATFORM}
MY_CMAKE_FLAGS += -DOPENCOLORIO_LIBRARY=${OpenColorIO_ROOT}/lib/libOpenColorIO_SPI.so
# Anybody remember why we needed Field3d disabled for SpComp2?
FIELD3D_HOME ?= ${SPCOMP2_ROOT}/Field3D/${SPCOMP2_FULLBOOST_SUFFIX}/v412
endif
OPENVDB_ROOT_DIR ?= ${SPCOMP2_ROOT}/openvdb/${SPCOMP2_FULLBOOST_SUFFIX}/${OPENVDB_SPCOMP2_VERSION}
TBB_ROOT_DIR ?= /net/apps/rhel7/intel/tbb
Field3D_ROOT ?= ${SPCOMP2_ROOT}/Field3D/${SPCOMP2_FULLBOOST_SUFFIX}/v412
OPENVDB_VERSION ?= 6.2.2-3
OpenVDB_ROOT ?= ${REZ_PACKAGE_ROOT}/OpenVDB/${OPENVDB_VERSION}/${SPI_COMPILER_PLATFORM}/python-${PYTHON_VERSION}/boost-${BOOSTVERS}
endif
TBB_ROOT ?= /net/apps/rhel7/intel/tbb
TBB_LIBRARY ?= /net/apps/rhel7/intel/tbb/lib/intel64/gcc4.7
Libheif_ROOT=/shots/spi/home/lib/arnold/rhel7/libheif-1.3.2
MY_CMAKE_FLAGS += \
-DOCIO_PATH=${OCIO_PATH} \
-DFIELD3D_HOME=${FIELD3D_HOME} \
-DOPENVDB_ROOT_DIR=${OPENVDB_ROOT_DIR} \
-DTBB_ROOT_DIR=${TBB_ROOT_DIR} \
-DOpenColorIO_ROOT=${OpenColorIO_ROOT} \
-DField3D_ROOT=${Field3D_ROOT} \
-DOpenVDB_ROOT=${OpenVDB_ROOT} \
-DTBB_ROOT=${TBB_ROOT} \
-DTBB_LIBRARY=${TBB_LIBRARY} \
-DTBB_USE_DEBUG_BUILD=0 \
-DHDF5_CUSTOM=1 \
-DHDF5_LIBRARIES=/usr/lib64/libhdf5.so \
-DNuke_ROOT=/net/apps/rhel7/foundry/nuke${NUKE_VERSION} \
-DLIBRAW_INCLUDEDIR_HINT=/usr/include/libraw-0.18.11 \
-DLIBRAW_LIBDIR_HINT=/usr/lib64/libraw-0.18.11 \
-DLIBHEIF_PATH=/shots/spi/home/lib/arnold/rhel7/libheif-1.3.2 \
-DLibheif_ROOT=${Libheif_ROOT} \
-DFFMPEG_INCLUDES=/usr/include/ffmpegroot/ffmpeg34 \
-DFFMPEG_LIBRARIES="/usr/lib64/ffmpegroot/ffmpeg345/libavcodec.so;/usr/lib64/ffmpegroot/ffmpeg345/libavformat.so;/usr/lib64/ffmpegroot/ffmpeg345/libavutil.so;/usr/lib64/ffmpegroot/ffmpeg345/libswscale.so;" \
-DUSE_OPENCV=0 \
-DHIDE_SYMBOLS=1 \
-DVISIBILITY_MAP_FILE:STRING="${working_dir}/site/spi/hidesymbols.map"
# LibRaw
ifeq (${SPI_COMPILER_PLATFORM},gcc-4.8)
MY_CMAKE_FLAGS += -DLIBRAW_INCLUDEDIR_HINT=/usr/include/libraw-0.18.11
MY_CMAKE_FLAGS += -DLIBRAW_LIBDIR_HINT=/usr/lib64/libraw-0.18.11
LIBRAW_LIBDIR = /usr/lib64/libraw-0.18.11
else
LibRaw_ROOT ?= /shots/spi/home/software/packages/LibRaw/0.20.0-dev3/${SPI_COMPILER_PLATFORM}
MY_CMAKE_FLAGS += -DLibRaw_ROOT=${LibRaw_ROOT}
LIBRAW_LIBDIR = ${LibRaw_ROOT}/lib
endif
# Use libtiff I built myself, static, and try to hide its symbols.
MY_CMAKE_FLAGS += \
-DTIFF_INCLUDE_DIR:STRING=/usr/include \
@@ -244,12 +318,26 @@ else ifeq (${platform}, macosx)
MY_CMAKE_FLAGS += \
-DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8
USE_LIBCPLUSPLUS := 0
else ifeq (${COMPILER},clang6)
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=/usr/local/Cellar/llvm@6/6.0.1_1/bin/clang -DCMAKE_CXX_COMPILER=/usr/local/Cellar/llvm@6/6.0.1_1/bin/clang++
else ifeq (${COMPILER}, gcc9)
MY_CMAKE_FLAGS += \
-DCMAKE_C_COMPILER=gcc-9 -DCMAKE_CXX_COMPILER=g++-9
USE_LIBCPLUSPLUS := 0
else ifeq (${COMPILER}, gcc10)
MY_CMAKE_FLAGS += \
-DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10
USE_LIBCPLUSPLUS := 0
else ifeq (${COMPILER},clang7)
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=/usr/local/Cellar/llvm@7/7.0.1/bin/clang -DCMAKE_CXX_COMPILER=/usr/local/Cellar/llvm@7/7.0.1/bin/clang++
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=/usr/local/opt/llvm@7/bin/clang \
-DCMAKE_CXX_COMPILER=/usr/local/llvm@7/bin/clang++
else ifeq (${COMPILER},clang8)
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=/usr/local/Cellar/llvm/8.0.0/bin/clang -DCMAKE_CXX_COMPILER=/usr/local/Cellar/llvm/8.0.0/bin/clang++
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=/usr/local/opt/llvm@8/bin/clang \
-DCMAKE_CXX_COMPILER=/usr/local/opt/llvm@8/bin/clang++
else ifeq (${COMPILER},clang9)
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=/usr/local/opt/llvm@9/bin/clang \
-DCMAKE_CXX_COMPILER=/usr/local/opt/llvm@9/bin/clang++
else ifeq (${COMPILER},clang10)
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=/usr/local/opt/llvm/bin/clang \
-DCMAKE_CXX_COMPILER=/usr/local/opt/llvm/bin/clang++
else ifeq (${COMPILER},clang)
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
else ifeq (${COMPILER},gcc)
@@ -269,13 +357,35 @@ endif # endif ${SP_OS}
ifeq (${OIIO_SPIREZ},1)
# Rpath touch-ups
# NOTE: This MUST match the order and naming of the Rez variants
# set in rez/package.py.in
REZ_INSTALL_PATH := ${REZ_PACKAGE_ROOT}/${OIIO_REZ_NAME}/${OIIO_VERS}/${SPI_COMPILER_PLATFORM}/python-${PYTHON_VERSION}/boost-${BOOSTVERSSP}
MY_CMAKE_FLAGS += -DOIIO_REZ_INSTALL_PATH=${REZ_INSTALL_PATH}
MY_CMAKE_FLAGS += -DCMAKE_INSTALL_RPATH=${REZ_INSTALL_PATH}/lib
INSTALL_PREFIX := ${working_dir}/dist/${platform}
endif
ifneq (${VERBOSE},)
$(info MY_CMAKE_FLAGS: $(MY_CMAKE_FLAGS))
endif
############################################################################
# SpComp2 magic incantations follow. Here be dragons.
############################################################################
CPPSTDSUFFIX=
SPCOMP2_INSTALL_ROOT ?= $(SPCOMP2_ROOT)
BOOSTVERSSP?=${BOOSTVERS}${BOOSTSPSUFFIX}
SPARCH=${SP_OS}-$(SPCOMP2_COMPILER)$(CPPSTDSUFFIX)-boost$(subst .,,$(BOOSTVERSSP))
OIIO_SPCOMP2_PATH := ${SPCOMP2_INSTALL_ROOT}/OpenImageIO/${SPARCH}/v${OPENIMAGEIO_SPCOMP2_VERSION}
# $(info New rhel7 OIIO_SPCOMP2_PATH is ${OIIO_SPCOMP2_PATH})
PYVERNOSPACE=${shell echo ${PYTHON_VERSION} | sed "s/\\.//"}
SPPYARCH=$(SPARCH)-py$(PYVERNOSPACE)
@@ -283,33 +393,35 @@ SPPYARCH=$(SPARCH)-py$(PYVERNOSPACE)
all: dist
.PHONY: spcomp2_install spcomp2_install_local clean all
local: dist
.PHONY: spcomp2_install spcomp2_install_local spi clean all
spi: MY_CMAKE_FLAGS += -DCMAKE_DEBUG_POSTFIX=_d
spi: debug dist
comma:= ,
empty:=
space:= $(empty) $(empty)
INSTALL_BIN_LOCATION = /shots/spi/home/bin/${SP_OS}
SPCOMP2_INSTALL_ROOT ?= $(SPCOMP2_ROOT)
OIIO_SPCOMP2_PATH := ${SPCOMP2_INSTALL_ROOT}/OpenImageIO/$(SPARCH)/v${OPENIMAGEIO_SPCOMP2_VERSION}
INSTALL_SPCOMP2_CURRENT = $(SPCOMP2_INSTALL_ROOT)/OpenImageIO/$(SPARCH)/v$(OPENIMAGEIO_SPCOMP2_VERSION)
# $(info New rhel7 OIIO_SPCOMP2_PATH is ${OIIO_SPCOMP2_PATH})
INSTALL_BIN_LOCATION = $(INSTALL_SPCOMP2_CURRENT)/bin
SPCOMP2_LOCAL_PATH ?= /net/soft_scratch/users/$(USER)/SpComp2_test
SPCOMP2_RPATH_OPT ?= ${OCIO_PATH}/lib:${FIELD3D_HOME}/lib:/usr/lib64/libraw-0.18.11:${OPENVDB_ROOT_DIR}/lib:/shots/spi/home/lib/arnold/rhel7/libheif-1.3.2/lib:shots/spi/home/lib/arnold/rhel7/libde265-1.0.3/lib:${SPBOOST_LIB_DIR}
SPCOMP2_RPATH_DEBUG ?= ${OCIO_PATH}/lib/debug:${FIELD3D_HOME}/lib/debug:/usr/lib64/libraw-0.18.11:${OPENVDB_ROOT_DIR}/lib/debug:/shots/spi/home/lib/arnold/rhel7/libheif-1.3.2/lib:shots/spi/home/lib/arnold/rhel7/libde265-1.0.3/lib:${SPBOOST_LIB_DIR}
PYSPCOMP2_RPATH_OPT ?= ${SPCOMP2_RPATH_OPT}:${OIIO_SPCOMP2_PATH}/lib:${PYTHON_LIBRARY_DIR}
PYSPCOMP2_RPATH_DEBUG ?= ${SPCOMP2_RPATH_DEBUG}:${OIIO_SPCOMP2_PATH}/lib/debug:${PYTHON_LIBRARY_DIR}
spcomp2_install_local: SPCOMP2_INSTALL_ROOT = $(SPCOMP2_LOCAL_PATH)
spcomp2_install_local: INSTALL_BIN_LOCATION = $(INSTALL_SPCOMP2_CURRENT)/bin
spcomp2_install_local: spcomp2_install
local: dist
SPCOMP2_RPATH_OPT ?= ${OpenEXR_ROOT}/lib:${OpenColorIO_ROOT}/lib:${Field3D_ROOT}/lib:${LIBRAW_LIBDIR}:${OpenVDB_ROOT}/lib:${Libheif_ROOT}/lib:shots/spi/home/lib/arnold/rhel7/libde265-1.0.3/lib:${TBB_ROOT}/lib/intel64/gcc4.7:${SPBOOST_LIB_DIR}
SPCOMP2_RPATH_DEBUG ?= ${OpenEXR_ROOT}/lib:${OpenColorIO_ROOT}/lib:${Field3D_ROOT}/lib/debug:${LIBRAW_LIBDIR}:${OpenVDB_ROOT}/lib/debug:${Libheif_ROOT}/lib:shots/spi/home/lib/arnold/rhel7/libde265-1.0.3/lib:${TBB_ROOT}/lib/intel64/gcc4.7:${SPBOOST_LIB_DIR}
PYSPCOMP2_RPATH_OPT ?= ${SPCOMP2_RPATH_OPT}:${OIIO_SPCOMP2_PATH}/lib:${PYTHON_LIBRARY_DIR}
PYSPCOMP2_RPATH_DEBUG ?= ${SPCOMP2_RPATH_DEBUG}:${OIIO_SPCOMP2_PATH}/lib/debug:${PYTHON_LIBRARY_DIR}
spcomp2: MY_CMAKE_FLAGS += \
-DCMAKE_SKIP_BUILD_RPATH:BOOL=ON \
-DCMAKE_SKIP_BUILD_RPATH:BOOL=OFF \
-DCMAKE_INSTALL_RPATH=$(SPCOMP2_INSTALL_ROOT)/OpenImageIO/$(SPARCH)/v$(OPENIMAGEIO_SPCOMP2_VERSION)/lib \
-DCMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOL=ON \
-DPYLIB_INCLUDE_SONAME:BOOL=ON \
@@ -319,7 +431,7 @@ spcomp2: MY_CMAKE_FLAGS += \
spcomp2: dist
spcomp2_debug: MY_CMAKE_FLAGS += \
-DCMAKE_SKIP_BUILD_RPATH:BOOL=ON \
-DCMAKE_SKIP_BUILD_RPATH:BOOL=OFF \
-DCMAKE_INSTALL_RPATH=$(SPCOMP2_INSTALL_ROOT)/OpenImageIO/$(SPARCH)/v$(OPENIMAGEIO_SPCOMP2_VERSION)/lib \
-DCMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOL=ON \
-DPYLIB_INCLUDE_SONAME:BOOL=ON \
@@ -372,4 +484,3 @@ spcomp2_install: spcomp2_install_fixup_${SP_OS}
--srcdir=${dist_dir}/python \
--builddir_o=${dist_dir}/python \
--builddir_d=${dist_dir}.debug/python
+6
View File
@@ -0,0 +1,6 @@
<cfg>
<version>@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@.@PROJECT_VERSION_TWEAK@</version>
<appdir architecture="@SP_OS@">@OIIO_REZ_INSTALL_PATH@</appdir>
<launchprogram></launchprogram>
<setup></setup>
</cfg>
+16
View File
@@ -0,0 +1,16 @@
option (${PROJ_NAME}_SPIREZ "Enable extra bits for building for SPI Rez install" OFF)
set (${PROJ_NAME}_REZ_PACKAGE_NAME CACHE STRING "${PROJECT_NAME}")
if (${PROJ_NAME}_SPIREZ)
# message (STATUS "Creating package.py from package.py.in")
# configure_file ("${PROJECT_SOURCE_DIR}/site/spi/rez/package.py.in" "${CMAKE_BINARY_DIR}/package.py")
set (appcfg_filename "${CMAKE_BINARY_DIR}/${PROJECT_NAME}_${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}.${PROJECT_VERSION_TWEAK}.xml")
configure_file ("${PROJECT_SOURCE_DIR}/site/spi/appcfg.xml.in" "${appcfg_filename}")
# install (FILES ${CMAKE_BINARY_DIR}/package.py
# "${PROJECT_SOURCE_DIR}/site/spi/rez/CMakeLists.txt"
# ${appcfg_filename}
# DESTINATION ${CMAKE_INSTALL_PREFIX}
# COMPONENT developer)
endif ()
+18
View File
@@ -0,0 +1,18 @@
#!/usr/bin/env python
# This helper script takes a major.minor.patch semantic version string
# ("2.1.1") and reformats it into the dot-less zero-padded version like
# "20101". This is necessary to turn external release designations into
# integer SpComp2 version numbers.
from __future__ import print_function
from __future__ import absolute_import
import sys
if len(sys.argv) != 2 :
print('Need 1 argument: version number with dots')
exit(1)
vers = sys.argv[1]
parts = vers.split('.')
print ('{:d}{:02d}{:02d}'.format(int(parts[0]), int(parts[1]), int(parts[2])))
+4
View File
@@ -1 +1,5 @@
# Copyright 2008-present Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
add_oiio_plugin (bmpinput.cpp bmpoutput.cpp bmp_pvt.cpp)
+5 -27
View File
@@ -1,34 +1,12 @@
/*
Copyright 2008-2009 Larry Gritz and the other authors and contributors.
All Rights Reserved.
// Copyright 2008-present Contributors to the OpenImageIO project.
// SPDX-License-Identifier: BSD-3-Clause
// https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the software's owners nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
(This is the Modified BSD License)
*/
#include "bmp_pvt.h"
#include <OpenImageIO/fmath.h>
OIIO_PLUGIN_NAMESPACE_BEGIN
namespace bmp_pvt {
+7 -34
View File
@@ -1,39 +1,12 @@
/*
Copyright 2008-2009 Larry Gritz and the other authors and contributors.
All Rights Reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the software's owners nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
(This is the Modified BSD License)
*/
// Copyright 2008-present Contributors to the OpenImageIO project.
// SPDX-License-Identifier: BSD-3-Clause
// https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
#pragma once
#include <cstdio>
#include <OpenImageIO/filesystem.h>
#include <OpenImageIO/fmath.h>
#include <OpenImageIO/imageio.h>
OIIO_PLUGIN_NAMESPACE_BEGIN
@@ -155,14 +128,14 @@ public:
void* data) override;
private:
int m_padded_scanline_size;
int64_t m_padded_scanline_size;
int m_pad_size;
FILE* m_fd;
bmp_pvt::BmpFileHeader m_bmp_header;
bmp_pvt::DibInformationHeader m_dib_header;
std::string m_filename;
std::vector<bmp_pvt::color_table> m_colortable;
fpos_t m_image_start;
int64_t m_image_start;
void init(void)
{
m_padded_scanline_size = 0;
@@ -193,12 +166,12 @@ public:
stride_t ystride, stride_t zstride) override;
private:
int m_padded_scanline_size;
int64_t m_padded_scanline_size;
FILE* m_fd;
std::string m_filename;
bmp_pvt::BmpFileHeader m_bmp_header;
bmp_pvt::DibInformationHeader m_dib_header;
fpos_t m_image_start;
int64_t m_image_start;
unsigned int m_dither;
std::vector<unsigned char> m_tilebuffer;
+30 -56
View File
@@ -1,32 +1,6 @@
/*
Copyright 2008-2009 Larry Gritz and the other authors and contributors.
All Rights Reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the software's owners nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
(This is the Modified BSD License)
*/
// Copyright 2008-present Contributors to the OpenImageIO project.
// SPDX-License-Identifier: BSD-3-Clause
// https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
#include "bmp_pvt.h"
OIIO_PLUGIN_NAMESPACE_BEGIN
@@ -77,24 +51,24 @@ BmpInput::open(const std::string& name, ImageSpec& spec)
m_fd = Filesystem::fopen(m_filename, "rb");
if (!m_fd) {
error("Could not open file \"%s\"", name.c_str());
errorf("Could not open file \"%s\"", name);
return false;
}
// we read header of the file that we think is BMP file
if (!m_bmp_header.read_header(m_fd)) {
error("\"%s\": wrong bmp header size", m_filename.c_str());
errorf("\"%s\": wrong bmp header size", m_filename);
close();
return false;
}
if (!m_bmp_header.isBmp()) {
error("\"%s\" is not a BMP file, magic number doesn't match",
m_filename.c_str());
errorf("\"%s\" is not a BMP file, magic number doesn't match",
m_filename);
close();
return false;
}
if (!m_dib_header.read_header(m_fd)) {
error("\"%s\": wrong bitmap header size", m_filename.c_str());
errorf("\"%s\": wrong bitmap header size", m_filename);
close();
return false;
}
@@ -140,7 +114,7 @@ BmpInput::open(const std::string& name, ImageSpec& spec)
// file pointer is set to the beginning of image data
// we save this position - it will be helpfull in read_native_scanline
fgetpos(m_fd, &m_image_start);
m_image_start = Filesystem::ftell(m_fd);
spec = m_spec;
return true;
@@ -149,7 +123,7 @@ BmpInput::open(const std::string& name, ImageSpec& spec)
bool
BmpInput::read_native_scanline(int subimage, int miplevel, int y, int z,
BmpInput::read_native_scanline(int subimage, int miplevel, int y, int /*z*/,
void* data)
{
lock_guard lock(m_mutex);
@@ -162,17 +136,17 @@ BmpInput::read_native_scanline(int subimage, int miplevel, int y, int z,
// if the height is positive scanlines are stored bottom-up
if (m_dib_header.width >= 0)
y = m_spec.height - y - 1;
const int scanline_off = y * m_padded_scanline_size;
const int64_t scanline_off = y * m_padded_scanline_size;
std::vector<unsigned char> fscanline(m_padded_scanline_size);
fsetpos(m_fd, &m_image_start);
fseek(m_fd, scanline_off, SEEK_CUR);
size_t n = fread(&fscanline[0], 1, m_padded_scanline_size, m_fd);
std::unique_ptr<unsigned char[]> fscanline(
new unsigned char[m_padded_scanline_size]);
Filesystem::fseek(m_fd, m_image_start + scanline_off, SEEK_SET);
size_t n = fread(fscanline.get(), 1, m_padded_scanline_size, m_fd);
if (n != (size_t)m_padded_scanline_size) {
if (feof(m_fd))
error("Hit end of file unexpectedly");
errorf("Hit end of file unexpectedly");
else
error("read error");
errorf("read error");
return false; // Read failed
}
@@ -183,17 +157,18 @@ BmpInput::read_native_scanline(int subimage, int miplevel, int y, int z,
for (unsigned int i = 0; i < m_spec.scanline_bytes();
i += m_spec.nchannels)
std::swap(fscanline[i], fscanline[i + 2]);
memcpy(data, &fscanline[0], m_spec.scanline_bytes());
memcpy(data, fscanline.get(), m_spec.scanline_bytes());
return true;
}
std::vector<unsigned char> mscanline(m_spec.scanline_bytes());
size_t scanline_bytes = m_spec.scanline_bytes();
std::unique_ptr<unsigned char[]> mscanline(
new unsigned char[scanline_bytes]);
if (m_dib_header.bpp == 16) {
const uint16_t RED = 0x7C00;
const uint16_t GREEN = 0x03E0;
const uint16_t BLUE = 0x001F;
for (unsigned int i = 0, j = 0; j < m_spec.scanline_bytes();
i += 2, j += 3) {
for (unsigned int i = 0, j = 0; j < scanline_bytes; i += 2, j += 3) {
uint16_t pixel = (uint16_t) * (&fscanline[i]);
mscanline[j] = (uint8_t)((pixel & RED) >> 8);
mscanline[j + 1] = (uint8_t)((pixel & GREEN) >> 4);
@@ -201,16 +176,14 @@ BmpInput::read_native_scanline(int subimage, int miplevel, int y, int z,
}
}
if (m_dib_header.bpp == 8) {
for (unsigned int i = 0, j = 0; j < m_spec.scanline_bytes();
++i, j += 3) {
for (unsigned int i = 0, j = 0; j < scanline_bytes; ++i, j += 3) {
mscanline[j] = m_colortable[fscanline[i]].r;
mscanline[j + 1] = m_colortable[fscanline[i]].g;
mscanline[j + 2] = m_colortable[fscanline[i]].b;
}
}
if (m_dib_header.bpp == 4) {
for (unsigned int i = 0, j = 0; j + 6 < m_spec.scanline_bytes();
++i, j += 6) {
for (unsigned int i = 0, j = 0; j + 6 < scanline_bytes; ++i, j += 6) {
uint8_t mask = 0xF0;
mscanline[j] = m_colortable[(fscanline[i] & mask) >> 4].r;
mscanline[j + 1] = m_colortable[(fscanline[i] & mask) >> 4].g;
@@ -222,9 +195,9 @@ BmpInput::read_native_scanline(int subimage, int miplevel, int y, int z,
}
}
if (m_dib_header.bpp == 1) {
for (unsigned int i = 0, k = 0; i < fscanline.size(); ++i) {
for (int64_t i = 0, k = 0; i < m_padded_scanline_size; ++i) {
for (int j = 7; j >= 0; --j, k += 3) {
if (k + 2 >= mscanline.size())
if (size_t(k + 2) >= scanline_bytes)
break;
int index = 0;
if (fscanline[i] & (1 << j))
@@ -235,7 +208,7 @@ BmpInput::read_native_scanline(int subimage, int miplevel, int y, int z,
}
}
}
memcpy(data, &mscanline[0], m_spec.scanline_bytes());
memcpy(data, &mscanline[0], scanline_bytes);
return true;
}
@@ -271,9 +244,10 @@ BmpInput::read_color_table(void)
size_t n = fread(&m_colortable[i], 1, entry_size, m_fd);
if (n != entry_size) {
if (feof(m_fd))
error("Hit end of file unexpectedly while reading color table");
errorf(
"Hit end of file unexpectedly while reading color table");
else
error("read error while reading color table");
errorf("read error while reading color table");
return false; // Read failed
}
}
+30 -47
View File
@@ -1,32 +1,6 @@
/*
Copyright 2008-2009 Larry Gritz and the other authors and contributors.
All Rights Reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the software's owners nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
(This is the Modified BSD License)
*/
// Copyright 2008-present Contributors to the OpenImageIO project.
// SPDX-License-Identifier: BSD-3-Clause
// https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
#include <OpenImageIO/strutil.h>
@@ -64,7 +38,7 @@ bool
BmpOutput::open(const std::string& name, const ImageSpec& spec, OpenMode mode)
{
if (mode != Create) {
error("%s does not support subimages or MIP levels", format_name());
errorf("%s does not support subimages or MIP levels", format_name());
return false;
}
@@ -73,8 +47,18 @@ BmpOutput::open(const std::string& name, const ImageSpec& spec, OpenMode mode)
m_spec = spec;
if (m_spec.nchannels != 3 && m_spec.nchannels != 4) {
error("%s does not support %d-channel images\n", format_name(),
m_spec.nchannels);
errorf("%s does not support %d-channel images\n", format_name(),
m_spec.nchannels);
return false;
}
// Only support 8 bit channels for now.
m_spec.set_format(TypeDesc::UINT8);
m_dither = m_spec.get_int_attribute("oiio:dither", 0);
int64_t file_size = m_spec.image_bytes() + BMP_HEADER_SIZE + WINDOWS_V3;
if (file_size >= int64_t(1) << 32) {
errorf("%s does not support files over 4GB in size\n", format_name());
return false;
}
@@ -89,11 +73,7 @@ BmpOutput::open(const std::string& name, const ImageSpec& spec, OpenMode mode)
// Scanline size is rounded up to align to 4-byte boundary
m_padded_scanline_size = ((m_spec.width * m_spec.nchannels) + 3) & ~3;
fgetpos(m_fd, &m_image_start);
// Only support 8 bit channels for now.
m_spec.set_format(TypeDesc::UINT8);
m_dither = m_spec.get_int_attribute("oiio:dither", 0);
m_image_start = Filesystem::ftell(m_fd);
// If user asked for tiles -- which this format doesn't support, emulate
// it by buffering the whole image.
@@ -110,21 +90,23 @@ BmpOutput::write_scanline(int y, int z, TypeDesc format, const void* data,
stride_t xstride)
{
if (y > m_spec.height) {
error("Attempt to write too many scanlines to %s", m_filename.c_str());
errorf("Attempt to write too many scanlines to %s", m_filename);
close();
return false;
}
if (m_spec.width >= 0)
y = (m_spec.height - y - 1);
int scanline_off = y * m_padded_scanline_size;
fsetpos(m_fd, &m_image_start);
fseek(m_fd, scanline_off, SEEK_CUR);
int64_t scanline_off = y * m_padded_scanline_size;
Filesystem::fseek(m_fd, m_image_start + scanline_off, SEEK_SET);
std::vector<unsigned char> scratch;
data = to_native_scanline(format, data, xstride, scratch, m_dither, y, z);
std::vector<unsigned char> buf(m_padded_scanline_size);
memcpy(&buf[0], data, m_spec.scanline_bytes());
std::vector<unsigned char> buf;
buf.reserve(m_padded_scanline_size); // reserve enough for padded scanline
buf.assign((const unsigned char*)data,
(const unsigned char*)data + m_spec.scanline_bytes());
buf.resize(m_padded_scanline_size, 0); // pad with zeroes if needed
// Swap RGB pixels into BGR format
if (m_spec.nchannels >= 3)
@@ -159,7 +141,7 @@ BmpOutput::close(void)
bool ok = true;
if (m_spec.tile_width) {
// Handle tile emulation -- output the buffered pixels
ASSERT(m_tilebuffer.size());
OIIO_DASSERT(m_tilebuffer.size());
ok &= write_scanlines(m_spec.y, m_spec.y + m_spec.height, 0,
m_spec.format, &m_tilebuffer[0]);
std::vector<unsigned char>().swap(m_tilebuffer);
@@ -174,9 +156,10 @@ BmpOutput::close(void)
void
BmpOutput::create_and_write_file_header(void)
{
m_bmp_header.magic = MAGIC_BM;
const int data_size = m_spec.width * m_spec.height * m_spec.nchannels;
const int file_size = data_size + BMP_HEADER_SIZE + WINDOWS_V3;
m_bmp_header.magic = MAGIC_BM;
int64_t data_size = int64_t(m_spec.width) * m_spec.height
* m_spec.nchannels;
int64_t file_size = data_size + BMP_HEADER_SIZE + WINDOWS_V3;
m_bmp_header.fsize = file_size;
m_bmp_header.res1 = 0;
m_bmp_header.res2 = 0;
+1 -1
View File
@@ -5,6 +5,6 @@ includedir=${prefix}/include
Name: OpenImageIO
Description: OpenImageIO is a library for reading and writing images.
Version: @OIIO_VERSION_MAJOR@.@OIIO_VERSION_MINOR@.@OIIO_VERSION_PATCH@
Version: @PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@.@PROJECT_VERSION_TWEAK@
Libs: -L${libdir} -lOpenImageIO
Cflags: -I${includedir}/OpenImageIO
+36
View File
@@ -0,0 +1,36 @@
#!/usr/bin/env bash
# Utility script to download and build cmake
# Exit the whole script if any command fails.
set -ex
echo "Building cmake"
uname
CMAKE_VERSION=${CMAKE_VERSION:=3.12.4}
LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=${PWD}/ext}
CMAKE_INSTALL_DIR=${CMAKE_INSTALL_DIR:=${LOCAL_DEPS_DIR}/cmake}
if [[ `uname` == "Linux" && `uname -m` == "x86_64" ]] ; then
mkdir -p ${CMAKE_INSTALL_DIR} || true
curl --location "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-Linux-x86_64.sh" -o "cmake.sh"
sh cmake.sh --skip-license --prefix=${CMAKE_INSTALL_DIR}
export PATH=${CMAKE_INSTALL_DIR}/bin:$PATH
fi
if [[ `uname` == "Linux" && `uname -m` == "aarch64" ]] ; then
mkdir -p ${CMAKE_INSTALL_DIR} || true
curl --location https://anaconda.org/conda-forge/cmake/3.17.0/download/linux-aarch64/cmake-3.17.0-h28c56e5_0.tar.bz2 -o cmake-3.17.0-h28c56e5_0.tar.bz2
tar -xjvf cmake-3.17.0-h28c56e5_0.tar.bz2 -C ${CMAKE_INSTALL_DIR}
export PATH=${CMAKE_INSTALL_DIR}/bin:$PATH
# In case we ever need to build from scratch:
# curl --location "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}.tar.gz" -o cmake.tar.gz
# tar xzf cmake.tar.gz
# pushd cmake-${CMAKE_VERSION}
# CXX="ccache $CXX" ./bootstrap --parallel=${PARALLEL:=4} --enable-ccache
# CXX="ccache $CXX" timeout 2100 time make ${PAR_MAKEFAGS} || true
# export PATH=${CMAKE_INSTALL_DIR}/bin:$PWD/bin:$PATH
# popd
fi
+54
View File
@@ -0,0 +1,54 @@
#!/usr/bin/env bash
# Utility script to download and build libjpeg-turbo
#
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio
# Exit the whole script if any command fails.
set -ex
# Repo and branch/tag/commit of libjpeg-turbo to download if we don't have it yet
LIBJPEGTURBO_REPO=${LIBJPEGTURBO_REPO:=https://github.com/libjpeg-turbo/libjpeg-turbo.git}
LIBJPEGTURBO_VERSION=${LIBJPEGTURBO_VERSION:=2.0.5}
# Where to put libjpeg-turbo repo source (default to the ext area)
LIBJPEGTURBO_SRC_DIR=${LIBJPEGTURBO_SRC_DIR:=${PWD}/ext/libjpeg-turbo}
# Temp build area (default to a build/ subdir under source)
LIBJPEGTURBO_BUILD_DIR=${LIBJPEGTURBO_BUILD_DIR:=${LIBJPEGTURBO_SRC_DIR}/build}
# Install area for libjpeg-turbo (default to ext/dist)
LIBJPEGTURBO_INSTALL_DIR=${LIBJPEGTURBO_INSTALL_DIR:=${PWD}/ext/dist}
#LIBJPEGTURBO_CONFIG_OPTS=${LIBJPEGTURBO_CONFIG_OPTS:=}
pwd
echo "libjpeg-turbo install dir will be: ${LIBJPEGTURBO_INSTALL_DIR}"
mkdir -p ./ext
pushd ./ext
# Clone libjpeg-turbo project from GitHub and build
if [[ ! -e ${LIBJPEGTURBO_SRC_DIR} ]] ; then
echo "git clone ${LIBJPEGTURBO_REPO} ${LIBJPEGTURBO_SRC_DIR}"
git clone ${LIBJPEGTURBO_REPO} ${LIBJPEGTURBO_SRC_DIR}
fi
cd ${LIBJPEGTURBO_SRC_DIR}
echo "git checkout ${LIBJPEGTURBO_VERSION} --force"
git checkout ${LIBJPEGTURBO_VERSION} --force
mkdir -p ${LIBJPEGTURBO_BUILD_DIR}
cd ${LIBJPEGTURBO_BUILD_DIR}
time cmake --config Release \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${LIBJPEGTURBO_INSTALL_DIR} \
${LIBJPEGTURBO_CONFIG_OPTS} ..
time cmake --build . --config Release --target install
ls -R ${LIBJPEGTURBO_INSTALL_DIR}
popd
# Set up paths. These will only affect the caller if this script is
# run with 'source' rather than in a separate shell.
export JPEGTurbo_ROOT=$LIBJPEGTURBO_INSTALL_DIR
+56
View File
@@ -0,0 +1,56 @@
#!/usr/bin/env bash
# Utility script to download and build libpng
#
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio
# Exit the whole script if any command fails.
set -ex
# Repo and branch/tag/commit of libpng to download if we don't have it yet
LIBPNG_REPO=${LIBPNG_REPO:=https://github.com/glennrp/libpng.git}
LIBPNG_VERSION=${LIBPNG_VERSION:=v1.6.35}
# Where to put libpng repo source (default to the ext area)
LIBPNG_SRC_DIR=${LIBPNG_SRC_DIR:=${PWD}/ext/libpng}
# Temp build area (default to a build/ subdir under source)
LIBPNG_BUILD_DIR=${LIBPNG_BUILD_DIR:=${LIBPNG_SRC_DIR}/build}
# Install area for libpng (default to ext/dist)
LIBPNG_INSTALL_DIR=${LIBPNG_INSTALL_DIR:=${PWD}/ext/dist}
#LIBPNG_CONFIG_OPTS=${LIBPNG_CONFIG_OPTS:=}
pwd
echo "libpng install dir will be: ${LIBPNG_INSTALL_DIR}"
mkdir -p ./ext
pushd ./ext
# Clone libpng project from GitHub and build
if [[ ! -e ${LIBPNG_SRC_DIR} ]] ; then
echo "git clone ${LIBPNG_REPO} ${LIBPNG_SRC_DIR}"
git clone ${LIBPNG_REPO} ${LIBPNG_SRC_DIR}
fi
cd ${LIBPNG_SRC_DIR}
echo "git checkout ${LIBPNG_VERSION} --force"
git checkout ${LIBPNG_VERSION} --force
mkdir -p ${LIBPNG_BUILD_DIR}
cd ${LIBPNG_BUILD_DIR}
time cmake --config Release \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${LIBPNG_INSTALL_DIR} \
-DPNG_EXECUTABLES=OFF \
-DPNG_TESTS=OFF \
${LIBPNG_CONFIG_OPTS} ..
time cmake --build . --config Release --target install
ls -R ${LIBPNG_INSTALL_DIR}
popd
# Set up paths. These will only affect the caller if this script is
# run with 'source' rather than in a separate shell.
export PNG_ROOT=$LIBPNG_INSTALL_DIR
+53
View File
@@ -0,0 +1,53 @@
#!/usr/bin/env bash
# Utility script to download and build LibRaw
# Exit the whole script if any command fails.
set -ex
# Which LibRaw to retrieve, how to build it
LIBRAW_REPO=${LIBRAW_REPO:=https://github.com/LibRaw/LibRaw.git}
LIBRAW_VERSION=${LIBRAW_VERSION:=0.19.5}
LIBRAW_BRANCH=${LIBRAW_BRANCH:=${LIBRAW_VERSION}}
# Where to install the final results
LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=${PWD}/ext}
LIBRAW_SOURCE_DIR=${LIBRAW_SOURCE_DIR:=${LOCAL_DEPS_DIR}/libraw}
LIBRAW_BUILD_DIR=${LIBRAW_BUILD_DIR:=${LOCAL_DEPS_DIR}/libraw-build}
LIBRAW_INSTALL_DIR=${LIBRAW_INSTALL_DIR:=${LOCAL_DEPS_DIR}/libraw-install}
LIBRAW_BUILD_TYPE=${LIBRAW_BUILD_TYPE:=Release}
pwd
echo "Building LibRaw ${LIBRAW_BRANCH}"
echo " build dir will be: ${LIBRAW_BUILD_DIR}"
echo " install dir will be: ${LIBRAW_INSTALL_DIR}"
echo " build type is ${LIBRAW_BUILD_TYPE}"
# Clone LibRaw project (including IlmBase) from GitHub and build
if [[ ! -e ${LIBRAW_SOURCE_DIR} ]] ; then
echo "git clone ${LIBRAW_REPO} ${LIBRAW_SOURCE_DIR}"
git clone ${LIBRAW_REPO} ${LIBRAW_SOURCE_DIR}
fi
mkdir -p ${LIBRAW_INSTALL_DIR} && true
mkdir -p ${LIBRAW_BUILD_DIR} && true
pushd ${LIBRAW_SOURCE_DIR}
git checkout ${LIBRAW_BRANCH} --force
aclocal
autoreconf --install
./configure --prefix=${LIBRAW_INSTALL_DIR}
time make -j ${PARALLEL:=4} && make install
popd
#ls -R ${LIBRAW_INSTALL_DIR}
# Set up paths. These will only affect the caller if this script is
# run with 'source' rather than in a separate shell.
export LibRaw_ROOT=$LIBRAW_INSTALL_DIR
export LibRaw_LIBRARY_DIR=$LIBRAW_INSTALL_DIR/lib
export LD_LIBRARY_PATH=$LIBRAW_ROOT/lib:$LD_LIBRARY_PATH
+52
View File
@@ -0,0 +1,52 @@
#!/usr/bin/env bash
# Utility script to download and build libtiff
# Exit the whole script if any command fails.
set -ex
LIBTIFF_REPO=${LIBTIFF_REPO:=https://gitlab.com/libtiff/libtiff.git}
LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=${PWD}/ext}
LIBTIFF_BUILD_DIR=${LIBTIFF_BUILD_DIR:=${LOCAL_DEPS_DIR}/libtiff}
LIBTIFF_INSTALL_DIR=${LIBTIFF_INSTALL_DIR:=${PWD}/ext/dist}
LIBTIFF_VERSION=${LIBTIFF_VERSION:=v4.1.0}
if [[ `uname` == `Linux` ]] ; then
LIBTIFF_CXX_FLAGS=${LIBTIFF_CXX_FLAGS:="-O3 -Wno-unused-function -Wno-deprecated-declarations -Wno-cast-qual -Wno-write-strings"}
fi
LIBTIFF_BUILDOPTS="${LIBTIFF_BUILDOPTS}"
BASEDIR=`pwd`
pwd
echo "libtiff install dir will be: ${LIBTIFF_INSTALL_DIR}"
mkdir -p ${LOCAL_DEPS_DIR}
pushd ${LOCAL_DEPS_DIR}
# Clone libtiff project from GitHub and build
if [[ ! -e libtiff ]] ; then
echo "git clone ${LIBTIFF_REPO} libtiff"
git clone ${LIBTIFF_REPO} libtiff
fi
cd libtiff
echo "git checkout ${LIBTIFF_VERSION} --force"
git checkout ${LIBTIFF_VERSION} --force
mkdir -p build
cd build
time cmake --config Release \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${LIBTIFF_INSTALL_DIR} \
-DCMAKE_CXX_FLAGS="${LIBTIFF_CXX_FLAGS}" \
${LIBTIFF_BUILDOPTS} ..
time cmake --build . --config Release --target install
popd
ls -R ${LIBTIFF_INSTALL_DIR}
#echo "listing .."
#ls ..
# Set up paths. These will only affect the caller if this script is
# run with 'source' rather than in a separate shell.
export TIFF_ROOT=$LIBTIFF_INSTALL_DIR
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${LIBTIFF_INSTALL_DIR}/lib
+42
View File
@@ -0,0 +1,42 @@
#!/usr/bin/env bash
# Utility script to download and build LLVM & clang
# Exit the whole script if any command fails.
set -ex
echo "Building LLVM"
uname
if [[ `uname` == "Linux" ]] ; then
LLVM_VERSION=${LLVM_VERSION:=8.0.0}
LLVM_INSTALL_DIR=${LLVM_INSTALL_DIR:=${PWD}/llvm-install}
if [[ "$GITHUB_WORKFLOW" != "" ]] ; then
LLVM_DISTRO_NAME=${LLVM_DISTRO_NAME:=ubuntu-18.04}
elif [[ "$TRAVIS_DIST" == "trusty" ]] ; then
LLVM_DISTRO_NAME=${LLVM_DISTRO_NAME:=ubuntu-14.04}
elif [[ "$TRAVIS_DIST" == "xenial" ]] ; then
LLVM_DISTRO_NAME=${LLVM_DISTRO_NAME:=ubuntu-16.04}
elif [[ "$TRAVIS_DIST" == "bionic" ]] ; then
LLVM_DISTRO_NAME=${LLVM_DISTRO_NAME:=ubuntu-18.04}
else
LLVM_DISTRO_NAME=${LLVM_DISTRO_NAME:=error}
fi
if [ "$LLVM_VERSION" == "5.0.0" ] ; then
LLVMTAR=clang+llvm-${LLVM_VERSION}-linux-x86_64-${LLVM_DISTRO_NAME}.tar.xz
else
LLVMTAR=clang+llvm-${LLVM_VERSION}-x86_64-linux-gnu-${LLVM_DISTRO_NAME}.tar.xz
fi
echo LLVMTAR = $LLVMTAR
curl --location http://releases.llvm.org/${LLVM_VERSION}/${LLVMTAR} -o $LLVMTAR
ls -l $LLVMTAR
tar xf $LLVMTAR
rm -f $LLVMTAR
echo "Installed ${LLVM_VERSION} in ${LLVM_INSTALL_DIR}"
mkdir -p $LLVM_INSTALL_DIR && true
mv clang+llvm*/* $LLVM_INSTALL_DIR
export LLVM_DIRECTORY=$LLVM_INSTALL_DIR
export PATH=${LLVM_INSTALL_DIR}/bin:$PATH
ls -a $LLVM_DIRECTORY
fi
+28 -17
View File
@@ -1,41 +1,52 @@
#!/bin/bash
#!/usr/bin/env bash
OCIOREPO=${OCIOREPO:=https://github.com/imageworks/OpenColorIO.git}
OCIOBUILDDIR=${OCIOBUILDDIR:=${PWD}/ext/OpenColorIO}
OCIOINSTALLDIR=${OCIOINSTALLDIR:=${PWD}/ext/OpenColorIO/dist}
OCIOBRANCH=${OCIOBRANCH:=v1.1.0}
OCIOCXXFLAGS=${OCIOCXXFLAGS:="-Wno-unused-function -Wno-deprecated-declarations -Wno-cast-qual -Wno-write-strings"}
# Utility script to download and build OpenColorIO
# Exit the whole script if any command fails.
set -ex
OCIO_REPO=${OCIO_REPO:=https://github.com/AcademySoftwareFoundation/OpenColorIO.git}
LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=${PWD}/ext}
OCIO_BUILD_DIR=${OCIO_BUILD_DIR:=${LOCAL_DEPS_DIR}/OpenColorIO}
OCIO_INSTALL_DIR=${OCIO_INSTALL_DIR:=${LOCAL_DEPS_DIR}/OpenColorIO/dist}
OCIO_VERSION=${OCIO_VERSION:=1.1.1}
OCIO_BRANCH=${OCIO_BRANCH:=v${OCIO_VERSION}}
OCIO_CXX_FLAGS=${OCIO_CXX_FLAGS:="-Wno-unused-function -Wno-deprecated-declarations -Wno-cast-qual -Wno-write-strings"}
# Just need libs:
OCIO_BUILDOPTS="-DOCIO_BUILD_APPS=OFF -DOCIO_BUILD_NUKE=OFF \
-DOCIO_BUILD_DOCS=OFF -DOCIO_BUILD_TESTS=OFF \
-DOCIO_BUILD_PYTHON=OFF -DOCIO_BUILD_PYGLUE=OFF \
-DOCIO_BUILD_JAVA=OFF"
-DOCIO_BUILD_JAVA=OFF \
-DOCIO_BUILD_STATIC=${OCIO_BUILD_STATIC:=OFF}"
BASEDIR=`pwd`
pwd
echo "OpenColorIO install dir will be: ${OCIOINSTALLDIR}"
echo "OpenColorIO install dir will be: ${OCIO_INSTALL_DIR}"
mkdir -p ./ext
pushd ./ext
mkdir -p ${LOCAL_DEPS_DIR}
pushd ${LOCAL_DEPS_DIR}
# Clone OpenColorIO project from GitHub and build
if [[ ! -e OpenColorIO ]] ; then
echo "git clone ${OCIOREPO} OpenColorIO"
git clone ${OCIOREPO} OpenColorIO
echo "git clone ${OCIO_REPO} OpenColorIO"
git clone ${OCIO_REPO} OpenColorIO
fi
cd OpenColorIO
echo "git checkout ${OCIOBRANCH} --force"
git checkout ${OCIOBRANCH} --force
echo "git checkout ${OCIO_BRANCH} --force"
git checkout ${OCIO_BRANCH} --force
mkdir -p build
time (cd build ; cmake --config Release -DCMAKE_INSTALL_PREFIX=${OCIOINSTALLDIR} -DCMAKE_CXX_FLAGS="${OCIOCXXFLAGS}" ${OCIO_BUILDOPTS} .. && make clean && make -j 4 && make install)
cd build
time cmake --config Release -DCMAKE_INSTALL_PREFIX=${OCIO_INSTALL_DIR} -DCMAKE_CXX_FLAGS="${OCIO_CXX_FLAGS}" ${OCIO_BUILDOPTS} ..
time cmake --build . --config Release --target install
popd
ls -R ${OCIOINSTALLDIR}
ls -R ${OCIO_INSTALL_DIR}
#echo "listing .."
#ls ..
# Set up paths. These will only affect the caller if this script is
# run with 'source' rather than in a separate shell.
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${OCIOINSTALLDIR}/lib
export OpenColorIO_ROOT=$OCIO_INSTALL_DIR
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${OCIO_INSTALL_DIR}/lib
+84 -53
View File
@@ -1,74 +1,105 @@
#!/bin/bash
#!/usr/bin/env bash
# The Linux VM used by Travis has OpenEXR 1.x. We really want 2.x.
# This script downloads and builds OpenEXR in the ext/ subdirectory.
# Utility script to download and build OpenEXR & IlmBase
# Exit the whole script if any command fails.
set -ex
# Which OpenEXR to retrieve, how to build it
OPENEXR_REPO=${OPENEXR_REPO:=https://github.com/openexr/openexr.git}
OPENEXR_VERSION=${OPENEXR_VERSION:=v2.4.1}
# Where to install the final results
LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=${PWD}/ext}
OPENEXR_SOURCE_DIR=${OPENEXR_SOURCE_DIR:=${LOCAL_DEPS_DIR}/openexr}
OPENEXR_BUILD_DIR=${OPENEXR_BUILD_DIR:=${LOCAL_DEPS_DIR}/openexr-build}
OPENEXR_INSTALL_DIR=${OPENEXR_INSTALL_DIR:=${LOCAL_DEPS_DIR}/dist}
OPENEXR_BUILD_TYPE=${OPENEXR_BUILD_TYPE:=Release}
CMAKE_GENERATOR=${CMAKE_GENERATOR:="Unix Makefiles"}
OPENEXR_CMAKE_FLAGS=${OPENEXR_CMAKE_FLAGS:=""}
OPENEXR_CXX_FLAGS=${OPENEXR_CXX_FLAGS:=""}
BASEDIR=$PWD
EXRREPO=${EXRREPO:=https://github.com/openexr/openexr.git}
EXRINSTALLDIR=${EXRINSTALLDIR:=${PWD}/ext/openexr-install}
EXRBRANCH=${EXRBRANCH:=v2.3.0}
EXRCXXFLAGS=${EXRCXXFLAGS:=""}
BASEDIR=`pwd`
pwd
echo "EXR install dir will be: ${EXRINSTALLDIR}"
echo "Building OpenEXR ${OPENEXR_VERSION}"
echo "EXR build dir will be: ${OPENEXR_BUILD_DIR}"
echo "EXR install dir will be: ${OPENEXR_INSTALL_DIR}"
echo "CMAKE_PREFIX_PATH is ${CMAKE_PREFIX_PATH}"
echo "OpenEXR Build type is ${OPENEXR_BUILD_TYPE}"
if [[ ! -e ${EXRINSTALLDIR} ]] ; then
mkdir -p ${EXRINSTALLDIR}
if [[ "$CMAKE_GENERATOR" == "" ]] ; then
OPENEXR_GENERATOR_CMD="-G \"$CMAKE_GENERATOR\""
fi
# Clone OpenEXR project (including IlmBase) from GitHub and build
if [[ ! -e ./ext/openexr ]] ; then
echo "git clone ${EXRREPO} ./ext/openexr"
git clone ${EXRREPO} ./ext/openexr
if [[ ! -e ${OPENEXR_SOURCE_DIR} ]] ; then
echo "git clone ${OPENEXR_REPO} ${OPENEXR_SOURCE_DIR}"
git clone ${OPENEXR_REPO} ${OPENEXR_SOURCE_DIR}
fi
flags=
mkdir -p ${OPENEXR_INSTALL_DIR} && true
mkdir -p ${OPENEXR_BUILD_DIR} && true
if [[ ${LINKSTATIC:=0} == 1 ]] ; then
flags=${flags} --enable-static --enable-shared=no --with-pic
fi
pushd ${OPENEXR_SOURCE_DIR}
git checkout ${OPENEXR_VERSION} --force
pushd ./ext/openexr
echo "git checkout ${EXRBRANCH} --force"
git checkout ${EXRBRANCH} --force
if [[ ${EXRBRANCH} == "v2.3.0" ]] ; then
if [[ ${OPENEXR_VERSION} == "v2.2.0" ]] || [[ ${OPENEXR_VERSION} == "v2.2.1" ]] ; then
mkdir -p ${OPENEXR_BUILD_DIR}/IlmBase && true
mkdir -p ${OPENEXR_BUILD_DIR}/OpenEXR && true
cd ${OPENEXR_BUILD_DIR}/IlmBase
cmake --config ${OPENEXR_BUILD_TYPE} ${OPENEXR_GENERATOR_CMD} \
-DCMAKE_INSTALL_PREFIX="${OPENEXR_INSTALL_DIR}" \
-DCMAKE_CXX_FLAGS="${OPENEXR_CXX_FLAGS}" \
${OPENEXR_CMAKE_FLAGS} ${OPENEXR_SOURCE_DIR}/IlmBase
time cmake --build . --target install --config ${OPENEXR_BUILD_TYPE}
cd ${OPENEXR_BUILD_DIR}/OpenEXR
cmake --config ${OPENEXR_BUILD_TYPE} ${OPENEXR_GENERATOR_CMD} \
-DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}\;${OPENEXR_INSTALL_DIR}" \
-DCMAKE_INSTALL_PREFIX="${OPENEXR_INSTALL_DIR}" \
-DILMBASE_PACKAGE_PREFIX="${OPENEXR_INSTALL_DIR}" \
-DBUILD_UTILS=0 -DBUILD_TESTS=0 \
-DCMAKE_CXX_FLAGS="${OPENEXR_CXX_FLAGS}" \
${OPENEXR_CMAKE_FLAGS} ${OPENEXR_SOURCE_DIR}/OpenEXR
time cmake --build . --target install --config ${OPENEXR_BUILD_TYPE}
elif [[ ${OPENEXR_VERSION} == "v2.3.0" ]] ; then
# Simplified setup for 2.3+
mkdir build
cd build
mkdir OpenEXR
mkdir OpenEXR/IlmImf
unzip -d OpenEXR/IlmImf ${BASEDIR}/src/build-scripts/b44ExpLogTable.h.zip
unzip -d OpenEXR/IlmImf ${BASEDIR}/src/build-scripts/dwaLookups.h.zip
cmake --config Release -DCMAKE_INSTALL_PREFIX=${EXRINSTALLDIR} -DILMBASE_PACKAGE_PREFIX=${EXRINSTALLDIR} -DOPENEXR_BUILD_UTILS=0 -DOPENEXR_BUILD_TESTS=0 -DOPENEXR_BUILD_PYTHON_LIBS=0 -DCMAKE_CXX_FLAGS=${EXRCXXFLAGS} .. && make clean && make -j 4 && make install
cd ${OPENEXR_BUILD_DIR}
cmake --config ${OPENEXR_BUILD_TYPE} -G "$CMAKE_GENERATOR" \
-DCMAKE_INSTALL_PREFIX="${OPENEXR_INSTALL_DIR}" \
-DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" \
-DILMBASE_PACKAGE_PREFIX="${OPENEXR_INSTALL_DIR}" \
-DOPENEXR_BUILD_UTILS=0 \
-DOPENEXR_BUILD_TESTS=0 \
-DOPENEXR_BUILD_PYTHON_LIBS=0 \
-DCMAKE_CXX_FLAGS="${OPENEXR_CXX_FLAGS}" \
${OPENEXR_CMAKE_FLAGS} ${OPENEXR_SOURCE_DIR}
time cmake --build . --target install --config ${OPENEXR_BUILD_TYPE}
else
cd IlmBase
mkdir build
cd build
cmake --config Release -DCMAKE_INSTALL_PREFIX=${EXRINSTALLDIR} -DCMAKE_CXX_FLAGS=${EXRCXXFLAGS} .. && make clean && make -j 4 && make install
cd ..
cd ../OpenEXR
cp ${BASEDIR}/src/build-scripts/OpenEXR-CMakeLists.txt CMakeLists.txt
cp ${BASEDIR}/src/build-scripts/OpenEXR-IlmImf-CMakeLists.txt IlmImf/CMakeLists.txt
mkdir build
mkdir build/IlmImf
cd build
unzip -d IlmImf ${BASEDIR}/src/build-scripts/b44ExpLogTable.h.zip
unzip -d IlmImf ${BASEDIR}/src/build-scripts/dwaLookups.h.zip
cmake --config Release -DCMAKE_INSTALL_PREFIX=${EXRINSTALLDIR} -DILMBASE_PACKAGE_PREFIX=${EXRINSTALLDIR} -DBUILD_UTILS=0 -DBUILD_TESTS=0 -DCMAKE_CXX_FLAGS=${EXRCXXFLAGS} .. && make clean && make -j 4 && make install
# Simplified setup for 2.4+
cd ${OPENEXR_BUILD_DIR}
cmake --config ${OPENEXR_BUILD_TYPE} -G "$CMAKE_GENERATOR" \
-DCMAKE_INSTALL_PREFIX="${OPENEXR_INSTALL_DIR}" \
-DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" \
-DILMBASE_PACKAGE_PREFIX="${OPENEXR_INSTALL_DIR}" \
-DOPENEXR_BUILD_UTILS=0 \
-DBUILD_TESTING=0 \
-DPYILMBASE_ENABLE=0 \
-DOPENEXR_VIEWERS_ENABLE=0 \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_CXX_FLAGS="${OPENEXR_CXX_FLAGS}" \
${OPENEXR_CMAKE_FLAGS} ${OPENEXR_SOURCE_DIR}
time cmake --build . --target install --config ${OPENEXR_BUILD_TYPE}
fi
popd
ls -R ${EXRINSTALLDIR}
#echo "listing .."
#ls ..
#ls -R ${OPENEXR_INSTALL_DIR}
# Set up paths. These will only affect the caller if this script is
# run with 'source' rather than in a separate shell.
export ILMBASE_ROOT_DIR=$EXRINSTALLDIR
export OPENEXR_ROOT_DIR=$EXRINSTALLDIR
export ILMBASE_LIBRARY_DIR=$EXRINSTALLDIR/lib
export OPENEXR_LIBRARY_DIR=$EXRINSTALLDIR/lib
export LD_LIBRARY_PATH=$OPENEXR_ROOT_DIR/lib:$LD_LIBRARY_PATH
export ILMBASE_ROOT=$OPENEXR_INSTALL_DIR
export OPENEXR_ROOT=$OPENEXR_INSTALL_DIR
export ILMBASE_LIBRARY_DIR=$OPENEXR_INSTALL_DIR/lib
export OPENEXR_LIBRARY_DIR=$OPENEXR_INSTALL_DIR/lib
export LD_LIBRARY_PATH=$OPENEXR_ROOT/lib:$LD_LIBRARY_PATH
+58
View File
@@ -0,0 +1,58 @@
#!/usr/bin/env bash
# Utility script to download and build pugixml
#
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio
# Exit the whole script if any command fails.
set -ex
# Repo and branch/tag/commit of pugixml to download if we don't have it yet
PUGIXML_REPO=${PUGIXML_REPO:=https://github.com/zeux/pugixml.git}
PUGIXML_VERSION=${PUGIXML_VERSION:=1.10}
PUGIXML_BRANCH=${PUGIXML_BRANCH:=v${PUGIXML_VERSION}}
# Where to put pugixml repo source (default to the ext area)
PUGIXML_SRC_DIR=${PUGIXML_SRC_DIR:=${PWD}/ext/pugixml}
# Temp build area (default to a build/ subdir under source)
PUGIXML_BUILD_DIR=${PUGIXML_BUILD_DIR:=${PUGIXML_SRC_DIR}/build}
# Install area for pugixml (default to ext/dist)
PUGIXML_INSTALL_DIR=${PUGIXML_INSTALL_DIR:=${PWD}/ext/dist}
#PUGIXML_BUILD_OPTS=${PUGIXML_BUILD_OPTS:=}
pwd
echo "pugixml install dir will be: ${PUGIXML_INSTALL_DIR}"
mkdir -p ./ext
pushd ./ext
# Clone pugixml project from GitHub and build
if [[ ! -e ${PUGIXML_SRC_DIR} ]] ; then
echo "git clone ${PUGIXML_REPO} ${PUGIXML_SRC_DIR}"
git clone ${PUGIXML_REPO} ${PUGIXML_SRC_DIR}
fi
cd ${PUGIXML_SRC_DIR}
echo "git checkout ${PUGIXML_BRANCH} --force"
git checkout ${PUGIXML_BRANCH} --force
mkdir -p ${PUGIXML_BUILD_DIR}
cd ${PUGIXML_BUILD_DIR}
time cmake --config Release \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${PUGIXML_INSTALL_DIR} \
-DBUILD_TESTS=OFF \
${PUGIXML_BUILD_OPTS} ..
time cmake --build . --config Release --target install
ls -R ${PUGIXML_INSTALL_DIR}
popd
#echo "listing .."
#ls ..
# Set up paths. These will only affect the caller if this script is
# run with 'source' rather than in a separate shell.
export pugixml_ROOT=$PUGIXML_INSTALL_DIR
+57
View File
@@ -0,0 +1,57 @@
#!/usr/bin/env bash
# Utility script to download and build pybind11
# Exit the whole script if any command fails.
set -ex
# Repo and branch/tag/commit of pybind11 to download if we don't have it yet
PYBIND11_REPO=${PYBIND11_REPO:=https://github.com/pybind/pybind11.git}
PYBIND11_VERSION=${PYBIND11_VERSION:=v2.4.3}
# Where to put pybind11 repo source (default to the ext area)
PYBIND11_SRC_DIR=${PYBIND11_SRC_DIR:=${PWD}/ext/pybind11}
# Temp build area (default to a build/ subdir under source)
PYBIND11_BUILD_DIR=${PYBIND11_BUILD_DIR:=${PYBIND11_SRC_DIR}/build}
# Install area for pybind11 (default to ext/dist)
LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=${PWD}/ext}
PYBIND11_INSTALL_DIR=${PYBIND11_INSTALL_DIR:=${LOCAL_DEPS_DIR}/dist}
#PYBIND11_BUILD_OPTS=${PYBIND11_BUILD_OPTS:=}
if [[ "${PYTHON_VERSION}" != "" ]] ; then
PYBIND11_BUILD_OPTS+=" -DPYBIND11_PYTHON_VERSION=${PYTHON_VERSION}"
fi
pwd
echo "pybind11 install dir will be: ${PYBIND11_INSTALL_DIR}"
mkdir -p ./ext
pushd ./ext
# Clone pybind11 project from GitHub and build
if [[ ! -e ${PYBIND11_SRC_DIR} ]] ; then
echo "git clone ${PYBIND11_REPO} ${PYBIND11_SRC_DIR}"
git clone ${PYBIND11_REPO} ${PYBIND11_SRC_DIR}
fi
cd ${PYBIND11_SRC_DIR}
echo "git checkout ${PYBIND11_VERSION} --force"
git checkout ${PYBIND11_VERSION} --force
mkdir -p ${PYBIND11_BUILD_DIR}
cd ${PYBIND11_BUILD_DIR}
time cmake --config Release \
-DCMAKE_INSTALL_PREFIX=${PYBIND11_INSTALL_DIR} \
-DPYBIND11_TEST=OFF \
${PYBIND11_BUILD_OPTS} ..
time cmake --build . --config Release --target install
ls -R ${PYBIND11_INSTALL_DIR}
popd
#echo "listing .."
#ls ..
# Set up paths. These will only affect the caller if this script is
# run with 'source' rather than in a separate shell.
export pybind11_ROOT=$PYBIND11_INSTALL_DIR
+54
View File
@@ -0,0 +1,54 @@
#!/usr/bin/env bash
# Utility script to download and build zlib
#
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio
# Exit the whole script if any command fails.
set -ex
# Repo and branch/tag/commit of zlib to download if we don't have it yet
ZLIB_REPO=${ZLIB_REPO:=https://github.com/madler/zlib.git}
ZLIB_VERSION=${ZLIB_VERSION:=v1.2.11}
# Where to put zlib repo source (default to the ext area)
ZLIB_SRC_DIR=${ZLIB_SRC_DIR:=${PWD}/ext/zlib}
# Temp build area (default to a build/ subdir under source)
ZLIB_BUILD_DIR=${ZLIB_BUILD_DIR:=${ZLIB_SRC_DIR}/build}
# Install area for zlib (default to ext/dist)
ZLIB_INSTALL_DIR=${ZLIB_INSTALL_DIR:=${PWD}/ext/dist}
#ZLIB_CONFIG_OPTS=${ZLIB_CONFIG_OPTS:=}
pwd
echo "zlib install dir will be: ${ZLIB_INSTALL_DIR}"
mkdir -p ./ext
pushd ./ext
# Clone zlib project from GitHub and build
if [[ ! -e ${ZLIB_SRC_DIR} ]] ; then
echo "git clone ${ZLIB_REPO} ${ZLIB_SRC_DIR}"
git clone ${ZLIB_REPO} ${ZLIB_SRC_DIR}
fi
cd ${ZLIB_SRC_DIR}
echo "git checkout ${ZLIB_VERSION} --force"
git checkout ${ZLIB_VERSION} --force
mkdir -p ${ZLIB_BUILD_DIR} && true
cd ${ZLIB_BUILD_DIR}
time cmake --config Release \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${ZLIB_INSTALL_DIR} \
${ZLIB_CONFIG_OPTS} ..
time cmake --build . --config Release --target install
ls -R ${ZLIB_INSTALL_DIR}
popd
# Set up paths. These will only affect the caller if this script is
# run with 'source' rather than in a separate shell.
export ZLIB_ROOT=$ZLIB_INSTALL_DIR
+40 -15
View File
@@ -12,22 +12,47 @@ if [[ -e src/build-scripts/ci-setenv.bash ]] ; then
source src/build-scripts/ci-setenv.bash
fi
if [[ "$TRAVIS" != "" ]] ; then
MAKEFLAGS=-j2
elif [[ "$CIRCLECI" != "" ]] ; then
MAKEFLAGS=-j4
if [[ ! -e build/$PLATFORM ]] ; then
mkdir -p build/$PLATFORM
fi
if [[ ! -e dist/$PLATFORM ]] ; then
mkdir -p dist/$PLATFORM
fi
make $MAKEFLAGS VERBOSE=1 $BUILD_FLAGS cmakesetup
make $MAKEFLAGS $BUILD_FLAGS $BUILDTARGET
if [[ "$SKIP_TESTS" == "" ]] ; then
$OPENIMAGEIO_ROOT_DIR/bin/oiiotool --help
make $BUILD_FLAGS test
if [[ "$USE_SIMD" != "" ]] ; then
MY_CMAKE_FLAGS="$MY_CMAKE_FLAGS -DUSE_SIMD=$USE_SIMD"
fi
if [[ "$DEBUG" == "1" ]] ; then
export CMAKE_BUILD_TYPE=Debug
fi
if [[ $BUILDTARGET == clang-format ]] ; then
pushd build/$PLATFORM
cmake ../.. -G "$CMAKE_GENERATOR" \
-DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" \
-DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" \
-DCMAKE_INSTALL_PREFIX="$OpenImageIO_ROOT" \
-DPYTHON_VERSION="$PYTHON_VERSION" \
-DCMAKE_INSTALL_LIBDIR="$OpenImageIO_ROOT/lib" \
-DCMAKE_CXX_STANDARD="$CMAKE_CXX_STANDARD" \
$MY_CMAKE_FLAGS -DVERBOSE=1
if [[ "$BUILDTARGET" != "none" ]] ; then
echo "Parallel build " ${CMAKE_BUILD_PARALLEL_LEVEL}
time cmake --build . --target ${BUILDTARGET:=install} --config ${CMAKE_BUILD_TYPE}
fi
popd
if [[ "${SKIP_TESTS:=0}" == "0" ]] ; then
$OpenImageIO_ROOT/bin/oiiotool --help || true
TESTSUITE_CLEANUP_ON_SUCCESS=1
echo "Parallel test " ${CTEST_PARALLEL_LEVEL}
# make $BUILD_FLAGS test
pushd build/$PLATFORM
ctest -C ${CMAKE_BUILD_TYPE} -E broken --force-new-ctest-process --output-on-failure
popd
fi
if [[ "$BUILDTARGET" == clang-format ]] ; then
git diff --color
THEDIFF=`git diff`
if [[ "$THEDIFF" != "" ]] ; then
@@ -36,6 +61,6 @@ if [[ $BUILDTARGET == clang-format ]] ; then
fi
fi
if [[ "$CODECOV" == 1 ]] ; then
bash <(curl -s https://codecov.io/bash)
fi
# if [[ "$CODECOV" == 1 ]] ; then
# bash <(curl -s https://codecov.io/bash)
# fi
+46 -14
View File
@@ -5,13 +5,18 @@
# with 'source', not in a separate shell.
# Figure out the platform
if [[ $TRAVIS_OS_NAME == osx ]] ; then
if [[ $TRAVIS_OS_NAME == osx || $RUNNER_OS == macOS ]] ; then
export ARCH=macosx
fi
if [[ $TRAVIS_OS_NAME == linux || $CIRCLECI == true ]] ; then
elif [[ `uname -m` == aarch64 ]] ; then
export ARCH=aarch64
elif [[ $TRAVIS_OS_NAME == linux || $RUNNER_OS == Linux || $CIRCLECI == true ]] ; then
export ARCH=linux64
elif [[ $RUNNER_OS == Windows ]] ; then
export ARCH=windows64
else
export ARCH=unknown
fi
PLATFORM=$ARCH
export PLATFORM=$ARCH
if [[ "$DEBUG" == 1 ]] ; then
export PLATFORM=${PLATFORM}.debug
@@ -21,29 +26,56 @@ echo "Architecture is $ARCH"
echo "Build platform name is $PLATFORM"
# Environment variables we always need
export USE_CCACHE=1
export USE_CCACHE=${USE_CCACHE:=1}
export CCACHE_CPP2=1
export OPENIMAGEIO_ROOT_DIR=$PWD/dist/$PLATFORM
export DYLD_LIBRARY_PATH=$OPENIMAGEIO_ROOT_DIR/lib:$DYLD_LIBRARY_PATH
export LD_LIBRARY_PATH=$OPENIMAGEIO_ROOT_DIR/lib:$LD_LIBRARY_PATH
export OIIO_LIBRARY_PATH=$OPENIMAGEIO_ROOT_DIR/lib
export PYTHONPATH=$OPENIMAGEIO_ROOT_DIR/python:$PYTHONPATH
export OpenImageIO_ROOT=$PWD/dist/$PLATFORM
export DYLD_LIBRARY_PATH=$OpenImageIO_ROOT/lib:$DYLD_LIBRARY_PATH
export LD_LIBRARY_PATH=$OpenImageIO_ROOT/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$OpenImageIO_ROOT/lib64:$LD_LIBRARY_PATH
export OIIO_LIBRARY_PATH=$OpenImageIO_ROOT/lib
export LSAN_OPTIONS=suppressions=$PWD/src/build-scripts/nosanitize.txt
export ASAN_OPTIONS=print_suppressions=0
export PYTHON_VERSION=${PYTHON_VERSION:="2.7"}
export PYTHONPATH=$OpenImageIO_ROOT/lib/python${PYTHON_VERSION}/site-packages:$PYTHONPATH
export BUILD_MISSING_DEPS=${BUILD_MISSING_DEPS:=1}
export COMPILER=${COMPILER:=gcc}
export CXX=${CXX:=g++}
export CI=true
export USE_NINJA=${USE_NINJA:=1}
export CMAKE_GENERATOR=${CMAKE_GENERATOR:=Ninja}
export CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:=Release}
export CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD:=11}
uname -n
if [[ $TRAVIS == true && "$ARCH" == aarch64 ]] ; then
export PARALLEL=4
elif [[ $TRAVIS == true ]] ; then
export PARALLEL=2
elif [[ $CIRCLECI == true ]] ; then
export PARALLEL=4
elif [[ $GITHUB_ACTIONS == true ]] ; then
export PARALLEL=4
fi
export PARALLEL=${PARALLEL:=4}
export PAR_MAKEFLAGS=-j${PARALLEL}
export CMAKE_BUILD_PARALLEL_LEVEL=${CMAKE_BUILD_PARALLEL_LEVEL:=${PARALLEL}}
export CTEST_PARALLEL_LEVEL=${CTEST_PARALLEL_LEVEL:=${PARALLEL}}
export LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=$HOME/ext}
export PATH=${LOCAL_DEPS_DIR}/bin:$PATH
export LD_LIBRARY_PATH=${LOCAL_DEPS_DIR}/lib:$LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=${LOCAL_DEPS_DIR}/lib:$DYLD_LIBRARY_PATH
echo "uname -a: " `uname -a`
echo "uname -m: " `uname -m`
echo "uname -s: " `uname -s`
echo "uname -n: " `uname -n`
pwd
ls
env
env | sort
if [[ $ARCH == linux64 ]] ; then
if [[ `uname -s` == "Linux" ]] ; then
head -40 /proc/cpuinfo
elif [[ $ARCH == macosx ]] ; then
sysctl machdep.cpu.features
fi
@@ -1,53 +0,0 @@
#!/usr/bin/env bash
#
set -ex
#dpkg --list
time apt-get update
time apt-get install -y \
git \
cmake \
ninja-build \
g++ \
ccache \
libboost-dev libboost-thread-dev \
libboost-filesystem-dev libboost-regex-dev \
libtiff-dev \
libilmbase-dev libopenexr-dev \
python-dev python-numpy \
libgif-dev \
libpng-dev \
libraw-dev \
libwebp-dev \
libfreetype6-dev \
dcmtk \
libavcodec-dev libavformat-dev libswscale-dev libavutil-dev \
locales \
opencolorio-tools \
wget \
libtbb-dev \
libopenvdb-dev \
libopencv-dev \
ptex-base \
dcmtk
# time apt-get install -y g++-4.8
#time apt-get install -y g++-7
#time apt-get install -y g++-8
# time apt-get install -y clang
# time apt-get install -y llvm
#time apt-get install -y libopenjpeg-dev
#time apt-get install -y libjpeg-turbo8-dev
dpkg --list
# I think opencolor-tools package is adequate for now. For more recent
# versions of OCIO, we could buidl it ourselves:
#CXX="ccache $CXX" src/build-scripts/build_ocio.bash
#export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/ext/OpenColorIO/dist/lib
src/build-scripts/install_test_images.bash
+48
View File
@@ -0,0 +1,48 @@
#!/usr/bin/env bash
#
set -ex
echo "Which g++ " `which g++`
g++ --version && true
ls /usr/bin/g++* && true
/usr/bin/g++ --version && true
export PATH=/opt/rh/devtoolset-6/root/usr/bin:/usr/local/bin:$PATH
#ls /opt/rh/devtoolset-6/root/usr/bin && true
#ls /usr/local/bin
ls /etc/yum.repos.d
sudo yum install -y giflib giflib-devel && true
sudo yum install -y opencv opencv-devel && true
sudo yum install -y Field3D Field3D-devel && true
#sudo rpm -v --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro && true
#sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm && true
sudo yum install -y ffmpeg ffmpeg-devel && true
if [[ "$CXX" == "clang++" ]] ; then
source src/build-scripts/build_llvm.bash
fi
src/build-scripts/install_test_images.bash
source src/build-scripts/build_pybind11.bash
if [[ "$OPENEXR_BRANCH" || "$OPENEXR_VERSION" ]] ; then
source src/build-scripts/build_openexr.bash
fi
if [[ "$LIBTIFF_BRANCH" || "$LIBTIFF_VERSION" ]] ; then
source src/build-scripts/build_libtiff.bash
fi
if [[ "$OCIO_BRANCH" || "$OCIO_VERSION" ]] ; then
# Temporary (?) fix: GH ninja having problems, fall back to make
CMAKE_GENERATOR="Unix Makefiles" \
source src/build-scripts/build_ocio.bash
fi
+98
View File
@@ -0,0 +1,98 @@
#!/usr/bin/env bash
#
set -ex
#dpkg --list
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
time sudo apt-get update
time sudo apt-get -q install -y \
git \
cmake \
ninja-build \
g++ \
ccache \
libboost-dev libboost-thread-dev \
libboost-filesystem-dev libboost-regex-dev \
libtiff-dev \
libilmbase-dev libopenexr-dev \
python-dev python-numpy \
libgif-dev \
libpng-dev \
libraw-dev \
libwebp-dev \
libfreetype6-dev \
libavcodec-dev libavformat-dev libswscale-dev libavutil-dev \
locales \
libopencolorio-dev \
wget \
libtbb-dev \
libopenvdb-dev \
libopencv-dev \
ptex-base \
dcmtk \
libsquish-dev \
qt5-default \
libhdf5-dev
# Disable libheif on CI for now... seems to make crashes in CI tests.
# Works fine for me in real life. Investigate.
#if [[ "$USE_LIBHEIF" != "0" ]] ; then
# sudo add-apt-repository ppa:strukturag/libde265
# sudo add-apt-repository ppa:strukturag/libheif
# time sudo apt-get -q install -y libheif-dev
#fi
export CMAKE_PREFIX_PATH=/usr/lib/x86_64-linux-gnu:$CMAKE_PREFIX_PATH
if [[ "$CXX" == "g++-4.8" ]] ; then
time sudo apt-get install -y g++-4.8
elif [[ "$CXX" == "g++-6" ]] ; then
time sudo apt-get install -y g++-6
elif [[ "$CXX" == "g++-7" ]] ; then
time sudo apt-get install -y g++-7
elif [[ "$CXX" == "g++-8" ]] ; then
time sudo apt-get install -y g++-8
elif [[ "$CXX" == "g++-9" ]] ; then
time sudo apt-get install -y g++-9
elif [[ "$CXX" == "g++-10" ]] ; then
time sudo apt-get install -y g++-10
fi
# time sudo apt-get install -y clang
# time sudo apt-get install -y llvm
#time sudo apt-get install -y libopenjpeg-dev
#time sudo apt-get install -y libjpeg-turbo8-dev
echo "Which python3 " `which python3`
python3 --version && true
#dpkg --list
if [[ "$CXX" == "clang++" ]] ; then
source src/build-scripts/build_llvm.bash
fi
src/build-scripts/install_test_images.bash
CXX="ccache $CXX" source src/build-scripts/build_pybind11.bash
if [[ "$OPENEXR_BRANCH" || "$OPENEXR_VERSION" ]] ; then
CXX="ccache $CXX" source src/build-scripts/build_openexr.bash
fi
if [[ "$LIBTIFF_BRANCH" || "$LIBTIFF_VERSION" ]] ; then
CXX="ccache $CXX" source src/build-scripts/build_libtiff.bash
fi
if [[ "$LIBRAW_BRANCH" || "$LIBRAW_VERSION" ]] ; then
CXX="ccache $CXX" source src/build-scripts/build_libraw.bash
fi
if [[ "$OCIO_BRANCH" || "$OCIO_VERSION" ]] ; then
# Temporary (?) fix: GH ninja having problems, fall back to make
CMAKE_GENERATOR="Unix Makefiles" \
source src/build-scripts/build_ocio.bash
fi
+137
View File
@@ -0,0 +1,137 @@
#!/usr/bin/env bash
# Copyright 2008-present Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
if [[ ! -e build/$PLATFORM ]] ; then
mkdir -p build/$PLATFORM
fi
if [[ ! -e dist/$PLATFORM ]] ; then
mkdir -p dist/$PLATFORM
fi
# DEP_DIR="$PWD/ext/dist"
DEP_DIR="$PWD/dist/$PLATFORM"
mkdir -p "$DEP_DIR"
mkdir -p ext && true
INT_DIR="build/$PLATFORM"
VCPKG_INSTALLATION_ROOT=/c/vcpkg
export CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH:=.}
export CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH;$DEP_DIR"
export BOOST_ROOT=${BOOST_ROOT_1_72_0}
export CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH;$BOOST_ROOT"
export CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH;$VCPKG_INSTALLATION_ROOT/installed/x64-windows"
export PATH="$PATH:$DEP_DIR/bin:$DEP_DIR/lib:$VCPKG_INSTALLATION_ROOT/installed/x64-windows/bin:/bin"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$DEP_DIR/bin:$VCPKG_INSTALLATION_ROOT/installed/x64-windows/bin"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$DEP_DIR/lib:$VCPKG_INSTALLATION_ROOT/installed/x64-windows/lib"
# export MY_CMAKE_FLAGS="$MY_CMAKE_FLAGS -DCMAKE_TOOLCHAIN_FILE=$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake"
# export OPENEXR_CMAKE_FLAGS="$OPENEXR_CMAKE_FLAGS -DCMAKE_TOOLCHAIN_FILE=$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake"
ls -l "C:/Program Files (x86)/Microsoft Visual Studio/*/Enterprise/VC/Tools/MSVC" && true
ls -l "C:/Program Files (x86)/Microsoft Visual Studio" && true
########################################################################
# Dependency method #1: Use vcpkg (disabled)
#
# Currently we are not using this, but here it is for reference:
#
# vcpkg list
# vcpkg update
#
# # vcpkg install zlib:x64-windows
# vcpkg install tiff:x64-windows
# vcpkg install libpng:x64-windows
# vcpkg install giflib:x64-windows
# vcpkg install freetype:x64-windows
# # vcpkg install openexr:x64-windows
# # vcpkg install libjpeg-turbo:x64-windows
#
# vcpkg install libraw:x64-windows
# vcpkg install openjpeg:x64-windows
# vcpkg install libsquish:x64-windows
# # vcpkg install ffmpeg:x64-windows # takes FOREVER!
# # vcpkg install webp:x64-windows # No such vcpkg package?a
#
# #echo "$VCPKG_INSTALLATION_ROOT"
# #ls "$VCPKG_INSTALLATION_ROOT"
# #echo "$VCPKG_INSTALLATION_ROOT/installed/x64-windows"
# #ls "$VCPKG_INSTALLATION_ROOT/installed/x64-windows"
# #echo "$VCPKG_INSTALLATION_ROOT/installed/x64-windows/lib"
# #ls "$VCPKG_INSTALLATION_ROOT/installed/x64-windows/lib"
# #echo "$VCPKG_INSTALLATION_ROOT/installed/x64-windows/bin"
# #ls "$VCPKG_INSTALLATION_ROOT/installed/x64-windows/bin"
#
# # export PATH="$PATH:$DEP_DIR/bin:$VCPKG_INSTALLATION_ROOT/installed/x64-windows/bin"
# export PATH="$DEP_DIR/lib:$DEP_DIR/bin:$PATH:$VCPKG_INSTALLATION_ROOT/installed/x64-windows/lib"
# export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$VCPKG_INSTALLATION_ROOT/installed/x64-windows/lib:$DEP_DIR/lib:$DEP_DIR/bin"
#
# echo "All VCPkg installs:"
# vcpkg list
#
########################################################################
########################################################################
# Dependency method #2: Build from source ourselves
#
#
src/build-scripts/build_zlib.bash
export ZLIB_ROOT=$PWD/ext/dist
src/build-scripts/build_libpng.bash
export PNG_ROOT=$PWD/ext/dist
src/build-scripts/build_libtiff.bash
export TIFF_ROOT=$PWD/ext/dist
LIBJPEGTURBO_CONFIG_OPTS=-DWITH_SIMD=OFF
# ^^ because we're too lazy to build nasm
src/build-scripts/build_libjpeg-turbo.bash
export JPEGTurbo_ROOT=$PWD/ext/dist
source src/build-scripts/build_pybind11.bash
#export pybind11_ROOT=$PWD/ext/dist
curl --location https://ffmpeg.zeranoe.com/builds/win64/dev/ffmpeg-4.2.1-win64-dev.zip -o ffmpeg-dev.zip
unzip ffmpeg-dev.zip
FFmpeg_ROOT=$PWD/ffmpeg-4.2.1-win64-dev
echo "CMAKE_PREFIX_PATH = $CMAKE_PREFIX_PATH"
OPENEXR_CXX_FLAGS=" /W1 /EHsc /DWIN32=1 "
#OPENEXR_BUILD_TYPE=$CMAKE_BUILD_TYPE
OPENEXR_INSTALL_DIR=$DEP_DIR
OPENEXR_BRANCH=v2.4.0
source src/build-scripts/build_openexr.bash
export PATH="$OPENEXR_INSTALL_DIR/bin:$OPENEXR_INSTALL_DIR/lib:$PATH"
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PATH
# the above line is admittedly sketchy
cp $DEP_DIR/lib/*.lib $DEP_DIR/bin
cp $DEP_DIR/bin/*.dll $DEP_DIR/lib
echo "DEP_DIR $DEP_DIR :"
ls -R -l "$DEP_DIR"
src/build-scripts/install_test_images.bash
ls /c/hostedtoolcache/windows/Python
echo "/c/hostedtoolcache/windows/Python/3.6.8/x64"
ls /c/hostedtoolcache/windows/Python/3.6.8/x64
# source src/build-scripts/build_openexr.bash
# export CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH;$ILMBASE_ROOT;$OPENEXR_ROOT"
# source src/build-scripts/build_ocio.bash
if [[ "$PYTHON_VERSION" == "3.6" ]] ; then
export CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH;/c/hostedtoolcache/windows/Python/3.6.8/x64"
fi
+31 -27
View File
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# This script, which assumes it is runnign on a Mac OSX with Homebrew
# installed, does a "brew install" in all packages reasonably needed by
@@ -24,50 +24,54 @@ brew list --versions
if [[ "$BUILDTARGET" == "clang-format" ]] ; then
# If we are running for the sake of clang-format only, just install the
# bare minimum packages and return.
time brew install ilmbase openexr llvm clang-format
brew install --display-times ilmbase openexr llvm clang-format libtiff libpng boost ninja giflib
brew install --display-times python pybind11 && true
brew upgrade --display-times python && true
brew link --overwrite python
brew upgrade --display-times cmake && true
else
# All cases except for clang-format target, we need the dependencies.
time brew install gcc
time brew link --overwrite gcc
time brew install ccache cmake ninja
time brew install ilmbase openexr
time brew install opencolorio
time brew install freetype
time brew install libraw
time brew install libpng webp jpeg-turbo
time brew install openjpeg
time brew install dcmtk
time brew install qt
time brew install -s field3d
# Note: field3d must be build from source to fix boost mismatch as of
# Nov 2018. Maybe it will be fixed soon? Check later.
time brew install ffmpeg
time brew install opencv
time brew install tbb
time brew install openvdb
time brew install pybind11
time brew install libheif
brew install --display-times gcc ccache cmake ninja boost && true
brew link --overwrite gcc
brew install --display-times python && true
brew upgrade --display-times python && true
brew link --overwrite python
brew upgrade --display-times cmake && true
brew install --display-times libtiff ilmbase openexr opencolorio
brew install --display-times libpng giflib webp jpeg-turbo openjpeg
brew install --display-times freetype libraw dcmtk pybind11 numpy && true
brew install --display-times ffmpeg libheif libsquish
brew install --display-times openvdb tbb
brew install --display-times opencv qt ptex
brew install --display-times field3d && true
fi
if [[ "$LINKSTATIC" == "1" ]] ; then
time brew install little-cms2 tinyxml szip
time brew install homebrew/dupes/bzip2
time brew install yaml-cpp --with-static-lib
brew install --display-times little-cms2 tinyxml szip
brew install --display-times homebrew/dupes/bzip2
brew install --display-times yaml-cpp --with-static-lib
fi
if [[ "$CLANG_TIDY" != "" ]] ; then
# If we are running for the sake of clang-tidy only, we will need
# a modern clang version not just the xcode one.
time brew install llvm
brew install --display-times llvm
fi
echo ""
echo "After brew installs:"
brew list --versions
# Needed on some systems
pip install numpy
# Set up paths. These will only affect the caller if this script is
# run with 'source' rather than in a separate shell.
export PATH=/usr/local/opt/qt5/bin:$PATH ;
export PATH=/usr/local/opt/python/libexec/bin:$PATH ;
export PYTHONPATH=/usr/local/lib/python${PYTHON_VERSION}/site-packages:$PYTHONPATH ;
export PATH=/usr/local/Cellar/llvm/8.0.0*/bin:$PATH ;
export PATH=/usr/local/opt/llvm/bin:$PATH ;
# If field3d and hdf5 get even slightly out of sync, hdf5 will throw fits.
# This is unnecessary, so we disable the step to make CI more likely to
# pass in cases where they don't exactly match on the Travis/GH instances.
export HDF5_DISABLE_VERSION_CHECK=1
+1 -1
View File
@@ -5,7 +5,7 @@ if [[ ! -e ../oiio-images ]] ; then
fi
if [[ ! -e ../libtiffpic ]] ; then
wget https://download.osgeo.org/libtiff/pics-3.8.0.tar.gz
curl -o pics-3.8.0.tar.gz https://download.osgeo.org/libtiff/pics-3.8.0.tar.gz
tar xf pics-3.8.0.tar.gz -C ..
fi
+2
View File
@@ -1,4 +1,5 @@
leak:Imf_2_2
leak:Imf_2_3
leak:libIlmImf
leak:libgomp
leak:boost::detail::make_external_thread_data
@@ -6,3 +7,4 @@ leak:boost::detail::add_new_tss_node
leak:g_malloc0
leak:ArgParse::options
leak:LibRaw::copy_fuji_uncropped
leak:libtbb
+7 -3
View File
@@ -1,4 +1,8 @@
# Copyright 2008-present Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
add_oiio_plugin (cineoninput.cpp
libcineon/Cineon.cpp libcineon/OutStream.cpp libcineon/Codec.cpp libcineon/Reader.cpp
libcineon/Writer.cpp libcineon/CineonHeader.cpp libcineon/ElementReadStream.cpp
libcineon/InStream.cpp)
libcineon/Cineon.cpp libcineon/OutStream.cpp libcineon/Codec.cpp
libcineon/Reader.cpp libcineon/Writer.cpp libcineon/CineonHeader.cpp
libcineon/ElementReadStream.cpp libcineon/InStream.cpp)
+32 -57
View File
@@ -1,37 +1,12 @@
/*
Copyright 2010 Larry Gritz and the other authors and contributors.
All Rights Reserved.
// Copyright 2008-present Contributors to the OpenImageIO project.
// SPDX-License-Identifier: BSD-3-Clause
// https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the software's owners nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
(This is the Modified BSD License)
*/
#include <cmath>
#include "libcineon/Cineon.h"
#include <OpenImageIO/dassert.h>
#include <OpenImageIO/fmath.h>
#include <OpenImageIO/imageio.h>
#include <OpenImageIO/strutil.h>
#include <OpenImageIO/typedesc.h>
@@ -104,13 +79,13 @@ CineonInput::open(const std::string& name, ImageSpec& newspec)
// open the image
m_stream = new InStream();
if (!m_stream->Open(name.c_str())) {
error("Could not open file \"%s\"", name.c_str());
errorf("Could not open file \"%s\"", name);
return false;
}
m_cin.SetInStream(m_stream);
if (!m_cin.ReadHeader()) {
error("Could not read header");
errorf("Could not read header");
return false;
}
@@ -126,7 +101,7 @@ CineonInput::open(const std::string& name, ImageSpec& newspec)
case 2: typedesc = TypeDesc::UINT16; break;
case 3:
case 4: typedesc = TypeDesc::UINT32; break;
default: error("Unsupported bit depth %d", maxbits); return false;
default: errorf("Unsupported bit depth %d", maxbits); return false;
}
m_spec = ImageSpec(m_cin.header.Width(), m_cin.header.Height(),
m_cin.header.NumberOfElements(), typedesc);
@@ -206,7 +181,7 @@ CineonInput::open(const std::string& name, ImageSpec& newspec)
case cineon::kRec709Blue: m_spec.attribute("oiio:ColorSpace", "Rec709");
default:
// either grayscale or printing density
if (!isinf(m_cin.header.Gamma()) && m_cin.header.Gamma() != 0.0f)
if (!std::isinf(m_cin.header.Gamma()) && m_cin.header.Gamma() != 0.0f)
// actual gamma value is read later on
m_spec.attribute("oiio:ColorSpace",
Strutil::sprintf("GammaCorrected%.2g", g));
@@ -214,7 +189,7 @@ CineonInput::open(const std::string& name, ImageSpec& newspec)
}
// gamma exponent
if (!isinf(m_cin.header.Gamma()) && m_cin.header.Gamma() != 0.0f)
if (!std::isinf(m_cin.header.Gamma()) && m_cin.header.Gamma() != 0.0f)
m_spec.attribute("oiio:Gamma", (float)m_cin.header.Gamma());
#endif
@@ -248,40 +223,40 @@ CineonInput::open(const std::string& name, ImageSpec& newspec)
// per-file attribs
#define CINEON_SET_ATTRIB_S(x, n, s) m_spec.attribute(s, m_cin.header.x(n))
#define CINEON_SET_ATTRIB(x, n) CINEON_SET_ATTRIB_S(x, n, "cineon:" #x)
#define CINEON_SET_ATTRIB_BYTE(x) \
if (m_cin.header.x() != 0xFF) \
#define CINEON_SET_ATTRIB_BYTE(x) \
if (m_cin.header.x() != 0xFF) \
CINEON_SET_ATTRIB(x, )
#define CINEON_SET_ATTRIB_INT(x) \
if (static_cast<unsigned int>(m_cin.header.x()) != 0xFFFFFFFF) \
#define CINEON_SET_ATTRIB_INT(x) \
if (static_cast<unsigned int>(m_cin.header.x()) != 0xFFFFFFFF) \
CINEON_SET_ATTRIB(x, )
#define CINEON_SET_ATTRIB_FLOAT(x) \
if (!isinf(m_cin.header.x())) \
#define CINEON_SET_ATTRIB_FLOAT(x) \
if (!std::isinf(m_cin.header.x())) \
CINEON_SET_ATTRIB(x, )
#define CINEON_SET_ATTRIB_COORDS(x) \
m_cin.header.x(floats); \
if (!isinf(floats[0]) && !isinf(floats[1]) \
&& !(floats[0] == 0. && floats[1] == 0.)) \
#define CINEON_SET_ATTRIB_COORDS(x) \
m_cin.header.x(floats); \
if (!std::isinf(floats[0]) && !std::isinf(floats[1]) \
&& !(floats[0] == 0. && floats[1] == 0.)) \
m_spec.attribute("cineon:" #x, TypeDesc(TypeDesc::FLOAT, 2), &floats[0])
#define CINEON_SET_ATTRIB_STR(X, x) \
if (m_cin.header.x[0] && m_cin.header.x[0] != char(-1)) \
#define CINEON_SET_ATTRIB_STR(X, x) \
if (m_cin.header.x[0] && m_cin.header.x[0] != char(-1)) \
m_spec.attribute("cineon:" #X, m_cin.header.x)
// per-element attribs
#define CINEON_SET_ATTRIB_N(x, a, t, c) \
for (int i = 0; i < m_cin.header.NumberOfElements(); i++) { \
c(x) a[i] = m_cin.header.x(i); \
} \
m_spec.attribute("cineon:" #x, \
TypeDesc(TypeDesc::t, m_cin.header.NumberOfElements()), \
#define CINEON_SET_ATTRIB_N(x, a, t, c) \
for (int i = 0; i < m_cin.header.NumberOfElements(); i++) { \
c(x) a[i] = m_cin.header.x(i); \
} \
m_spec.attribute("cineon:" #x, \
TypeDesc(TypeDesc::t, m_cin.header.NumberOfElements()), \
&a)
#define CINEON_CHECK_ATTRIB_FLOAT(x) if (!isinf(m_cin.header.x(i)))
#define CINEON_SET_ATTRIB_FLOAT_N(x) \
#define CINEON_CHECK_ATTRIB_FLOAT(x) if (!std::isinf(m_cin.header.x(i)))
#define CINEON_SET_ATTRIB_FLOAT_N(x) \
CINEON_SET_ATTRIB_N(x, floats, FLOAT, CINEON_CHECK_ATTRIB_FLOAT)
#define CINEON_CHECK_ATTRIB_INT(x) if (m_cin.header.x(i) != 0xFFFFFFFF)
#define CINEON_SET_ATTRIB_INT_N(x) \
#define CINEON_SET_ATTRIB_INT_N(x) \
CINEON_SET_ATTRIB_N(x, ints, UINT32, CINEON_CHECK_ATTRIB_INT)
#define CINEON_CHECK_ATTRIB_BYTE(x) if (m_cin.header.x(i) != 0xFF)
#define CINEON_SET_ATTRIB_BYTE_N(x) \
#define CINEON_SET_ATTRIB_BYTE_N(x) \
CINEON_SET_ATTRIB_N(x, ints, UINT32, CINEON_CHECK_ATTRIB_BYTE)
CINEON_SET_ATTRIB_STR(Version, version);
@@ -391,7 +366,7 @@ CineonInput::close()
bool
CineonInput::read_native_scanline(int subimage, int miplevel, int y, int z,
CineonInput::read_native_scanline(int subimage, int miplevel, int y, int /*z*/,
void* data)
{
lock_guard lock(m_mutex);
@@ -159,10 +159,10 @@ void cineon::IndustryHeader::Reset()
cineon::ImageElement::ImageElement()
{
this->lowData = 0xffffffff;
this->lowQuantity = 0xffffffff;
this->highData = 0xffffffff;
this->highQuantity = 0xffffffff;
this->lowData = R32(0xffffffff);
this->lowQuantity = R32(0xffffffff);
this->highData = R32(0xffffffff);
this->highQuantity = R32(0xffffffff);
this->bitDepth = 0xff;
}
@@ -543,7 +543,7 @@ void cineon::GenericHeader::SetCreationTimeDate(const long sec)
struct tm *tm_time;
char str[32];
#ifdef WIN32
#ifdef _WIN32
_tzset();
#endif
@@ -560,7 +560,7 @@ void cineon::GenericHeader::SetSourceTimeDate(const long sec)
struct tm *tm_time;
char str[32];
#ifdef WIN32
#ifdef _WIN32
_tzset();
#endif
+2 -2
View File
@@ -1085,7 +1085,7 @@ namespace cineon
* \brief Returns the size of the header
* \return 2048 as defined by the standard
*/
const U32 Size() const;
U32 Size() const;
/*!
* \brief Calculate all of the offset members in the header
@@ -1128,7 +1128,7 @@ namespace cineon
return this->DetermineByteSwap(this->magicNumber);
}
inline const U32 Header::Size() const
inline U32 Header::Size() const
{
return 2048;
}
+4
View File
@@ -35,6 +35,10 @@
#include <cstring>
#include <ctime>
#if defined(__GNUC__)
# pragma GCC diagnostic ignored "-Wunused-parameter"
#endif
#include "Cineon.h"
#include "CineonStream.h"
#include "EndianSwap.h"
+19
View File
@@ -0,0 +1,19 @@
@PACKAGE_INIT@
include(CMakeFindDependencyMacro)
# add here all the find_dependency() whenever switching to config based dependencies
# e.g. if switching to Boost::Boost instead of using ${Boost_LIBRARY_DIRS} the add:
# find_dependency(Boost @Boost_VERSION@)
set_and_check (@PROJECT_NAME@_INCLUDE_DIR "@CMAKE_INSTALL_FULL_INCLUDEDIR@")
set_and_check (@PROJECT_NAME@_INCLUDES "@CMAKE_INSTALL_FULL_INCLUDEDIR@")
set_and_check (@PROJECT_NAME@_LIB_DIR "@CMAKE_INSTALL_FULL_LIBDIR@")
set (@PROJECT_NAME@_PLUGIN_SEARCH_PATH "@PLUGIN_SEARCH_PATH_NATIVE@")
#...logic to determine installedPrefix from the own location...
#set (@PROJECT_NAME@_CONFIG_DIR "${installedPrefix}/@CONFIG_INSTALL_DIR@")
include ("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
check_required_components ("@PROJECT_NAME@")
+28
View File
@@ -0,0 +1,28 @@
# Copyright 2008-present Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
# Is the named package "enabled" via our disabling convention? If either
# USE_pkgname (or the all-uppercase USE_PKGNAME, or ENABLE_pkgname, or
# ENABLE_PKGNAME) exists as either a CMake or environment variable, is
# nonempty by contains a non-true/nonnzero value, store false in the
# variable named by <enablevar>, otherwise store true.
function (check_is_enabled pkgname enablevar)
string (TOUPPER ${pkgname} pkgname_upper)
set (${enablevar} true PARENT_SCOPE)
if (
(NOT "${USE_${pkgname}}" STREQUAL "" AND NOT "${USE_${pkgname}}") OR
(NOT "${USE_${pkgname_upper}}" STREQUAL "" AND NOT "${USE_${pkgname_upper}}") OR
(NOT "$ENV{USE_${pkgname}}" STREQUAL "" AND NOT "$ENV{USE_${pkgname}}") OR
(NOT "$ENV{USE_${pkgname_upper}}" STREQUAL "" AND NOT "$ENV{USE_${pkgname_upper}}") OR
(NOT "${ENABLE_${pkgname}}" STREQUAL "" AND NOT "${ENABLE_${pkgname}}") OR
(NOT "${ENABLE_${pkgname_upper}}" STREQUAL "" AND NOT "${ENABLE_${pkgname_upper}}") OR
(NOT "$ENV{ENABLE_${pkgname}}" STREQUAL "" AND NOT "$ENV{ENABLE_${pkgname}}") OR
(NOT "$ENV{ENABLE_${pkgname_upper}}" STREQUAL "" AND NOT "$ENV{ENABLE_${pkgname_upper}}") OR
(DISABLE_${pkgname} OR DISABLE_${pkgname_upper} OR
"$ENV{DISABLE_${pkgname}}" OR "$ENV{DISABLE_${pkgname_upper}}") OR
(NOT "${_pkg_ENABLE}" STREQUAL "" AND NOT "${_pkg_ENABLE}")
)
set (${enablevar} false PARENT_SCOPE)
endif ()
endfunction ()
+12
View File
@@ -0,0 +1,12 @@
# Copyright 2008-present Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
# Define color codes for pretty terminal output
string (ASCII 27 ColorEsc)
set (ColorReset "${ColorEsc}[m")
set (ColorRed "${ColorEsc}[31m")
set (ColorGreen "${ColorEsc}[32m")
set (ColorYellow "${ColorEsc}[33m")
set (ColorBoldWhite "${ColorEsc}[1;37m")
+334 -159
View File
@@ -1,41 +1,43 @@
# Copyright 2008-present Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
###########################################################################
#
# This file contains compiler-related detection, options, and actions.
#
# Each option declaration is kept close to the related logic for that
# option.
#
###########################################################################
# Compiler-related detection, options, and actions
message (STATUS "CMAKE_CXX_COMPILER is ${CMAKE_CXX_COMPILER}")
message (STATUS "CMAKE_CXX_COMPILER_ID is ${CMAKE_CXX_COMPILER_ID}")
set (USE_CPP 11 CACHE STRING "C++ standard to prefer (11, 14, 17, etc.)")
option (USE_LIBCPLUSPLUS "Compile with clang libc++" OFF)
set (USE_SIMD "" CACHE STRING "Use SIMD directives (0, sse2, sse3, ssse3, sse4.1, sse4.2, avx, avx2, avx512f, f16c, aes)")
option (STOP_ON_WARNING "Stop building if there are any compiler warnings" ON)
option (HIDE_SYMBOLS "Hide symbols not in the public API" OFF)
option (USE_CCACHE "Use ccache if found" ON)
option (USE_fPIC "Build with -fPIC")
set (EXTRA_CPP_ARGS "" CACHE STRING "Extra C++ command line definitions")
set (EXTRA_DSO_LINK_ARGS "" CACHE STRING "Extra command line definitions when building DSOs")
option (BUILDSTATIC "Build static libraries instead of shared" OFF)
option (LINKSTATIC "Link with static external libraries when possible" OFF)
option (CODECOV "Build code coverage tests" OFF)
set (SANITIZE "" CACHE STRING "Build code using sanitizer (address, thread)")
option (CLANG_TIDY "Enable clang-tidy" OFF)
set (CLANG_TIDY_CHECKS "" CACHE STRING "clang-tidy checks to perform (none='-*')")
set (CLANG_TIDY_ARGS "" CACHE STRING "clang-tidy args")
option (CLANG_TIDY_FIX "Have clang-tidy fix source" OFF)
set (CLANG_FORMAT_EXE_HINT "" CACHE STRING "clang-format executable's directory (will search if not specified")
set (CLANG_FORMAT_INCLUDES "src/*.h" "src/*.cpp"
CACHE STRING "Glob patterns to include for clang-format")
# Eventually: want this to be: "src/*.h;src/*.cpp"
set (CLANG_FORMAT_EXCLUDES "src/include/OpenImageIO/fmt/*.h"
"*pugixml*" "*SHA1*" "*/farmhash.cpp" "*/tinyformat.h"
"src/dpx.imageio/libdpx/*"
"src/cineon.imageio/libcineon/*"
"src/dds.imageio/squish/*"
"src/gif.imageio/gif.h"
"src/hdr.imageio/rgbe.cpp"
CACHE STRING "Glob patterns to exclude for clang-format")
set (GLIBCXX_USE_CXX11_ABI "" CACHE STRING "For gcc, use the new C++11 library ABI (0|1)")
###########################################################################
# Print some basic status about the system and compiler
#
if (VERBOSE)
message (STATUS "CMAKE_SYSTEM_NAME = ${CMAKE_SYSTEM_NAME}")
message (STATUS "CMAKE_SYSTEM_VERSION = ${CMAKE_SYSTEM_VERSION}")
message (STATUS "CMAKE_SYSTEM_PROCESSOR = ${CMAKE_SYSTEM_PROCESSOR}")
endif ()
message (STATUS "CMAKE_CXX_COMPILER = ${CMAKE_CXX_COMPILER}")
message (STATUS "CMAKE_CXX_COMPILER_ID = ${CMAKE_CXX_COMPILER_ID}")
###########################################################################
# C++ language standard
#
set (CMAKE_CXX_STANDARD 11 CACHE STRING
"C++ standard to prefer (11, 14, 17, 20, etc.)")
set (CMAKE_CXX_STANDARD_REQUIRED ON)
set (CMAKE_CXX_EXTENSIONS OFF)
message (STATUS "Building for C++${CMAKE_CXX_STANDARD}")
###########################################################################
# Figure out which compiler we're using
#
if (CMAKE_COMPILER_IS_GNUCC)
execute_process (COMMAND ${CMAKE_CXX_COMPILER} -dumpversion
OUTPUT_VARIABLE GCC_VERSION
@@ -43,9 +45,10 @@ if (CMAKE_COMPILER_IS_GNUCC)
if (VERBOSE)
message (STATUS "Using gcc ${GCC_VERSION} as the compiler")
endif ()
else ()
set (GCC_VERSION 0)
endif ()
# Figure out which compiler we're using, for tricky cases
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER MATCHES "[Cc]lang")
# If using any flavor of clang, set CMAKE_COMPILER_IS_CLANG. If it's
# Apple's variety, set CMAKE_COMPILER_IS_APPLECLANG and
@@ -73,89 +76,101 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Intel")
endif ()
endif ()
# turn on more detailed warnings and consider warnings as errors
###########################################################################
# Turn on more detailed warnings and optionally consider warnings as errors
#
option (STOP_ON_WARNING "Stop building if there are any compiler warnings" ON)
option (EXTRA_WARNINGS "Enable lots of extra pedantic warnings" OFF)
if (NOT MSVC)
add_definitions ("-Wall")
add_compile_options ("-Wall")
if (EXTRA_WARNINGS)
add_compile_options ("-Wextra")
endif ()
if (STOP_ON_WARNING OR DEFINED ENV{CI})
add_definitions ("-Werror")
add_compile_options ("-Werror")
# N.B. Force CI builds (Travis defines $CI) to use -Werror, even if
# STOP_ON_WARNING has been switched off by default, which we may do
# in release branches.
endif ()
endif ()
if (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
# cmake bug workaround -- on some platforms, cmake doesn't set
# NDEBUG for RelWithDebInfo mode
add_definitions ("-DNDEBUG")
###########################################################################
# Control symbol visibility
#
# We try hard to make default symbol visibility be "hidden", except for
# symbols that are part of the public API, which should be marked in the
# source code with a special decorator, OIIO_API.
#
# Additionally, there is a hidesymbols.map file that on some platforms may
# give more fine-grained control for hiding symbols, because sometimes
# dependent libraries may not be well behaved and need extra hiding.
#
set (CXX_VISIBILITY_PRESET "hidden" CACHE STRING "Symbol visibility (hidden or default")
option (VISIBILITY_INLINES_HIDDEN "Hide symbol visibility of inline functions" ON)
set (VISIBILITY_MAP_FILE "${PROJECT_SOURCE_DIR}/src/build-scripts/hidesymbols.map" CACHE FILEPATH "Visibility map file")
set (C_VISIBILITY_PRESET ${CXX_VISIBILITY_PRESET})
if (${CXX_VISIBILITY_PRESET} STREQUAL "hidden" AND
(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG) AND
(CMAKE_SYSTEM_NAME MATCHES "Linux|kFreeBSD" OR CMAKE_SYSTEM_NAME STREQUAL "GNU"))
# Linux/FreeBSD/Hurd: also hide all the symbols of dependent libraries
# to prevent clashes if an app using this project is linked against
# other verions of our dependencies.
set (VISIBILITY_MAP_COMMAND "-Wl,--version-script=${VISIBILITY_MAP_FILE}")
endif ()
###########################################################################
# Compiler-specific and platform-specific options.
#
# Here is where we add a whole bunch of options for specific compilers or
# platforms. Usually this is to suppress false-positive compiler warnings.
#
if (CMAKE_COMPILER_IS_CLANG OR CMAKE_COMPILER_IS_APPLECLANG)
# Clang-specific options
add_compile_options ("-Wno-unused-function")
add_compile_options ("-Wno-overloaded-virtual")
add_compile_options ("-Wno-unneeded-internal-declaration")
add_compile_options ("-Wno-unused-private-field")
add_compile_options ("-Wno-tautological-compare")
# disable warning about unused command line arguments
add_compile_options ("-Qunused-arguments")
# Don't warn if we ask it not to warn about warnings it doesn't know
add_compile_options ("-Wunknown-warning-option")
if (CLANG_VERSION_STRING VERSION_GREATER_EQUAL 3.6 OR
APPLECLANG_VERSION_STRING VERSION_GREATER 6.1)
add_compile_options ("-Wno-unused-local-typedefs")
endif ()
if (CLANG_VERSION_STRING VERSION_GREATER_EQUAL 3.9)
# Don't warn about using unknown preprocessor symbols in #if'set
add_compile_options ("-Wno-expansion-to-defined")
endif ()
endif ()
if (CMAKE_COMPILER_IS_GNUCC AND NOT (CMAKE_COMPILER_IS_CLANG OR CMAKE_COMPILER_IS_APPLECLANG))
# gcc specific options
add_compile_options ("-Wno-unused-local-typedefs")
add_compile_options ("-Wno-unused-result")
if (NOT ${GCC_VERSION} VERSION_LESS 7.0)
add_compile_options ("-Wno-aligned-new")
add_compile_options ("-Wno-noexcept-type")
endif ()
endif ()
# Options common to gcc and clang
if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)
# CMake doesn't automatically know what do do with
# include_directories(SYSTEM...) when using clang or gcc.
set (CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem ")
# Options common to gcc and clang
# Ensure this macro is set for stdint.h
add_definitions ("-D__STDC_LIMIT_MACROS")
add_definitions ("-D__STDC_CONSTANT_MACROS")
# this allows native instructions to be used for sqrtf instead of a function call
add_definitions ("-fno-math-errno")
add_compile_options ("-fno-math-errno")
endif ()
if (HIDE_SYMBOLS AND NOT DEBUGMODE AND (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG))
# Turn default symbol visibility to hidden
set (VISIBILITY_COMMAND "-fvisibility=hidden -fvisibility-inlines-hidden")
add_definitions (${VISIBILITY_COMMAND})
if (CMAKE_SYSTEM_NAME MATCHES "Linux|kFreeBSD" OR CMAKE_SYSTEM_NAME STREQUAL "GNU")
# Linux/FreeBSD/Hurd: also hide all the symbols of dependent
# libraries to prevent clashes if an app using OIIO is linked
# against other verions of our dependencies.
if (NOT VISIBILITY_MAP_FILE)
set (VISIBILITY_MAP_FILE "${PROJECT_SOURCE_DIR}/src/build-scripts/hidesymbols.map")
endif ()
set (VISIBILITY_MAP_COMMAND "-Wl,--version-script=${VISIBILITY_MAP_FILE}")
if (VERBOSE)
message (STATUS "VISIBILITY_MAP_COMMAND = ${VISIBILITY_MAP_COMMAND}")
endif ()
endif ()
endif ()
# Clang-specific options
if (CMAKE_COMPILER_IS_CLANG OR CMAKE_COMPILER_IS_APPLECLANG)
# Disable some warnings for Clang, for some things that are too awkward
# to change just for the sake of having no warnings.
add_definitions ("-Wno-unused-function")
add_definitions ("-Wno-overloaded-virtual")
add_definitions ("-Wno-unneeded-internal-declaration")
add_definitions ("-Wno-unused-private-field")
add_definitions ("-Wno-tautological-compare")
# disable warning about unused command line arguments
add_definitions ("-Qunused-arguments")
# Don't warn if we ask it not to warn about warnings it doesn't know
add_definitions ("-Wunknown-warning-option")
if (CLANG_VERSION_STRING VERSION_GREATER 3.5 OR
APPLECLANG_VERSION_STRING VERSION_GREATER 6.1)
add_definitions ("-Wno-unused-local-typedefs")
endif ()
if (CLANG_VERSION_STRING VERSION_EQUAL 3.9 OR CLANG_VERSION_STRING VERSION_GREATER 3.9)
# Don't warn about using unknown preprocessor symbols in #if'set
add_definitions ("-Wno-expansion-to-defined")
endif ()
endif ()
# gcc specific options
if (CMAKE_COMPILER_IS_GNUCC AND NOT (CMAKE_COMPILER_IS_CLANG OR CMAKE_COMPILER_IS_APPLECLANG))
add_definitions ("-Wno-unused-local-typedefs")
add_definitions ("-Wno-unused-result")
if (NOT ${GCC_VERSION} VERSION_LESS 7.0)
add_definitions ("-Wno-aligned-new")
add_definitions ("-Wno-noexcept-type")
endif ()
endif ()
# Microsoft specific options
if (MSVC)
add_definitions (/W1)
# Microsoft specific options
add_compile_options (/W1)
add_definitions (-D_CRT_SECURE_NO_DEPRECATE)
add_definitions (-D_CRT_SECURE_NO_WARNINGS)
add_definitions (-D_CRT_NONSTDC_NO_WARNINGS)
@@ -163,7 +178,21 @@ if (MSVC)
add_definitions (-DJAS_WIN_MSVC_BUILD)
endif (MSVC)
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD"
AND ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i386")
# For FreeBSD, minimum arch of i586 is needed for atomic cpu instructions
add_compile_options (-march=i586)
endif ()
###########################################################################
# Use ccache if found
#
# This can really speed up compilation by caching object files that have
# been compiled previously with idential arguments and inputs. Putting this
# logic here makes it work even if the user is unaware of ccache. If it's
# not found on the system, it will simply be silnetly not used.
option (USE_CCACHE "Use ccache if found" ON)
find_program (CCACHE_FOUND ccache)
if (CCACHE_FOUND AND USE_CCACHE)
if (CMAKE_COMPILER_IS_CLANG AND USE_QT AND (NOT DEFINED ENV{CCACHE_CPP2}))
@@ -174,44 +203,45 @@ if (CCACHE_FOUND AND USE_CCACHE)
endif ()
endif ()
set (CSTD_FLAGS "")
if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG OR CMAKE_COMPILER_IS_INTEL)
if (USE_CPP VERSION_EQUAL 17)
message (STATUS "Building for C++17")
set (CSTD_FLAGS "-std=c++17")
elseif (USE_CPP VERSION_EQUAL 14)
message (STATUS "Building for C++14")
set (CSTD_FLAGS "-std=c++14")
else ()
message (STATUS "Building for C++11")
set (CSTD_FLAGS "-std=c++11")
endif ()
add_definitions (${CSTD_FLAGS})
if (CMAKE_COMPILER_IS_CLANG)
# C++ >= 11 doesn't like 'register' keyword, which is in Qt headers
add_definitions ("-Wno-deprecated-register")
endif ()
endif ()
###########################################################################
# Option to force use of libc++ (the LLVM project's alternate C++ standard
# library). Currently this only has an effect if using clang as the
# compiler. Maybe it would also work for g++? Investigate.
option (USE_LIBCPLUSPLUS "Compile with clang libc++" OFF)
if (USE_LIBCPLUSPLUS AND CMAKE_COMPILER_IS_CLANG)
message (STATUS "Using libc++")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
endif ()
# GCC 5+: honor build-time option for whether or not to use new string ABI.
###########################################################################
# For gcc >= 5, allow an option to force which version of the C++ ABI to
# use (mostly this affects the implementation of std::string).
#
# FIXME: In theory, this should also be needed for clang, if compiling with
# the gcc libstdc++ toolchain. In practice, I could not get things to build
# with clang properly when using this option, and I haven't yet seen a case
# where it's needed. We can return to this and fix for clang if it becomes a
# legit problem later.
if (CMAKE_COMPILER_IS_GNUCC AND NOT ${GCC_VERSION} VERSION_LESS 5.0)
#
set (GLIBCXX_USE_CXX11_ABI "" CACHE STRING "For gcc, use the new C++11 library ABI (0|1)")
if (CMAKE_COMPILER_IS_GNUCC AND ${GCC_VERSION} VERSION_GREATER_EQUAL 5.0)
if (NOT ${GLIBCXX_USE_CXX11_ABI} STREQUAL "")
add_definitions ("-D_GLIBCXX_USE_CXX11_ABI=${GLIBCXX_USE_CXX11_ABI}")
endif ()
endif ()
# SIMD and machine architecture options
###########################################################################
# SIMD and machine architecture options.
#
# The USE_SIMD optinon may be set to a comma-separated list of machine /
# instruction set optinos, such as "avx3,f16c". The list will be parsed and
# the proper compiler directives added to generate code for those ISA
# capabilities.
#
set (USE_SIMD "" CACHE STRING "Use SIMD directives (0, sse2, sse3, ssse3, sse4.1, sse4.2, avx, avx2, avx512f, f16c, aes)")
set (SIMD_COMPILE_FLAGS "")
if (NOT USE_SIMD STREQUAL "")
message (STATUS "Compiling with SIMD level ${USE_SIMD}")
@@ -233,29 +263,29 @@ if (NOT USE_SIMD STREQUAL "")
# off by default except when we explicitly use madd. At some
# future time, we should look at this again carefully and
# see if we want to use it more widely by ffp-contract=fast.
add_definitions ("-ffp-contract=off")
add_compile_options ("-ffp-contract=off")
endif ()
endforeach()
endif ()
add_definitions (${SIMD_COMPILE_FLAGS})
add_compile_options (${SIMD_COMPILE_FLAGS})
endif ()
if (USE_fPIC)
add_definitions ("-fPIC")
endif ()
# Test for features
###########################################################################
# Preparation to test for compiler/language features
if (NOT VERBOSE)
set (CMAKE_REQUIRED_QUIET 1)
endif ()
include (CMakePushCheckState)
include (CheckCXXSourceRuns)
include (CheckLibraryExists)
# Find out if it's safe for us to use std::regex or if we need boost.regex
###########################################################################
# Find out if it's safe for us to use std::regex or if we need boost.regex.
# This is primarily about gcc 4.8 having a broken regex implementation.
# This will be obsolete once our minimum supported gcc is >= 4.9.
#
cmake_push_check_state ()
set (CMAKE_REQUIRED_DEFINITIONS ${CSTD_FLAGS})
check_cxx_source_runs("
#include <regex>
int main() {
@@ -263,39 +293,79 @@ check_cxx_source_runs("
return r == \"a c\" ? 0 : -1;
}"
USE_STD_REGEX)
cmake_pop_check_state ()
if (USE_STD_REGEX)
add_definitions (-DUSE_STD_REGEX)
else ()
add_definitions (-DUSE_BOOST_REGEX)
endif ()
cmake_pop_check_state ()
###########################################################################
# Check if we need libatomic on this platform. We shouldn't on mainstream
# x86/x86_64, but might on some other platforms.
#
if (NOT MSVC AND NOT APPLE)
cmake_push_check_state ()
check_cxx_source_runs(
"#include <atomic>
#include <cstdint>
std::atomic<uint64_t> x {0};
int main() {
uint64_t i = x.load(std::memory_order_relaxed);
return 0;
}"
COMPILER_SUPPORTS_ATOMIC_WITHOUT_LIBATOMIC)
cmake_pop_check_state ()
if (NOT COMPILER_SUPPORTS_ATOMIC_WITHOUT_LIBATOMIC)
check_library_exists (atomic __atomic_load_8 "" LIBATOMIC_WORKS)
if (LIBATOMIC_WORKS)
list (APPEND GCC_ATOMIC_LIBRARIES "-latomic")
message (STATUS "Compiler needs libatomic, added")
else ()
message (FATAL_ERROR "Compiler needs libatomic, but not found")
endif ()
else ()
if (VERBOSE)
message (STATUS "Compiler supports std::atomic, no libatomic necessary")
endif ()
endif ()
endif ()
###########################################################################
# Code coverage options
#
option (CODECOV "Build code coverage tests" OFF)
if (CODECOV AND (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG))
message (STATUS "Compiling for code coverage analysis")
add_definitions ("-ftest-coverage -fprofile-arcs -O0 -D${PROJ_NAME}_CODE_COVERAGE=1")
add_compile_options ("-ftest-coverage -fprofile-arcs -O0")
add_definitions ("-D${PROJ_NAME}_CODE_COVERAGE=1")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -ftest-coverage -fprofile-arcs")
set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -ftest-coverage -fprofile-arcs")
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -ftest-coverage -fprofile-arcs")
endif ()
###########################################################################
# Sanitizer options
#
set (SANITIZE "" CACHE STRING "Build code using sanitizer (address, thread)")
if (SANITIZE AND (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG))
message (STATUS "Compiling for sanitizer=${SANITIZE}")
string (REPLACE "," ";" SANITIZE_FEATURE_LIST ${SANITIZE})
foreach (feature ${SANITIZE_FEATURE_LIST})
message (STATUS " sanitize feature: ${feature}")
add_definitions (-fsanitize=${feature})
add_compile_options (-fsanitize=${feature})
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=${feature}")
set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fsanitize=${feature}")
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=${feature}")
endforeach()
add_definitions (-g -fno-omit-frame-pointer)
add_compile_options (-g -fno-omit-frame-pointer)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set (SANITIZE_ON_LINUX 1)
endif ()
if (CMAKE_COMPILER_IS_GNUCC AND ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
add_definitions ("-fuse-ld=gold")
add_compile_options ("-fuse-ld=gold")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fuse-ld=gold")
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=gold")
@@ -309,7 +379,22 @@ if (SANITIZE AND (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG))
add_definitions ("-D${PROJECT_NAME}_SANITIZE=1")
endif ()
###########################################################################
# clang-tidy options
#
# clang-tidy is a static analyzer that is part of the LLVM tools. It has a
# variety of the usual bug and security tests, linting, and also tests for
# things like finding (and correcting!) use of older language constructs.
#
# If clang-tidy is found and enabled, a "clang-tidy" build target will be
# enabled. The set of tests can be customized both here and through
# the .clang-tidy file that is part of this project.
#
option (CLANG_TIDY "Enable clang-tidy" OFF)
set (CLANG_TIDY_CHECKS "-*" CACHE STRING "clang-tidy checks to perform (none='-*')")
set (CLANG_TIDY_ARGS "" CACHE STRING "clang-tidy args")
option (CLANG_TIDY_FIX "Have clang-tidy fix source" OFF)
if (CLANG_TIDY)
find_program(CLANG_TIDY_EXE NAMES "clang-tidy"
DOC "Path to clang-tidy executable")
@@ -338,7 +423,26 @@ if (CLANG_TIDY)
# Hint: run with CLANG_TIDY_ARGS=-list-checks to list all the checks
endif ()
# clang-format
###########################################################################
# clang-format options
#
# clang-format is a source code reformatter that is part of the LLVM tools.
# It can be used to check adherence to project code formatting rules and
# correct any deviations. If clang-format is found on the system, a
# "clang-format" build target will trigger a reformatting.
#
set (CLANG_FORMAT_EXE_HINT "" CACHE PATH "clang-format executable's directory (will search if not specified")
set (CLANG_FORMAT_INCLUDES "src/*.h" "src/*.cpp"
CACHE STRING "Glob patterns to include for clang-format")
set (CLANG_FORMAT_EXCLUDES "*pugixml*" "*SHA1*" "*/farmhash.cpp"
"src/dpx.imageio/libdpx/*"
"src/cineon.imageio/libcineon/*"
"src/dds.imageio/squish/*"
"src/gif.imageio/gif.h"
"src/hdr.imageio/rgbe.cpp"
"src/libutil/stb_sprintf.h"
CACHE STRING "Glob patterns to exclude for clang-format")
find_program (CLANG_FORMAT_EXE
NAMES clang-format bin/clang-format
HINTS ${CLANG_FORMAT_EXE_HINT} ENV CLANG_FORMAT_EXE_HINT
@@ -365,43 +469,114 @@ else ()
endif ()
###########################################################################
# Another way to sneak in custom compiler and DSO linking flags.
#
set (EXTRA_CPP_ARGS "" CACHE STRING "Extra C++ command line definitions")
if (EXTRA_CPP_ARGS)
message (STATUS "Extra C++ args: ${EXTRA_CPP_ARGS}")
add_definitions ("${EXTRA_CPP_ARGS}")
add_compile_options ("${EXTRA_CPP_ARGS}")
endif()
set (EXTRA_DSO_LINK_ARGS "" CACHE STRING "Extra command line definitions when building DSOs")
if (BUILDSTATIC)
message (STATUS "Building static libraries")
set (LIBRARY_BUILD_TYPE STATIC)
add_definitions(-D${PROJ_NAME}_STATIC_BUILD=1)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
# On Linux, the lack of -fPIC when building static libraries seems
# incompatible with the dynamic library needed for the Python bindings.
set (USE_PYTHON OFF)
endif ()
###########################################################################
# Set the versioning for shared libraries.
#
if (${PROJECT_NAME}_SUPPORTED_RELEASE)
# Supported releases guarantee ABI back-compatibility within the release
# family, so SO versioning is major.minor.
set (SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
CACHE STRING "Set the SO version for dynamic libraries")
else ()
set (LIBRARY_BUILD_TYPE SHARED)
endif()
# Development master makes no ABI stability guarantee, so we make the
# SO naming capture down to the major.minor.patch level.
set (SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}
CACHE STRING "Set the SO version for dynamic libraries")
endif ()
if (VERBOSE)
message(STATUS "Setting SOVERSION to: ${SOVERSION}")
endif ()
# Use .a files if LINKSTATIC is enabled
###########################################################################
# BUILD_SHARED_LIBS, if turned off, will disable building of .so/.dll
# dynamic libraries and instead only build static libraries.
#
option (BUILD_SHARED_LIBS "Build shared libraries (set to OFF to build static libs)" ON)
if (NOT BUILD_SHARED_LIBS)
add_definitions (-D${PROJ_NAME}_STATIC_DEFINE=1)
endif ()
###########################################################################
# LINKSTATIC, if enabled, will cause us to favor linking static versions
# of library dependencies, if they are available.
#
option (LINKSTATIC "Link with static external libraries when possible" OFF)
if (LINKSTATIC)
set (_orig_link_suffixes ${CMAKE_FIND_LIBRARY_SUFFIXES})
message (STATUS "Statically linking external libraries")
#set (_orig_link_suffixes ${CMAKE_FIND_LIBRARY_SUFFIXES})
message (STATUS "Statically linking external libraries when possible")
if (WIN32)
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
else ()
set (CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
endif ()
add_definitions (-DBoost_USE_STATIC_LIBS=1)
set (Boost_USE_STATIC_LIBS 1)
else ()
if (MSVC)
add_definitions (-DBOOST_ALL_DYN_LINK)
add_definitions (-DOPENEXR_DLL)
endif ()
###########################################################################
# Any extra logic to be run only for CI builds goes here.
#
if (DEFINED ENV{TRAVIS} OR DEFINED ENV{APPVEYOR} OR DEFINED ENV{CI} OR DEFINED ENV{GITHUB_ACTIONS})
add_definitions ("-D${PROJ_NAME}_CI=1" "-DBUILD_CI=1")
if (APPLE)
# Keep Mono framework from being incorrectly searched for include
# files on GitHub Actions CI.
set(CMAKE_FIND_FRAMEWORK LAST)
endif ()
endif ()
if (DEFINED ENV{TRAVIS} OR DEFINED ENV{APPVEYOR} OR DEFINED ENV{CI})
add_definitions ("-D${PROJ_NAME}_CI=1" "-DBUILD_CI=1")
###########################################################################
# Rpath handling at the install step
#
set (MACOSX_RPATH ON)
if (CMAKE_SKIP_RPATH)
# We need to disallow the user from truly setting CMAKE_SKIP_RPATH, since
# we want to run the generated executables from the build tree in order to
# generate the manual page documentation. However, we make sure the
# install rpath is unset so that the install tree is still free of rpaths
# for linux packaging purposes.
set (CMAKE_SKIP_RPATH FALSE)
unset (CMAKE_INSTALL_RPATH)
else ()
if (NOT CMAKE_INSTALL_RPATH)
set (CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}")
endif ()
# add the automatically determined parts of the RPATH that
# point to directories outside the build tree to the install RPATH
set (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
if (VERBOSE)
message (STATUS "CMAKE_INSTALL_RPATH = ${CMAKE_INSTALL_RPATH}")
endif ()
endif ()
###########################################################################
# Macro to install targets to the appropriate locations. Use this instead
# of the install(TARGETS ...) signature. Note that it adds it to the
# export targets list for when we generate config files.
#
# Usage:
#
# install_targets (target1 [target2 ...])
#
macro (install_targets)
install (TARGETS ${ARGN}
EXPORT ${PROJ_NAME}_EXPORTED_TARGETS
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT user
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT user
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT developer)
endmacro()
+289 -564
View File
@@ -1,92 +1,159 @@
# Copyright 2008-present Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
###########################################################################
# Find libraries
# Find external dependencies
###########################################################################
# When not in VERBOSE mode, try to make things as quiet as possible
if (NOT VERBOSE)
set (Boost_FIND_QUIETLY true)
set (DCMTK_FIND_QUIETLY true)
set (FFmpeg_FIND_QUIETLY true)
set (Field3D_FIND_QUIETLY true)
set (Freetype_FIND_QUIETLY true)
set (GIF_FIND_QUIETLY true)
set (HDF5_FIND_QUIETLY true)
set (IlmBase_FIND_QUIETLY true)
set (JPEG_FIND_QUIETLY true)
set (LIBHEIF_FIND_QUIETLY true)
set (LibRaw_FIND_QUIETLY true)
set (Nuke_FIND_QUIETLY true)
set (OpenColorIO_FIND_QUIETLY true)
set (OpenCV_FIND_QUIETLY true)
set (OpenEXR_FIND_QUIETLY true)
set (OpenGL_FIND_QUIETLY true)
set (OpenJpeg_FIND_QUIETLY true)
set (OPENVDB_FIND_QUIETLY true)
set (PkgConfig_FIND_QUIETLY true)
set (PNG_FIND_QUIETLY TRUE)
set (PTex_FIND_QUIETLY TRUE)
set (PugiXML_FIND_QUIETLY TRUE)
set (PythonInterp_FIND_QUIETLY true)
set (PythonLibs_FIND_QUIETLY true)
set (Qt5_FIND_QUIETLY true)
set (TBB_FIND_QUIETLY true)
set (Threads_FIND_QUIETLY true)
set (TIFF_FIND_QUIETLY true)
set (WEBP_FIND_QUIETLY true)
set (ZLIB_FIND_QUIETLY true)
endif ()
message (STATUS "${ColorBoldWhite}")
message (STATUS "* Checking for dependencies...")
message (STATUS "* - Missing a dependency 'Package'?")
message (STATUS "* Try cmake -DPackage_ROOT=path or set environment var Package_ROOT=path")
message (STATUS "* For many dependencies, we supply src/build-scripts/build_Package.bash")
message (STATUS "* - To exclude an optional dependency (even if found),")
message (STATUS "* -DUSE_Package=OFF or set environment var USE_Package=OFF ")
message (STATUS "${ColorReset}")
set (OIIO_LOCAL_DEPS_PATH "${CMAKE_SOURCE_DIR}/ext/dist" CACHE STRING
"Local area for dependencies added to CMAKE_PREFIX_PATH")
list (APPEND CMAKE_PREFIX_PATH ${CMAKE_SOURCE_DIR}/ext/dist)
set (REQUIED_DEPS "" CACHE STRING
"Additional dependencies to consider required (semicolon-separated list, or ALL)")
set (OPTIONAL_DEPS "" CACHE STRING
"Additional dependencies to consider optional (semicolon-separated list, or ALL)")
# checked_find_package(pkgname ..) is a wrapper for find_package, with the
# following extra features:
# * If either `USE_pkgname` or the all-uppercase `USE_PKGNAME` (or
# `ENABLE_pkgname` or `ENABLE_PKGNAME`) exists as either a CMake or
# environment variable, is nonempty by contains a non-true/nonnzero
# value, do not search for or use the package. The optional ENABLE <var>
# arguments allow you to override the name of the enabling variable. In
# other words, support for the dependency is presumed to be ON, unless
# turned off explicitly from one of these sources.
# * Print a message if the package is enabled but not found. This is based
# on ${pkgname}_FOUND or $PKGNNAME_FOUND.
# * Optional DEFINITIONS <string> are passed to add_definitions if the
# package is found.
# * Optional PRINT <list> is a list of variables that will be printed
# if the package is found, if VERBOSE is on.
# * Optional DEPS <list> is a list of hard dependencies; for each one, if
# dep_FOUND is not true, disable this package with an error message.
# * Optional ISDEPOF <downstream> names another package for which the
# present package is only needed because it's a dependency, and
# therefore if <downstream> is disabled, we don't bother with this
# package either.
#
# N.B. This needs to be a macro, not a function, because the find modules
# will set(blah val PARENT_SCOPE) and we need that to be the global scope,
# not merely the scope for this function.
macro (checked_find_package pkgname)
cmake_parse_arguments(_pkg "REQUIRED" "ENABLE;ISDEPOF" "DEFINITIONS;PRINT;DEPS" ${ARGN})
# Arguments: <prefix> noValueKeywords singleValueKeywords multiValueKeywords argsToParse
string (TOUPPER ${pkgname} pkgname_upper)
if (NOT VERBOSE)
set (${pkgname}_FIND_QUIETLY true)
set (${pkgname_upper}_FIND_QUIETLY true)
endif ()
if ("${pkgname}" IN_LIST REQUIRED_DEPS OR "ALL" IN_LIST REQUIRED_DEPS)
set (_pkg_REQUIRED 1)
endif ()
if ("${pkgname}" IN_LIST OPTIONAL_DEPS OR "ALL" IN_LIST OPTIONAL_DEPS)
set (_pkg_REQUIRED 0)
endif ()
set (_quietskip false)
check_is_enabled (${pkgname} _enable)
set (_disablereason "")
foreach (_dep ${_pkg_DEPS})
if (_enable AND NOT ${_dep}_FOUND)
set (_enable false)
set (ENABLE_${pkgname} OFF PARENT_SCOPE)
set (_disablereason "(because ${_dep} was not found)")
endif ()
endforeach ()
if (_pkg_ISDEPOF)
check_is_enabled (${_pkg_ISDEPOF} _dep_enabled)
if (NOT _dep_enabled)
set (_enable false)
set (_quietskip true)
endif ()
endif ()
if (_enable OR _pkg_REQUIRED)
find_package (${pkgname} ${_pkg_UNPARSED_ARGUMENTS})
if (${pkgname}_FOUND OR ${pkgname_upper}_FOUND)
foreach (_vervar ${pkgname_upper}_VERSION ${pkgname}_VERSION_STRING
${pkgname_upper}_VERSION_STRING)
if (NOT ${pkgname}_VERSION AND ${_vervar})
set (${pkgname}_VERSION ${${_vervar}})
endif ()
endforeach ()
message (STATUS "${ColorGreen}Found ${pkgname} ${${pkgname}_VERSION} ${ColorReset}")
if (VERBOSE)
set (_vars_to_print ${pkgname}_INCLUDES ${pkgname_upper}_INCLUDES
${pkgname}_INCLUDE_DIR ${pkgname_upper}_INCLUDE_DIR
${pkgname}_INCLUDE_DIRS ${pkgname_upper}_INCLUDE_DIRS
${pkgname}_LIBRARIES ${pkgname_upper}_LIBRARIES
${_pkg_PRINT})
list (REMOVE_DUPLICATES _vars_to_print)
foreach (_v IN LISTS _vars_to_print)
if (NOT "${${_v}}" STREQUAL "")
message (STATUS " ${_v} = ${${_v}}")
endif ()
endforeach ()
endif ()
add_definitions (${_pkg_DEFINITIONS})
else ()
message (STATUS "${ColorRed}${pkgname} library not found ${ColorReset}")
if (${pkgname}_ROOT)
message (STATUS "${ColorRed} ${pkgname}_ROOT was: ${${pkgname}_ROOT} ${ColorReset}")
elseif ($ENV{${pkgname}_ROOT})
message (STATUS "${ColorRed} ENV ${pkgname}_ROOT was: ${${pkgname}_ROOT} ${ColorReset}")
else ()
message (STATUS "${ColorRed} Try setting ${pkgname}_ROOT ? ${ColorReset}")
endif ()
if (EXISTS "${PROJECT_SOURCE_DIR}/src/build-scripts/build_${pkgname}.bash")
message (STATUS "${ColorRed} Maybe this will help: src/build-scripts/build_${pkgname}.bash ${ColorReset}")
endif ()
if (_pkg_REQUIRED)
message (FATAL_ERROR "${ColorRed}${pkgname} is required, aborting.${ColorReset}")
endif ()
endif()
else ()
if (NOT _quietskip)
message (STATUS "${ColorRed}Not using ${pkgname} -- disabled ${_disablereason} ${ColorReset}")
endif ()
endif ()
endmacro()
include (ExternalProject)
option (BUILD_MISSING_DEPS "Try to download and build any missing dependencies" OFF)
###########################################################################
# TIFF
if (NOT TIFF_LIBRARIES OR NOT TIFF_INCLUDE_DIR)
find_package (TIFF 3.9 REQUIRED)
include_directories (${TIFF_INCLUDE_DIR})
else ()
message (STATUS "Custom TIFF_LIBRARIES ${TIFF_LIBRARIES}")
message (STATUS "Custom TIFF_INCLUDE_DIR ${TIFF_INCLUDE_DIR}")
endif ()
###########################################################################
# Several packages need Zlib
find_package (ZLIB REQUIRED)
###########################################################################
# PNG
find_package (PNG REQUIRED)
###########################################################################
# IlmBase & OpenEXR setup
find_package (OpenEXR 2.0 REQUIRED)
#OpenEXR 2.2 still has problems with importing ImathInt64.h unqualified
#thus need for ilmbase/OpenEXR
include_directories ("${OPENEXR_INCLUDE_DIR}"
"${ILMBASE_INCLUDE_DIR}"
"${ILMBASE_INCLUDE_DIR}/OpenEXR")
if (NOT OpenEXR_FIND_QUIETLY)
message (STATUS "OPENEXR_INCLUDE_DIR = ${OPENEXR_INCLUDE_DIR}")
message (STATUS "OPENEXR_LIBRARIES = ${OPENEXR_LIBRARIES}")
endif ()
# OpenEXR setup
###########################################################################
###########################################################################
# Boost setup
if (LINKSTATIC)
set (Boost_USE_STATIC_LIBS ON)
set (Boost_USE_STATIC_LIBS ON)
if (MSVC)
add_definitions (-DBOOST_ALL_NO_LIB=1)
endif ()
else ()
if (MSVC)
add_definitions (-DBOOST_ALL_DYN_LINK=1)
endif ()
endif ()
set (Boost_USE_MULTITHREADED ON)
if (BOOST_CUSTOM)
set (Boost_FOUND true)
# N.B. For a custom version, the caller had better set up the variables
@@ -96,17 +163,21 @@ else ()
if (NOT USE_STD_REGEX)
list (APPEND Boost_COMPONENTS regex)
endif ()
find_package (Boost 1.53 REQUIRED
COMPONENTS ${Boost_COMPONENTS})
# The FindBoost.cmake interface is broken if it uses boost's installed
# cmake output (e.g. boost 1.70.0, cmake <= 3.14). Specifically it fails
# to set the expected variables printed below. So until that's fixed
# force FindBoost.cmake to use the original brute force path.
set (Boost_NO_BOOST_CMAKE ON)
checked_find_package (Boost 1.53 REQUIRED
COMPONENTS ${Boost_COMPONENTS}
PRINT Boost_INCLUDE_DIRS Boost_LIBRARIES
)
endif ()
message (STATUS "Boost version ${Boost_VERSION}")
if (NOT Boost_FIND_QUIETLY)
message (STATUS "Boost found ${Boost_FOUND} ")
message (STATUS "BOOST_ROOT ${BOOST_ROOT}")
message (STATUS "Boost include dirs ${Boost_INCLUDE_DIRS}")
message (STATUS "Boost library dirs ${Boost_LIBRARY_DIRS}")
message (STATUS "Boost libraries ${Boost_LIBRARIES}")
# On Linux, Boost 1.55 and higher seems to need to link against -lrt
if (CMAKE_SYSTEM_NAME MATCHES "Linux"
AND ${Boost_VERSION} VERSION_GREATER_EQUAL 105500)
list (APPEND Boost_LIBRARIES "rt")
endif ()
include_directories (SYSTEM "${Boost_INCLUDE_DIRS}")
@@ -115,546 +186,200 @@ link_directories ("${Boost_LIBRARY_DIRS}")
# end Boost setup
###########################################################################
###########################################################################
# OpenGL setup
if (USE_OPENGL)
find_package (OpenGL)
if (NOT OpenGL_FIND_QUIETLY)
message (STATUS "OPENGL_FOUND=${OPENGL_FOUND} USE_OPENGL=${USE_OPENGL}")
endif ()
###########################################################################
# Dependencies for required formats and features. These are so critical
# that we will not complete the build if they are not found.
checked_find_package (ZLIB REQUIRED) # Needed by several packages
checked_find_package (TIFF 3.0 REQUIRED)
# IlmBase & OpenEXR
checked_find_package (OpenEXR 2.0 REQUIRED)
# We use Imath so commonly, may as well include it everywhere.
include_directories ("${OPENEXR_INCLUDES}" "${ILMBASE_INCLUDES}"
"${ILMBASE_INCLUDES}/OpenEXR")
if (CMAKE_COMPILER_IS_CLANG AND OPENEXR_VERSION VERSION_LESS 2.3)
# clang C++ >= 11 doesn't like 'register' keyword in old exr headers
add_compile_options (-Wno-deprecated-register)
endif ()
# end OpenGL setup
###########################################################################
###########################################################################
# OpenColorIO Setup
if (USE_OCIO)
# If 'OCIO_PATH' not set, use the env variable of that name if available
if (NOT OCIO_PATH)
if (NOT $ENV{OCIO_PATH} STREQUAL "")
set (OCIO_PATH $ENV{OCIO_PATH})
endif ()
endif()
find_package (OpenColorIO)
if (OCIO_FOUND)
include_directories (${OCIO_INCLUDES})
add_definitions ("-DUSE_OCIO=1")
else ()
message (STATUS "Skipping OpenColorIO support")
endif ()
if (LINKSTATIC)
find_library (TINYXML_LIBRARY NAMES tinyxml)
if (TINYXML_LIBRARY)
set (OCIO_LIBRARIES ${OCIO_LIBRARIES} ${TINYXML_LIBRARY})
endif ()
find_library (YAML_LIBRARY NAMES yaml-cpp)
if (YAML_LIBRARY)
set (OCIO_LIBRARIES ${OCIO_LIBRARIES} ${YAML_LIBRARY})
endif ()
find_library (LCMS2_LIBRARY NAMES lcms2)
if (LCMS2_LIBRARY)
set (OCIO_LIBRARIES ${OCIO_LIBRARIES} ${LCMS2_LIBRARY})
endif ()
endif ()
else ()
message (STATUS "OpenColorIO disabled")
endif ()
# end OpenColorIO setup
###########################################################################
###########################################################################
# Qt setup
if (USE_QT)
set (qt5_modules Core Gui Widgets)
if (USE_OPENGL)
list (APPEND qt5_modules OpenGL)
endif ()
find_package (Qt5 COMPONENTS ${qt5_modules})
endif ()
if (USE_QT AND Qt5_FOUND)
if (NOT Qt5_FIND_QUIETLY)
message (STATUS "Qt5_FOUND=${Qt5_FOUND}")
endif ()
else ()
message (STATUS "No Qt5 -- skipping components that need Qt5.")
if (USE_QT AND NOT Qt5_FOUND AND APPLE)
message (STATUS "If you think you installed qt5 with Homebrew and it still doesn't work,")
message (STATUS "try: export PATH=/usr/local/opt/qt5/bin:$PATH")
endif ()
endif ()
# end Qt setup
###########################################################################
###########################################################################
# BZIP2 - used by ffmped and freetype
find_package (BZip2) # Used by ffmpeg
if (NOT BZIP2_FOUND)
set (BZIP2_LIBRARIES "")
if (MSVC AND NOT LINKSTATIC)
add_definitions (-DOPENEXR_DLL) # Is this needed for new versions?
endif ()
###########################################################################
# FFmpeg
if (USE_FFMPEG)
find_package (FFmpeg 2.6)
if (FFMPEG_INCLUDE_DIR AND FFMPEG_LIBRARIES)
set (FFMPEG_FOUND TRUE)
if (NOT FFmpeg_FIND_QUIETLY)
message (STATUS "FFMPEG includes = ${FFMPEG_INCLUDE_DIR}")
message (STATUS "FFMPEG library = ${FFMPEG_LIBRARIES}")
endif ()
else ()
message (STATUS "FFMPEG not found")
endif ()
endif()
# end FFmpeg setup
###########################################################################
###########################################################################
# Field3d
if (USE_FIELD3D)
if (HDF5_CUSTOM)
if (NOT HDF5_FIND_QUIETLY)
message (STATUS "Using custom HDF5")
endif ()
set (HDF5_FOUND true)
# N.B. For a custom version, the caller had better set up the
# variables HDF5_INCLUDE_DIRS and HDF5_LIBRARIES.
else ()
find_library (HDF5_LIBRARIES
NAMES hdf5
PATHS
/usr/local/lib
/opt/local/lib
)
if (HDF5_LIBRARIES)
set (HDF5_FOUND true)
endif ()
endif ()
if (NOT HDF5_FIND_QUIETLY)
message (STATUS "HDF5_FOUND=${HDF5_FOUND}")
message (STATUS "HDF5_LIBRARIES=${HDF5_LIBRARIES}")
endif ()
endif ()
if (USE_FIELD3D AND HDF5_FOUND)
if (NOT Field3D_FIND_QUIETLY)
message (STATUS "FIELD3D_HOME=${FIELD3D_HOME}")
endif ()
if (FIELD3D_HOME)
set (FIELD3D_INCLUDES "${FIELD3D_HOME}/include")
else ()
find_path (FIELD3D_INCLUDES Field3D/Field.h
"${PROJECT_SOURCE_DIR}/src/include"
"${FIELD3D_HOME}/include"
)
endif ()
find_library (FIELD3D_LIBRARY
NAMES Field3D
PATHS "${FIELD3D_HOME}/lib"
)
if (FIELD3D_INCLUDES AND FIELD3D_LIBRARY)
set (FIELD3D_FOUND TRUE)
if (NOT Field3D_FIND_QUIETLY)
message (STATUS "Field3D includes = ${FIELD3D_INCLUDES}")
message (STATUS "Field3D library = ${FIELD3D_LIBRARY}")
endif ()
add_definitions ("-DUSE_FIELD3D=1")
include_directories ("${FIELD3D_INCLUDES}")
else ()
message (STATUS "Field3D not found")
add_definitions ("-UUSE_FIELD3D")
set (FIELD3D_FOUND FALSE)
endif ()
else ()
add_definitions ("-UUSE_FIELD3D")
message (STATUS "Field3d will not be used")
# JPEG -- prefer Turbo-JPEG to regular libjpeg
checked_find_package (JPEGTurbo
DEFINITIONS -DUSE_JPEG_TURBO=1
PRINT JPEG_INCLUDES JPEG_LIBRARIES)
if (NOT JPEG_FOUND) # Try to find the non-turbo version
checked_find_package (JPEG REQUIRED)
endif ()
# end Field3d setup
###########################################################################
###########################################################################
# Intel TBB
if (USE_TBB)
if (DEBUGMODE)
set(TBB_USE_DEBUG_BUILD ON)
endif ()
find_package (TBB 2017) # 2017 min for VFX Platform 2018
if (TBB_FOUND)
if (NOT TBB_FIND_QUIETLY)
message (STATUS "Intel TBB includes = ${TBB_INCLUDE_DIRS}")
message (STATUS "Intel TBB library = ${TBB_LIBRARIES}")
endif ()
add_definitions ("-DUSE_TBB=1")
else ()
message (STATUS "Intel TBB not found, TBB_ROOT_DIR='${TBB_ROOT_DIR}'")
endif ()
endif ()
# end Intel TBB setup
###########################################################################
###########################################################################
# OpenVDB
if (USE_OPENVDB AND TBB_FOUND)
find_package (OpenVDB 5.0) # 5.0 min for VFX Platform 2017
if (OPENVDB_FOUND)
if (NOT OPENVDB_FIND_QUIETLY)
message (STATUS "OpenVDB includes = ${OPENVDB_INCLUDE_DIRS}")
message (STATUS "OpenVDB libraries = ${OPENVDB_LIBRARIES}")
endif ()
add_definitions ("-DUSE_OPENVDB=1")
else ()
message (STATUS "OpenVDB not found, OPENVDB_ROOT_DIR='${OPENVDB_ROOT_DIR}'")
endif ()
else ()
if (USE_OPENVDB AND NOT TBB_FOUND)
set (oiio_vdb_why ", could not find Intel TBB")
endif ()
message (STATUS "OpenVDB will not be used${oiio_vdb_why}")
endif ()
# end OpenVDB setup
###########################################################################
###########################################################################
# JPEG
if (USE_JPEGTURBO)
find_package (JPEGTurbo)
endif ()
if (JPEG_FOUND)
add_definitions ("-DUSE_JPEG_TURBO=1")
set (JPEG_TURBO_FOUND 1)
else ()
# Try to find the non-turbo version
find_package (JPEG REQUIRED)
endif ()
include_directories (${JPEG_INCLUDE_DIR})
# end JPEG
###########################################################################
###########################################################################
# OpenJpeg
if (USE_OPENJPEG)
find_package (OpenJpeg)
endif()
# end OpenJpeg setup
###########################################################################
###########################################################################
# LibRaw
if (USE_LIBRAW)
if (NOT LibRaw_FIND_QUIETLY)
message (STATUS "Looking for LibRaw with ${LIBRAW_PATH}")
endif ()
find_package (LibRaw)
if (LibRaw_r_LIBRARIES AND LibRaw_INCLUDE_DIR)
set (LIBRAW_FOUND TRUE)
include_directories (${LibRaw_INCLUDE_DIR})
if (NOT LibRaw_FIND_QUIETLY)
message (STATUS "Found LibRaw, include ${LibRaw_INCLUDE_DIR}")
endif ()
else ()
set (LIBRAW_FOUND FALSE)
message (STATUS "LibRaw not found!")
endif()
if (LINKSTATIC)
find_package (Jasper)
find_library (LCMS2_LIBRARIES NAMES lcms2)
set (LibRaw_r_LIBRARIES ${LibRaw_r_LIBRARIES} ${JASPER_LIBRARIES} ${LCMS2_LIBRARIES})
endif ()
else ()
message (STATUS "Not using LibRaw")
endif()
# end LibRaw setup
###########################################################################
###########################################################################
# WebP setup
if (USE_WEBP)
if (NOT WEBP_FIND_QUIETLY)
message (STATUS "WEBP_HOME=${WEBP_HOME}")
endif ()
find_path (WEBP_INCLUDE_DIR webp/encode.h
"${PROJECT_SOURCE_DIR}/src/include"
"${WEBP_HOME}")
find_library (WEBP_LIBRARY
NAMES webp
PATHS "${WEBP_HOME}")
if (WEBP_INCLUDE_DIR AND WEBP_LIBRARY)
set (WEBP_FOUND TRUE)
if (NOT WEBP_FIND_QUIETLY)
message (STATUS "WEBP includes = ${WEBP_INCLUDE_DIR} ")
message (STATUS "WEBP library = ${WEBP_LIBRARY} ")
endif ()
else()
set (WEBP_FOUND FALSE)
message (STATUS "WebP library not found")
endif()
else ()
message (STATUS "Not using WebP")
endif ()
# end Webp setup
###########################################################################
###########################################################################
# Pugixml setup. Normally we just use the version bundled with oiio, but
# some linux distros are quite particular about having separate packages so we
# allow this to be overridden to use the distro-provided package if desired.
option (USE_EXTERNAL_PUGIXML "Use an externally built shared library version of the pugixml library" OFF)
if (USE_EXTERNAL_PUGIXML)
find_package (PugiXML REQUIRED)
# insert include path to pugixml first, to ensure that the external
# pugixml is found, and not the one in OIIO's include directory.
include_directories (BEFORE ${PUGIXML_INCLUDE_DIR})
add_definitions ("-DUSE_EXTERNAL_PUGIXML=1")
checked_find_package (pugixml REQUIRED
DEFINITIONS -DUSE_EXTERNAL_PUGIXML=1)
endif()
###########################################################################
# OpenCV setup
if (USE_OPENCV)
find_package (OpenCV)
if (OpenCV_FOUND)
add_definitions ("-DUSE_OPENCV")
else ()
message (STATUS "OpenCV library not found")
endif ()
else ()
message (STATUS "Not using OpenCV")
###########################################################################
# Dependencies for optional formats and features. If these are not found,
# we will continue building, but the related functionality will be disabled.
checked_find_package (PNG)
checked_find_package (BZip2) # Used by ffmpeg and freetype
if (NOT BZIP2_FOUND)
set (BZIP2_LIBRARIES "") # TODO: why does it break without this?
endif ()
# end OpenCV setup
###########################################################################
checked_find_package (Freetype
DEFINITIONS -DUSE_FREETYPE=1 )
checked_find_package (HDF5
ISDEPOF Field3D)
checked_find_package (OpenColorIO
DEFINITIONS -DUSE_OCIO=1 -DUSE_OPENCOLORIO=1)
checked_find_package (OpenCV
DEFINITIONS -DUSE_OPENCV=1)
###########################################################################
# Freetype setup
# Intel TBB
set (TBB_USE_DEBUG_BUILD OFF)
checked_find_package (TBB 2017
DEFINITIONS -DUSE_TBB=1
ISDEPOF OpenVDB)
if (USE_FREETYPE)
find_package (Freetype)
if (FREETYPE_FOUND)
add_definitions ("-DUSE_FREETYPE")
if (NOT Freetype_FIND_QUIETLY)
message (STATUS "Freetype includes = ${FREETYPE_INCLUDE_DIRS} ")
message (STATUS "Freetype libs = ${FREETYPE_LIBRARIES} ")
endif ()
else ()
message (STATUS "Freetype library not found")
endif ()
else ()
message (STATUS "Not using Freetype")
checked_find_package (DCMTK 3.6.1) # For DICOM images
checked_find_package (FFmpeg 2.6)
checked_find_package (Field3D
DEPS HDF5
DEFINITIONS -DUSE_FIELD3D=1)
checked_find_package (GIF 4)
checked_find_package (Libheif 1.3) # For HEIF/HEIC format
checked_find_package (LibRaw
PRINT LibRaw_r_LIBRARIES)
checked_find_package (OpenJpeg 2.0)
checked_find_package (OpenVDB 5.0
DEPS TBB
DEFINITIONS -DUSE_OPENVDB=1)
checked_find_package (PTex)
checked_find_package (Webp)
option (USE_R3DSDK "Enable R3DSDK (RED camera) support" OFF)
checked_find_package (R3DSDK) # RED camera
set (NUKE_VERSION "7.0" CACHE STRING "Nuke version to target")
checked_find_package (Nuke)
checked_find_package (OpenGL) # used for iv
# Qt -- used for iv
set (qt5_modules Core Gui Widgets)
if (OPENGL_FOUND)
list (APPEND qt5_modules OpenGL)
endif ()
option (USE_QT "Use Qt if found" ON)
checked_find_package (Qt5 COMPONENTS ${qt5_modules})
if (USE_QT AND NOT Qt5_FOUND AND APPLE)
message (STATUS " If you think you installed qt5 with Homebrew and it still doesn't work,")
message (STATUS " try: export PATH=/usr/local/opt/qt5/bin:$PATH")
endif ()
# end Freetype setup
###########################################################################
###########################################################################
# GIF
if (USE_GIF)
find_package (GIF)
endif()
# end GIF setup
###########################################################################
###########################################################################
# PTex
if (USE_PTEX)
find_package (PTex)
if (NOT PTEX_FOUND)
set (PTEX_INCLUDE_DIR "")
set (PTEX_LIBRARIES "")
endif ()
endif()
# end PTEX setup
###########################################################################
###########################################################################
# DCMTK
if (USE_DICOM)
find_package (DCMTK 3.6.1)
if (NOT DCMTK_FOUND)
set (DCMTK_INCLUDE_DIR "")
set (DCMTK_LIBRARIES "")
endif ()
endif()
# end DCMTK setup
###########################################################################
###########################################################################
# HEIF
if (USE_HEIF)
find_package (Libheif 1.3)
endif()
# end HEIF setup
###########################################################################
###########################################################################
# pybind11
option (BUILD_PYBIND11_FORCE "Force local download/build of Pybind11 even if installed" OFF)
option (BUILD_MISSING_PYBIND11 "Local download/build of Pybind11 if not installed" ON)
set (BUILD_PYBIND11_VERSION "v2.2.4" CACHE STRING "Preferred pybind11 version, of downloading/building our own")
set (PYBIND11_HOME "" CACHE STRING "Installed pybind11 location hint")
set (BUILD_PYBIND11_MINIMUM_VERSION "2.2.0")
macro (find_or_download_pybind11)
# If we weren't told to force our own download/build of pybind11, look
# for an installed version. Still prefer a copy that seems to be
# locally installed in this tree.
if (NOT BUILD_PYBIND11_FORCE)
find_path (PYBIND11_INCLUDE_DIR pybind11/pybind11.h
"${PROJECT_SOURCE_DIR}/ext/pybind11/include"
"${PYBIND11_HOME}"
"$ENV{PYBIND11_HOME}"
)
endif ()
# Check the version -- if it's too old, download a local copy.
if (PYBIND11_INCLUDE_DIR)
set (PYBIND11_COMMON_FILE "${PYBIND11_INCLUDE_DIR}/pybind11/detail/common.h")
IF (NOT EXISTS ${PYBIND11_COMMON_FILE})
set (PYBIND11_COMMON_FILE "${PYBIND11_INCLUDE_DIR}/pybind11/common.h")
endif ()
file(STRINGS "${PYBIND11_COMMON_FILE}" TMP REGEX "^#define PYBIND11_VERSION_MAJOR .*$")
string (REGEX MATCHALL "[0-9]+$" PYBIND11_VERSION_MAJOR ${TMP})
file(STRINGS "${PYBIND11_COMMON_FILE}" TMP REGEX "^#define PYBIND11_VERSION_MINOR .*$")
string (REGEX MATCHALL "[0-9]+$" PYBIND11_VERSION_MINOR ${TMP})
set (PYBIND11_VERSION "${PYBIND11_VERSION_MAJOR}.${PYBIND11_VERSION_MINOR}")
if ("${PYBIND11_VERSION}" VERSION_LESS BUILD_PYBIND11_MINIMUM_VERSION)
message (WARNING "pybind11 from ${PYBIND11_INCLUDE_DIR} is too old (${PYBIND11_VERSION}), minimum is ${BUILD_PYBIND11_MINIMUM_VERSION}, downloading our own.")
set (PYBIND11_INCLUDE_DIR "")
endif ()
endif ()
# If an external copy wasn't found and we requested that missing
# packages be built, or we we are forcing a local copy to be built, then
# download and build it.
if ((BUILD_MISSING_PYBIND11 AND NOT PYBIND11_INCLUDE_DIR) OR BUILD_PYBIND11_FORCE)
message (STATUS "Building local Pybind11")
set (PYBIND11_INSTALL_DIR "${PROJECT_SOURCE_DIR}/ext/pybind11")
set (PYBIND11_GIT_REPOSITORY "https://github.com/pybind/pybind11")
if (NOT IS_DIRECTORY ${PYBIND11_INSTALL_DIR}/include)
find_package (Git REQUIRED)
execute_process(COMMAND
${GIT_EXECUTABLE} clone ${PYBIND11_GIT_REPOSITORY}
--branch ${BUILD_PYBIND11_VERSION}
${PYBIND11_INSTALL_DIR}
)
if (IS_DIRECTORY ${PYBIND11_INSTALL_DIR}/include)
message (STATUS "DOWNLOADED pybind11 to ${PYBIND11_INSTALL_DIR}.\n"
"Remove that dir to get rid of it.")
else ()
message (FATAL_ERROR "Could not download pybind11")
endif ()
endif ()
set (PYBIND11_INCLUDE_DIR "${PYBIND11_INSTALL_DIR}/include")
set (PYBIND11_COMMON_FILE "${PYBIND11_INCLUDE_DIR}/pybind11/detail/common.h")
IF (NOT EXISTS ${PYBIND11_COMMON_FILE})
set (PYBIND11_COMMON_FILE "${PYBIND11_INCLUDE_DIR}/pybind11/common.h")
endif ()
file(STRINGS "${PYBIND11_COMMON_FILE}" TMP REGEX "^#define PYBIND11_VERSION_MAJOR .*$")
string (REGEX MATCHALL "[0-9]+$" PYBIND11_VERSION_MAJOR ${TMP})
file(STRINGS "${PYBIND11_COMMON_FILE}" TMP REGEX "^#define PYBIND11_VERSION_MINOR .*$")
string (REGEX MATCHALL "[0-9]+$" PYBIND11_VERSION_MINOR ${TMP})
set (PYBIND11_VERSION "${PYBIND11_VERSION_MAJOR}.${PYBIND11_VERSION_MINOR}")
endif ()
if ("${PYBIND11_VERSION}" VERSION_LESS BUILD_PYBIND11_MINIMUM_VERSION)
message (WARNING "pybind11 from ${PYBIND11_INCLUDE_DIR} is too old (${PYBIND11_VERSION}), minimum is ${BUILD_PYBIND11_MINIMUM_VERSION}.")
set (PYBIND11_INCLUDE_DIR "")
endif ()
if (PYBIND11_INCLUDE_DIR)
message (STATUS "pybind11 ${PYBIND11_VERSION}, include dir: ${PYBIND11_INCLUDE_DIR}")
else ()
message (FATAL_ERROR "pybind11 is missing! If it's not on your "
"system, you need to install it, or build with either "
"-DBUILD_MISSING_DEPS=ON or -DBUILD_PYBIND11_FORCE=ON. "
"Or build with -DUSE_PYTHON=OFF.")
endif ()
endmacro()
###########################################################################
# Tessil/robin-map
option (BUILD_ROBINMAP_FORCE "Force local download/build of robin-map even if installed" OFF)
option (BUILD_MISSING_ROBINMAP "Local download/build of robin-map if not installed" ON)
set (BUILD_ROBINMAP_VERSION "1e59f1993c7b6eace15032f38b5acb0bc34f530b" CACHE STRING "Preferred Tessil/robin-map version, of downloading/building our own")
set (ROBINMAP_HOME "" CACHE STRING "Installed robin-map location hint")
set (BUILD_ROBINMAP_VERSION "v0.6.2" CACHE STRING "Preferred Tessil/robin-map version, of downloading/building our own")
macro (find_or_download_robin_map)
# If we weren't told to force our own download/build of robin-map, look
# for an installed version. Still prefer a copy that seems to be
# locally installed in this tree.
if (NOT BUILD_ROBINMAP_FORCE)
find_path (ROBINMAP_INCLUDE_DIR tsl/robin_map.h
"${PROJECT_SOURCE_DIR}/ext/robin-map/tsl/"
"${ROBINMAP_HOME}"
"$ENV{ROBINMAP_HOME}"
)
find_package (Robinmap QUIET)
endif ()
# If an external copy wasn't found and we requested that missing
# packages be built, or we we are forcing a local copy to be built, then
# download and build it.
# Download the headers from github
if ((BUILD_MISSING_ROBINMAP AND NOT ROBINMAP_INCLUDE_DIR) OR BUILD_ROBINMAP_FORCE)
if ((BUILD_MISSING_ROBINMAP AND NOT ROBINMAP_FOUND) OR BUILD_ROBINMAP_FORCE)
message (STATUS "Downloading local Tessil/robin-map")
set (ROBINMAP_INSTALL_DIR "${PROJECT_SOURCE_DIR}/ext/robin-map")
set (ROBINMAP_GIT_REPOSITORY "https://github.com/Tessil/robin-map")
if (NOT IS_DIRECTORY ${ROBINMAP_INSTALL_DIR}/tsl)
if (NOT IS_DIRECTORY ${ROBINMAP_INSTALL_DIR}/include/tsl)
find_package (Git REQUIRED)
execute_process(COMMAND ${GIT_EXECUTABLE} clone ${ROBINMAP_GIT_REPOSITORY} -n ${ROBINMAP_INSTALL_DIR})
execute_process(COMMAND ${GIT_EXECUTABLE} checkout ${BUILD_ROBINMAP_VERSION}
WORKING_DIRECTORY ${ROBINMAP_INSTALL_DIR})
if (IS_DIRECTORY ${ROBINMAP_INSTALL_DIR}/tsl)
if (IS_DIRECTORY ${ROBINMAP_INSTALL_DIR}/include/tsl)
message (STATUS "DOWNLOADED Tessil/robin-map to ${ROBINMAP_INSTALL_DIR}.\n"
"Remove that dir to get rid of it.")
else ()
message (FATAL_ERROR "Could not download Tessil/robin-map")
endif ()
endif ()
set (ROBINMAP_INCLUDE_DIR "${ROBINMAP_INSTALL_DIR}")
endif ()
if (ROBINMAP_INCLUDE_DIR)
message (STATUS "robin-map include dir: ${ROBINMAP_INCLUDE_DIR}")
else ()
message (FATAL_ERROR "Tessil/robin-map is missing!")
set (ROBINMAP_INCLUDE_DIR "${ROBINMAP_INSTALL_DIR}/include")
endif ()
checked_find_package (Robinmap REQUIRED)
endmacro()
###########################################################################
# libsquish
option (USE_EMBEDDED_LIBSQUISH
"Force use of embedded Libsquish, even if external is found" OFF)
if (NOT USE_EMBEDDED_LIBSQUISH)
checked_find_package (Libsquish)
endif ()
###########################################################################
# fmtlib
option (BUILD_FMT_FORCE "Force local download/build of fmt even if installed" OFF)
option (BUILD_MISSING_FMT "Local download/build of fmt if not installed" ON)
set (BUILD_FMT_VERSION "6.1.2" CACHE STRING "Preferred fmtlib/fmt version, when downloading/building our own")
macro (find_or_download_fmt)
# If we weren't told to force our own download/build of fmt, look
# for an installed version. Still prefer a copy that seems to be
# locally installed in this tree.
if (NOT BUILD_FMT_FORCE)
find_package (fmt QUIET)
endif ()
# If an external copy wasn't found and we requested that missing
# packages be built, or we we are forcing a local copy to be built, then
# download and build it.
if ((BUILD_MISSING_FMT AND NOT FMT_FOUND) OR BUILD_FMT_FORCE)
message (STATUS "Downloading local fmtlib/fmt")
set (FMT_INSTALL_DIR "${PROJECT_SOURCE_DIR}/ext/fmt")
set (FMT_GIT_REPOSITORY "https://github.com/fmtlib/fmt")
if (NOT IS_DIRECTORY ${FMT_INSTALL_DIR}/include/fmt)
find_package (Git REQUIRED)
execute_process(COMMAND ${GIT_EXECUTABLE} clone ${FMT_GIT_REPOSITORY} -n ${FMT_INSTALL_DIR})
execute_process(COMMAND ${GIT_EXECUTABLE} checkout ${BUILD_FMT_VERSION}
WORKING_DIRECTORY ${FMT_INSTALL_DIR})
if (IS_DIRECTORY ${FMT_INSTALL_DIR}/include/fmt)
message (STATUS "DOWNLOADED fmtlib/fmt to ${FMT_INSTALL_DIR}.\n"
"Remove that dir to get rid of it.")
else ()
message (FATAL_ERROR "Could not download fmtlib/fmt")
endif ()
endif ()
set (FMT_INCLUDE_DIR "${FMT_INSTALL_DIR}/include")
endif ()
checked_find_package (fmt REQUIRED)
endmacro()
find_or_download_fmt()
include_directories (${FMT_INCLUDES})
-20
View File
@@ -1,20 +0,0 @@
###########################################################################
# Rpath handling at the install step
set (MACOSX_RPATH ON)
if (CMAKE_SKIP_RPATH)
# We need to disallow the user from truly setting CMAKE_SKIP_RPATH, since
# we want to run the generated executables from the build tree in order to
# generate the manual page documentation. However, we make sure the
# install rpath is unset so that the install tree is still free of rpaths
# for linux packaging purposes.
set (CMAKE_SKIP_RPATH FALSE)
unset (CMAKE_INSTALL_RPATH)
else ()
set (CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}")
# add the automatically determined parts of the RPATH that
# point to directories outside the build tree to the install RPATH
set (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
if (VERBOSE)
message (STATUS "CMAKE_INSTALL_RPATH = ${CMAKE_INSTALL_RPATH}")
endif ()
endif ()
+12 -31
View File
@@ -1,7 +1,7 @@
# Module to find DCMTK
#
# This module will first look into the directories defined by the variables:
# - DCMTK_PATH, DCMTK_INCLUDE_PATH, DCMTK_LIBRARY_PATH
# - DCMTK_ROOT, DCMTK_INCLUDE_PATH, DCMTK_LIBRARY_PATH
#
# This module defines the following variables:
#
@@ -15,8 +15,8 @@ include (FindPackageHandleStandardArgs)
include (FindPackageMessage)
if (NOT DCMTK_FIND_QUIETLY)
if (DCMTK_PATH)
message(STATUS "DCMTK path explicitly specified: ${DCMTK_PATH}")
if (DCMTK_ROOT)
message(STATUS "DCMTK path explicitly specified: ${DCMTK_ROOT}")
endif()
if (DCMTK_INCLUDE_PATH)
message(STATUS "DCMTK INCLUDE_PATH explicitly specified: ${DCMTK_INCLUDE_PATH}")
@@ -28,31 +28,21 @@ endif ()
find_path (DCMTK_INCLUDE_DIR
dcmtk/dcmdata/dcuid.h
PATHS
${DCMTK_INCLUDE_PATH}
${DCMTK_PATH}/include/
/usr/include
/usr/local/include
/sw/include
/opt/local/include
HINTS
${DCMTK_INCLUDE_PATH} ENV DCMTK_INCLUDE_PATH
DOC "The directory where DCMTK headers reside")
foreach (COMPONENT dcmimage dcmimgle dcmdata oflog ofstd iconv)
find_library (DCMTK_${COMPONENT}_LIB ${COMPONENT}
PATHS ${DCMTK_PATH}/lib/
/usr/local/lib
/usr/lib64
/usr/lib
/usr/local/lib64
/sw/lib
/opt/local/lib
HINTS
${DCMTK_LIBRARY_PATH} ENV DCMTK_LIBRARY_PATH
PATH_SUFFIXES lib lib64
)
if (DCMTK_${COMPONENT}_LIB)
set (DCMTK_LIBRARIES ${DCMTK_LIBRARIES} ${DCMTK_${COMPONENT}_LIB})
endif ()
endforeach()
message (STATUS "DCMTK_INCLUDE_DIR = ${DCMTK_INCLUDE_DIR}")
if (DCMTK_INCLUDE_DIR AND EXISTS "${DCMTK_INCLUDE_DIR}/dcmtk/config/osconfig.h")
file(STRINGS "${DCMTK_INCLUDE_DIR}/dcmtk/config/osconfig.h" TMP REGEX "^#define PACKAGE_VERSION[ \t].*$")
string(REGEX MATCHALL "[0-9.]+" DCMTK_VERSION ${TMP})
@@ -60,25 +50,16 @@ if (DCMTK_INCLUDE_DIR AND EXISTS "${DCMTK_INCLUDE_DIR}/dcmtk/config/osconfig.h")
string(REGEX MATCHALL "[0-9.]+" DCMTK_VERSION_NUMBER ${TMP})
endif ()
if (DCMTK_INCLUDE_DIR AND DCMTK_LIBRARIES)
set(DCMTK_FOUND TRUE)
set(DCMTK_INCLUDES "${DCMTK_INCLUDE_DIR}")
if (NOT DCMTK_FIND_QUIETLY)
message(STATUS "Found DCMTK library ${DCMTK_LIBRARIES}")
message(STATUS "Found DCMTK includes ${DCMTK_INCLUDES}")
message(STATUS "Found DCMTK short version number ${DCMTK_VERSION_NUMBER}")
endif ()
else()
set(DCMTK_FOUND FALSE)
message(STATUS "DCMTK not found. Specify DCMTK_PATH to locate it")
endif()
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (DCMTK
REQUIRED_VARS DCMTK_INCLUDE_DIR DCMTK_LIBRARIES
VERSION_VAR DCMTK_VERSION
)
if (DCMTK_FOUND)
set(DCMTK_INCLUDES "${DCMTK_INCLUDE_DIR}")
endif()
mark_as_advanced (
DCMTK_INCLUDE_DIR
DCMTK_LIBRARIES
+33 -37
View File
@@ -1,25 +1,29 @@
# - Try to find ffmpeg libraries (libavcodec, libavformat and libavutil)
# Once done this will define
#
# FFMPEG_FOUND - system has ffmpeg or libav
# FFmpeg_FOUND - system has ffmpeg or libav
# FFMPEG_INCLUDE_DIR - the ffmpeg include directory
# FFMPEG_LIBRARIES - Link these to use ffmpeg
# FFMPEG_LIBAVCODEC
# FFMPEG_LIBAVFORMAT
# FFMPEG_LIBAVUTIL
#
# Copyright (c) 2008 Andreas Schneider <mail@cynapses.org>
# Modified for other libraries by Lasse Kärkkäinen <tronic>
# Modified for Hedgewars by Stepik777
#
# Redistribution and use is allowed according to the terms of the New
# BSD license.
# Original:
# Copyright (c) 2008 Andreas Schneider <mail@cynapses.org>
# Modified for other libraries by Lasse Kärkkäinen <tronic>
# Modified for Hedgewars by Stepik777
# Redistribution and use is allowed according to the terms of the New
# BSD license.
#
# Modifications:
# Copyright 2008-present Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
if (FFMPEG_INCLUDES AND FFMPEG_LIBRARIES)
set (FFmpeg_FOUND TRUE)
else ()
if (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR)
# in cache already
set(FFMPEG_FOUND TRUE)
else (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR)
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
find_package(PkgConfig)
@@ -32,54 +36,46 @@ else (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR)
find_path(FFMPEG_AVCODEC_INCLUDE_DIR
NAMES libavcodec/version.h
PATHS ${_FFMPEG_AVCODEC_INCLUDE_DIRS} /usr/include /usr/local/include /opt/local/include /sw/include
HINTS ${_FFMPEG_AVCODEC_INCLUDE_DIRS}
PATH_SUFFIXES ffmpeg libav
)
find_library(FFMPEG_LIBAVCODEC
NAMES avcodec
PATHS ${_FFMPEG_AVCODEC_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib
)
HINTS ${_FFMPEG_AVCODEC_LIBRARY_DIRS} )
find_library(FFMPEG_LIBAVFORMAT
NAMES avformat
PATHS ${_FFMPEG_AVFORMAT_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib
)
HINTS ${_FFMPEG_AVFORMAT_LIBRARY_DIRS} )
find_library(FFMPEG_LIBAVUTIL
NAMES avutil
PATHS ${_FFMPEG_AVUTIL_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib
)
HINTS ${_FFMPEG_AVUTIL_LIBRARY_DIRS} )
find_library(FFMPEG_LIBSWSCALE
NAMES swscale
PATHS ${_FFMPEG_SWSCALE_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib
)
HINTS ${_FFMPEG_SWSCALE_LIBRARY_DIRS} )
if (FFMPEG_LIBAVCODEC AND FFMPEG_LIBAVFORMAT AND FFMPEG_AVCODEC_INCLUDE_DIR)
set(FFMPEG_FOUND TRUE)
endif()
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (FFmpeg
REQUIRED_VARS FFMPEG_LIBAVCODEC
FFMPEG_LIBAVFORMAT
FFMPEG_AVCODEC_INCLUDE_DIR
)
if (FFMPEG_FOUND)
if (FFmpeg_FOUND)
set(FFMPEG_INCLUDE_DIR ${FFMPEG_AVCODEC_INCLUDE_DIR})
set(FFMPEG_INCLUDES ${FFMPEG_AVCODEC_INCLUDE_DIR})
set(FFMPEG_LIBRARIES
${FFMPEG_LIBAVCODEC}
${FFMPEG_LIBAVFORMAT}
${FFMPEG_LIBAVUTIL}
${FFMPEG_LIBSWSCALE}
)
endif ()
endif (FFMPEG_FOUND)
endif ()
if (FFMPEG_FOUND)
if (NOT FFmpeg_FIND_QUIETLY)
message(STATUS "Found FFMPEG or Libav: ${FFMPEG_LIBRARIES}, ${FFMPEG_INCLUDE_DIR}")
endif (NOT FFmpeg_FIND_QUIETLY)
else (FFMPEG_FOUND)
if (FFMPEG_FIND_REQUIRED)
message(FATAL_ERROR "Could not find libavcodec or libavformat or libavutil or libswscale")
endif (FFMPEG_FIND_REQUIRED)
endif (FFMPEG_FOUND)
endif (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR)
mark_as_advanced (
FFMPEG_INCLUDES FFMPEG_LIBRARIES
)
+47
View File
@@ -0,0 +1,47 @@
# Module to find Field3D
#
# This module will first look into the directories defined by the variables:
# - Field3D_ROOT, FIELD3D_INCLUDE_PATH, FIELD3D_LIBRARY_PATH
#
# This module defines the following variables:
#
# Field3D_FOUND True if Field3D was found.
# FIELD3D_INCLUDES Where to find Field3D headers
# FIELD3D_LIBRARIES List of libraries to link against when using Field3D
# FIELD3D_VERSION Version of Field3D (e.g., 3.6.2)
include (FindPackageHandleStandardArgs)
find_path (FIELD3D_INCLUDE_DIR Field3D/Field.h
HINTS
${FIELD3D_INCLUDE_PATH}
ENV FIELD3D_INCLUDE_PATH
DOC "The directory where Field3D headers reside")
find_library (FIELD3D_LIBRARY Field3D
HINTS
${FIELD3D_LIBRARY_PATH}
ENV FIELD3D_LIBRARY_PATH
DOC "The Field3D libraries")
find_package_handle_standard_args (Field3D
REQUIRED_VARS FIELD3D_INCLUDE_DIR FIELD3D_LIBRARY
)
if (Field3D_FOUND)
set (FIELD3D_INCLUDES ${FIELD3D_INCLUDE_DIR})
set (FIELD3D_LIBRARIES ${FIELD3D_LIBRARY})
if (NOT TARGET Field3D::Field3D)
add_library(Field3D::Field3D UNKNOWN IMPORTED)
set_target_properties(Field3D::Field3D PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${FIELD3D_INCLUDES}")
set_property(TARGET Field3D::Field3D APPEND PROPERTY
IMPORTED_LOCATION "${FIELD3D_LIBRARIES}")
endif ()
endif ()
mark_as_advanced (
FIELD3D_INCLUDE_DIR
FIELD3D_LIBRARY
)
+22 -19
View File
@@ -9,32 +9,35 @@
include (FindPackageHandleStandardArgs)
find_path(JPEG_INCLUDE_DIR turbojpeg.h
PATHS ${JPEGTURBO_PATH}/include
/usr/local/opt/jpeg-turbo/include)
HINTS /usr/local/opt/jpeg-turbo/include
PATH_SUFFIXES include)
set(JPEG_NAMES ${JPEG_NAMES} jpeg libjpeg turbojpeg libturbojpeg)
find_library(JPEG_LIBRARY NAMES ${JPEG_NAMES}
PATHS ${JPEG_INCLUDE_DIR}/../lib
${JPEGTURBO_PATH}/lib64
${JPEGTURBO_PATH}/lib
/usr/local/opt/jpeg-turbo/lib
/opt/libjpeg-turbo/lib64
/opt/libjpeg-turbo/lib
NO_DEFAULT_PATH)
find_library(JPEG_LIBRARY NAMES ${JPEG_NAMES}
HINTS ${JPEG_INCLUDE_DIR}/..
/usr/local/opt/jpeg-turbo
/opt/libjpeg-turbo
PATH_SUFFIXES lib lib64
NO_DEFAULT_PATH)
if (NOT JPEG_LIBRARY)
find_library(JPEG_LIBRARY NAMES ${JPEG_NAMES}
PATHS ${JPEG_INCLUDE_DIR}/../lib
${JPEGTURBO_PATH}/lib
/usr/local/opt/jpeg-turbo/lib)
find_library(JPEG_LIBRARY NAMES ${JPEG_NAMES}
HINTS ${JPEG_INCLUDE_DIR}/..
/usr/local/opt/jpeg-turbo
PATH_SUFFIXES lib lib64)
endif ()
if (JPEG_INCLUDE_DIR AND JPEG_LIBRARY)
set (JPEG_INCLUDE_DIRS ${JPEG_INCLUDE_DIR} CACHE PATH "JPEG include dirs")
set (JPEG_LIBRARIES ${JPEG_LIBRARY} CACHE STRING "JPEG libraries")
endif ()
# handle the QUIETLY and REQUIRED arguments and set JPEG_FOUND to TRUE if
# all listed variables are TRUE
FIND_PACKAGE_HANDLE_STANDARD_ARGS(JPEG DEFAULT_MSG JPEG_LIBRARY JPEG_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(JPEG DEFAULT_MSG JPEG_LIBRARIES JPEG_INCLUDE_DIRS)
if(JPEG_FOUND)
set(JPEG_LIBRARIES ${JPEG_LIBRARY})
endif()
if (JPEG_FOUND)
set (JPEGTURBO_FOUND true)
endif ()
mark_as_advanced(JPEG_LIBRARY JPEG_INCLUDE_DIR )
mark_as_advanced(JPEG_LIBRARIES JPEG_INCLUDE_DIRS )
+25 -22
View File
@@ -14,46 +14,42 @@
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
FIND_PACKAGE(PkgConfig)
find_package(PkgConfig)
IF(PKG_CONFIG_FOUND AND NOT LIBRAW_PATH)
if(PKG_CONFIG_FOUND AND NOT LibRaw_ROOT AND NOT $ENV{LibRaw_ROOT})
PKG_CHECK_MODULES(PC_LIBRAW QUIET libraw)
SET(LibRaw_DEFINITIONS ${PC_LIBRAW_CFLAGS_OTHER})
PKG_CHECK_MODULES(PC_LIBRAW_R QUIET libraw_r)
SET(LibRaw_r_DEFINITIONS ${PC_LIBRAW_R_CFLAGS_OTHER})
ENDIF()
SET(LibRaw_r_DEFINITIONS ${PC_LIBRAW_R_CFLAGS_OTHER})
endif()
FIND_PATH(LibRaw_INCLUDE_DIR libraw/libraw.h
find_path(LibRaw_INCLUDE_DIR libraw/libraw.h
HINTS
${LIBRAW_INCLUDEDIR_HINT}
${LIBRAW_PATH}
${PC_LIBRAW_INCLUDEDIR}
${PC_LibRaw_INCLUDE_DIRS}
PATH_SUFFIXES libraw
)
FIND_LIBRARY(LibRaw_LIBRARIES NAMES raw libraw
find_library(LibRaw_LIBRARIES NAMES raw libraw
HINTS
${LIBRAW_LIBDIR_HINT}
${LIBRAW_PATH}
${PC_LIBRAW_LIBDIR}
${PC_LIBRAW_LIBRARY_DIRS}
)
FIND_LIBRARY(LibRaw_r_LIBRARIES NAMES raw_r
find_library(LibRaw_r_LIBRARIES NAMES raw_r
HINTS
${LIBRAW_LIBDIR_HINT}
${LIBRAW_PATH}
${PC_LIBRAW_R_LIBDIR}
${PC_LIBRAW_R_LIBRARY_DIRS}
)
IF(WIN32)
if(WIN32)
SET( LibRaw_r_LIBRARIES ${LibRaw_LIBRARIES} )
ENDIF()
endif()
IF(LibRaw_INCLUDE_DIR)
if(LibRaw_INCLUDE_DIR)
FILE(READ ${LibRaw_INCLUDE_DIR}/libraw/libraw_version.h _libraw_version_content)
STRING(REGEX MATCH "#define LIBRAW_MAJOR_VERSION[ \t]*([0-9]*)\n" _version_major_match ${_libraw_version_content})
@@ -65,18 +61,18 @@ IF(LibRaw_INCLUDE_DIR)
STRING(REGEX MATCH "#define LIBRAW_PATCH_VERSION[ \t]*([0-9]*)\n" _version_patch_match ${_libraw_version_content})
SET(_libraw_version_patch "${CMAKE_MATCH_1}")
IF(_version_major_match AND _version_minor_match AND _version_patch_match)
if(_version_major_match AND _version_minor_match AND _version_patch_match)
SET(LibRaw_VERSION_STRING "${_libraw_version_major}.${_libraw_version_minor}.${_libraw_version_patch}")
ELSE()
IF(NOT LibRaw_FIND_QUIETLY)
else()
if(NOT LibRaw_FIND_QUIETLY)
MESSAGE(STATUS "Failed to get version information from ${LibRaw_INCLUDE_DIR}/libraw/libraw_version.h")
ENDIF()
ENDIF()
ENDIF()
endif()
endif()
endif()
INCLUDE(FindPackageHandleStandardArgs)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibRaw
REQUIRED_VARS LibRaw_LIBRARIES LibRaw_INCLUDE_DIR
REQUIRED_VARS LibRaw_LIBRARIES LibRaw_r_LIBRARIES LibRaw_INCLUDE_DIR
VERSION_VAR LibRaw_VERSION_STRING
)
@@ -87,3 +83,10 @@ MARK_AS_ADVANCED(LibRaw_VERSION_STRING
LibRaw_DEFINITIONS
LibRaw_r_DEFINITIONS
)
if (LINKSTATIC)
# Necessary?
find_package (Jasper)
find_library (LCMS2_LIBRARIES NAMES lcms2)
set (LibRaw_r_LIBRARIES ${LibRaw_r_LIBRARIES} ${JASPER_LIBRARIES} ${LCMS2_LIBRARIES})
endif ()
+25 -25
View File
@@ -1,56 +1,56 @@
# Module to find LIBHEIF
#
# This module will first look into the directories defined by the variables:
# - LIBHEIF_PATH, LIBHEIF_INCLUDE_PATH, LIBHEIF_LIBRARY_PATH
# - Libheif_ROOT, LIBHEIF_INCLUDE_PATH, LIBHEIF_LIBRARY_PATH
#
# This module defines the following variables:
#
# LIBHEIF_FOUND True if LIBHEIF was found.
# Libheif_FOUND True if LIBHEIF was found.
# LIBHEIF_INCLUDES Where to find LIBHEIF headers
# LIBHEIF_LIBRARIES List of libraries to link against when using LIBHEIF
# LIBHEIF_VERSION Version of LIBHEIF (e.g., 3.6.2)
include (FindPackageHandleStandardArgs)
include (FindPackageMessage)
find_path (LIBHEIF_INCLUDE_DIR
libheif/heif_version.h
PATHS
${LIBHEIF_INCLUDE_PATH}
${LIBHEIF_PATH}/include/
HINTS
${LIBHEIF_INCLUDE_PATH}
ENV LIBHEIF_INCLUDE_PATH
DOC "The directory where libheif headers reside")
find_library (LIBHEIF_LIBRARY heif
PATHS ${LIBHEIF_PATH}/lib ${LIBHEIF_LIBRARY_PATH})
HINTS
${LIBHEIF_LIBRARY_PATH}
ENV LIBHEIF_LIBRARY_PATH
DOC "The directory where libheif libraries reside")
message (STATUS "LIBHEIF_INCLUDE_DIR = ${LIBHEIF_INCLUDE_DIR}")
if (LIBHEIF_INCLUDE_DIR)
file(STRINGS "${LIBHEIF_INCLUDE_DIR}/libheif/heif_version.h" TMP REGEX "^#define LIBHEIF_VERSION[ \t].*$")
string(REGEX MATCHALL "[0-9.]+" LIBHEIF_VERSION ${TMP})
endif ()
if (LIBHEIF_INCLUDE_DIR AND LIBHEIF_LIBRARY)
set(LIBHEIF_FOUND TRUE)
set(LIBHEIF_INCLUDES "${LIBHEIF_INCLUDE_DIR}")
set(LIBHEIF_LIBRARIES "${LIBHEIF_LIBRARY}")
if (NOT LIBHEIF_FIND_QUIETLY)
message(STATUS "Found libheif ${LIBHEIF_VERSION} library ${LIBHEIF_LIBRARIES}")
message(STATUS "Found libheif includes ${LIBHEIF_INCLUDES}")
endif ()
else()
set(LIBHEIF_FOUND FALSE)
message(STATUS "libheif not found. Specify LIBHEIF_PATH to locate it")
endif()
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (LIBHEIF
find_package_handle_standard_args (Libheif
REQUIRED_VARS LIBHEIF_INCLUDE_DIR
LIBHEIF_LIBRARIES
VERSION_VAR LIBHEIF_VERSION
LIBHEIF_LIBRARY
)
if (Libheif_FOUND)
set(LIBHEIF_INCLUDES "${LIBHEIF_INCLUDE_DIR}")
set(LIBHEIF_LIBRARIES "${LIBHEIF_LIBRARY}")
if (NOT TARGET Libheif::Libheif)
add_library(Libheif::Libheif UNKNOWN IMPORTED)
set_target_properties(Libheif::Libheif PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${LIBHEIF_INCLUDES}")
set_property(TARGET Libheif::Libheif APPEND PROPERTY
IMPORTED_LOCATION "${LIBHEIF_LIBRARIES}")
endif ()
endif()
mark_as_advanced (
LIBHEIF_INCLUDE_DIR
LIBHEIF_INCLUDES
LIBHEIF_LIBRARIES
LIBHEIF_VERSION
)
+50
View File
@@ -0,0 +1,50 @@
# Module to find Libsquish
#
# This module will first look into the directories defined by the variables:
# - Libsquish_ROOT, LIBSQUISH_INCLUDE_PATH, LIBSQUISH_LIBRARY_PATH
#
# This module defines the following variables:
#
# Libsquish_FOUND True if Libsquish was found.
# LIBSQUISH_INCLUDES Where to find Libsquish headers
# LIBSQUISH_LIBRARIES List of libraries to link against when using Libsquish
# LIBSQUISH_VERSION Version of Libsquish (e.g., 3.6.2)
include (FindPackageHandleStandardArgs)
find_path (LIBSQUISH_INCLUDE_DIR squish.h
HINTS
${LIBSQUISH_INCLUDE_PATH}
ENV LIBSQUISH_INCLUDE_PATH
DOC "The directory where Libsquish headers reside")
find_library (LIBSQUISH_LIBRARY squish
HINTS
${LIBSQUISH_LIBRARY_PATH}
ENV LIBSQUISH_LIBRARY_PATH
DOC "The Libsquish libraries")
find_package_handle_standard_args (Libsquish
REQUIRED_VARS
LIBSQUISH_INCLUDE_DIR
LIBSQUISH_LIBRARY
)
if (Libsquish_FOUND)
set (LIBSQUISH_INCLUDES ${LIBSQUISH_INCLUDE_DIR})
set (LIBSQUISH_LIBRARIES ${LIBSQUISH_LIBRARY})
if (NOT TARGET Libsquish::Libsquish)
add_library(Libsquish::Libsquish UNKNOWN IMPORTED)
set_target_properties(Libsquish::Libsquish PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${LIBSQUISH_INCLUDES}")
set_property(TARGET Libsquish::Libsquish APPEND PROPERTY
IMPORTED_LOCATION "${LIBSQUISH_LIBRARIES}")
endif ()
endif ()
mark_as_advanced (
LIBSQUISH_INCLUDE_DIR
LIBSQUISH_LIBRARY
)
+10 -5
View File
@@ -12,9 +12,9 @@
# Output variables:
# NUKE_FOUND
# NUKE_EXECUTABLE
# NUKE_INCLUDE_DIRS
# NUKE_LIBRARY_DIRS
# NUKE_INCLUDES
# NUKE_LIBRARIES
# NUKE_LIBRARY_DIRS
# NUKE_DDIMAGE_LIBRARY
# NUKE_VERSION_MAJOR
# NUKE_VERSION_MINOR
@@ -130,12 +130,12 @@ find_library(NUKE_DDIMAGE_LIBRARY DDImage
if(NUKE_DDIMAGE_LIBRARY)
get_filename_component(NUKE_LIBRARY_DIRS ${NUKE_DDIMAGE_LIBRARY} PATH)
find_path(NUKE_INCLUDE_DIRS DDImage/Op.h "${NUKE_LIBRARY_DIRS}/include")
find_path(NUKE_INCLUDE_DIR DDImage/Op.h "${NUKE_LIBRARY_DIRS}/include")
# Pull version information from header
# (We could pull the DDImage path apart instead, but this avoids dealing
# with platform-specific naming.)
file(STRINGS "${NUKE_INCLUDE_DIRS}/DDImage/ddImageVersionNumbers.h" _nuke_DDIMAGE_VERSION_H)
file(STRINGS "${NUKE_INCLUDE_DIR}/DDImage/ddImageVersionNumbers.h" _nuke_DDIMAGE_VERSION_H)
string(REGEX REPLACE ".*#define kDDImageVersionMajorNum ([0-9]+).*" "\\1"
NUKE_VERSION_MAJOR ${_nuke_DDIMAGE_VERSION_H})
string(REGEX REPLACE ".*#define kDDImageVersionMinorNum ([0-9]+).*" "\\1"
@@ -156,4 +156,9 @@ endif()
# Finalize search
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Nuke DEFAULT_MSG
NUKE_DDIMAGE_LIBRARY NUKE_INCLUDE_DIRS NUKE_LIBRARY_DIRS NUKE_EXECUTABLE)
NUKE_DDIMAGE_LIBRARY NUKE_INCLUDE_DIR NUKE_LIBRARY_DIRS NUKE_EXECUTABLE)
if (NUKE_FOUND)
set (NUKE_INCLUDES ${NUKE_INCLUDE_DIR})
set (NUKE_LIBRARIES ${NUKE_DDIMAGE_LIBRARY})
endif ()
+14 -37
View File
@@ -2,31 +2,19 @@
# Find the OpenCV library
# This module defines
# OpenCV_VERSION, the version string of OpenCV
# OpenCV_INCLUDE_DIR, where to find header files
# OpenCV_INCLUDES, where to find header files
# OpenCV_LIBRARIES, the libraries needed to use OpenCV
# OpenCV_DEFINITIONS, the definitions needed to use OpenCV
FIND_PACKAGE(PkgConfig)
IF(PKG_CONFIG_FOUND AND NOT LIBRAW_PATH)
PKG_CHECK_MODULES(PC_LIBRAW QUIET libraw)
SET(LibRaw_DEFINITIONS ${PC_LIBRAW_CFLAGS_OTHER})
PKG_CHECK_MODULES(PC_LIBRAW_R QUIET libraw_r)
SET(LibRaw_r_DEFINITIONS ${PC_LIBRAW_R_CFLAGS_OTHER})
ENDIF()
#
# You can provide a location hint with OpenCV_ROOT (either a defined CMake
# variable or an environment variable).
find_path (OpenCV_INCLUDE_DIR
NAMES opencv4/opencv2/opencv.hpp opencv2/opencv.hpp
PATHS
"${PROJECT_SOURCE_DIR}/include"
"${OpenCV_DIR}/include"
"${OpenCV_DIR}/include/opencv4"
"$ENV{OpenCV_DIR}/include"
/usr/local/include
/opt/local/include
/usr/local/opt/opencv4/include
/usr/local/opt/opencv3/include
/opt/local/include
/usr/local/opt/opencv4
/usr/local/opt/opencv3
PATH_SUFFIXES opencv4
)
@@ -51,12 +39,9 @@ if (EXISTS "${_ocv_version_file}")
else ()
set (OpenCV_VERSION "${CV_VERSION_MAJOR}.${CV_VERSION_MINOR}.${CV_VERSION_REVISION}")
endif ()
message (STATUS "Found OpenCV ${OpenCV_VERSION} include in ${OpenCV_INCLUDE_DIR}")
endif ()
set (libdirs "${PROJECT_SOURCE_DIR}/lib"
"${OpenCV_DIR}/lib"
"$ENV{OpenCV_DIR}/lib"
"${_ocv_include_root}/../lib"
/usr/local/lib
/opt/local/lib
@@ -74,30 +59,22 @@ endif ()
foreach (component ${opencv_components})
find_library (${component}_lib
NAMES ${component}
PATHS ${libdirs}
NO_DEFAULT_PATH)
# If that didn't work, try again with default paths
find_library (${component}_lib
NAMES ${component}
PATHS ${libdirs})
HINTS ${libdirs})
if (${component}_lib)
set (OpenCV_LIBS ${OpenCV_LIBS} ${${component}_lib})
endif ()
endforeach ()
if (OpenCV_INCLUDE_DIR AND OpenCV_LIBS)
set (OpenCV_FOUND TRUE)
message (STATUS "Found OpenCV libs: ${OpenCV_LIBS}")
endif ()
include (FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS (OpenCV
REQUIRED_VARS OpenCV_LIBS OpenCV_INCLUDE_DIR OpenCV_VERSION
VERSION_VAR OpenCV_VERSION )
MARK_AS_ADVANCED (OpenCV_VERSION
OpenCV_INCLUDE_DIR
OpenCV_LIBS
OpenCV_DEFINITIONS )
if (OPENCV_FOUND)
set (OpenCV_INCLUDES ${OpenCV_INCLUDE_DIR})
set (OpenCV_LIBRARIES ${OpenCV_LIBS})
endif ()
MARK_AS_ADVANCED (OpenCV_INCLUDE_DIR OpenCV_LIBS)
unset (_ocv_version_file)
unset (_ocv_include_root)
+67 -43
View File
@@ -1,60 +1,84 @@
# Module to find OpenColorIO
#
# This module will first look into the directories defined by the variables:
# - OCIO_PATH, OCIO_INCLUDE_PATH, OCIO_LIBRARY_PATH
# This module will first look into the directories hinted by the variables:
# - OpenColorIO_ROOT, OPENCOLORIO_INCLUDE_PATH, OPENCOLORIO_LIBRARY_PATH
#
# This module defines the following variables:
#
# OCIO_FOUND - True if OpenColorIO was found.
# OCIO_INCLUDES - where to find OpenColorIO.h
# OCIO_LIBRARIES - list of libraries to link against when using OpenColorIO
# OPENCOLORIO_FOUND - True if OpenColorIO was found.
# OPENCOLORIO_INCLUDES - where to find OpenColorIO.h
# OPENCOLORIO_LIBRARIES - list of libraries to link against when using OpenColorIO
# OPENCOLORIO_DEFINITIONS - Definitions needed when using OpenColorIO
# Other standarnd issue macros
include (FindPackageHandleStandardArgs)
include (FindPackageMessage)
if (NOT OpenColorIO_FIND_QUIETLY)
if (OCIO_PATH)
message(STATUS "OCIO path explicitly specified: ${OCIO_PATH}")
endif()
if (OCIO_INCLUDE_PATH)
message(STATUS "OCIO INCLUDE_PATH explicitly specified: ${OCIO_INCLUDE_PATH}")
endif()
if (OCIO_LIBRARY_PATH)
message(STATUS "OCIO LIBRARY_PATH explicitly specified: ${OCIO_LIBRARY_PATH}")
endif()
endif ()
FIND_PATH(OCIO_INCLUDES
OpenColorIO/OpenColorIO.h
PATHS
${OCIO_INCLUDE_PATH}
${OCIO_PATH}/include/
/usr/include
/usr/local/include
find_path (OPENCOLORIO_INCLUDE_DIR
OpenColorIO/OpenColorIO.h
HINTS
${OPENCOLORIO_INCLUDE_PATH}
ENV OPENCOLORIO_INCLUDE_PATH
PATHS
/sw/include
/opt/local/include
DOC "The directory where OpenColorIO/OpenColorIO.h resides")
FIND_LIBRARY(OCIO_LIBRARIES
NAMES OCIO OpenColorIO
PATHS
${OCIO_LIBRARY_PATH}
${OCIO_PATH}/lib/
DOC "The directory where OpenColorIO/OpenColorIO.h resides")
find_library (OPENCOLORIO_LIBRARY
NAMES OCIO OpenColorIO
HINTS
${OPENCOLORIO_LIBRARY_PATH}
ENV OPENCOLORIO_LIBRARY_PATH
PATHS
/usr/lib64
/usr/lib
/usr/local/lib64
/usr/local/lib
/sw/lib
/opt/local/lib
DOC "The OCIO library")
DOC "The OCIO library")
if(OCIO_INCLUDES AND OCIO_LIBRARIES)
set(OCIO_FOUND TRUE)
if (NOT OpenColorIO_FIND_QUIETLY)
message(STATUS "Found OCIO library ${OCIO_LIBRARIES}")
message(STATUS "Found OCIO includes ${OCIO_INCLUDES}")
endif ()
else()
set(OCIO_FOUND FALSE)
message(STATUS "OCIO not found. Specify OCIO_PATH to locate it")
endif()
if (EXISTS "${OPENCOLORIO_INCLUDE_DIR}/OpenColorIO/OpenColorABI.h")
file(STRINGS "${OPENCOLORIO_INCLUDE_DIR}/OpenColorIO/OpenColorABI.h" TMP
REGEX "^#define OCIO_VERSION[ \t].*$")
string (REGEX MATCHALL "[0-9]+[.0-9]+" OPENCOLORIO_VERSION ${TMP})
endif ()
find_package_handle_standard_args (OpenColorIO
REQUIRED_VARS OPENCOLORIO_INCLUDE_DIR OPENCOLORIO_LIBRARY
FOUND_VAR OPENCOLORIO_FOUND
VERSION_VAR OPENCOLORIO_VERSION
)
if (OPENCOLORIO_FOUND)
set (OPENCOLORIO_INCLUDES ${OPENCOLORIO_INCLUDE_DIR})
set (OPENCOLORIO_LIBRARIES ${OPENCOLORIO_LIBRARY})
set (OPENCOLORIO_DEFINITIONS "")
if (NOT TARGET OpenColorIO::OpenColorIO)
add_library(OpenColorIO::OpenColorIO UNKNOWN IMPORTED)
set_target_properties(OpenColorIO::OpenColorIO PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${OPENCOLORIO_INCLUDES}")
set_property(TARGET OpenColorIO::OpenColorIO APPEND PROPERTY
IMPORTED_LOCATION "${OPENCOLORIO_LIBRARIES}")
if (LINKSTATIC)
set_target_properties(OpenColorIO::OpenColorIO PROPERTIES
INTERFACE_COMPILE_DEFINITIONS "-DOpenColorIO_STATIC")
endif()
endif ()
endif ()
if (OpenColorIO_FOUND AND LINKSTATIC)
# Is this necessary?
set (OPENCOLORIO_DEFINITIONS "-DOpenColorIO_STATIC")
find_library (TINYXML_LIBRARY NAMES tinyxml)
if (TINYXML_LIBRARY)
set (OPENCOLORIO_LIBRARIES "${OPENCOLORIO_LIBRARIES};${TINYXML_LIBRARY}" CACHE STRING "" FORCE)
endif ()
find_library (YAML_LIBRARY NAMES yaml-cpp)
if (YAML_LIBRARY)
set (OPENCOLORIO_LIBRARIES "${OPENCOLORIO_LIBRARIES};${YAML_LIBRARY}" CACHE STRING "" FORCE)
endif ()
find_library (LCMS2_LIBRARY NAMES lcms2)
if (LCMS2_LIBRARY)
set (OPENCOLORIO_LIBRARIES "${OPENCOLORIO_LIBRARIES};${LCMS2_LIBRARY}" CACHE STRING "" FORCE)
endif ()
endif ()
+37 -53
View File
@@ -2,7 +2,7 @@
#
# This module will set
# OPENEXR_FOUND true, if found
# OPENEXR_INCLUDE_DIR directory where headers are found
# OPENEXR_INCLUDES directory where headers are found
# OPENEXR_LIBRARIES libraries for OpenEXR + IlmBase
# ILMBASE_LIBRARIES libraries just IlmBase
# OPENEXR_VERSION OpenEXR version (accurate for >= 2.0.0,
@@ -25,23 +25,25 @@ endif ()
# Attempt to find OpenEXR with pkgconfig
find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
if (NOT ILMBASE_ROOT_DIR)
if (NOT Ilmbase_ROOT AND NOT ILMBASE_ROOT
AND NOT DEFINED ENV{Ilmbase_ROOT} AND NOT DEFINED ENV{ILMBASE_ROOT})
pkg_check_modules(_ILMBASE QUIET IlmBase>=2.0.0)
endif ()
if (NOT OPENEXR_ROOT_DIR)
if (NOT OpenEXR_ROOT AND NOT OPENEXR_ROOT
AND NOT DEFINED ENV{OpenEXR_ROOT} AND NOT DEFINED ENV{OPENEXR_ROOT})
pkg_check_modules(_OPENEXR QUIET OpenEXR>=2.0.0)
endif ()
endif (PKG_CONFIG_FOUND)
# List of likely places to find the headers -- note priority override of
# ${OPENEXR_ROOT_DIR}/include.
# ${OPENEXR_ROOT}/include.
# ILMBASE is needed in case ilmbase an openexr are installed in separate
# directories, like NixOS does
set (GENERIC_INCLUDE_PATHS
${OPENEXR_ROOT_DIR}/include
$ENV{OPENEXR_ROOT_DIR}/include
${ILMBASE_ROOT_DIR}/include
$ENV{ILMBASE_ROOT_DIR}/include
${OPENEXR_ROOT}/include
$ENV{OPENEXR_ROOT}/include
${ILMBASE_ROOT}/include
$ENV{ILMBASE_ROOT}/include
${_ILMBASE_INCLUDEDIR}
${_OPENEXR_INCLUDEDIR}
/usr/local/include
@@ -50,18 +52,13 @@ set (GENERIC_INCLUDE_PATHS
/sw/include
/opt/local/include )
# Find the include file locations. We call find_path twice -- first using
# only the custom paths, then if that fails, try the default paths only.
# This seems to be the most robust way I can find to not get confused when
# both system and custom libraries are present.
# Find the include file locations.
find_path (ILMBASE_INCLUDE_PATH OpenEXR/IlmBaseConfig.h
PATHS ${ILMBASE_INCLUDE_DIR} ${OPENEXR_INCLUDE_DIR}
${GENERIC_INCLUDE_PATHS} NO_DEFAULT_PATH)
find_path (ILMBASE_INCLUDE_PATH OpenEXR/IlmBaseConfig.h)
HINTS ${ILMBASE_INCLUDE_DIR} ${OPENEXR_INCLUDE_DIR}
${GENERIC_INCLUDE_PATHS} )
find_path (OPENEXR_INCLUDE_PATH OpenEXR/OpenEXRConfig.h
PATHS ${OPENEXR_INCLUDE_DIR}
${GENERIC_INCLUDE_PATHS} NO_DEFAULT_PATH)
find_path (OPENEXR_INCLUDE_PATH OpenEXR/OpenEXRConfig.h)
HINTS ${OPENEXR_INCLUDE_DIR}
${GENERIC_INCLUDE_PATHS} )
# Try to figure out version number
if (DEFINED _OPENEXR_VERSION AND NOT "${_OPENEXR_VERSION}" STREQUAL "")
@@ -85,10 +82,10 @@ endif ()
# List of likely places to find the libraries -- note priority override of
# ${OPENEXR_ROOT_DIR}/lib.
# ${OPENEXR_ROOT}/lib.
set (GENERIC_LIBRARY_PATHS
${OPENEXR_ROOT_DIR}/lib
${ILMBASE_ROOT_DIR}/lib
${OPENEXR_ROOT}/lib
${ILMBASE_ROOT}/lib
${OPENEXR_INCLUDE_PATH}/../lib
${ILMBASE_INCLUDE_PATH}/../lib
${_ILMBASE_LIBDIR}
@@ -114,41 +111,22 @@ if (OpenEXR_USE_STATIC_LIBS)
endif ()
endif ()
# Look for the libraries themselves, for all the components. Like with the
# headers, we do two finds -- first for custom locations, then for default.
# Look for the libraries themselves, for all the components.
# This is complicated because the OpenEXR libraries may or may not be
# built with version numbers embedded.
set (_openexr_components IlmThread IlmImf Imath Iex Half)
foreach (COMPONENT ${_openexr_components})
string (TOUPPER ${COMPONENT} UPPERCOMPONENT)
# First try with the version embedded
set (FULL_COMPONENT_NAME ${COMPONENT}-${OPENEXR_VERSION_MAJOR}_${OPENEXR_VERSION_MINOR})
find_library (OPENEXR_${UPPERCOMPONENT}_LIBRARY ${FULL_COMPONENT_NAME}
PATHS ${OPENEXR_LIBRARY_DIR} $ENV{OPENEXR_LIBRARY_DIR}
${GENERIC_LIBRARY_PATHS} NO_DEFAULT_PATH)
# Again, with no directory restrictions
find_library (OPENEXR_${UPPERCOMPONENT}_LIBRARY ${FULL_COMPONENT_NAME})
# Try again without the version
set (FULL_COMPONENT_NAME ${COMPONENT})
find_library (OPENEXR_${UPPERCOMPONENT}_LIBRARY ${FULL_COMPONENT_NAME}
PATHS ${OPENEXR_LIBRARY_DIR} $ENV{OPENEXR_LIBRARY_DIR}
${GENERIC_LIBRARY_PATHS} NO_DEFAULT_PATH)
# One more time, with no restrictions
find_library (OPENEXR_${UPPERCOMPONENT}_LIBRARY ${FULL_COMPONENT_NAME})
find_library (OPENEXR_${UPPERCOMPONENT}_LIBRARY
NAMES ${COMPONENT}-${OPENEXR_VERSION_MAJOR}_${OPENEXR_VERSION_MINOR}
${COMPONENT}
${COMPONENT}-${OPENEXR_VERSION_MAJOR}_${OPENEXR_VERSION_MINOR}_d
${COMPONENT}_d
HINTS ${OPENEXR_LIBRARY_DIR} $ENV{OPENEXR_LIBRARY_DIR}
${GENERIC_LIBRARY_PATHS} )
endforeach ()
# Set the FOUND, INCLUDE_DIR, and LIBRARIES variables.
if (ILMBASE_INCLUDE_PATH AND OPENEXR_INCLUDE_PATH AND
OPENEXR_IMATH_LIBRARY AND OPENEXR_ILMIMF_LIBRARY AND
OPENEXR_IEX_LIBRARY AND OPENEXR_HALF_LIBRARY)
set (OPENEXR_FOUND TRUE)
set (ILMBASE_FOUND TRUE)
set (ILMBASE_INCLUDE_DIR ${ILMBASE_INCLUDE_PATH} CACHE STRING "The include paths needed to use IlmBase")
set (OPENEXR_INCLUDE_DIR ${OPENEXR_INCLUDE_PATH} CACHE STRING "The include paths needed to use OpenEXR")
set (ILMBASE_LIBRARIES ${OPENEXR_IMATH_LIBRARY} ${OPENEXR_IEX_LIBRARY} ${OPENEXR_HALF_LIBRARY} ${OPENEXR_ILMTHREAD_LIBRARY} ${ILMBASE_PTHREADS} CACHE STRING "The libraries needed to use IlmBase")
set (OPENEXR_LIBRARIES ${OPENEXR_ILMIMF_LIBRARY} ${ILMBASE_LIBRARIES} ${ZLIB_LIBRARIES} CACHE STRING "The libraries needed to use OpenEXR")
endif ()
find_package_handle_standard_args (OpenEXR
REQUIRED_VARS ILMBASE_INCLUDE_PATH OPENEXR_INCLUDE_PATH
OPENEXR_IMATH_LIBRARY OPENEXR_ILMIMF_LIBRARY
@@ -156,11 +134,17 @@ find_package_handle_standard_args (OpenEXR
VERSION_VAR OPENEXR_VERSION
)
MARK_AS_ADVANCED(
ILMBASE_INCLUDE_DIR
OPENEXR_INCLUDE_DIR
ILMBASE_LIBRARIES
OPENEXR_LIBRARIES
if (OPENEXR_FOUND)
set (ILMBASE_FOUND TRUE)
set (ILMBASE_INCLUDES ${ILMBASE_INCLUDE_PATH})
set (OPENEXR_INCLUDES ${OPENEXR_INCLUDE_PATH})
set (ILMBASE_INCLUDE_DIR ${ILMBASE_INCLUDE_PATH})
set (OPENEXR_INCLUDE_DIR ${OPENEXR_INCLUDE_PATH})
set (ILMBASE_LIBRARIES ${OPENEXR_IMATH_LIBRARY} ${OPENEXR_IEX_LIBRARY} ${OPENEXR_HALF_LIBRARY} ${OPENEXR_ILMTHREAD_LIBRARY} ${ILMBASE_PTHREADS} CACHE STRING "The libraries needed to use IlmBase")
set (OPENEXR_LIBRARIES ${OPENEXR_ILMIMF_LIBRARY} ${ILMBASE_LIBRARIES} ${ZLIB_LIBRARIES} CACHE STRING "The libraries needed to use OpenEXR")
endif ()
mark_as_advanced(
OPENEXR_ILMIMF_LIBRARY
OPENEXR_IMATH_LIBRARY
OPENEXR_IEX_LIBRARY
+69 -37
View File
@@ -1,8 +1,9 @@
###########################################################################
# OpenImageIO https://www.openimageio.org
# Copyright 2008-2018 Larry Gritz et al. All rights reserved.
# BSD 3-clause license:
# https://github.com/OpenImageIO/oiio/blob/master/LICENSE
# Copyright 2008-present Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
#
# For an up-to-date version of this file, see:
# https://github.com/OpenImageIO/oiio/blob/master/src/cmake/Modules/FindOpenImageIO.cmake
#
@@ -11,23 +12,41 @@
# CMake module to find OpenImageIO
#
# This module will set
# OPENIMAGEIO_FOUND True, if found
# OPENIMAGEIO_INCLUDE_DIR directory where headers are found
# OpenImageIO_FOUND True, if found
# OPENIMAGEIO_INCLUDES directory where headers are found
# OPENIMAGEIO_LIBRARIES libraries for OIIO
# OPENIMAGEIO_LIBRARY_DIRS library dirs for OIIO
# OPENIMAGEIO_VERSION Version ("major.minor.patch")
# OPENIMAGEIO_VERSION Version ("major.minor.patch.tweak")
# OPENIMAGEIO_VERSION_MAJOR Version major number
# OPENIMAGEIO_VERSION_MINOR Version minor number
# OPENIMAGEIO_VERSION_PATCH Version minor patch
# OPENIMAGEIO_VERSION_TWEAK Version minor tweak
# OIIOTOOL_BIN Path to oiiotool executable
#
# Imported targets:
# OpenImageIO::OpenImageIO The libOpenImageIO library.
# OpenImageIO::oiiotool The oiiotool executable.
#
# Special inputs:
# OpenImageIO_ROOT - if using CMake >= 3.12, will automatically search
# this area for OIIO components.
# OPENIMAGEIO_ROOT_DIR - custom "prefix" location of OIIO installation
# (expecting bin, lib, include subdirectories)
# This is deprecated, but will work for a while.
# OpenImageIO_FIND_QUIETLY - if set, print minimal console output
# OIIO_LIBNAME_SUFFIX - if set, optional nonstandard library suffix
#
###########################################################################
#
# NOTE: This file is deprecated.
#
# In OIIO 2.1+, we generate OpenImageIOConfig.cmake files that are now the
# preferred way for downstream projecs to find an installed OIIO. There
# should be no need to copy this FindOpenImageIO.cmake file into downstream
# projects, *unless* they need to work with a range of OIIO vesions that
# may include <2.1, which would lack the generated config files.
#
###########################################################################
# If 'OPENIMAGE_HOME' not set, use the env variable of that name if available
@@ -36,23 +55,16 @@ if (NOT OPENIMAGEIO_ROOT_DIR AND NOT $ENV{OPENIMAGEIO_ROOT_DIR} STREQUAL "")
endif ()
if (NOT OpenImageIO_FIND_QUIETLY)
message ( STATUS "OPENIMAGEIO_ROOT_DIR = ${OPENIMAGEIO_ROOT_DIR}" )
endif ()
find_library ( OPENIMAGEIO_LIBRARY
NAMES OpenImageIO${OIIO_LIBNAME_SUFFIX}
HINTS ${OPENIMAGEIO_ROOT_DIR}/lib
PATH_SUFFIXES lib64 lib
PATHS "${OPENIMAGEIO_ROOT_DIR}/lib" )
HINTS ${OPENIMAGEIO_ROOT_DIR}
PATH_SUFFIXES lib64 lib )
find_path ( OPENIMAGEIO_INCLUDE_DIR
NAMES OpenImageIO/imageio.h
HINTS ${OPENIMAGEIO_ROOT_DIR}/include
PATH_SUFFIXES include )
HINTS ${OPENIMAGEIO_ROOT_DIR} )
find_program ( OIIOTOOL_BIN
NAMES oiiotool oiiotool.exe
HINTS ${OPENIMAGEIO_ROOT_DIR}/bin
PATH_SUFFIXES bin )
NAMES oiiotool
HINTS ${OPENIMAGEIO_ROOT_DIR} )
# Try to figure out version number
set (OIIO_VERSION_HEADER "${OPENIMAGEIO_INCLUDE_DIR}/OpenImageIO/oiioversion.h")
@@ -63,33 +75,53 @@ if (EXISTS "${OIIO_VERSION_HEADER}")
string (REGEX MATCHALL "[0-9]+" OPENIMAGEIO_VERSION_MINOR ${TMP})
file (STRINGS "${OIIO_VERSION_HEADER}" TMP REGEX "^#define OIIO_VERSION_PATCH .*$")
string (REGEX MATCHALL "[0-9]+" OPENIMAGEIO_VERSION_PATCH ${TMP})
set (OPENIMAGEIO_VERSION "${OPENIMAGEIO_VERSION_MAJOR}.${OPENIMAGEIO_VERSION_MINOR}.${OPENIMAGEIO_VERSION_PATCH}")
file (STRINGS "${OIIO_VERSION_HEADER}" TMP REGEX "^#define OIIO_VERSION_TWEAK .*$")
if (TMP)
string (REGEX MATCHALL "[0-9]+" OPENIMAGEIO_VERSION_TWEAK ${TMP})
else ()
set (OPENIMAGEIO_VERSION_TWEAK 0)
endif ()
set (OPENIMAGEIO_VERSION "${OPENIMAGEIO_VERSION_MAJOR}.${OPENIMAGEIO_VERSION_MINOR}.${OPENIMAGEIO_VERSION_PATCH}.${OPENIMAGEIO_VERSION_TWEAK}")
endif ()
set ( OPENIMAGEIO_LIBRARIES ${OPENIMAGEIO_LIBRARY})
get_filename_component (OPENIMAGEIO_LIBRARY_DIRS "${OPENIMAGEIO_LIBRARY}" DIRECTORY CACHE)
if (NOT OpenImageIO_FIND_QUIETLY)
message ( STATUS "OpenImageIO includes = ${OPENIMAGEIO_INCLUDE_DIR}" )
message ( STATUS "OpenImageIO libraries = ${OPENIMAGEIO_LIBRARIES}" )
message ( STATUS "OpenImageIO library_dirs = ${OPENIMAGEIO_LIBRARY_DIRS}" )
message ( STATUS "OpenImageIO oiiiotool = ${OIIOTOOL_BIN}" )
endif ()
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (OpenImageIO
FOUND_VAR OPENIMAGEIO_FOUND
REQUIRED_VARS OPENIMAGEIO_INCLUDE_DIR OPENIMAGEIO_LIBRARIES
OPENIMAGEIO_LIBRARY_DIRS OPENIMAGEIO_VERSION
FOUND_VAR OpenImageIO_FOUND
REQUIRED_VARS OPENIMAGEIO_INCLUDE_DIR OPENIMAGEIO_LIBRARY
OPENIMAGEIO_VERSION
VERSION_VAR OPENIMAGEIO_VERSION
)
set (OPENIMAGEIO_FOUND ${OpenImageIO_FOUND}) # Old name
if (OpenImageIO_FOUND)
set (OPENIMAGEIO_INCLUDES ${OPENIMAGEIO_INCLUDE_DIR})
set (OPENIMAGEIO_LIBRARIES ${OPENIMAGEIO_LIBRARY})
get_filename_component (OPENIMAGEIO_LIBRARY_DIRS "${OPENIMAGEIO_LIBRARY}" DIRECTORY)
if (NOT OpenImageIO_FIND_QUIETLY)
message ( STATUS "OpenImageIO includes = ${OPENIMAGEIO_INCLUDE_DIR}" )
message ( STATUS "OpenImageIO libraries = ${OPENIMAGEIO_LIBRARIES}" )
message ( STATUS "OpenImageIO library_dirs = ${OPENIMAGEIO_LIBRARY_DIRS}" )
message ( STATUS "OpenImageIO oiiotool = ${OIIOTOOL_BIN}" )
endif ()
if (NOT TARGET OpenImageIO::OpenImageIO)
add_library(OpenImageIO::OpenImageIO UNKNOWN IMPORTED)
set_target_properties(OpenImageIO::OpenImageIO PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${OPENIMAGEIO_INCLUDES}")
set_property(TARGET OpenImageIO::OpenImageIO APPEND PROPERTY
IMPORTED_LOCATION "${OPENIMAGEIO_LIBRARIES}")
endif ()
if (NOT TARGET OpenImageIO::oiiotool AND EXISTS "${OIIOTOOL_BIN}")
add_executable(OpenImageIO::oiiotool IMPORTED)
set_target_properties(OpenImageIO::oiiotool PROPERTIES
IMPORTED_LOCATION "${OIIOTOOL_BIN}")
endif ()
endif ()
mark_as_advanced (
OPENIMAGEIO_INCLUDE_DIR
OPENIMAGEIO_LIBRARIES
OPENIMAGEIO_LIBRARY_DIRS
OPENIMAGEIO_VERSION
OPENIMAGEIO_VERSION_MAJOR
OPENIMAGEIO_VERSION_MINOR
OPENIMAGEIO_VERSION_PATCH
OPENIMAGEIO_LIBRARY
)
+16 -19
View File
@@ -1,11 +1,11 @@
# Module to find OpenJpeg.
#
# This module will first look into the directories defined by the variables:
# - OPENJPEG_HOME
# - OpenJpeg_ROOT
#
# This module defines the following variables:
#
# OPENJPEG_INCLUDE_DIR - where to find openjpeg.h
# OPENJPEG_INCLUDES - where to find openjpeg.h
# OPENJPEG_LIBRARIES - list of libraries to link against when using OpenJpeg.
# OPENJPEG_FOUND - True if OpenJpeg was found.
# OPENJPEG_VERSION - Set to the OpenJPEG version found
@@ -17,7 +17,6 @@ macro (PREFIX_FIND_INCLUDE_DIR prefix includefile libpath_var)
string (TOUPPER ${prefix}_INCLUDE_DIR tmp_varname)
find_path(${tmp_varname} ${includefile}
PATHS ${${libpath_var}}
PATH_SUFFIXES include
NO_DEFAULT_PATH
)
if (${tmp_varname})
@@ -32,13 +31,11 @@ macro (PREFIX_FIND_LIB prefix libname libpath_var liblist_var cachelist_var)
find_library(${tmp_prefix}_LIBRARY_RELEASE
NAMES ${libname}
PATHS ${${libpath_var}}
PATH_SUFFIXES lib
NO_DEFAULT_PATH
)
find_library(${tmp_prefix}_LIBRARY_DEBUG
NAMES ${libname}d ${libname}_d ${libname}debug ${libname}_debug
PATHS ${${libpath_var}}
PATH_SUFFIXES lib
NO_DEFAULT_PATH
)
# Properly define ${tmp_prefix}_LIBRARY (cached) and ${tmp_prefix}_LIBRARIES
@@ -68,9 +65,7 @@ set (OpenJpeg_include_paths
/usr/include/openjpeg-2.3
/usr/include/openjpeg-2.2
/usr/include/openjpeg-2.1
/usr/include/openjpeg-1.5
/usr/include/openjpeg
/usr/local/include/openjpeg-1.5
/usr/include
/opt/local/include
/opt/local/include/openjpeg-2.3
@@ -85,20 +80,20 @@ set (OpenJpeg_library_paths
/sw/lib
/opt/local/lib)
if (OPENJPEG_HOME)
if (OpenJpeg_ROOT)
set (OpenJpeg_library_paths
${OPENJPEG_HOME}/lib
${OPENJPEG_HOME}/lib64
${OPENJPEG_HOME}/bin
${OpenJpeg_ROOT}/lib
${OpenJpeg_ROOT}/lib64
${OpenJpeg_ROOT}/bin
${OpenJpeg_library_paths}
)
set (OpenJpeg_include_paths
${OPENJPEG_HOME}/include/openjpeg-2.3
${OPENJPEG_HOME}/include/openjpeg-2.2
${OPENJPEG_HOME}/include/openjpeg-2.1
${OPENJPEG_HOME}/include/openjpeg-2.0
${OPENJPEG_HOME}/include/openjpeg
${OPENJPEG_HOME}/include
${OpenJpeg_ROOT}/include/openjpeg-2.3
${OpenJpeg_ROOT}/include/openjpeg-2.2
${OpenJpeg_ROOT}/include/openjpeg-2.1
${OpenJpeg_ROOT}/include/openjpeg-2.0
${OpenJpeg_ROOT}/include/openjpeg
${OpenJpeg_ROOT}/include
${OpenJpeg_include_paths}
)
endif()
@@ -154,10 +149,12 @@ else ()
endif ()
# Use the standard function to handle OPENJPEG_FOUND
FIND_PACKAGE_HANDLE_STANDARD_ARGS (OpenJpeg DEFAULT_MSG
OPENJPEG_INCLUDE_DIR ${OpenJpeg_libvars})
FIND_PACKAGE_HANDLE_STANDARD_ARGS (OpenJpeg
VERSION_VAR OPENJPEG_VERSION
REQUIRED_VARS OPENJPEG_INCLUDE_DIR ${OpenJpeg_libvars})
if (OPENJPEG_FOUND)
set (OPENJPEG_INCLUDES ${OPENJPEG_INCLUDE_DIR})
set (OPENJPEG_LIBRARIES "")
foreach (tmplib ${OpenJpeg_libvars})
list (APPEND OPENJPEG_LIBRARIES ${${tmplib}})
+24 -18
View File
@@ -4,14 +4,16 @@
# OPENVDB_INCLUDE_DIRS, where to find openvdb.h, Set when
# OPENVDB_INCLUDE_DIR is found.
# OPENVDB_LIBRARIES, libraries to link against to use OPENVDB.
# OPENVDB_ROOT_DIR, The base directory to search for OPENVDB.
# OpenVDB_ROOT, The base directory to search for OPENVDB.
# This can also be an environment variable.
# OPENVDB_FOUND, If false, do not try to use OPENVDB.
# OpenVDB_FOUND, If false, do not try to use OPENVDB.
#
# also defined, but not for general use are
# OPENVDB_LIBRARY, where to find the OPENVDB library.
#=============================================================================
# Modified from one with this copyright notice:
#
# Copyright 2015 Blender Foundation.
#
# Distributed under the OSI-approved BSD License (the "License");
@@ -22,13 +24,9 @@
# See the License for more information.
#=============================================================================
# If OPENVDB_ROOT_DIR was defined in the environment, use it.
IF(NOT OPENVDB_ROOT_DIR AND NOT $ENV{OPENVDB_ROOT_DIR} STREQUAL "")
SET(OPENVDB_ROOT_DIR $ENV{OPENVDB_ROOT_DIR})
ENDIF()
SET(_openvdb_SEARCH_DIRS
${OPENVDB_ROOT_DIR}
${OpenVDB_ROOT}
ENV OpenVDB_ROOT
/usr/local
/sw # Fink
/opt/local # DarwinPorts
@@ -56,11 +54,11 @@ if (OPENVDB_INCLUDE_DIR)
endif ()
LIST(INSERT oiio_vdblib_search 0 lib)
IF (DEBUGMODE)
LIST(INSERT oiio_vdblib_search 0 lib/debug)
ENDIF ()
if ($<CONFIG:Debug>)
list (INSERT oiio_vdblib_search 0 lib/debug)
endif ()
FIND_LIBRARY(OPENVDB_LIBRARY
find_library(OPENVDB_LIBRARY
NAMES
openvdb
HINTS
@@ -69,18 +67,26 @@ FIND_LIBRARY(OPENVDB_LIBRARY
${oiio_vdblib_search}
)
# handle the QUIETLY and REQUIRED arguments and set OPENVDB_FOUND to TRUE if
# handle the QUIETLY and REQUIRED arguments and set OpenVDB_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OPENVDB
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenVDB
REQUIRED_VARS OPENVDB_LIBRARY OPENVDB_INCLUDE_DIR
VERSION_VAR OPENVDB_VERSION
)
IF(OPENVDB_FOUND)
SET(OPENVDB_LIBRARIES ${OPENVDB_LIBRARY})
SET(OPENVDB_INCLUDE_DIRS ${OPENVDB_INCLUDE_DIR})
ENDIF(OPENVDB_FOUND)
if (OpenVDB_FOUND)
set(OPENVDB_LIBRARIES ${OPENVDB_LIBRARY})
set(OPENVDB_INCLUDES ${OPENVDB_INCLUDE_DIR})
if (NOT TARGET OpenVDB::OpenVDB)
add_library(OpenVDB::OpenVDB UNKNOWN IMPORTED)
set_target_properties(OpenVDB::OpenVDB PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${OPENVDB_INCLUDES}")
set_property(TARGET OpenVDB::OpenVDB APPEND PROPERTY
IMPORTED_LOCATION "${OPENVDB_LIBRARIES}")
endif ()
endif ()
MARK_AS_ADVANCED(
OPENVDB_INCLUDE_DIR
+3 -1
View File
@@ -127,7 +127,9 @@ find_package_handle_standard_args(PTex
if (PTEX_FOUND)
set(PTEX_LIBRARIES ${PTEX_LIBRARY})
endif(PTEX_FOUND)
else ()
set (PTEX_INCLUDE_DIR "")
endif()
mark_as_advanced(
PTEX_INCLUDE_DIR
-35
View File
@@ -1,35 +0,0 @@
# Find the pugixml XML parsing library.
#
# Sets the usual variables expected for find_package scripts:
#
# PUGIXML_INCLUDE_DIR - header location
# PUGIXML_LIBRARIES - library to link against
# PUGIXML_FOUND - true if pugixml was found.
find_path (PUGIXML_INCLUDE_DIR
NAMES pugixml.hpp
PATHS ${PUGIXML_HOME}/include
/usr/local/include
/usr/local/include/pugixml-1.8)
find_library (PUGIXML_LIBRARY
NAMES pugixml
PATHS ${PUGIXML_HOME}/lib
/usr/local/lib
/usr/local/lib/pugixml-1.8)
# Support the REQUIRED and QUIET arguments, and set PUGIXML_FOUND if found.
include (FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS (PugiXML DEFAULT_MSG PUGIXML_LIBRARY
PUGIXML_INCLUDE_DIR)
if (PUGIXML_FOUND)
set (PUGIXML_LIBRARIES ${PUGIXML_LIBRARY})
if (NOT PugiXML_FIND_QUIETLY)
message (STATUS "PugiXML include = ${PUGIXML_INCLUDE_DIR}")
message (STATUS "PugiXML library = ${PUGIXML_LIBRARY}")
endif ()
else ()
message (STATUS "No PugiXML found")
endif()
mark_as_advanced (PUGIXML_LIBRARY PUGIXML_INCLUDE_DIR)
+66
View File
@@ -0,0 +1,66 @@
# - Try to find R3D SDK
#
# Set R3DSDK_ROOT Environment variable to root of the SDK
# Otherwise it will try to guess some plausible paths.
#
# Once done, this will define
#
# R3DSDK_FOUND - system has R3D SDK
# R3DSDK_INCLUDE_DIR - the include directory
# R3DSDK_LIBRARIES - link these at build time.
# R3DSDK_RUNTIME_LIBRARIES - Use this path (or copy the contents to a path)
# for R3DSDK::InitializeSdk() at runtime.
include (FindPackageHandleStandardArgs)
# Assuming only C++11 and 64 bit support is needed.
# Set R3DSDK_LIB_NAME before invoking this file to override.
if (NOT DEFINED R3DSDK_LIB_NAME)
set(R3DSDK_LIB_NAME R3DSDKPIC-cpp11)
endif()
if(DEFINED ENV{R3DSDK_ROOT})
set(R3DSDK_ROOT $ENV{R3DSDK_ROOT})
# message("Using R3D SDK Root: " ${R3DSDK_ROOT})
else()
# message("Looking for R3D SDK")
# The R3D SDK is supplied as a zip file that you can unpack anywhere.
# So try some plausible locations and hope for the best.
# Use a glob to try and avoid dealing with exact SDK version numbers.
file(GLOB R3DSDK_PATHS "/opt/R3DSDKv*"
"C:/R3DSDKv*"
${CMAKE_CURRENT_SOURCE_DIR}/../R3DSDKv*
${CMAKE_CURRENT_SOURCE_DIR}/../../R3DSDKv*
${CMAKE_CURRENT_SOURCE_DIR}/../../../R3DSDKv*
)
find_path(R3DSDK_ROOT Include/R3DSDK.h
PATHS ${R3DSDK_PATHS}
)
endif()
set(R3DSDK_INCLUDE_DIR ${R3DSDK_ROOT}/Include)
find_library(R3DSDK_LIBRARY NAMES ${R3DSDK_LIB_NAME}
PATHS ${R3DSDK_ROOT}/Lib/linux64/
${R3DSDK_ROOT}/Lib/win64/
NO_DEFAULT_PATH
)
# handle the QUIETLY and REQUIRED arguments and set R3DSDK_FOUND to TRUE if
# all listed variables are TRUE
FIND_PACKAGE_HANDLE_STANDARD_ARGS(R3DSDK DEFAULT_MSG R3DSDK_LIBRARY R3DSDK_INCLUDE_DIR)
# TODO : Ask somebody with a Mac to add support.
if(R3DSDK_FOUND)
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(R3DSDK_LIBRARIES ${R3DSDK_LIBRARY} dl)
set(R3DSDK_RUNTIME_LIBRARIES ${R3DSDK_ROOT}/Redistributable/linux)
else()
set(R3DSDK_LIBRARIES ${R3DSDK_LIBRARY})
set(R3DSDK_RUNTIME_LIBRARIES ${R3DSDK_ROOT}/Redistributable/win)
endif()
endif()
mark_as_advanced(R3DSDK_LIBRARY R3DSDK_INCLUDE_DIR)
+21
View File
@@ -0,0 +1,21 @@
# Find Robinmap
#
# Sets the usual variables expected for find_package scripts:
#
# ROBINMAP_INCLUDES - header location
# ROBINMAP_FOUND - true if robin-map was found.
find_path (ROBINMAP_INCLUDE_DIR tsl/robin_map.h
HINTS "${PROJECT_SOURCE_DIR}/ext/robin-map"
)
# Support the REQUIRED and QUIET arguments, and set ROBINMAP_FOUND if found.
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (Robinmap
REQUIRED_VARS ROBINMAP_INCLUDE_DIR)
if (ROBINMAP_FOUND)
set (ROBINMAP_INCLUDES ${ROBINMAP_INCLUDE_DIR})
endif ()
mark_as_advanced (ROBINMAP_INCLUDE_DIR)
+4 -9
View File
@@ -88,14 +88,10 @@ if(NOT TBB_FOUND)
# Check the build type
##################################
if(NOT DEFINED TBB_USE_DEBUG_BUILD)
if(CMAKE_BUILD_TYPE MATCHES "Debug|DEBUG|debug")
set(TBB_USE_DEBUG_BUILD TRUE)
else()
set(TBB_USE_DEBUG_BUILD FALSE)
endif()
if (NOT DEFINED TBB_USE_DEBUG_BUILD)
set(TBB_USE_DEBUG_BUILD $<CONFIG:Debug>)
endif()
##################################
# Set the TBB search directories
##################################
@@ -140,8 +136,7 @@ if(NOT TBB_FOUND)
find_path(TBB_INCLUDE_DIRS tbb/tbb.h
HINTS ${TBB_INCLUDE_DIR} ${TBB_SEARCH_DIR}
PATHS ${TBB_DEFAULT_SEARCH_DIR}
PATH_SUFFIXES include)
PATHS ${TBB_DEFAULT_SEARCH_DIR})
##################################
# Find TBB components
+49
View File
@@ -0,0 +1,49 @@
# Module to find Webp
#
# This module will first look into the directories defined by the variables:
# - Webp_ROOT, WEBP_INCLUDE_PATH, WEBP_LIBRARY_PATH
#
# This module defines the following variables:
#
# Webp_FOUND True if Webp was found.
# WEBP_INCLUDES Where to find Webp headers
# WEBP_LIBRARIES List of libraries to link against when using Webp
# WEBP_VERSION Version of Webp (e.g., 3.6.2)
include (FindPackageHandleStandardArgs)
find_path (WEBP_INCLUDE_DIR webp/encode.h
HINTS
${WEBP_INCLUDE_PATH}
ENV WEBP_INCLUDE_PATH
DOC "The directory where Webp headers reside")
find_library (WEBP_LIBRARY webp
HINTS
${WEBP_LIBRARY_PATH}
ENV WEBP_LIBRARY_PATH
DOC "The directory where Webp libraries reside")
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (Webp
REQUIRED_VARS WEBP_INCLUDE_DIR
WEBP_LIBRARY
)
if (Webp_FOUND)
set (WEBP_INCLUDES "${WEBP_INCLUDE_DIR}")
set (WEBP_LIBRARIES "${WEBP_LIBRARY}")
if (NOT TARGET Webp::Webp)
add_library(Webp::Webp UNKNOWN IMPORTED)
set_target_properties(Webp::Webp PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${WEBP_INCLUDES}")
set_property(TARGET Webp::Webp APPEND PROPERTY
IMPORTED_LOCATION "${WEBP_LIBRARIES}")
endif ()
endif ()
mark_as_advanced (
WEBP_INCLUDE_DIR
WEBP_LIBRARY
)
+28
View File
@@ -0,0 +1,28 @@
# Find fmt library
#
# Sets the usual variables expected for find_package scripts:
#
# FMT_INCLUDES - header location
# FMT_FOUND - true if fmt was found.
# FMT_VERSION - combined version number (e.g. 60102 for 6.1.2)
find_path (FMT_INCLUDE_DIR fmt/format.h
HINTS "${PROJECT_SOURCE_DIR}/ext/fmt"
)
if (FMT_INCLUDE_DIR)
file(STRINGS "${FMT_INCLUDE_DIR}/fmt/core.h" TMP REGEX "^#define FMT_VERSION .*$")
string (REGEX MATCHALL "[0-9]+[.0-9]+" FMT_VERSION ${TMP})
endif ()
# Support the REQUIRED and QUIET arguments, and set FMT_FOUND if found.
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (fmt
REQUIRED_VARS FMT_INCLUDE_DIR
VERSION_VAR FMT_VERSION)
if (FMT_FOUND)
set (FMT_INCLUDES ${FMT_INCLUDE_DIR})
endif ()
mark_as_advanced (FMT_INCLUDE_DIR)
+144 -52
View File
@@ -1,33 +1,28 @@
# Macro to install targets to the appropriate locations. Use this instead of
# the install(TARGETS ...) signature.
#
# Usage:
#
# oiio_install_targets (target1 [target2 ...])
#
macro (oiio_install_targets)
install (TARGETS ${ARGN}
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT user
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT user
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT developer)
endmacro ()
# Copyright 2008-present Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
# Macro to add a build target for an IO plugin.
#
# Usage:
#
# add_oiio_plugin ( source1 [source2 ...]
# [ NAME targetname ... ]
# [ SRC source1 ... ]
# [ INCLUDE_DIRS include_dir1 ... ]
# [ LINK_LIBRARIES external_lib1 ... ]
# [ DEFINITIONS -DFOO=bar ... ])
#
# The plugin name is deduced from the name of the current directory and the
# source is automatically linked against OpenImageIO. Additional include
# directories (just for this target) may be specified after the optional
# INCLUDE_DIRS keyword. Additional libraries (for example, libpng) may be
# specified after the optionl LINK_LIBRARIES keyword. Additional
# preprocessor definitions may be specified after the optional DEFINITIONS
# keyword.
# The plugin name can be specified with NAME, otherwise is inferred from the
# subdirectory name. The source files of the binary can be specifeied with
# SRC, otherwise are inferred to be all the .cpp files within the
# subdirectory. Optional compile DEFINITIONS, private INCLUDE_DIRS, and
# priviate LINK_LIBRARIES may also be specified. The source is automatically
# linked against OpenImageIO.
#
# The plugin may be disabled individually using any of the usual
# check_is_enabled() conventions (e.g. -DENABLE_<format>=OFF).
#
# What goes on under the covers is quite different depending on whether
# EMBEDPLUGINS is 0 or 1. If EMBEDPLUGINS is 0 (in which case this is
@@ -39,34 +34,107 @@ endmacro ()
# be handed off too the setup of the later OpenImageIO target.
#
macro (add_oiio_plugin)
cmake_parse_arguments (_plugin "" "" "INCLUDE_DIRS;LINK_LIBRARIES;DEFINITIONS" ${ARGN})
cmake_parse_arguments (_plugin "" "NAME" "SRC;INCLUDE_DIRS;LINK_LIBRARIES;DEFINITIONS" ${ARGN})
# Arguments: <prefix> <options> <one_value_keywords> <multi_value_keywords> args...
if (EMBEDPLUGINS)
set (_target_name OpenImageIO)
# Add each source file to the libOpenImageIO_srcs, but it takes some
# bending over backwards to change it in the parent scope.
set (_plugin_all_source ${libOpenImageIO_srcs})
foreach (_plugin_source_file ${_plugin_UNPARSED_ARGUMENTS})
list (APPEND _plugin_all_source "${CMAKE_CURRENT_SOURCE_DIR}/${_plugin_source_file}")
endforeach ()
set (libOpenImageIO_srcs "${_plugin_all_source}" PARENT_SCOPE)
set (format_plugin_definitions ${format_plugin_definitions} ${_plugin_DEFINITIONS} PARENT_SCOPE)
set (format_plugin_include_dirs ${format_plugin_include_dirs} ${_plugin_INCLUDE_DIRS} PARENT_SCOPE)
set (format_plugin_libs ${format_plugin_libs} ${_plugin_LINK_LIBRARIES} PARENT_SCOPE)
get_filename_component (_plugin_name ${CMAKE_CURRENT_SOURCE_DIR} NAME_WE)
if (NOT _plugin_NAME)
# If NAME is not supplied, infer target name (and therefore the
# executable name) from the directory name.
get_filename_component (_plugin_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
endif ()
# if (NOT _plugin_SRC)
# # If SRC is not supplied, assume local cpp files are its source.
# file (GLOB _plugin_SRC *.cpp)
# endif ()
check_is_enabled (${_plugin_name} _enable_plugin)
if (_enable_plugin)
if (EMBEDPLUGINS)
# Add each source file to the libOpenImageIO_srcs, but it takes some
# bending over backwards to change it in the parent scope.
set (_plugin_all_source ${libOpenImageIO_srcs})
foreach (_plugin_source_file ${_plugin_UNPARSED_ARGUMENTS} )
list (APPEND _plugin_all_source "${CMAKE_CURRENT_SOURCE_DIR}/${_plugin_source_file}")
endforeach ()
set (libOpenImageIO_srcs "${_plugin_all_source}" PARENT_SCOPE)
set (format_plugin_definitions ${format_plugin_definitions} ${_plugin_DEFINITIONS} PARENT_SCOPE)
set (format_plugin_include_dirs ${format_plugin_include_dirs} ${_plugin_INCLUDE_DIRS} PARENT_SCOPE)
set (format_plugin_libs ${format_plugin_libs} ${_plugin_LINK_LIBRARIES} PARENT_SCOPE)
else ()
# Get the name of the current directory and use it as the target name.
get_filename_component (_plugin_name ${CMAKE_CURRENT_SOURCE_DIR} NAME)
add_library (${_plugin_name} MODULE ${_plugin_UNPARSED_ARGUMENTS})
target_compile_definitions (${_plugin_name} PRIVATE
${_plugin_DEFINITIONS}
OpenImageIO_EXPORTS)
target_include_directories (${_plugin_name} PRIVATE ${_plugin_INCLUDE_DIRS})
target_link_libraries (${_plugin_name} PUBLIC OpenImageIO
PRIVATE ${_plugin_LINK_LIBRARIES})
set_target_properties (${_plugin_name} PROPERTIES PREFIX "" FOLDER "Plugins")
install_targets (${_plugin_name})
endif ()
else ()
# Get the name of the current directory and use it as the target name.
set (_target_name ${CMAKE_CURRENT_SOURCE_DIR})
get_filename_component (_target_name ${CMAKE_CURRENT_SOURCE_DIR} NAME)
add_library (${_target_name} SHARED ${_plugin_UNPARSED_ARGUMENTS})
add_definitions (${_plugin_DEFINITIONS})
include_directories (${_target_name} PRIVATE ${_plugin_INCLUDE_DIRS})
target_link_libraries (${_target_name} OpenImageIO ${_plugin_LINK_LIBRARIES})
set_target_properties (${_target_name} PROPERTIES PREFIX "" FOLDER "Plugins")
oiio_install_targets (${_target_name})
message (STATUS "${ColorRed}Disabling ${_plugin_name} ${ColorReset}")
string (TOUPPER ${_plugin_name} _plugin_name_upper)
set (format_plugin_definitions ${format_plugin_definitions} DISABLE_${_plugin_name_upper} PARENT_SCOPE)
endif ()
endmacro ()
# Macro to add an executable build target. The executable name can be
# specified with NAME, otherwise is inferred from the subdirectory name. The
# source files of the binary can be specifeied with SRC, otherwise are
# inferred to be all the .cpp files within the subdirectory. Optional
# compile DEFINITIONS, private INCLUDE_DIRS, and priviate LINK_LIBRARIES may
# also be specified.
#
# The executable may be disabled individually using any of the usual
# check_is_enabled() conventions (e.g. -DENABLE_<executable>=OFF).
#
# Usage:
#
# fancy_add_executable ([ NAME targetname ... ]
# [ SRC source1 ... ]
# [ INCLUDE_DIRS include_dir1 ... ]
# [ DEFINITIONS -DFOO=bar ... ])
# [ LINK_LIBRARIES external_lib1 ... ]
#
macro (fancy_add_executable)
cmake_parse_arguments (_target "" "NAME" "SRC;INCLUDE_DIRS;SYSTEM_INCLUDE_DIRS;LINK_LIBRARIES;DEFINITIONS" ${ARGN})
# Arguments: <prefix> <options> <one_value_keywords> <multi_value_keywords> args...
if (NOT _target_NAME)
# If NAME is not supplied, infer target name (and therefore the
# executable name) from the directory name.
get_filename_component (_target_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
endif ()
if (NOT _target_SRC)
# If SRC is not supplied, assume local cpp files are its source.
file (GLOB _target_SRC *.cpp)
endif ()
check_is_enabled (${_target_NAME} _target_NAME_enabled)
if (_target_NAME_enabled)
add_executable (${_target_NAME} ${_target_SRC})
if (_target_INCLUDE_DIRS)
target_include_directories (${_target_NAME} PRIVATE ${_target_INCLUDE_DIRS})
endif ()
if (_target_SYSTEM_INCLUDE_DIRS)
target_include_directories (${_target_NAME} SYSTEM PRIVATE ${_target_SYSTEM_INCLUDE_DIRS})
endif ()
if (_target_DEFINITIONS)
target_compile_definitions (${_target_name} PRIVATE ${_target_DEFINITIONS})
endif ()
if (_target_LINK_LIBRARIES)
target_link_libraries (${_target_NAME} PRIVATE ${_target_LINK_LIBRARIES})
endif ()
set_target_properties (${_target_NAME} PROPERTIES FOLDER "Tools")
install_targets (${_target_NAME})
else ()
message (STATUS "${ColorRed}Disabling ${_target_NAME} ${ColorReset}")
endif ()
endmacro ()
# oiio_set_testenv() - add environment variables to a test
#
# Usage:
@@ -93,22 +161,39 @@ endmacro ()
# Usage:
# oiio_add_tests ( test1 [ test2 ... ]
# [ IMAGEDIR name_of_reference_image_directory ]
# [ URL http://find.reference.cases.here.com ] )
# [ URL http://find.reference.cases.here.com ]
# [ FOUNDVAR variable_name ... ]
# [ ENABLEVAR variable_name ... ]
# )
#
# The optional argument IMAGEDIR is used to check whether external test images
# (not supplied with OIIO) are present, and to disable the test cases if
# they're not. If IMAGEDIR is present, URL should also be included to tell
# the user where to find such tests.
#
# The optional FOUNDVAR introduces variables (typically Foo_FOUND) that if
# not existing and true, will skip the test.
#
# The optional ENABLEVAR introduces variables (typically ENABLE_Foo) that
# if existing and yet false, will skip the test.
#
macro (oiio_add_tests)
cmake_parse_arguments (_ats "" "" "URL;IMAGEDIR;LABEL;FOUNDVAR;TESTNAME" ${ARGN})
cmake_parse_arguments (_ats "" "" "URL;IMAGEDIR;LABEL;FOUNDVAR;ENABLEVAR;TESTNAME" ${ARGN})
# Arguments: <prefix> <options> <one_value_keywords> <multi_value_keywords> args...
set (_ats_testdir "${OIIO_TESTSUITE_IMAGEDIR}/${_ats_IMAGEDIR}")
# If there was a FOUNDVAR param specified and that variable name is
# not defined, mark the test as broken.
if (_ats_FOUNDVAR AND NOT ${_ats_FOUNDVAR})
set (_ats_LABEL "broken")
endif ()
foreach (_var ${_ats_FOUNDVAR})
if (NOT ${_var})
set (_ats_LABEL "broken")
endif ()
endforeach ()
foreach (_var ${_ats_ENABLEVAR})
if ((NOT "${${_var}}" STREQUAL "" AND NOT "${${_var}}") OR
(NOT "$ENV{${_var}}" STREQUAL "" AND NOT "$ENV{${_var}}"))
set (_ats_LABEL "broken")
endif ()
endforeach ()
if (_ats_IMAGEDIR AND NOT EXISTS ${_ats_testdir})
# If the directory containig reference data (images) for the test
# isn't found, point the user at the URL.
@@ -129,7 +214,7 @@ macro (oiio_add_tests)
set (_testname "${_testname}-broken")
endif ()
set (_runtest python "${CMAKE_SOURCE_DIR}/testsuite/runtest.py" ${_testdir})
set (_runtest ${PYTHON_EXECUTABLE} "${CMAKE_SOURCE_DIR}/testsuite/runtest.py" ${_testdir})
if (MSVC_IDE)
set (_runtest ${_runtest} --devenv-config $<CONFIGURATION>
--solution-path "${CMAKE_BINARY_DIR}" )
@@ -145,16 +230,23 @@ macro (oiio_add_tests)
# For texture tests, add a second test using batch mode as well.
if (_testname MATCHES "texture")
add_test ( NAME "${_testname}.batch"
set (_testname ${_testname}.batch)
set (_testdir ${_testdir}.batch)
set (_runtest ${PYTHON_EXECUTABLE} "${CMAKE_SOURCE_DIR}/testsuite/runtest.py" ${_testdir})
if (MSVC_IDE)
set (_runtest ${_runtest} --devenv-config $<CONFIGURATION>
--solution-path "${CMAKE_BINARY_DIR}" )
endif ()
file (MAKE_DIRECTORY "${_testdir}")
add_test ( NAME "${_testname}"
COMMAND env TESTTEX_BATCH=1 ${_runtest} )
oiio_set_testenv("${_testname}.batch" "${_testsuite}"
"${_testsrcdir}" "${_testdir}" "${_ats_testdir}")
oiio_set_testenv("${_testname}" "${_testsuite}"
"${_testsrcdir}" "${_testdir}.batch" "${_ats_testdir}")
endif ()
#if (VERBOSE)
# message (STATUS "TEST ${_testname}: ${_runtest}")
# # message (STATUS "TEST ${_testname}: ${_runtest}")
#endif ()
endforeach ()
if (VERBOSE)
-54
View File
@@ -1,54 +0,0 @@
###########################################################################
# Figure out what platform we're on, and set some variables appropriately
# CMAKE_SYSTEM_PROCESSOR should not be used because it indicates the platform
# we are building on, but when cross compiling or using a chroot this is not
# what we want to use
if ("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
set (SYSTEM_PROCESSOR "x86_64")
else()
set (SYSTEM_PROCESSOR "i686")
endif()
if (VERBOSE)
message (STATUS "CMAKE_SYSTEM_NAME = ${CMAKE_SYSTEM_NAME}")
message (STATUS "CMAKE_SYSTEM_VERSION = ${CMAKE_SYSTEM_VERSION}")
message (STATUS "SYSTEM_PROCESSOR = ${SYSTEM_PROCESSOR}")
endif ()
if (UNIX)
if (VERBOSE)
message (STATUS "Unix! ${CMAKE_SYSTEM_NAME}")
endif ()
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set (platform "linux")
set (CXXFLAGS "${CXXFLAGS} -DLINUX")
if (${SYSTEM_PROCESSOR} STREQUAL "x86_64")
set (platform "linux64")
set (CXXFLAGS "${CXXFLAGS} -DLINUX64")
endif ()
elseif (APPLE)
set (platform "macosx")
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
set (platform "FreeBSD")
set (CXXFLAGS "${CXXFLAGS} -DFREEBSD")
if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i386")
# minimum arch of i586 is needed for atomic cpu instructions
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=i586")
endif()
else ()
string (TOLOWER ${CMAKE_SYSTEM_NAME} platform)
endif ()
endif ()
if (WIN32)
set (platform "windows")
endif ()
if (platform)
message (STATUS "platform = ${platform}")
else ()
message (FATAL_ERROR "'platform' not defined")
endif ()
unset(SYSTEM_PROCESSOR)
+127
View File
@@ -0,0 +1,127 @@
# Copyright 2008-present Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
# Python-related options.
option (USE_PYTHON "Build the Python bindings" ON)
set (PYTHON_VERSION "2.7" CACHE STRING "Target version of python to find")
option (PYLIB_INCLUDE_SONAME "If ON, soname/soversion will be set for Python module library" OFF)
option (PYLIB_LIB_PREFIX "If ON, prefix the Python module with 'lib'" OFF)
set (PYMODULE_SUFFIX "" CACHE STRING "Suffix to add to Python module init namespace")
# Find Python. This macro should only be called if python is required. If
# Python cannot be found, it will be a fatal error.
# Variables set by this macro:
# PYTHON_INCLUDES_PATH - directory where python headers are found
# PYTHON_LIBRARIES - python libraries to link
# PYTHON_SITE_DIR - our own install dir where our python moduels go
macro (find_python)
if (NOT VERBOSE)
set (PythonInterp_FIND_QUIETLY true)
set (PythonLibs_FIND_QUIETLY true)
endif ()
# Attempt to find the desired version, but fall back to other
# additional versions.
checked_find_package (PythonInterp ${PYTHON_VERSION} REQUIRED)
# The version that was found may not be the default or user
# defined one.
set (PYTHON_VERSION_FOUND ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
if (NOT ${PYTHON_VERSION} VERSION_EQUAL ${PYTHON_VERSION_FOUND} )
message (WARNING "The requested version ${PYTHON_VERSION} was not found.")
message (WARNING "Using ${PYTHON_VERSION_FOUND} instead.")
endif ()
checked_find_package (PythonLibs ${PYTHON_VERSION_FOUND} REQUIRED)
if (VERBOSE)
message (STATUS " Python include dirs ${PYTHON_INCLUDE_PATH}")
message (STATUS " Python libraries ${PYTHON_LIBRARIES}")
message (STATUS " Python site packages dir ${PYTHON_SITE_DIR}")
message (STATUS " Python to include 'lib' prefix: ${PYLIB_LIB_PREFIX}")
message (STATUS " Python to include SO version: ${PYLIB_INCLUDE_SONAME}")
message (STATUS " Python version ${PYTHON_VERSION_STRING}")
message (STATUS " Python version major: ${PYTHON_VERSION_MAJOR} minor: ${PYTHON_VERSION_MINOR}")
endif ()
if (NOT DEFINED PYTHON_SITE_DIR)
set (PYTHON_SITE_DIR "${CMAKE_INSTALL_LIBDIR}/python${PYTHON_VERSION_FOUND}/site-packages")
endif ()
endmacro()
###########################################################################
# pybind11
macro (setup_python_module)
cmake_parse_arguments (lib "" "TARGET;MODULE;LIBS" "SOURCES" ${ARGN})
# Arguments: <prefix> <options> <one_value_keywords> <multi_value_keywords> args...
set (target_name ${lib_TARGET})
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
# Seems to be a problem on some systems, with pybind11 and python headers
set_property (SOURCE ${lib_SOURCES} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-macro-redefined ")
endif ()
# Add the library itself
add_library (${target_name} MODULE ${lib_SOURCES})
# Set up include dirs for python & pybind11
target_include_directories (${target_name} SYSTEM PRIVATE ${PYTHON_INCLUDE_PATH})
# Declare the libraries it should link against
target_link_libraries (${target_name} PRIVATE
pybind11::pybind11 ${lib_LIBS} ${SANITIZE_LIBRARIES})
if (APPLE)
set_target_properties (${target_name} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
else ()
target_link_libraries (${target_name} PRIVATE ${PYTHON_LIBRARIES})
endif ()
# Exclude the 'lib' prefix from the name
if (NOT PYLIB_LIB_PREFIX)
target_compile_definitions(${target_name}
PRIVATE "PYMODULE_NAME=${lib_MODULE}")
set_target_properties (${target_name} PROPERTIES
OUTPUT_NAME ${lib_MODULE}
PREFIX "")
else ()
target_compile_definitions(${target_name}
PRIVATE "PYMODULE_NAME=Py${lib_MODULE}")
set_target_properties (${target_name} PROPERTIES
OUTPUT_NAME Py${lib_MODULE}
PREFIX lib)
endif ()
if (PYLIB_INCLUDE_SONAME)
if (VERBOSE)
message(STATUS "Setting Py${lib_MODULE} SOVERSION to: ${SOVERSION}")
endif ()
set_target_properties(${target_name} PROPERTIES
VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
SOVERSION ${SOVERSION} )
endif()
if (WIN32)
set_target_properties (${target_name} PROPERTIES
DEBUG_POSTFIX "_d"
SUFFIX ".pyd")
endif()
# In the build area, put it in lib/python so it doesn't clash with the
# non-python libraries of the same name (which aren't prefixed by "lib"
# on Windows).
set_target_properties (${target_name} PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/python/site-packages
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/python/site-packages
)
install (TARGETS ${target_name}
RUNTIME DESTINATION ${PYTHON_SITE_DIR} COMPONENT user
LIBRARY DESTINATION ${PYTHON_SITE_DIR} COMPONENT user)
endmacro ()
+15 -2
View File
@@ -1,4 +1,17 @@
add_oiio_plugin (ddsinput.cpp squish/alpha.cpp squish/clusterfit.cpp
# Copyright 2008-present Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
if (Libsquish_FOUND)
# External libsquish was found -- use it
add_oiio_plugin (ddsinput.cpp
LINK_LIBRARIES Libsquish::Libsquish
)
else ()
# No external libsquish was found -- use the embedded version.
add_oiio_plugin (ddsinput.cpp squish/alpha.cpp squish/clusterfit.cpp
squish/colourblock.cpp squish/colourfit.cpp squish/colourset.cpp
squish/maths.cpp squish/rangefit.cpp squish/singlecolourfit.cpp
squish/squish.cpp)
squish/squish.cpp
INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/squish")
endif ()
+3 -32
View File
@@ -1,38 +1,9 @@
/*
Copyright 2009 Larry Gritz and the other authors and contributors.
All Rights Reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the software's owners nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
(This is the Modified BSD License)
*/
// Copyright 2008-present Contributors to the OpenImageIO project.
// SPDX-License-Identifier: BSD-3-Clause
// https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
#pragma once
#include <OpenImageIO/filesystem.h>
#include <OpenImageIO/fmath.h>
OIIO_PLUGIN_NAMESPACE_BEGIN
+13 -39
View File
@@ -1,45 +1,19 @@
/*
Copyright 2010 Larry Gritz and the other authors and contributors.
All Rights Reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the software's owners nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
(This is the Modified BSD License)
*/
// Copyright 2008-present Contributors to the OpenImageIO project.
// SPDX-License-Identifier: BSD-3-Clause
// https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include "dds_pvt.h"
#include <OpenImageIO/dassert.h>
#include <OpenImageIO/filesystem.h>
#include <OpenImageIO/fmath.h>
#include <OpenImageIO/imageio.h>
#include <OpenImageIO/typedesc.h>
#include "squish/squish.h"
#include "dds_pvt.h"
#include "squish.h"
OIIO_PLUGIN_NAMESPACE_BEGIN
@@ -123,7 +97,7 @@ private:
{
size_t n = ::fread(buf, itemsize, nitems, m_file);
if (n != nitems)
error("Read error");
errorf("Read error");
return n == nitems;
}
};
@@ -160,15 +134,15 @@ DDSInput::open(const std::string& name, ImageSpec& newspec)
m_file = Filesystem::fopen(name, "rb");
if (!m_file) {
error("Could not open file \"%s\"", name.c_str());
errorf("Could not open file \"%s\"", name);
return false;
}
// due to struct packing, we may get a corrupt header if we just load the
// struct from file; to adress that, read every member individually
// save some typing
#define RH(memb) \
if (!fread(&m_dds.memb, sizeof(m_dds.memb), 1)) \
#define RH(memb) \
if (!fread(&m_dds.memb, sizeof(m_dds.memb), 1)) \
return false
RH(fourCC);
@@ -249,7 +223,7 @@ DDSInput::open(const std::string& name, ImageSpec& newspec)
&& m_dds.flags & DDS_DEPTH))
|| (m_dds.caps.flags2 & DDS_CAPS2_CUBEMAP
&& !(m_dds.caps.flags1 & DDS_CAPS1_COMPLEX))) {
error("Invalid DDS header, possibly corrupt file");
errorf("Invalid DDS header, possibly corrupt file");
return false;
}
@@ -262,7 +236,7 @@ DDSInput::open(const std::string& name, ImageSpec& newspec)
&& !((m_dds.fmt.flags & DDS_PF_RGB)
| (m_dds.fmt.flags & DDS_PF_LUMINANCE)
| (m_dds.fmt.flags & DDS_PF_ALPHA)))) {
error("Image with no data");
errorf("Image with no data");
return false;
}
@@ -272,7 +246,7 @@ DDSInput::open(const std::string& name, ImageSpec& newspec)
&& m_dds.fmt.fourCC != DDS_4CC_DXT2 && m_dds.fmt.fourCC != DDS_4CC_DXT3
&& m_dds.fmt.fourCC != DDS_4CC_DXT4
&& m_dds.fmt.fourCC != DDS_4CC_DXT5) {
error("Unsupported compression type");
errorf("Unsupported compression type");
return false;
}
+5 -1
View File
@@ -1,4 +1,8 @@
if (USE_DICOM AND DCMTK_FOUND)
# Copyright 2008-present Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
if (DCMTK_FOUND)
add_oiio_plugin (dicominput.cpp
INCLUDE_DIRS ${DCMTK_INCLUDE_DIR}
LINK_LIBRARIES ${DCMTK_LIBRARIES}
+15 -38
View File
@@ -1,32 +1,6 @@
/*
Copyright 2016 Larry Gritz and the other authors and contributors.
All Rights Reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the software's owners nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
(This is the Modified BSD License)
*/
// Copyright 2008-present Contributors to the OpenImageIO project.
// SPDX-License-Identifier: BSD-3-Clause
// https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
#include <OpenImageIO/fmath.h>
#include <OpenImageIO/imageio.h>
@@ -63,7 +37,10 @@ public:
DICOMInput() {}
virtual ~DICOMInput() { close(); }
virtual const char* format_name(void) const override { return "dicom"; }
virtual int supports(string_view feature) const override { return false; }
virtual int supports(string_view /*feature*/) const override
{
return false; // we don't support any optional features
}
virtual bool open(const std::string& name, ImageSpec& newspec) override;
virtual bool open(const std::string& name, ImageSpec& newspec,
const ImageSpec& config) override;
@@ -121,7 +98,7 @@ DICOMInput::open(const std::string& name, ImageSpec& newspec)
bool
DICOMInput::open(const std::string& name, ImageSpec& newspec,
const ImageSpec& config)
const ImageSpec& /*config*/)
{
m_filename = name;
m_subimage = -1;
@@ -180,7 +157,7 @@ DICOMInput::seek_subimage(int subimage, int miplevel)
m_subimage = 0;
if (m_img->getStatus() != EIS_Normal) {
m_img.reset();
error("Unable to open DICOM file %s", m_filename);
errorf("Unable to open DICOM file %s", m_filename);
return false;
}
m_framecount = m_img->getFrameCount();
@@ -188,7 +165,7 @@ DICOMInput::seek_subimage(int subimage, int miplevel)
}
if (subimage >= m_firstframe + m_framecount) {
error("Unable to seek to subimage %d", subimage);
errorf("Unable to seek to subimage %d", subimage);
return false;
}
@@ -197,7 +174,7 @@ DICOMInput::seek_subimage(int subimage, int miplevel)
m_img->processNextFrames(1);
if (m_img->getStatus() != EIS_Normal) {
m_img.reset();
error("Unable to seek to subimage %d", subimage);
errorf("Unable to seek to subimage %d", subimage);
return false;
}
++m_subimage;
@@ -237,7 +214,7 @@ DICOMInput::seek_subimage(int subimage, int miplevel)
{ EPI_YBR_Full, "YBR_Full", 3 }, /// YCbCr full
{ EPI_YBR_Full_422, "YBR_Full_422", 3 }, /// YCbCr full 4:2:2
{ EPI_YBR_Partial_422, "YBR_Partial_422", 3 }, /// YCbCr partial 4:2:2
{ EPI_Unknown, NULL }
{ EPI_Unknown, NULL, 0 }
};
int nchannels = 1;
const char* photoname = NULL;
@@ -287,7 +264,7 @@ DICOMInput::read_metadata()
DcmStack stack;
while (dcm->nextObject(stack, OFTrue).good()) {
DcmObject* object = stack.top();
ASSERT(object);
OIIO_ASSERT(object);
DcmTag& tag = const_cast<DcmTag&>(object->getTag());
std::string tagname = tag.getTagName();
if (ignore_tags.find(tagname) != ignore_tags.end())
@@ -346,7 +323,7 @@ DICOMInput::read_metadata()
bool
DICOMInput::read_native_scanline(int subimage, int miplevel, int y, int z,
DICOMInput::read_native_scanline(int subimage, int miplevel, int y, int /*z*/,
void* data)
{
lock_guard lock(m_mutex);
@@ -355,7 +332,7 @@ DICOMInput::read_native_scanline(int subimage, int miplevel, int y, int z,
if (y < 0 || y >= m_spec.height) // out of range scanline
return false;
ASSERT(m_internal_data);
OIIO_DASSERT(m_internal_data);
size_t size = m_spec.scanline_bytes();
memcpy(data, m_internal_data + y * size, size);
+2 -2
View File
@@ -2283,7 +2283,7 @@ Fixes, minor enhancements, and performance improvements:
* oiiotool --stats of "deep" files prints a histogram of samples/pixel
(1.5.6).
* oiiotool -subimage has better error detection and reporting for
requests for nonexistant subimages. #1005 (1.5.7)
requests for nonexistent subimages. #1005 (1.5.7)
* oiiotool --ch is a bit more flexible in its channel-shuffling syntax:
you are now able to say newchannel=oldchannel, both shuffling and
renaming channels simultaneously, thus removing a frequent necessity
@@ -3310,7 +3310,7 @@ Fixes, minor enhancements, and performance improvements:
* ImageBufAlgo improvements:
* Internal overhaul of IBA::resize to greatly speed it up.
* Improve IBA::resize to handle the image edge better -- instead of
clamping, just don't consider nonexistant pixels.
clamping, just don't consider nonexistent pixels.
* More careful selection of filter when resizing (IBA::resize, oiiotool
--resize and --fit, and maketx).
* Fix IBA::paste() error when the foreground image runs off the end of
+4 -1
View File
@@ -1,7 +1,10 @@
# Copyright 2008-present Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
project(documentation)
set (public_docs
openimageio.pdf
"${OpenImageIO_SOURCE_DIR}/LICENSE.md"
"${OpenImageIO_SOURCE_DIR}/LICENSE-THIRD-PARTY.md"
"${OpenImageIO_SOURCE_DIR}/CHANGES.md"
+10 -26
View File
@@ -254,12 +254,6 @@ TAB_SIZE = 4
ALIASES = "rst=\verbatim embed:rst:leading-slashes"
ALIASES += "endrst=\endverbatim"
# This tag can be used to specify a number of word-keyword mappings (TCL only).
# A mapping has the form "name=value". For example adding "class=itcl::class"
# will allow you to use the command class in the itcl::class meaning.
TCL_SUBST =
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
# only. Doxygen will then generate output that is more tailored for C. For
# instance, some of the names that are used will be different. The list of all
@@ -900,11 +894,7 @@ RECURSIVE = YES
EXCLUDE = ../../src/include/OpenImageIO/filter.h \
../../src/include/OpenImageIO/plugin.h \
../../src/include/OpenImageIO/pugixml.cpp \
../../src/include/OpenImageIO/pugixml.hpp \
../../src/include/OpenImageIO/SHA1.h \
../../src/include/OpenImageIO/tinyformat.h \
../../src/include/OpenImageIO/fmt \
../../src/include/OpenImageIO/detail \
../../src/doc \
../../src/libOpenImageIO \
../../src/libtexture \
@@ -2167,9 +2157,17 @@ INCLUDE_FILE_PATTERNS = *.h
PREDEFINED = DOXYGEN_SHOULD_SKIP_THIS \
OIIO_NO_SANITIZE_ADDRESS:= \
OIIO_API:= \
OIIO_HOSTDEVICE= \
OIIO_NAMESPACE_BEGIN="namespace OIIO {" \
OIIO_NAMESPACE_END="}" \
OIIO_CONSTEXPR14=constexpr
OIIO_CONSTEXPR14=constexpr \
OIIO_CONSTEXPR20=constexpr \
OIIO_PURE_FUNC= \
OIIO_CONST_FUNC= \
OIIO_MAYBE_UNUSED= \
OIIO_NODISCARD=[[nodiscard]] \
OIIO_FORCEINLINE=inline
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
@@ -2236,11 +2234,6 @@ EXTERNAL_GROUPS = YES
EXTERNAL_PAGES = YES
# The PERL_PATH should be the absolute path and name of the perl script
# interpreter (i.e. the result of 'which perl').
# The default file (with absolute path) is: /usr/bin/perl.
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
@@ -2255,15 +2248,6 @@ PERL_PATH = /usr/bin/perl
CLASS_DIAGRAMS = YES
# You can define message sequence charts within doxygen comments using the \msc
# command. Doxygen will then run the mscgen tool (see:
# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the
# documentation. The MSCGEN_PATH tag allows you to specify the directory where
# the mscgen tool resides. If left empty the tool is assumed to be found in the
# default search path.
MSCGEN_PATH =
# You can include diagrams made with dia in doxygen documentation. Doxygen will
# then run dia to produce the diagram and insert it in the documentation. The
# DIA_PATH tag allows you to specify the directory where the dia binary resides.
+6 -3
View File
@@ -3,10 +3,10 @@
include ../make/detectplatform.mk
BUILDDIR := ../../build/${platform}
ifeq (${OIIOTOOL},)
ifneq (${shell ls ${BUILDDIR}/src/oiiotool/oiiotool},)
OIIOTOOL := "${BUILDDIR}/src/oiiotool/oiiotool"
ifneq (${shell ls ${BUILDDIR}/bin/oiiotool},)
OIIOTOOL := "${BUILDDIR}/bin/oiiotool"
else
OIIOTOOL := "../../build/src/oiiotool/oiiotool"
OIIOTOOL := "../../build/bin/oiiotool"
endif
endif
@@ -82,6 +82,9 @@ SPHINXBUILDDIR = ../../build/sphinx
sphinx : Makefile conf.py
# @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(SPHINXBUILDDIR)" $(SPHINXOPTS) $(O)
$(SPHINXBUILD) -b html "$(SOURCEDIR)" "$(SPHINXBUILDDIR)" $(SPHINXOPTS)
sphinxpdf : Makefile conf.py
# @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(SPHINXBUILDDIR)" $(SPHINXOPTS) $(O)
$(SPHINXBUILD) -b latex "$(SOURCEDIR)" "$(SPHINXBUILDDIR)/latex" $(SPHINXOPTS)
$(MAKE) -C $(SPHINXBUILDDIR)/latex all-pdf
# $(SPHINXBUILD) -b latexpdf "$(SOURCEDIR)" "$(SPHINXBUILDDIR)/latex" $(SPHINXOPTS)
+109 -22
View File
@@ -148,7 +148,7 @@ DPX files use the file extension :file:`.dpx`.
**Configuration settings for DPX input**
When opening a DPX ImageInput with a *configuration* (see
Section~\ref{sec:inputwithconfig}), the following special configuration
Section :ref:`sec-inputwithconfig`), the following special configuration
options are supported:
.. list-table::
@@ -375,7 +375,7 @@ Field3d files, and does not write them.
Fields are comprised of multiple *layers* (which appear to OpenImageIO
as subimages). Each layer/subimage may have a different name, resolution,
and coordinate mapping. Layers may be scalar (1 channel) or vector (3
channel) fields, and the data may be ``half``, ``float``, or ``double``.
channel) fields, and the data may be ``half``, `float`, or ``double``.
OpenImageIO always reports Field3D files as tiled. If the Field3d file has
a "block size", the block size will be reported as the tile size. Otherwise,
@@ -551,10 +551,10 @@ preferred except when legacy file access is required.
- RGBE header data or explanation
* - ``Orientation``
- int
- encodes the orientation (see Section \ref{metadata:orientation})
- encodes the orientation (see Section :ref:`sec-metadata-orientation`)
* - ``oiio:ColorSpace``
- string
- Color space (see Section `Color information metadata`_).
- Color space (see Section :ref:`sec-metadata-color`).
* - ``oiio:Gamma``
- float
- the gamma correction specified in the RGBE header (if it's gamma corrected).
@@ -726,14 +726,14 @@ anywhere near the acceptance of the original JPEG/JFIF format.
-
- Extensive Exif, IPTC, XMP, and GPS data are supported by the
reader/writer, and you should assume that nearly everything described
Appendix~\ref{chap:stdmetadata} is properly translated when using
Appendix :ref:`chap-stdmetadata` is properly translated when using
JPEG files.
**Limitations**
* JPEG/JFIF only supports 1- (grayscale) and 3-channel (RGB) images. As a
special case, OpenImageIO's JPEG writer will accept $n$-channel image
special case, OpenImageIO's JPEG writer will accept n-channel image
data, but will only output the first 3 channels (if n >= 3) or the first
channel (if n <= 2), silently drop any extra channels from the output.
* Since JPEG/JFIF only supports 8 bits per channel, OpenImageIO's
@@ -819,6 +819,12 @@ Some special attributes are used for movie files:
* - ``oiio:Movie``
- int
- Nonzero value for movie files
* - ``oiio:subimages``
- int
- The number of frames in the movie, positive if it can be known
without reading the entire file. Zero or not present if the number
of frames cannot be determinend from reading from just the file
header.
* - ``FramesPerSecond``
- int[2] (rational)
- Frames per second
@@ -877,7 +883,7 @@ OpenEXR
OpenEXR is an image file format developed by Industrial Light & Magic,
and subsequently open-sourced. OpenEXR's strengths include support of
high dynamic range imagery (``half`` and ``float`` pixels), tiled
high dynamic range imagery (``half`` and `float` pixels), tiled
images, explicit support of MIPmaps and cubic environment maps,
arbitrary metadata, and arbitrary numbers of color channels. OpenEXR
files use the file extension :file:`.exr`.
@@ -903,6 +909,9 @@ The official OpenEXR site is http://www.openexr.com/.
- matrix
- worldToCamera
* - ``worldtoscreen``
- matrix
- worldToScreen
* - ``worldtoNDC``
- matrix
- worldToNDC
* - ``ImageDescription``
@@ -973,7 +982,7 @@ The official OpenEXR site is http://www.openexr.com/.
**Configuration settings for OpenEXR input**
When opening an OpenEXR ImageInput with a *configuration* (see
Section~\ref{sec:inputwithconfig}), the following special configuration
Section :ref:`sec-inputwithconfig`), the following special configuration
attributes are supported:
.. list-table::
@@ -1024,7 +1033,7 @@ control aspects of the writing itself:
OpenEXR input and output both support the "custom I/O" feature via the
special ``"oiio:ioproxy"`` attributes (see
Sections~\ref{sec:imageoutput:ioproxy} and \ref{sec:imageinput:ioproxy}).
Sections :ref:`sec-imageoutput-ioproxy` and :ref:`sec-imageinput-ioproxy`).
**A note on channel names**
@@ -1061,7 +1070,7 @@ does not write them.
Volumes are comprised of multiple *layers* (which appear to OpenImageIO as
subimages). Each layer/subimage may have a different name, resolution, and
coordinate mapping. Layers may be scalar (1 channel) or vector (3 channel)
fields, and the voxel data are always ``float``. OpenVDB files always
fields, and the voxel data are always `float`. OpenVDB files always
report as tiled, using the leaf dimension size.
.. list-table::
@@ -1130,7 +1139,7 @@ files use the file extension :file:`.png`.
- resolution and units from the PNG header.
* - ``oiio:ColorSpace``
- string
- Color space (see Section `Color information metadata`_).
- Color space (see Section :ref:`sec-metadata-color`).
* - ``oiio:Gamma``
- float
- the gamma correction value (if specified).
@@ -1141,7 +1150,7 @@ files use the file extension :file:`.png`.
**Configuration settings for PNG input**
When opening an PNG ImageInput with a *configuration* (see
Section~\ref{sec:inputwithconfig}), the following special configuration
Section :ref:`sec-inputwithconfig`), the following special configuration
attributes are supported:
.. list-table::
@@ -1173,6 +1182,19 @@ control aspects of the writing itself:
* - Output Configuration Attribute
- Type
- Meaning
* - ``png:compressionLevel``
- int
- Compression level for zip/deflate compression, on a scale from 0
(fastest, minimal compression) to 9 (slowest, maximal compression).
The default is 6. PNG compression is always lossless.
* - ``png:filter``
- int
- Controls the "row filters" that prepare the image for optimal
compression. The default is 0 (``PNG_NO_FILTERS``), but other values
(which may be "or-ed" or summed to combine their effects) are 8
(``PNG_FILTER_NONE``), 16 (``PNG_FILTER_SUB``), 32
(``PNG_FILTER_UP``), 64 (``PNG_FILTER_AVG``), or 128
(``PNG_FILTER_PAETH``).
* - ``oiio:ioproxy``
- ptr
- Pointer to a ``Filesystem::IOProxy`` that will handle the I/O, for
@@ -1185,7 +1207,7 @@ control aspects of the writing itself:
**Custom I/O Overrides**
PNG output supports the "custom I/O" feature via the special
``"oiio:ioproxy"`` attributes (see Section~\ref{sec:imageoutput:ioproxy}).
``"oiio:ioproxy"`` attributes (see Section :ref:`sec-imageoutput-ioproxy`).
**Limitations**
@@ -1261,7 +1283,7 @@ write PSD files.
**Configuration settings for PSD input**
When opening an ImageInput with a *configuration* (see
Section~\ref{sec:inputwithconfig}), the following special configuration
Section :ref:`sec-inputwithconfig`), the following special configuration
options are supported:
.. list-table::
@@ -1337,7 +1359,7 @@ plugin that is based on the LibRaw library (http://www.libraw.org/).
**Configuration settings for RAW input**
When opening an ImageInput with a *configuration* (see
Section~\ref{sec:inputwithconfig}), the following special configuration
Section :ref:`sec-inputwithconfig`), the following special configuration
options are supported:
.. list-table::
@@ -1370,6 +1392,13 @@ options are supported:
decoding the raw image. The default (1,1) means to perform no
correction. This is an overall spatial scale, sensible values will be
very close to 1.0.
* - ``raw:half_size``
- int
- If nonzero, outputs the image in half size. (Default: 0)
* - ``raw:user_mul``
- float[4]
- Sets user white balance coefficients. Only applies if ``raw:use_camera_wb``
is not equal to 0.
* - ``raw:ColorSpace``
- string
- Which color primaries to use: ``raw``, ``sRGB``, ``Adobe``, ``Wide``,
@@ -1476,7 +1505,7 @@ software developed at Wavefront. RLA files commonly use the file extension
- white point XY (vec2) or XYZ (vec3) coordinates.
* - ``oiio:ColorSpace``
- string
- Color space (see Section `Color information metadata`_).
- Color space (see Section :ref:`sec-metadata-color`).
* - ``oiio:Gamma``
- float
- the gamma correction value (if specified).
@@ -1499,7 +1528,7 @@ SGI
The SGI image format was a simple raster format used long ago on SGI
machines. SGI files use the file extensions ``sgi``, ``rgb``, ``rgba``,
``bw``, ``int``, and ``inta``.
``bw``, `int`, and ``inta``.
The SGI format is sometimes used for legacy apps, but has little merit
otherwise: no support for tiles, no MIPmaps, no multi-subimage, only 8- and
@@ -1610,7 +1639,7 @@ http://www.dca.fee.unicamp.br/~martino/disciplinas/ea978/tgaffs.pdf
- the true bits per sample of the PIC file.
* - ``oiio:ColorSpace``
- string
- Color space (see Section `Color information metadata`_).
- Color space (see Section :ref:`sec-metadata-color`).
* - ``oiio:Gamma``
- float
- the gamma correction value (if specified).
@@ -1636,6 +1665,64 @@ is the total number of channel samples in the thumbnail).
than 4 color channels.
|
.. _sec-bundledplugins-term:
Term (Terminal)
===============================================
This *experimental* output-only "format" is actually a procedural output
that writes a low-res representation of the image to the console output. It
requires a terminal application that supports Unicode and 24 bit color
extensions.
The `term` ImageOutput supports the following special metadata tokens to
control aspects of the writing itself:
.. list-table::
:widths: 30 10 65
:header-rows: 1
* - Output Configuration Attribute
- Type
- Meaning
* - ``term:method``
- string
- May be one of `iterm2`, `24bit` (default), `24bit-space`, `256color`,
or `dither`.
* - ``term:fit``
- int
- If 1 (the default), the image will be resized to fit on the console
window.
The `iterm2` mode is the best quality and is the default mode when actually
running on a Mac and launching using iTerm2 as the terminal. This mode uses
iTerm2's nonstandard extension to directly output an pixel array to be
visible in the terminal.
The default in other circumstances is the `24bit` mode, which displays two
approximately square pixels vertically in each character cell, by outputting
the Unicode "upper half block" glyph (`\u2508`) with the foreground color
set to the top pixel's color and the background color set to the bottom
pixel's color.
If this doesn't look right, or your terminal doesn't support Unicode,
the `24bit-space` is an alternate mode that displays one elongated pixel
in each character cell, writing a space character with the correct color.
There's also a `256color` method that just uses the 6x6x6 color space in the
256 color palette -- which looks horrible -- and an experimental `dither`
which does a half-assed Floyd-Steinberg dithering, horizontally only, and
frankly is not an improvement unless you squint really hard. These may
change or be eliminted in the future.
In all cases, the image will automatically be resized to fit in the terminal
and keep approximately the correct aspect ratio, as well as converted to
sRGB so it looks kinda ok.
|
.. _sec-bundledplugins-tiff:
@@ -1677,7 +1764,7 @@ metadata if present.
**Configuration settings for TIFF input**
When opening an ImageInput with a *configuration* (see
Section~\ref{sec:inputwithconfig}), the following special configuration
Section :ref:`sec-inputwithconfig`), the following special configuration
options are supported:
.. list-table::
@@ -1725,7 +1812,7 @@ aspects of the writing itself:
is 1.)
* - ``tiff:half``
- int
- If nonzero, allow writing TIFF files with `half' (16 bit float)
- If nonzero, allow writing TIFF files with `half` (16 bit float)
pixels. The default of 0 will automatically translate to float
pixels, since most non-OIIO applications will not properly read half
TIFF files despite their being legal.
@@ -1901,10 +1988,10 @@ aware of:
- SubfileType
* - ``Exif:*``
-
- A wide variety of EXIF data are honored, and are all prefixed with ``Exif:}.
- A wide variety of EXIF data are honored, and are all prefixed with `Exif`.
* - ``oiio:BitsPerSample``
- int
- The actual bits per sample in the file (may differ from {\cf ImageSpec::format}).
- The actual bits per sample in the file (may differ from `ImageSpec::format`).
* - ``oiio:UnassociatedAlpha``
- int
- Nonzero if the alpha channel contained "unassociated" alpha.
+53 -10
View File
@@ -1,3 +1,5 @@
#!/usr/bin/env python3
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
@@ -14,23 +16,44 @@
# import sys
# sys.path.insert(0, os.path.abspath('.'))
from __future__ import absolute_import
import sys
import os
import shlex
import subprocess
# -- Project information -----------------------------------------------------
# The master toctree document.
master_doc = 'index'
default_role = 'code'
project = 'OpenImageIO'
copyright = 'Contributors to OpenImageIO'
copyright = '2008-present, Contributors to OpenImageIO'
author = 'Larry Gritz'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
version = '2.1'
# The full version, including alpha/beta/rc tags.
release = '2.1.1'
# LG addition: we search for it in the CMakeLists.txt so we don't need to
# keep modifying this file:
version = '0.0'
release = '0.0.0'
import re
version_regex = re.compile(r'project .* VERSION ((\d+\.\d+)\.\d+)')
f = open('../../CMakeLists.txt')
for l in f:
aa=re.search(version_regex, l)
if aa is not None:
release = aa.group(1)
version = aa.group(2)
break
f.close()
print ("OIIO docs version = {}, release = {}".format(version, release))
# -- General configuration ---------------------------------------------------
@@ -38,13 +61,19 @@ release = '2.1.1'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
# add custom extensions directory to python path
sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(__file__)), 'extensions/sphinxtr'))
sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(__file__)), '../../ext/breathe'))
#import html_mods
#import latex_mods
extensions = [
#'sphinx.ext.pngmath',
#'sphinx.ext.todo',
'breathe' ]
'breathe',
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ['templates']
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
@@ -57,7 +86,8 @@ exclude_patterns = []
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
# html_theme = 'alabaster'
#html_theme = 'alabaster'
#html_theme = 'astropy-sphinx-theme'
html_theme = 'sphinx_rtd_theme'
# Add any paths that contain custom static files (such as style sheets) here,
@@ -70,6 +100,19 @@ html_static_path = ['_static']
breathe_projects = { "oiio": "../../build/doxygen/xml" }
breathe_default_project = "oiio"
breathe_domain_by_extension = {'h': 'cpp'}
breathe_default_members = ()
primary_domain = 'cpp'
highlight_language = 'cpp'
read_the_docs_build = os.getenv('READTHEDOCS') == 'True'
if read_the_docs_build:
print ("cwd =", os.getcwd())
print ("checkpoint -- rtd build")
if not os.path.exists('../../build/doxygen') :
os.makedirs ('../../build/doxygen')
print ("checkpoint 2 -- rtd build")
subprocess.call('echo "Calling Doxygen"', shell=True)
subprocess.call(['doxygen'], shell=True)
subprocess.call('echo "Ran Doxygen"', shell=True)
+32
View File
@@ -0,0 +1,32 @@
:orphan:
.. only:: not latex
Copyright Notice
----------------
The code that implements OpenImageIO is licensed under the BSD 3-clause
(also sometimes known as "new BSD" or "modified BSD") license
(https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md):
|
.. include:: ../../LICENSE.md
|
This manual and other text documentation about OpenImageIO
are licensed under the Creative Commons Attribution 3.0
Unported License.
.. image:: figures/CC-30BY.png
http://creativecommons.org/licenses/by/3.0/
|
OpenImageIO incorporates code from several other software packages with
compatible licenses. Copies of their licenses are reproduced here:
https://github.com/OpenImageIO/oiio/blob/master/LICENSE-THIRD-PARTY.md
+1 -2
View File
@@ -8,8 +8,7 @@ documentation are:
\vspace*{0.2in}
\noindent Copyright (c) 2008-2019 Larry Gritz, et al.
All Rights Reserved.
\noindent Copyright \textcopyright\ Contributors to the OpenImageIO project.
\vspace{0.5in}

Some files were not shown because too many files have changed in this diff Show More