Compare commits

...
590 Commits
Author SHA1 Message Date
Larry Gritz 931d3e107f Bump version for developer preview 2022-03-08 22:46:54 -08:00
Anthony Nemoff 5da21b0cc6 Add UDIM pattern <uvtile> (in lower-case) (#3358)
* Add UDIM pattern `<uvtile>` (in lower-case)

This UDIM pattern is equivalent to `u<u>_v<v>`.
See also #3280.

References:
- Clarisse: https://clarissewiki.com/5.0/image-maps-texture.html
- V-Ray: https://docs.chaos.com/display/VMAYA/File+Names+for+Bitmap+Textures

* LG Updated test and ref output
2022-03-08 22:44:11 -08:00
Larry Gritz 8cb1e4ec38 Beef up precision in computePixelStats (#3353)
We should have been doing this particular multiplication as doubles, and
in just a couple spots, it slightly changes the answer.
2022-03-08 22:43:31 -08:00
Larry Gritz 22486c4815 Fix broken iinfo --stats (#3352)
Inadvertently broken by PR 3328.
2022-03-08 22:37:58 -08:00
Larry Gritz 4260a7cc81 Track down some integer overflow warnings (#3329) 2022-02-19 09:31:11 -08:00
Larry Gritz 4f1398a689 CHANGES and bump version for developer preview 2022-02-18 10:04:33 -08:00
Larry Gritz e800c05dfd oiiotool --warp improvements (#3341)
* New "wrap" optional modifier lets you specify which wrap mode to pass
  to IBA::warp().

* fix typo in error message.
2022-02-17 23:37:00 -08:00
Larry Gritz a53399deb5 oiiotool --pixelaspect : fix setting of attributes (#3340)
We weren't doing quite the right calls to set the attributes correctly
after performing the scale.
2022-02-17 23:36:31 -08:00
Larry Gritz 31b643a02f Testing: OIIO_CHECK_SIMD_EQUAL_THRESH to use <= eps (#3333) 2022-02-16 20:15:57 -08:00
Larry Gritz 1fad2a89dc Imath fiddling (#3339)
Make the imath includes respect the recently added
OPENIMAGEIO_IMATH_DEPENDENCY_VISIBILITY flag, just like the libraries
do.
2022-02-16 20:15:40 -08:00
Larry Gritz 00c09106fe Hide static library dependency symbols from the python module (#3338)
Just like we had done for the other libraries recently. And need
to make sure that the imath libs are added explicitly to the python
module's needs, since for hidden static libraries, they will not get
picked up merely by linking to libOpenImageIO.
2022-02-15 14:38:52 -08:00
Larry Gritz 4323093bdb CI: bump OpenEXR version used for 'latest' (#3336)
Also, for the bleeding edge test, OpenEXR's "master" has been renamed
to "main".
2022-02-12 14:50:24 -08:00
Larry Gritz a2e1ccd7d2 More Imath hiding controls (#3335)
Add an OIIO build-time option for forcing our exported
OpenImageIOConfig.cmake to skip the find_dependency of Imath and
OpenEXR.

This is helpful if you're at a site that is trying to build OIIO
against statically compiled Imath/OpenEXR, and want to be super sure
the downstream projects are definitely not going to encounter that
find_dependency(Imath) when the read the OIIO config files.
(They could do their own `-DOPENIMAGEIO_CONFIG_DO_NOT_FIND_IMATH`,
but I want even that to be unnecessary.)
2022-02-11 19:03:30 -08:00
Larry Gritz 4a345ad77e Bump developer preview version to 2.4.0.2 2022-02-10 22:21:48 -08:00
Larry Gritz 620cec2b5b CHANGES 2022-02-10 22:21:48 -08:00
Bernhard Rosenkraenzer e8bd39f078 Port to ffmpeg 5.0 (#3282)
Port to ffmpeg 5.0 -- av_register_all removed, AVPicture
removed, pkt_pts changed to pts

Signed-off-by: Bernhard Rosenkränzer <bero@lindev.ch>
2022-02-10 22:17:47 -08:00
Larry Gritz 54019aef35 Docs touchups
* Change example of set_write_tiles so that it uses a tile size I would
  more strongly recommend. (Very minor nit.)
2022-02-10 14:10:12 -08:00
Larry Gritz a07cb917ba Reduce Imath footprint even more (#3332)
There was that one pesky place where we were still including Imath
headers, from simd.h in the case where OIIO_SIMD==0 and we wanted to
fall back on some Imath::Matrix methods.

Ugh, but this backfired because when including this file from Cuda,
OIIO_SIMD==0 and it included the header. But what happens if a
downstream app (a) includes this file from Cuda, and (b) uses a
DIFFERENT Imath (so names clash) or doesn't want to use Imath at all?

So one more change:

* Remove the include of Imath.h from simd.h entirely.

* Most places where we fell back on the Imath::Matrix methods, just
  replace it with scalar code, it's not complicated. (For some technical
  reasons, this required some minor surgery on the matrix44 class, but
  not anything that changes anything from a caller's point of view.)

* The one complicated case is matrix44::inverse(). Punt! Just let that
  only be implemented if either (a) there is SIMD available, or (b)
  there is Imath available (i.e., included by the downstream code
  prior to this header). That's it. If you want to invert a 4x4 matrix
  without SIMD, you need to arrange inclusion of the correct
  ImathMatrix.h yourself before including this header.
2022-02-10 14:00:46 -08:00
Larry Gritz fd8bdbcfaf Add texture creation metadata: "handed" (#3331)
For vector displacement maps or normal maps that are in tangent space,
it is heplful to be able to record whether the data are intended to use
a local left-handed or right-handed coordinate system, and for that to
be querably from the shader accessing the map.

The `maketx --handed` option, or `oiiotool -attrib -otex:handed=...`,
or adding "handed" metadata to the configuration ImageSpec being
passed to `IBA::make_texture()` does this. It's easy for texture
formats like openexr that allow arbitrary metadata. For TIFF textures,
we embed it in the ImageDescription tag (as we do for several other
texture-specific hints).
2022-02-08 11:26:43 -08:00
jreichel-nvidia 475cf1eccd Targa: Fix parsing of TGA 2.0 extension area. (#3323)
Skip 3 bytes between "software" and "background (key) colour" for the "software
version" (was simply missing). Avoids that m_alpha_type is overwritten with
wrong values.
2022-02-08 10:17:13 -08:00
Larry Gritz f482be2d6a Update THIRD-PARTY info for OSL and OCIO with new URLs and copyright notices 2022-02-06 17:17:48 -08:00
Larry Gritz cc8b41b669 Split fmt setup into detail/fmt.h, fix fmt ostream problem (#3327)
The very latest fmt master changes a behavior: fmt functions no longer
automatically know how to format any type that can output to an
ostream, and instead need custom formtter objects. This breaks A LOT.
Fix by defining the preprocessor symbol `FMT_DEPRECATED_OSTREAM`,
which restores the old behavior (for now, at least).

While I was at it, I moved the fmt inclusion logic out of strutil.h
and into a new separate header, detail/fmt.h. This is in turn included
from strutil.h, so nothing in user code needs to change.
2022-02-06 17:12:06 -08:00
Larry Gritz 91f519ecfd Handle NUL (0) characters in ustrings by truncating. (#3326)
It turns out that this can crop up all the time, sometimes from
malformed metadata inside image files. We weren't noticing it because
in many cases, things ended up being turned into ustrings twice, and
the sequence string-with-nuls -> ustring() -> c_str() -> ustring()
will launder it. As I was tracking down and eliminating some of the
double ustring constructions, the metadata strings that were malformed
all along started becoming symptomatic.

Bad paradoxes follow from a ustring contain embedded NUL characters,
including ustring.c_str() and ustring.string() being different
character sequences, as well as ustring.hash() not being equal to
strhash(ustring.c_str()). One should definitely be able to count on
ustring(cstring) == ustring(ustring(cstring).c_str()).

So this patch checks for embedded NUL characters at the appropriate
time of ustring construction, and truncates the character sequence at
the point of any internal NUL character.
2022-02-06 17:11:48 -08:00
Larry Gritz 52f7c40b57 CMake: Remove redundant include of GNUInstallsDirs (#3325) 2022-02-06 17:11:26 -08:00
Larry Gritz 1921787fed Changes to make it easier to hide the Imath dependency (#3322)
* `OPENIMAGEIO_IMATH_DEPENDENCY_VISIBILITY` is a new CMake cache
  variable at OIIO build time that controls whether the Imath library
  dependencies will be declared as PUBLIC (default) or PRIVATE target
  dependencies of libOpenImageIO and libOpenImageIO_Util.

* For *downstream projects* that consume OIIO's exported cmake config
  files, setting CMake variable `OPENIMAGEIO_CONFIG_DO_NOT_FIND_IMATH`
  to true will skip the find_depencency() calls for Imath and OpenEXR.
  To clarify, this is not a variable that has any effect when building
  OIIO, it's something set in the downstream project itself.

* Add a `OIIO_IMATH_H_INCLUDED` header guard in OpenImageIO/Imath.h,
  which allows something downstream to pre-define it to prevent OIIO
  headers it needs to read from using the contents of that header.

Most builders of OIIO won't care and shouldn't change the defaults or
use any of these.  But here's the specific case it addresses: If you
are building OIIO against static libraries of Imath & OpenEXR, but the
libOpenImageIO will be consumed by a downstream project that wants to
use a different Imath version, this can help you avoid some build-time
conflicts in the downstream project.
2022-02-06 17:11:02 -08:00
Larry Gritz 5dd4cb224f Color space adjustment for PPM and PNG files. (#3321)
PPM by specification is Rec709! Make it so.

PNG files were getting marked as sRGB or Gamma if certain header
attributes were found in the file, but if they were absent, we didn't
designate a color space at all. Change so that the default assumes
sRGB, in the absence of any metadata telling us for sure.

Fixes #3084
2022-02-05 11:25:22 -08:00
Larry Gritz c6f9d40135 Expose additional OCIO utility functions via ColorConfig (#3319) 2022-02-02 13:21:25 -08:00
Daniel Flehner Heenanddaniel aef4227aed update example and definition to match C++ (#3320)
Co-authored-by: daniel <daniel@stormstudios.no>
2022-02-02 13:20:19 -08:00
Larry Gritz afd1d31d80 Correction to recent wstring changes: un-virtualize one method (#3318)
One new method that should have been inline and non-virtual (so that
this whole set of changes does not change ABI by shifting the vtable
around) was accidentally marked virtual -- cut and paste error. This
patch fixes it to restore ABI compatibility.
2022-02-01 22:37:43 -08:00
Larry Gritz d1a3d279ef TIFF: Mitigate IPTC corruptions (#3316)
IPTC data blocks seems buggy, and I don't know why. Our code?
Something in libtiff?  Since nobody is depending on it and none of our
testsuite appears to fail when disabled, only write the IPTC block if
the user explicitly asks for it.  Also, when reading them, don't
overwrite other metadata of the same name.
2022-01-31 09:38:21 -08:00
Merwan Achibet c8dfbd7066 Relocatable cmake package (#3302)
CMake: use relative paths in the config script
2022-01-31 09:35:34 -08:00
Larry Gritz ca75260255 Work toward eliminating string_view::c_str() (#3315)
We wrote our string_view before C++17 std::string_view was finalized,
and the std one doesn't have a c_str() method. For conformance with the
standard, I want to remove this over time from ours.

Part 1: There were some places we did not need to call c_str() at all,
and some places where it was much more appropriate to just use a
std::string.
2022-01-30 08:21:15 -08:00
Larry Gritz 2b01dd3350 string_view: beef up tests of constructors (#3314) 2022-01-30 08:20:47 -08:00
Larry Gritz 2b453321b7 wstring (almost) all the things (#3312)
As Doug Rogers points out in Issue 3304, it is customary for Windows
applications to use wstring extensively for Unicode support. But it's
especially critical for unicode filenames, because unlike Unix-like
OS's where fopen() and similar functions support UTF-8, on Windows
those functions are strictly ASCII, and Windows users are used to
calling _wfopen() and other nonstandard functions that expect
filenames to be std::wstring if they want to support Unicode.

This patch:

* More clearly documents through all of our classes when parameters that
  represent filenames or searchpaths are assumed to support UTF-8.

* Augments ImageInput, ImageOutput, and ImageBuf so that their methods
  that take file names or path lists have additional flavors that take
  wstring (always implemented as an inline shim that translates the
  UTF-16 wstring to a std::string with UTF-8 encoding to pass on to the
  usual method).

* Augments ImageCache and TextureSystem in just a couple places, the
  functions where a filename is turned into a handle. All the many
  other functions that take ustring for function names were left alone,
  because they are called very frequently and are performance-sensitive,
  so we don't want any translation from wstring to string happening on
  every call.

We do not attempt to add wstring-based versions of functions that take
strings for other purposes -- that is, that are not intended to
represent filenames.
2022-01-29 08:56:24 -08:00
Larry Gritz ac46f1f7f1 Avoid unsafe isspace() (#3310)
C isspace() takes an int, but on Windows when building in debug mode,
the implementation of isspace() can hit an assert if the value is < 0,
which of course it can be if you're looking at a character in a string
whose high bit is set (because char is signed).

Easiest solution is to make our own Strutil::isspace that does exactly
what we want and is safe.

Fixes #3300
2022-01-28 21:29:11 -08:00
Larry Gritz 8eb2c6a9da Embed Imath version symbols in oiioversion.h (#3305)
This makes sure that two new preprocessor symbols are defined in
oiioversion.h: `OIIO_USING_IMATH_VERSION_MAJOR` and
`OIIO_USING_IMATH_VERSION_MINOR`, revealing the version of Imath being
used by the build of OIIO (which may not be the same as the version
found or being used by the app that's calling OIIO). They also get
defined as CMake variables in our exported cmake configs, allowng
downstream cmake build systems to be able to easily test whether the
Imath they found is compatible with the version that we use in our
APIs.
2022-01-28 14:32:26 -08:00
Larry Gritz 71f0aa6a58 Hide Imath headers and types from most of the public API (#3301)
This patch sets out to minimize the extent to which Imath is a
necessary source dependency for using OIIO C++ header files and
APIs. The major changes are:

* Remove the unconditional `#include <OpenImageIO/Imath.h>` from
  fmath.h and simd.h. Those forced Imath headers on nearly all all
  code that uses OIIO's public APIs, whether or not they needed the
  very few calls where Imath types are used as parameters.

* Make sure all public OIIO non-virtual methods and freestanding
  functions that have Imath types as parameters are enclosed in header
  guards like `#ifdef INCLUDE_IMATHVECTOR_H`. Downstream client code
  needs to include Imath headers before including OIIO headers, if
  they want to call those few particular functions.

This means that client applications who don't need those particular
functions, but call other parts of the OIIO APIs, don't need to
`#include` any Imath headers (or pay the extra compilation time for
doing so), and don't need any knowledge of which specific version of
Imath is used by the OIIO they are using.

The small number of public API calls that will no longer be visible
downstream unless the client code also include Imath headers (before
the OIIO headers) are:

  - color.h: ColorConfig::createMatrixTransform (needs ImathColor.h)

  - fmath.h: type conversions involving `half` (needs half.h).

  - imagebufalgo.h: warp(), colormatrixtransform() (needs ImathMatrix.h)

  - simd.h: conversions between our SIMD types and Imath types (Vec3,
    Matrix33, Matrix44) and vtransform() calls involving those types
    (requires ImathVec.h and ImathMatrix.h), and SIMD load/store
    involving `half` data (requires half.h).

These changes necessitated adding including of Imath.h in a number of
internal .cpp files, the ones where those types are actually used.

The following header files do still unconditionally reference Imath
types or headers:

  - texture.h: Some virtual methods of TextureSystem use Imath types
    as parameters.
  - imagebufalgo_util.h: For `half` support. We use this a lot
    internally, but presume most client code never uses this header.
  - simd.h, ONLY IF USE_SIMD=0 (which is generally only used for
    development debugging and if porting to obscure platforms that are
    neither x86 nor ARM).

The bottom line is that the vast majority of downstream callers of OIIO
APIs who need ImageInput/ImageOutput, ImageBuf, ImageBufAlgo, and
generally everything in the OpenImageIO_Util library, do not need to
use Imath types, include Imath headers, or even be aware of which Imath
release OIIO is using.

Why would we do all this?

Because this paves the way for optionally building OIIO to link against
static libraries for OpenEXR and Imath, essentially embedding and
completely hiding an OpenEXR/Imath inside libOpenImageIO.

That allows libOpenImageIO to use the very latest Imath (3.1, say,
with the new faster core API), even though that libOpenImageIO is
being consumed by an application that for whatever reason is forced to
use an entirely different (older) OpenEXR or Imath library.  In other
words, it lets OIIO use OpenEXR/Imath fully embedded without
transitively passing that OpenEXR version as a downstream dependency
(except for the few use cases that need to call the tiny number of
OIIO API methods that require Imath types.

There is a small chance that client code that use Imath types and
SHOULD have been includeing Imath headers themselves actually omitted
those includes and dependd on the fact that certain OIIO headers
included them.  Now that they don't, it may require the client-side
code to add those includes. I'm going to claim that this is a "bug" in
the client code (they didn't include a header that defined a type they
used), and not a breaking incompatibility in OIIO's public calls
themselves. Thus, I feel comfortable with these changes being in OIIO
2.4 (today's master) and not necessitating a 3.0 release (in which
arbitrary loss of backward compatibility would be allowed). So watch
out for the occasional need for OIIO-calling code to need to add an
`#include` for Imath types the code was always using, but neglected
to explicitly include.
2022-01-28 13:04:40 -08:00
Larry Gritz 22a67bd24d CI: revise failed build artifact storage to capture cmake files (#3311) 2022-01-27 16:52:22 -08:00
Larry Gritz a7bd12b565 utf8 / utf16 conversion modernization. (#3307)
Our Strutil utilities for utf8 <-> utf16 conversion were based on
Windows specific calls that we had added even before C++11 was our
minimum. Replace the Windows-specific code with std calls, and
expose them in strutil.h for all platforms (why not?).
2022-01-26 20:33:50 -08:00
Larry Gritz cbd0917d03 Filesystem::searchpath_split handle empty paths (#3306)
Fixes #3274
2022-01-25 15:45:31 -08:00
Larry Gritz 7a4f0221cf Separate C++ that we build with from what we demand downstream (#3288)
We were passing along, in the exported cmake config files, a demand
for downstream clients to use a C++ standard version equal to that
which we used to build OpenImageIO itself. But that's not
necessary. We may choose to build with C++17 (for example), but all of
our public APIs are safe to use for C++14.

Split the build-time options to CMAKE_CXX_STANDARD for the standard we
build this project with, and DOWNSTREAM_CXX_STANDARD for the standard
we are declaring is the minimum to *use* the library.
2022-01-23 23:10:18 -08:00
Larry Gritz 7babbbfe79 Targa improvements: attribs, unassociated alpha handling, and more (#3279)
The main event:

* Assume that for a TGA 1.0 file (too old to have the header field
  that says if alpha is associated, unassociated, or meaningless), if
  the alpha is zero everywhere, it means that it's meaningless, not
  unassociated, so in that case we should skip the
  auto-premultiplication. (See issue 3277)

Public-ish stuff:

* Be more consistent with Targa-specific attributes all being called
  "targa:foo" (most were, but one was "tga:alpha_type").
* Document all the targa-specific attributes (a few were not).
* Add "targa:version" to reveal whether the file was a TGA 1.0 or
  2.0 version of the format.

Internal stuff, opportunistic:

* Some more minor conversions of string fomatting to fmt style.
* Convert some std::cerr debugging code (commented out) to the DBG macro
  we use anywhere.
* The `std::unique_ptr<uint8_t> m_buf` should always have been
  `unique_ptr<uint8_t[]>` because it's not a pointer to a single value.
2022-01-23 23:09:38 -08:00
Larry Gritz dc223d93c9 simd.h: more guards for Cuda are necessary (#3292) 2022-01-20 15:54:44 -08:00
Larry Gritz fc793ee786 oiiotool --ch : warn for unknown channels (#3290)
I realized recently that if you said something like

    oiiotool foo.exr --ch R,G,B,A -o out.exr

and there was no "A" channel... it would just silently fill the channel
with 0 in the output.

This patch adds a warning if --ch is told to copy a channel that doesn't
exist in the input.
2022-01-20 09:16:15 -08:00
Larry Gritz f22b1f7755 TIFF: Special hint to suppress output of EXTRASAMPLES tag (#3289)
Ugh, there's a situation where PhotoShop is misinterpreting an alpha
channel for certain OIIO-written TIFF files, but it's fine with some that
came from elsewhere, and the only thing that appears to be different is
that the non-OIIO one entirely lacks the EXTRASAMPLES TIFF tag.

So I'm adding an option (use with extreme caution) allowing you to
tell the TIFF output to not output this tag, even though clearly it
should be.
2022-01-20 09:16:01 -08:00
Larry Gritz 10a35e2d55 simd.h: when compiling with Cuda, don't include intrinsic headers (#3291) 2022-01-20 09:15:49 -08:00
Larry Gritz 2714b71bb5 TIFF: gracefully handle missing ExtraSamples tag (#3287)
Some rogue app out there is writing 4-channel TIFF files without the
ExtraSamples tag in the header that explains that the data is a valid
alpha channel.

We were using TIFFGetFieldDefaulted to retrieve this tag, and guess what?
The defaulted behavior changed between libtiff 4.0 and 4.3!

Changing to TIFFGetField actually turns out to fall back to the right
logic on our side, which boils down to assuming a 4th channel is alpha
if there's no other information. That seams reasonable -- RGB + mystery
channel is almost certainly RGBA.
2022-01-19 15:00:31 -08:00
Larry Gritz aa81e78006 Clarify UDIM docs (#3285) 2022-01-18 22:53:05 -08:00
Larry Gritz 35cb6a83e2 Add UDIM pattern <UVTILE> (specified by MaterialX) (#3280)
MaterialX documents a udim pattern that we hadn't previously supported,
`<UVTILE>`, which is equivalent to our `<U>_<V>`.

Fixes #3275
2022-01-17 11:25:00 -08:00
Merwan Achibet 0f1d5caf64 Fix OpenEXR build script for Windows (#3281) 2022-01-17 10:01:26 -08:00
Larry Gritz c2a41fc35e Minor build and compile fixes (#3278)
* Bugs fixed in build_opencolorio.bash, it botched some of the directory
  choices when customizing where to place and build it. Also, switch to
  the more standard BUILD_SHARED_LIBS cmake variable to control whether
  to build dynamic or static libraries.

* Correctly handle the cmake variable VISIBILITY_MAP_FILE being set to
  "" on the command line as a way to disable using the visibility map file
  entirely.

* FindOpenColorIO.cmake changes:
    - Prefer and use an exported cmake config for OCIO if found (is should
      be present for OCIO 2.1+), unless caller set OPENCOLORIO_NO_CONFIG=ON.
    - New hint OPENCOLORIO_INTERFACE_LINK_LIBRARIES lets caller force a
      list of interface link libraries. This is helpful when purposely using
      a static OCIO library, which itself has static dependencies, and you
      need to name those specific library filepaths.

* Simplify some of the logic for setting extra link flag arguments for the
  two main libraries.

* On Linux, also set link flags `--exclude-libs ALL` to hide symbols from
  any embedded static library dependencies, to prevent clashes with other
  versions of those libraries that may be compiled into a DCC app.
2022-01-16 21:55:28 -08:00
Larry Gritz c0ab86d423 make_texture: ensure that "maketx:ignore_unassoc" is honored (#3269)
I realized that a call to make_texture() with the "maketx:ignore_unassoc"
attribute set did not properly set the configuration attribute up when
opening a new ImageBuf.
2022-01-15 23:57:31 -08:00
Thiago IzeandThiago Ize 1259ca80c1 Fix clang 10 warning: (#3272)
```include/OpenImageIO/typedesc.h:620:10: warning: 'const' type qualifier on return type has no effect [-Wignored-qualifiers]
auto parse(format_parse_context &ctx) -> decltype(ctx.begin()) const // c++11
```

Co-authored-by: Thiago Ize <thiago@solidangle.com>
2022-01-15 23:55:17 -08:00
Larry Gritz 65c457d6f5 Bump version after developer preview tag 2022-01-07 11:55:22 -08:00
Larry Gritz 5317863c45 CI: Update 'latest' fmt to 8.1.1 2022-01-06 22:36:09 -08:00
Larry Gritz 1e488aedc2 CHANGES 2022-01-05 17:17:07 -08:00
Larry Gritz c885e5b05c Python: fix clamp() when min or max are just a float (#3265)
The docs said that passing a tuple for min or max param of the clamp()
function gave per-channel values, but passing a single float gave one
value for all channels.

In fact, the implementation used the float to clamp only the first
channel. This patch fixes the behavior.

Fixes #3264
2022-01-05 12:59:50 -08:00
Larry Gritz 6d2df7095d Docs: supply more python and oiiotool examples to IBA docs (#3263)
In addition to C++ code examples for each IBA function, work toward
also having equivalent Python code. Also, where applicable, show the
equivalent operation using oiiotool.
2022-01-05 12:58:50 -08:00
Larry Gritz 908ce0cd56 TIFF: make it work for 16-bit palette images (#3260) 2022-01-04 10:26:12 -08:00
Larry Gritz f8fc2358cf oiiotool: don't warn for --colorcount or --rangecheck (#3262)
We had forgotten to mark --colorcount and --rangecheck as commands
that intentionally outputs to the console. This omission meant that an
oiiotool command consisting only of a those would warn about no
output.  But we didn't really want it to.
2022-01-03 23:51:50 -08:00
AdamMainsTL b4aa7aa40c Fix variable usage example in docs (#3261)
I found this while reading through the image output section and it seems wrong given the following examples.
2022-01-03 13:08:25 -08:00
Larry Gritz 01fbf4167d oiiotool: control flow (#3243)
How do you craft an oiiotool command that will examine a file and add
an alpha=1 channel if it's a 3-channel file, but leave the existing
alpha alone if it's already a 4 channel file?

This patch adds control flow, so you could express the above like this:

    oiiotool in.exr --if "{TOP.nchannels < 4}" --ch R,G,B,A=1 --endif -o out.exr

The following slate of new fetures is added:

* `--set name value` sets a "user variable".

* Expression evaluation will expand identifiers that are the names of
  user variables. For example, `{i}` is replaced by the value of user
  variable `i`, and `{i+3}` returns 3 more than the current numerical
  value of `i`.

* Expression evaluation has been extended to support the following
  numerical comparison operators: `<` `>` `<=` `>=` `==` `!=` and
  `<=>` (the last one being the 3-way comparison, like in C++20).
  Also logical operators `&&` and `||`. All return 1 for true, 0 for
  false. Note that the comprison and logical operators have the same
  precedence as `+` and `-`, so use parentheses liberally to
  disambiguate complex mixed expressions.

* New functions recognized within expressions:
  - the value held by a named user variable: `var(name)`
  - logical negation: `!`, `not()`
  - string comparison: `eq()`, `neq()`

* `--if condition commands... [--else commands...] --endif`

* `--while condition commands... --endwhile`

* `--for variable range commands... --endfor` where the range may be,
  like Python, any of `end` (implied begin=0, step=1), `begin,end`
  (implied step=1), or `begin,end,step`.

Also needed to modify ArgParse so that it has the notion of whether
it's "running" -- actually calling the actions for each argument, or
if it's merely parsing but taking no action -- and to be able to set
and retrieve which command line argument index an action is responding
to.
2022-01-03 11:12:20 -08:00
Larry Gritz f705510f14 ImageBufAlgo: Slightly more flexibility in inferring constants (#3257)
This little change makes this work:

    ImageBufAlgo::add (buf, { 0.2f, 0.2f, 0.2f });

instead of the more awkward

    ImageBufAlgo::add (buf, cspan<float>({ 0.2f, 0.2f, 0.2f }));

and for anyplace tht has Image_or_Const parameter types.
2022-01-02 20:11:51 -08:00
Larry Gritz c66a532352 CI: Bump OCIO and fmt versions (#3258)
New OpenColorIO and fmt versions are out.

* Bump "latest releases" test to fmt 8.1.0, and OCIO 2.1.1.
* Re-adjust CI test fmt versions across many tests to give a better
  spread over the supported releases.
* Bump the default version to download and use if none is found to 8.0.0.
2022-01-02 14:50:25 -08:00
Larry Gritz 15f4da1f2a oiiotool --point (#3256)
We had --line (wrapping IBA::render_line) and --box (wrapping
IBA::render_box).

This adds the obvious --point, wrapping the existing IBA::render_point.
2022-01-02 10:48:51 -08:00
Larry Gritz 71c2d3da71 Python: improve ParamValueList and ImageSpec dict interface (#3252)
The Python bindings for ParamValueList and ImageSpec allow a "dict"
style (associative array) interface:

    imagespec["key"] = value
    val = imagespec["key"]

This patch makes some minor improvements:

* Clarify in the docs that like a regular Python dict, the associative
  retrieval will raise a KeyError if the key is not found.

* Add `__contains__` python method as a synonym for contains(), thus
  implementing `key in dict`.

* Add `__delitem__` python method as a synonym for erase(), thus
  implementing `del dict[key]`.

* Add an `ImageSpec.get()` method that is a synonym for getattribute
  (which retrieves the item or returns None or a default if not
  found), mirroring the behavior of Python's `dict.get()`.
2022-01-02 10:48:34 -08:00
Larry Gritz 1fe7bcd6a0 Python: implement ROI.copy() (#3253)
Somehow I never implemented a copy() method for ROI, which of course is
super useful if you want to make an actual copy of an ROI and modify
the copy.

I also realized that ImageSpec.copy() unnecessarily/incorrectly set
return_value_policy to reference_internal, but actually it should be a
real copy, which it has to be anyway because the implementation
creates a separate copy.
2022-01-01 11:55:51 -08:00
Larry Gritz 7deafc4718 oiiotool --pattern checker tweak and documentation fix (#3255)
* Docs: we previously only documented the "width=" optional modifier.
  Add height, color1, color2.

* Change behavior ever so slightly so that if the "height=" modifier is
  not supplied, the height defaults to the "width".
2022-01-01 11:41:51 -08:00
Larry Gritz af030f3b07 Docs: add missing Python docs for ImageBufAlgo.bluenoise_image (#3254) 2021-12-31 15:04:29 -08:00
Larry Gritz 9d6daca9be Python: ImageBuf constructor/reset from numpy array (#3246)
Deduce the ImageSpec from the shape and type of the ndarray, and
copy its contents into the ImageBuf.

Closes #2954
2021-12-31 15:04:03 -08:00
Larry Gritz 7d8fd72654 Docs: better C++/Python examples in ImageInput chapter (#3250) 2021-12-29 13:25:17 -08:00
Larry Gritz ee146a8c3f CI: pybind11 version bumps (#3248)
* Use the new pybind11 v2.9.0 for 2022 and "latest" tests.
* Bump the default version built by build_pybind11.bash to 2.8.1.
* Adjust the pybind11 version used in many of the other CI tests, to
  give an even spread across versions, and to make each of the
  "vfx platform" CI tests use the pybind11 version that was available
  near the start of its repsective year.
2021-12-29 12:44:02 -08:00
Larry Gritz 3cf4e1b81e ImageSpec: allow getattribute("format") to retrieve the data type name (#3247) 2021-12-29 11:56:53 -08:00
Larry Gritz 84a61b11f8 ImageSpec: New constructors to accept string for data type (#3245)
For each ImageSpec ctr that takes a TypeDesc, add another one
that's the same but takes a string_view (which is just a simple
pass-through of the TypeDesc-from-string_view).
2021-12-28 09:56:37 -08:00
Larry Gritz 6b316f2d15 Docs: more C++/Python dual examples (#3244)
* Add Python examples comprehensively to the ImageOutput chapter.
* Clean up some of the C++ code, too, using more modern idioms.
2021-12-27 09:59:41 -08:00
Larry Gritz aeeb3e741b oiiotool internals: convert all error and warning to fmt style (#3240)
Also tagged Strutil and ustring::fmtformat as 'nodiscard', to produce
warnings if people call it and ignore the results. (As was the case in
my own bug that I tracked down in the course of this patch.)
2021-12-24 17:26:35 -08:00
Larry Gritz fe9d572160 oiiotool: allow all filtered ops to take highlightcomp= modifier (#3239)
When doing operations with filters that have negative lobes, you can
sometimes get visible ringing artifacts in very high contrast regions
of HDR images (you tend not to see these artifacts in images that have
range [0,1] because the ringing is very low amplitude unless the input
is very large).

You can do "highlight compensation" to reduce the artifacts when they
occur by doing --rangecompress, which does a log transform on the
input, then the filtered op, then --rangeexpand to transform back to a
linear space. But that makes for kind of verbose and clumsy command
lines, and makes it easy to err by doing the transforms in the wrong
sequence or omitting one.

The -otex command takes a highlightcomp=1 modifier, which does this
bracketing automatically, foolproof, with a compact notation.

This patch adds support for optional highlightcomp=1 modifier for all
of the oiiotool commands that let you specify a filter= option:
--rotate, --warp, --resize, --fit, and --pixelaspect.
2021-12-24 16:17:50 -08:00
Larry Gritz 399e1fad6e Docs improvements (#3238)
* Clean up intra-document section references.
* New explanations about input and output configuration hints.
* More code examples in both C++ and Python.
* Fix some formatting flubs.
2021-12-21 15:03:28 -08:00
Larry Gritz 88f2c26f25 Get rid of obsolete header (#3237)
This was an obsolete experiment in adding a C binding. We abandoned
this effort (a replacement will happen eventually), but this one file
was left behind when we intended to remove it all.
2021-12-19 15:41:26 -08:00
Larry Gritz 57fdf840b2 Improve error propagation from ImageCache to higher levels (#3233)
Errors encountered while reading tiles were getting lost as we used
ImageBuf::Iterator to iterate over an image. Have the iterator keep a
flag for whether it encountered an error, set to true if the
ImageBuf::retile indicates an error occurred during the read.

Also, some ImageCache errors might get lost on the way to
TextureSystem calls, fix that as well.
2021-12-16 11:24:26 -08:00
Larry Gritz 9792b753e0 Make texture system 64-bit safe for tile access (#3232)
TextureSystem is designed primarily for tiled images (typically 64x64
pixels each), but to handle untiled images, it just treats the whole
image as one big tile. That means for very large untiled images, you
might end up with one VERY large tile, and if the image is large
enough, the size and/or offset computations therein may overflow a
32 bit int.

This patch attempts to make all the offset computations in the texture
system be 64-bit safe.
2021-12-16 11:24:09 -08:00
Brady 8232c157b1 Fix the reference (#3234) 2021-12-14 18:19:14 -08:00
Larry Gritz e4cf482bf2 IOProxy cleanup -- use new helper methods for TIFF, DPX, and PNG. (#3231)
After setting up the new IOProxy helper methods for ImageInput and
ImageOutput, here we go back to the readers/writers that had used
proxies for a long time, and switch them to using the new helpers.
2021-12-14 10:41:36 -08:00
Larry Gritz d1ec7624bf Protect against corrupt headers with image size and channel limits (#3230)
Add two new global OIIO attributes: "limits:channels" and
"limits:imagesize_MB" which are imposed limits for validating a
reasonable number of channels and total uncompressed image size,
respectively. We presume that an image file header describing an image
that purports to exceed these is most likely corrupted or even
maliciously crafted. The limits, therefore, are designed to avoid
crashes, absurd memory allocations, or other cascading errors that
would result from taking such a claim at face value (for example,
a file that appears to have tens of thousands of color channels).

The limits default currently to a maximum of 1024 color channels, and
a maximum uncompressed data size of a single 2D image to 32GB.  These
seem reasonable today, but if such large sizes become likely to be
seen in the wild in legit files in the future, we may change the
defaults. They may be adjusted now simply by setting the attributes,
of course, as should be done by applications that legitimately expect
to see input that exceeds them. (Applications also may make the
validation limits even smaller if they wish.)

I've modified the TIFF reader to check these limits as a first step.
We'll expand to doing such validation checks on other readers over time,
as we have opportunities to visit them.
2021-12-14 10:41:08 -08:00
Larry Gritz 9e897fe9a0 Strutil::edit_distance() (#3229)
This string utility computes the "edit distance" between two strings.
Currently it only uses the Levenshtein metric, but it has room for
future expansion by taking a parameter that can specify which metric
to use. Levenshtein is an algorithm for computing how many single
character insertions or deletions are necessary to turn one string
into the other.

I have a few ideas for where this can be useful, but as one
demonstration, I also modify the ArgParse class internals so that if a
command is not found, it will print a suggestion naming the valid
command option that has the closest edit distance (but only if one
choice is <= 2 edis away, and only if it's not a single-character
option, in order to reduce the number of useless suggestions). Here's
its behavior in action:

    $ iinfo --stat foo.exr
    iinfo error: Invalid option "--stat" (did you mean --stats?)
    ...
2021-12-14 10:40:19 -08:00
Larry Gritz bfd99269f7 CMake: don't download missing test data if BUILD_TESTING is off (#3227)
Fixes #3189
2021-12-12 22:38:32 -08:00
Larry Gritz 43a8dbbed8 IOProxy support for JPEG2000 (#3226) 2021-12-10 12:45:01 -08:00
Paul Melis 3bd9e44796 Mention that git is needed for certain dependencies (#3228)
... if they cannot be found and are installed from source as part of the build process.
2021-12-10 11:31:05 -08:00
Larry Gritz 0541331cdb JPEG2000: enable multithreading, other fixes (#3225)
* The main event here is that we're now telling OpenJPEG to use
  threading when compressing/decompressing JPEG-2000 files.  This
  improves the speed of JPEG-2000 reading on my laptop by 2-3x!  The
  threading feature was added to OpenJPEG 2.2 for decode, and 2.4 for
  encode.

* CI: Build OpenJPEG 2.4 for the "latest releases" test, and build
  their master for our "bleeding edge" test.

* Fixes to deal with the in-progress 2.5 deprecating a struct field.

* Generally clean up our detection of what OpenJPEG version we are
  using.

* Some clean-up of the FindOpenJPEG.cmake file, use PATH_SUFFIXES.
2021-12-09 23:01:50 -08:00
Larry Gritz 794ec616b5 IOProxy support for BMP (#3223) 2021-12-09 12:20:03 -08:00
Larry Gritz 70f7991c5b Webp IOProxy support (#3224) 2021-12-09 11:48:36 -08:00
Larry Gritz d3521a3d37 Docs: touch-ups to maketx argument explanations 2021-12-09 10:23:10 -08:00
Larry Gritz 8f1e33b611 Targa: add IOProxy support (#3221) 2021-12-08 17:08:23 -08:00
Larry Gritz b74a2e9523 Refactor PSD input to support IOProxy (#3220) 2021-12-08 17:08:08 -08:00
Larry Gritz 85768195e5 PNM overhaul to support IOProxy (#3219)
Also fix longstanding bugs in PNM input:
* We weren't correctly emulating random scanline access, as is expected
  (but in practice rarely used) of all ImageInput implementations.
* We weren't marking the color space in any way, now we do mark as
  "Gamma2.2", which is the correct/preferred interpretation according
  to the PNM spec.
2021-12-07 16:15:33 -08:00
Larry Gritz c4d9b6e66d hdr overhaul (#3218)
* Add full IOProxy support to both input and output.

* This necessitated a major refactor, including sucking the I/O specific
  code from rgbe.{cpp,h} into hdr{input,output}.cpp and getting rid of
  the old files.

* Add a testsuite entry for hdr (shockingly, there was none before)
2021-12-07 16:15:10 -08:00
Larry Gritz 3e9cbd1950 DDS input IOProxy support (#3217)
As well,

* Add a DDS test, apparently we never had one.
* Remove DDS setting of "texturetype", we don't ever use that, it's only
  "textureformat" that we use. Not sure how that crept in there years ago.
2021-12-07 14:22:26 -08:00
Larry Gritz 36bfeb6694 Minor ImageInput/ImageOutput IOProxy handling tweaks: (#3222)
Helper functions ioproxy_opened() and iotell() should have been const
all along, since they just return back information and should not
change state of the proxy, and also ioproxy() should have both const
and non-const versions.
2021-12-07 14:21:52 -08:00
Larry Gritz 6cfba204be CMake: use the more compact TARGET_NAME_IF_EXISTS (#3215) 2021-12-07 10:13:12 -08:00
Larry Gritz 6d0c98e516 Build/CI openvdb tweaks (#3216)
* On Mac CI, use openvdb from Homebrew now that it's OpenVDB 9, which
  properly supports OpenEXR/Imath 3.1.

* Update our FindOpenVDB.cmake target names to match the names used in
  OpenVDB's own FindOpenVDB.cmake (even though we don't use their module,
  may as well stick to their convention, especially if they eventually have
  a properly exported config file).
2021-12-07 10:08:09 -08:00
Larry Gritz 91b60106e7 Name gamma-corrected color spaces "GammaX.Y" (#3202)
For some reason, in the early days I got in the habit of having OIIO
input readers call their color space "GammaCorrected2.2" (for example)
when they appeared to be a straight-up gamma. (Generally only used for
certain fairly old formats that date from before sRGB existed.)

But there appears to be a widely used convention of naming OpenColorIO
spaces "GammaX.Y", so I'm switching OIIO to conform that
convention. It's more straightforward and increases the chances that
it will match the names of color spaces that already exist in people's
OCIO configs.
2021-12-07 10:07:32 -08:00
Larry Gritz 5bf288be33 Better IOProxy support for image format implementations (#3203)
As we move toward fully equipping all image format implementations
with full IOProxy support, it's clear that a lot of repeated code is
error-prone. I first tried to collect this in a mixin class, but then
re-implemented after realizing that we can use the existing PIMPL
ImageInput::Impl and ImageInput::Impl classes, without changing any
ABI or making new headers.

This patch add a couple data members to the Impl data -- an
`IOProxy*`, (the current proxy, used for both passed-in and created
proxies) and also a `unique_ptr<IOProxy>` used when we have to create
our own and want to make sure it's destroyed with the ImageInput or
ImageOutput.

Then we add a number of protected member functions to ImageInput and
ImageOutput, not meant to be ever called by "users" of the OIIO APIs,
but used internally by II's and IO's to encapsulate several common
tasks related to managing IOProxy's.  This coalesces redundant code
that would need to appear separately in most of the plugins that
support IOProxy, helps to reduce cut-and-paste errors from having to
make these changes separately in many places, and centralizes the
logic so that as our ideas of how to implement IOProxy evolve, we can
easily change it in just one place and have it apply to all plugins.

GIF revise with new IOProxy utility methods

JPEG simplify with new IOProxy utilities.
2021-12-04 23:05:01 -08:00
Larry Gritz f423cde454 Build: Make sure to use tbb target if it exists (#3214) 2021-12-04 12:31:07 -08:00
Larry Gritz 1fe77f312b Refactor ImageBuf::Iterator, ConstIterator (#3195)
To try to combat long template instantiation times, did some refactoring
on the ImageBuf iterators:

* Pushed more functionality from the templated Iterator and
  ConstIterator to the non-templated base class IteratorBase. This
  should reduce the amount of code that is separately instantiated for
  every data type, in every module that uses iterators.

* Pushed many implementations from inline defined in imagebuf.h to
  separately compiled in imagebuf.cpp. The most important methods that
  are called on every pixel are still inline, but we are switching to
  separate compilation for all the methods that are only called upon
  construction (once per image being iterated over) and most of the
  code that is called only when we wrap to the next scanline.

* Some other miscellaneous refactor to remove redundant computation in
  those classes.
2021-12-03 20:27:23 -08:00
Larry Gritz 08e86b795d Use a project-specific var for whether we're running in CI (#3211)
Maybe somebody else is building this as a subproject or has a varible
called "CI"?

* For our CI runs, set an env variable "OpenImageIO_CI" (not just
  generic "CI").

* Make sure STOP_ON_WARNING is true for our CI runs, even for release
  branches -- but now check OpenImageIO_CI, not CI, in case somebody
  else has set that.
2021-12-03 20:25:38 -08:00
Larry Gritz 59ef613b90 fmath.h: bit_cast specializations should take refs, like the template (#3213) 2021-12-03 20:19:52 -08:00
Larry Gritz e481e40dc2 Testing: Gracefully handle failing to find git for test data download (#3212)
Fixes #3208
2021-12-03 13:34:21 -08:00
Larry Gritz ffe7c190c1 Fix typo 2021-12-02 17:06:04 -08:00
Larry Gritz e582e2e166 Restore code that finds Jasper when using static libraw (#3210)
This was deleted a few months back, but I think I did not realize
it still served a purpose. We don't use JasPer directly, but LibRaw
does, so if we are using static LibRaw, we still need it here.

Fixes #3209
2021-12-02 10:01:12 -08:00
Larry Gritz 028582817c Add documentation for new texture CDF options (#3206)
Also, fixed the fact that direct calls to make_texture() were not given
proper defaults for the cdfsigma and cdfbits options.

Related to PR #3159
2021-11-29 21:39:02 -08:00
Larry Gritz 5563aec0e5 make_texture()/maketx fix to channel name with monochrome_detect (#3205)
When the make_texture option monochrome_detect is used to collapse 3
identical channels to 1, it was leaving the first channel name in
place (for example, "R"). That was confusing, because at this point,
we're not trying to represent a red image, we're trying to represent a
grayscale image. A strategic call to `default_channel_names()` clears
it up, imposing the standard "Y" we use for a single channel luminance
image.

Also amended the documentation of IBA::channels(). It turned out not
to be the way I called channels() that was the problem here, but by
the time I figured that out, I had already seen that its docs could be
improved.

Fixes #3204
2021-11-29 21:17:28 -08:00
olegul 78a67fe6a0 Add support for writing Gaussian forward and inverse transform lookup tables (#3159) 2021-11-29 09:52:01 -08:00
Larry Gritz f0ac3e1022 imageinout_test debugging aids (#3201)
* --onlyformat or env IMAGEINOUT_TEST_ONLYFORMAT to test only one format.
* --no-delete to preserve the temporary files for inspection
* other debugging checks
2021-11-29 00:04:45 -08:00
Larry Gritz 9aca017113 DDS: add test, minor adjustments (#3200)
* Add a DDS test, apparently we never had one.
* Remove DDS setting of "texturetype", we don't ever use that, it's only
  "textureformat" that we use. Not sure how that crept in there years ago.
2021-11-29 00:04:22 -08:00
Larry Gritz 963b5673d2 filesystem.h: New write_binary_file utility template (#3199) 2021-11-28 22:01:42 -08:00
Larry Gritz df77c3fcfc Fix typo 2021-11-28 00:22:37 -08:00
Larry Gritz f2ae8a594e IBA::maxchan(), minchan(), and oiiotool --maxchan / --minchan (#3198)
The previously existing max and min take 2 images and compute the
pixel-by-pixel, channel-by-channel max or min of the two images.

The new maxchan/minchan take one multi-channel image and produce a
single-channel image where each pixel contains the max or min of the
*channels* of the corresponding pixel of the original image.

It is equivalent to this (for an RGB image):

    oiiotool in.exr -ch R in.exr -ch G in.exr -ch B -max -max -o max.exr

Except, of course, that --maxchan is a single command, is much more
efficient, and doesn't require you to know the number or names of the
channels of the input.

This was a specific user request.

Note: in the course of making the tests, I noticed that we did not
have documentation or testsuite coverage of the python bindings for
IBA.min() an max(), although they were implemented. So I added that as
well.
2021-11-27 10:22:25 -08:00
Larry Gritz 0a69fa3ceb CMake tweaks (#3197)
* Make PROJECT_VERSION_RELEASE_TYPE be a cache string, so individual
  build configs or sites can override it.

* Change OpenImageIO_IS_SUBPROJECT to PROJECT_IS_TOP_LEVEL (and with
  the opposite sense), to match CMake 21+ behavior. And no need to set
  it ourselves if using cmake 21+.
2021-11-27 10:21:57 -08:00
Larry Gritz bc4685ccdd oiiotool --repremult (#3192)
ImageBufAlgo has both premult and repremult (as well as unpremult).
But oiiotool only exposed unpremult and premult, but not repremult.
This little patch rectifies that oversight.

Just to remind everybody of the difference:

`premult` just multipies the color channels by alpha, like it says.
Note that for a pixel that has Alpha = 0 but nonzero color, this will
crush the color to black.

That's fine if you have an *original* image that's unpremultiplied and
you want to do a one-time conversion to premultiplied.

But there's another use case, which is when you start with a
premultiplied image, you need to temporarily unpremultiply it (like
for a color space conversion), and then re-premultiply it. In that
case, you may have those glowing pixels in the original image, the
unpremult will preserve them, and you DO NOT want to crush them to
black with the subsequent premult.  So there is a "repremult"
operation that's like premult, but preserves the color values when
alpha == 0. This is the preferred operation when you are doing the
sequence of "unpremult, do something, re-premult" so that the glowing
pixels make it through the round trip.
2021-11-22 23:25:56 -08:00
Larry Gritz d4da1fde87 Fix to oiiotool --invert : avoid losing the alpha channel values (#3191)
When I implemented `oiiotool --invert`, I knew that the default should
be to only invert the first three channels (presumably R,G,B) and not
anything beyond, because we wouldn't want to invert the Alpha channel.

But I botched it, and instead what happened is that if given an RGBA
image, it would just leave the A black in the result image.

So this patch has two improvements:

1. If there are more channels in the source image than we are
   inverting, make sure to copy the other channels unmodified, don't
   just leave them blank.

2. Allow optional modifiers chbegin= and chend=, so users can change
   the default if they want a different channel set to be inverted.
2021-11-22 23:24:54 -08:00
Larry Gritz 9206e45256 IBA::saturate() and oiiotool --saturate (#3190)
This new IBA/oiiotool command adjusts the saturation of a color image,
with a scale factor. Scale = 0 makes the image gray scale of
equivalent perceptual luminance, scale = 1 leaves color unchanged,
scale > 1 increases color saturation.
2021-11-22 23:24:23 -08:00
Larry Gritz 81aebd2f56 Build: option to time individual compile commands (#3194)
This adds a new cmake variable in our build system, TIME_COMMANDS,
that when set ON will adjust the compile and link rule launch to
include a time command. This is probably only useful when also setting
`CMAKE_BUILD_PARALLEL_LEVEL=1` so that build are happening serially.
The use case is to investigate how long each module takes to compile,
for optimizing the build.
2021-11-22 00:20:45 -08:00
Larry Gritz 85acf8b250 CI enhancements: MacOS 11, other updates (#3193)
* Add a test for MacOS 11
* Updated supported versions of dependencies
* Move linux clang test to clang13 on vfx2022 container
* Switch clang-format test to use clang12
2021-11-22 00:20:21 -08:00
Larry Gritz 1217102b0f GIF full IOProxy support (#3181) 2021-11-20 18:02:12 -08:00
Larry Gritz 32e00ada6a JPEG output IOProxy support (#3182)
IOProxy was already supported for JPEG input.
2021-11-19 23:41:43 -08:00
Larry Gritz 717b0bb175 Expand the list of TERM values supporting color (#3185) 2021-11-19 20:39:53 -08:00
Larry Gritz 82c7a5af94 Raise ImageCache default tile cache size to 1GB (#3180)
In the early days of OIIO, it was 100MB. Ten years ago, we bumped it
to 256MB. I've heard a rumor that computer memories have grown in the
last 10 years, and so have the size of images some people deal
with. So it seems reasonable to raise it to 1GB.
2021-11-19 20:37:52 -08:00
Larry Gritz 4b6bffafc9 Banish sscanf (#3178)
`sscanf()` still has locale-dependent behavior that we wish to avoid
because it can lead to subtle bugs for people whose machines are
configured for certain locales.

This patch removes from the OIIO codebase almost every remaining
sscanf use (and definitely every one that could harbor locale bugs).
Instead, we use the rich set of parsing functions we've added to
Strutil over the years, which are locale-independent, and in most
cases are also faster than the standard C/C++ equivalent.
2021-11-19 20:37:16 -08:00
Larry Gritz f046c42ee1 TypeDesc ctr from string: accept "box2f", "box3f" (#3186)
The official names we use are "box2" and "box3", but users of Imath
know these as box2f/box3f, so accept these as synonyms when
constructing a TypeDesc from a string.
2021-11-17 16:42:54 -08:00
olegulandOle Gulbrandsen da21b7a98e SPI Specific: default to LLVM 12.0.1 (#3187)
Co-authored-by: Ole Gulbrandsen <ogulbrandsen@imageworks.com>
2021-11-17 15:06:22 -08:00
cmstein 3092639295 adding host/device attributes to make TypeDesc methods GPU device-friendly (#3188) 2021-11-17 15:04:32 -08:00
Larry Gritz 476c02eb92 Fix docs/behavior with webp "LoopCount" (#3183)
* Typo in webp section -- said "gif:LoopCount" when we meant
  "webp:LoopCount".

* In the code, did not actually set the "oiio:LoopCount" metadata
  that the docs said would be set.

* Opportunistic fix: TIFF docs said we only suported IOProxy for input,
  but we have supported it for output for a while now.
2021-11-15 21:31:42 -08:00
Larry Gritz 985bda763a Strutil::parse_line (#3177) 2021-11-11 21:14:53 -08:00
Brecht Van Lommel 4f97ff6eef Fix excessive memory usage when saving EXR file with many channels (#3176)
Scratch memory allocation in ImageOutput::to_native_rectangle was using
the number of channels squared.
2021-11-11 13:25:55 -08:00
Larry Gritz 974f79b6aa Strutil: add new utilities for parsing values out of strings (#3173)
* `parse_values()` and `scan_values()` both can parse a series of
  values in a string, with optional prefix, suffix, and separator. The
  scan versions just figure out the values, the parse versions
  optionally can update a string_view& like the other parsing
  functions in Strutil.

* `scan_datetime` parses the int components of a string that looks like
  "YYYY:MM:DD hh:mm:ss" (and a few minor variants).

* Fix stoui -- it was previously casting stoi results, which is not
  correct.

* Add `from_string<>` specialties for `double`, `int64_t`, `uint64_t`.
2021-11-10 13:45:03 -08:00
Larry Gritz ba1d19dd74 SPI specific: updates to versions used by Makefile-bits 2021-11-08 11:44:28 -08:00
Larry Gritz e09a2e66bd oiiotool: better detection of file reading failures (#3165) 2021-11-07 18:07:07 -08:00
Larry Gritz b65412c22b oiiotool: Fix bug autocropping to positive area for all-negative data (#3164)
When outputting to formats that don't support negative pixel origins
(such as JPEG), we crop away the negative areas. But we did not
consider the case where the entire data window was in the negative
region!
2021-11-07 18:06:50 -08:00
Larry Gritz 1b22597371 RLA input: guard against malformed input (#3163) 2021-11-07 18:01:50 -08:00
Larry Gritz 429883dc88 Targa: more safety for corrupted files (#3162)
* Check for palette mode files that don't supply a color map.
* Fix implementation bug in handling x flipped images.
2021-11-07 14:38:48 -08:00
Larry Gritz 60e3ea8c28 tiff output: switch to "bigtiff" for really big images (#3158)
TIFF has an absolute limit of 4GB file size due to use of uint32
offsets within the file. If you try to write a big enough TIFF image,
it will fail. This is not a software problem, it's a limitation of the
original TIFF file specification itself.

The underlying libtiff supports a nonstandard "bigtiff" extension that
uses 64 bit offsets. This patch switches to this automatically for
images whose uncompressed size would get too close to (or exceed) the
4GB limit.  Any such files can be read by OIIO-based software, as well
as anything else using a relatively modern version of libtiff, but may
not be readable by independent TIFF reading implementations.

This is a mixed bag, though. On one hand, this at least lets us write
files that would have been an error before.  But note that some files
that would have worked as classic TIFF before -- because their
*compressed* size was still under the 4GB limit, even if their
uncompressed pixel size was not -- will now be written as bigtiff
because we have to commit at the time we open the file, before we've
seen the pixels and know the final compressed size.  We just can't
know for sure, for an image with > 4GB of pixels, if the file will get
lucky and be below the limit by the time the scanlines or tiles are
compressed.  So for those files, not all apps will be able to read
them (though anything using libtiff >= 4.0 or OIIO will be fine).

Fixes 3156
2021-11-07 08:21:53 -08:00
Larry Gritz 152f6c8849 New global OIIO attribute: "try_all_readers" (#3172)
When ImageInput::create() or open() is called, it first uses the
extension of the filename to guess which reader plugin to try (for
example, "foo.jpg" will try the jpeg reader). If that fails, however,
the default behavior is to then try EVERY reader to see if any will
open the file, in case it guessed wrong, or the extension is used by
more than one format, or the file was simply given the wrong
name. Thus, ultimately, OIIO will never fail to open a valid image
file in a known format, even if the file is wildly misnamed. However,
it's a lot faster to open a correctly named file, because it will try
that one first, before trying a long succession of readers in the hope
that eventually one will work.

There are three cases where this is not the desired behavior:

1. You are confident that files are named with the correct extensions,
and you want a corrupt or invalid file to fail QUICKLY, without trying
every format reader.

2. If the file is corrupt, rather than see a generic "Could not find
any format reader that will open the file" because they all failed,
you want to see the more specific error message for why the (presumed)
correct reader could not succeed.

3. When doing regression tests to make sure that sample corrupted
files are correctly reporting the right errors, we really do want to
see error messages from that one reader we are testing.

This PR exposes a global OIIO attribute, "try_all_readers", which
defaults to 1, but when set to 0, changes the behavior so that ONLY
the one format implied by the file extension is tried, and OIIO does
not subsequently try every known reader.
2021-11-07 08:21:30 -08:00
Larry Gritz eae19db2f9 oiiotool --oiioattrib (#3171)
This new oiiotool command lets you set global OIIO attributes, i.e.,
making calls to OIIO::attribute(). It allows oiiotool command lines to
set some additional OIIO-wide options for which no specific oiiotool
command flags could otherwise access.
2021-11-05 00:13:00 -07:00
Larry Gritz e058dc8c4a Fix per-file boilerplate to just link to the github project (#3170)
Not the specific license file. Users can find that. Better to use
the project link. I'd been meaning to do this for a long time.
2021-11-04 09:51:41 -07:00
Rémi Achard 26cd4113c2 Fix identifier not found error on MSVC (#3168)
Signed-off-by: Rémi Achard <remiachard@gmail.com>
2021-11-03 16:27:56 -07:00
Larry Gritz 3850e29ed6 CI: OCIO has renamed its master branch to main (#3169) 2021-11-03 13:20:34 -07:00
Larry Gritz 4c1bdfefbd build_libtiff.bash: Allow override of build type (#3161)
Also make the default version of libtiff we build be the current 4.3
2021-11-03 09:59:08 -07:00
Larry Gritz 25bbb7fa7f Update to newer stb_printf for our implementation of vsnprintf (#3160)
Solves some security problems and/or just false positives in
address sanitizer.
2021-11-03 09:58:49 -07:00
SebTV 022d42a871 Fix Typo that prevents setting Compile Definitions (#3167) 2021-11-03 09:58:17 -07:00
Larry Gritz 91bc398073 exr output: Support new OpenEXR zip compression level choices (#3157)
When building against OpenEXR >= 3.1.3, exr output now allows zip/zips
compression to take a quality metric (such as compression
"zip:4"). The range is from 1-9, 4 is the default, and it's a control
over speed of compression vs compression ratio (higher number is more
expensive but may result in smaller files). This only affects
compressed output -- it's lossless and will be read to the same pixel
values upon input.

This is also incentive to upgrade to OpenEXR >= 3.1.3, because its new
default (and ours) is 4, versus the old (implied, not directly
controlled) 6. This change was made because compared to 6, it's
significantly faster to write exr files with zip compression 4 (tens
of % faster), while only increasing file size by 1-2%, so that seemed
like the right tradeoff. Lower numbers make much larger files for
little speed gain, and larger numbers than 6 make for much slower
writes of exr files for very tiny compression improvements. But YMMV
and you may want to experiment to find the right trade-off for your
use cases.
2021-11-01 23:06:47 -07:00
Larry Gritz 00a6c6023a CHANGES 2021-10-31 12:15:50 -07:00
Larry Gritz 71177ff402 Field3D deprecation part 2: Remove field3d support (#3151)
OIIO 2.3 marked it as deprecated. This new change is for master (2.4+)
only -- removing all support for Field3D.

F3d is effectively unmaintained, is known to be incompatible with
the latest versions of OpenEXR/Imath, and we haven't found anyone
prepared to speak up as a user of it via OpenImageIO support.
2021-10-31 12:14:07 -07:00
Larry Gritz 5c89335ddc Rewrite Filesystem::searchpath_split to remove boost::tokenizer (#3154)
One more boost extraction:  tokenizer.

The only place we used it is Filesystem::searchpath_split, which can
easily be rewritten in terms of the Strutil parsing functions.
While I'm at it, add a new version that returns the vector instead
of needing to pass in a ref.
2021-10-29 21:28:20 -07:00
Larry Gritz 04293edaa3 Stochastic mipmap interpolation (#3127)
Suggested by Luke Emrose, the idea here is that we introduce two new
MIP interpolation modes: StochasticTrilinear and StochasticAniso.
These work similarly to Trilinear and Aniso, respectively, except that
instead of sampling both of the bracketing MIP levels and blending
between them, in stochastic mode we use a random variate to select ONE
of the two MIP levels with probability proportional to the computed
blending weight.

If these mip modes are used, the caller needs to pass a
well-stratified value in the new "rnd" field of TextureOpt. Also note
that the method only really makes sense in the context of a renderer
that is using many samples per pixel. As a single texture lookup, it
looks horrible and noisy, as you can see by the testshade-based tests
we do of this, which are 1spp and looks pretty rough.

My benchmarks (in a hard stress test of the texture system using
`testtex --threadtimes 8`) show that this approach has speedups of
35-40% when using between 1-4 threads, dropping to more like 25-30%
speedup as threads are in the 12-32 range (that makes sense, it's
doing the same amount of total I/O).

In this first implementation, in order to preserve ABI compatibility
if we decide to backport this feature to the release branch,
TextureOpt::rnd is added as a union co-member with the unused "bias"
field. For TextureOptBatch, we had to add it outright, but it's
guarded by an `#if` and will not be backported to 2.3. (We may change
our minds and not backport it at all, I just wanted to leave the
option open with this initial patch. Also, there will probably be
additional further ABI-breaking changes coming later that will
definitely not be backported.)

In this first phase, we only use the stochastic component to turn the
2-MIP-level lookup into one level lookup.  It has been further
suggested that we could apply stochastic techniques to anisotropic
filtering (instead of many samples spaced across the major axis of the
filter footprint, take one sample distributed across the axis), and
even for the ordinary bilinear or bicubic within each level (instead
of 4 or 16 weighted texels, just retrieve one texel chosen with the
weights as probabilities). But these deserve to be benchmarked and
have their quality evaluated separtely and deliberately, and so will
be relegated to a later investigation and implementation.
2021-10-28 14:02:52 -07:00
Larry Gritz b8f25e0541 Remove the last vestiges of the experimental C API (#3144)
We will have a C API eventually, but it will be implemented
differently, and this cruft will probably get in the way. If the new
code needs any of this (particularly the test cases), it's easy enough
to revive it from the project history).
2021-10-27 21:24:58 -07:00
Larry Gritz 3f0e12a822 raw: fix ProPhoto gamma, add ProPoto-linear (#3153)
When requesting that raw image be returned as "ProPhoto" color space,
we were using the wrong gamma. Also, at user request, add
"ProPhoto-linear", which is the same but with linear response. (This
is analogous to the existing "sRGB" and "sRGB-linear".)

Fixes #3152
2021-10-27 21:22:22 -07:00
Larry Gritz fff364ffce Fix bad alignment and simd assumptions in fill_gray_channels (#3145)
Thiago Ize points out that TextureSystemImpl::fill_gray_channels
assumes that the `float*` addresses it is passed are big enough for
a vfloat4, and also properly aligned as such. Not true.

This is an edge case anyway, only called in particular cases where
we are doing 3/4 channel lookups on 1/2 channel files with the option
turned on to expand single channel gray to RGB gray, and also doesn't
do enough SIMD to have a perf impact. So just recode as scalar and
have no more alignment mismatches to worry about.

Also make sure at least one of the Windows CI tests is explicitly
turning SSE on.

Fixes #3128
2021-10-27 21:21:27 -07:00
Larry Gritz 3715f15ce7 docs: formatting fixes 2021-10-24 22:40:33 -07:00
Larry Gritz 4cde5b72b9 Field3D deprecation -- stage 1 (#3140)
Field3D is essentially unmaintained, and is currently incompatible with
OpenEXR/Imath >= 3.

In this first stage (which will apply to OIIO 2.3):

* By default, Field3D support is disabled. To enable it, you must
  invoke CMake with `-DENABLE_FIELD3D=1`. No warning or other messages
  are printed by the build configure step when not enabled.

* If requested, but an incompatible OpenEXR is found, it will be disabled
  with a clear error message.

* If requested and enabled, a warning will be printed indicating that
  Field3D support will be removed from future versions (2.4 and beyond).

* Add a new test, texture-texture3d, that provides the same testing that
  texture-field3d did, but with openvdb.
2021-10-24 12:07:10 -07:00
Larry Gritz a844c7a0ed Improvements related to image dithering and low-bit-depth output (#3141)
We have options that allow adding random dither to images before
output, which when converting float images to 8 bit or less, can
greatly reduce the appearance of banding artifacts. This PR makes a
number of improvements:

* When the option is used, it should apply dither any time you are
  reducing an image with > 8 bits/channel to an output with <= 8
  bits/channel. Not just from float/half, but also from uint16, for
  example. (When outputting > 8 bits per channel, there are enough
  gradations that you tend not to see banding artifacts, so dithering
  is not necessary for 16 bit output, even if coming from a float data
  source.)

* Change the actual dither we use to blue noise. The old dither just
  used a hash to add uniformly distributed random numbers to each
  pixel value before quantization, completely uncorrelated from pixel
  to pixel. Blue noise is specially constructed to still have a
  uniform distribution of the output range, but it ensures that
  spatially, similar values are distributed as far away from each
  other as possible, rather than having similar values sometimes
  clumped together.  The result is a MUCH NICER appearance.

* Of course, this means the we needed to store a blue noise table in
  the library, and some access routines for it. We incorporate a
  public domain blue noise texture as a table.

* ImageBufAlgo::noise() and `oiiotool --noise` now take "blue" as a
  noise name to return blue noise. Also, make "white" the (preferred)
  synonym for "uniform" (to disambiguate the fact that both white and
  blue noise are uniformly distributed; the difference is that white
  is independently random for each pixel, whereas blue shapes the
  spectrum to favor high frequencies, making it better suited for
  dithering and sampling purposes.

* ImageBufAlgo::bluenoise_image() returns a reference to a stored
  periodic blue noise image.

* oiiotool -d would let you say "uint10" or "uint12" to indicate 10 or
  12 bit output (for formats that support it), but had no way to ask
  for less than 8 bit output (for example, TIFF supports that). So we
  add "uint6", "uint4", "uint2", "uint1" as recognized names for the
  `-d` option in those rare cases when you specifically want to
  produce a low bit depth file. And furthermore, if you ask for
  `--dither` when using lower bit depths, the dither amplitude is
  adjusted to be right sized for the bit depth you are using.

* Many format output modules that support 8 bit output honor the
  option to dither the output, but in the "built-in plugins" chapter
  of the docs, most did not list this option in the section that
  describes which special output options it knows. So now we've added
  this to the docs for all the output plugins that did support it.
2021-10-24 11:27:03 -07:00
Larry Gritz 77ff294664 Fix copy/paste error in ImageCache docs for 'failure_retries' attrib (#3147) 2021-10-24 11:25:30 -07:00
Larry Gritz c3cf7b9c08 heif: Handle unassociated alpha (#3146)
Turns out that heif files that contain alpha can have either
associated or unassociated alpha. We had been assuming
associated. With LibHeif 1.12 and beyond, you can ask, so now we
do. Thanks Frédéric Devernay for pointing this out.

Similar to other formats that optionally have unassociated alpha:

* The default behavior is to associate/premultiply automatically when
  reading, but set metadata "heif:UnassociatedAlpha" to indicate that
  it was unassociated in the file.

* Open configuration hint "oiio:UnassociatedAlpha", when nonzero,
  means to please keep the data unassociated and not premultiply. In
  that case, metadata "oiio:UnassociatedAlpha" will be set in the
  ImageSpec to indicate that the returned image (not just the file)
  consists of unassociated values.

I did a couple other minor docs touch-ups while I was at it.

Fixes #3129
2021-10-24 11:04:48 -07:00
Larry Gritz 6507724330 raw: Fix compat break in their 202110 snapshot (#3143) 2021-10-23 12:58:13 -07:00
Larry Gritz fb55e52843 [docs] Add an oiiotool example of putting a border around an image (#3138) 2021-10-21 23:46:13 -07:00
Larry Gritz f749be7bd3 oiiotool --dumpdata:C=name (#3136)
New ":C=name" modifier for --dumpdata will cause the dumped image data
to be formatted with the syntax of a C array, that can be dropped right
into source code.

    $ oiiotool --dumpdata:C=foo image.exr
    // image.exr       :  256 x  256, 4 channel, float openexr
    float foo[256][256][4] =
    {
      { /* (0, 0): */ { 0.517036676, 0.261921108, 0.017822538, 0.912108004 },
        /* (1, 0): */ { 0.653315008, 0.527794302, 0.359594107, 0.277836263 },
        ...
    };

Without this modifier, --dumpdata will keep the same formatting it
always had.

This works pretty well for ordinary boring flat, single subimage,
non-MIPmap images.  The option should probably not be used (or at
least is very unpolished) for multi-subimage, MIP-mapped, deep, or
other oddball cases (but you probably don't want to shove those into
a single C array anyway).
2021-10-21 23:46:01 -07:00
Larry Gritz 245ae961b1 cmake: Need OpenImageIO_SUPPORTED_RELEASE to be cache variable (3142)
I have a reason for needing to be able to override it on the command
line when we do a cmake config step.
2021-10-21 23:45:03 -07:00
Brad Smith 713b78d18b Sysutil: improvements to NetBSD and OpenBSD support (#3137) 2021-10-18 00:45:32 -07:00
Brad Smith b4787213e3 Fix building with Clang on big endian archs (#3133) 2021-10-16 11:27:44 -07:00
Larry Gritz 0ecea4e275 Fix sometimes build breaks related to OpenCV headers (#3135)
Reclassify the OpenCV headers as "system" includes, which will turn off
warnings for things that show up in those headers that we can't control.
2021-10-16 11:16:12 -07:00
nick black c1997ddc3d [jpeg] remove debugging cruft (#3134) 2021-10-16 09:20:35 -07:00
Larry Gritz 7cc7a3a816 Fix broken oiiotool --dumpdata: botched a formatting string (#3131) 2021-10-14 22:34:34 -07:00
Larry Gritz e1060c3d2a Fix typo (#3130) 2021-10-14 22:34:15 -07:00
Larry Gritz 4f77d8b8d1 Replace Imath::clamp with OIIO::clamp (#3126)
We had long ago established that the one in fmath was a slightly
faster formulation, as well as having the property of squashing
NaNs. There were a few remaining places where we used a different
clamp so fix them.
2021-10-13 21:02:27 -07:00
Larry Gritz 23de7648fa Clean up src/doc/Makefile (#3124)
It was still by default referencing the old latex files that we've
long since removed.
2021-10-13 20:57:14 -07:00
Larry Gritz 99085de393 libraw: add new color space names (#3123)
The DSLR raw format reader has the ability to pass hints to the
underlying LibRaw requesting that the pixel data be returned to us in
particular color spaces.

* Add new supported color spaces "DCI-P3" and "Rec2020" when using a
  LibRaw new enough to understand them -- which means the upcoming 0.21.

* A new name to request the data be returned using sRGB color
  primaries but a linear response curve: "sRGB-linear".

* The old name we used for sRGB-linear, "linear", is now considered
  deprecated since it's ambiguous -- since its first use, new color
  spaces "ACES", "DCI-P3", and "Rec2020" have been added, all of which
  are also linear response.
2021-10-12 22:34:26 -07:00
Larry Gritz dea9b1fa7b Beef up error checking in Targa read (#3120)
When reading tga files, make sure that every seek and every read
checks results and issues error messages. Also double check that
large allocations succeed.

Also improve error propagation in several spot of iinfo, oiiotool
2021-10-12 22:33:55 -07:00
Larry Gritz 7745ac72b9 Address new warnings revealed by clang13 (#3122) 2021-10-10 10:24:30 -07:00
Larry Gritz 37e9ac2bae ci: Bump versions for the 'latest' tests (#3121)
* OpenEXR -> 3.1.2
* pybind11 -> 2.8.0
* On Windows, no longer vcpkg install boost regex, we no longer need it.
2021-10-08 20:12:03 -07:00
Larry Gritz 780fce4dc7 Use inline constexpr for C++17 (#3119)
Owing to our C++11 focus in previous years, we had a number of places
were constants were declared as `static constexpr`. When done in
headers, this potentially causes separate copies of those constants to
be instantiated in each module that includes the header. It's not
really harmful the way we're using it for small constand objects, but
it's wasteful to potentially have dozens of copies of each those
constants by having it repeated in each module.

C++17 has a new idiom, `inline constexpr` that is more like we want --
makes it a true compiler constant that doesn't get instantiated in the
memory of each module.

We still have to cater to C++14, and in platform.h we already had a
C++-standard-dependent definition of OIIO_INLINE_CONSTEXPR that was
almost correct. Fix it (it wasn't previously used, but I must have
seen this coming at some point) so that it expands to
`inline constexpr` for C++17 and beyond, but stays as
`static constexpr` for C++14, and then use it for these constants.

Fixes #3117
2021-10-05 16:12:43 -07:00
Larry Gritz b7f470b68f Guard against invalid UDIM tile numbering (#3116)
If think that our inventory of UDIM tile files won't find names with
wildly out-of-range tile indices, you haven't been working in a
production studio! When those indices imply tile numbers < 0, we were
running off the beginning of the vector when filling in the udim
table, to hilarious results.
2021-10-01 15:08:04 -07:00
Larry Gritz 4d50578d9c Allow quotes in oiiotool command modifiers (#3112)
Oiiotool::extract_options was kind of fishy and brittle before --
splitting the string at ':' characters, then split each piece (which
should form a `name=value` pattern) at the first '=' character. There
are probably many malformed option strings that would have had weird
results with the prior naive parsing method. And it has been noted
that it can't handle a value that is intended to be a Windows filename
(like "C:/foo"), nor a searchpath (like "/usr/bin:/usr/local/bin").

Rewrite to parse it more carefully as name=value pairs delimited by
':'. In the process, we now have the ability to have the value be
enclosed by a single or double quoted string, in which case the
contents of the quote may themselves contain a colon, for example, the
following command and modifier is now no longer a problem:
`--foo:filename='C:/blah':count=3:`
2021-09-29 18:26:54 -07:00
Larry Gritz 2fbdbf9d9d TIFF output: Honor zip quality request when we do our own compression (#3110)
We were already passing this on to libtiff when it handles the
compression.  But for the case where we were calling zlib ourselves
(to facilitate multi-thread compression, which libtiff doesn't do),
we were just using the default compression.

This is inspired by a great [blog post](https://aras-p.info/blog/2021/08/05/EXR-Zip-compression-levels/)
by Aras Pranckevičius in which he made a similar change to OpenEXR
and benchmarked the results. He reported approximately a slightly more
than 2x write speed increase, while getting files that were only around
2% larger.

I tried replicating his experiment for TIFF, and while I don't quite
get results as good as he did, it still is really interesting.  I
tested with 100 images randomly selected from the [Animal Logic Lab
USD scene](https://animallogic.com/usd-alab/) (they are almost all
4k^2, a mix of 1- and 3-channel images), converted from half exr to
uint16 TIFF images. I ran the tests for both scanline and tiled
images.

Compared to the default zip level 6, using level 4 resulted in 3%
bigger files, and around 40% faster write times. That seems like it
is a potentially very helpful tradeoff.

I tested the same set of images also with zip levels 8 and 2. For
level 8, the files were only another 2% smaller than the default level
6, but the write speed was 45-50% slower, so there is little value to
asking it to work harder on compression -- it just burns up time. For
level 2, it went somewhat faster (maybe another 10% faster than level
4) but the files started getting bigger, level 2 was 12% bigger than
level 6, that's definitely getting into territory where people might
mind the larger files.

So I want to add the control now, though I'm deferring a decision on
changing the default value until I can do some more extensive
tests. In particular, I would like to assess how it behaves with 8 bit
files (I was testing uint16, specifically), how well it works with
rendered images and with natural/photographic images (I was testing a
set of textures, which may not have the same characteristics), and
perhaps also see if results are better or worse for lower resolution
images.
2021-09-29 18:24:19 -07:00
Larry Gritz 7b0352b58a Add multithreading to exr core read_scanlines and read_tiles (#3107)
The old libOpenEXR/libIlmImf (default) implementation handled
multithreading on the exr side of things, inside the readPixels method.

The new (experimental, enabled only by option) OpenEXRCore
implementation leaves the threading to the caller, and we weren't
doing it, so the performance was unsurprisingly awful.

This patch turns the implementations of the exrcore-based
read_native_scanlines and read_native_tiles (and also the deep
versions thereof) to use parallel-for loops, restoring parallel
processing to the exr reader when using OpenEXRCore.

Reading of whole scanline and tiled images now is on par or slightly
faster (a few %) than when using the main OpenEXR library. Reading of whole
scanline and tiled deep images is substantially faster (2-3x!) than
before.

I did some extra refactoring while I was there, simplifying and
eliminating some redundant error handling and using a new
DecoderDestroyer utility class.

STILL TO DO:

* See the long comment at the end of read_native_scanlines -- the error
  message strategy implemented here is temporary, I'd like to improve it,
  will probably involve both some work here as well as on the openexr
  side.
2021-09-29 13:05:30 -07:00
Larry Gritz f8aca7b0d3 SPI only: Minor tweaks to the site file. 2021-09-29 11:10:57 -07:00
Larry Gritz 6197716bf9 Suppress OCIO console info output (#3113)
Make sure OCIO isn't spraying info messages at the console when we
first ask for a config.
2021-09-28 10:32:55 -07:00
Larry Gritz ee36fd5b91 Build: Add ENABLE_INSTALL_testtex option (#3111)
If set to ON, will include the testtex program in the install.
The default is OFF, which builds it for tests, but doesn't install it
with the real command line utilities.
2021-09-28 10:32:23 -07:00
Larry Gritz 6a339bc957 Bump minimum supported OpenEXR/Imath to 2.3 (#3109)
In forward looking code (current master means OIIO 2.4, which won't
be released until mid-2022), get rid of some stray logic catering to
OpenEXR releases 2.2 and older.
2021-09-28 10:31:40 -07:00
Larry Gritz 8de11b8d73 Build: fix over-eager use of targets (#3108)
Background: Old style CMake was to use FindFoo.cmake modules, which
set FOO_INCLUDES and FOO_LIBRARIES variables. Best new cmake practices
are for the upstream packages themselves to export a FooConfig.cmake
and friends, which set up cmake targets. Of course, many packages don't
provide exported configs, so we use the old Find modules for many of
our dependencies.

I've slowly been migrating our Find modules to set up targets in addition
to the variables, and favoring use of the targets over the variables.

But I was wrong about this. It's more than just a choice of style.
When targets are used, use of transitive linkage (especially for static
library versions of dependencies) make the dependency targets show up in
our own exported OpenImageIOConfig.cmake. But to a downstream package,
now our config talks about a target like Libsquish::Libsquish, but it
doesn't know what that is, and it doesn't have the FindLibsquish.cmake
module that we used (internally) when we found that dependency.

This was causing particular problems for Libsquish on Windows with
vcpkg, but I see now that this could be a problem elsewhere as well:
field3d, libheif, openvdb, and webp.

So this patch:

* Reverts from the ill-advised targets back to the old style
  variables, for the dependencies where we use *custom* Find modules.
  (We presume that a dependency's exported configs, as well as any
  Find modules that are distributed as part of CMake itself and define
  targets, are done correctly, and will be available to downstream
  packages, and so we continue to use targets in those cases.)

* Beefs up our FindLibsquish.cmake module to correctly find debug
  versions of the library, to use in debug builds.

* Alters build_webp.bash to allow WEBP_BUILD_TYPE to override the build
  type, which had previously been hard-coded to Release.

* Removes search for HDF5, which as far as I can tell was unused
  directly by OIIO.
2021-09-27 21:49:57 -07:00
Larry Gritz 9d2a52341d strutil_test: add a test of split when the separator is not found (#3106)
I had a hunch about a problem. Was wrong, this function worked right
all along. But I'm keeping the beefed-up test.
2021-09-25 10:01:51 -07:00
Larry Gritz 93a16297e3 fmath: Improvements to round_to_multiple (#3104)
* More clearly document, test, and correctly handle the cases where
  the value < 0.

* Add `round_down_to_multiple`.
2021-09-20 23:10:14 -07:00
Larry Gritz 78901c3b04 Always have OpenEXRCore C library on tap -- with option (#3100)
Instead of a build-time option for enabling (and always using) the
experimental OpenEXR "core" library...

* Build support for it by default any time we're using a new enough
  OpenEXR version (>= 3.1). You can still hard-disable it being compiled
  in at all with `-DOIIO_USE_EXR_C_API=OFF`.

* Select whether it's actually used with the global OIIO attribute
  "openexr:core" (default to 0, disabled, for now).

This easily lets an app select support at runtime, and also may be
selected by user with environment variable
`OPENIMAGEIO_OPTIONS="openexr:core=1".

This all is intended to make it easier to benchmark use of this new
feature, switching back and forth without a rebuild.
2021-09-20 23:09:56 -07:00
Larry Gritz 31d5a6f1d3 Remove FindOpenImageIO.cmake (#3098)
Downstream clients should use the exported config.
2021-09-20 22:56:17 -07:00
Larry Gritz eb4b84e74d OCIO 2.1 now exports cmake config -- explain 2021-09-17 20:38:24 -07:00
Larry Gritz 4399477fd4 Improvements to font finding (#3096)
* Honor env $OPENIMAGEIO_FONTS as an additinal font searchpath.

* Global attribute "font_searchpath" as an additional font searchpath.

* Refactor and simplify the code that assembles the list of directories
  to search.
2021-09-16 19:53:05 -07:00
Larry Gritz 2d14cec834 Adjust logic of getting OCIO config (#3095)
When $OCIO was not set at all, the call to OCIO::GetCurrentConfig()
was checking it again and writing the info message that none was found
to stdout, which we really don't want.  And as Patrick pointed out
recently, asking for the "current" config is suspect, since who knows
exatly what the app has done.

So we're making the following executive decision: At least from OIIO's
viewpoint, if you want an OCIO color config, you either have to name it
expliticly, or have it determined by the `$OCIO` env variable. That makes
cleaner logic, and also rids us of the info messages.

I also now have the exported cmake config set
`OpenImageIO_HAS_OpenColorIO`. This makes it easier for downstream
consumers of our exported OpenImageIOConfig.cmake to know if the OIIO
build they have found has build-in support of OpenColorIO.
2021-09-15 10:24:59 -07:00
Larry Gritz 9dc2f971fd Fix ImageBuf::read bug for images of mixed per-channel data types (#3088)
When it comes time to read_image() into the ImageBuf's internal
memory, we should have said to convert to `m_spec.format`, which
describes the buffer we allocated. Instead, we asked for `convert`,
which is the user request, which at that time can still be UNKNOWN,
which indicates to preserve the file's data format, which in fact does
not necessarily match the internal buffer.

This becomes especially troublesome for images with mixed per-channel
data types, which will obviously never match the internal buffer since
ImageBuf only internally stores one data format for all channels.
2021-09-15 09:57:03 -07:00
Larry Gritz 689bfbfd54 When possible (>= C++17) use std::gcd instead of boost (#3076)
This is a very low priority change, but every little bit helps when it
comes to limiting boost's footprint as thing we used to require it for
become available in the standard library.
2021-09-15 09:46:43 -07:00
Larry Gritz cc67fab4f3 Rewrite ColorConfig::reset for clearer logic and better err handling (#3092)
Add tests to be sure we have reasonable error reporting for at least
two important cases: a specified OCIO config file is not found at all,
and an OCIO config is present but cannot be read (in particular, if
the config is newer than the library). Because the exact error spewage
is different for each OCIO version, and apparently also depending on
the exact version of the yaml library that OCIO used, we have a few
different possible output references.

* oiiotool --nostderr (new hidden command)

This hidden flag causes oiiotool errors to go to stdout instead of the
default stderr. It only does this for oiiotool's own error and warning
calls; if there are other places within library functions that
directly output to stderr, they will not be redirected by this
command.

The main purpose of this is for testsuite and debugging. I don't
expect ordinary users to have any use for this, and so it is currently
hidden from the oiiotool --help explanation.  If it seems useful for
something other than testsuite, I'll expose it in oiiotool --help.

It seems that for the case of OCIOv1 reading a v2 config, OCIO itself spews a bunch of warnings to stderr. And apparently the order is nondeterministic, because I just could not get any set of reference error output to match stably from run to run in CI. But the problem is, if I don't capture stderr, I also don't get the oiiotool error messages, which are the very thing I'm trying to test!

So what I did is add a new flag to oiiotool, --nostderr, which causes oiiotool's error and warnings to get sent to stdout rather than stderr. This lets me capture the usual output and the error messages from oiiotool, for this test, while allowing OCIO's stray stderr output to go into the ether where we don't care about its order.

I'm not sure if there's any non-CI, non-debugging application for oiiotool --nostderr, but maybe it'll turn out to be generally useful.
2021-09-11 19:10:36 -07:00
Larry Gritz 5506f34f85 Use latest aswf docker container for vfx platform 2022 (#3094) 2021-09-10 22:09:40 -07:00
Larry Gritz 7b22ba6305 CI: Adjust how we specify what to exclude from failure artifacts (#3091)
We weren't using a recognized notation, and so our artifacts were
including huge files unintentionally.
2021-09-04 18:20:34 -07:00
Larry Gritz d8661b783c OCIO: better catching of exceptions. (#3089)
When OIIO that was built against OCIO 1.x, but encounters an OCIO 2.x
config file, OCIO could throw an exception that was not caught by
OIIO.  The problem was the call to OCIO::GetCurrentConfig(), it should
have been inside the try/catch block.
2021-09-03 19:02:59 -07:00
Dalai Felinto 085aa98cc4 Update CREDITS.md (typo) (#3090) 2021-09-03 10:38:53 -07:00
Larry Gritz 6ba1f1faa4 CHANGES 2021-08-31 23:41:10 -07:00
Larry Gritz 7037cfba47 CI: Build VFXP2022 and latest releases against OCIO 2.1 (#3080) 2021-08-31 23:36:05 -07:00
Larry Gritz 112a318ad6 Additional TIFF IOProxy bug fix -- we don't want a full init inside open (#3077)
Calling close() in open will forget too much state. All we want to do
here is make sure the TIFF file itself is closed at that point (so it
can be re-opened in append mode to add a subsequent subimage).
2021-08-31 08:48:50 -07:00
0ea473527a tiffoutput: support ioproxy (#3075)
Co-authored-by: Alexandre Gauthier-Foichat <alexandre.gauthier@left-angle.com>
Co-authored-by: Larry Gritz <lg@larrygritz.com>
2021-08-30 14:51:10 -07:00
Larry Gritz b53cdeddc8 CI test for VP2022, fix revealed python binding bugs (#3074)
* CI test for VP2022, fix revealed python binding bugs

* CI test against ASWF's latest VFXPlatform-2022 docker container,
  including Python 3.9.

* Pesky crash resulted in testsuite/python-imagebufalgo, laboriously
  traced to IBA_color_range_check releasing the GIL too liberally. The
  scoped release cannot contain the tuple construction!

* Audited the rest of py_imagebufalgo.cpp and found the same mistake in
  only one other place: IBA_histogram. Was asymptomatic so far, but fixed
  now.

* Presumably we just got lucky and these bugs were never symptomatic
  until we started building against Python 3.9.

* Noticed that the recent change in build tree layout where we now
  copy the test images into the build/testsuite area, resulted in HUGE
  GHA build artifacts for failed tests. Modify ci.yml use of
  upload-artifact action to exclude those directories.

* more tweaks
2021-08-30 09:14:04 -07:00
Larry Gritz bdf6a40bad oiiotool: Overhaul operations timing (#3073)
oiiotool --runstats tries to report how much time was taken by each
operation.  But it has always had a major flaw: Because we try to read
input files lazily and use ImageCache underneath, only in certain
circumstances do the true cost of reading the files show up in the
entry for "-i"; often the cost gets wrongly credited to the other
command (like --add or -o) whose operations triggered the I/O.

This patch addresses the problem, and I think correctly credits I/O
time where it belongs.

The workhorse here is a new helper class within oiiotool,
OTScopedTimer, which does some tricks to try to account for both
direct read time and ImageCache I/O time, subtracting those from the
op it was instructed to time and instead adding it to the counter for
"-i".  Because the destructor apportions time to the right commands,
this eliminates a whole bunch of spots where we did that by hand.

Also fixed a few places where ops directly called ImageRec::read()
instead of Oiiotool::read(), which would also result in bypassing some
timers we relied on. I made the ImageRec one be private, so harder to
make that mistake in the future.
2021-08-30 09:13:40 -07:00
Larry Gritz 159d7e7ae9 Beef up strongparam.h comments and fix typo 2021-08-25 21:02:42 -07:00
Larry Gritz 218e1bd731 gitignore adjustments
Make it ignore a lot of the test case clutter I tend to accumulate
in the project root.
2021-08-25 21:02:24 -07:00
Larry Gritz be5dda397f Timer::add_seconds, add_ticks (#3070)
Add methods to the Timer class that allows you to add (or subtract, if
negtive) to the total elapsed value of a timer.
2021-08-24 21:22:47 -07:00
Larry Gritz 97532b814f Build: Be careful about default installation directory (#3069)
Use a cmake idiom so that you need an explicit `-DCMAKE_INSTALL_PREFIX=`
in order to write over /usr/local or any potentially sensitive area.
In the absence of this being set explicitly, it will configure the
cmake build so that an "install" ends up in ./dist (which is what the
Makefile wrapper did all along).
2021-08-24 21:21:37 -07:00
Larry Gritz 8b4f8f2321 oiiotool --ch : reduce expense for no-op (#3068)
Before doing all the work of copying the image, first see if the
`--ch` is actually specifying any change versus the image as it
stands. If not, skip all the copying and just stick to the image we
have.

The main benefit here is if you have a --ch primarily for "conformance",
e.g. you want to reduce to a known subset of channels and remove any
extra that may be unanticipated in the input, but it's possible that
the input will come to you already with only the desired channels. As
an example,

    oiiotool in.exr --ch R,G,B ...more ops... -o out.exr

Previously, if in.exr aleady had channels R,G,B (and no other), there
would be some unneceessary expense of creating (in memory) a new image
for the output of --ch copying data to fill it in. With this patch,
the --ch would very nearly turn into a no-op. In both cases, if
in.exr's channels were something other than R,G,B, channel copies
would need to be done identically in both old and new code.
2021-08-24 21:20:54 -07:00
Larry Gritz 0ab127226a Build scripts: rename OIIO_DEP_DOWNLOAD_ONLY to DEP_DOWNLOAD_ONLY (#3072)
I realized after this was merged that I often share and copy a lot of
these little dependency build scripts across multiple projects, so I
wanted to remove the OIIO-specific naming.
2021-08-24 21:20:17 -07:00
Larry Gritz 4ebae5f91e Update ref output for slightly different libjpeg 2021-08-23 16:18:09 -07:00
Shootfast 5024e8dd5e formatspec: Implemented deserialization of extra_attribs from XML (#3066) 2021-08-20 22:32:50 -07:00
Larry Gritz c6b4424564 More testsuite cleanup for arbitrary build directory (#3067)
To help make testsuite pass even with nonstandard relative path to the
build area, slightly change how we reference the OCIO config that is
in the testsuite.
2021-08-20 18:36:32 -07:00
Larry Gritz 741c6d7b51 Increase timer_test slop in CI to remove spurious failures 2021-08-20 13:07:47 -07:00
Larry Gritz 44bbf1f434 Testsuite: fix use of OIIO_TESTSUITE_ROOT (#3065)
Fixes python error about OIIO_TESTSUITE_ROOT not defined in the case
where the testsuite dir wasn't found in the standard places. This can
happen if you put the build directory in an unusual location that's
not right in the main project area.
2021-08-20 12:29:04 -07:00
Thomas MansencalandThomas Mansencal 1866f2fdb8 PR: Minor Windows Build Fixes (#3062)
* Ensure that "CMAKE" built "OpenCV" libraries can be found.

* Fix incorrect url to "openexr-images" repository.

* Fix typo in "FindTBB.cmake" module.

Co-authored-by: Thomas Mansencal <tmansencal@wetafx.co.nz>
2021-08-19 09:27:49 -07:00
Larry Gritz 8ff28a9d58 Fix typo in test generation 2021-08-18 16:28:38 -07:00
Larry Gritz 09766c95a9 Bump version to 2.4.0.0 after branching 2.3beta 2021-08-17 17:15:21 -07:00
Larry Gritz a17769cb57 CHANGES 2021-08-17 13:48:31 -07:00
Larry Gritz 231e885c21 Fewer spurious CI failures for timer_test 2021-08-17 13:48:31 -07:00
Larry Gritz 273952b642 cmake: checked_find_package enhancements (#3061)
* New SETVARIABLES option sets named cmake variabes to true if the
  package is found.
* DEBUG should print variables even if not found. Duh, failing to find
  the package is the most important debugging situation.
2021-08-16 09:01:14 -07:00
Larry Gritz f91d391b1a Build: collapse build and dist hierarchy (#3057)
For historical reasons, our wrapper makefiles assume that we build in
`build/ARCH[.variant]`, so maybe build/linux64, build/linux64.debug, etc.

I think this is a throwback to literally decades ago when I would
build multiple architectures from different machines that viewed a
common shared directory of code, this allowing them to build
simultaneously and/or erase one without needing to rebuild the others,
etc.

But now I find that:
* It's contrary to modern cmake practice, and there are many benefits
  to having our build directory structure identical to the vast majority
  of other open source projects.
* I never want or need those simultaneous builds in practice, haven't
  for a long, long time.
* ccache means that there is no longer an onerous cost to, for example,
  having to blow away a release build and do a debug build and then
  blow that away and do release again. It's just a few seconds to do a
  ccache-based full rebuild of a recently-built tree.

So this patch switches all our assumptions to having a single level
hierarchy to the build and dist areas.

Also, I'm changing the assumption that the oiio-images (and other data
sets used by the testsuite) live "up a level", but instead added code
that either copies it from there (or another area settable with the
cmake variable OIIO_LOCAL_TESTDATA_ROOT) or downloads it, into the
build/testsuite directory itself. This simplifies a great number of things
in the test scripts as well as the test reference output (a lot of which
changes slightly to accommodate the new paths to test files).
2021-08-15 15:00:24 -07:00
Larry Gritz 63f69cbca8 Try to decrease spurious CI failures (#3059)
* On Windows, increase number of tries for tests that timeout.
* On all CI runs, allow timer_test to be less accurate.
2021-08-15 14:25:11 -07:00
Larry Gritz 83e44727f5 Update FindTBB.cmake to create proper targets (#3060) 2021-08-15 14:24:54 -07:00
Shootfast b2f9a9be79 RAW plugin improvements (#3045)
* raw: Fixed output when raw:Demosaic == "none"

* raw: Include metadata regarding filter pattern

* raw: Added missing call to set unpacked status

* raw: Implement "balance_clamped" mode to help HDRI processing

* raw: Implement raw:apply_scene_linear_scale feature

* Fix up formatting with clang-format

* Update testsuite reference output

* raw: Fixed error message format handling

* raw: Updated documentation to include new raw features
2021-08-14 14:03:57 -07:00
Anders Langlands bbc2dfca2c Add flags to control stages of dependency build scripts (#3058)
* Ensure that all the `build_*.bash` scripts don't download anything if the packages appear to already be there.
* Env variable `OIIO_DEP_DOWNLOAD_ONLY` can be used to do the download only (if not present) and skip the actual build.

This combination allow the scripts to be run twice: once to do all the network I/O to download the packages we'll need, and a second time to trigger the builds.
2021-08-14 09:58:24 -07:00
Larry Gritz 0dd908f4e9 New oiiotool commands: --printinfo, --printstats (#3056)
The existing --info and --stats seem a little confusing and
inflexible.  Unlike the majority of oiiotool arguments which are
evaluated in order, these merely set flags which apply to the entire
oiiotool command (specifically, they cause all image inputs to print
the metadata or image statistics at the time that the input are read
from disk).  There isn't a way to make it apply to a single image, nor
to print the metadata or stats of any *computed* image, leading some
people to awkwardly save a computed image and re-read it merely to
print information about it.

So in this patch, we add new commands

* `--printinfo` which is like `-info -v` but is done immediately for
  the "current" image on the top of the stack (even if it's a computed
  image and does not correspond to any disk file).

* `--printstats` which is like `--stats` but is done immediately for
  the current image on top of the stack.

  Furthermore, `--printstats` takes an optional modifier `:window=`
  which can be given a rectangular region in either of the notations
  we use ("WxH+X+Y" or "xmin,xmax,ymin,ymax"), for example:

      oiiotool blah.exr --printstats:window=30x30+1000+500

  prints the statistics of the 30x30 region whose upper left corner
  is pixel (1000,500).

The code to implement this is actually pretty short and straightforward,
but this patch turns out to touch a lot more. I needed to plumb
some of the info-printing internals for this support and did some
refactoring along the way.

Also, upon adding these to the docs, I realized that it would be
better to reorganize a bit to separate descriptions of the "flags"
from the "actions", and so many of the oiiotool arguments got shuffled
between different subsections, and in a few cases the descriptions
themselves got rewritten for clarity.
2021-08-13 21:21:54 -07:00
Larry Gritz 2284dc038e Udim refactor and expose more helper functions (#3054)
To help applications that need to deal with UDIM textures, the
TextureSystem now exposes the following public API calls:

* is_udim() : is a filename (or a `TextureHandle*`) referring to a
  UDIM pattern / virtual file?

* resolve_udim() : given a filename (or handle) and s,t coordinates,
  return the handle for the concrete file corresponding to those
  coordinates.

* inventory_udim(): retrieve the full list of concrete filenames, as a
  vector indexed by `(utile + vtile * nvtiles)`, and the nutiles,
  nvtiles counts. Empty filenames in the vector indicate UDIM tiles
  that are not populated.

Some extra functionality falls out naturally from these and existing
ingredients:

* inventory_udim + get_texture_handle together can get you the list of
  handles corresponding to each found udim tile.

* resolve_udim + get_texture_info together can retrieve the attributes
  of the udim tile corresponding to a particular texture coordinate.

Additionally, I have done some refactoring and performance
improvements of the internals:

* The internal UdimInfo that's stored inside the ImageCacheFile record
  is now a vector, not a flat_map, so conversion of texture
  coordinates to a handle is now O(1) rather than O(log n).

* Per Luke Emrose's suggestion, use `rcontains()` when searching for
  UDIM pattern markers, since they will almost always occur close to the
  end of the full pathname.

* Added TextureSystem and ImageCache methods that lets you find out
  the filename that corresponds to a handle. (That's bound to be handy
  for somebody.)

* Beefed up the udim tests to be sure to test every udim notation that
  we support.
2021-08-11 20:51:38 -07:00
Thomas Mansencal 6a3b7569a0 Fix broken section links in "INSTALL.md" file. (#3055) 2021-08-09 16:08:11 -07:00
Larry Gritz 77217afe20 Strutil: Add rcontains, ircontains, improve contains, docs (#3053)
* At the suggestion of Luke Emrose, add rcontains() and ircontains(),
  which are like contains/icontains, but start the search at the end
  of the string rather than the beginning. This is measurably faster
  than contains() for the case when you are reasonably certain that if
  the search pattern is found at all, it is highly likely to be close
  to the end of the string. (They're approximately the same speed when
  the pattern is not found.)

* To verify this, I added a bunch of benchmarking to strutil_test.

* The benchmarks also revealed that contains was about 2x slower than
  calling find! It should be the same. I don't know what the underlying
  boost::algorithm::contains is doing differently than find, but whatever.
  Changing our implementation of Strutil::contains to simply call find
  doubles its speed.

* The new implementation of contains has an extremely minor behavior
  change for the degenerate case of `contains("", "")`, which used to
  return true and now returns false. Since the right behavior here is
  debatable at best (is it false because the first empty string
  contains nothing? or is it true because containts(a,b) should return
  true if a==b?), I'm going to accept this behavior change as well
  worth the 2x speed improvement (besides, "contains(a,b) should have
  the same result as find(a,b)!=npos" is also a reasonable
  expectation).

* The benchmarks also reveal that the case-insensitive functions (like
  ifind) are not just a little bit slower than their case-sensitive
  siblings (like find), they are 20x or more slower! I don't think
  there is anything to do about that, but I did note it in the
  documentation of those functions so that we are disuaded from using
  them except when a case-insensitive test is really necessary.
2021-08-07 20:33:55 -07:00
pumkinpal 57fe02c0e2 WebpInput: Fixed mismatched new[] and delete (#3052) 2021-08-05 14:09:14 -07:00
Larry Gritz 2c7e762774 Udim improvements (#3049)
The primary issue being addressed here was that get_texture_info() on a
udim pattern filename (like "foo_<UDIM>.exr") was unable to retrieve
info, except for an extremely narrow range of queries, because of course,
different UDIM "tiles" might have different attributes or be missing.

So in consultation with Lee Kerley, we decided that get_texture_info should
work as follows:

* If the attribute exists and has the same value for all of the
  matching UDIM file files, then succeed and return the value.

* If any of the tile files does not contain the attribute, or if the
  attribute doesn't have the same value in all found files, then it's
  a failure and the value cannot be retrieved.

This necessitated a more rebust accounting of all the tile files
comprising a UDIM pattern, by doing a full inventory the first time
the UDIM pattern is encountered, rather than (ick) iterating through
all possible tile files every time we retrieve an attribute, as we
were apparently doing before. And so the following improvements were
also made:

* get_texture_info now works for more queries -- in fact, any query
  that would be possible to ask about on an individual file, without
  restriction.  (Though, as I said, the query will fail if the value
  isn't identical across all the found tile files.)

* The info queries (even the few that were previously supported) will
  be MUCH FASTER than before, because we are doing the tile file
  inventory once per udim pattern, rather than on every query.

* That inventory will also pre-build the association between u,v tiles
  and the concrete filename (and texture handle!), so that each
  individual texture call does a simple map lookup to get all the way
  to the texture handle, without any string manipulation to first
  construct a concrete filename, then look that new filename up in the
  cache to get a handle, etc. I'm expecting this to reduce some of the
  overhead of using UDIM files with the TextureSystem.

Note: I added an ImageCacheImpl::find_file_no_add at some point in
this work, eventually not needing it by the time I got to the final
version of my implementation of this PR, but I'm going to keep it
because I can forsee its usefulness and I don't want to delete it only
to write it again some day.
2021-08-04 21:05:33 -07:00
Larry Gritz cd6c0f146f Remove the experimental C APIs (#3051)
We now think that this C API should be removed, and replaced by a
different one coming soon.

Merely commented out the option and other lines in the top-level
CMakeLists.txt, since almost the exact thing will be needed eventually.
Also kept libOpenImageIO-C/CMakeLists.txt since we'll eventually need
one much like it. But deleted the .cpp and .h files, since those will
be totally replaced.
2021-08-04 20:26:34 -07:00
Larry Gritz 263abf165a Build: Updates to handling OpenColorIO (#3050)
For the upcoming OCIO 2.1, the library names will incorporate the
major/minor version numbers, so our Find module needs to take that into
consideration.

Work towards eventually using OCIO exported configs (though still not
100% working now, may need fixes on their end).

Change CI to use the OCIO's that come in the aswf containers instead
of building from scratch in many cases.
2021-08-04 20:21:19 -07:00
Larry Gritz faac914959 filesystem.h: Switch some methods to using string_view (#3047)
Also improve comment documenting get_directory_entires, I realized it
was a little garbled.
2021-08-03 08:29:45 -07:00
Larry Gritz 1bc0cdcebf Filesystem::filename_to_regex (#3046)
Sometimes we use a filename, or pieces of it, as a regex.
But filenames can have characters that are interpreted differently when
part of a regex pattern (like `.`, which in a filename is literal, but
in a regex means to match any character!).

So this handy utility inserts the right backslashes so the filename will
end up as a literal match when part of a regex.
Furthermore, there's an optional parameter `simple_glob`, which when
true, will also substitute `?` with `.?` and `*` with `.*`.

We then use this to fix a latent bug in scan_for_matching_filenames():
it could have incorrectly matched files during the search.
2021-08-02 18:33:28 -07:00
Larry Gritz 5f2cdb5828 imagebuf.h: remove inclusion of imagecache.h (#3036)
I noticed when working on an ImageCache thing that even the smallest
change to imagecache.h was causing a substantial amount of the
codebase to needlessly recompile even though very few places really
need to use the IC APIs directly.

It took a little bit of juggling of some declarations, but this patch
allows imagebuf.h to be able to treat ImageCache and ImageCacheTile as
opaque, forward-declared types, without the need for every file that
needs imagebuf.h to also have to parse imagecache.h and everything it
might pull in.

This speeds up my development cycle substantially in many cases, and
it also speeds up compilation of user code (by a small amount) by
avoiding parsing of imagecache.h in circumstances where the user code
only needed to know about ImageBuf but not ImageCache.

There's a downside to this -- it's possible that user code that truly
needs both imagebuf.h and imagecache.h only includes the former
(inadvertently relying on the fact that the latter was transitively
included). These apps may need `#include <OpenImageIO/imagecache.h>`
to be added after upgrading to OIIO 2.3. Is that really really bad?
2021-08-02 18:32:52 -07:00
Larry Gritz 3e31830158 Strutil::contains_any_char (#3043)
Added this handy function that figures out if the first string contains
any character present in the second string.

Also rewrite the comments describing parse_until and parse_while for
better clarity and correctness.
2021-08-01 12:21:26 -07:00
Larry Gritz de53f325ef exr read: don't rename "version" attribute to "openexr:version" (#3044)
Some of the OpenEXR sample files had an attribute "version".
All along, I assumed this was telling me the version of the OpenEXR file
itself, so I was passing it along and also renaming "openexr:version".

Turns out I was wrong! This is just arbitrary metadata. Who knows why
it's in some of these files? Maybe nobody. But it's not meant to indicate
the file format version, and indeed it does not correctly reflect it.

In fact, there is no simple API call in the OpenEXR API that tells you
the file format version, you have to infer it from the features
present (multi-part or deep or long attribute name indicate changes
that came along with OpenEXR 2.x, but there is no version number in
the file per se).

So I'm just going to stop doing this rename, let "version" be "version",
it's just some user's metadata, I guess.
2021-08-01 12:20:37 -07:00
Larry Gritz b0b17a8f35 openexr reader internals: Remove unused fields (#3042) 2021-07-31 14:04:05 -07:00
Larry Gritz 3fdb3ecc21 Overhaul of how to read/write thumbnails (#3021)
A few image formats (but not most) support "thumbnails" -- low-res preview
images.

Traditionally, we have shoved them in the ImageSpec metadata as a byte
array (and ints for the width, height, nchannels). This is less than
ideal: It makes the metadata very bloated, taking more memory and
being more expensive to copy metadata, and potentially wastes time
doing I/O on this data that most applications don't want or
need. (Remember that any alterations to the image will make the
thumbnail "wrong", also. So it's rarely useful except for applications
that specifically want a preview image.)

Discussion in Issue 2902 led us to think that thumbnails should be
treated explicitly by the API, rather than shoved into the metadata in
this way. This patch is the attempt to overhaul thumbnail handling:

* ImageInput has a new `get_thumbnail()` method that can retrieve the
  thumbnail (if it exists) into an ImageBuf. The base class / default
  implementation does nothing; the image formats that support
  thumbnails should have their readers override this method. They are
  encouraged to read the thumbnails "lazily" if possible -- only
  if/when this method is called, and avoid the cost, memory, and I/O
  if not requested.

* ImageOutput likewise has a new `set_thumbnail` method.

* These are implemented for Targa and PSD, the only two formats for
  which we previously had implemented thumbnail functionality. (There
  are probably other formats that support thumbnails, but for which we
  never added OIIO support. Leave that for another day.)

* ImageBuf has new `has_thumbnail`, `get_thumbnail`, `set_thumbnail`,
  and `clear_thumbnail` methods.

* ImageCache has a new `get_thumbnail` method.

* oiiotool and iconvert attempt to preserve a thumbnail from input to
  output (but of course, only if both file types support it).

* ImageBufAlgo::IBAPrep clears the thumbnail in the destination image,
  on the theory that pretty much everything IBA would ever do will
  likely invalidate any preview image that it started with. This gets
  us to the point with oiiotool where a straight copy (like a format
  conversion) `oiiotool in.tga -o out.tga` will preserve the thumbnail,
  but just about anything else `oiiotool in.tga --stuff -o out.tga`
  will not transmit the original thumbnail to the output (which would
  almost certainly be wrong).

There is more work to do in the future. Some file formats that support
thumbnails don't yet have OIIO support for it. I'm not sure we ever
really want (except in the case of a truly straight copy) for oiiotool
to keep any input thumbnails; maybe if a thumbnail is wanted for
output, it should always be created anew (by downscaling) so that it
definitely matches the main image? Maybe also oiiotool needs a command
to explicitly extract and save the thumbnail (is that needed for any
legit use? or only as a debugging tool?).
2021-07-30 19:24:52 -07:00
Larry Gritz 7fe6710406 Streamline determination of whether file type is procedural. (#3039)
Imagecache repeatedly has to determine whether a filename is a type
of file that's "procedural" and does it expensively -- every time, it
creates the type of ImageInput in question just to ask it if it
supports("procedural").

We can ask this of each plugin type once, when we first register it.
Then just look it up when we need it.

This is strictly internal, has nothing to do with public APIs.
2021-07-30 10:06:21 -07:00
Larry Gritz b866cc9210 Augment PR 3037 to make it not break ABI compat (#3040) 2021-07-29 16:49:20 -07:00
Larry Gritz 0aaed34c2e Let CUE_THREADS help determine default number of threads for OIIO (#3038)
OpenCue-launched apps are encouraged to honor the setting of
CUE_THREADS to limit the number of threads they use. This change makes
oiiotool (and other OIIO-based tools and scripts) better citizens when run
as part of an OpenCue job.

CUE_THREADS has lower precedence than the more OIIO-specific
`OPENIMAGEIO_THREADS`.

For ordinary command line usage, this should not change behavior, since
you wouldn't expect CUE_THREADS to be set.

(Also fix docs which incorrectly named `OPENIMAGEIO_TEXTURE_OPTIONS`.)
2021-07-28 09:50:26 -07:00
Larry Gritz 4ba3380305 Extend Sysutil::getenv() to take a default if the env var is not found (#3037) 2021-07-27 09:31:39 -07:00
Larry Gritz 3df1923e5a CI: update "latest" releases we test against, notably OpenEXR 3.1 (#3033)
OpenEXR -> 3.1.0
pybind11 -> 2.7.0
OCIO -> 2.0.1
2021-07-25 16:04:50 -07:00
Larry Gritz bc1a8b3541 ImageCache: add a variety of invalidate() that takes an ImageHandle* (#3035)
Most of the rest of the IC methods that take a filename, also have
a version that takes a handle.
2021-07-25 14:08:03 -07:00
Larry Gritz d1fb156ebb Mark some long-deprecated things with OIIO_DEPRECATED (#3032)
And make sure to switch all of our internal uses of those to the
preferred new equivalents!

Also, hide some deprecated things from the documentation system so that
new people won't be tempted to use them.

These are all things that have been deprecated starting with OIIO 2.0
(or in some cases, even earlier). Multiple releases (2.0, 2.1, 2.2)
have gone by with them commented or documented as deprecated, but
without our adding the warnings. It's about time. We're still not
taking them away entirely, I usually don't do that until we've had at
least one release where it's been marked as OIIO_DEPRECATED, and also
only do true removals of API at major releases. But we're laying the
groundwork for being able to totally remove these when we eventually
have a 3.0 release.
2021-07-17 16:56:13 -07:00
zomgrolf d1073accae Make finding Boost more flexible. (#3031)
This patch modifies the build system to make it possible to control
whether OIIO should link Boost in the form of static or dynamic
libraries, independently from the LINKSTATIC setting, without
having to use the fully custom route (BOOST_CUSTOM).

This is done by preserving the value of the Boost_USE_STATIC_LIBS
variable, if it has been defined by the user. If the value
of Boost_USE_STATIC_LIBS has NOT been explicitly defined, it is
set to match the value of the LINKSTATIC variable, which should
result in Boost being linked in the same way as other dependencies.
2021-07-17 16:49:01 -07:00
Larry Gritz 23116709f5 Bump version after dev preview release 2021-07-16 14:56:53 -07:00
Larry Gritz 5f515f20bf CHANGES 2021-07-15 12:07:24 -07:00
Larry Gritz fea77d3f9d oiiotool: Get rid of long-deprecated, useless --histogram function (#3029) 2021-07-15 12:01:38 -07:00
Larry Gritz 280b337ccf Improve ImageBufAlgo docs 2021-07-13 22:07:06 -07:00
Larry Gritz 9b107a7e96 Document ImageOutput::copy_image as being not thread-safe 2021-07-13 13:45:30 -07:00
Larry Gritz 7f4806fde0 Document and minor changes to uvslopes_scale argument to bumpslopes (#3028)
Slightly amends PR 3012

* Add docs for this recently-added feature.

* Change the make_texture configuration hint to "maketx:uvslopes_scale"
  for symmetry with all the other texture conversion configuration names.
  Everything works as before, including setting "uvslopes_scale"
  metadata in the file.  (But still accept the name without the
  prefix as a synonym.)

* Change it to a float for a bit more flexibility.
2021-07-13 13:12:56 -07:00
Kimball Thurston 06ce4521e7 Updates after API simplification pass in EXR master (#3027)
The core API has been made consistent with the language in the file
layout documentation. 

Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
2021-07-12 11:58:26 -07:00
Larry Gritz a4e4114a91 Give oiiotool --mosaic a new optional fit=WxH modifier (#3026)
Ordinarily, --mosaic takes the N images you have, arranges them into a
rectangular array of "cells" where the cell size is simply the biggest
image of the collection.

This adds the optional modifier `:fit=WxH` that lets you specify a
cell size expliticly. Images will be sized to fit the dimensions in
the same way as the `--fit` works (maximally filling the dimensions
while preserving aspect ratio of the original image).

This is particularly helpful for creating a contact sheet from full-size
frames, without having to do any resizing as a separate step.
2021-07-11 09:49:04 -07:00
Larry Gritz 155b4571fb Allow oiiotool to print metadata of computed images (#3025)
The existing semantics of `oiiotool -info`, `-info -v` and `-stats`
are that these options set flags so that each time a file is opened
for the first time, it will print the metadata and/or stats. But these
do not allow you to create new images and print their metadata or stats
(at least, not without writing to disk and reading those files).

This patch extends the expression substition syntax to recognize the
following new metadata notations:

* `METABRIEF` : a string containing the brief one-line description that
  would be printed with `oiiotool -info`.
* `META` : a multi-line string containing the full metadata that would
  be printed with `oiiotool -info -v`.
* `STATS` : a multi-line string containing the image statistics that would
  be printed with `oiiotool -stats`.

Some interesting use cases are illustrated with these examples:

    # Roughly the same behavior as `oiiotool -info img.exr`:
    oiiotool img.exr -echo "{TOP.filename} : {TOP.METABRIEF}"

    # Perform computations on an image and print statistics about
    # the computed image (not the original):
    oiiotool img.exr -blur 3x3 -echo "blurred stats: {TOP.STATS}"

    # Print statistics on intermediate results... and keep going with
    # more operations:
    oiiotool fg.exr bg.exr -over -echo "{TOP.STATS}" -o comp.exr

    # Write metdata as "burn-in" on an image:
    oiiotool in.exr -text:x=10:y=20 "{TOP.META}" -o burned.exr

The implementation in the business logic of oiiotool.cpp was very
simple.  The more extensive change behind the scenes to make this
possible was a massive refactoring of printinfo.cpp, which previously
just wrote everything to stdout in a totally undisciplined fashion,
and transforming it to very carefully write to output streams instead,
which could be passed a stringstream to render the metadata listing or
stats output as a string. Also needed some refactoring to allow it to
take either the name of a file to read anew (as it did before), or an
existing ImageBuf/ImageRec (to support the new feature).
2021-07-07 22:36:31 -07:00
Larry Gritz 771bc2523a IBA::render_text and oiiotool --text honor linefeed chars (#3024)
Allow multiple lines of text to be specified per call, as long as you
don't mind single spacing.
2021-07-07 10:42:00 -07:00
Larry Gritz 4d52d34043 ImageBuf: Expose strides to ctr from wrapped buffer (#3022)
Internally, ImageBuf has for some time now supported strided or
non-contiguous buffers (for IBs that reside in memory, rather than in
an ImageCache). It was originally anticipated to accommodate cases
where we would want pixels or scanlines to have particular alignment
or spacing, such as to be even multiples of the SIMD width.

But we never allowed the kind of IB that "wraps" an application's
memory buffer to specify the strides, in case the app buffer was in
some layout that was not contiguous. This patch adds that ability, by
amending that constructor with stride values (which are optional and
default to AutoStride, which indicates that contiguity should be
assumed). This is 100% back compatible for source code.

This lets you do some cool things with in-memory buffers:

* More flexible about the kinds and layouts of buffers that you can wrap
  to look like an IB.

* Can easily make an IB that wraps an interior rectangular subset of
  another buffer (including another ImageBuf).

* To a limited extent, makes it possible to have an IB that is a "view"
  of another IB (if the second IB is in memory), including strided pixels
  or scanlines -- and even if the strides are negative (this lets you make
  an IB view of a buffer where copying the buffer can reverse left/right
  or top/bottom, however you can't use it to change the channel order or
  layout within each pixel).

* I think this also lets you make a 2D IB that wraps a 2D slice along any
  axis of a 3D volumetric IB.

Some other changes that came along for the ride:

* Added `ImageBuf::contiguous()`, which tells you if the memory layout is
  contiguous (will return false if it's not an in-memory buffer of some
  kind, so ImageCache-backed IBs are NOT considered contiguous).

* Renamed some internal types and fields, in particular, changes like
  `size_t ImageBufImpl::m_pixel_bytes` to `stride_t m_xstride` to make it
  clear that the values are strides and can be negative.
2021-07-05 16:13:10 -07:00
Kimball Thurston 596b124f1f Experimental use of openexr C layer in openimageio (#3009) 2021-07-05 16:09:55 -07:00
Larry Gritz 8cb12d8aa8 Make a unit test for color.h contents (#3023)
Currently, it only tests the linear <-> sRGB and linear <-> Rec709
transformations.
2021-07-05 09:18:39 -07:00
Larry Gritz 14ca518421 More conversions to fmt (#3020) 2021-07-01 18:17:56 -07:00
Larry Gritz 2086ed228b Targa: fix alpha handling (#3019)
There are several alpha choices. We were assuming that color values
were unassociated (need to be premultiplied) unless it was marked as
premultiplied alpha. But it seems that, actually, we should only
premultiply if it's "useful alpha". [Indeed, their terminology is
the worst.]

Rename the m_alpha member to m_alpha_type to clarifywhat it holds.
Also add the alpha type to the metadata as "tga:alpha_type" to make it
easier to inspect the value in tga files.
2021-07-01 18:15:15 -07:00
Larry Gritz eacf549e5c Beef up thread safety of ImageBuf init_spec() and read(). (#3018)
I don't think issues have been reported, so maybe this wasn't a
problem in practice for reasons I've long forgotten about, but doing
some other work in ImageBuf, I noticed what I think was a thread
safety problem.

ImageBuf reads are done lazily, a lot of operations call
validate_spec() or validate_pixels() which can trigger a call to
init_spec() or read() if they have not yet been done, and those had a
spin mutex protecting them from being called at the same time. But the
underlying read() and init_spec() themselves did not have any lock,
which made me worried about what would happen if one user thread was
explicitly calling read() while another was calling it implicitly
through validate.

Also, spin_lock is probably inappropriate for something that could
trigger an entire image read from disk -- it's meant specifically for
situtions where the lock only will be held for a few instructions.

So, this patch:

* Renames ImageBufImpl::m_valid_mutex to m_mutex, reflecting that it's
  not merely guarding access to `m_spec_valid` and `m_pixels_valid`,
  but to potentially anything internal to the ImageBufImpl that needs
  thread safety.

* Changes that mutex from a spin_mutex to a std::recursive_mutex, to
  reflect that it *may* block longer than a few cycles, so blocked
  threads should yield rather than spin. And recursive to simplify the
  hand-off logic between validate_spec, validate_pixels, init_spec,
  and read, the former two may call the latter two.

* Add locks to read() and init_spec(), which previously lacked them (I
  think in error), in addition to the existing ones in the validate
  methods.

* For some locking ImageBufImpl methods, add a param that lets the
  caller (which will always be internal code) specify that the lock is
  already held.

* Add a timing test of recursive_mutex to spinlock_test, just to verify
  that I'm not doing anything to totally botch performance. On my Intel
  Mac laptop, an uncontested lock acquisition/release is 6.4ns for a
  spin_mutex, 16ns for a std::mutex, and 27ns for std::recursive_mutex.
  So this is definitely a more expensive lock, but 27ns is still very
  reasonable, and *most* operations don't need to acquire the lock at
  all (first it checks the m_spec_valid or m_pixels_valid, once they are
  set there is no more locking).

* Improve ImageBuf docs, adding more explanation including some guideines
  about which methods are considered thread-safe.
2021-07-01 18:14:45 -07:00
Larry Gritz 8f055a9f09 Docs: improve description of IOProxy 2021-07-01 18:13:08 -07:00
Larry Gritz 29e3518158 Clarify docs that oiiotool --ociofiletransform doesn't need an OCIO config 2021-06-30 17:00:31 -07:00
Larry Gritz d93386b478 Clarify comments in ImageOutput::copy_image
Make it clear that this function is only copying the pixel data
from an ImageInput to an ImageOutput.
2021-06-29 23:23:15 -07:00
Larry Gritz 442d5f9397 Bump minimum OpenCV supported to >= 3.0 (#3015)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-06-29 23:18:09 -07:00
Larry Gritz 52758b817b More fmt transition aids (#3014)
* strutil.h already had a symbol called OIIO_FORMAT_IS_FMT defined to
  0 or 1 that reveals (to clients of OIIO) whether Strutil::format()
  behaves like printf (the old and current way) or like std::format
  (the future way). Now we adjust so that the caller may pre-set the
  value to force one implementation or the other, at least for the
  "inline" functions of the headers.

* As an aid to downstream packages trying to ensure that they aren't
  using the function slated for eventual deprecation or behavior
  change, you can now define OIIO_HIDE_FORMAT to cause a deprecation
  warning now on those functions that will eventually change or be
  deprecated. This can help to identify any places where you call the
  future-deprecated functions and change them to a "safe" variety.
2021-06-29 23:17:50 -07:00
Larry Gritz 44bc4cf971 TIFF: honor caller request for single threaded (#3016)
ImageInput and ImageOutput have ways for the caller to say that there
should be no "fan-out" in the internals of what the reader or writer
needs to do. But TIFF wasn't honoring this.
2021-06-28 23:13:33 -07:00
Pascal LecocqandPascal Lecocq 890bbb9502 Add a scaled slopes UV normalization options for --bumpslopes. (#3012)
This patch provides an additional but optional parameter for --bumpslopes option to mormalize the derivatives in UV space and scale them by a user defined constant. The scale factor is used to prevent half floating point overflow at time of the UV normalization. A value of 256 is recommended to prevent floating point overflow with texture resolutions up to 32k. The constant value is stored as an extra attribute in the output file for reverting the scaling when using the texture. Note that this options is only meaningful with height maps.

Co-authored-by: Pascal Lecocq <plecocq@imageworks.com>
2021-06-28 18:26:28 -07:00
Kimball Thurston 54c4e2fa95 Convert dpx output to be ioproxy enabled (#3013)
Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
2021-06-27 15:12:51 -07:00
Larry Gritz a78b45577b Fix typo 2021-06-26 16:39:47 -07:00
Larry Gritz 91008a3432 TypeDesc improvements (#3008)
* Add TypeDesc support for metadata that is a 2D or 3D bounding box,
  represented as an array of 2 VEC2 aggregates (for 2d) or VEC3
  aggregates (for 3d), having the BOX semantic. The basetype
  determines whether it's an integer-based (generally for pixel
  ranges) or float-based (generally for 3D spatial) bounds. The new
  text representations are "box2" and "box3" (for float-based), and
  "box2i" and "box3i" (for int-based).

* Somehow we never had a C++ test thoroughly exercising all the corners
  of TypeDesc. Now we do: typedesc_test.cpp

* The test revealed a number of edge cases we don't handle well, now
  shored up.
2021-06-26 13:58:53 -07:00
Larry Gritz 22036943e7 SPI: Fix compilers for lg 2021-06-26 13:56:13 -07:00
Larry Gritz acd0abfbf5 fmt related fixes (#3007)
* New fmt 8.0.0 is out -- make sure we test against both that and their
  current master.

* Starting with fmt 8.0, and in accordance with C++20 std::format's
  final incarnation, the format string needs to be constant, for the
  sake of compile time checks. To use a nonconstant format string, as
  we do for these wrapper functions, we need to lean on vformat.

* For Strutil::sprintf, just `using ::fmt::sprintf` and eliminate the
  wrapper entirely. (Though we express the wrapper inside
  `#ifdef OIIO_OXYGEN_ONLY` so that it fully appears in any docs we
  generate.)
2021-06-26 13:49:46 -07:00
Bernd c4d8a645a7 fix typo for REQUIRED_USE (#3011)
Signed-off-by: Bernd Waibel <waebbl-gentoo@posteo.net>
2021-06-25 13:28:35 -07:00
etheory a07efab5d8 Add Houdini and AL custom UDIM support (#3006)
Add custom UDIM support and Houdini UDIM convention support

For our (Animal Logic) in-house renderer, we need support for an additional UDIM format of `/path/to/file/textureName_u##v##.ext`

Added second line to ImageCacheImpl::resolve_udim to make this work.

Additionally add support for Houdini UDIM specification
2021-06-21 22:43:37 -07:00
Larry Gritz 6a9b7a3993 check_find_package now takes optional DEBUG to dump more info (#3005) 2021-06-16 21:56:38 -07:00
Larry Gritz 8a9ba9827a Build and test fixes related to Ptex (#3001)
* New Ptex (since 2.3.1) has exported cmake configs. Use those if
  available and seem to work.
* Rename FindPTex.cmake -> FindPtex.cmake to match the capitalization
  in the Ptex project itself, thus avoiding warnings from CMake.
* Fix our FindPtex.cmake to set up Ptex::Ptex_dynamic target. Use
  that instead of the old style variables. That makes a seamless future
  transition between the old Find module and future exported configs.
* Our FindPtex.cmake got the version number all wrong. Fix.
* gh-installdeps.bash tried to install ptex-base. That's not Ptex! So
  stop doing that.
* New build_Ptex.bash does a simple clone and build of Ptex. Do so for
  a few of the CI test cases so that we are more thoroughly testing Ptex
  in CI.
2021-06-16 21:56:21 -07:00
Larry Gritz f691a0749f Clean up preprocessor mess left by farmhash.h (#3002)
Try to `#undef` at the end all the things that are `#define` by
farmhash.h that do not begin with `FARMHASH_`.
2021-06-15 22:08:06 -07:00
Larry Gritz 240b0abe53 CI: make a specific test for buildling with clang11 and C++17 (#3004) 2021-06-15 22:07:36 -07:00
Larry Gritz c33035aded Clang + C++17 + LibRaw < 0.20 don't mutually get along (#3003)
LibRaw 0.19 and earlier use auto_ptr in public headers, which was
deprecated in C++11 and removed in C++17.

When this combo is detected, issue a warning message from CMake.
2021-06-15 20:37:58 -07:00
Larry Gritz eb8c6415e2 Bump ffmpeg minimum to 3.0, and other cleanup (#2999) 2021-06-15 18:37:50 -07:00
Larry Gritz 762b95c961 Change acknowledgment
We switched from Jasper to OpenJPEG many years ago, but apparently never
updated this acknowledgement.
2021-06-15 16:45:47 -07:00
Larry Gritz a5d8004313 More exception safety in Filesystem directory iteration (#2998)
When using filesystem::directory_iterator, I was using operator++,
which can throw exceptions for OS errors. I should have used
increment(ec) instead. Throw in a surrounding try/catch just in case,
since even increment is not marked as noexcept.
2021-06-14 14:17:07 -07:00
Larry Gritz 8ae8ac921b Add missing boost requirement to INSTALL.md 2021-06-08 21:25:07 -07:00
Larry Gritz 908c1832ec Have FindFFmpeg.cmake detect the version at cmake time. (#2994) 2021-06-08 21:23:04 -07:00
Larry Gritz 05a5448c3e Fix to accommodate changed preprocessor name in imath master. (#2996)
Also need to back off the top of fmt master when using gcc11, it seems
to have some trouble with.
2021-06-08 18:56:31 -07:00
Larry Gritz 3ae756b64f Less restrictive warning pragma, amend last PR 2021-06-06 23:47:20 -07:00
Larry Gritz 4cf8980129 gcc 11 support (#2995)
* Use g++11 on the bleeding edge CI test
* Remove OIIO_CONSTEXPR20 decls from string_view -- gcc 11, even in
  C++20 mode, doesn't have std::string fully constexpr plumbed, it's
  not ready for this.
* Suppress gcc11 warnings about arithmetic with enums that occur in the
  OpenCV headers.
* Suppress gcc11 warning (correct) in the spot where we were trying to
  force a crash for testing purposes.
2021-06-06 22:28:37 -07:00
Larry Gritz 36189e194f Bump version after tagger developer preview 2021-06-05 16:08:48 -07:00
Larry Gritz 48437c887c CHANGES 2021-06-05 09:04:51 -07:00
Larry Gritz df3c8e45c2 Fix redundant error message for maketx and oiiotool -otex (#2992)
We were double-printing error messages. If maketx/oiiotool is itself
printing errors returned by IBA::make_texture, it is not necessary to
pass std::cout to make_texture so that it can echo the message to the
console itself.
2021-06-05 08:46:50 -07:00
Larry Gritz 08b48c96eb make_texture now detects and rejects deep images (#2991)
It's meaningless to try to use make_texture on input images that are
"deep".  We never even thought to check for this, which led to a
cascade of problems resulting in a segfault.
2021-06-05 08:46:27 -07:00
Larry Gritz cac5c05019 Fix ustring crash on M1 (ARM) based Mac. (#2990)
There's something wrong with the behind the scenes tricks we're using
to doctor the internal string representation. Is it because of big
endian?  The "alternate" string rep? Something else different on
Apple's libc++ on M1?

Fix for now by just disabling that clause. The only harm is that
ustring internals will take more memory on that platform. That's
better than crashing!

When I have more hands-on access to an M1 (or when GitHub Actions
supports running CI tests on M1), I'll return to this for a proper
fix.
2021-06-03 14:48:38 -07:00
Larry Gritz 96eef33e65 Fix some ffmpeg encodings that didn't realize they were >8bit, alpha (#2989)
A few varieties of encoded videos with bit depth 12 and having alpha
were not marked as such, and falling to the default case that reported
them as 8 bit RGB.
2021-06-02 10:54:31 -07:00
Larry Gritz 1b884e1234 Clarify behavior of color conversion on image with > 4 channels (#2987)
The docs were ambiguous about what would happen for many-channel
image, and the behavor in fact was to copy and color transform only up
to the first 4 channels, leaving additional channels in the
destination undefined (though in practice they turned out black).

Clarify now that for colorconvert, colormatrixtransform, ociolook,
ociodisplay, and ociofiletransform, the first 4 channels are assumed
to be RGBA to undergo the transformation, and any additional channels
will be copied unaltered from source to destination (not set to black).
2021-05-31 21:11:42 -07:00
Larry Gritz 686573f162 If feature is disabled, skip its tests, don't report them broken (#2988) 2021-05-31 21:10:53 -07:00
Larry Gritz bf9d5fb906 Avoid divide-by-0 error computing chunk size for invalid image sizes (#2983)
In ImageInput::read_scanlines and read_image, if somehow the image has
a spec with 0 size, it will lead to a divide by zero error. Check this
and fail safely.

For BMP in particular, do some sanity checks to catch corrupted headers.
(This is in response to Issue 2982)
2021-05-30 08:12:50 -07:00
Larry Gritz 034c5e1a09 Fix broken build against TBB 2021 (#2985)
For TBB 2021, headers moved around, and our FindTBB.cmake was failing.
But actually, starting with TBB 2021, TBB exports a proper cmake config!
So take advantage of that by preferring to load TBB from a config file.

Fixes 2963
2021-05-30 08:12:32 -07:00
Larry Gritz 6e5bebbfce CMake: Make checked_find_package able to prefer configs (#2984)
Both global and per-package controls have been added to our
checked_find_package cmake function, to cause it to first check for
an exported config for the dependency, and only if not found, revert
to potentially using a FindPackage.cmake module.

This reflects our general leaning toward assuming that a package that
exports a cmake config probably does a better job of it than we would
do writing a Find module for it.
2021-05-29 18:49:46 -07:00
Larry Gritz 26650fa309 One more OpenJPEG rename that I missed in #2979 2021-05-29 16:24:08 -07:00
Larry Gritz 11f61e4b66 IBA::render_text did not properly account for alpha of the draw color (#2981) 2021-05-28 09:06:47 -07:00
Larry Gritz bc04e95194 Build: FindOpenJPEG.cmake improvements (#2979)
Rename FindOpenJpeg -> FindOpenJPEG to match the conventions used by
that project, in particular for its exported CMake config files.

(We don't yet rely on their exported configs, I need to do some
homework to see if they exist and are reliable as far back as the
oldest OpenJPEG release that we support.)

Add helper script to build OpenJPEG
2021-05-26 09:22:08 -07:00
Larry Gritz a55ab0216b Remove last remnants of boost regex (#2977)
This is safe in master, now that gcc4.8 is not on the menu.
2021-05-25 23:02:56 -07:00
Larry Gritz d90386ecc1 Change localtime() calls to Sysutil::get_local_time (#2978)
We still had a few stray localtime() calls (which is not reentrant,
because it depends on a global buffer), even though all along we had a
"safe" wrapper in Sysutil::get_local_time, which internally calls safe
versions localtime_r or localtime_s (depending on the OS).
2021-05-25 13:53:22 -07:00
Larry Gritz 7dc4821157 Improvements to BMP (#2976)
* Writing: Write single channel BMP as 8 bit palette images (not 24/32
  bit images). This fixes a problem I discovered related to the recent
  change that reads 8 bit palette images as if they were single channel.
  The lack of symmetry there made problems for round-tripping an image
  and having it end with the same apparent number of channels as it
  started with.

* Reading: respect a configuration hint "bmp:monochrome_detect" that if
  set to 0, will disable the detection of monochrome palettes and spoofing
  to look like a single-channel image. The default is 1.

* Read RLE-compressed images correcty now! Both 4 and 8 bpp varieties.

* Beef up the testsuite/bmp tests, now test against a wider set of sample
  BMP images from bmpsuite (including rle compressed images).
2021-05-24 12:32:24 -07:00
Larry Gritz 31a7613481 Fix oiiotool docs typo and clarify discussion about subimages 2021-05-24 12:13:44 -07:00
Larry Gritz 6a6b0518fc Change default postfix for debug libraries to '_d' (#2970) 2021-05-23 18:05:56 -07:00
Larry Gritz 1b05ae93f6 Fix exported cmake config, it confused imath and openexr versions (#2975)
OpenImageIO exported config has a dependency on Imath/OpenEXR.  For
Imath 3, I accidentally used OpenEXR_VERSION when I should have said
Imath_VERSION. Makes no differece if they're in sync. But should
somebody downstream have a separately compiled Imath and OpenEXR that
just might be different patch versions, it could break builds by
rejecting if the Imath version appears to be behind the OpenEXR
version. There's no guarantee that Imath and OpenEXR will always be
released exactly in sync.
2021-05-19 12:22:47 -07:00
Larry Gritz 2cfb281fef CI: Bump OpenEXR releases to the latest in each branch (#2974) 2021-05-19 00:13:31 -07:00
Larry Gritz 116ab5289e BMP refactor: move BMPInput and BMPOutput to the files where they are used. (#2973) 2021-05-18 22:53:23 -07:00
Larry Gritz 9373be97ad Clarify that our BMP implementation does not support RLE files. (#2972)
Separate patch coming later to add support for RLE.
2021-05-18 16:06:59 -07:00
Larry Gritz a3763dca95 CI: Mac: Adjust to homebrew using imath 3
Need to disable OpenVDB on Mac CI for now, because its homebrew version
wants ilmbase.
2021-05-15 16:44:23 -07:00
Larry Gritz 1d5081d9ce Fix runaway parsing time for pathological XMP metadata (#2968)
Found some files that encountered the problem described here:
https://prepression.blogspot.com/2017/06/metadata-bloat-photoshopdocumentancestors.html
https://feedback.photoshop.com/conversations/photoshop/photoshop-corrupt-ancestors-tag-in-xmp-causing-giant-file-sizes/5f5f45f74b561a3d426ba97f

The pathologically long lists of "photoshop:DocumentAncestors" tags (a
4MB PNG of which 3MB consisting of XMP) was tripping us up with an
O(n^2) handling of appending to lists for those attributes that could take
minutes per file.

It seems like this was a widely acknowledged problem that has been fixed
in Photoshop 20.0.2 (January 2019) and later.

Solution:

* Just skip the problem tag; I can discern no real use for preserving
  it in any OIIO context.

* More generally, be on the lookout for pathological or corrupt XMP by
  keeping track of the length of lists and just cutting them off from
  further appending when they seem senselessly long. I can imagine XMP
  with lots of attributes, but it's hard to imagine that any single
  attribute having thousands of list entries is intentional and useful.

* Fix some places where we were needlessly generating and then tearing
  down std::string's.
2021-05-13 10:08:00 -07:00
Larry Gritz cf0340ca14 CI script typo kept mac from recognizing ARCH properly (#2967) 2021-05-12 10:49:56 -07:00
Larry Gritz 479bbe6e07 Update the CI clang-format to use llvm 11 (from 10) (#2966)
This makes several minor formatting changes, mostly related to how
clang-format 11 has improved ability to track the alignment of = in
successive statements, even when one of those statements is split
across two lines.
2021-05-11 18:48:25 -07:00
Larry Gritz 3b32b92adc CMake: propagate min C++ requirement to cmake config exports (#2965) 2021-05-08 15:46:02 -07:00
Larry Gritz 6e700eb772 Adjustment for OpenColorIO 2.1 (in dev) deprecating method (#2961)
This started out as just trying to fix our CI on the "bleeding edge"
building against OCIO master and complaining about a recently committed
OCIO deprecation of Config::parseColorSpaceFromString.

But it turned out that the new OCIO v2 method, getColorSpaceFromFilepath,
didn't work quite the same way and broke our tests. So I ended up having
to implement a bit more of a complicated set of functionality:

* Config::parseColorSpaceFromString now wraps the OCIO version if it's
  available, but implements the equivalent logic if OCIO is new enough
  that the function is deprecated.

* As a bonus, our pCSFS now works (didn't before) in cases where lack of
  OCIO support or missing config meant the OCIO functionality wasn't
  available. That is, it works on our meager set of default color spaces
  that are present even without OCIO.

* New Config::getColorSpaceFromFilepath wraps the OCIO version if OCIO
  is new enough, but if it isn't, or if there's no OCIO, or if OCIO ends
  up not figuring it out and returning the default rule, we fall back
  to Config::parseColorSpaceFromString.

* Add OCIO to VFX Platform CI builds -- because it's not in the aswf-osl
  docker images, we weren't testing OCIO in as many versions as we had
  previously thought.

* Bump default OCIO version built by build-scripts/build_opencolorio.bash
  to 2.0 (from 1.1.1).
2021-05-04 23:46:25 -07:00
Damien Courtois 1ef9a17f39 fixed a crash is ImageCacheFile::read_unmipped when sampling non-zero-base channels. (#2962)
the temporary image buffer is created with only 3 channels, so the get_pixels call at the end of the
read_unmipped method must account for that when creating the ROI passed to it.
2021-05-04 09:08:18 -07:00
Larry Gritz 554f854f4a Bump C++ minimum to 14 (#2955)
This also bumps compiler minimums to gcc 6.1, clang 3.4, MSVS 2017,
and icc 17 (all because those are the first versions to fully support
C++14).

This has been coming and has been socialized for a long time, with
nobody voicing serious objection. So here it is.

This WILL NOT be backported to release branches. The new minimums only
affect OIIO 2.3 and later.

When last discussed on the oiio-dev mail list, I said I would aim to
introduce this change on May 1. I will not merge this PR earlier than
that, and I will tag a developer preview release before that happens.
2021-05-02 20:51:45 -07:00
Larry Gritz 2fd6ad15c6 Bump version after developer preview tag 2021-05-02 16:12:23 -07:00
Larry Gritz 331c0eb098 CHANGES and tag Release-2.3.4.0-dev, the last developer preview with C++11 support 2021-05-02 15:01:11 -07:00
Larry Gritz 311c23dd8d Strutil: add find, rfind, ifind, irfind (#2960) 2021-05-01 21:18:54 -07:00
Larry Gritz ad028f48b0 CHANGES 2021-04-30 22:55:43 -07:00
Matteo F. VescoviandMatteo F. Vescovi 4824fc7457 Rename TITLE to NAME in manpages script (#2958)
Co-authored-by: Matteo F. Vescovi <mfv@debian.org>
2021-04-30 14:47:09 -07:00
Larry Gritz bf598ba1e6 CMake: use modern targets for PNG and ZLIB (#2957) 2021-04-30 12:42:47 -07:00
Larry Gritz f46c8b9a0f Document support of libtiff 4.3 and test against it (#2953) 2021-04-26 21:28:49 -07:00
Larry Gritz b58e8c58d7 oiiotool --missingfile {error,black,checker} (#2949)
The new `--missingfile` argument (taking a value of either `error`,
`black`, or `checker`) specifies the policy for what oiiotool does
for input files that are entirely missing (not present but broken).
In all cases, an error messages is issued, but for the cases of
black and checker, an image is substituted and computation continues,
rather than immediately ending the attempt to execute the command
sequence.
2021-04-24 15:28:49 -07:00
Larry Gritz 9e985981be Fully separate libOpenImageIO and libOpenImageIO_Util (#2906)
On a personal project a while back, I wasted a full day chasing down
inexplicable behavior that turned out to stem from TWO implementations
of ustring being in the same application, a result of inadvertently
linking against both libOpenImageIO and libOpenImageIO_Util. This led
to two ustrings that contain the same character sequence, but with
different pointers because they resided in different ustring tables.

There is no way that anybody without very deep understanding of ustring
and a lot of patience could have tracked down the underlying issue.

This patch eliminates the possibility of duplicated modules in
libOpenImageIO and libOpenImageIO_Util.  Now libOpenImageIO depends on
and links to the latter. This should all be automatic for users -- as
before, link against libOpenImageIO if you want everything, link
against libOpenImageIO_Util if you just want the util helper classes
but don't need any of the image I/O functionality.  But now, if you
accidentally specify both... well, that's just the same thing as
asking for libOpenImageIO.

Fully separating libOpenImageIO from libOpenImageIO_Util requires new
OIIO_UTIL_API
2021-04-21 15:43:25 -07:00
Larry Gritz 20c50da66a Docs: Clarify the optional modifier of oiiotool --ociodisplay and --ociolook (#2952) 2021-04-20 22:55:10 -07:00
Larry Gritz d869a3c880 Add missing MakeTxBumpWithSlopes enum value to python bindings (#2951) 2021-04-20 22:54:48 -07:00
Larry Gritz ec782e3363 SPI minor adjustment 2021-04-20 22:53:57 -07:00
Larry Gritz 86c364a5b5 CMake: Adjust namespace digits (#2948)
Make whether namespace includes the patch number be dependent on
whether it's a dev or release branch. We generally want the patch
in the namespace for master, but not release.
2021-04-19 15:29:21 -07:00
Larry Gritz 5c96e9df6b oiiotool: allow expression substitution to include getattribute(name) (#2932)
This teaches oiiotool's command line expression substitution (`{...}`)
syntax to understand that

    getattribute(name)

should be replaced by the value that OIIO::getattribute(name,...) would
retrieve. The `name` may optionally be single or double quoted, but doesn't
have to be if it's a simple identifier.

Some examples:

    # Which SIMD features does this OIIO use?
    oiiotool --echo "{getattribute('oiio:simd')}"

    # Which dependencies are used for each format?
    oiiotool --echo "{getattribute(library_list)}"

    # Which file extensions are associated with each format?
    oiiotool --echo "{getattribute(extension_list)}"
2021-04-17 09:12:54 -07:00
Larry Gritz 9d9adf501f Adjustment on exported config: hint where to find OpenEXR/IlmBase (#2947) 2021-04-17 09:12:29 -07:00
pwm1234-sri 902ba1fd7b IBA::to_OpenCV(): use dst.create rather than constructor w/move (#2944)
The cv::Mat::create method does the same thing as the constructor but "Allocates new array data if needed." And when not needed, which is my use case when all the images I process are the same size, create does nothing. This is more efficient than the implementation where a new mat is constructed and then moved to the destination. This is a minor optimization, but it does avoid allocating an image size block of pixels when it is not necessary.
2021-04-12 22:11:25 -07:00
Larry Gritz 2b875975d2 Yet again, cmake adjustments to openexr, etc. (#2942)
Sorry this has taken so much tinkering to get right for downstream
projects. It's tricky business.

First, we start by adding testsuite/cmake-consumer -- a test that
consumes OIIO and its exported cmake modules, and is independent of
the rest of OIIO's build system, more accurately simulating whether
things will work for a downstream client.

Adjust our exported module, it needs to break out the OpenEXR 3 vs 2
cases separately, as well as whether it found an OpenEXR/Imath config
file or not. I think I have all the cases covered now. I also needed
to specify find_dependency of IlmBase and Threads, for the sake of
openexr 2.4 with config, and add the INCLUDES directory lists in the
case of no config files found.

Some adjustment of our library target_link_libraries -- better PRIVATE
hiding of things not needed in the interface by downstream builds.
In particular, the OpenEXR components and OpenCV should be private, not
public.
2021-04-12 19:12:27 -07:00
pwm1234-sri cf8bb4f888 Support single channel 8-bit bmp (#2943)
Add m_allgray field and color_table_is_all_gray method to detect
that the color table entries have the same r, g, b values and indicate
a single channel gray scale image rather than a 3 channel rgb image.
2021-04-12 19:11:52 -07:00
Larry Gritz 665af526df BMP: eliminate wasteful allocation and copying (#2934)
Temporary allocations were made and freed for each scanline read or
written. Do it once per image and reuse. When reading, eliminate one
temp buffer by writing data into its final location, also eliminating
a needless extra copy of each scanline.
2021-04-12 11:55:08 -07:00
Larry Gritz 1ac8a48393 Adjust openexr includes (#2941)
We broke things subtly for older OpenEXR when we added the 3.x
support.  Without this fix, our export CMake config files weren't
properly exporting the OpenEXR include path as the interface includes
for OIIO libraries. This doesn't affect the OIIO build itself, but it
can affect downstream libraries that use OIIO as a dependency and
rely on our exported cmake config files.

We also remove the need for OpenEXR/OpenEXRConfig.h entirely through
header configuration.
2021-04-09 12:29:10 -07:00
alister-chowdhury 9d4c6959b9 Added logic to copy along the alpha_channel when generating sub-images for fillholes_pushpull (#2939) 2021-04-08 10:14:18 -07:00
Larry Gritz 536dae3fa7 Build: be robust to certain OpenEXR 2.x config files (#2935)
Ever since adding OpenEXR 3.0 support, we had some cases where
installations that built the 2.x IlmBase and OpenEXR portions
separately and installing to separate areas.

Also make some minor changes to ci.yml to make sure we are documenting
the right openexr versions used for each test.
2021-04-07 12:14:32 -07:00
Larry Gritz 4430a0ef69 SPI specific: remove gcc4.8, C++11, old Boost
Also, we have a different script that controls building or Rez, there
is no need to clutter this here with Rez stuff we don't use.
2021-04-02 17:59:51 -07:00
Larry Gritz 796b3145fd CMake: don't use --config inappropriately (#2931)
It seems that for CMake, --config should only be used in conjunction
with --build. Who knew? Things are breaking right and left now, especially
on GitHub Actions CI. But also on my laptop.

Hypothesis: maybe this was silently ignored in older cmake versions, but
now with CMake 3.20 is a hard error?
2021-04-02 15:45:23 -07:00
Frédéric Devernay 9d5365b4f1 fix c++11 build (#2930) 2021-04-02 12:58:36 -07:00
Larry Gritz d0803608fc Fix typo for stdout change 2021-04-01 14:03:42 -07:00
Larry Gritz 867c25cbd1 Change default C++ standard to 14 (#2918)
This does not (YET) change the minimum to C++14. For now, you can still
build for C++11 -- and with compilers that only support C++11 -- by using
CMAKE_CXX_STANDARD=11.

By changing the default, we hope to more thoroughly test everybody's
ability to compile C++14, ahead of the actual cut-off when we make that
the true miimum.

Also, the latest OpenVDB 8.0 does has C++14 as a minimum, so compiling
in C++11 mode will automatically disable OpenVDB support if OpenVDB >=
8 is what is found. We expect an increasing number of our dependencies
to drop support for C++11, so we want our default compilation mode to
be one that doesn't silently drop format support without
users/builders being aware of it.
2021-04-01 11:49:28 -07:00
Larry Gritz 998a8d429e Eliminate the last few std::cerr and std::cout outputs (#2923)
In many cases, this informative debugging code was left over from when
parts of this code was strictly a command line utility. It's not
appropriate for a library call, especially on Windows.

Make sure every last output to std::cerr is guarded by some
preprocessor symbol that would only be enabled when one of the
developers is trying to do some "printf debugging". And similarly,
std::cout should only be used for standalone command line
utilities that are by design supposed to output to the console.
2021-04-01 11:48:53 -07:00
Larry Gritz b9644f9b03 TIFF: support IOProxy for input (#2921)
Also beef up docs, which had neglected to mention that proxy was
supported for a few other formats.
2021-04-01 11:47:20 -07:00
Larry Gritz 7b5bb507fe Allow reading of JPEG files with mildly corrupted headers (#2927)
We were treating some recoverable warnings from jpeglib as fatal errors.

Removed testsuite/jpeg-corrupt-header since now we can read it just
fine despite the very minor corruption! Also, turns out the image was
inappropriate, sorry, I had never actually seen it before because
OIIO wouldn't read and display it and I assumed it was just garbage.
2021-04-01 11:47:05 -07:00
Larry Gritz 8e6bad8783 Fix function name ambiguity in farmhash.h for C++11 and certain compilers (#2914)
Apparently all the recent farmhash changes are fine with C++14 mode,
and fine with C++11 mode on gcc 4.8, but gets some errors when
usig in newer compilers (gcc6+) using C++11 mode.

Add a CI test with gcc10 but with C++11 compatibility to verify this fix.
We will remove this test once we retire C++11 compatibility.
2021-03-28 09:42:27 -07:00
Larry Gritz cb2541c973 Avoid OCIO 2 exception by setting strides correctly (#2911)
For the case of applying a color transformation to just one color, we
were sloppy and set the strides to 0 (just one color means we are not
iterating from point to point using the strides).

OpenColorIO 1.x didn't care, but OpenColorIO 2.0 throws an exception if
the strides don't look valid.

Thanks to Thomas Metais for the fix suggestion.
2021-03-26 00:14:54 -07:00
Larry Gritz a610b38df1 Remove redundant format conversion code from imageio.cpp. (#2907)
Change imageio.cpp convert_from_float to use the convert_type function
from fmath.h, rather than defining redundant functionality in that
module.

This has the added benefit that the ones in fmath.h have some interesting
specializations to use SIMD ops and other optimizations that the one-offs
in imageio.cpp lacked.
2021-03-25 22:11:15 -07:00
Larry Gritz b249ffd8fb oiiotool --skip-bad-frames (#2905)
Ordinarily, oiiotool will exit upon encountering an error (such as an
input file not being found). When operating on a frame range or with
frame number wildcards, that means that it will exit without attempting
the rest of the frame range.

The new `--skip-bad-frames` command line argument means that an error
will skip the rest of that iteration, but not exit, instead starting
fresh on the next frame in the sequence. (But if any frame in the
sequence encounters an error, the exit code of the oiiotool command
will still be EXIT_FAILURE.)
2021-03-25 20:19:40 -07:00
Larry Gritz 9faf3cdbe9 CMake 3.20 dropped the -g3 flag (#2913) 2021-03-25 14:48:05 -07:00
Larry Gritz c7e986879c Fix missing boost path on recently broken GHA CI (#2912)
GitHub Actions in its wisdom has removed pre-installed Boost from the Windows
images, causing our CI to fail.

Instead, get boost from vcpkg, just the pieces we need.

Also needed some JPEG adjustments for Windows CI build.
2021-03-25 14:35:25 -07:00
Larry Gritz 54bc719a42 get_extension_map and oiiotool --list-formats (#2904)
Added utility function OIIO::get_extension_map() which returns a
`std::map<std::string, std::vector<std::string>>` listing all
image file formats and their presumed file extensions.

`oiiotool --list-formats` helps to test this and is useful in its own
right.
2021-03-24 22:58:04 -07:00
Larry Gritz 73c9a9e045 Bump version after developer preview tag 2021-03-24 22:03:43 -07:00
Larry Gritz 82683bdeb1 CHANGES and belated bump of developer snapshot version to 2.3.3.0 2021-03-22 12:39:46 -07:00
Larry Gritz 5e89f4f041 CHANGES 2021-03-22 11:19:15 -07:00
Nayden Dochev ef107cf6c4 Fix reading tiff files when size is not multiple of tile size (#2895)
Fix reading tiled tiff files when vertical read size is less than tile size, just for the code path where we use TIFFReadRGBATile (used for certain rarely encountered types of TIFF files). TIFFReadRGBATile returns the image data in bottom-to-top order, and we had been correctly reversing it all along, but neglected to account for the issue of a partially-filled tile ending up with the padding at the beginning of the buffer rather than the end.
2021-03-21 13:59:39 -07:00
Larry Gritz 11cae64880 strutil.h: Clarify the comment explanation of split. 2021-03-20 23:40:32 -07:00
Larry Gritz eab20ebac8 Targa read fix for tga files with 0-sized thumbnails (#2903)
All of our prior tga tests had valid thumbnails. The code skipped the
thumbnail if the "offset to the thumbnail" was 0. But if the offset was
nonzero but the thumbnail record at that spot had a 0x0 size, we just
ran merrily along, and on Windows in debug mode even it an assert.

This patch makes it understand that a 0x0 thumbnail size means no
thumbnail.

I added an image from Doug Rogers, the reporter of the problem, to the
oiio-images repo in the targa directory, and updated the OIIO testsuite
to also check that image. (So testsuite will fail for people who don't
update their oiio-images repo.)

Also changed some stray refs to &vector[0] to vector.data().

Fixes #2900
2021-03-20 21:21:37 -07:00
Larry Gritz 91e9852ac2 BMP: fix bug reading older variety (#2899)
The very old OS2_V1 variety of BMP files -- which dates from the OS/2
and Windows 2.0 circa 1987 -- could have undefined results by relying
on the cpalete header field that didn't exist in that early
version. Our failure to initialize it led to expecting color palettes
of undefined size (which could either cause a read failure or even a
crash if it vastly over-allocated).

Some other minor touch-ups to the bmp code while we're at it:

* Zero-initialize all the other fields that don't exist in the OS2_V1
  version of the header.

* Don't set the Resolution metadata if the values in the file aren't
  positive (including for the V1 header that lacks it entirely).

* Fix reading V1 header resolution on big endian architectures (I just
  happened to spot that potential bug).

* Fix longstanding error (that I only just noticed) in reading 4 bpp
  images with odd horizontal resolutions, wherein the very last column
  was not filled in correctly (that's the change at lines 188 and
  193).

* Beef up one of the error messages invoked for failures while reading
  the color palette.

* Rig the BMP reader to know the "dib" is another extension often
  associated with BMP files.

* Add a regression test case for this format variant.

* Make sure CI tests bmp -- the GHA CI did not download the bmpsuite and
  so was not actually running the testsuite/bmp tests.

* Add "bmp:bitsperpixel" (when not 24 or 32) and "bmp:version" metadata.
  This is primarily for debugging and understanding which encodings the
  BMP file is using.

* Recognize nonsensical values for the header's field for number of entries
  in the palette. Add a test for that.
2021-03-19 13:05:52 -07:00
Larry Gritz 006ffc9b30 CHANGES 2021-03-17 14:01:15 -07:00
Larry Gritz 163f703e35 CI: Bump latest and bleeding tests to OpenEXR 3.0 tags (#2897) 2021-03-17 11:26:50 -07:00
Larry Gritz 04aeea3d9d Remove old pre-C++11 use of boost::random (#2896) 2021-03-16 21:46:25 -07:00
Larry Gritz a64e302204 Minor fixes to keep up with OpenEXR build system changes 2021-03-16 13:09:43 -07:00
Larry Gritz 8d9303e8ba Overhaul ustring hash collision handling (#2870)
This patch ensures that two ustrings will never have the same hash value.
The basic strategy is that the usual 64 bit hash of the characters provides
an initial guess. If no other string has already used that hash (as is
almost always the case), we use it. However, if a different string already
took that hash value, we rehash, and repeat until we find an unused hash.

We maintain a "reverse hash map" that relates hashes to ustrings to
help figure this out efficiently. (Note: This adds at least another 16
bytes per unique ustring to maintain the reverse map. Do we care?
Probably few applications are in the business of creating more than a
few million distinct strings.)

Because we are recording the collisions as they happen, this also
greatly simplifies (and reduces to trivially low cost) the
recently-added ustring::hash_collisions() function, because there is
no complicated search when it is called.
2021-03-16 13:07:15 -07:00
Larry Gritz 166f4ce0dc make_texture: Clamp half values to prevent Inf values popping up (#2892)
When making a texture out of float values, but writing ultimately to a
`half` file, it's not too hard to end up with valid but large float
values that are outside the range representable by a `half` (fp16)
value and therefore will get converted to an `Inf`, which nobody wants
in their texture.

This patch prevents Inf from showing up in the output of make_texture
by clamping output buffers to the range of `half` when the source data
are float and the destination file is half.
2021-03-16 11:46:38 -07:00
Larry Gritz 8c118ab917 CI: test C++20 on the Linux bleeding edge test. (#2891)
Fix minor warnings and deprecations of C++20.

Bump to more modern ubuntu images for recent-year tests and make some
related adjustments. Also make sure that the "latest" and "bleeding edge"
tests are using python3, they were inadvertently still using python2.
2021-03-16 11:43:32 -07:00
Larry Gritz f3ca19ce60 Docs: Fix doxygen mismatch, bump breathe version 2021-03-16 11:05:03 -07:00
Larry Gritz 5a9bc7bd9a Fix build breaks against recent OpenEXR 3.x additions (#2894)
A recent commit in the OpenEXR master changed which headers are
transitively included by other OpenEXR headers, and that broke our
build until this patch adds the missing headers explicitly.

The change may or may not be reverted on the OpenEXR side, but this
patch to OIIO at least unbreaks our CI in the mean time, and has
no down-side.
2021-03-16 10:24:40 -07:00
Larry Gritz 05f215cb12 More format modernization (#2889)
Update old calls to Strutil::format to new fmt conventions, convert
some sprintf-like calls to std::format like calls.

This is not meant to be comprehensive; there is more work to do.
It's just an opportunistic bite at getting some of it done.
2021-03-11 23:06:05 -08:00
Larry Gritz 899878b66b oiiotool --autocc now has optional :unpremult=1 modifier (#2890)
The oiiotool --colorconvert operator (and the other color conversion ops)
have an optional modifier ":unpremult=1" that will bracket the color
transformation with an unpremultiply/premltiply. But the implied
colorconvert that happens upon input and output with --autocc has no such
option, which is an oversight. This patch adds the ability to control
with autocc transformations happen in an unpremultiplied state (which I
believe they SHOULD, generally speaking).

Also beef up the docs and help messages in some areas where I
coincidentally realized that -i and -o explanations omitted some of
the possible options.
2021-03-11 12:55:17 -08:00
Larry Gritz d346ae7cdf Make RAW files handle Unicode filenames on Windows (#2888) 2021-03-09 10:48:50 -08:00
Larry Gritz ae0173119b Fix crash related to ImageBuf::set_write_format (#2885)
There were some flaws in the logic of IB::set_write_format that could
cause a crash when used in conjunction with a file format that doesn't
support per-channel data types (even if the set_write_format call
specified a single type rather than per-channel types!).

There are basically two problems I fixed here.

First, in ImageBuf::write, where we are dealing with the fact that
set_write_format previously registered a request, be extra careful
that the "default" data format is the "biggest" type out of the
per-channel choices, and also make sure that if all the channels are
identical, we just use the default type and clear the channelformats
vector.

Secondly -- and more importantly to the crash itself -- in
ImageOutput::to_native_rectangle, if the output file format does not
suport per-channel data types, just use the main format.  Do NOT
consider this case a hard error, which previously took an early out by
returning NULL for the location where the native data was copied.  It
was that NULL that, when subsequently copied from (not noticing that
it was NULL indicating an error), actually produced the segfault that
caused the crash.  In other words, don't worry, be happy -- just do
your best by treating the unsatisfiable request as the next best
thing, as if it were the same type for all channels.
2021-03-05 09:29:31 -08:00
SRHMorris 9a3743af2c Fix error checking for file descriptor in gifinput on windows (#2886) 2021-03-05 09:28:20 -08:00
Larry Gritz 2c536aa048 Adjust to changed int type definitions in upcoming Imath 3.0 (#2883) 2021-03-04 21:15:12 -08:00
Larry Gritz c6ab3abcda CI: Use Qt5 as a temporary measure (#2884)
Homebrew just upgraded to Qt6, and that breaks us. Peg to Qt5 as a
temporary measure to let our CI pass, until somebody figures out what
needs to be fixed for full Qt6 compatibility.
2021-03-04 21:15:05 -08:00
Larry Gritz fc17e94c97 Changes to accommodate upcoming Imath vector conversion changes (#2878)
I have submitted a PR to Imath that adds "interopability" constructors
and assignment, that use some templates to allow seamless
construction, assignment, and passing of "foreign" vector types to
Imath vectors. This makes it easier library A that uses Imath vector
types in its API to interact with app or library B that has a custom
internal vector type, without a ton of ugly casts and copies.
(See https://github.com/AcademySoftwareFoundation/Imath/pull/91)

These created a few minor conflicts with OIIO's internal SIMD classes
and their construction and casting from Imath types. This patch cleans
up the ambiguities:

* Make Imath::V4f -> simd::vfloat4 and Imath::M44f -> simd::matrix44
  constructor `explicit`.

* Make the simd types `simd()` method (returning the underlying raw SIMD
  type) also have a variety that returns a ref to a non-const vector,
  to ensure proper working of the _MM_TRANSPOSE4_PS macro.

Now I am going to commit a sin. This MUST get backported to OIIO 2.2
in order for it to not break against the upcoming Imath 3.0.  This
doesn't break ABI compatibility, nor change OIIO's primary advertised
public APIs, but it does change the technically/informally public APIs
of simd.h in ways that introduce the possibility that an app using
those simd vector classes *might* need minor source code editing if
they relied on those implicit constructors. Such software might need
certain `simd::vector4 foo = imath_bar` to become `foo = vector4(bar)`
and the same for certain matrix44 assignments.  It is usually a big
no-no to backport any change that could require editing of source
code.  But since the alternative is not being able to use the new
Imath, I think this is the lesser evil, and maybe nobody out there is
doing the thing that would need to be changed?
2021-03-01 12:34:22 -08:00
SRHMorris 86d910bb1c Fix loading PSB with cinf tag (#2877) 2021-02-28 10:29:58 -08:00
Larry Gritz c622d52e15 Imath/OpenEXR 3.x fixes (#2876)
Need some include fixes to more gracefully handle the case where
Imath_ROOT points to a custom build (say, of Imath 3.x), but there is
a system installation of a different version (say, OpenEXR 2.x in
/usr/include, which could easily end up earlier in the path list).

Also update some reference output due to recent bug fixes in OpenEXR,
where error messages changed.
2021-02-27 00:06:44 -08:00
Larry Gritz ad6e7e9afd Remove unused variables that generated warnings (#2873) 2021-02-23 17:52:08 -08:00
Larry Gritz 566e4b128f For libOpenImageIO-C, use BUILD_SHARED_LIBS implicitly like the other libs. (#2872) 2021-02-22 23:26:02 -08:00
Larry Gritz a21dc4e48b Make failure artifacts include the CMake cache and log 2021-02-19 16:44:34 -08:00
Larry Gritz 0017405985 Remove last vestiges of Travis-CI (#2871)
* Some very minor CI cleanup

Mostly get rid of some needless verbosity.
2021-02-19 14:49:54 -08:00
Larry Gritz 796768ef48 unordered_map_concurrent additions: find_or_insert(), nobin_mask() (#2867) 2021-02-18 12:54:59 -08:00
Larry Gritz 1897ddfa70 pkgconfig OpenImageIO.pc was setting include dir one level too deep (#2869) 2021-02-18 08:42:48 -08:00
Larry Gritz 70fe65426b Improve parsing of xmp records (#2865)
* Better handling of lists/sequences -- append into attribute arrays
  instead of allowing each value to overwrite the previous one.

* Better inference of unknown attributes that look like int, float, or
  rational, rather than cramming into strings.

* Fixed what I now think were bugs in handling rational values.
2021-02-17 12:14:10 -08:00
Larry Gritz 4e5cd84e96 Re-enable libheif for Ubuntu (#2866)
Seems to work
2021-02-16 20:04:14 -08:00
alister-chowdhury 0a92880fcb Adding basic TextureSystem support for python. (#2842) 2021-02-15 15:27:11 -08:00
Larry Gritz d474f0b377 Switch to OpenEXR 2.5.5 in hopes of avoiding deadlock (#2863)
Turns out it doesn't -- we're still seeing timeouts on the Windows CI
tests, even with the OpenEXR that we thought fixed the threadpool
problem.

But let's keep this change anyway.
2021-02-14 14:16:04 -08:00
Larry Gritz 1e8f52629a CI overhaul: separate stages (#2862)
Background: In our GitHub Actions CI, we were doing environment setup,
dependency setup, OIIO build, and testsuite -- all in one action
"step" because each stage is its own shell process, so I couldn't
figure out how to communicate between them (for example, a dependency
setup might build and install a dep package, but then the later build
stage needs the CMake Pkg_ROOT variable set to that location).

Doing it all as one "step" was clumsy, not best GHA practice, and it
made it hard to understand which stages were taking different amounts
of time and how to optimize them.

The trick, it turns out, is that $GITHUB_ENV is the name of a file
that will be executed at the start of each step. So you put commands
into that location that restore whatever env variable you need to
restore between steps, or any other setup you need.

So in this patch, we:

* Elevate env setting to be for all steps.

* Split build-and-test.bash into separate build and test scripts.

* Separate setup, dependency installs, build, and test into separate
  GHA steps.

* Each step's script, at its very end, calls new script save-env.bash,
  which puts commands to restore the environment into the file named
  by $GITHUB_ENV, which will be read at the beginning of the subsequent
  step.

* Merge gh-installdeps and gh-centos-installdeps scripts -- there was a
  lot of redundancy between them anyway.

The net result of this is that when we examine the test results, it's
much easier to see which stage a failed test had trouble on, and
especially how much time each stage took. That's really handy with the
recent changes to add caching, and helps us verify that the caching is
working as intended, since it is expected to take a big bite out of
the dependency and build stages, but not the test stage.
2021-02-14 11:44:53 -08:00
Larry Gritz a99000fee4 Build: warn for incompatible OpenVDB 8.0 vs C++11 (#2860) 2021-02-12 20:54:04 -08:00
Larry Gritz fb44431573 Turn off STOP_ON_WARNING default for release branches (#2861) 2021-02-12 20:51:05 -08:00
Larry Gritz 8faa892903 Speed up CI with GitHub 'cache' action + ccache (#2859)
This speeds up CI builds by 1/2 - 2/3 of total time, for PRs that are
minor changes by reusing the compiled results from previous runs.
Most of the remaining time cannot be squeezed down -- it's the
instantiation of docker containers and running the testsuite
itself. But the build (including of dependencies we build from
scratch) is dramatically faster.

Currently, this depends on ccache, so is for Linux/Mac only. I'm also
working on doing something similar for Windows, but it's not ready for
review yet.
2021-02-09 16:29:32 -08:00
Larry Gritz 02ffd75c7d More thoroughly constexpr string_view (#2841)
This should not break backward compatibility.
2021-02-08 12:51:57 -08:00
Larry Gritz b8c5db73c3 CI: Don't build OpenEXR examples (#2857) 2021-02-04 22:34:38 -08:00
Larry Gritz e828f3e2a9 Modify hash_test to verify correctness and stability of the hashes (#2853)
Do some adjustment/simplification of the macros that set up the right
decorators on the new inline farmhash.

Some additional constexpr's, including Strutil::strhash().

Add to hash_test verification of the actual results of each of the
hashes, so we know that we don't break them over time, that they give
the same result on all platforms, and most immediately, to 100% verify
that the new constexpr inline version of the hash precisely matches
the old procedure call one.

Augment the existing benchmarking of the hashes to include
farmhash::inline.  It tries a variety of string sizes. I was worried
that the constexpr/inline version would be a performance hit because
it can't use any of the SSE intrinsics (which, ugh, aren't declared
constexpr in the headers).  But it turns out that the inline (but
SSE-free0 version is a little faster on some tests, a little slower on
other tests, overall a wash and never differing by more than
10%. Maybe that means that the inlining/constexpr makes up for the
lack of SSE? Maybe it means that the compiler optimization is adding
SSE back in well enough that losing the intrinsics isn't as bad as we
would have thought? In any case, the upshot is that this doesn't
represent a performance it, so I may consider a future change to just
go strictly with the inline constexpr versions and eliminating the
separately compiled version altogether. Will mull that over.
2021-02-03 19:14:50 -08:00
Shootfast 5c37eb1139 Static building (#2854)
* cmake: Make LibRaw Jasper and LCMS2 detection optional, add LIBRAW_NODLL

* cmake: Fix OpenColorIO defines on Windows to use correct cmake mechanism

* cmake: Add missing LibRaw defines (needed when linking statically)
2021-02-03 10:58:33 -08:00
Larry Gritz a666727e15 Update INSTALL regarding libheif versions 2021-02-02 09:19:35 -08:00
Larry Gritz a387b51318 CHANGES 2021-02-01 23:58:24 -08:00
Larry Gritz bfac82ab5c Build break fix for new Qt version in VFX Platform 2021 (#2852)
Also bump the number of allowed timeouts on Windows to help pass
tests until we fully track down the OpenEXR deadlock problem.
2021-02-01 17:54:07 -08:00
Larry Gritz 3a78c4ee23 CHANGES 2021-02-01 11:36:19 -08:00
Larry Gritz 0f48445451 CI: Temporarily lock 'bleeding edge' pybind11 to v2.6.3
Something seems to have broken in their master. Lock to the last known
working release so tests pass, while I sort this out.
2021-02-01 10:22:18 -08:00
Larry Gritz 3e74eae539 Fixes to support libraw 202101 snapshot, in progress 0.21.0 (#2850)
Some fields have disappeared from certain structures, so we need to make
adjustments to the various conditional compilation guards.

This patch just makes OIIO build against the new libraw, and is intended
to be backported to the release branch.

This patch does not incorporate any new fields added to libraw
structs, representing newly retrieved metadata. A separate PR patch
will address the newly added capabilities (TBD whether or not that
ends up safe to backport and when).
2021-01-30 16:28:57 -08:00
Larry Gritz fe9a0b85ea OpenColorIO v2 miscellany (#2849)
Bump CI "current releases" test to OCIO v2, it's released!

Oops, we used the wrong name for the env variable, and that CI test
wasn't getting the OCIOv2 RC all along!

Add OIIO::ColorConfig::OpenColorIO_version_hex().

Have oiiotool --help print the OCIO version.

Also Bump the pybind11 version for the "latest" test, and update
INSTALL.md a bit to document the latest versions known to work of
several dependencies.
2021-01-29 22:01:37 -08:00
Larry Gritz 2dc39c87c1 CI: Reduce redundant verbosity in the output during dependency building 2021-01-29 17:05:49 -08:00
Larry Gritz 172a8cc25c Use std types, not TIFF-defined types (#2848)
libtiff trunk is removing these custom types from future
versions. They have been there forever, since long before the std
versions were present.
2021-01-29 09:50:11 -08:00
Larry Gritz d985b0f337 Don't use the version of libheif that's known to be broken on Mac (#2847) 2021-01-28 14:23:50 -08:00
Larry Gritz 9675520247 Fix argument order mismatch on IBA::ociolook and ociofiletransform (#2844)
Ugh, the argument order of the headers and documentation didn't match
that of the implementation, with the inverse and unpremult args swapped.
2021-01-28 12:26:57 -08:00
Clifford Stein 1236e2289b Move farmhash.h to detail subdirectory 2021-01-27 22:53:30 -08:00
cmstein ddb87d9753 make hash functions constexpr friendly so we can compute string hashe… (#2843)
make hash functions constexpr friendly so we can compute string hashes at
compile-time for CUDA/OptiX shaders in OSL.
2021-01-27 16:19:46 -08:00
Larry Gritz b1ebfdaf4b StrongParam helper for disambiguating parameters (#2735)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-01-27 11:40:08 -08:00
Larry Gritz b187908e53 Start staging span and string_view size and ssize changes (#2827)
When we wrote our `span<>`, we based it off the draft for std::span,
which at that time specified span::size() as ptrdiff_t, which is
signed. By the time std::span got finalized in C++20, it was changed
to size_t, which is unsigned. Ick. Switching to size_t will be an API
break, so we can't do that until we're at a version where it's ok to
make breaking changes.

But we can stage a few changes that will make that future transition
easier.

* Add std::size() and std::ssize() wrappers for both span and
  string_view.  This gives downstream apps the opportunity to avoid
  span::size(), instead using std::size(the_span), which is guaranteed
  to be unsigned, and std::ssize(the_span), which is guaranteed to be
  signed, and both of these will work now as well as after we make the
  other breaking changes.

* Doing this properly required adding a couple 'constexpr' in places
  where they should have been all along.

* Define macros OIIO_SPAN_HAS_STD_SIZE and OIIO_STRING_VIEW_HAS_STD_SIZE
  making it easy to know if std::size and std::ssize are defined for
  span and string_view

* OIIO_SPAN_SIZE_IS_UNSIGNED will be defined when OIIO::span switches
  to having an unsigned size like std::span (making it easy for client
  software to know if span::size is signed or unsigned).

  Turn this on automatically for OIIO >= 3.0 so we don't forget.

  If client code predefines OIIO_SPAN_SIZE_IS_UNSIGNED before
  including span.h, that forces span::size to unsigned now (good for
  experimentation and compatibility testing, but I don't recommend
  anybody ship software in that state unless they really know what
  they are doing and don't mind potential incompatibility with the
  out-of-the-box OIIO).

These SHOULD NOT break any existing code or ABIs that uses our
existing span and string_view classes or their size() methods. It only
adds options that will help bridge compatibility.
2021-01-23 11:24:28 -08:00
Larry Gritz 7235dae2be Windows CI: get tiff-suite test passing on Windows (#2840)
We were failing this test because of lack of JPEG support in the TIFF we
were building. Rather than fight it, just use vcpkg to get tiff.
2021-01-23 11:22:47 -08:00
Larry Gritz 20bb4a782a Remove incorrect stray declaration (#2839) 2021-01-22 19:01:17 -08:00
Larry Gritz bb30c3fd05 Make testsuite/coiio work properly on Windows CI (#2838)
A variety of small problems were fixed:

* Symbols in libOpenImageIO-C that were not marked as OIIOC_API.

* MSVS not being happy with array length determined by a variable

* Issues with Windows paths
2021-01-22 13:27:47 -08:00
Larry Gritz 92593fc032 Changes to make filesystem_test work properly on Windows (#2836) 2021-01-20 09:58:00 -08:00
alister-chowdhury 038e3d1beb Changing pybind11 bindings to used SHARED rather than using MODULE (#2830) 2021-01-18 10:56:10 -08:00
Larry Gritz ec78315f20 Try to fix oiiotool-copy and oiiotool-maketx test for Windows CI (#2835) 2021-01-18 08:48:03 -08:00
Larry Gritz d99cc7a3ab imagebuf_test: reset the IB before we remove the file it's reading (#2834)
This is a weird thing we're doing in this very artificial test,
removing a file when the IB reading it is still alive. That's safe on
Unix, where a file with an open file handle still be safe to read even
if it's removed.  But it's not kosher on Windows.  Fix by simply making
sure that in this test, we aren't doing the unadvised thing of having
the IB still active on the file we're deleting. This should fix the
unit_imagebuf test that is failing our Windows CI.
2021-01-17 19:22:28 -08:00
Larry Gritz c63407a73c platform.h: define OIIO_INLINE_CONSTEXPR to be inline constexpr (#2832)
But only for C++ >= 17 when inline constexpr variables became available.
It defines to simply constexpr for older C++.
2021-01-16 22:38:07 -08:00
Larry Gritz 75d4fa9271 Simple macros for testing if OIIO is < or >= a certain version (#2831) 2021-01-16 22:37:06 -08:00
Larry Gritz ec12a0d578 CHANGES for 2.2.10 releases 2021-01-16 22:36:04 -08:00
Chris Whalen 100f9fc3ec added openjpeg-2.4 to OpenJpeg_include_paths (#2829) 2021-01-16 03:08:35 -08:00
Larry Gritz 6a368f4692 Windows CI fix: windows shell treats quotes differently (#2826) 2021-01-15 10:03:22 -08:00
Larry Gritz 3a8abbb55b Fix doc -- C++-like declaration crept into python docs 2021-01-14 12:52:12 -08:00
Larry Gritz 30f98ecdf2 CI: Bump some dependency versions that we test against (#2823)
* CI use latest PugiXML release

* Have the 'latest' test use OCIO v2 RC1

* Bump which version of fmt we download by default
2021-01-14 12:50:43 -08:00
Larry Gritz 3ed1f4a36e Update ref images after recent changes to oiiotool error messages (#2825) 2021-01-13 23:38:35 -08:00
Fabien Servant 9041d0d872 [exif] memory leak in exif parse (#2824) 2021-01-13 11:54:03 -08:00
Larry Gritz a5dd972bc8 Various fixes to make more Windows CI tests pass (#2821)
* Try to address the OpenEXR thread pool hanging when we call exit().

    * Strive to remove all exit() calls after any file reads happen,
      in oiiotool, iconvert, and idiff.

    * This DOES NOT stop all hanging. It's still a bit of a mystery whether
      there is anything we can do to fully prevent it without a fix on the
      OpenEXR side.

    * Temp workaround: for the Windows CI tests, use ctest commands to
      allow each test to timeout 3 times before giving up. To be clear,
      this does not solve the problem, it only masks it. But it helps
      us "pass" those tests, exposing any other problems occurring with
      them, and we will return later to find the source of any residual
      timeouts.

* Update ref output for several tests where the differ slightly under Windows.

* Make runtest.py convert text output line endings cr-lf -> lf before
  comparing to reference output. (This eliminates unnecessary diffs.)

* Update many tests' run.py file to use double quotes instead of single
  quotes for arguments containing some characters -- looks like the Windows
  shell invoked by Python system() does not handle the single quotes quite
  the same way as Unix shells.

* oiiotool: when printing the command line after errors, genericize
  identifiable filenames so they render the same on Windows and POSIX,
  and strip directory name from the oiiotool filepath. This makes
  error output comparison more equal between Windows and POSIX, making
  several more tests pass.

In total, this seems to get us down to failing only 7 tests (not counting
spurious timeouts that cause failures).
2021-01-12 10:26:38 -08:00
Larry Gritz 8b3bd4aa6e Argparse::abort() stops further processing of arguments (#2820) 2021-01-12 09:29:03 -08:00
Larry Gritz a19939c04f Filesystem::generic_filepath. (#2819)
Similar to C++17 std::filesystem::path::generic_string(), but for a
filepath sent as string_view.

While I was there, I noticed that a few Filesystem functions that I
declared as `noexcept` actually call things that can throw, so I put a
few try/catch in stratgic spots. Nobody had reported a problem with
this, and maybe it would be fine, but it's the right thing to do.
2021-01-12 09:28:46 -08:00
Harry Mallon 7e565f7fd4 Fix tests with libheif built without AV1 support (#2818) 2021-01-06 11:10:36 -08:00
Larry Gritz 67551c7d80 CI: fix Windows python tests (#2805)
* Change to finding a consistent Python version (3.7)

* Install numpy

* On Windows, convert crlf to lf before diffing reference output, so we
  don't get mismatches just because of LF vs CRLF.

* Update ref output on testsuite/python-imageinput

* Fix windows detection in runtest.py oiio_relpath

* Fix some semicolon problems that were making bash command lines conused

Along for the ride:

* Have ci-build-and-test.bash send OIIO_CTEST_FLAGS as extra args to ctest

* Remove some needless verbosity from the dependency building scripts.
2021-01-05 21:58:12 -08:00
Larry Gritz 8ecfe7799e Fix build break against OpenColorIO master -- headers disappeared (#2817)
The functions we depend on are all still there, they just moved from
these headers into the main OpenColorIO.h.
2021-01-05 20:20:52 -08:00
Larry Gritz 36422bce81 Fix build break for older libheif (#2814)
With some recent heic related packages, we lost the ability to build
against some older libheif versions that we purport to support. We may
eventually want to raise the minimum supported libheif, but in the
mean time, this restores the prior build abilities.
2021-01-05 15:10:34 -08:00
Larry Gritz a34e8dc5f6 Fix recently-symptomatic python2 vs clang warnings (#2815) 2021-01-05 14:36:37 -08:00
Harry Mallon 9eeac26847 Enabled AVIF encoding with libheif (#2811) (#2812)
Requires libheif built with libaom or dav1d/rav1e
2021-01-05 10:07:02 -08:00
Harry Mallon 5dda98cb63 Enabled AVIF decoding with libheif (#2811)
Requires libheif built with libaom or dav1d/rav1e

Add a test file and simple test for AVIF
2021-01-04 15:28:48 -08:00
Larry Gritz aaf6244e7f Some refactoring to remove unnecessary linkage to python libs (#2807)
Use pybind11 functions to set up python module, it's got superior logic
to what we were doing.

Bump pybind11 version default in build_pybind11.bash

Suppress clang warnings about python register use
2021-01-04 14:20:46 -08:00
Harry Mallon 64a894196f Re-add the HeifInput valid_file check (#2810)
Perhaps an earlier version of libheif was missing the defs? Not sure.
2021-01-04 11:36:34 -08:00
Harry Mallon aad41ce99b Fix error decoding Apple HEIF files (#2809)
* 0 size metadata causes an issue in the libheif cxx wrapper
* fixes #2794
2021-01-04 09:54:25 -08:00
Larry Gritz 8ac0f966e6 Fix several Windows CI tests involving text (#2798)
* Re-enable vcpkg installation of freetype on windows

* Add TESTSUITE-README.md file

We'll use this file to document how the testsuite works and how users
should update it when necessary.

* Re-enable windows tests
2020-12-31 13:36:31 -08:00
Larry Gritz 27baec6ffb Avoid stray pyconfig.h definition of 'copysign' causing problems (#2800)
Caused build errors on Windows due to conflicting definitions of copysign (one of which was a macro).
2020-12-30 21:46:15 -08:00
Chris CrosettoandChris Crosetto 0fb1ad5413 Fix crash parsing OpenEXR header with certain Rational attributes. (#2801)
Fix a few issues parsing rational values with large denominator in OpenEXR header.

Incorrect array index can cause divide by zero crash (observed consistently on Windows with repro image).

Conditional comparison was assigning 1 or 0 to int f declaration instead of gcd value.

Changed gcd type parameter to long long to avoid unsigned int->long int overflow on windows (long int is 4-bytes on windows).

Co-authored-by: Chris Crosetto <ccrosetto@gmail.com>
2020-12-30 12:02:50 -08:00
debaetsdandDieter De Baets bb7b04c7fa Windows CI fixes (#2796)
* fixes to make vs2019 CI run. Not passing yet as some tests fail

* added explicit ctest timeout (180sec) + misc fixes to run CI local

* disable Windows VS2019 tests again as they are not passing yet

Co-authored-by: Dieter De Baets <dieter.baets@unity3d.com>
2020-12-28 11:28:09 -08:00
Larry Gritz 8915b4b24f CI: Test against latest libtiff release (#2792) 2020-12-25 12:14:21 -08:00
Larry Gritz 6b6d45518a ustring hash collision instrumentation (#2786)
OSL has some concerns about how ustring hash collisions could impact
its strategy for strings on GPU.

This patch adds some instrumentation to ustring to detect hash
collisions.  Added static ustring methods total_ustrings() and
hash_collisions(). The latter tells you the number of collision pairs,
including optionally enumerating them into a vector of ustrings. Also,
`getstats(verbose=true)`, in Debug builds only, will print all of the
colliding pairs.  These are both somewhat expensive if there are lots
of strings (my laptop takes about 4 seconds to find and print all
collisions for 10M ustrings). So if you are concerned about
performance in debug builds, call getstats(false) instead if you have
a truly enormous ustring table.
2020-12-25 12:14:02 -08:00
Larry Gritz f6b7f21a93 Mac CI cleanup (#2791)
* No need to uninstall openssl for mac ci (in fact, it breaks things now)

* Mac CI python and numpy install refinement
2020-12-20 19:25:04 -08:00
SRHMorris 3dc00c602d Add ICC profile support for PSD input (#2788)
* Add ICC profile support for PSD input

* Update testsuite

* Hopefully make clang-format happy
2020-12-18 12:23:51 -08:00
Larry Gritz 55aa422a11 Docs: add missing modifiers to -otex (#2790) 2020-12-18 11:08:22 -08:00
Larry Gritz 9163402e14 IBA::fit(): special handling of wrap mode (2787)
This addresses slight ringing at image edges when using a combination of
black wrap mode and a filter with negative lobes. We need to be sure that
we really clamp the filter at the source image edges.

But we only want to do the clamping selectively. Works great for --fit,
not so much for more general warp and rotate. So add it as an internal
parameter to the underlying warp we're doing.

Needed to update a bunch of the fit-related output reference.
2020-12-14 21:02:14 -08:00
Patrick Piché ac4a3d44f2 Removed some duplicates in maketx.rst (#2785)
Removed some duplicates
2020-12-12 10:33:37 -08:00
Larry Gritz 417d6745f0 SPI - bump ffmpeg version 2020-12-10 10:36:54 -08:00
Larry Gritz 686689be32 CHANGES 2020-12-10 10:22:35 -08:00
Larry Gritz 205a48c5d1 Add fillmode parameter to IBA::fit (#2784)
There are several ways to make an image fit a new size while preserving
aspect ratio. Originally, fit() would do what we now call "letterbox"
mode, which tries to maximally fill the new size, retain the original
aspect ratio of the visible image, exactly fill one of the dimensions,
but not lose any visible image data -- this means that a dimension that
cannot be filled will be padded with black pixels. This is still the
default behavior.

But additional modes are not possible: "width" means to exactly fill
the horizontal dimension (the vertical may be letterboxed, or may be
cropped, depending on if it's too big or too small), "height" means to
exactly fill the vertical dimension (the horizontal may be letterboxed
or cropped).

* Add `fillmode` parameter to IBA::fit() in both C++ and Python.

* Old fit() without this parameter are still present for
  back-compatibility, but are deprecated and will eventually (when
  we're at an ABI-breaking release in the future) be removed.

* oiiotool: Add optional `:fillmode=` modifier to the `--fit` command.

* More comprehensive tests in testsuite/oiiotool-xform, testing every
  combination of portrait, landscape, shrinking, growing, each fill mode.

* Update docs
2020-12-10 10:03:04 -08:00
Larry Gritz ed03b43adf Fix webp compile break on 32 bit systems (#2783)
The WebPData::size is a size_t, on 32 bit systems it will balk at our
putting a uint64_t in it. Downcast explicitly so the warning doesn't
flag us.

Also some changes to ensure adequate testing of webp in CI. (Even though
we only CI test 64 bit systems, so this was not related to the specific
build break being fixed... but an excuse to make sure we are hitting it
a reasonable amount in CI.)
2020-12-09 22:10:06 -08:00
Larry Gritz 859020fdfe Better error reporting for IOFile, esp. for OpenEXR writes (#2780)
Filesystem::IOFile constructor now upon an error opening the file will
set the error message appropriately.

Move IOProxy::error() implementation from inline to be in
filesystem.cpp to hide its details, use a static mutex to make error
set and retrieval be thread-safe (we presume that the rare chance that
multiple threads will be setting or getting IOProxy errors
simultaneously are rare enough that it's not a thread performance
issue, and if the user is getting file I/O errors, a bit of minor
locking is the least of their worries).

Better checking of these errors in OpenEXR input and output open
operations.  Hopefully this means that exr file I/O errors will
percolate up more helpful error messages.
2020-12-09 22:09:27 -08:00
Larry Gritz 4851582f2d CI: Make sure we test the latest fmt, PugiXML, and pybind11 releases (#2778)
Also add build scripts for ninja and gif.
2020-12-06 23:33:18 -08:00
Larry Gritz 18fd917114 Bump master version because we're using 2.3.1.x for minor additions to 2.3.1.0 2020-12-06 21:59:51 -08:00
Larry Gritz de5081e3f8 Fix typo in last commit 2020-12-06 21:59:51 -08:00
Larry Gritz 300b3d1ffb Fix rare OpenEXR multithread output crash (#2781)
TL;DR: This could crash during openexr output, turned out to be a subtle
race condition.

Long explanation:

Metadata gets prefixed with `<formatname>:` in cases where it's only
meant to be understood by the reader or writer of one format.  Formats
that support arbitrary metadata filter out any items that are prefixed
by the name of a different format (so you don't, for example, when
converting file formats, incorrectly copy a TIFF-specific metadata
hint into an OpenEXR file as literal metadata).

The specific code we used in the OpenEXR writer tried to do this but
got the threading locks wrong, and this could lead to very rare, subtle
crashes. It could have been fixed by a 3-line very local fix, but...

I also noticed that the same code was replicated in Field3D output (and
quite incorrectly -- in the cut and paste from the openexr code, it was
still looking for "openexr:" prefix instead of the correcd field3d one!).

Since this idiom was happening (wrong) in two different places, and
seemed likely to crop up again some time, instead of fixing locally I
added a new API call, `is_imageio_format_name()`, to do this centrally
and correctly.  So most of this patch is implementing that and then
using it instead of the incorrect code elsewhere.

Also add python bindings and docs for the new API function
2020-12-06 19:55:43 -08:00
Larry Gritz b0d6c9481b Remove appveyor.yml -- broken and no longer needed. (#2782)
We test Windows build with GitHub Actions CI now, this is no longer
needed and a PITA to maintain.
2020-12-05 15:57:53 -08:00
Larry Gritz 30773617af Support UTF-8 filenames for GIF (#2777)
Required adding a utility function Filesystem::open that returns an
integer file descriptor.
2020-12-02 10:24:58 -08:00
Larry Gritz 9e0bd88c7d CHANGES 2020-12-01 10:57:58 -08:00
Larry Gritz cd26833fdf Extend checked_find_package with VERSION_MIN and VERSION_MAX (#2773)
Upon reading cmake docs mre carefully, it's clear that when you pass a
version to find_package (which does much of the heavy lifting inside
checked_find_package), it DOESN'T MEAN you want that version or
later. It means you want to find a version that is "compatible" with
the named version. The meaning of "compatible" is up to the package.
Some packages define it as being >= the requested version. Others
define it as being the same major release, or same major AND minor
release, or exact.

But generally speaking, we only care about the minimum version (e.g.,
"I want FooBar 8.0 or later"). And it's not guaranteed that is what
the package's compatibility will do. In fact, FooBar may be using
compatibility mode "SameMajorVersion", which will make our find of
FooBar succeed for 8.0, 8.1, 8.2, but if a user encounters FooBar 9.0,
our build will reject it, even though it's probably fine.

So I augmented our checked_find_package wrapper to take optional
VERSION_MIN to give the real minimum version, when that's the semantic
we really want (in which case we would omit the ordinary version
number used for the compatibility check and let VERSION_MIN do all the
work). There's also an optional (and usually omitted) VERSION_MAX that
you can use if you are sure that we must be less than a certain
version (the max is exclusive, you must be <, not <=, whereas the min
is inclusive >=).

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-27 12:16:57 -08:00
SRHMorris 70ea9e71b9 Fix bmp row order (#2776) 2020-11-26 12:03:14 -08:00
Larry Gritz 45f6e801e7 Unbreak CI on Mac
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-21 21:57:05 -08:00
Larry Gritz f2d7aaf144 Unbreak CI on Windows (#2772)
Some permissions on GH changed due to security concerns, and that broke
the setup-nuget action we were using... which turned out to be obsolete,
anyway, and switching to the new recommended replacement fixes everything.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-21 11:52:36 -08:00
Larry Gritz 929a347526 Docs: Set up to try sphinx_tabs extension (#2768)
Inspired by OpenColorIO's beautiful docs, I'm adding the "sphinx_tabs"
extension to our docs, and testing them out in one little spot in
ImageBufAlgo to see if we like the effect.

Please look at https://openimageio.readthedocs.io/en/rtd/imagebufalgo.html
look at the first couple screenfuls to see the example of how the
tabs look. Opinions are welcome. Should we do this kind of thing more
extensively?

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-18 14:42:40 -08:00
Larry Gritz 3accbb9f3e CMake refactoring and subproject friendliness (#2770)
* Detect if OIIO is being built as a subproject, and if so, set
  `OpenImageIO_IS_SUBPROJECT` (a.k.a. `${PROJECT_NAME}_IS_SUBPROJECT`).

* Move all the testing logic out of the main CMakeLists.txt (and a few
  testing-related macros from oiio_macros.cmake) and into a new
  src/cmake/testing.cmake.

* Move all of the packaging logic out of the main CMakeLists.txt and
  into a new src/cmake/packaging.cmake.

* Make all the testing and packaging inactive if this is being built
  as a subproject. Also disable the clang-format target for subprojects.

* Move fancy_add_executable and add_oiio_plugin from oiio_macros.cmake
  into their own files (leaving oiio_macros.cmake empty and
  eliminating it).

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-16 13:37:07 -08:00
Larry Gritz 6313484e35 Build against OpenEXR 3.0 + Imath 3.0 (#2771)
As OpenEXR works toward their 3.0 release, which includes splitting
Imath (the vector, matrix, math, and 'half' stuff) out into a separate
repo, their top of tree master finally breaks our "bleeding edge"
build.

This is a little tricky, because now our support of this dependency is
attempting to span 3 eras: 3.0 with the full split of openexr from
imath, recent openexr+ilmbase 2.x that supplies reliable exported
cmake configs, and older 2.x that predates cmake configs. Eventually
we'll phase out older versions and clean up.

Fixes in this patch generally include:

* Add a new CI test of VFX2021 + openexr/imath master. (This will go away
  when 3.0 is released and that's what we use for the main 2021 case.)

* For new enough versions of OpenEXR, use the exported config file and
  targets, rather than the old style OPENEXR_LIBRARIES style variables.
  We have kind of a mixed idiom use because we're still supporting older
  versions that predate use of the config files.

* Move imath includes to new OpenImageIO/Imath.h Deal with the fact
  that the Imath headers now live inside `<Imath/ImathBlah.h>` rather
  than `<OpenEXR/ImathBlah.h>`. But of course, you need to start
  including things just to find out the version. It's tricky.  The
  logic is to look at `<OpenEXR/OpenEXRConfig.h>` to determine the
  version we're dealing with, then include Imath stuff from one or the
  other depending on what we found. I rearranged quite a few includes
  to ensure that all this logic only happens in a couple spots and the
  rest gets included transitively. As it turns out, quite a few of our
  `#include`s of Imath headers were redundant.

* OpenImageIO-C depended on OpenImageIO publicly, but actually it
  should depend on OpenImageIO privately, but export its include
  needs.

* OIIO's exported config needs to look for OpenEXR.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-15 16:49:07 -08:00
Larry Gritz f4d2c85078 Read exif encoded in PNG files (#2767)
At present, it only reads Exif from png, it doesn't write.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-12 11:49:30 -08:00
Larry Gritz 2608e4693f Bump version after developer preview tag
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-11 16:18:24 -08:00
Larry Gritz 1ad75bcf89 CHANGES
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-09 11:36:16 -08:00
Larry Gritz ece16ea82a fmath.h: Use intrinsics for swap_endian (#2763)
Use __builtin_bswap when available. These seem to be 8-15x faster than
the std::swap-based implementation when multiple data values are
being swapped. (It's not dramatically better when swapping a single
value, either way it's pretty fast.)

Also add correctness unit test and benchmark for swap_endian.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-09 11:27:09 -08:00
Fabien Servant e9f9dc9a5e libraw user_flip configuation option (#2769) 2020-11-08 08:45:48 -08:00
Anders Langlands 5f362446f9 Add a plain C API (#2748)
The core ImageInput and ImageOutput (and auxiliary classes they use, such as ROI, ImageSpec, DeepData) now have C99 interfaces that wrap the native C++ classes. In addition to being good for using OIIO with C, this is an important step along the way to simplifying the implementation of Rust bindings (and other languages that have a simple ffi interface to C but are tricky to wrap C++).

Still to do: ImageBuf, ImageBufAlgo, etc.
2020-11-06 12:23:23 -08:00
Larry Gritz 4107d7d428 clang-format fix
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-03 12:29:16 -08:00
Larry Gritz 1896caa37a Improvements to docs and breathe setup (#2762)
* Bump breathe release to the latest (we'e been holding back because of
  errors that we fix in the other elements of this patch, below)

* Changing declaration formatting, particularly in the ImageBuf and
  ImageBufAlgo chapters, eliminates function ambiguity warnings and even
  python exceptions we were getting in Breathe before.

* Document missing texture option fields and improve formatting.

* Instruct Doxygen to not catalog deprecated ImageBufAlgo functions.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-02 16:17:23 -08:00
Larry Gritz fd273acf69 CHANGES, belatedly bump version to reflect recent ABI change in master
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-01 22:50:02 -08:00
Larry Gritz 59667abcf6 Document jpeg output hints
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-01 22:40:01 -08:00
Larry Gritz e46392b2c2 Build: Require exact version if PYTHON_VERSION is specified (#2764)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-01 17:42:25 -08:00
Larry Gritz 0c130968b8 CI: Just run all tests, don't try to cleverly exclude some (#2766)
We were running some CI tests only for PRs or for certain branches.
This may save some time, but I found that I was, more often than not,
naming my branches to trigger all tests to run. That's silly. Just run
all the tests every time, it's not that expensive.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-01 16:55:29 -08:00
Larry Gritz 822ac4f149 Changes for recent OpenColorIO v2 (#2765)
OCIO master recently renamed the symbol in its headers that we used to
detect its version, breaking OIIO's build against the current OCIO
top of tree master.

This change makes our FindOpenColorIO.cmake work with both old and new
OCIO.

Also, cut out other useless OCIO building (for our purposes) by having
our build_opencolorio.cmake disable buildig of GPU tests (which,
recently, became controlled by a different option than is used to
disable building all the other tests).

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-01 16:43:43 -08:00
Larry Gritz f809c7b98e Clarify certain ImageBuf methods for copied images (#2759)
ImageBuf methods subimage(), nsubimages(), miplevel(), nmiplevels(),
and file_format_name(), which are concerned with the file to which the
ImageBuf refers, only make sense for an ImageBuf that directly refers
to a file -- either by being constructed/reset from a filename, or in
some cases, being a direct unmodified copy of such an imageBuf. All
other cases, including pixel-copies of other ImageBufs (even those
that came from files), it is merely an in-memory image and doesn't
really refer to a file.

Clarify the docs (and fix the implementation) to ensure that for
any ImageBuf that is not a simple reference to a file, these methods
return a suitale default value.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-31 15:58:29 -07:00
Larry Gritz 47bd962bc8 CI: Better libraw testing (#2761)
* Accommodate changes for 0.20.2 that Homebrew now has.

* Mistake in variable naming meant we weren't testing libraw master as
  we previously thought.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-29 18:59:11 -07:00
Larry Gritz 30d70594b0 Fix reading TIFF files with "separate" planarconfig (#2757)
There is a big bug lurking in how we read TIFF files with "separate"
planarconfig (RRRGGGBBB, versus "contig" RGBRGBRGB). I knew that
libtiff when reading scanline files doesn't support true "random
access" to scanline for most compression methods -- because you can't
seek to the start of a scanline in the middle of a compressed "strip,"
you have to read whole strips, or read individual scanlines
consecutively. But what somehow I've misunderstood for years (if not
decades) is that for "separate" planarconfig, this means that you
can't jump from scanline i in plane 0 to scanline i in plane 1! You
have to read all the scanlines (at least within one strip) in a single
plane before moving to the next plane.

This means that we get all sorts of read failures when reading TIFF
files meeting all of these conditions:

* "separate" planarconfig (these are rare in general)
* Scanline-oriented (tiles are fine, because they're read whole)
* More than one channel (with one channel, separate and contig are
  basically the same)
* Certain compression codecs (turns out the separate+scanline combo
  tests in the libtiff example suite are uncompressed, which is how
  our testsuite failed to catch this).
* rowsperstrip > 1 (if rps == 1, every scanline is a new strip, and
  that worked)
* written by an app that doesn't use OpenImageIO (because OIIO TIFF
  output forced rps=1 for separate planarconfig)

Things were very broken. There is a comment in tiffoutput.cpp that says

    // I can only seem to make separate planarconfig work when
    // rowsperstrip is 1.

and forces rps=1 for separate planarconfig output. So at some point
many years ago I realized that something odd was happening here, but I
apparently I thought it was a bug in libtiff when writing with rps > 1.
Probably we were writing correctly all along, and the real bug was in
the reading.  This also explains why we had mostly not seen this
problem before, which is because all OIIO-written files avoided
producing tiff files that fell into the failures case.

This patch mostly fixes it and also makes a number of performance
enhancements:

* Fix misunderstanding in read_scanlines where it was loose with thread
  safety in retrieving the rows per strip.

* In read_scanlines when deciding the "chunk size" to limit temp
  buffer size, and in read_image when deciding how many scanlines to
  read at a time via read_scanlines, these computations weren't the
  same, leaving slivers to be read alone instead of staying aligned
  with strips. Make those both compute the same way, so from read_image
  on down, we end up reading chunks that are always aligned with
  strips.

* TIFF read_scanlines used to try to read whole strips, except for
  reading individual scanlines that didn't comprise a whole strip
  length. Modify it to recognize that the one exception is the last
  strip in the file, in which the strip is shorter than usual if the
  total number of scanlines is not an even multiple of rps. This
  ensures that the last strip is read as a strip, not as individual
  scanlines.

* Imagecache autotile behavior is modified to force the pseudo-tile
  size to be a multiple of the strip length. Again, that keeps the
  resulting reads to always be in units of strips, which is much more
  efficient and is the safe way to seek and read separate
  planarconfig.  Also, always turn on autotile for any tiff file with
  rowsperstrip > 1, because it's already organized that way in the
  file. This is not only more efficient generally, but also makes it
  so that ImageCache will only do reads aligned safely to strip
  boundaries.

This is not a complete solution, in the sense that an app making
individual read_scanline calls for solo scanlines, or read_scanlines()
that is not aligned to strips, can still have read failures for TIFF
files that are just the right combination of separate planarconfig +
certain compressions + scanline order.

However, with this patch, the following common cases will ALWAYS work
correctly now: (a) read_image or read_scanlines of the whole image
size; (b) any reads mediated by ImageCache or TextureSystem; (c) all
images read by ImageBuf (which always use either (a) or (b)); (d) all
operations of oiiotool (which use ImageBuf).

After this patch is merged, solving the common cases, I'll return to
the topic to tackle the remaining issue of broken reads for these
files when doing individual ImageInput::read_scanline reads or
read_scanlines with ranges not aligned to strips. To make those work,
I'll need some kind of ugly internal strip buffering.

I'm going to leave the "force rps = 1 when writing planar separate tiff"
as it is, because even after this set of fixes, software using old
versions of OIIO will not be able to correctly read rps>1 planar files,
so we wouldn't want to be inadvertently writing them, at least not
until all the pre-fix OIIO releases are unlikely to be used by
anyone. Not writing planar files with rps>1 is not much of a
sacrifice, considering how rarely planar files are used at all.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-27 21:22:23 -07:00
Larry Gritz c07c983df9 Remove the unused old LaTeX documentation (#2758)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-25 22:14:33 -07:00
Jan Hettenkofer 05063ac2b2 Docs: illustrate reading image data into separate per-channel buffers (#2756)
Related to #2744
2020-10-25 21:31:47 -07:00
Larry Gritz d8c610653b CI: Simplify install_homebrew_deps.bash for modes we don't use (#2753)
Now that we use Linux and the ASWF docker containers for the
"clang-format" test, there's no reason to have logic in this setup
script for Mac to choose a more restrictive set of package for that
case.

Same for clang-tidy -- we don't have a test like that anyway, and
if we add one, we will surely do it with one of the Linux containers.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-25 12:02:13 -07:00
Larry Gritz 4dd4f25311 Fix propagation of errors from make_texture (#2747)
There was no formal error setting! Errors were echoed to the optional
output stream, if supplied. But that's not good enough.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-25 12:00:59 -07:00
Larry Gritz e22de63bd7 Fix thread safety in ImageInput error reporting (#2752)
Although we were careful to make sure that the new versions of
ImageInput `read_scanlines`/`read_tiles`/`read_image` methods were
thread-safe when called concurrently, one thing that slipped through
the cracks was error reporting. A failed read (or other) call would
return an error flag and use error() to set the error message, which
could be retrieved via geterror()/has_error().

Except the flaw was that the error itself was a single std::string in
the class. It was guarded by a mutex, so at least the threads wouldn't
clobber each other over access to the string. But it means that the
following call sequence would do the wrong thing:

    thread 1:   read_tile A  --> fails
    thread 2:   read_tile B  --> fails
    thread 1:   geterror()   --> gets both errors appended, oops!
    thread 2:   geterror()   --> gets an empty error message, oops!

Why hadn't we noticed until now? Because read failures of individual
scanlines or tiles are rare -- usually the failure or discovery of a
missing or corrupt file is in open().  So I guess it's not often that
two concurrent reads would both have just the right timing to have the
error retrieval problem described above.

There is no easy fix, so a bit of a bigger, ABI-breaking, change was
necessary to make this work properly once and for all:

* ImageInput and ImageOutput error messages are now thread-specific. That
  is, geterror() retrieves errors generated by method calls made by the
  same thread.

* ImageInput and ImgageOutput now use a PIMPL idiom to store some data
  behind an opaque pointer. This is good -- it means that the details
  are hidden from the public API, and can use classes we don't wish to
  expose (which we will do here with boost::thread_specific_pointer) as
  well as allow us to change what's behind the pointer without breaking
  the ABI.

* The error message uses a thread_specific_pointer.

* We therefore removed the m_errormessage member that was unfortunately
  in the public class. Also removed the mutex and the m_threads, which
  can now be safely tucked behind the PIMPL.

* With the mutex hidden from view, we now re-jigger references to it
  to use the lock/unlock methods we had already. In fact, instead of
  using lock_guard<mutex>, we can use lock_guard<ImageInput> because
  the presence of lock/unlock methods make ImageInput (and ImageOutput)
  themselves compliant with the BasicLockable concept.

Note that this changes the data layout of ImageInput and ImageOutput,
and therefore is an ABI break. So this is a change meant for master
only (future OIIO 2.3+), and will not be backported to the 2.2 release
branch.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-25 12:00:19 -07:00
Larry Gritz 1226202c0c CI: lock down on clang-format 10 (#2751)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-22 21:24:47 -07:00
Larry Gritz 4d21c3114c Work around GHCI Mac problem with homebrew openssl (#2750)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-22 21:17:21 -07:00
SRHMorris d8d7661b7f Add support for saving progressive jpegs (#2749) 2020-10-22 11:52:14 -07:00
Larry Gritz f391aa86e2 WebP input overhaul (including animated webp and metadata) (#2730)
* WebP input overhaul (including animated webp and metadata)

Huge overhaul of webp reading. Since webp support was first added in
2011 (with no major changes since, other than a couple minor bug
fixes), we have been using the basic/simplified webp API, which had
many limitations.  This patch rewrites it to use the more complete
API. This results in the following changes and new capabilities:

* RGB images are kept as 3-channel instead of forced to be RGBA upon
  input.

* Skip alpha premultiplication for RGB files. And for RGBA, skip the
  dubious color space transformation when doing premultiplication of
  RGBA files. I think this has been wrong all along.

* We can now read animated webp images (akin to animated GIFs, they look
  like multi-subimage files).

* Much more efficient to read just the header, the pixels are read and
  decoded lazily.

* Switch to the WebPDecode*Into API calls, which lets us preallocate
  and manage the decoded image buffer (as a unique_ptr). Also switch
  the encoded buffer from a std::vector to std::unique_ptr, which
  avoids an unnecessary zeroing out of the buffer.

* Close the file handle immediately after we're done reading, rather
  than leaving the handle open until the client is done with the
  ImageInput.

* Read Exif metadata properly from webp files.

* To use the more sophisticated API, we need to find and use the
  libwebpdemux library.

* Since there is a "LoopCount" metadata here, similarly to with GIF, I
  decided to make an OIIO metadata "oiio:LoopCount" that will work
  with both. GIF saves with this, too, and "gif:LoopCount" is now
  considered a deprecated synonym.

Fixes #2721

N.B. This only covers webp input, not output. A similar overhaul should be
done eventually on the output side.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-21 17:19:30 -07:00
Larry Gritz 2c8e1d8036 Make readthedocs generate downloadable html as well as pdf (#2746)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-21 09:43:17 -07:00
Larry Gritz 25f74995dd Confirm that we can build with Clang 11
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-20 22:36:22 -07:00
Larry GritzandDeclan Russell c9d7538a4e Fix Cuda build break (#2743)
Cuda 10.1 seems to have trouble because of the `__attribute__` used in
`OPENIMAGEIO_PRINTF_ARGS`. Declan Russell suggests modifying the `#if`
to avoid using it for `__CUDACC__`.

LG further observes that `OPENIMAGEIO_PRINTF_ARGS` is only used for
the declaration of two functions, it seems like a nice decluttering to
just directly use the short attribute exactly where it is needed
instead of having a lengthy explanation and possibly defining
`__attribute__` everywhere as a side effect.

Signed-off-by: Larry Gritz <lg@larrygritz.com>

Co-authored-by: Declan Russell <declan@solidangle.com>
2020-10-20 17:42:02 -07:00
Larry Gritz 665c634b12 IC bug fix: add_tile/get_tile not peroperly honoring chend < chbegin (#2742)
For IC::add_tile() and IC::get_tile(), the documentation advertised that
passing chend < chbegin meant "all channels". But the implementation was
setting chend=nchannels but not setting chbegin to 0.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-15 23:16:08 -07:00
Larry Gritz 4b55445489 Error policy overhaul to clear up inconsistencies (#2740)
Different classes and modules had minor inconsistencies on how errors
were reported and retrieved. Let's fix these up.

* geterror() should always take a `clear` parameter that allows the
  caller to control whether or not retrieving the error clears the
  internal error message (default is true, clear it after retrieving).

* Any class with a geterror() should also have a has_error() that merely
  reports whether there is an error message pending retrieval.

* geterror() will always *append* to an existing error message that
  has not yet been retrieved, with a newline separating error
  messages. Previously, some of our geterror implementations appended
  and others replaced.

* geterror() will trim a single trailing newline from the message it
  is passed, thus storing error messages that are not
  newline-terminated and making it so that callers of geterror() don't
  need to wonder whether or not they should terminate their error
  messages with a newline or what happens if you make the wrong
  choice.

* Usage guidance is therefore that individual errorf/errorfmt() calls
  not include a trailing newline (though if one is present, it will
  be harmlessly stripped), and that whoever retrieves with geterror()
  should, after outputting it, add a newline (which they seem to
  invariably do already).

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-15 23:15:24 -07:00
Larry Gritz 619c2e0d29 Fix CI break (#2741)
One of our CI matrix entries -- building with clang -- has
mysteriously broken with compile errors complaining about reallocarray
being inconsistently declared in stdlib.h and gif_lib.h. It just broke
a few days ago, unrelated to any changes on our part. I have no idea
if it was the compiler or gif library that got updated and then broke.
Whatever. Insulate ourselves from random changes on GHCI by converting
this test to use one of the ASWF containers that we can count on to
have stable dependencies installed.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-11 15:11:50 -07:00
Larry Gritz f981098ace pugixml build fixes (#2733)
* Bring back the idea of a Findpugixml.cmake file because it turns out
  that (for pugixml <= 1.10) the exported config files are not reliable.

* Fix CI scripts to build PugiXML (with a few different versions). We
  previously were relying on the embedded version for all CI tests, which
  masked problems associated with using an external PugiXML.

* Fix deprecation warnings about xml_document.load(), the new call is
  xml_document::load_string().

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-10 11:18:24 -07:00
gbansal2andGaurav Bansal 8a64508a84 Fixed ARM NEON code path in simd.h, all tests in simd_test are passing (#2739)
Co-authored-by: Gaurav Bansal <gbansal@apple.com>
2020-10-09 13:36:59 -07:00
Larry Gritz 6612857298 make_texture was not correctly setting tile sizes (#2737)
It was setting it, but later, too late for the particular case where
constant_color_detect was used and found a constant color and also the
config spec came in without any tile preference (still 0's).  So move
the default initialization up to the top.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-07 20:52:43 -07:00
Larry Gritz 1003d1a287 Use 'final' liberally (#2734)
This is good for optimization, allowing "de-virtualization" of function
calls in cases when the compiler can be sure that there can be no further
subclassing.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-07 18:40:41 -07:00
Larry Gritz 12d81bd84a Fix broken read of 16 bit iff files (#2736)
This used to work, was inadvertently broken in #2398, in Nov 2019, and
no release of OIIO 2.1 ever had it working!  (I guess people don't
come across 16 bit iff files very often?)

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-06 19:58:53 -07:00
debaetsd 051f16933c Fix boost linkage on Windows (#2727)
Boost date_time, though never explicitly called in OIIO code, can be transitively pulled in by boost threads. This seems to be a problem on Windows when you build a partial boost containing only the libraries you think you need.

The solution seems to be to set BOOST_ALL_NO_LIB on MSVC, even for the dynamic linking case.
2020-10-05 10:51:33 -07:00
Larry Gritz a43dbfcc15 oiiotool: Improve guessing about output format based on inputs (#2717)
What data format does oiiotool write for its outputs? The ones
specified by -d, if supplied, but otherwise it will make a guess based
on the types of inputs it has seen.

This patch makes several improvements:

* Multi-subimage files were getting very confused because different
  subimages may want different data formats, and it was at best
  remembering data formats overall and by channel name, but not taking
  subimages into consideration. Make this much more specific by
  remembering both raw channel names (for all subimages), as well as
  specific channels of named subimages.

* The way the input data formats were remembered had repeated (and
  non-matching) code depending on whether the input was read
  immediately or lazily.  That is now cleared up, with the logic
  refactored and expressed only once.

* The -d directive can specify a type (for all channels), a type for a
  particular channel name (`channel=type`), and -- this part is new --
  a type for all channels of a named subimage (specified as
  `subimage.*=type`) or just one channel of a specific subimage
  (`subimage.channel=type`).

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-01 09:42:45 -07:00
Larry Gritz 89bcfbdde1 iv shouldn't open with config unless it really means it (#2728)
This can cause cache re-reads unnecessarily because it thinks you're
asking for potentially different configuration hints every time you
set the ImageBuf to a different subimage.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-29 15:50:23 -07:00
Larry Gritz d6c4c73b3c CI on Windows: Disable ffmpeg download, the link is broken (#2729)
The web site where we used to download pre-built ffmpeg binaries
seems to have disappeared.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-28 23:04:00 -07:00
Brice Gros f666b67369 WebP: add support for lossless attribute of image spec for webp (#2726) 2020-09-28 22:20:56 -07:00
alister-chowdhury 0604c1711e #2720 - Adding 1 bits per sample support to tiffs. (#2722) 2020-09-26 15:07:14 -07:00
Larry Gritz 1a00428732 More principled approach to alloca to avoid stack overflows (#2716)
A bug (issue 2713) revealed that an alloca in IBA::colorconvert could
cause a stack overflow on an image that had an unusually wide number of
columns per scanline.

This patch takes a number of measures to help root out these problems
in the future:

* The OIIO_ALLOCA macro is amended to assert (in DEBUG builds only)
  upon any attempt to alloca more than 1MB, which is surely a sign that
  we have used alloca in an inappropriate place.

* A new OIIO_ALLOCATE_STACK_OR_HEAP macro is used to encapsulate an
  idiom I have used before, to alloca small things but new[] big things,
  and ensure in both cases that the memory is freed when the function
  exists scope. I choose arbitrarily for "big thing" to mean <= 64 KB,
  which is big enough for one 64x64 tile or one scanline of a 4k image
  if it has 4 float channels, that means most of the time we'll safely
  allocate on the stack, but for anything larger, it will use heap.

* Use OIIO_ALLOCATE_STACK_OR_HEAP in those problematic spots of
  colorconvert.

* Use OIIO_ALLOCATE_STACK_OR_HEAP in a few other places that seem
  prudent.

* Grepped through the code for all instances of OIIO_ALLOCA and I think
  that all the potentiallly "big" ones are now using the safe idiom.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-26 15:06:06 -07:00
Larry Gritz 6a9bf72322 TIFF: Fix spec() and spec_dimensions() for mipmapped tiff files (#2723)
For "mip-mapped" TIFF files where we use the multiple images in the file
to emulate MIP-maps rather than what we ordinarily consider subimages,
a call to `ImageInput::spec(subimage,miplevel)` was not properly
recognizing invalid subimage values and returning an empty ImageSpec
as advertised. Basically, we assumed that they would only ask for a
valid subimage and miplevel and didn't properly handle out of range
values.

Same problem for spec_dimensions().

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-26 15:02:00 -07:00
Larry Gritz 9183e44b75 Update ref output after libheif 1.9 release (#2724)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-26 15:01:02 -07:00
Larry Gritz ed2ba9b2d9 Bump version after dev snapshot tag
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-26 15:00:16 -07:00
Larry Gritz 03210f9c9d CHANGES
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-24 16:44:15 -07:00
Larry Gritz e9a7f8b160 oiiotool: Enhance --chappend and --siappend (#2709)
For both, allow an optional modifier ":n=" to specify the number of
images from the stack to be combined by having their channels or
subimages appended (versus the default of combining just the top 2
images).

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-20 22:36:46 -07:00
Larry Gritz 2e79caed68 Move type_merge functionality from IBA to TypeDesc (#2715)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-19 00:16:57 -07:00
Larry Gritz b5fb702223 Strutil::splits, splitsv should return NO pieces for empty string (#2712)
Fix cause of a subtle bug: splitting an empty string returned one
string piece (also empty) instead of 0 pieces.

Beef up the Strutil unit tests in this area.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-17 23:31:35 -07:00
Larry Gritz 8e8ad987ee Fix crash in oiiotool --resize with multi-subimages (#2711)
This was subtle. Empty subimage include/exclude specifications would
confuse compute_subimages(), which in turn would MUCH later do a
mis-allocation and lead to a situation in --resize where it would
iterate over subimages that had not need allocated.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-17 23:31:04 -07:00
Larry Gritz c2ff09fff2 Convert iv to use new style argparse (#2707)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-14 20:58:55 -07:00
Larry Gritz 5273f478b9 python cleanup (#2705)
Switch from old cmake macros that were marked obsolete in cmake 3.12 to
the new FindPython.cmake module.

Instead of defaulting to python 2.7, default to whatever is found.
But user can still set PYTHON_VERSION variable to request a specific
one in case there are multiple.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-14 20:57:51 -07:00
Larry Gritz 3b5249bdb9 Robust to broken homebrew gpg transitive dependency
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-14 14:34:52 -07:00
Larry Gritz eb2818d52d Fix ImageBuf vs ImageCache out-of-date image problem (#2696)
ImageBuf uses ImageCache underneath. But this can lead to the following
unexpected behavior if you don't understand this:

1. Make an ImageBuf for an image, read it (even just header info).
2. Done with it, destroy the ImageBuf.
3. Some other part of the program, or even a different process, changes
   that file on disk.
4. Make another ImageBuf with the same filename, thinking you're getting
   the updated image, but in fact it's relying on the cached representation
   which doesn't contain the changes made in step 3.

So these tiny changes try to make this much harder to shoot yourself in the
foot:

* New ImageBufs automatically call cache->invalidate on the filename
  before they start reading, to ensure that if the file has changed on
  disk, anything in the cache is invalidated.
* When you destroy or clear an ImageBuf, it calls cache->close() on the
  file, to release the handle (especially helpful on Windows, where an
  open file handle can lock the file to other processes).

There is a chance that some image operations will have degraded
performance, if you are mixing direct ImageCache use (including
TextureSystem) and ImageBuf reads of the same files -- since creating
and destroying the IB's will flush tiles from the cache and close cached
file handles. But I think that this should not be a problem in practice,
since most apps that are heavy users of ImageBuf (like oiiotool) aren't
heavey users of IC/TS, and vice versa. And eliminating this confusing
behavior is probably more important than occasional over-eager
invalidation of the cache.

Also clarify in the docs (and imagebuf_test) that if you use the
variety of ImageBuf ctr where you give it a custom ImageCache, it's
important that the ImageBuf outlives the ImageCache, as it is a
non-owning reference.

Fixes 1987

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-13 18:24:44 -07:00
Larry Gritz 5e16ad0e53 oiiotool --pastemeta (#2708)
This new command takes two images as arguments, and appends all the
metadata (only) from the first image onto the second image's pixels
and metadata, producing a combined image.

This can be useful for users who have some (either non-OIIO-based or
just badly implemented) application that operates on image files but
fails to propagate the metadata, by having a simple way to transfer
metadata from one file to another:

    bad-app in.exr -o out.exr
    # oops, out.exr no longer has the crucial metadata from in.exr

    oiiotool in.exr out.exr --pastemeta -o out2.exr
    # Now out2.exr has the pixels of out.exr, but with all metadata
    # from in.exr added to or overwriting that found in out.exr.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-13 18:22:09 -07:00
Larry Gritz 98d7de6855 IBA::contrast_remap -- move alloca outside loop (#2704)
This could stack overflow for large images.

Fixes 2703

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-07 14:25:09 -07:00
Larry Gritz 7e6d9c4e34 Declare aligned_malloc and aligned_free as OIIO_API (#2701)
Fixes 2700

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-07 01:18:54 -07:00
Larry Gritz 19b7fefdff Python: be more forgiving in what's passed to attribute() (#2695)
We have many classes that have methods

    .attribute(name, intval)
    .attribute(name, floatval)
    .attribute(name, stringval)
    .attribute(name, TypeDesc, anyval)

For ImageSpec.attribute() and OIIO.attribute(), the anyval was
restricted to only accept tuples. Fix these to bring them in line with
many other classes' attribute calls in which the 'anyval' really can
be just about anything -- tuples, lists, numpy arrays or other buffer
objects, or scalar values.

Fixes #2674

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-03 21:51:52 -07:00
Larry Gritz abc544a5d7 Fix GIF min dependency (#2697)
Seems that cmake's FindGIF.cmake isn't good at discerning minor
releases (prior to GIF 5.x including more info in its headers), so
saying "find_package(GIF 4.1)" doesn't work the way we'd like, and
seems to fail to find a legit 4.1 installation.  Go back to
find_package(GIF 4).

We seem to have broken this in PR 2681, and I'm worried that people
with gif_lib 4.1 will find themselves mysteriously lacking GIF support
in their OIIO builds. I may do an emergency tweak release of 2.2 just
to address this.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-03 16:12:15 -07:00
patlefort 2d6831a5f8 Fix pugixml linkage and some mingw build problems (#2698)
- Fix external pugixml linkage. Also remove 'BEFORE' as it is unnecessary. 
- A few fixes for cross compiling with mingw on linux.
2020-09-03 15:38:27 -07:00
Larry Gritz ce6ac37c4a Python: Direct support for 'half' using numpy.float16 type (#2694)
When transferring blocks of pixels (for example, by ImageInput.read_image
or ImageOutput.write_image), "half" pixels ended up mangled into uint16,
the only type of the right bit width.

But NumPy has a numpy.float16 type! A little bit of extra hinting to
pybind11 makes this work as users probably expect.

Fixes #2689

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-03 12:06:36 -07:00
Larry Gritz 96b9cb9e95 ffmpeg reader: avoid potential crash when frame can't be read (#2693)
Don't copy from the data pointer if it's null, that indicates an error.

Related to issue 2688, but doesn't fully solve it.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-03 10:33:33 -07:00
Larry Gritz a5cb7089c4 Fix broken TIFF reads of multi-subimage non-spectral files (#2692)
For a few rare edge cases of photometric interpretation, we fall back
on libtiff's ability to auto-translate to an RGBA image for us. It
only does this for the whole image at once, so we do it for the first
scanline we read (storing the whole image in a buffer, skipping the
conversion for subsequent scanlines -- and it can tell it's the
"first" scanline because the buffer isn't yet allocated).

The bug was that for these cases (such as a photometric YCbCr), if the
file was *multi-subimage*, we were not clearing the rgba buffer, so
upon reading the second subimage, it thought its buffer was already
filled, so it wasn't actually doing the read and convert, just using
whatever was already living in the buffer. Oops.

Also, I noticed that we should clear m_use_rgba_interface for each
subimage -- it was previously just setting it when it found those edge
cases. We never saw a symptom from this, but I realized it would be
problematic for a file where the first subimage was YCbCr and the
second subimage was regular RGB, it wouldn't know to fall back to our
usual code path.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-02 18:52:32 -07:00
Larry Gritz a4aa992e80 Stop running the "openexr-damaged" test for CI. (#2690)
It's been endless trouble, because the nature of the test is malformed
images that fail in inconsistent ways. I can never seem to make a
stable set of reference output for it, especially for OpenEXR
development master, which is always adding new fixes or tinkering with
exceptions and error messages.

So just don't run that test in the automated CI.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-02 18:52:04 -07:00
Larry Gritz f9f925bbb3 Improved error message for corrupted input (#2687)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-02 09:27:54 -07:00
Larry Gritz d58dbe7799 Update ref image after Homebrew upgraded libraw to 0.20
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-30 15:29:08 -07:00
Larry Gritz 7f4bbe6bba CHANGES
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-30 13:13:02 -07:00
Larry Gritz 05d58cf7c0 CHANGES
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-29 12:16:44 -07:00
Larry Gritz 061fd594a9 oiiotool: fix some multi-subimage bugs when outputting images (#2684)
Plain old bug in all cases:

--croptofull botched the subimage count by reserving space for results
based on the subimages in the input image, but then only producing
results for the first one if -a (or :allsubimages=1) was not used.

Output specific bugs:

There are some operations that happen ephemerally upon output, mostly
to account for output file formats that don't support some feature of
the top image (like action_croptofull if the output format doesn't
support differing display and data windows, or action_channels if
there are more channels than are supported by the format, or
action_colorconvert when --autocc is used).

In these cases, we were forgetting that those operations may tend to
drop all but the first subimages, if no -a or :allsubimages=1 is not
used.  But that's NOT the behavior we want in this case, because for
output specifically, we never want to drop subimages. This is because
we want a simple format conversion like

    oiiotool in.xyz -o out.pdq

to faithfully copy, not "narrow" to one subimage, even if some other
operations on their own will tend to drop all but the first subimage if
not instructed to preserve them all.

So the solution is that we need to add ":allsubimages=1" modifier to
these ephemerally called adjustments.
2020-08-29 12:12:17 -07:00
Larry Gritz 09cca88b1e Build system and CI touchups (#2686)
Periodic compare of analogous build scripts in OIIO & OSL and synchronize
to ensure that my current most favored idioms are in both.

The biggest change is that I split the checked_find_package into a separate
cmake file, for easier copying between projects.

Also fix some minor typos.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-28 23:15:22 -07:00
Larry Gritz bb1f88f44f Improve comments in openexr handling code
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-28 20:38:58 -07:00
Larry Gritz 177de5ece6 Support for libheif 1.8 (#2685)
HEIF is a lossy format, and it seems libheif 1.8 changed internally
in such a way that the bit-for-bit comparsions of the write-read
cycle we do in imageinout_test started failing. (Bummer on our Mac
CI, where the homebrew version of libheif updated automatically and
then started failing.)

The easy solution is that just for this test, write zeros to the image,
not 1.0 values (which were coming out 254, not the expected 255).

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-28 14:23:30 -07:00
Larry Gritz 7b60accb8a Improve missing dependency hints (#2682)
In the case of a dependency not being found, we look for
src/build-scripts/build_{package}.bash and if it exists, suggest using
it. But the scripts were all lower case, and the packages were not, so
it was often not giving the hint! Also, in some cases, the package
might be named 'TIFF' but the script was 'build_libtiff.bash'.

So now, look for a build script with the package name straight, and
also all-upper and all-lower-case versions, and "lib<lower>".

Rename build_ocio.bash to build_opencolorio.bash, because it's the one
case where the script didn't match any of those obvious
transformations.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-26 16:24:23 -07:00
Larry Gritz f403a56ac5 Use .git-blame-ignore-revs (#2683)
This new file contains the hashes of commits whose only function was
to reformat large amounts of code.

Ordinarily, this would make for confusing 'git blame' output, by
making old code written by author A appear to have a new modification
date and authorship by B, when in fact we know that B just did some
reformatting. This can make it especially hard to discern code history
after after commits that establish the use of "clang-format".

A new git feature (requiring git >= 2.23) allows pointing to a file
containing hashes of commits to be ignored by git blame:

    git blame --ignore-revs-file .git-blame-ignore-revs

To avoid having to remember this all the time, consider adding this to
your git config:

    git config blame.ignoreRevsFile .git-blame-ignore-revs

Note that git supports this feature but does not dictate the name of
the file. I'm just following the convention I'm seeing pop up in other
projects of calling it ".git-blame-ignore-revs".

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-25 23:13:26 -07:00
Larry Gritz b630256745 Enhancements to checked_find_package (#2681)
Sometimes the true minimum version of a dependency that we are able to
build against is lower than the minimum *recommended* version (perhaps
because some important feature was added in a subsequent release that
we would like to expose if available).

This patch allows checked_find_package to take two new optional
arguments: RECOMMEND_MIN is the minimum *recommended* version (but not
the true rejection minimum) and RECOMMEND_MIN_REASON is some text to
add to the error message if there is a succinct explanation for why we
recommend a higher version than the true minimum.

As an example, we will (currently) build against any OpenEXR 2.x. But
if it's not at least 2.2, we can't support DWAA and DWAB compression.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-25 23:07:53 -07:00
Larry Gritz dd62deaddf Try renaming LICENSE-THIRD-PARTY to make GitHub recognize the license properly
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-25 14:11:14 -07:00
Larry Gritz f21698ce08 Remove old and misleading Windows install instructions (#2679)
These were so out of date and unhelpful, it has to be better to
have no instructions at all. Tear it down and make room for somebody
to do it right.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-25 13:27:31 -07:00
Larry Gritz 062dcdbf54 Fix typos in comments and docs (#2678)
Ran spell checker on all the comments.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-23 13:10:49 -07:00
Larry Gritz 37117f3513 Update ref output after changes in OpenEXR 2.5/3.0 error message text
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-22 11:47:48 -07:00
Larry Gritz cc59eb654c Try to make GitHub recognize the project license
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-22 09:31:50 -07:00
Larry Gritz a965f290bd Restore missing python read_image signature (#2677)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-20 19:36:26 -07:00
Larry Gritz 8f942a9dd4 Document design flaw in Python ParamValue (#2675)
Oops, ParamValue.type ought to be a TypeDesc, just like in C++.  In
the Python binding overhaul of 2.0, it seems that I made a mistake and
unintentionally changed it to appear to Python as a string (e.g.,
'int' rather than TypeDesc('int')).

Fixing it to be the way it was originally intended would involve a
breaking change and not appropriate until such things are allowed by a
2.x -> 3.0 transition, so we'll just have to live with it.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-18 09:27:56 -07:00
Larry Gritz e75ed3ddd4 Re-enable fmt formatting helper for TypeDesc (#2670)
A previous patch removed the definition of OIIO_USE_FMT, which
inadvertently removed this helper class from the compilation stream.
2020-08-14 16:22:07 -07:00
Michael Shigorin 714aae4cbb Fix build for Elbrus 2000 architecture (2671)
https://en.wikipedia.org/wiki/Elbrus_2000

From Michael Shigorin

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-14 15:09:36 -07:00
Larry Gritz 421e3bc3fb Fix Mac CI ref output for OpenEXR 2.5.3
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-14 13:50:18 -07:00
Larry Gritz 4af1d69212 CI: Bump exr 2.5 to 2.5.3; update ref output for failure case
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-12 22:13:12 -07:00
Larry Gritz 63152e7a5d Fix CI Linux oldest test
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-12 20:59:50 -07:00
marsupialandrzulak 9274692cb5 Add llvm-11.0.0 to Makefile-bits. (#2669)
Co-authored-by: rzulak <rzulak@imageworks.com>
2020-08-12 17:37:04 -07:00
Larry Gritz 05a7a7e37c CHANGES and docs tweaks
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-11 09:43:16 -07:00
Larry Gritz 0ee92483cf 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 20:55:17 -07:00
Larry Gritz a045034243 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:51:05 -07:00
ra-mt 84c38629c3 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:51:00 -07:00
Larry Gritz a62e9d4a13 Rejigger the build dir's detail area to be in the same spot as dist (#2667)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-10 17:44:55 -07:00
Larry Gritz 742173e395 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:43:34 -07:00
Larry Gritz 81dbea5f9e bit_cast should take a reference, not a value (#2668)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-10 17:42:53 -07:00
Larry Gritz cb00167133 SPI: Mac newer compilers
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-09 16:39:24 -07:00
Larry Gritz 7ab3b5047c pybind11 version fix for CI
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-09 01:07:51 -07:00
Larry Gritz 56a4c9f868 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 01:04:19 -07:00
lmarz af796c9e6c Fix compilation error with armv7, x86 (#2660)
Fixes a compilation error, that appears on alpine linux.
 /builds/lmarz/aports/testing/openimageio/src/oiio-Release-2.1.18.0/src/libOpenImageIO/exif.cpp: In function 'void OpenImageIO_v2_1::read_exif_tag(OpenImageIO_v2_1::ImageSpec&, const TIFFDirEntry*, OpenImageIO_v2_1::cspan<unsigned char>, bool, int, std::set<unsigned int>&, const OpenImageIO_v2_1::pvt::TagMap&)':
 /builds/lmarz/aports/testing/openimageio/src/oiio-Release-2.1.18.0/src/libOpenImageIO/exif.cpp:789:20: error: comparison of integer expressions of different signedness: 'unsigned int' and 'OpenImageIO_v2_1::span<const unsigned char, -1>::index_type' {aka 'int'} [-Werror=sign-compare]
   789 |         if (offset >= buf.size()) {
       |
2020-08-07 08:56:15 -07:00
Brecht Van Lommel 6ce93a1334 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:20:00 -07:00
Biswapriyo Nath 736a52d645 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:13:10 -07:00
Larry Gritz c06a1d32a8 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:24:29 -07:00
Larry Gritz 44c2218aa6 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 11:11:12 -07:00
Larry Gritz 10b1049ba9 Fix python binding of ImageSpec.erase_attribute (#2654)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-05 10:29:52 -07:00
Larry Gritz 3c298539e0 PNG option: add "png:filter" to control PNG filter options (#2650)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-01 18:52:44 -07:00
Dustin Rodrigues ded1f0c02d fix minor typo in bug report issue template (#2652) 2020-08-01 08:38:35 -07:00
Larry Gritz bc1b634618 Branch 2.2, master is now 2.3 dev
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-31 12:31:23 -07:00
718 changed files with 109292 additions and 44555 deletions
+6 -2
View File
@@ -5,8 +5,11 @@ SpaceBeforeParens: ControlStatements
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
#AlignConsecutiveAssignments: Consecutive
#AlignConsecutiveBitFields: Consecutive
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
#AlignConsecutiveDeclarations: None
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
@@ -75,6 +78,7 @@ IncludeCategories:
Priority: 1
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
IndentExternBlock: NoIndent
IndentPPDirectives: AfterHash
IndentWidth: 4
IndentWrappedFunctionNames: false
@@ -118,7 +122,7 @@ SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
Standard: c++14
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
+38
View File
@@ -0,0 +1,38 @@
# Reformatting via clang-format (part 1) (#2059)
5e76177f6850a8d04c544dc98128bcdfe55ca40a
# clang-format stage 2: src/libutil (#2064)
1a5b7aa00dd34883a8829875ee05c55b2a1f6736
# clang-format stage 3 -- src/*.imageio/* (#2065)
22e1af2ff0caa2c9aa31c0d7a69eb7762c04302d
# clang-format of src/libtexture and src/libOpenImageIO (#2067)
400e2340cf12ae84792f9a0146426b6022474dc9
# clang-format, final-ish update (#2069)
5af338158ad47fc84e7b0d03086fece04e0e2d24
# Adjustments from clang-format update
3e106c35845715875c3b3ce7b1621cb62ea41f0d
# clang-format fixes (#2137)
e536411711367ed7309ca884ebc9de4cea4d0da0
c31816192691562e96b4ebc10dd7e5fd2e9c801b
# Minor formatting changes in ustring with new clang-format (#2574)
9e911bddf275206867643d0009f0bd7b9a20e463
9fa2a5d42465870ae370afe5e3298433b2ecb56c
# Fix broken clang-format test (#2627)
7e5b841a80ed63b38f6d343889de615ef8cc4316
# Adjustments from clang-format update with clang 8
e83809b77e4d895dbf48fb6c2b5fb914a5f8eb06
# Touch up formatting with clang-format
f701a76b745b6ddba41c77b24a1ea7e1f48ae0b4
# clang-format: Adjust alignment of line continuation backslashes (#2664)
742173e39588e07cf43cbe7b49dd22d624a48388
d8810c5365ea88e2b1bce6155b7b495c18f2f9bc
+1 -1
View File
@@ -21,7 +21,7 @@ Steps to reproduce the behavior:
A clear and concise description of what you expected to happen.
**Evidence**
Do you have error messages? (please quote exacty) Screenshots? Example
Do you have error messages? (please quote exactly) 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?
+926
View File
@@ -0,0 +1,926 @@
# Copyright 2008-present Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio
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 8 * * *"
jobs:
vfxplatform-2019:
name: "Linux VFX Platform 2019: gcc6/C++14 py2.7 boost1.66 exr2.3 ocio1.1"
runs-on: ubuntu-latest
container:
image: aswf/ci-osl:2019
env:
CXX: g++
CC: gcc
CMAKE_CXX_STANDARD: 14
USE_SIMD: sse4.2
FMT_VERSION: 6.1.2
PUGIXML_VERSION: v1.9
PYBIND11_VERSION: v2.4.2
steps:
- uses: actions/checkout@v2
- name: Prepare ccache timestamp
id: ccache_cache_keys
run: |
echo "::set-output name=date::`date -u +'%Y-%m-%dT%H:%M:%SZ'`"
- name: ccache
id: ccache
uses: actions/cache@v2
with:
path: /tmp/ccache
key: ${{ github.job }}-${{ steps.ccache_cache_keys.outputs.date }}
restore-keys: |
${{ github.job }}-
- name: Build setup
run: |
src/build-scripts/ci-startup.bash
- name: Dependencies
run: |
src/build-scripts/gh-installdeps.bash
- name: Build
run: |
src/build-scripts/ci-build.bash
- name: Testsuite
run: |
src/build-scripts/ci-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: |
build/*.cmake
build/CMake*
build/testsuite/*/*.*
!build/testsuite/oiio-images
!build/testsuite/openexr-images
!build/testsuite/fits-images
!build/testsuite/j2kp4files_v1_5
vfxplatform-2020:
name: "Linux VFX Platform 2020: gcc6/C++14 py3.7 boost1.70 exr2.4 ocio1.1"
runs-on: ubuntu-latest
container:
image: aswf/ci-osl:2020
env:
CXX: g++
CC: gcc
CMAKE_CXX_STANDARD: 14
FMT_VERSION: 7.0.1
PYBIND11_VERSION: v2.5.0
PYTHON_VERSION: 3.7
USE_SIMD: avx
WEBP_VERSION: v1.1.0
steps:
- uses: actions/checkout@v2
- name: Prepare ccache timestamp
id: ccache_cache_keys
run: |
echo "::set-output name=date::`date -u +'%Y-%m-%dT%H:%M:%SZ'`"
- name: ccache
id: ccache
uses: actions/cache@v2
with:
path: /tmp/ccache
key: ${{ github.job }}-${{ steps.ccache_cache_keys.outputs.date }}
restore-keys: |
${{ github.job }}-
- name: setup
run: |
src/build-scripts/ci-startup.bash
- name: dependencies
run: |
src/build-scripts/gh-installdeps.bash
- name: Build
run: |
src/build-scripts/ci-build.bash
- name: Testsuite
run: |
src/build-scripts/ci-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: |
build/*.cmake
build/CMake*
build/testsuite/*/*.*
!build/testsuite/oiio-images
!build/testsuite/openexr-images
!build/testsuite/fits-images
!build/testsuite/j2kp4files_v1_5
vfxplatform-2021:
name: "Linux VFX Platform 2021: gcc9/C++17 py3.7 boost1.73 exr2.5 ocio2.0 qt-5.15"
runs-on: ubuntu-latest
container:
image: aswf/ci-osl:2021
env:
CXX: g++
CC: gcc
CMAKE_CXX_STANDARD: 17
FMT_VERSION: 7.1.0
PYBIND11_VERSION: v2.7.0
PYTHON_VERSION: 3.7
USE_SIMD: avx2,f16c
WEBP_VERSION: v1.1.0
steps:
- uses: actions/checkout@v2
- name: Prepare ccache timestamp
id: ccache_cache_keys
run: |
echo "::set-output name=date::`date -u +'%Y-%m-%dT%H:%M:%SZ'`"
- name: ccache
id: ccache
uses: actions/cache@v2
with:
path: /tmp/ccache
key: ${{ github.job }}-${{ steps.ccache_cache_keys.outputs.date }}
restore-keys: |
${{ github.job }}-
- name: Build setup
run: |
src/build-scripts/ci-startup.bash
- name: Dependencies
run: |
src/build-scripts/gh-installdeps.bash
- name: Build
run: |
src/build-scripts/ci-build.bash
- name: Testsuite
run: |
src/build-scripts/ci-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: |
build/*.cmake
build/CMake*
build/testsuite/*/*.*
!build/testsuite/oiio-images
!build/testsuite/openexr-images
!build/testsuite/fits-images
!build/testsuite/j2kp4files_v1_5
vfxplatform-2022:
name: "Linux VFX Platform 2022: gcc9/C++17 py3.9 boost1.76 exr3.1 ocio2.1 qt5.15"
runs-on: ubuntu-latest
container:
image: aswf/ci-osl:2022-clang11
env:
CXX: g++
CC: gcc
CMAKE_CXX_STANDARD: 17
FMT_VERSION: 8.1.1
PYBIND11_VERSION: v2.9.0
PYTHON_VERSION: 3.9
USE_SIMD: avx2,f16c
steps:
- uses: actions/checkout@v2
- name: Prepare ccache timestamp
id: ccache_cache_keys
run: |
echo "::set-output name=date::`date -u +'%Y-%m-%dT%H:%M:%SZ'`"
- name: ccache
id: ccache
uses: actions/cache@v2
with:
path: /tmp/ccache
key: ${{ github.job }}-${{ steps.ccache_cache_keys.outputs.date }}
restore-keys: |
${{ github.job }}-
- name: Build setup
run: |
src/build-scripts/ci-startup.bash
- name: Dependencies
run: |
src/build-scripts/gh-installdeps.bash
- name: Build
run: |
src/build-scripts/ci-build.bash
- name: Testsuite
run: |
src/build-scripts/ci-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: |
build/*.cmake
build/CMake*
build/testsuite/*/*.*
!build/testsuite/oiio-images
!build/testsuite/openexr-images
!build/testsuite/fits-images
!build/testsuite/j2kp4files_v1_5
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
env:
CXX: g++-7
CMAKE_CXX_STANDARD: 14
USE_SIMD: sse4.2
OPENEXR_VERSION: v2.4.3
PYBIND11_VERSION: v2.6.2
CMAKE_BUILD_TYPE: Debug
steps:
- uses: actions/checkout@v2
- name: Prepare ccache timestamp
id: ccache_cache_keys
run: |
echo "::set-output name=date::`date -u +'%Y-%m-%dT%H:%M:%SZ'`"
- name: ccache
id: ccache
uses: actions/cache@v2
with:
path: /tmp/ccache
key: ${{ github.job }}-${{ steps.ccache_cache_keys.outputs.date }}
restore-keys: |
${{ github.job }}-
- name: Build setup
run: |
src/build-scripts/ci-startup.bash
- name: Dependencies
run: |
src/build-scripts/gh-installdeps.bash
- name: Build
run: |
src/build-scripts/ci-build.bash
- name: Testsuite
run: |
src/build-scripts/ci-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: |
build/*.cmake
build/CMake*
build/testsuite/*/*.*
!build/testsuite/oiio-images
!build/testsuite/openexr-images
!build/testsuite/fits-images
!build/testsuite/j2kp4files_v1_5
linux-gcc8:
# Test against gcc8.
name: "Linux gcc8: gcc8 C++17 avx exr2.5"
runs-on: ubuntu-18.04
env:
CXX: g++-8
CMAKE_CXX_STANDARD: 17
USE_SIMD: avx
OPENEXR_VERSION: v2.5.6
PYBIND11_VERSION: v2.5.0
steps:
- uses: actions/checkout@v2
- name: Prepare ccache timestamp
id: ccache_cache_keys
run: |
echo "::set-output name=date::`date -u +'%Y-%m-%dT%H:%M:%SZ'`"
- name: ccache
id: ccache
uses: actions/cache@v2
with:
path: /tmp/ccache
key: ${{ github.job }}-${{ steps.ccache_cache_keys.outputs.date }}
restore-keys: |
${{ github.job }}-
- name: Build setup
run: |
src/build-scripts/ci-startup.bash
- name: Dependencies
run: |
src/build-scripts/gh-installdeps.bash
- name: Build
run: |
src/build-scripts/ci-build.bash
- name: Testsuite
run: |
src/build-scripts/ci-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: |
build/*.cmake
build/CMake*
build/testsuite/*/*.*
!build/testsuite/oiio-images
!build/testsuite/openexr-images
!build/testsuite/fits-images
!build/testsuite/j2kp4files_v1_5
linux-latest-releases:
# Test against latest supported releases of toolchain and dependencies.
name: "Linux latest releases: gcc10 C++17 avx2 exr3.1 ocio2.1"
runs-on: ubuntu-20.04
env:
CXX: g++-10
CMAKE_CXX_STANDARD: 17
USE_SIMD: avx2,f16c
FMT_VERSION: 8.1.1
LIBRAW_VERSION: 0.20.2
LIBTIFF_VERSION: v4.3.0
OPENCOLORIO_VERSION: v2.1.1
OPENEXR_VERSION: v3.1.4
OPENJPEG_VERSION: v2.4.0
PUGIXML_VERSION: v1.11.4
PTEX_VERSION: v2.4.0
PYBIND11_VERSION: v2.9.0
PYTHON_VERSION: 3.8
WEBP_VERSION: v1.2.1
OPENIMAGEIO_OPTIONS: "openexr:core=1"
USE_OPENVDB: 0
# The old installed OpenVDB has a TLS conflict with Python 3.8
steps:
- uses: actions/checkout@v2
- name: Prepare ccache timestamp
id: ccache_cache_keys
run: |
echo "::set-output name=date::`date -u +'%Y-%m-%dT%H:%M:%SZ'`"
- name: ccache
id: ccache
uses: actions/cache@v2
with:
path: /tmp/ccache
key: ${{ github.job }}-${{ steps.ccache_cache_keys.outputs.date }}
restore-keys: |
${{ github.job }}-
- name: Build setup
run: |
src/build-scripts/ci-startup.bash
- name: Dependencies
run: |
src/build-scripts/gh-installdeps.bash
- name: Build
run: |
src/build-scripts/ci-build.bash
- name: Testsuite
run: |
src/build-scripts/ci-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: |
build/*.cmake
build/CMake*
build/testsuite/*/*.*
!build/testsuite/oiio-images
!build/testsuite/openexr-images
!build/testsuite/fits-images
!build/testsuite/j2kp4files_v1_5
linux-bleeding-edge:
# Test against development master for relevant dependencies, latest
# supported releases of everything else.
name: "Linux bleeding edge: gcc11 C++20 py38 OCIO/libtiff/exr-master boost1.71 avx2"
runs-on: ubuntu-20.04
env:
CXX: g++-11
CMAKE_CXX_STANDARD: 20
USE_SIMD: avx2,f16c
FMT_VERSION: master
LIBRAW_VERSION: master
LIBTIFF_VERSION: master
OPENCOLORIO_VERSION: main
OPENEXR_VERSION: main
OPENJPEG_VERSION: master
PUGIXML_VERSION: master
PTEX_VERSION: main
PYBIND11_VERSION: master
PYTHON_VERSION: 3.8
WEBP_VERSION: master
OPENIMAGEIO_OPTIONS: "openexr:core=1"
USE_OPENVDB: 0
# The old installed OpenVDB has a TLS conflict with Python 3.8
steps:
- uses: actions/checkout@v2
- name: Prepare ccache timestamp
id: ccache_cache_keys
run: |
echo "::set-output name=date::`date -u +'%Y-%m-%dT%H:%M:%SZ'`"
- name: CCache
id: ccache
if: always()
uses: actions/cache@v2
with:
path: /tmp/ccache
key: ${{ github.job }}-${{ steps.ccache_cache_keys.outputs.date }}
restore-keys: |
${{ github.job }}-
- name: Build setup
run: |
src/build-scripts/ci-startup.bash
- name: Dependencies
run: |
src/build-scripts/gh-installdeps.bash
- name: Build
run: |
src/build-scripts/ci-build.bash
- name: Testsuite
run: |
src/build-scripts/ci-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: |
build/*.cmake
build/CMake*
build/testsuite/*/*.*
!build/testsuite/oiio-images
!build/testsuite/openexr-images
!build/testsuite/fits-images
!build/testsuite/j2kp4files_v1_5
linux-oldest:
# Oldest versions of the dependencies that we can muster, and various
# things disabled (no SSE, OCIO, or OpenCV, don't embed plugins).
name: "Linux oldest/hobbled: gcc6.3/C++14 py2.7 boost-1.66 exr-2.3 no-sse no-ocio"
runs-on: ubuntu-latest
container:
image: aswf/ci-osl:2019
env:
CMAKE_CXX_STANDARD: 14
USE_SIMD: 0
USE_JPEGTURBO: 0
USE_OPENCOLORIO: 0
USE_OPENCV: 0
EMBEDPLUGINS: 0
FMT_VERSION: 6.1.2
OPENEXR_VERSION: v2.3.0
PTEX_VERSION: v2.3.1
PYBIND11_VERSION: v2.4.2
WEBP_VERSION: v1.0.0
steps:
- uses: actions/checkout@v2
- name: Prepare ccache timestamp
id: ccache_cache_keys
run: |
echo "::set-output name=date::`date -u +'%Y-%m-%dT%H:%M:%SZ'`"
- name: ccache
id: ccache
uses: actions/cache@v2
with:
path: /tmp/ccache
key: ${{ github.job }}-${{ steps.ccache_cache_keys.outputs.date }}
restore-keys: |
${{ github.job }}-
- name: Build setup
run: |
src/build-scripts/ci-startup.bash
- name: Dependencies
run: |
sudo rm -rf /usr/local/include/OpenEXR
src/build-scripts/gh-installdeps.bash
- name: Build
run: |
src/build-scripts/ci-build.bash
- name: Testsuite
run: |
src/build-scripts/ci-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: |
build/*.cmake
build/CMake*
build/testsuite/*/*.*
!build/testsuite/oiio-images
!build/testsuite/openexr-images
!build/testsuite/fits-images
!build/testsuite/j2kp4files_v1_5
macos10-py38:
name: "MacOS-10.15 appleclang12/C++14 py38 boost1.76 exr3.1 ocio2.1"
runs-on: macos-10.15
env:
CXX: clang++
PYTHON_VERSION: 3.8
CMAKE_CXX_STANDARD: 14
steps:
- uses: actions/checkout@v2
- name: Prepare ccache timestamp
id: ccache_cache_keys
run: |
echo "::set-output name=date::`date -u +'%Y-%m-%dT%H:%M:%SZ'`"
- name: ccache
id: ccache
uses: actions/cache@v2
with:
path: /Users/runner/.ccache
key: ${{ github.job }}-${{ steps.ccache_cache_keys.outputs.date }}
restore-keys: |
${{ github.job }}-
- name: Build setup
run: |
src/build-scripts/ci-startup.bash
- name: Dependencies
run: |
src/build-scripts/install_homebrew_deps.bash
src/build-scripts/install_test_images.bash
- name: Build
run: |
export PYTHONPATH=/usr/local/lib/python${PYTHON_VERSION}/site-packages:$PYTHONPATH
src/build-scripts/ci-build.bash
- name: Testsuite
run: |
src/build-scripts/ci-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: |
build/*.cmake
build/CMake*
build/testsuite/*/*.*
!build/testsuite/oiio-images
!build/testsuite/openexr-images
!build/testsuite/fits-images
!build/testsuite/j2kp4files_v1_5
macos11-py38:
name: "MacOS-11 appleclang13/C++17 py39 boost1.76 exr3.1 ocio2.1"
runs-on: macos-11
env:
CXX: clang++
PYTHON_VERSION: 3.9
CMAKE_CXX_STANDARD: 17
steps:
- uses: actions/checkout@v2
- name: Prepare ccache timestamp
id: ccache_cache_keys
run: |
echo "::set-output name=date::`date -u +'%Y-%m-%dT%H:%M:%SZ'`"
- name: ccache
id: ccache
uses: actions/cache@v2
with:
path: /Users/runner/.ccache
key: ${{ github.job }}-${{ steps.ccache_cache_keys.outputs.date }}
restore-keys: |
${{ github.job }}-
- name: Build setup
run: |
src/build-scripts/ci-startup.bash
- name: Dependencies
run: |
src/build-scripts/install_homebrew_deps.bash
src/build-scripts/install_test_images.bash
- name: Build
run: |
export PYTHONPATH=/usr/local/lib/python${PYTHON_VERSION}/site-packages:$PYTHONPATH
src/build-scripts/ci-build.bash
- name: Testsuite
run: |
src/build-scripts/ci-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: |
build/*.cmake
build/CMake*
build/testsuite/*/*.*
!build/testsuite/oiio-images
!build/testsuite/openexr-images
!build/testsuite/fits-images
!build/testsuite/j2kp4files_v1_5
windows-vs2019:
name: "Windows VS2019"
runs-on: windows-2019
env:
PYTHON_VERSION: 3.7
CMAKE_GENERATOR: "Visual Studio 16 2019"
OPENEXR_VERSION: v2.5.6
USE_SIMD: sse4.2
CTEST_ARGS: "--timeout 120 --repeat after-timeout:6"
steps:
- uses: actions/checkout@v2
- name: Setup Nuget.exe
uses: nuget/setup-nuget@v1
- name: Build setup
shell: bash
run: |
src/build-scripts/ci-startup.bash
- name: Dependencies
shell: bash
run: |
src/build-scripts/gh-win-installdeps.bash
- name: Build
shell: bash
run: |
src/build-scripts/ci-build.bash
- name: Testsuite
shell: bash
run: |
src/build-scripts/ci-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: |
build/*.cmake
build/CMake*
build/testsuite/*/*.*
!build/testsuite/oiio-images
!build/testsuite/openexr-images
!build/testsuite/fits-images
!build/testsuite/j2kp4files_v1_5
windows-vs2017:
name: "Windows VS2017"
runs-on: windows-2016
env:
PYTHON_VERSION: 3.7
CMAKE_GENERATOR: "Visual Studio 15 2017 Win64"
OPENEXR_VERSION: v2.5.6
CTEST_ARGS: "--timeout 120 --repeat after-timeout:6"
steps:
- uses: actions/checkout@v2
- name: Setup Nuget.exe
uses: nuget/setup-nuget@v1
- name: Build setup
shell: bash
run: |
src/build-scripts/ci-startup.bash
- name: Dependencies
shell: bash
run: |
src/build-scripts/gh-win-installdeps.bash
- name: Build
shell: bash
run: |
src/build-scripts/ci-build.bash
- name: Testsuite
shell: bash
run: |
src/build-scripts/ci-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: |
build/*.cmake
build/CMake*
build/testsuite/*/*.*
!build/testsuite/oiio-images
!build/testsuite/openexr-images
!build/testsuite/fits-images
!build/testsuite/j2kp4files_v1_5
sanitizer:
# Run sanitizers.
name: "Sanitizers"
runs-on: ubuntu-18.04
container:
image: aswf/ci-osl:2020
env:
CXX: g++
CC: gcc
CMAKE_CXX_STANDARD: 14
PYTHON_VERSION: 3.7
USE_PYTHON: 0
SANITIZE: address
steps:
- uses: actions/checkout@v2
- name: Prepare ccache timestamp
id: ccache_cache_keys
run: |
echo "::set-output name=date::`date -u +'%Y-%m-%dT%H:%M:%SZ'`"
- name: ccache
id: ccache
uses: actions/cache@v2
with:
path: /tmp/ccache
key: ${{ github.job }}-${{ steps.ccache_cache_keys.outputs.date }}
restore-keys: |
${{ github.job }}-
- name: Build setup
run: |
src/build-scripts/ci-startup.bash
- name: Dependencies
run: |
src/build-scripts/gh-installdeps.bash
- name: Build
run: |
src/build-scripts/ci-build.bash
- name: Testsuite
run: |
src/build-scripts/ci-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: |
build/*.cmake
build/CMake*
build/testsuite/*/*.*
!build/testsuite/oiio-images
!build/testsuite/openexr-images
!build/testsuite/fits-images
!build/testsuite/j2kp4files_v1_5
linux-clang10-cpp14:
# Test compiling with clang on Linux.
name: "Linux clang10: clang10 C++14 avx2 exr2.5 ocio2.0"
runs-on: ubuntu-18.04
container:
image: aswf/ci-osl:2021-clang10
env:
CXX: clang++
CMAKE_CXX_STANDARD: 14
PYTHON_VERSION: 3.7
USE_SIMD: avx2,f16c
PYBIND11_VERSION: v2.6.2
steps:
- uses: actions/checkout@v2
- name: Prepare ccache timestamp
id: ccache_cache_keys
run: |
echo "::set-output name=date::`date -u +'%Y-%m-%dT%H:%M:%SZ'`"
- name: ccache
id: ccache
uses: actions/cache@v2
with:
path: /tmp/ccache
key: ${{ github.job }}-${{ steps.ccache_cache_keys.outputs.date }}
restore-keys: |
${{ github.job }}-
- name: Build setup
run: |
src/build-scripts/ci-startup.bash
- name: Dependencies
run: |
src/build-scripts/gh-installdeps.bash
- name: Build
run: |
src/build-scripts/ci-build.bash
- name: Testsuite
run: |
src/build-scripts/ci-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: |
build/*.cmake
build/CMake*
build/testsuite/*/*.*
!build/testsuite/oiio-images
!build/testsuite/openexr-images
!build/testsuite/fits-images
!build/testsuite/j2kp4files_v1_5
linux-clang13-cpp17:
# Test compiling with clang and C++17 on Linux.
name: "Linux clang13: clang13 C++17 py39 avx2 exr3.1 ocio2.0"
runs-on: ubuntu-18.04
container:
image: aswf/ci-osl:2022-clang13
env:
CXX: clang++
CMAKE_CXX_STANDARD: 17
PYBIND11_VERSION: v2.8.1
PYTHON_VERSION: 3.9
USE_SIMD: avx2,f16c
steps:
- uses: actions/checkout@v2
- name: Prepare ccache timestamp
id: ccache_cache_keys
run: |
echo "::set-output name=date::`date -u +'%Y-%m-%dT%H:%M:%SZ'`"
- name: ccache
id: ccache
uses: actions/cache@v2
with:
path: /tmp/ccache
key: ${{ github.job }}-${{ steps.ccache_cache_keys.outputs.date }}
restore-keys: |
${{ github.job }}-
- name: Build setup
run: |
src/build-scripts/ci-startup.bash
- name: Dependencies
run: |
src/build-scripts/gh-installdeps.bash
- name: Build
run: |
src/build-scripts/ci-build.bash
- name: Testsuite
run: |
src/build-scripts/ci-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: |
build/*.cmake
build/CMake*
build/testsuite/*/*.*
!build/testsuite/oiio-images
!build/testsuite/openexr-images
!build/testsuite/fits-images
!build/testsuite/j2kp4files_v1_5
linux-static:
# Test building static libs.
name: "Linux static libs: gcc7 C++14 exr2.4"
runs-on: ubuntu-18.04
env:
CXX: g++-7
CMAKE_CXX_STANDARD: 14
BUILD_SHARED_LIBS: OFF
OPENEXR_VERSION: v2.4.3
PYBIND11_VERSION: v2.6.2
steps:
- uses: actions/checkout@v2
- name: Prepare ccache timestamp
id: ccache_cache_keys
run: |
echo "::set-output name=date::`date -u +'%Y-%m-%dT%H:%M:%SZ'`"
- name: ccache
id: ccache
uses: actions/cache@v2
with:
path: /tmp/ccache
key: ${{ github.job }}-${{ steps.ccache_cache_keys.outputs.date }}
restore-keys: |
${{ github.job }}-
- name: Build setup
run: |
src/build-scripts/ci-startup.bash
- name: Dependencies
run: |
sudo rm -rf /usr/local/include/OpenEXR
sudo rm -rf /usr/local/lib64/cmake/{IlmBase,OpenEXR}
src/build-scripts/gh-installdeps.bash
- name: Build
run: |
src/build-scripts/ci-build.bash
- name: Testsuite
run: |
src/build-scripts/ci-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: |
build/*.cmake
build/CMake*
build/testsuite/*/*.*
!build/testsuite/oiio-images
!build/testsuite/openexr-images
!build/testsuite/fits-images
!build/testsuite/j2kp4files_v1_5
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:2022-clang12
env:
BUILDTARGET: clang-format
PYTHON_VERSION: 3.9
steps:
- uses: actions/checkout@v2
- name: Build setup
run: |
src/build-scripts/ci-startup.bash
- name: Dependencies
run: |
src/build-scripts/gh-installdeps.bash
- name: Build
run: |
src/build-scripts/ci-build.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: src/*/*.{cpp,h}
-434
View File
@@ -1,434 +0,0 @@
# 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_BRANCH: 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_BRANCH: 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_BRANCH: v2.5.0
PYBIND11_VERSION: 2.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_BRANCH: master
OCIO_BRANCH: master
LIBTIFF_BRANCH: master
PYBIND11_BRANCH: 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_BRANCH: 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_BRANCH: 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_BRANCH: 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_BRANCH: 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}
+12 -1
View File
@@ -1,10 +1,21 @@
*~
*.bak
branches/
build/
dist/
ext/
testsuite/runtest.pyc
.idea
.vscode
.cproject
.project
.DS_Store
*.pyc
# Exclude test files I tend to leave around at the top level. The leading
# slash ensures that files with these extensions within subdirectories are not
# ignored.
/*.exr
/*.tif
/*.jpg
/*.tx
/*.log
+1 -1
View File
@@ -12,7 +12,7 @@ sphinx:
# Optionally build your docs in additional formats such as PDF and ePub
formats:
- pdf
- htmlzip
# Optionally set the version of Python and requirements required to build your docs
python:
-202
View File
@@ -1,202 +0,0 @@
# 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
osx_image: xcode10
dist: xenial
# Add-ons: specify apt packages for Linux
# We actaully specify packages per-matrix-entry, so these don't do anything
# except to tag them (&add-sources, &common-packages, &common-boost-packages)
# so they can be referened later ('*') to save repetition.
addons:
apt:
sources: &add-sources
- ubuntu-toolchain-r-test
packages: &common-packages
- libilmbase-dev
- libopenexr-dev
- libopencolorio-dev
- libgif-dev
- libopenjpeg-dev
- libwebp-dev
- libfreetype6-dev
- libjpeg-turbo8-dev
- dcmtk
- locales
- python-numpy
- libraw-dev
- ninja-build
# - qtbase5-dev # FIXME: enable Qt5 on Linux
# - bzip2
# - libtinyxml-dev
# - liblcms2-dev
# - libyaml-cpp-dev
packages: &common-boost-packages
- libboost1.58-dev
- libboost-filesystem1.58
- 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
apt: true
directories:
- $HOME/.ccache
- $PWD/oiio-images
- $PWD/libtiffpic
before_install:
- source src/build-scripts/ci-startup.bash
- export WHICHGCC=${WHICHGCC:="4.8"}
- if [ "$CXX" == "g++" ]; then export CXX="g++-${WHICHGCC}" ; fi
install:
- 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:
- 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
branches:
only:
- master
- /RB-/
- /lg-/
jobs:
fast_finish: true
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 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
# 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
# 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
# guess this should/could be both platforms, but in the interest of
# making the tests go faster, don't bother doing it on OSX.
# 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_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
# 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
# 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.
# - name: "Static analysis / clang-tidy"
# os: linux
# compiler: gcc
# env: CLANG_TIDY=1 CLANG_TIDY_FIX=1 SKIP_TESTS=1
# if: branch =~ /(master|RB|travis|tidy)/ OR type = pull_request
# Build with EMBEDPLUGINS=0, both platforms.
# FIXME: doesn't work yet on Travis
# - os: linux
# compiler: gcc
# env: EMBEDPLUGINS=0
# FIXME: don't have OSX EMBEDPLUGINS=0 working yet on Travis (though
# it works fine on my laptop).
# - os: osx
# compiler: clang
# env: EMBEDPLUGINS=0
notifications:
email:
recipients:
- lg@openimageio.org
on_success: change
on_failure: always
+1683 -65
View File
File diff suppressed because it is too large Load Diff
+60 -268
View File
@@ -1,18 +1,34 @@
# Copyright 2008-present Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
# https://github.com/OpenImageIO/oiio
cmake_minimum_required (VERSION 3.12)
project (OpenImageIO VERSION 2.2.4.0
project (OpenImageIO VERSION 2.4.0.4
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
string (TOUPPER ${PROJ_NAME} PROJ_NAME_UPPER) # short name upper case
set (PROJECT_VERSION_RELEASE_TYPE "dev") # "dev", "betaX", "RCY", ""
set (PROJECT_VERSION_RELEASE_TYPE "dev" CACHE STRING
"Build type, for example: dev, beta2, RC1 (empty string for normal release)")
set (${PROJECT_NAME}_VERSION_RELEASE_TYPE ${PROJECT_VERSION_RELEASE_TYPE})
set (PROJECT_AUTHORS "Contributors to the OpenImageIO project")
set (${PROJECT_NAME}_SUPPORTED_RELEASE 0) # Change to 1 after release branch
option (${PROJECT_NAME}_SUPPORTED_RELEASE
"Set ON for supported release branch, OFF for master" OFF)
if (${PROJECT_NAME}_SUPPORTED_RELEASE)
set (${PROJECT_NAME}_DEV_RELEASE OFF)
else ()
set (${PROJECT_NAME}_DEV_RELEASE ON)
endif ()
# Set PROJECT_IS_TOP_LEVEL to ON if if this is the top level project (not
# if this is included as a subproject of something else). Note that this is
# handled automatically for CMake >= 3.21.
if (CMAKE_VERSION VERSION_LESS 3.21)
if ("${CMAKE_PROJECT_NAME}" STREQUAL "${PROJECT_NAME}")
set (PROJECT_IS_TOP_LEVEL ON)
endif ()
endif ()
# If the user wants to use Conan to build dependencies, they will have done
# this prior to the cmake config:
@@ -25,13 +41,19 @@ if (EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
endif()
message (STATUS "Building ${PROJECT_NAME} ${PROJECT_VERSION}")
message (STATUS "CMake version is ${CMAKE_VERSION}")
if (NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE "Release")
endif ()
# If the user hasn't configured cmake with an explicit
# -DCMAKE_INSTALL_PREFIX=..., then set it to safely install into ./dist, to
# help prevent the user from accidentally writing over /usr/local or whatever.
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT
AND PROJECT_IS_TOP_LEVEL)
set (CMAKE_INSTALL_PREFIX "${PROJECT_SOURCE_DIR}/dist" CACHE PATH
"Installation location" FORCE)
endif()
message (STATUS "Configuring ${PROJECT_NAME} ${PROJECT_VERSION}")
message (STATUS "CMake ${CMAKE_VERSION}")
message (STATUS "CMake system = ${CMAKE_SYSTEM}")
@@ -67,14 +89,10 @@ option (BUILD_OIIOUTIL_ONLY "If ON, will build *only* libOpenImageIO_Util" OFF)
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 PATH
"Location of oiio-images, openexr-images, libtiffpic, etc.." )
set (CMAKE_DEBUG_POSTFIX "_d" CACHE STRING "Library naming postfix for Debug builds")
option (OIIO_THREAD_ALLOW_DCLP "OIIO threads may use DCLP for speed" ON)
if (NOT OIIO_THREAD_ALLOW_DCLP)
@@ -89,10 +107,11 @@ 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)
option (${PROJ_NAME}_NAMESPACE_INCLUDE_PATCH
"Should the inner namespace include the patch number" ${${PROJECT_NAME}_DEV_RELEASE})
set (PROJ_NAMESPACE "${${PROJ_NAME}_NAMESPACE}")
set (PROJ_NAMESPACE_V "${PROJ_NAMESPACE}_v${PROJECT_VERSION_MAJOR}_${PROJECT_VERSION_MINOR}")
if (OIIO_NAMESPACE_INCLUDE_PATCH)
if (${PROJ_NAME}_NAMESPACE_INCLUDE_PATCH)
set (PROJ_NAMESPACE_V "${PROJ_NAMESPACE_V}_${PROJECT_VERSION_PATCH}")
endif ()
message(STATUS "Setting Namespace to: ${PROJ_NAMESPACE_V}")
@@ -104,23 +123,31 @@ list (APPEND CMAKE_MODULE_PATH
include (GNUInstallDirs)
# Utilities
include (colors)
include (check_is_enabled)
include (checked_find_package)
include (fancy_add_executable)
include (add_oiio_plugin)
# All the C++ and compiler related options and adjustments live here
# All the C++ and compiler related options and adjustments
include (compiler)
include (oiio_macros)
# All the dependency finding and options are here
include (externalpackages)
# Utilities related to finding python and making python bindings
# Utilities and options 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)
# Dependency finding utilities and all dependency-related options
include (externalpackages)
# Include all our testing apparatus and utils, but not if it's a subproject
if (PROJECT_IS_TOP_LEVEL)
include (testing)
else ()
macro (oiio_add_tests)
endmacro ()
macro (oiio_add_all_tests)
endmacro ()
endif ()
include_directories (
@@ -128,6 +155,7 @@ include_directories (
"${CMAKE_SOURCE_DIR}/src/include"
"${CMAKE_BINARY_DIR}/src/include"
"${CMAKE_BINARY_DIR}/include"
"${CMAKE_BINARY_DIR}/include/OpenImageIO"
)
# Tell CMake to process the sub-directories
@@ -183,7 +211,7 @@ if (NOT EMBEDPLUGINS AND NOT BUILD_OIIOUTIL_ONLY)
endforeach ()
endif ()
if (USE_PYTHON AND NOT BUILD_OIIOUTIL_ONLY)
if (USE_PYTHON AND Python_Development_FOUND AND NOT BUILD_OIIOUTIL_ONLY)
add_subdirectory (src/python)
endif ()
@@ -204,17 +232,12 @@ if (OIIO_SITE AND EXISTS "${PROJECT_SOURCE_DIR}/site/${OIIO_SITE}/cmake/sitecust
endif ()
# install pkgconfig file
IF ( NOT MSVC )
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)
ENDIF()
# Oddball: install the FindOpenImageIO.cmake file
install (FILES src/cmake/modules/FindOpenImageIO.cmake
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/Modules
COMPONENT cmake)
endif()
# Export the configuration files. There are also library-specific config
# exports in the CMakeLists.txt of libOpenImageIO.
@@ -256,242 +279,11 @@ install (EXPORT OIIO_EXPORTED_TARGETS
NAMESPACE ${PROJECT_NAME}::)
#########################################################################
# Testing
#
# Just call oiio_add_tests(testname...) for each test. Additional
# optional arguments include:
# FOUNDVAR specifies the name of a CMAKE variable; if not defined,
# the test will not be added for 'make test' (helpful
# for excluding tests for libraries not found).
# IMAGEDIR specifies a directory for test images, one level higher
# than where the oiio top level source lives -- a
# message will be printed if not found.
# URL URL where the test images can be found, will be
# incorporated into the error message if the test
# image directory is not found.
# LABEL If set to "broken", will designate the test as one
# that is known to be broken, so will only be run
# for "make testall", but not "make test".
#
# 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_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_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" )
# Tests that require oiio-images:
oiio_add_tests (gpsread
oiiotool oiiotool-attribs oiiotool-copy
oiiotool-readerror oiiotool-xform
oiiotool-fixnan ## maketx & oiiotool-maketx depend on this
maketx oiiotool-maketx
misnamed-file
missingcolor
texture-interp-bicubic
texture-blurtube
texture-crop texture-cropover
texture-derivs texture-fill texture-filtersize
texture-flipt texture-gettexels texture-gray
texture-mip-nomip texture-mip-trilinear
texture-overscan texture-pointsample
texture-uint8
texture-width0blur
texture-fat texture-skinny texture-wrapfill
texture-missing texture-res texture-maxres
texture-udim texture-udim2
IMAGEDIR oiio-images URL "Recent checkout of oiio-images"
)
# Remaining freestanding tests:
oiio_add_tests (nonwhole-tiles
oiiotool-composite
oiiotool-pattern
oiiotool-subimage oiiotool-text
diff
dither dup-channels
jpeg-corrupt
null
rational
)
# Travis + old libjpeg seems to not catch an error in this test, skip it
# for that case.
if (JPEG_TURBO_FOUND OR NOT DEFINED ENV{TRAVIS})
oiio_add_tests (jpeg-corrupt-header)
endif()
# Add tests that require the Python bindings if we built the Python
# bindings. This is mostly the test that are specifically about testing
# the Python bindings themselves, but also a handful of tests that are
# mainly about other things but happen to use Python in order to perform
# thee test.
# 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 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
)
if (PROJECT_IS_TOP_LEVEL AND BUILD_TESTING)
oiio_setup_test_data()
oiio_add_all_tests()
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
)
if (PROJECT_IS_TOP_LEVEL)
include (packaging)
endif ()
if (NOT DEFINED ENV{TRAVIS} AND NOT DEFINED ENV{CIRCLECI} AND NOT DEFINED ENV{GITHUB_ACTIONS})
oiio_add_tests (texture-icwrite)
endif ()
# 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
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
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 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 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
FOUNDVAR SPI_TESTS
IMAGEDIR spi-oiio-tests
URL "noplace -- it's SPI specific tests")
endif ()
#########################################################################
# Packaging
set (CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set (CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set (CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
# "Vendor" is only used in copyright notices, so we use the same thing that
# the rest of the copyright notices say.
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}-${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")
file (RENAME "${CMAKE_BINARY_DIR}/cpack/LICENSE.md" "${CMAKE_BINARY_DIR}/cpack/License.txt")
set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_BINARY_DIR}/cpack/License.txt")
file (COPY "${PROJECT_SOURCE_DIR}/README.md" DESTINATION "${CMAKE_BINARY_DIR}/cpack")
set (CPACK_RESOURCE_FILE_README "${CMAKE_BINARY_DIR}/cpack/README.md")
set (CPACK_RESOURCE_FILE_WELCOME "${PROJECT_SOURCE_DIR}/src/doc/Welcome.txt")
#SET (CPACK_STRIP_FILES Do we need this?)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set (CPACK_GENERATOR "TGZ;STGZ;RPM;DEB")
set (CPACK_SOURCE_GENERATOR "TGZ")
endif ()
if (APPLE)
set (CPACK_GENERATOR "TGZ;STGZ;PackageMaker")
set (CPACK_SOURCE_GENERATOR "TGZ")
endif ()
if (WIN32)
set (CPACK_GENERATOR "NSIS")
set(CPACK_PACKAGE_EXECUTABLES "iv" "iv - Image Viewer")
# set(CPACK_CREATE_DESCTOP_LINKS "iv" "iv - Image Viewer")
set(CPACK_NSIS_MODIFY_PATH ON)
include (InstallRequiredSystemLibraries)
endif ()
set (CPACK_SOURCE_PACKAGE_FILE_NAME ${PROJECT_NAME}-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}-source)
#set (CPACK_SOURCE_STRIP_FILES Do we need this?)
set (CPACK_SOURCE_IGNORE_FILES ".*~")
set (CPACK_COMPONENT_UNSPECIFIED_HIDDEN TRUE)
set (CPACK_COMPONENT_UNSPECIFIED_REQUIRED TRUE)
set (CPACK_COMPONENTS_ALL user developer documentation Unspecified)
set (CPACK_COMPONENT_USER_DISPLAY_NAME "Applications")
set (CPACK_COMPONENT_DEVELOPER_DISPLAY_NAME "Developer files")
set (CPACK_COMPONENT_DOCUMENTATION_DISPLAY_NAME "Documentation")
set (CPACK_COMPONENT_USER_DESCRIPTION
"Applications: oiotool, iv, iinfo, iconvert, idiff, igrep, maketx and libraries")
set (CPACK_COMPONENT_DEVELOPER_DESCRIPTION "Include files")
set (CPACK_COMPONENT_DOCUMENTATION_DESCRIPTION "OpenImageIO documentation")
set (CPACK_COMPONENT_DEVELOPER_DEPENDS user)
include (CPack)
+8 -10
View File
@@ -111,13 +111,11 @@ component that deserves extended discussion or debate among the wider OIIO
community, then it may be prudent to email oiio-dev pointing everybody to
the pull request URL and discussing any issues you think are important.
6. All pull requests automatically launch jobs on [TravisCI](https://travis-ci.org)
for Linux and MacOS and on [Appveyor](http://appveyor.com) for Windows.
This ensures that the build completes and that the tests suite runs
correctly, for a varity of platform, compiler, library, and flag combinations.
The status of the CI tests for your PR will be displayed on the GitHub PR
page. We will not accept PRs that don't build cleanly or pass the existing
testsuite.
6. All pull requests automatically launch CI jobs on GitHub Actions to
ensure that the build completes and that the tests suite runs correctly, for
a varity of platform, compiler, library, and flag combinations. The status
of the CI tests for your PR will be displayed on the GitHub PR page. We will
not accept PRs that don't build cleanly or pass the existing testsuite.
7. The reviewer will look over the code and critique on the "comments" area.
Reviewers may ask for changes, explain problems they found, congratulate the
@@ -145,7 +143,7 @@ and it will automatically reformat your code according to the configuration
file found in the `.clang-format` file at the root directory of the OIIO
source code checkout.
One of the TravisCI test matrix entries runs clang-format and fails if any
One of the CI test matrix entries runs clang-format and fails if any
diffs were generated (that is, if any of your code did not 100% conform to
the `.clang-format` formatting configuration). If it fails, clicking on that
test log will show you the diffs generated, so that you can easily correct
@@ -153,9 +151,9 @@ it on your end and update the PR with the formatting fixes.
If you don't have clang-format set up on your machine, and your patch is not
very long, you may find that it's more convenient to just submit it and hope
for the best, and if it doesn't pass the Travis test, look at the diffs in
for the best, and if it doesn't pass the CI test, look at the diffs in
the log and make the corrections by hand and then submit an update to the
patch (i.e. relying on Travis to run clang-format for you).
patch (i.e. relying on CI to run clang-format for you).
Because the basic formatting is automated by clang-format, we won't
enumerate the rules here.
+32 -5
View File
@@ -4,6 +4,7 @@ by first name.
If you know of somebody that I missed or have corrections, please email:
lg@openimageio.org
* Adam Mains
* Akihiro Yamasaki
* Alan Jones
* Alejandro Conty
@@ -14,25 +15,34 @@ lg@openimageio.org
* Alexandre Gauthier
* Alexis Oblet
* Alexy Pawlow
* Alister Chowdhury
* Aman Shah
* Ananth Garre
* Anders Langlands
* Arkady Shapkin
* Basileios Anastasatos
* Bastien Montagne
* Ben De Luca
* Biswapriyo Nath
* Blair Tennessy
* Blazej Floch
* Brad Smith
* Brecht Van Lommel
* Brent Davis
* Brian Hall
* Brice Gros
* Carl Rand
* Cassian Andrei
* Chad Dombrova
* Changlin Hsieh
* Chris Crosetto
* Chris Foster
* Chris Kulla
* Chris Whalen
* Christoph Willing
* Cliff Stein
* Clément Champetier
* Dalai Felinto
* Dan Wexler
* Daniel Dresser
* Daniel Flehner Heen
@@ -40,30 +50,35 @@ lg@openimageio.org
* David Aguilar
* David Gordon
* Deepak Gopinath
* Delai Felinto
* Dennis Schridde
* Dieter De Baets
* 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
* Frédéric Devernay
* Gaurav Bansal
* Ghislain Antony Vaillant
* Gonzalo Garramuño
* Grégoire De Lillo
* Gregor Mueckl
* Grégoire De Lillo
* Guillaume Chatelet
* Hanspeter Niederstrasser
* Harry Mallon
* Heiko Becker
* Henri Fousse
* Harry Mallon
* Hugh Macdonald
* Imarz
* Irena Damsky
* Ismael Cortes
* Jan Hettenkofer
* Jens Lindgren
* Jep Hill
* Jeph Alapat
* Jeremy Rose
@@ -78,6 +93,7 @@ lg@openimageio.org
* Justina Mikonyte
* Kazuki Takahashi
* Kevin Brightwell
* Kimball Thurston
* Konrad Kleine
* Krzysztof Blicharski
* Larry Gritz (project leader)
@@ -88,6 +104,7 @@ lg@openimageio.org
* Lucille Caillaud
* Lukas Schrangl
* Lukasz Maliszewski
* Luke Emrose
* M Joonas Pihlaja
* Malcolm Humphreys
* Manuel Gamito
@@ -100,6 +117,7 @@ lg@openimageio.org
* Matteo F. Vescovi
* Matthew E. Levine
* Max Liani
* Merwan Achibet
* Michel Lerenard
* Michel Normand
* Mikael Sundell
@@ -111,21 +129,27 @@ lg@openimageio.org
* Nick Black
* Nicolas Burtnyk
* Nixon Kwok
* Northon Patrick
* Nuno Cardoso
* Ole Gulbrandsen
* Ott Tinn
* Pascal Lecocq
* Patrick Hodoul
* Patrick Piché
* Paul Melis
* Paul Molodowitch
* Pavel Karneliuk
* Pete Larabell
* Philip Nemec
* Pino Toscano
* Puneet Jain
* Radu Arjocu
* Ramon Montoya
* Ray Molenkamp
* Rémi Achard
* Richard Shaw
* Roeland Schoukens
* Robert Matusewicz
* Roeland Schoukens
* Roman Zulak
* Rui Li
* Ryen
@@ -134,11 +158,13 @@ lg@openimageio.org
* Samuel Nicholas
* Scott Wilson
* Sebastian Elsner
* SebTV
* Seifeddine Dridi
* Sergey Sharybin
* Shane Ambler
* Simon Boorer
* Solomon Boulos
* SRHMorris
* Stefan Bruens
* Stefan Stavrev
* Thiago Ize
@@ -156,3 +182,4 @@ lg@openimageio.org
* Xo Wang
* Yang Yang
* Yann Lanthony
* zomgrolf
+54 -115
View File
@@ -2,9 +2,9 @@ Installation instructions for OpenImageIO
=========================================
# Table of Contents
1. [OpenImageIO's Dependences](#dependencies)
2. [Installing binaries from package managers](#installingfrompackagemanagers)
3. [Building OIIO from source](#buildingfromsource)
1. [OpenImageIO's Dependencies](#dependencies)
2. [Installing binaries from package managers](#installing-from-package-managers)
3. [Building OIIO from source](#building-from-source)
Dependencies
@@ -14,12 +14,17 @@ 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.1, 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)
* **C++14** (also builds with C++17, and C++20)
* The default build mode is C++14. This can be controlled by via the
CMake configuration flag: `-DCMAKE_CXX_STANDARD=17`, etc.
* Compilers: **gcc 6.1 - 11.2**, **clang 3.4 - 13**, **MSVS 2017 - 2019**,
**icc 17+**.
* CMake >= 3.12 (tested through 3.22)
* OpenEXR/Imath >= 2.3 (recommended: 2.4 or higher; tested through 3.1)
* libTIFF >= 3.9 (recommended: 4.0+; tested through 4.3)
* libjpeg >= 8, or libjpeg-turbo >= 1.1 (tested through jpeg9d and jpeg-turbo
2.1)
* Boost >= 1.53 (recommended: at least 1.66; tested through 1.76)
### Optional dependencies -- features may be disabled if not found
* If you are building the `iv` viewer (which will be disabled if any of
@@ -27,38 +32,48 @@ NEW or CHANGED MINIMUM dependencies since the last major release are **bold**.
* 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.)
* Python >= 2.7 (tested against 2.7, 3.7, 3.8, 3.9)
* pybind11 >= 2.4.2 (Tested through 2.9.)
* 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)
* LibRaw >= 0.15 (tested 0.15 - 0.20.2; LibRaw >= 0.18 is necessary for
ACES support and much better recognition of camera metadata; if
building with C++17 or higher, LibRaw >= 0.20 is necessary)
* If you want support for a wide variety of video formats:
* ffmpeg >= 2.6 (tested through 4.3)
* **ffmpeg >= 3.0** (tested through 5.0)
* If you want support for jpeg 2000 images:
* **OpenJpeg >= 2.0** (tested through 2.3)
* If you want support for Field3D files:
* Field3D
* **OpenJpeg >= 2.0** (tested through 2.4; we recommend 2.4 or higher
for multithreading support)
* If you want support for OpenVDB files:
* OpenVDB >= 5.0 (tested through 7.0) and Intel TBB >= 2018 (tested
through 2020_U1)
* OpenVDB >= 5.0 (tested through 9) and Intel TBB >= 2018 (tested
through 2021)
* Note that OpenVDB 8.0+ requires C++14 or higher.
* 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)
* **OpenCV 3.x, or 4.x** (tested through 4.5)
* 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 HEIF/HEIC or AVIF images:
* libheif >= 1.3 (1.7 required for AVIF support, tested through 1.12)
* libheif must be built with an AV1 encoder/decoder for AVIF support.
* Avoid libheif 1.10 on Mac, it is very broken. Libheif 1.11 is fine.
* 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 WebP images:
* WebP >= 0.6.1 (tested through 1.2.1)
* If you want support for OpenColorIO color transformations:
* OpenColorIO >= 1.1 (also tested against the current master that will
become OCIO 2.0).
* OpenColorIO >= 1.1 (tested through 2.1; 2.0+ is recommended)
* If you want support for Ptex:
* Ptex >= 2.3.1 (probably works for older; tested through 2.4.0)
* We use PugiXML for XML parsing. There is a version embedded in the OIIO
tree, but if you want to use an external, system-installed version (as
may be required by some software distributions with policies against
embedding other projects), then just build with `-DUSE_EXTERNAL_PUGIXML=1`.
Any PugiXML >= 1.8 should be fine (we have tested through 1.11).
@@ -68,6 +83,11 @@ Mac OS X, and Windows.
Our build system is based upon 'CMake'. If you don't already have it
installed on your system, you can get it from http://www.cmake.org
If certain dependencies (robin-map and fmtlib) are not found, their sources
will be retrieved and built into libraries, as part of the build process. The
sources of those dependences are cloned from their Git repo, hence `git` must
be available as a command.
After you build OpenImageIO, if you compiled with the `EMBEDPLUGINS=0` flag
you will need to set the environment variable `OIIO_LIBRARY_PATH` to point
to the 'lib' directory where OpenImageIO is installed, or else it will
@@ -81,10 +101,10 @@ 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:
* vckpg (https://github.com/Microsoft/vcpkg)
* vcpkg (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`
* `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`
@@ -139,7 +159,7 @@ 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
FFmpeg, OpenVDB, 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.
@@ -215,7 +235,7 @@ Additionally, a few helpful modifiers alter some build-time options:
| make USE_PYTHON=0 ... | Don't build the Python binding |
| 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 SOVERSION=nn ... | Include the specified major version number in the shared object metadata |
| make NAMESPACE=name | Wrap everything in another namespace |
The command 'make help' will list all possible options.
@@ -243,91 +263,10 @@ or, if you are using CMake directly,
Building on Windows
-------------------
**Method 1 - Default**
**Method 1 - from source**
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
D:\OIIO\trunk directory.
2. Download the package with precompiled external libraries from
http://www.openimageio.org/external.zip
Next, unpack it. The directory with downloaded code from the repository
and the directory with unpacked libraries should be siblings. For example,
```
D:
\OIIO
\trunk // this is my tree
\src // directory with src files for OIIO
\build // directory that is created by cmake
\external // this is extracted external package
\dist
\windows
\glew-1.5.1
\ilmbase-1.0.1
\jpeg-6b
\libpng-1.2.3
\openexr-1.6.1
\tbb-21_20080605oss
\zlib-1.2.3
\tiff-3.8.2
```
3. Download precompiled Qt4 binaries for Windows from here:
http://qt.windows.binaries.googlepages.com/index.html
Unpack it (it doesn't matter where). After unpacking, add the path to
the Qt bin directory to the PATH variable. For example, if you unpacked
this package to the D:\qt-win directory, you should add D:\qt-win\bin to
your PATH. It's important to add the Qt bin directory to PATH because
the FindQt4 module uses it to search for qmake applications.
4. Also, just to be safe, add QTDIR to the environment variables. It
should point to directory where you unpacked Qt.
5. Download precompiled BOOST 1.53 or newer libraries from
http://www.boostpro.com/download
Install it on your system. Choose two versions: Multithread Debug, DLL
and Multithread, DLL for Your Visual Studio version.
6. Download precompiled BOOST 1.53 or newer libraries from here (unfficial
mirror) or from here (unofficial mirror, registration required). Install
it on Your system. Choose two versions: Multithread Debug, DLL and
Multithread, DLL for Your Visual Studio version.
7. Install cmake. You can download precompiled binaries from here:
http://www.cmake.org/cmake/resources/software.html
After installing, run cmake-gui. Set the field that specifies the source
code location (for example, to D:\OIIO\trunk\src). Then set the field
that specifies where to build binaries to the directory you want to
build project for OIIO (for example, D:\OIIO\trunk\build).
8. Set the THIRD_PARTY_TOOLS_HOME environment variable to the directory
where are stored unpacked external libraries (for example,
D:\OIIO\external\dist\windows). You can add variables by clicking Add
entry button.
9. Hit the Configure button. Cmake should automatically find externals
libraries and prepare the environment for creating the OIIO project. If
the configuration process ends without errors go to next step. If not,
read the instructions from the end of this tutorial.
10. Hit the Generate button. Cmake will build Visual Studio a solution in
the build directory.
11. That's all. You can open the OpenImageIO solution and start developing
OIIO! Potential problems:
It may happen that cmake won't find zlib, png, tiff or jpeg
libraries. If so you have to set CMAKE_PREFIX_PATH to point to the
directory where the missing libraries are stored. For example, if cmake
can't find ZLIB, add to CMAKE_PREFIX_PATH the
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.
I really need someone to write correct, modern docs about how to build
from source on Windows.
**Method 2 - Using vcpkg**
@@ -335,7 +274,7 @@ D:\OIIO\external\dist\windows\zlib-1.2.3;D:\OIIO\external\dist\windows\libpng-1.
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``
3. Execute the PowerShell command from where vcpkg is located in directory. ``vcpkg install openimageio``
Test Images
-----------
-2
View File
@@ -1,5 +1,3 @@
BSD 3-Clause License
Copyright (c) 2008-present by Contributors to the OpenImageIO project.
All Rights Reserved.
+12 -26
View File
@@ -10,7 +10,7 @@
#
# Copyright 2008-present Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
# https://github.com/OpenImageIO/oiio
#########################################################################
@@ -21,18 +21,9 @@ working_dir := ${shell pwd}
# Figure out which architecture we're on
include ${working_dir}/src/make/detectplatform.mk
# Presence of make variables DEBUG and PROFILE cause us to make special
# builds, which we put in their own areas.
ifdef DEBUG
variant +=.debug
endif
ifdef PROFILE
variant +=.profile
endif
MY_MAKE_FLAGS ?=
MY_NINJA_FLAGS ?=
MY_CMAKE_FLAGS += -g3
MY_CMAKE_FLAGS ?=
BUILDSENTINEL ?= Makefile
NINJA ?= ninja
CMAKE ?= cmake
@@ -46,10 +37,8 @@ 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}
build_dir ?= build
dist_dir ?= dist
INSTALL_PREFIX ?= ${working_dir}/${dist_dir}
@@ -95,7 +84,7 @@ MY_CMAKE_FLAGS += -DPYLIB_INCLUDE_SONAME:BOOL=${PYLIB_INCLUDE_SONAME}
endif
ifneq (${USE_EXTERNAL_PUGIXML},)
MY_CMAKE_FLAGS += -DUSE_EXTERNAL_PUGIXML:BOOL=${USE_EXTERNAL_PUGIXML} -DPUGIXML_HOME=${PUGIXML_HOME}
MY_CMAKE_FLAGS += -DUSE_EXTERNAL_PUGIXML:BOOL=${USE_EXTERNAL_PUGIXML}
endif
ifneq (${OPENEXR_ROOT},)
@@ -245,7 +234,7 @@ endif
#########################################################################
# Top-level documented targets
all: dist
all: install
# 'make debug' is implemented via recursive make setting DEBUG
debug:
@@ -265,7 +254,7 @@ config:
cd ${build_dir} ; \
${CMAKE} -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} \
-DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} \
${MY_CMAKE_FLAGS} ../.. ; \
${MY_CMAKE_FLAGS} ${working_dir} ; \
fi)
@@ -303,7 +292,7 @@ clang-format: config
)
# 'make dist' is just a synonym for 'make install'
# DEPRECATED: 'make dist' is just a synonym for 'make install'
dist : install
TEST_FLAGS += --force-new-ctest-process --output-on-failure
@@ -336,10 +325,8 @@ clean:
realclean: clean
${CMAKE} -E remove_directory ${dist_dir}
# 'make nuke' blows away the build and dist areas for all platforms
nuke:
${CMAKE} -E remove_directory ${top_build_dir}
${CMAKE} -E remove_directory ${top_dist_dir}
# DEPRECATED: 'make nuke' blows away the build and dist areas for all platforms
nuke: realclean
doxygen:
doxygen src/doc/Doxyfile
@@ -359,7 +346,6 @@ help:
@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"
@@ -370,7 +356,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 " CMAKE_CXX_STANDARD=14 Compile in C++14 mode (default is C++11)"
@echo " CMAKE_CXX_STANDARD=14 C++ standard to build with (default is 14)"
@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"
@@ -392,7 +378,7 @@ help:
@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 " DCMTK FFmpeg Freetype GIF JPEGTurbo"
@echo " LibRaw OpenColorIO OpenCV OpenGL OpenJpeg OpenVDB"
@echo " PTex R3DSDK TBB TIFF Webp"
@echo " Finding and Using Dependencies:"
+7 -9
View File
@@ -2,8 +2,7 @@ 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.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)
[![CI](https://github.com/OpenImageIO/oiio/actions/workflows/ci.yml/badge.svg)](https://github.com/OpenImageIO/oiio/actions/workflows/ci.yml)
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/2694/badge)](https://bestpractices.coreinfrastructure.org/projects/2694)
@@ -19,7 +18,7 @@ OpenImageIO consists of:
* Simple but powerful ImageInput and ImageOutput APIs that provide
an abstraction for reading and writing image files of nearly any
format, without the calling application needing to know any of the
details of these file formats, and indeed without the calling
details of these file formats, and indeed without the calling
application needing to be aware of which formats are available.
* A library that manages subclasses of ImageInput and ImageOutput that
@@ -31,9 +30,9 @@ OpenImageIO consists of:
* Plugins implementing I/O for several popular image file formats,
including TIFF, JPEG/JFIF, OpenEXR, PNG, HDR/RGBE, ICO, BMP, Targa,
JPEG-2000, RMan Zfile, FITS, DDS, Softimage PIC, PNM, DPX, Cineon,
IFF, Field3D, OpenVDB, Ptex, Photoshop PSD, Wavefront RLA, SGI, WebP,
GIF, DICOM, HEIC/HEIF, many "RAW" digital camera formats, and a variety of
movie formats (readable as individual frames). More are being developed
IFF, OpenVDB, Ptex, Photoshop PSD, Wavefront RLA, SGI, WebP,
GIF, DICOM, HEIF/HEIC/AVIF, many "RAW" digital camera formats, and a variety
of movie formats (readable as individual frames). More are being developed
all the time.
* Several command line image tools based on these classes, including
@@ -83,7 +82,7 @@ particular licensing terms in your own application.
Some code and resources are distributed along with OIIO that have highly
compatible, though slightly different, licenses (generally MIT or Apache).
See the PDF documentation Acknowledgements section, and the
[LICENSE-THIRD-PARTY](LICENSE-THIRD-PARTY.md) file for details.
[THIRD-PARTY](THIRD-PARTY.md) file for details.
Building and Installation
@@ -113,7 +112,7 @@ Simple "how do I...", "I'm having trouble", or "is this a bug" questions are
best asked on the [oiio-dev developer mail
list](http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org).
That's where the most people will see it and potentially be able to answer
your question quickly (moreso than a GH "issue").
your question quickly (more so than a GH "issue").
Bugs, build problems, and discovered vulnerabilities that you are relatively
certain is a legit problem in the code, and for which you can give clear
@@ -146,4 +145,3 @@ Mail list subscriptions and archives:
* Developer mail list: http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org
* Just release announcements: http://lists.openimageio.org/listinfo.cgi/oiio-announce-openimageio.org
+8 -1
View File
@@ -21,12 +21,19 @@ SPDX-License-Identifier: BSD-3-Clause
OIIO, but since some elements are derived from that, we still acknowledge
the original copyright here.
* Open Shading Language. Copyright Sony Pictures Imageworks Inc.
* Open Shading Language. Copyright contributors to the OSL project.
https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
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.
* OpenColorIO (c) Copyright contributors to the OpenColorIO Project.
https://github.com/AcademySoftwareFoundation/OpenColorIO
The sample OpenColorIO configurations in our testsuite are borrowed from
this ASWF project, also BSD-3-Clause licensed.
* DPX reader/writer (c) Copyright 2009 Patrick A. Palmer.
https://github.com/patrickpalmer/dpx
-117
View File
@@ -1,117 +0,0 @@
version: '{branch}-{build}'
image: Previous Visual Studio 2015
clone_folder: C:\projects\oiio
test: off
configuration:
- Release
# - Debug
platform:
- x64
# branches:
# only:
# - master
environment:
matrix:
- CMAKE_PLATFORM: "Visual Studio 14 2015 Win64"
PYTHON_DIR: "C:\\Python27-x64"
tbs_arch: "x64"
tbs_tools: "msvc14"
tbs_static_runtime: 0
MY_CMAKE_FLAGS: -DUSE_PYTHON=0
USE_PYTHON: 0
cache:
- C:\tools\vcpkg\installed
#- C:\tools\vcpkg -> appveyor.yml
#- C:\projects\ext -> appveyor.yml
# The -> means that the cache dir is discarded if appveyor.yml has changed
install:
- ps: $OIIO_INSTALL_BEGIN=Get-Date
- cinstall: python
- git submodule update --init --recursive
- set CMAKE_PREFIX_PATH=C:/Sys;%APPVEYOR_BUILD_FOLDER%/ext;c:/tools/vcpkg/installed/%platform%-windows
- set CMAKE_LIBRARY_PATH=C:/Sys/lib;%APPVEYOR_BUILD_FOLDER%/ext/lib
- set CMAKE_INCLUDE_PATH=C:/Sys/include;%APPVEYOR_BUILD_FOLDER%/ext/include
- mkdir c:\sys
- mkdir ext
- cd ext
- mkdir lib
- mkdir include
# Boost
# 1.63 is already installed on appveyor, just use it
- set BOOST_ROOT=C:\Libraries\boost_1_66_0
- set CMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH%;%BOOST_ROOT%
# Install a bunch of vcpkg dependencies. We rely on the run-to-run caching
# of these, but if the cache is flushed, it takes too long to rebuild them
# all, so we stage it.
- vcpkg list
- vcpkg update
# - vcpkg help triplet
# Dependencies that don't take too long, just build them unconditionally.
- vcpkg install zlib:"%platform%"-windows
- vcpkg install tiff:"%platform%"-windows
- vcpkg install libpng:"%platform%"-windows
- vcpkg install openexr:"%platform%"-windows
- vcpkg install freetype:"%platform%"-windows
- vcpkg install giflib:"%platform%"-windows
- vcpkg install libwebp:"%platform%"-windows
- vcpkg install openjpeg:"%platform%"-windows
- vcpkg install ptex:"%platform%"-windows
- vcpkg install libraw:x64-windows
- vcpkg install pybind11:x64-windows
# Qt
- set CMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH%;C:\Qt\5.12
# Expensive optional deps only build if there's plenty of time left.
# If we run out the clock, the cache won't be saved.
# - ps: |
# $OIIO_BUILD_NOW=Get-Date
# if (($OIIO_BUILD_NOW-$OIIO_INSTALL_BEGIN).TotalMinutes -gt 15) {
# Add-AppveyorMessage -Message "OIIO low on time, skippping dependency qt5-base"
# } else {
# vcpkg install qt5-base:x64-windows
# }
# Wish list:
# OpenCV
# ffmpeg
# OpenColorIO
- cd ..
- dir C:\Sys
# - dir C:\Sys\include
# - dir C:\Sys\lib
- vcpkg list
- dir c:\tools\vcpkg
- dir c:\tools\vcpkg\installed\x64-windows
- dir C:\projects\oiio\ext
- dir C:\projects\oiio\ext\include
- dir C:\projects\oiio\ext\lib
build_script:
- echo Running cmake...
- cd c:\projects\oiio
- mkdir build
- 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% --target install
- dir c:\projects\oiio\dist\windows64
matrix:
fast_finish: true
-1
View File
@@ -18,7 +18,6 @@ tbb/2020.0
# pybind11/2.4.3 - conan doesn't have this minimum version
# dcmtk
# ffmpeg
# field3d
# libheif
# libraw
# openvdb
+50 -275
View File
@@ -3,48 +3,18 @@ ifneq (${VERBOSE},)
$(info Including spi/Makefile-bits)
endif
# 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, 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 ?= 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
NAMESPACE ?= 'OpenImageIO_SpComp2'
SOVERSION ?= ${OPENIMAGEIO_SPCOMP2_VERSION}
PYLIB_LIB_PREFIX ?= 1
PYLIB_INCLUDE_SONAME ?= 1
else ifeq (${OIIO_ARNOLD},1)
ifeq (${OIIO_ARNOLD},1)
$(info Building for Arnold)
NAMESPACE ?= 'OpenImageIO_Arnold'
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
@@ -57,43 +27,36 @@ ifeq (${SP_OS}, rhel7)
# Rhel7 (current)
platform := rhel7
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
ifeq (${SPI_COMPILER_PLATFORM},gcc-6.3)
SPCOMP2_COMPILER ?= gcc63
CMAKE_CXX_STANDARD ?= 14
LLVM_VERSION ?= 10.0.0-1
LLVM_VERSION ?= 12.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
CMAKE_CXX_STANDARD ?= 14
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 += -DSPI_TESTS=1 -DPROJECT_VERSION_RELEASE_TYPE=spi
MY_CMAKE_FLAGS += -DOIIO_NAMESPACE_INCLUDE_PATCH=1
MY_CMAKE_FLAGS += -DCMAKE_DEBUG_POSTFIX=${CMAKE_DEBUG_POSTFIX:-_d}
REZ_PACKAGE_ROOT ?= /shots/spi/home/software/packages
SPCOMP2_ROOT ?= /shots/spi/home/lib/SpComp2
## Rhel7 (current)
ifeq (${SP_OS}, rhel7)
PYTHON_VERSION ?= 2.7
USE_SIMD ?= sse4.1,aes
CMAKE ?= cmake
USE_NINJA ?= 1
@@ -106,8 +69,6 @@ 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
@@ -117,18 +78,15 @@ 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/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++
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++
else ifeq (${COMPILER},clang9)
LLVM_DIRECTORY := /shots/spi/home/software/packages/llvm/9.0.1-1/${SPI_COMPILER_PLATFORM}
LLVM_DIRECTORY ?= ${REZ_PACKAGE_ROOT}/llvm/${LLVM_VERSION}/${SPI_COMPILER_PLATFORM}
ifeq (${COMPILER},clang9)
LLVM_DIRECTORY := ${REZ_PACKAGE_ROOT}/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}
LLVM_DIRECTORY := ${REZ_PACKAGE_ROOT}/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},clang11)
LLVM_DIRECTORY := ${REZ_PACKAGE_ROOT}/llvm/11.0.0/${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++
@@ -144,43 +102,16 @@ ifeq (${SP_OS}, rhel7)
-DCMAKE_C_COMPILER=${LLVM_DIRECTORY}/bin/clang \
-DCMAKE_CXX_COMPILER=${LLVM_DIRECTORY}/bin/clang++
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.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}
SPBOOST_LIB_DIR ?= /usr/lib64/boost_${BOOSTVERSSP}
ifeq (${BOOSTSPSUFFIX}, sp)
SPBOOST_LIBNAMESTART ?= lib${BOOSTSPSUFFIX}boost_${shell echo ${BOOSTVERS} | sed "s/\\./_/"}_0
else
SPBOOST_LIBNAMESTART ?= lib${BOOSTSPSUFFIX}boost
endif
SPBOOST_LIBNAMEEND ?= -gcc48-mt-${shell echo ${BOOSTVERS} | sed "s/\\./_/"}
MY_CMAKE_FLAGS += \
-DBOOST_CUSTOM=1 \
-DBoost_VERSION=${BOOSTVERS} \
-DBoost_INCLUDE_DIRS=${SPBOOST_INC_DIR} \
-DBoost_LIBRARY_DIRS=${SPBOOST_LIB_DIR} \
-DBoost_LIBRARIES:STRING="${SPBOOST_LIB_DIR}/${SPBOOST_LIBNAMESTART}_filesystem${SPBOOST_LIBNAMEEND}.so;${SPBOOST_LIB_DIR}/${SPBOOST_LIBNAMESTART}_regex${SPBOOST_LIBNAMEEND}.so;${SPBOOST_LIB_DIR}/${SPBOOST_LIBNAMESTART}_system${SPBOOST_LIBNAMEEND}.so;${SPBOOST_LIB_DIR}/${SPBOOST_LIBNAMESTART}_thread${SPBOOST_LIBNAMEEND}.so"
else
# Our Boost >= 1.61 setup is MUCH simpler and more standard
SPBOOST_INC_DIR := /usr/include/boostroot/boost${BOOSTVERSSP}.0
SPBOOST_LIB_DIR := /usr/lib64/boostroot/boost${BOOSTVERSSP}.0
MY_CMAKE_FLAGS += \
SPBOOST_INC_DIR := /usr/include/boostroot/boost${BOOSTVERS}.0
SPBOOST_LIB_DIR := /usr/lib64/boostroot/boost${BOOSTVERS}.0
MY_CMAKE_FLAGS += \
-DBOOST_INCLUDEDIR=${SPBOOST_INC_DIR} \
-DBOOST_LIBRARYDIR=${SPBOOST_LIB_DIR}
endif
#
# Python
@@ -188,18 +119,7 @@ ifeq (${SP_OS}, rhel7)
PYTHON_INCLUDE_DIR ?= /usr/include/python${PYTHON_VERSION}
PYTHON_LIBRARY_DIR ?= /usr/lib64
PYTHON_LIBRARY ?= ${PYTHON_LIBRARY_DIR}/libpython${PYTHON_VERSION}.so
ifeq (${PYTHON_VERSION},3.6)
# Special sauce for Python 3.6
PYTHON_INCLUDE_DIR := /usr/include/python${PYTHON_VERSION}m
PYTHON_LIBRARY := ${PYTHON_LIBRARY_DIR}/libpython${PYTHON_VERSION}m.so
MY_CMAKE_FLAGS += \
-DPYTHONINTERP_FOUND=1 \
-DPYTHON_VERSION_STRING=3.6.3 \
-DPYTHON_VERSION_MAJOR=3 \
-DPYTHON_VERSION_MINOR=6 \
-DPYTHON_VERSION_PATCH=3 \
-DPython_ADDITIONAL_VERSIONS="${PYTHON_VERSION}"
else ifeq (${PYTHON_VERSION},3.7)
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
@@ -225,42 +145,30 @@ ifeq (${SP_OS}, rhel7)
MY_CMAKE_FLAGS += \
-DPYTHON_INCLUDE_DIR:STRING=${PYTHON_INCLUDE_DIR} \
-DPYTHON_LIBRARY:STRING=${PYTHON_LIBRARY} \
-Dpybind11_ROOT:STRING=${REZ_PACKAGE_ROOT}/pybind11/2.4.3/python-${PYTHON_VERSION}
-Dpybind11_ROOT:STRING=${REZ_PACKAGE_ROOT}/pybind11/2.6.2/python-${PYTHON_VERSION}
# Set our preferred OpenEXR path, but allow env variable to override
# with custom/test version.
OPENEXR_VERSION ?= 2.4.0
OpenEXR_ROOT ?= ${REZ_PACKAGE_ROOT}/OpenEXR/${OPENEXR_VERSION}/${SPI_COMPILER_PLATFORM}/python-${PYTHON_VERSION}
OPENEXR_VERSION ?= 2.4.3
OpenEXR_ROOT ?= ${REZ_PACKAGE_ROOT}/OpenEXR/${OPENEXR_VERSION}/${SPI_COMPILER_PLATFORM}
MY_CMAKE_FLAGS += -DOpenEXR_ROOT=${OpenEXR_ROOT}
#
# SpComp2 and other weird SPI-installed packages
#
NUKE_VERSION ?= 11.2v3
SPCOMP2_FULLBOOST_SUFFIX = ${SP_OS}-${SPCOMP2_COMPILER}-boost${shell echo ${BOOSTVERSSP} | sed "s/\\.//"}
SPCOMP2_FULLBOOST_SUFFIX = ${SP_OS}-${SPCOMP2_COMPILER}-boost${shell echo ${BOOSTVERS} | sed "s/\\.//"}
# $(info SPCOMP2_FULLBOOST_SUFFIX ${SPCOMP2_FULLBOOST_SUFFIX})
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_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
OPENCOLORIO_VERSION ?= 2.1.0
OpenColorIO_ROOT ?= ${REZ_PACKAGE_ROOT}/OpenColorIO/${OPENCOLORIO_VERSION}/${SPI_COMPILER_PLATFORM}/python-${PYTHON_VERSION}
#MY_CMAKE_FLAGS += -DOPENCOLORIO_LIBRARY=${OpenColorIO_ROOT}/lib/libOpenColorIO_SPI.so
OPENVDB_VERSION ?= 8.0.0-2
OpenVDB_ROOT ?= ${REZ_PACKAGE_ROOT}/OpenVDB/${OPENVDB_VERSION}/${SPI_COMPILER_PLATFORM}/python-${PYTHON_VERSION}/boost-${BOOSTVERS}
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
Libheif_ROOT ?= /shots/spi/home/lib/arnold/rhel7/libheif-1.3.2
MY_CMAKE_FLAGS += \
-DOpenColorIO_ROOT=${OpenColorIO_ROOT} \
-DField3D_ROOT=${Field3D_ROOT} \
-DOpenVDB_ROOT=${OpenVDB_ROOT} \
-DTBB_ROOT=${TBB_ROOT} \
-DTBB_LIBRARY=${TBB_LIBRARY} \
@@ -269,21 +177,17 @@ ifeq (${SP_OS}, rhel7)
-DHDF5_LIBRARIES=/usr/lib64/libhdf5.so \
-DNuke_ROOT=/net/apps/rhel7/foundry/nuke${NUKE_VERSION} \
-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;" \
-DFFMPEG_INCLUDES=/usr/include/ffmpegroot/ffmpeg42 \
-DFFMPEG_LIBRARIES="/usr/lib64/ffmpegroot/ffmpeg424/libavcodec.so;/usr/lib64/ffmpegroot/ffmpeg424/libavformat.so;/usr/lib64/ffmpegroot/ffmpeg424/libavutil.so;/usr/lib64/ffmpegroot/ffmpeg424/libswscale.so;" \
-DUSE_OPENCV=0 \
-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
LibRaw_ROOT ?= ${REZ_PACKAGE_ROOT}/LibRaw/0.21.0.0/${SPI_COMPILER_PLATFORM}
MY_CMAKE_FLAGS += -DLibRaw_ROOT=${LibRaw_ROOT}
LIBRAW_LIBDIR = ${LibRaw_ROOT}/lib
MY_CMAKE_FLAGS += -DWebP_ROOT=${REZ_PACKAGE_ROOT}/webp/1.2.1/${SPI_COMPILER_PLATFORM}
# Use libtiff I built myself, static, and try to hide its symbols.
MY_CMAKE_FLAGS += \
@@ -298,38 +202,32 @@ else ifeq (${platform}, macosx)
USE_SIMD ?= sse4.2
MY_CMAKE_FLAGS += \
-DCMAKE_BUILD_WITH_INSTALL_RPATH=1 \
-DCMAKE_INSTALL_NAME_DIR="${working_dir}/dist/${platform}${variant}/lib"
-DCMAKE_INSTALL_NAME_DIR="${working_dir}/dist/lib"
# A variety of tags can be used to try specific versions of gcc or
# clang from the site-specific places we have installed them.
ifeq (${COMPILER}, gcc48)
MY_CMAKE_FLAGS += \
-DCMAKE_C_COMPILER=gcc-4.8 -DCMAKE_CXX_COMPILER=g++-4.8
USE_LIBCPLUSPLUS := 0
else ifeq (${COMPILER}, gcc5)
MY_CMAKE_FLAGS += \
-DCMAKE_C_COMPILER=gcc-5 -DCMAKE_CXX_COMPILER=g++-5
USE_LIBCPLUSPLUS := 0
else ifeq (${COMPILER}, gcc6)
ifeq (${COMPILER}, gcc6)
MY_CMAKE_FLAGS += \
-DCMAKE_C_COMPILER=gcc-6 -DCMAKE_CXX_COMPILER=g++-6
USE_LIBCPLUSPLUS := 0
else ifeq (${COMPILER}, gcc8)
else ifeq (${COMPILER}, gcc9)
MY_CMAKE_FLAGS += \
-DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8
-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}, gcc11)
MY_CMAKE_FLAGS += \
-DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g++-11
USE_LIBCPLUSPLUS := 0
else ifeq (${COMPILER},clang7)
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/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},clang11)
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=/usr/local/opt/llvm@11/bin/clang \
-DCMAKE_CXX_COMPILER=/usr/local/opt/llvm@11/bin/clang++
else ifeq (${COMPILER},clang)
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
else ifeq (${COMPILER},gcc)
@@ -349,130 +247,7 @@ 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)
all: dist
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_SPCOMP2_CURRENT = $(SPCOMP2_INSTALL_ROOT)/OpenImageIO/$(SPARCH)/v$(OPENIMAGEIO_SPCOMP2_VERSION)
INSTALL_BIN_LOCATION = $(INSTALL_SPCOMP2_CURRENT)/bin
SPCOMP2_LOCAL_PATH ?= /net/soft_scratch/users/$(USER)/SpComp2_test
spcomp2_install_local: SPCOMP2_INSTALL_ROOT = $(SPCOMP2_LOCAL_PATH)
spcomp2_install_local: INSTALL_BIN_LOCATION = $(INSTALL_SPCOMP2_CURRENT)/bin
spcomp2_install_local: spcomp2_install
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=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 \
-DPYLIB_LIB_PREFIX:BOOL=ON \
-DPYMODULE_SUFFIX="V${OPENIMAGEIO_SPCOMP2_VERSION}"
spcomp2: dist
spcomp2_debug: MY_CMAKE_FLAGS += \
-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 \
-DPYLIB_LIB_PREFIX:BOOL=ON \
-DPYMODULE_SUFFIX="V${OPENIMAGEIO_SPCOMP2_VERSION}"
spcomp2_debug: debug
spcomp2_install_fixup_rhel7: spcomp2 spcomp2_debug
echo $(SPCOMP2_INSTALL_ROOT)
patchelf --set-rpath ${SPCOMP2_RPATH_OPT} ${dist_dir}/lib/libOpenImageIO$(OIIO_LIBNAME_SUFFIX).so
patchelf --set-rpath ${SPCOMP2_RPATH_DEBUG} ${dist_dir}.debug/lib/libOpenImageIO$(OIIO_LIBNAME_SUFFIX).so
patchelf --set-rpath ${SPCOMP2_RPATH_OPT} ${dist_dir}/lib/libOpenImageIO_Util$(OIIO_LIBNAME_SUFFIX).so
patchelf --set-rpath ${SPCOMP2_RPATH_DEBUG} ${dist_dir}.debug/lib/libOpenImageIO_Util$(OIIO_LIBNAME_SUFFIX).so
patchelf --set-rpath ${PYSPCOMP2_RPATH_OPT} ${dist_dir}/python/libPyOpenImageIO.so
patchelf --set-rpath ${PYSPCOMP2_RPATH_DEBUG} ${dist_dir}.debug/python/libPyOpenImageIO.so
# This goal can't start with 'install' because something elsewhere picks
# it up and starts doing bad things
spcomp2_install: spcomp2_install_fixup_${SP_OS}
perl -I/usr/local/spi/lib/make /usr/local/spi/bin/spcomp_install.pl -m installhost \
--project=OpenImageIO \
--version=$(OPENIMAGEIO_SPCOMP2_VERSION) \
--root=$(SPCOMP2_INSTALL_ROOT) \
--arch=$(SPARCH) \
--headers=$(subst $(space),$(comma),$(wildcard ${dist_dir}/include/OpenImageIO/*)) \
--cflags= --static_lflags="$(LINK_BOOST) $(LINK_OPENEXR) -lpthread" \
--namespace=${NAMESPACE} \
--srcdir=${dist_dir}/lib \
--builddir_o=${dist_dir}/lib \
--builddir_d=${dist_dir}.debug/lib
perl -I/usr/local/spi/lib/make /usr/local/spi/bin/spcomp_install.pl -m installhost \
--project=OpenImageIO_Util \
--version=$(OPENIMAGEIO_SPCOMP2_VERSION) \
--root=$(SPCOMP2_INSTALL_ROOT) \
--arch=$(SPARCH) \
--headers=$(subst $(space),$(comma),$(wildcard ${dist_dir}/include/OpenImageIO/*)) \
--cflags= --static_lflags="$(LINK_BOOST) $(LINK_OPENEXR) -lpthread" \
--namespace=${NAMESPACE} \
--srcdir=${dist_dir}/lib \
--builddir_o=${dist_dir}/lib \
--builddir_d=${dist_dir}.debug/lib
perl -I/usr/local/spi/lib/make /usr/local/spi/bin/spcomp_install.pl -m installhost \
--project=PyOpenImageIO \
--version=$(OPENIMAGEIO_SPCOMP2_VERSION) \
--root=$(SPCOMP2_INSTALL_ROOT) \
--arch=$(SPPYARCH) \
--cflags= --static_lflags="$(LINK_BOOST) $(LINK_OPENEXR) -lpthread"\
--namespace=${NAMESPACE} \
--srcdir=${dist_dir}/python \
--builddir_o=${dist_dir}/python \
--builddir_d=${dist_dir}.debug/python
-9
View File
@@ -2,15 +2,6 @@ option (${PROJ_NAME}_SPIREZ "Enable extra bits for building for SPI Rez install"
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
@@ -1,18 +0,0 @@
#!/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])))
+1 -1
View File
@@ -1,5 +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
# https://github.com/OpenImageIO/oiio
add_oiio_plugin (bmpinput.cpp bmpoutput.cpp bmp_pvt.cpp)
+20 -17
View File
@@ -1,11 +1,14 @@
// Copyright 2008-present Contributors to the OpenImageIO project.
// SPDX-License-Identifier: BSD-3-Clause
// https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
// https://github.com/OpenImageIO/oiio
#include <OpenImageIO/filesystem.h>
#include <OpenImageIO/fmath.h>
#include <OpenImageIO/imageio.h>
#include "bmp_pvt.h"
#include <OpenImageIO/fmath.h>
OIIO_PLUGIN_NAMESPACE_BEGIN
@@ -14,23 +17,21 @@ namespace bmp_pvt {
/// Helper - write, with error detection
template<class T>
bool
fwrite(FILE* fd, const T* buf)
fwrite(Filesystem::IOProxy* fd, const T* buf)
{
size_t n = std::fwrite(buf, sizeof(T), 1, fd);
return n == 1;
return fd->write(buf, sizeof(T)) == sizeof(T);
}
/// Helper - read, with error detection
template<class T>
bool
fread(FILE* fd, T* buf, size_t itemsize = sizeof(T))
fread(Filesystem::IOProxy* fd, T* buf, size_t itemsize = sizeof(T))
{
size_t n = std::fread(buf, itemsize, 1, fd);
return n == 1;
return fd->read(buf, itemsize) == itemsize;
}
bool
BmpFileHeader::read_header(FILE* fd)
BmpFileHeader::read_header(Filesystem::IOProxy* fd)
{
if (!fread(fd, &magic) || !fread(fd, &fsize) || !fread(fd, &res1)
|| !fread(fd, &res2) || !fread(fd, &offset)) {
@@ -45,7 +46,7 @@ BmpFileHeader::read_header(FILE* fd)
bool
BmpFileHeader::write_header(FILE* fd)
BmpFileHeader::write_header(Filesystem::IOProxy* fd)
{
if (bigendian())
swap_endian();
@@ -86,7 +87,7 @@ BmpFileHeader::swap_endian(void)
bool
DibInformationHeader::read_header(FILE* fd)
DibInformationHeader::read_header(Filesystem::IOProxy* fd)
{
if (!fread(fd, &size))
return false;
@@ -120,14 +121,16 @@ DibInformationHeader::read_header(FILE* fd)
}
}
} else if (size == OS2_V1) {
// some of theses fields are smaller then in WINDOWS_Vx headers,
// so we use hardcoded counts
width = 0;
height = 0;
if (!fread(fd, &width, 2) || !fread(fd, &height, 2)
// some of theses fields are smaller than in WINDOWS_Vx headers,
// so we read into 16 bit ints and copy.
uint16_t width16 = 0;
uint16_t height16 = 0;
if (!fread(fd, &width16) || !fread(fd, &height16)
|| !fread(fd, &cplanes) || !fread(fd, &bpp)) {
return false;
}
width = width16;
height = height16;
}
if (bigendian())
swap_endian();
@@ -137,7 +140,7 @@ DibInformationHeader::read_header(FILE* fd)
bool
DibInformationHeader::write_header(FILE* fd)
DibInformationHeader::write_header(Filesystem::IOProxy* fd)
{
if (bigendian())
swap_endian();
+26 -97
View File
@@ -1,14 +1,9 @@
// Copyright 2008-present Contributors to the OpenImageIO project.
// SPDX-License-Identifier: BSD-3-Clause
// https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
// https://github.com/OpenImageIO/oiio
#pragma once
#include <cstdio>
#include <OpenImageIO/filesystem.h>
#include <OpenImageIO/imageio.h>
OIIO_PLUGIN_NAMESPACE_BEGIN
@@ -30,16 +25,20 @@ const int16_t MAGIC_CI = 0x4943;
const int16_t MAGIC_CP = 0x5043;
const int16_t MAGIC_PT = 0x5450;
//const int32_t RLE4_COMPRESSION = 2;
const int32_t NO_COMPRESSION = 0; // BI_RGB
const int32_t RLE8_COMPRESSION = 1; // BI_RLE8
const int32_t RLE4_COMPRESSION = 2; // BI_RLE4
// store informations about BMP file
class BmpFileHeader {
public:
// reads informations about BMP file
bool read_header(FILE* fd);
bool read_header(Filesystem::IOProxy* fd);
// writes information about bmp file to given file
bool write_header(FILE* fd);
bool write_header(Filesystem::IOProxy* fd);
// return true if given file is BMP file
bool isBmp() const;
@@ -48,7 +47,7 @@ public:
int32_t fsize; // size of the BMP file
int16_t res1; // reserved
int16_t res2; // reserved
int32_t offset; //offset of image data
int32_t offset; // offset of image data (pixels)
private:
void swap_endian(void);
};
@@ -57,24 +56,26 @@ private:
class DibInformationHeader {
public:
// reads informations about bitmap
bool read_header(FILE* fd);
bool read_header(Filesystem::IOProxy* fd);
// writes informations about bitmap
bool write_header(FILE* fd);
bool write_header(Filesystem::IOProxy* fd);
int32_t size; // size of the header
int32_t width; // bitmap width in pixels
int32_t height; // bitmap height in pixels
int16_t cplanes; // number of color planes - always 1
int16_t bpp; // number of bits per pixel, image color depth
int32_t compression; // compression used in file
int32_t isize; // size of the raw image data
int32_t hres; // horizontal resolution in pixels per meter
int32_t vres; // vertical resolutions in pixels per meter
int32_t cpalete; // number of entries in the color palete
int32_t important; // number of importatn color used,
// 0 - all colors are important,
// in most cases ignored
int32_t size; // size of the header
int32_t width; // bitmap width in pixels
int32_t height; // bitmap height in pixels
int16_t cplanes; // number of color planes - always 1
int16_t bpp; // number of bits per pixel, image color depth
// Added after Version 1 of the format
int32_t compression = 0; // compression used in file
int32_t isize = 0; // size of the raw image data
int32_t hres = 0; // horizontal resolution in pixels per meter
int32_t vres = 0; // vertical resolutions in pixels per meter
int32_t cpalete = 0; // number of entries in the color palette
int32_t important = 0; // number of important color used,
// 0 - all colors are important,
// in most cases ignored
// added in Version 4 of the format
int32_t red_mask;
@@ -116,76 +117,4 @@ struct color_table {
class BmpInput final : public ImageInput {
public:
BmpInput() { init(); }
virtual ~BmpInput() { close(); }
virtual const char* format_name(void) const override { return "bmp"; }
virtual bool valid_file(const std::string& filename) const override;
virtual bool open(const std::string& name, ImageSpec& spec) override;
virtual bool close(void) override;
virtual bool read_native_scanline(int subimage, int miplevel, int y, int z,
void* data) override;
private:
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;
int64_t m_image_start;
void init(void)
{
m_padded_scanline_size = 0;
m_pad_size = 0;
m_fd = NULL;
m_filename.clear();
m_colortable.clear();
}
bool read_color_table(void);
};
class BmpOutput final : public ImageOutput {
public:
BmpOutput() { init(); }
virtual ~BmpOutput() { close(); }
virtual const char* format_name(void) const override { return "bmp"; }
virtual int supports(string_view feature) const override;
virtual bool open(const std::string& name, const ImageSpec& spec,
OpenMode mode) override;
virtual bool close(void) override;
virtual bool write_scanline(int y, int z, TypeDesc format, const void* data,
stride_t xstride) override;
virtual bool write_tile(int x, int y, int z, TypeDesc format,
const void* data, stride_t xstride,
stride_t ystride, stride_t zstride) override;
private:
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;
int64_t m_image_start;
unsigned int m_dither;
std::vector<unsigned char> m_tilebuffer;
void init(void)
{
m_padded_scanline_size = 0;
m_fd = NULL;
m_filename.clear();
}
void create_and_write_file_header(void);
void create_and_write_bitmap_header(void);
};
OIIO_PLUGIN_NAMESPACE_END
+256 -63
View File
@@ -1,12 +1,68 @@
// Copyright 2008-present Contributors to the OpenImageIO project.
// SPDX-License-Identifier: BSD-3-Clause
// https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
// https://github.com/OpenImageIO/oiio
#include <cstdio>
#include <OpenImageIO/filesystem.h>
#include <OpenImageIO/imageio.h>
#include "bmp_pvt.h"
OIIO_PLUGIN_NAMESPACE_BEGIN
using namespace bmp_pvt;
class BmpInput final : public ImageInput {
public:
BmpInput() { init(); }
virtual ~BmpInput() { close(); }
virtual const char* format_name(void) const override { return "bmp"; }
int supports(string_view feature) const override
{
return feature == "ioproxy";
}
virtual bool valid_file(const std::string& filename) const override;
virtual bool open(const std::string& name, ImageSpec& newspec) override;
virtual bool open(const std::string& name, ImageSpec& newspec,
const ImageSpec& config) override;
virtual bool close(void) override;
virtual bool read_native_scanline(int subimage, int miplevel, int y, int z,
void* data) override;
private:
int64_t m_padded_scanline_size;
int m_pad_size;
bmp_pvt::BmpFileHeader m_bmp_header;
bmp_pvt::DibInformationHeader m_dib_header;
std::string m_filename;
std::vector<bmp_pvt::color_table> m_colortable;
std::vector<unsigned char> fscanline; // temp space: read from file
std::vector<unsigned char> m_uncompressed; // uncompressed palette image
bool m_allgray;
void init(void)
{
m_padded_scanline_size = 0;
m_pad_size = 0;
m_filename.clear();
m_colortable.clear();
m_allgray = false;
fscanline.shrink_to_fit();
m_uncompressed.shrink_to_fit();
ioproxy_clear();
}
bool read_color_table();
bool color_table_is_all_gray();
bool read_rle_image();
bool ioeof() { return size_t(ioproxy()->tell()) == ioproxy()->size(); }
};
// Obligatory material to make this a recognizeable imageio plugin
OIIO_PLUGIN_EXPORTS_BEGIN
@@ -24,7 +80,7 @@ bmp_input_imageio_create()
return new BmpInput;
}
OIIO_EXPORT const char* bmp_input_extensions[] = { "bmp", nullptr };
OIIO_EXPORT const char* bmp_input_extensions[] = { "bmp", "dib", nullptr };
OIIO_PLUGIN_EXPORTS_END
@@ -32,56 +88,69 @@ OIIO_PLUGIN_EXPORTS_END
bool
BmpInput::valid_file(const std::string& filename) const
{
FILE* fd = Filesystem::fopen(filename, "rb");
if (!fd)
return false;
bmp_pvt::BmpFileHeader bmp_header;
bool ok = bmp_header.read_header(fd) && bmp_header.isBmp();
fclose(fd);
return ok;
bmp_pvt::BmpFileHeader header;
Filesystem::IOFile file(filename, Filesystem::IOProxy::Read);
return file.opened() && header.read_header(&file) && header.isBmp();
}
bool
BmpInput::open(const std::string& name, ImageSpec& spec)
BmpInput::open(const std::string& name, ImageSpec& newspec)
{
ImageSpec emptyconfig;
return open(name, newspec, emptyconfig);
}
bool
BmpInput::open(const std::string& name, ImageSpec& newspec,
const ImageSpec& config)
{
// saving 'name' for later use
m_filename = name;
m_fd = Filesystem::fopen(m_filename, "rb");
if (!m_fd) {
errorf("Could not open file \"%s\"", name);
// BMP cannot be 1-channel, but config hint "bmp:monochrome_detect" is a
// hint to try to detect when all palette entries are gray and pretend
// that it's a 1-channel image to allow the calling app to save memory
// and time. It does this by default, but setting the hint to 0 turns
// this behavior off.
bool monodetect = config["bmp:monochrome_detect"].get<int>(1);
ioproxy_retrieve_from_config(config);
if (!ioproxy_use_or_open(name))
return false;
}
ioseek(0);
// we read header of the file that we think is BMP file
if (!m_bmp_header.read_header(m_fd)) {
errorf("\"%s\": wrong bmp header size", m_filename);
if (!m_bmp_header.read_header(ioproxy())) {
errorfmt("\"{}\": wrong bmp header size", name);
close();
return false;
}
if (!m_bmp_header.isBmp()) {
errorf("\"%s\" is not a BMP file, magic number doesn't match",
m_filename);
errorfmt("\"{}\" is not a BMP file, magic number doesn't match", name);
close();
return false;
}
if (!m_dib_header.read_header(m_fd)) {
errorf("\"%s\": wrong bitmap header size", m_filename);
if (!m_dib_header.read_header(ioproxy())) {
errorfmt("\"{}\": wrong bitmap header size", name);
close();
return false;
}
const int nchannels = (m_dib_header.bpp == 32) ? 4 : 3;
const int height = (m_dib_header.height >= 0) ? m_dib_header.height
: -m_dib_header.height;
: -m_dib_header.height;
m_spec = ImageSpec(m_dib_header.width, height, nchannels, TypeDesc::UINT8);
m_spec.attribute("XResolution", (int)m_dib_header.hres);
m_spec.attribute("YResolution", (int)m_dib_header.vres);
m_spec.attribute("ResolutionUnit", "m");
if (m_dib_header.hres > 0 && m_dib_header.vres > 0) {
m_spec.attribute("XResolution", (int)m_dib_header.hres);
m_spec.attribute("YResolution", (int)m_dib_header.vres);
m_spec.attribute("ResolutionUnit", "m");
}
// comupting size of one scanline - this is the size of one scanline that
// computing size of one scanline - this is the size of one scanline that
// is stored in the file, not in the memory
int swidth = 0;
switch (m_dib_header.bpp) {
@@ -97,6 +166,11 @@ BmpInput::open(const std::string& name, ImageSpec& spec)
m_padded_scanline_size = (m_spec.width + 3) & ~3;
if (!read_color_table())
return false;
m_allgray = monodetect && color_table_is_all_gray();
if (m_allgray) {
m_spec.nchannels = 1; // make it look like a 1-channel image
m_spec.default_channel_names();
}
break;
case 4:
swidth = (m_spec.width + 1) / 2;
@@ -111,42 +185,139 @@ BmpInput::open(const std::string& name, ImageSpec& spec)
return false;
break;
}
if (m_dib_header.bpp <= 16)
m_spec.attribute("bmp:bitsperpixel", m_dib_header.bpp);
switch (m_dib_header.size) {
case OS2_V1: m_spec.attribute("bmp:version", 1); break;
case WINDOWS_V3: m_spec.attribute("bmp:version", 3); break;
case WINDOWS_V4: m_spec.attribute("bmp:version", 4); break;
case WINDOWS_V5: m_spec.attribute("bmp:version", 5); break;
}
// file pointer is set to the beginning of image data
// we save this position - it will be helpfull in read_native_scanline
m_image_start = Filesystem::ftell(m_fd);
// Bite the bullet and uncompress now, for simplicity
if (m_dib_header.compression == RLE4_COMPRESSION
|| m_dib_header.compression == RLE8_COMPRESSION) {
if (!read_rle_image()) {
errorfmt("BMP error reading rle-compressed image");
close();
return false;
}
}
spec = m_spec;
if (m_spec.width < 1 || m_spec.height < 1 || m_spec.nchannels < 1
|| m_spec.image_bytes() < 1) {
errorfmt("Invalid image size {} x {} ({} chans, {})", m_spec.width,
m_spec.height, m_spec.nchannels, m_spec.format);
return false;
}
newspec = m_spec;
return true;
}
bool
BmpInput::read_rle_image()
{
int rletype = m_dib_header.compression == RLE4_COMPRESSION ? 4 : 8;
m_spec.attribute("compression", rletype == 4 ? "rle4" : "rle8");
m_uncompressed.clear();
m_uncompressed.resize(m_spec.height * m_spec.width);
// Note: the clear+resize zeroes out the buffer
bool ok = true;
int y = 0, x = 0;
while (ok) {
unsigned char rle_pair[2];
if (!ioread(rle_pair, 2)) {
ok = false;
break;
}
int npixels = rle_pair[0];
int value = rle_pair[1];
if (npixels == 0 && value == 0) {
// [0,0] is end of line marker
x = 0;
++y;
} else if (npixels == 0 && value == 1) {
// [0,1] is end of bitmap marker
break;
} else if (npixels == 0 && value == 2) {
// [0,2] is a "delta" -- two more bytes reposition the
// current pixel position that we're reading.
unsigned char offset[2];
ok &= ioread(offset, 2);
x += offset[0];
y += offset[1];
} else if (npixels == 0) {
// [0,n>2] is an "absolute" run of pixel data.
// n is the number of pixel indices that follow, but note
// that it pads to word size.
int npixels = value;
int nbytes = (rletype == 4)
? round_to_multiple((npixels + 1) / 2, 2)
: round_to_multiple(npixels, 2);
unsigned char absolute[256];
ok &= ioread(absolute, nbytes);
for (int i = 0; i < npixels; ++i, ++x) {
if (rletype == 4)
value = (i & 1) ? (absolute[i / 2] & 0x0f)
: (absolute[i / 2] >> 4);
else
value = absolute[i];
if (x < m_spec.width)
m_uncompressed[y * m_spec.width + x] = value;
}
} else {
// [n>0,p] is a run of n pixels.
for (int i = 0; i < npixels; ++i, ++x) {
int v;
if (rletype == 4)
v = (i & 1) ? (value & 0x0f) : (value >> 4);
else
v = value;
if (x < m_spec.width)
m_uncompressed[y * m_spec.width + x] = v;
}
}
}
return ok;
}
bool
BmpInput::read_native_scanline(int subimage, int miplevel, int y, int /*z*/,
void* data)
{
lock_guard lock(m_mutex);
lock_guard lock(*this);
if (!seek_subimage(subimage, miplevel))
return false;
if (y < 0 || y > m_spec.height)
return false;
size_t scanline_bytes = m_spec.scanline_bytes();
uint8_t* mscanline = (uint8_t*)data;
if (m_dib_header.compression == RLE4_COMPRESSION
|| m_dib_header.compression == RLE8_COMPRESSION) {
for (int x = 0; x < m_spec.width; ++x) {
int p = m_uncompressed[(m_spec.height - 1 - y) * m_spec.width + x];
mscanline[3 * x] = m_colortable[p].r;
mscanline[3 * x + 1] = m_colortable[p].g;
mscanline[3 * x + 2] = m_colortable[p].b;
}
return true;
}
// if the height is positive scanlines are stored bottom-up
if (m_dib_header.width >= 0)
if (m_dib_header.height >= 0)
y = m_spec.height - y - 1;
const int64_t scanline_off = y * m_padded_scanline_size;
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))
errorf("Hit end of file unexpectedly");
else
errorf("read error");
fscanline.resize(m_padded_scanline_size);
ioseek(m_bmp_header.offset + scanline_off);
if (!ioread(fscanline.data(), m_padded_scanline_size)) {
return false; // Read failed
}
@@ -157,13 +328,10 @@ 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.get(), m_spec.scanline_bytes());
memcpy(data, fscanline.data(), m_spec.scanline_bytes());
return true;
}
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;
@@ -176,18 +344,28 @@ 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 < 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_allgray) {
// Keep it as 1-channel image because all colors are gray
for (unsigned int i = 0; i < scanline_bytes; ++i) {
mscanline[i] = m_colortable[fscanline[i]].r;
}
} else {
// Expand palette image into 3-channel RGB (existing code)
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 < scanline_bytes; ++i, j += 6) {
for (unsigned int i = 0, j = 0; j < 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;
mscanline[j + 2] = m_colortable[(fscanline[i] & mask) >> 4].b;
if (j + 3 >= scanline_bytes)
break;
mask = 0x0F;
mscanline[j + 3] = m_colortable[fscanline[i] & mask].r;
mscanline[j + 4] = m_colortable[fscanline[i] & mask].g;
@@ -208,18 +386,14 @@ BmpInput::read_native_scanline(int subimage, int miplevel, int y, int /*z*/,
}
}
}
memcpy(data, &mscanline[0], scanline_bytes);
return true;
}
bool inline BmpInput::close(void)
bool
BmpInput::close(void)
{
if (m_fd) {
fclose(m_fd);
m_fd = NULL;
}
init();
return true;
}
@@ -233,25 +407,44 @@ BmpInput::read_color_table(void)
// if this field is 0 - color table has max colors:
// pow(2, m_dib_header.cpalete) otherwise color table have
// m_dib_header.cpalete entries
if (m_dib_header.cpalete < 0
|| m_dib_header.cpalete > (1 << m_dib_header.bpp)) {
errorfmt("Possible corrupted header, invalid palette size");
return false;
}
const int32_t colors = (m_dib_header.cpalete) ? m_dib_header.cpalete
: 1 << m_dib_header.bpp;
size_t entry_size = 4;
// if the file is OS V2 bitmap color table entr has only 3 bytes, not four
size_t entry_size = 4;
// if the file is OS V2 bitmap color table entry has only 3 bytes, not four
if (m_dib_header.size == OS2_V1)
entry_size = 3;
m_colortable.resize(colors);
for (int i = 0; i < colors; i++) {
size_t n = fread(&m_colortable[i], 1, entry_size, m_fd);
if (n != entry_size) {
if (feof(m_fd))
errorf(
"Hit end of file unexpectedly while reading color table");
if (!ioread(&m_colortable[i], entry_size)) {
if (ioeof())
errorfmt(
"Hit end of file unexpectedly while reading color table on color {}/{})",
i, colors);
else
errorf("read error while reading color table");
errorfmt("read error while reading color table");
return false; // Read failed
}
}
return true; // ok
}
bool
BmpInput::color_table_is_all_gray(void)
{
size_t ncolors = m_colortable.size();
for (size_t i = 0; i < ncolors; i++) {
color_table& color = m_colortable[i];
if (color.b != color.g || color.g != color.r)
return false;
}
return true;
}
OIIO_PLUGIN_NAMESPACE_END
+108 -62
View File
@@ -1,7 +1,11 @@
// Copyright 2008-present Contributors to the OpenImageIO project.
// SPDX-License-Identifier: BSD-3-Clause
// https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
// https://github.com/OpenImageIO/oiio
#include <cstdio>
#include <OpenImageIO/filesystem.h>
#include <OpenImageIO/imageio.h>
#include <OpenImageIO/strutil.h>
#include "bmp_pvt.h"
@@ -11,6 +15,46 @@ OIIO_PLUGIN_NAMESPACE_BEGIN
using namespace bmp_pvt;
class BmpOutput final : public ImageOutput {
public:
BmpOutput() { init(); }
virtual ~BmpOutput() { close(); }
virtual const char* format_name(void) const override { return "bmp"; }
virtual int supports(string_view feature) const override;
virtual bool open(const std::string& name, const ImageSpec& spec,
OpenMode mode) override;
virtual bool close(void) override;
virtual bool write_scanline(int y, int z, TypeDesc format, const void* data,
stride_t xstride) override;
virtual bool write_tile(int x, int y, int z, TypeDesc format,
const void* data, stride_t xstride,
stride_t ystride, stride_t zstride) override;
private:
int64_t m_padded_scanline_size;
std::string m_filename;
bmp_pvt::BmpFileHeader m_bmp_header;
bmp_pvt::DibInformationHeader m_dib_header;
int64_t m_image_start;
unsigned int m_dither;
std::vector<unsigned char> m_tilebuffer;
std::vector<unsigned char> m_scratch;
std::vector<unsigned char> m_buf; // more tmp space for write_scanline
void init(void)
{
m_padded_scanline_size = 0;
m_filename.clear();
ioproxy_clear();
}
void create_and_write_file_header(void);
void create_and_write_bitmap_header(void);
};
// Obligatory material to make this a recognizeable imageio plugin
OIIO_PLUGIN_EXPORTS_BEGIN
@@ -29,7 +73,7 @@ OIIO_PLUGIN_EXPORTS_END
int
BmpOutput::supports(string_view feature) const
{
return (feature == "alpha");
return (feature == "alpha" || feature == "ioproxy");
}
@@ -38,7 +82,7 @@ bool
BmpOutput::open(const std::string& name, const ImageSpec& spec, OpenMode mode)
{
if (mode != Create) {
errorf("%s does not support subimages or MIP levels", format_name());
errorfmt("{} does not support subimages or MIP levels", format_name());
return false;
}
@@ -46,9 +90,10 @@ BmpOutput::open(const std::string& name, const ImageSpec& spec, OpenMode mode)
m_filename = name;
m_spec = spec;
if (m_spec.nchannels != 3 && m_spec.nchannels != 4) {
errorf("%s does not support %d-channel images\n", format_name(),
m_spec.nchannels);
if (m_spec.nchannels != 1 && m_spec.nchannels != 3
&& m_spec.nchannels != 4) {
errorfmt("{} does not support {}-channel images\n", format_name(),
m_spec.nchannels);
return false;
}
@@ -58,22 +103,21 @@ BmpOutput::open(const std::string& name, const ImageSpec& spec, OpenMode mode)
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());
errorfmt("{} does not support files over 4GB in size\n", format_name());
return false;
}
m_fd = Filesystem::fopen(m_filename, "wb");
if (!m_fd) {
errorf("Could not open \"%s\"", m_filename);
ioproxy_retrieve_from_config(m_spec);
if (!ioproxy_use_or_open(name))
return false;
}
// Scanline size is rounded up to align to 4-byte boundary
m_padded_scanline_size = round_to_multiple(m_spec.scanline_bytes(), 4);
create_and_write_file_header();
create_and_write_bitmap_header();
// Scanline size is rounded up to align to 4-byte boundary
m_padded_scanline_size = ((m_spec.width * m_spec.nchannels) + 3) & ~3;
m_image_start = Filesystem::ftell(m_fd);
m_image_start = iotell();
// If user asked for tiles -- which this format doesn't support, emulate
// it by buffering the whole image.
@@ -90,7 +134,7 @@ BmpOutput::write_scanline(int y, int z, TypeDesc format, const void* data,
stride_t xstride)
{
if (y > m_spec.height) {
errorf("Attempt to write too many scanlines to %s", m_filename);
errorfmt("Attempt to write too many scanlines to {}", m_filename);
close();
return false;
}
@@ -98,23 +142,21 @@ BmpOutput::write_scanline(int y, int z, TypeDesc format, const void* data,
if (m_spec.width >= 0)
y = (m_spec.height - y - 1);
int64_t scanline_off = y * m_padded_scanline_size;
Filesystem::fseek(m_fd, m_image_start + scanline_off, SEEK_SET);
ioseek(m_image_start + scanline_off);
std::vector<unsigned char> scratch;
data = to_native_scanline(format, data, xstride, scratch, m_dither, y, z);
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
m_scratch.clear();
data = to_native_scanline(format, data, xstride, m_scratch, m_dither, y, z);
m_buf.assign((const unsigned char*)data,
(const unsigned char*)data + m_spec.scanline_bytes());
m_buf.resize(m_padded_scanline_size, 0); // pad with zeroes if needed
// Swap RGB pixels into BGR format
if (m_spec.nchannels >= 3)
for (int i = 0, iend = buf.size() - 2; i < iend; i += m_spec.nchannels)
std::swap(buf[i], buf[i + 2]);
for (int i = 0, iend = m_buf.size() - 2; i < iend;
i += m_spec.nchannels)
std::swap(m_buf[i], m_buf[i + 2]);
size_t byte_count = fwrite(&buf[0], 1, buf.size(), m_fd);
return byte_count == buf.size(); // true if wrote all bytes (no error)
return iowrite(&m_buf[0], m_buf.size());
}
@@ -133,7 +175,7 @@ BmpOutput::write_tile(int x, int y, int z, TypeDesc format, const void* data,
bool
BmpOutput::close(void)
{
if (!m_fd) { // already closed
if (!ioproxy_opened()) { // already closed
init();
return true;
}
@@ -147,8 +189,7 @@ BmpOutput::close(void)
std::vector<unsigned char>().swap(m_tilebuffer);
}
fclose(m_fd);
m_fd = NULL;
init();
return ok;
}
@@ -157,15 +198,15 @@ void
BmpOutput::create_and_write_file_header(void)
{
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;
m_bmp_header.offset = BMP_HEADER_SIZE + WINDOWS_V3;
int64_t data_size = m_padded_scanline_size * m_spec.height;
int palettesize = (m_spec.nchannels == 1) ? 4 * 256 : 0;
int64_t file_size = data_size + BMP_HEADER_SIZE + WINDOWS_V3 + palettesize;
m_bmp_header.fsize = file_size;
m_bmp_header.res1 = 0;
m_bmp_header.res2 = 0;
m_bmp_header.offset = BMP_HEADER_SIZE + WINDOWS_V3 + palettesize;
m_bmp_header.write_header(m_fd);
m_bmp_header.write_header(ioproxy());
}
@@ -177,33 +218,38 @@ BmpOutput::create_and_write_bitmap_header(void)
m_dib_header.width = m_spec.width;
m_dib_header.height = m_spec.height;
m_dib_header.cplanes = 1;
m_dib_header.compression = 0;
m_dib_header.compression = NO_COMPRESSION;
m_dib_header.bpp = m_spec.nchannels << 3;
m_dib_header.isize = m_spec.width * m_spec.height * m_spec.nchannels;
m_dib_header.hres = 0;
m_dib_header.vres = 0;
m_dib_header.cpalete = 0;
m_dib_header.important = 0;
ParamValue* p = NULL;
p = m_spec.find_attribute("ResolutionUnit", TypeDesc::STRING);
if (p && p->data()) {
std::string res_units = *(char**)p->data();
if (Strutil::iequals(res_units, "m")
|| Strutil::iequals(res_units, "pixel per meter")) {
ParamValue *resx = NULL, *resy = NULL;
resx = m_spec.find_attribute("XResolution", TypeDesc::INT32);
if (resx && resx->data())
m_dib_header.hres = *(int*)resx->data();
resy = m_spec.find_attribute("YResolution", TypeDesc::INT32);
if (resy && resy->data())
m_dib_header.vres = *(int*)resy->data();
}
if (m_spec.nchannels == 1) {
// Special case -- write a 1-channel image as a gray palette
m_dib_header.bpp = 8;
m_dib_header.cpalete = 256;
m_dib_header.important = 256;
} else {
m_dib_header.bpp = m_spec.nchannels * 8;
m_dib_header.cpalete = 0;
m_dib_header.important = 0;
}
m_dib_header.write_header(m_fd);
m_dib_header.isize = int32_t(m_spec.image_pixels());
m_dib_header.hres = 0;
m_dib_header.vres = 0;
string_view res_units = m_spec.get_string_attribute("ResolutionUnit");
if (Strutil::iequals(res_units, "m")
|| Strutil::iequals(res_units, "pixel per meter")) {
m_dib_header.hres = m_spec.get_int_attribute("XResolution");
m_dib_header.vres = m_spec.get_int_attribute("YResolution");
}
m_dib_header.write_header(ioproxy());
// Write palette, if there is one. This is only used for grayscale
// images, and the palette is just the 256 possible gray values.
for (int i = 0; i < m_dib_header.cpalete; ++i) {
unsigned char val[4] = { uint8_t(i), uint8_t(i), uint8_t(i), 255 };
iowrite(&val, 4);
}
}
OIIO_PLUGIN_NAMESPACE_END
-266
View File
@@ -1,266 +0,0 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT (openexr)
SET(OPENEXR_VERSION_MAJOR "2")
SET(OPENEXR_VERSION_MINOR "2")
SET(OPENEXR_VERSION_PATCH "0")
SET(OPENEXR_VERSION ${OPENEXR_VERSION_MAJOR}.${OPENEXR_VERSION_MINOR}.${OPENEXR_VERSION_PATCH})
SET(OPENEXR_VERSION_API ${OPENEXR_VERSION_MAJOR}_${OPENEXR_VERSION_MINOR})
# enable the tests
ENABLE_TESTING()
# distro building
SET(CPACK_PACKAGE_VERSION_MAJOR "${OPENEXR_VERSION_MAJOR}")
SET(CPACK_PACKAGE_VERSION_MINOR "${OPENEXR_VERSION_MINOR}")
SET(CPACK_PACKAGE_VERSION_PATCH "${OPENEXR_VERSION_PATCH}")
SET(CPACK_SOURCE_GENERATOR "TGZ")
set(CPACK_SOURCE_PACKAGE_FILE_NAME
"${CMAKE_PROJECT_NAME}-${OPENEXR_VERSION}"
)
set(CPACK_SOURCE_IGNORE_FILES
"/.git*;/.cvs*;${CPACK_SOURCE_IGNORE_FILES}")
INCLUDE ( CPack )
# Allow the developer to select if Dynamic or Static libraries are built
OPTION (BUILD_SHARED_LIBS "Build Shared Libraries" ON)
OPTION (USE_ZLIB_WINAPI "Use ZLib Win API" OFF)
OPTION (NAMESPACE_VERSIONING "Use Namespace Versioning" ON)
OPTION (BUILD_UTILS "Build the binary/utility programs" ON)
OPTION (BUILD_TESTS "Build the tests" ON)
# Setup osx rpathing
SET (CMAKE_MACOSX_RPATH 1)
SET (BUILD_WITH_INSTALL_RPATH 1)
ADD_DEFINITIONS ( -DHAVE_CONFIG_H -DILM_IMF_TEST_IMAGEDIR="${CMAKE_SOURCE_DIR}/IlmImfTest/" )
INCLUDE_DIRECTORIES (
${CMAKE_CURRENT_BINARY_DIR}/config
IlmImf
IlmImfUtil
exrmaketiled
exrenvmap
exrmakepreview
exrmultiview
IlmImfFuzzTest
)
FIND_PACKAGE(ZLIB REQUIRED)
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
IF (NOT WIN32)
SET ( PTHREAD_LIB pthread )
ENDIF()
INCLUDE_DIRECTORIES ( ${ILMBASE_PACKAGE_PREFIX}/include/OpenEXR )
LINK_DIRECTORIES ( ${ILMBASE_PACKAGE_PREFIX}/lib )
MESSAGE ( "ILMBASE_PACKAGE_PREFIX = " ${ILMBASE_PACKAGE_PREFIX})
SET (LIB_TYPE STATIC)
IF (BUILD_SHARED_LIBS)
# User wants to build Dynamic Libraries, so change the LIB_TYPE variable to CMake keyword 'SHARED'
SET (LIB_TYPE SHARED)
IF (WIN32)
ADD_DEFINITIONS(-DOPENEXR_DLL)
ENDIF ()
ENDIF ()
IF (USE_ZLIB_WINAPI)
ADD_DEFINITIONS(-DZLIB_WINAPI)
ENDIF ()
# Test for GCC-style inline asm support with AVX instructions
INCLUDE (CheckCXXSourceCompiles)
CHECK_CXX_SOURCE_COMPILES (
"
int main()
{
#if defined(__GNUC__) && defined(__SSE2__)
int n = 0;
int eax = 0;
int edx = 0;
__asm__(
\"xgetbv ;\"
\"vzeroupper \"
: \"=a\"(eax), \"=d\"(edx) : \"c\"(n) : );
#else
#error No GCC style inline asm supported for AVX instructions
#endif
}
" HAVE_GCC_INLINE_ASM_AVX)
# Check if sysconf(_SC_NPROCESSORS_ONLN) can be used for CPU count
CHECK_CXX_SOURCE_COMPILES (
"
#include <unistd.h>
int main()
{
sysconf(_SC_NPROCESSORS_ONLN);
}
" HAVE_SYSCONF_NPROCESSORS_ONLN)
##########################
# OpenEXRConfig.h generation
##########################
IF (WIN32)
FILE ( WRITE ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "#define OPENEXR_IMF_HAVE_COMPLETE_IOMANIP 1\n" )
ELSEIF (APPLE)
FILE ( WRITE ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "#define OPENEXR_IMF_HAVE_DARWIN 1\n" )
FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "#define OPENEXR_IMF_HAVE_COMPLETE_IOMANIP 1\n" )
FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "#include <string.h>\n" )
ELSE ()
# Linux
FILE ( WRITE ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "#define OPENEXR_IMF_HAVE_LINUX_PROCFS 1\n" )
FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "#define OPENEXR_IMF_HAVE_COMPLETE_IOMANIP 1\n" )
FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "#define OPENEXR_IMF_HAVE_LARGE_STACK 1\n" )
ENDIF()
IF (NAMESPACE_VERSIONING)
FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "#define OPENEXR_IMF_INTERNAL_NAMESPACE_CUSTOM 1\n")
FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "#define OPENEXR_IMF_NAMESPACE Imf\n" )
FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "#define OPENEXR_IMF_INTERNAL_NAMESPACE Imf_${OPENEXR_VERSION_API}\n\n" )
ELSE ()
FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "#define OPENEXR_IMF_INTERNAL_NAMESPACE_CUSTOM 0\n")
FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "#define OPENEXR_IMF_NAMESPACE Imf\n" )
FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "#define OPENEXR_IMF_INTERNAL_NAMESPACE Imf\n\n" )
ENDIF ()
FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "#define OPENEXR_VERSION_STRING \"${OPENEXR_VERSION}\"\n" )
FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "#define OPENEXR_PACKAGE_STRING \"OpenEXR ${OPENEXR_VERSION}\"\n" )
FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "
#define OPENEXR_VERSION_MAJOR ${OPENEXR_VERSION_MAJOR}
#define OPENEXR_VERSION_MINOR ${OPENEXR_VERSION_MINOR}
#define OPENEXR_VERSION_PATCH ${OPENEXR_VERSION_PATCH}
")
FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "
// Version as a single hex number, e.g. 0x01000300 == 1.0.3
#define OPENEXR_VERSION_HEX ((OPENEXR_VERSION_MAJOR << 24) | \\
(OPENEXR_VERSION_MINOR << 16) | \\
(OPENEXR_VERSION_PATCH << 8))\n
")
IF (HAVE_GCC_INLINE_ASM_AVX)
FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "#define OPENEXR_IMF_HAVE_GCC_INLINE_ASM_AVX 1\n" )
ENDIF()
IF (HAVE_SYSCONF_NPROCESSORS_ONLN)
FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "#define OPENEXR_IMF_HAVE_SYSCONF_NPROCESSORS_ONLN 1\n" )
ENDIF()
SET (OPENEXR_LIBSUFFIX "")
SET (ILMBASE_LIBSUFFIX "")
IF (NAMESPACE_VERSIONING)
SET ( OPENEXR_LIBSUFFIX "-${OPENEXR_VERSION_API}" )
# assume same NAMESPACE_VERSION setting for IlmBase for now
SET ( ILMBASE_LIBSUFFIX "-${OPENEXR_VERSION_API}" )
ENDIF ()
##########################
# IlmImf library
##########################
ADD_SUBDIRECTORY ( IlmImf )
SET_TARGET_PROPERTIES ( IlmImf
PROPERTIES
VERSION 22.0.0
SOVERSION 22
OUTPUT_NAME "IlmImf${OPENEXR_LIBSUFFIX}"
)
##########################
# IlmImfUtil library
##########################
ADD_SUBDIRECTORY ( IlmImfUtil )
SET_TARGET_PROPERTIES ( IlmImfUtil
PROPERTIES
VERSION 22.0.0
SOVERSION 22
OUTPUT_NAME "IlmImfUtil${OPENEXR_LIBSUFFIX}"
)
##########################
# Example Code
##########################
ADD_SUBDIRECTORY ( IlmImfExamples )
##########################
# Tests
##########################
if (BUILD_TESTS)
ADD_SUBDIRECTORY ( IlmImfTest )
ADD_SUBDIRECTORY ( IlmImfUtilTest )
ADD_SUBDIRECTORY ( IlmImfFuzzTest )
endif ()
##########################
# Binaries / Utilities
##########################
if (BUILD_UTILS)
ADD_SUBDIRECTORY ( exrheader )
ADD_SUBDIRECTORY ( exrmaketiled )
ADD_SUBDIRECTORY ( exrstdattr )
ADD_SUBDIRECTORY ( exrmakepreview )
ADD_SUBDIRECTORY ( exrenvmap )
ADD_SUBDIRECTORY ( exrmultiview )
ADD_SUBDIRECTORY ( exrmultipart )
endif ()
##########################
# Installation
##########################
INSTALL ( FILES
${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h
DESTINATION
${CMAKE_INSTALL_PREFIX}/include/OpenEXR
)
# Documentation
INSTALL ( FILES
doc/TechnicalIntroduction.pdf
doc/ReadingAndWritingImageFiles.pdf
doc/OpenEXRFileLayout.pdf
doc/MultiViewOpenEXR.pdf
doc/InterpretingDeepPixels.pdf
doc/TheoryDeepPixels.pdf
DESTINATION
${CMAKE_INSTALL_PREFIX}/share/doc/OpenEXR-${OPENEXR_VERSION}
)
# Examples
INSTALL ( FILES
IlmImfExamples/main.cpp
IlmImfExamples/drawImage.cpp
IlmImfExamples/rgbaInterfaceExamples.cpp
IlmImfExamples/rgbaInterfaceTiledExamples.cpp
IlmImfExamples/generalInterfaceExamples.cpp
IlmImfExamples/lowLevelIoExamples.cpp
IlmImfExamples/previewImageExamples.cpp
IlmImfExamples/generalInterfaceTiledExamples.cpp
IlmImfExamples/generalInterfaceTiledExamples.h
IlmImfExamples/drawImage.h
IlmImfExamples/rgbaInterfaceExamples.h
IlmImfExamples/generalInterfaceExamples.h
IlmImfExamples/rgbaInterfaceTiledExamples.h
IlmImfExamples/lowLevelIoExamples.h
IlmImfExamples/previewImageExamples.h
IlmImfExamples/namespaceAlias.h
DESTINATION
${CMAKE_INSTALL_PREFIX}/share/doc/OpenEXR-${OPENEXR_VERSION}/examples
)
@@ -1,273 +0,0 @@
# yue.nicholas@gmail.com
SET(CMAKE_INCLUDE_CURRENT_DIR 1)
if (NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/b44ExpLogTable.h")
ADD_EXECUTABLE ( b44ExpLogTable
b44ExpLogTable.cpp
)
TARGET_LINK_LIBRARIES ( b44ExpLogTable
Half
Iex${ILMBASE_LIBSUFFIX}
IlmThread${ILMBASE_LIBSUFFIX}
${PTHREAD_LIB}
)
ADD_CUSTOM_COMMAND (
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/b44ExpLogTable.h
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/b44ExpLogTable > ${CMAKE_CURRENT_BINARY_DIR}/b44ExpLogTable.h
DEPENDS b44ExpLogTable
)
else ()
message (STATUS "Skipping build of b44ExpLogTable.h")
endif ()
if (NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/dwaLookups.h")
ADD_EXECUTABLE ( dwaLookups
dwaLookups.cpp
)
TARGET_LINK_LIBRARIES ( dwaLookups
Half
Iex${ILMBASE_LIBSUFFIX}
IlmThread${ILMBASE_LIBSUFFIX}
${PTHREAD_LIB}
)
ADD_CUSTOM_COMMAND (
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/dwaLookups.h
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/dwaLookups > ${CMAKE_CURRENT_BINARY_DIR}/dwaLookups.h
DEPENDS dwaLookups
)
else ()
message (STATUS "Skipping build of dwaLookups.h")
endif ()
SET ( ILMIMF_SRCS
ImfAttribute.cpp
ImfBoxAttribute.cpp
ImfCRgbaFile.cpp
ImfChannelList.cpp
ImfChannelListAttribute.cpp
ImfFloatAttribute.cpp
ImfFrameBuffer.cpp
ImfHeader.cpp
ImfIO.cpp
ImfInputFile.cpp
ImfIntAttribute.cpp
ImfLineOrderAttribute.cpp
ImfMatrixAttribute.cpp
ImfOpaqueAttribute.cpp
ImfOutputFile.cpp
ImfRgbaFile.cpp
ImfStringAttribute.cpp
ImfVecAttribute.cpp
ImfHuf.cpp
ImfThreading.cpp
ImfWav.cpp
ImfLut.cpp
ImfCompressor.cpp
ImfRleCompressor.cpp
ImfZipCompressor.cpp
ImfPizCompressor.cpp
ImfB44Compressor.cpp
ImfDwaCompressor.cpp
ImfMisc.cpp
ImfCompressionAttribute.cpp
ImfDoubleAttribute.cpp
ImfConvert.cpp
ImfPreviewImage.cpp
ImfPreviewImageAttribute.cpp
ImfVersion.cpp
ImfChromaticities.cpp
ImfChromaticitiesAttribute.cpp
ImfKeyCode.cpp
ImfKeyCodeAttribute.cpp
ImfTimeCode.cpp
ImfTimeCodeAttribute.cpp
ImfRational.cpp
ImfRationalAttribute.cpp
ImfFramesPerSecond.cpp
ImfStandardAttributes.cpp
ImfStdIO.cpp
ImfEnvmap.cpp
ImfEnvmapAttribute.cpp
ImfScanLineInputFile.cpp
ImfTiledInputFile.cpp
ImfTiledMisc.cpp
ImfTiledOutputFile.cpp
ImfTiledRgbaFile.cpp
ImfTileDescriptionAttribute.cpp
ImfTileOffsets.cpp
ImfRgbaYca.cpp
ImfPxr24Compressor.cpp
ImfTestFile.cpp
ImfStringVectorAttribute.cpp
ImfMultiView.cpp
ImfAcesFile.cpp
ImfMultiPartOutputFile.cpp
ImfGenericOutputFile.cpp
ImfOutputPartData.cpp
ImfMultiPartInputFile.cpp
ImfGenericInputFile.cpp
ImfPartType.cpp
ImfInputPartData.cpp
ImfOutputPart.cpp
ImfTiledOutputPart.cpp
ImfInputPart.cpp
ImfTiledInputPart.cpp
ImfDeepScanLineInputPart.cpp
ImfDeepScanLineOutputPart.cpp
ImfDeepScanLineInputFile.cpp
ImfDeepScanLineOutputFile.cpp
ImfDeepTiledInputPart.cpp
ImfDeepTiledOutputPart.cpp
ImfDeepTiledInputFile.cpp
ImfDeepTiledOutputFile.cpp
ImfDeepFrameBuffer.cpp
ImfDeepCompositing.cpp
ImfCompositeDeepScanLine.cpp
ImfDeepImageStateAttribute.cpp
ImfFastHuf.cpp
ImfFloatVectorAttribute.cpp
ImfRle.cpp
ImfSystemSpecific.cpp
ImfZip.cpp
)
IF (BUILD_SHARED_LIBS)
ADD_DEFINITIONS(-DILMIMF_EXPORTS)
ENDIF()
ADD_LIBRARY ( IlmImf ${LIB_TYPE}
${ILMIMF_SRCS}
)
TARGET_LINK_LIBRARIES ( IlmImf
Half
Iex${ILMBASE_LIBSUFFIX}
Imath${ILMBASE_LIBSUFFIX}
IlmThread${ILMBASE_LIBSUFFIX}
${PTHREAD_LIB} ${ZLIB_LIBRARIES}
)
ADD_DEPENDENCIES ( IlmImf b44ExpLogTable )
SET_SOURCE_FILES_PROPERTIES (
ImfB44Compressor.cpp
PROPERTIES
OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/b44ExpLogTable.h
)
ADD_DEPENDENCIES ( IlmImf dwaLookups )
SET_SOURCE_FILES_PROPERTIES (
ImfDwaCompressor.cpp
PROPERTIES
OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/dwaLookups.h
)
# Libraries
INSTALL ( TARGETS
IlmImf
DESTINATION
${CMAKE_INSTALL_PREFIX}/lib
)
# Headers
INSTALL ( FILES
ImfForward.h
ImfExport.h
ImfAttribute.h
ImfBoxAttribute.h
ImfCRgbaFile.h
ImfChannelList.h
ImfChannelListAttribute.h
ImfCompressionAttribute.h
ImfDoubleAttribute.h
ImfFloatAttribute.h
ImfFrameBuffer.h
ImfHeader.h
ImfIO.h
ImfInputFile.h
ImfIntAttribute.h
ImfLineOrderAttribute.h
ImfMatrixAttribute.h
ImfOpaqueAttribute.h
ImfOutputFile.h
ImfRgbaFile.h
ImfStringAttribute.h
ImfVecAttribute.h
ImfHuf.h
ImfWav.h
ImfLut.h
ImfArray.h
ImfCompression.h
ImfLineOrder.h
ImfName.h
ImfPixelType.h
ImfVersion.h
ImfXdr.h
ImfConvert.h
ImfPreviewImage.h
ImfPreviewImageAttribute.h
ImfChromaticities.h
ImfChromaticitiesAttribute.h
ImfKeyCode.h
ImfKeyCodeAttribute.h
ImfTimeCode.h
ImfTimeCodeAttribute.h
ImfRational.h
ImfRationalAttribute.h
ImfFramesPerSecond.h
ImfStandardAttributes.h
ImfEnvmap.h
ImfEnvmapAttribute.h
ImfInt64.h
ImfRgba.h
ImfTileDescription.h
ImfTileDescriptionAttribute.h
ImfTiledInputFile.h
ImfTiledOutputFile.h
ImfTiledRgbaFile.h
ImfRgbaYca.h
ImfTestFile.h
ImfThreading.h
ImfB44Compressor.h
ImfStringVectorAttribute.h
ImfMultiView.h
ImfAcesFile.h
ImfMultiPartOutputFile.h
ImfGenericOutputFile.h
ImfMultiPartInputFile.h
ImfGenericInputFile.h
ImfPartType.h
ImfPartHelper.h
ImfOutputPart.h
ImfTiledOutputPart.h
ImfInputPart.h
ImfTiledInputPart.h
ImfDeepScanLineOutputFile.h
ImfDeepScanLineOutputPart.h
ImfDeepScanLineInputFile.h
ImfDeepScanLineInputPart.h
ImfDeepTiledInputFile.h
ImfDeepTiledInputPart.h
ImfDeepTiledOutputFile.h
ImfDeepTiledOutputPart.h
ImfDeepFrameBuffer.h
ImfDeepCompositing.h
ImfCompositeDeepScanLine.h
ImfNamespace.h
ImfMisc.h
ImfDeepImageState.h
ImfDeepImageStateAttribute.h
ImfFloatVectorAttribute.h
DESTINATION
${CMAKE_INSTALL_PREFIX}/include/OpenEXR
)
+2 -2
View File
@@ -6,5 +6,5 @@ includedir=${prefix}/include
Name: OpenImageIO
Description: OpenImageIO is a library for reading and writing images.
Version: @PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@.@PROJECT_VERSION_TWEAK@
Libs: -L${libdir} -lOpenImageIO
Cflags: -I${includedir}/OpenImageIO
Libs: -L${libdir} -lOpenImageIO -lOpenImageIO_Util
Cflags: -I${includedir}
Binary file not shown.
+57
View File
@@ -0,0 +1,57 @@
#!/usr/bin/env bash
# Utility script to download and build OpenJPEG
#
# 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 OpenJPEG to download if we don't have it yet
OPENJPEG_REPO=${OPENJPEG_REPO:=https://github.com/uclouvain/openjpeg.git}
OPENJPEG_VERSION=${OPENJPEG_VERSION:=v2.4.0}
# Where to put OpenJPEG repo source (default to the ext area)
LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=${PWD}/ext}
OPENJPEG_SRC_DIR=${OPENJPEG_SRC_DIR:=${LOCAL_DEPS_DIR}/OpenJPEG}
OPENJPEG_BUILD_DIR=${OPENJPEG_BUILD_DIR:=${OPENJPEG_SRC_DIR}/build}
OPENJPEG_INSTALL_DIR=${OPENJPEG_INSTALL_DIR:=${LOCAL_DEPS_DIR}/dist}
#OPENJPEG_CONFIG_OPTS=${OPENJPEG_CONFIG_OPTS:=}
pwd
echo "OpenJPEG install dir will be: ${OPENJPEG_INSTALL_DIR}"
mkdir -p ./ext
pushd ./ext
# Clone OpenJPEG project from GitHub and build
if [[ ! -e ${OPENJPEG_SRC_DIR} ]] ; then
echo "git clone ${OPENJPEG_REPO} ${OPENJPEG_SRC_DIR}"
git clone ${OPENJPEG_REPO} ${OPENJPEG_SRC_DIR}
fi
cd ${OPENJPEG_SRC_DIR}
echo "git checkout ${OPENJPEG_VERSION} --force"
git checkout ${OPENJPEG_VERSION} --force
mkdir -p ${OPENJPEG_BUILD_DIR} && true
cd ${OPENJPEG_BUILD_DIR}
if [[ -z $DEP_DOWNLOAD_ONLY ]]; then
time cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${OPENJPEG_INSTALL_DIR} \
-DBUILD_CODEC=OFF \
${OPENJPEG_CONFIG_OPTS} ..
time cmake --build . --config Release --target install
fi
# ls -R ${OPENJPEG_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 OpenJPEG_ROOT=$OPENJPEG_INSTALL_DIR
+48
View File
@@ -0,0 +1,48 @@
#!/usr/bin/env bash
# Utility script to download and build Ptex
#
# 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 ptex to download if we don't have it yet
: ${PTEX_REPO:=https://github.com/wdas/ptex.git}
: ${PTEX_VERSION:=v2.4.0}
: ${PTEX_SRC_DIR:=${PWD}/ext/ptex}
: ${PTEX_BUILD_DIR:=${PTEX_SRC_DIR}/build}
: ${PTEX_INSTALL_DIR:=${PWD}/ext/dist}
pwd
echo "Ptex install dir will be: ${PTEX_INSTALL_DIR}"
mkdir -p ./ext
pushd ./ext
# Clone ptex project from GitHub and build
if [[ ! -e ${PTEX_SRC_DIR} ]] ; then
echo "git clone ${PTEX_REPO} ${PTEX_SRC_DIR}"
git clone ${PTEX_REPO} ${PTEX_SRC_DIR}
fi
cd ${PTEX_SRC_DIR}
echo "git checkout ${PTEX_VERSION} --force"
git checkout ${PTEX_VERSION} --force
mkdir -p ${PTEX_BUILD_DIR}
cd ${PTEX_BUILD_DIR}
time cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${PTEX_INSTALL_DIR} \
${PTEX_CONFIG_OPTS} ..
time cmake --build . --config Release --target install
# ls -R ${PTEX_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 Ptex_ROOT=$PTEX_INSTALL_DIR
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${PTEX_INSTALL_DIR}/lib:${PTEX_INSTALL_DIR}/lib64
+1 -1
View File
@@ -22,7 +22,7 @@ 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}
tar -xjf 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:
+51
View File
@@ -0,0 +1,51 @@
#!/usr/bin/env bash
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio
# Utility script to download and build giflib
# Exit the whole script if any command fails.
set -ex
GIFLIB_REPO=${GIFLIB_REPO:=https://gitlab.com/giflib/giflib.git}
LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=${PWD}/ext}
GIFLIB_BUILD_DIR=${GIFLIB_BUILD_DIR:=${LOCAL_DEPS_DIR}/giflib}
GIFLIB_INSTALL_DIR=${GIFLIB_INSTALL_DIR:=${PWD}/ext/dist}
GIFLIB_VERSION=${GIFLIB_VERSION:=5.2.1}
GIFLIB_CC=${GIFLIB_CC:=gcc}
BASEDIR=`pwd`
pwd
echo "giflib install dir will be: ${GIFLIB_INSTALL_DIR}"
mkdir -p ${LOCAL_DEPS_DIR}
pushd ${LOCAL_DEPS_DIR}
# Clone giflib project and build
if [[ ! -e giflib-${GIFLIB_VERSION} ]] ; then
curl --location https://downloads.sourceforge.net/project/giflib/giflib-${GIFLIB_VERSION}.tar.gz -o giflib.tar.gz
tar xzf giflib.tar.gz
pushd giflib-${GIFLIB_VERSION}
cp Makefile Makefile.old
curl --location https://sourceforge.net/p/giflib/bugs/_discuss/thread/4e811ad29b/c323/attachment/Makefile.patch -o Makefile.patch
patch -p0 < Makefile.patch
popd
fi
cd giflib-${GIFLIB_VERSION}
if [[ -z $DEP_DOWNLOAD_ONLY ]]; then
time make PREFIX=${GIFLIB_INSTALL_DIR} CC=${GIFLIB_CC} install
fi
popd
# ls -R ${GIFLIB_INSTALL_DIR} && true
# Set up paths. These will only affect the caller if this script is
# run with 'source' rather than in a separate shell.
export GIF_ROOT=$GIFLIB_INSTALL_DIR
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${GIFLIB_INSTALL_DIR}/lib
+56
View File
@@ -0,0 +1,56 @@
#!/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}
if [[ -z $DEP_DOWNLOAD_ONLY ]]; then
time cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${LIBJPEGTURBO_INSTALL_DIR} \
${LIBJPEGTURBO_CONFIG_OPTS} ..
time cmake --build . --config Release --target install
fi
# 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
+60
View File
@@ -0,0 +1,60 @@
#!/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}
if [[ -z $DEP_DOWNLOAD_ONLY ]]; then
time cmake -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
fi
# 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
+10 -8
View File
@@ -7,8 +7,7 @@ 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}}
LIBRAW_VERSION=${LIBRAW_VERSION:=0.20.2}
# Where to install the final results
LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=${PWD}/ext}
@@ -18,7 +17,7 @@ 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 "Building LibRaw ${LIBRAW_VERSION}"
echo " build dir will be: ${LIBRAW_BUILD_DIR}"
echo " install dir will be: ${LIBRAW_INSTALL_DIR}"
echo " build type is ${LIBRAW_BUILD_TYPE}"
@@ -34,12 +33,15 @@ 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
git checkout ${LIBRAW_VERSION} --force
if [[ -z $DEP_DOWNLOAD_ONLY ]]; then
aclocal
autoreconf --install
./configure --prefix=${LIBRAW_INSTALL_DIR}
time make -j ${PARALLEL:=4} && make install
fi
popd
+20 -10
View File
@@ -8,10 +8,12 @@ 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:=${LOCAL_DEPS_DIR}/libtiff/dist}
LIBTIFF_VERSION=${LIBTIFF_VERSION:=4.1.0}
LIBTIFF_BRANCH=${LIBTIFF_BRANCH:=v${LIBTIFF_VERSION}}
LIBTIFF_CXX_FLAGS=${LIBTIFF_CXX_FLAGS:="-Wno-unused-function -Wno-deprecated-declarations -Wno-cast-qual -Wno-write-strings"}
LIBTIFF_INSTALL_DIR=${LIBTIFF_INSTALL_DIR:=${PWD}/ext/dist}
LIBTIFF_VERSION=${LIBTIFF_VERSION:=v4.3.0}
LIBTIFF_BUILD_TYPE=${LIBTIFF_BUILD_TYPE:=Release}
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
@@ -27,21 +29,29 @@ if [[ ! -e libtiff ]] ; then
fi
cd libtiff
echo "git checkout ${LIBTIFF_BRANCH} --force"
git checkout ${LIBTIFF_BRANCH} --force
echo "git checkout ${LIBTIFF_VERSION} --force"
git checkout ${LIBTIFF_VERSION} --force
mkdir -p build
cd build
time cmake --config Release -DCMAKE_INSTALL_PREFIX=${LIBTIFF_INSTALL_DIR} -DCMAKE_CXX_FLAGS="${LIBTIFF_CXX_FLAGS}" ${LIBTIFF_BUILDOPTS} ..
time cmake --build . --config Release --target install
if [[ -z $DEP_DOWNLOAD_ONLY ]]; then
time cmake -DCMAKE_BUILD_TYPE=${LIBTIFF_BUILD_TYPE} \
-DCMAKE_INSTALL_PREFIX=${LIBTIFF_INSTALL_DIR} \
-DCMAKE_CXX_FLAGS="${LIBTIFF_CXX_FLAGS}" \
${LIBTIFF_BUILDOPTS} ..
time cmake --build . --target install
fi
popd
ls -R ${LIBTIFF_INSTALL_DIR}
# 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 LIBTIFF_ROOT=$LIBTIFF_INSTALL_DIR
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${LIBTIFF_INSTALL_DIR}/lib
+2 -2
View File
@@ -30,7 +30,7 @@ if [[ `uname` == "Linux" ]] ; then
fi
echo LLVMTAR = $LLVMTAR
curl --location http://releases.llvm.org/${LLVM_VERSION}/${LLVMTAR} -o $LLVMTAR
ls -l $LLVMTAR
# ls -l $LLVMTAR
tar xf $LLVMTAR
rm -f $LLVMTAR
echo "Installed ${LLVM_VERSION} in ${LLVM_INSTALL_DIR}"
@@ -38,5 +38,5 @@ if [[ `uname` == "Linux" ]] ; then
mv clang+llvm*/* $LLVM_INSTALL_DIR
export LLVM_DIRECTORY=$LLVM_INSTALL_DIR
export PATH=${LLVM_INSTALL_DIR}/bin:$PATH
ls -a $LLVM_DIRECTORY
# ls -a $LLVM_DIRECTORY
fi
+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
# Exit the whole script if any command fails.
set -ex
LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=${PWD}/ext}
DOWNLOADS_DIR=${DOWNLOADS_DIR:=${LOCAL_DEPS_DIR}/downloads}
NINJA_REPO=${NINJA_REPO:=https://github.com/ninja-build/ninja}
NINJA_VERSION=${NINJA_VERSION:=1.10.2}
NINJA_BRANCH=${NINJA_BRANCH:=v${NINJA_VERSION}}
NINJA_INSTALL_DIR=${NINJA_INSTALL_DIR:=${LOCAL_DEPS_DIR}/dist/bin}
if [ ! -f $DOWNLOADS_DIR/ninja-${NINJA_VERSION}.zip ]; then
curl --location ${NINJA_REPO}/archive/${NINJA_BRANCH}.tar.gz -o $DOWNLOADS_DIR/ninja-${NINJA_BRANCH}.tar.gz
fi
tar xf $DOWNLOADS_DIR/ninja-${NINJA_BRANCH}.tar.gz
pushd ninja-${NINJA_VERSION}
./configure.py --bootstrap
mkdir -p ${NINJA_INSTALL_DIR}
cp ninja ${NINJA_INSTALL_DIR}
popd
-52
View File
@@ -1,52 +0,0 @@
#!/usr/bin/env bash
# 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_STATIC=${OCIO_BUILD_STATIC:=OFF}"
BASEDIR=`pwd`
pwd
echo "OpenColorIO install dir will be: ${OCIO_INSTALL_DIR}"
mkdir -p ${LOCAL_DEPS_DIR}
pushd ${LOCAL_DEPS_DIR}
# Clone OpenColorIO project from GitHub and build
if [[ ! -e OpenColorIO ]] ; then
echo "git clone ${OCIO_REPO} OpenColorIO"
git clone ${OCIO_REPO} OpenColorIO
fi
cd OpenColorIO
echo "git checkout ${OCIO_BRANCH} --force"
git checkout ${OCIO_BRANCH} --force
mkdir -p build
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 ${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 OpenColorIO_ROOT=$OCIO_INSTALL_DIR
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${OCIO_INSTALL_DIR}/lib
+59
View File
@@ -0,0 +1,59 @@
#!/usr/bin/env bash
# Utility script to download and build OpenColorIO
# Exit the whole script if any command fails.
set -ex
# Which OCIO to retrieve, how to build it
OPENCOLORIO_REPO=${OPENCOLORIO_REPO:=https://github.com/AcademySoftwareFoundation/OpenColorIO.git}
OPENCOLORIO_VERSION=${OPENCOLORIO_VERSION:=v2.0.1}
# Where to install the final results
LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=${PWD}/ext}
OPENCOLORIO_SOURCE_DIR=${OPENCOLORIO_SOURCE_DIR:=${LOCAL_DEPS_DIR}/OpenColorIO}
OPENCOLORIO_BUILD_DIR=${OPENCOLORIO_BUILD_DIR:=${LOCAL_DEPS_DIR}/OpenColorIO-build}
OPENCOLORIO_INSTALL_DIR=${OPENCOLORIO_INSTALL_DIR:=${LOCAL_DEPS_DIR}/dist}
OPENCOLORIO_CXX_FLAGS=${OPENCOLORIO_CXX_FLAGS:="-Wno-unused-function -Wno-deprecated-declarations -Wno-cast-qual -Wno-write-strings"}
# Just need libs:
OPENCOLORIO_BUILDOPTS="-DOCIO_BUILD_APPS=OFF -DOCIO_BUILD_NUKE=OFF \
-DOCIO_BUILD_DOCS=OFF -DOCIO_BUILD_TESTS=OFF \
-DOCIO_BUILD_GPU_TESTS=OFF \
-DOCIO_BUILD_PYTHON=OFF -DOCIO_BUILD_PYGLUE=OFF \
-DOCIO_BUILD_JAVA=OFF \
-DBUILD_SHARED_LIBS=${OPENCOLORIO_BUILD_SHARED_LIBS:=ON}"
BASEDIR=`pwd`
pwd
echo "OpenColorIO install dir will be: ${OPENCOLORIO_INSTALL_DIR}"
mkdir -p ${LOCAL_DEPS_DIR}
pushd ${LOCAL_DEPS_DIR}
# Clone OpenColorIO project from GitHub and build
if [[ ! -e ${OPENCOLORIO_SOURCE_DIR} ]] ; then
echo "git clone ${OPENCOLORIO_REPO} ${OPENCOLORIO_SOURCE_DIR}"
git clone ${OPENCOLORIO_REPO} ${OPENCOLORIO_SOURCE_DIR}
fi
cd ${OPENCOLORIO_SOURCE_DIR}
echo "git checkout ${OPENCOLORIO_VERSION} --force"
git checkout ${OPENCOLORIO_VERSION} --force
mkdir -p ${OPENCOLORIO_BUILD_DIR}
cd ${OPENCOLORIO_BUILD_DIR}
time cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${OPENCOLORIO_INSTALL_DIR} \
-DCMAKE_CXX_FLAGS="${OPENCOLORIO_CXX_FLAGS}" \
${OPENCOLORIO_BUILDOPTS} ${OPENCOLORIO_SOURCE_DIR}
time cmake --build . --config Release --target install
popd
# ls -R ${OPENCOLORIO_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 OpenColorIO_ROOT=$OPENCOLORIO_INSTALL_DIR
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${OPENCOLORIO_INSTALL_DIR}/lib
+13 -36
View File
@@ -6,66 +6,41 @@
set -ex
# Which OpenEXR to retrieve, how to build it
OPENEXR_REPO=${OPENEXR_REPO:=https://github.com/openexr/openexr.git}
OPENEXR_VERSION=${OPENEXR_VERSION:=2.4.1}
OPENEXR_BRANCH=${OPENEXR_BRANCH:=v${OPENEXR_VERSION}}
OPENEXR_REPO=${OPENEXR_REPO:=https://github.com/AcademySoftwareFoundation/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}/openexr-install}
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
pwd
echo "Building OpenEXR ${OPENEXR_BRANCH}"
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 "Building OpenEXR ${OPENEXR_VERSION}"
echo "OpenEXR build dir will be: ${OPENEXR_BUILD_DIR}"
echo "OpenEXR install dir will be: ${OPENEXR_INSTALL_DIR}"
echo "OpenEXR Build type is ${OPENEXR_BUILD_TYPE}"
if [[ "$CMAKE_GENERATOR" == "" ]] ; then
OPENEXR_GENERATOR_CMD="-G \"$CMAKE_GENERATOR\""
fi
echo "CMAKE_PREFIX_PATH is ${CMAKE_PREFIX_PATH}"
# Clone OpenEXR project (including IlmBase) from GitHub and build
if [[ ! -e ${OPENEXR_SOURCE_DIR} ]] ; then
echo "git clone ${OPENEXR_REPO} ${OPENEXR_SOURCE_DIR}"
git clone ${OPENEXR_REPO} ${OPENEXR_SOURCE_DIR}
fi
mkdir -p ${OPENEXR_INSTALL_DIR} && true
mkdir -p ${OPENEXR_BUILD_DIR} && true
pushd ${OPENEXR_SOURCE_DIR}
git checkout ${OPENEXR_BRANCH} --force
git checkout ${OPENEXR_VERSION} --force
if [[ ${OPENEXR_BRANCH} == "v2.2.0" ]] || [[ ${OPENEXR_BRANCH} == "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_BRANCH} == "v2.3.0" ]] ; then
if [[ ${OPENEXR_VERSION} == "v2.3.0" ]] ; then
# Simplified setup for 2.3+
cd ${OPENEXR_BUILD_DIR}
cmake --config ${OPENEXR_BUILD_TYPE} -G "$CMAKE_GENERATOR" \
cmake -DCMAKE_BUILD_TYPE=${OPENEXR_BUILD_TYPE} \
-DCMAKE_INSTALL_PREFIX="${OPENEXR_INSTALL_DIR}" \
-DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" \
-DILMBASE_PACKAGE_PREFIX="${OPENEXR_INSTALL_DIR}" \
@@ -78,7 +53,7 @@ elif [[ ${OPENEXR_BRANCH} == "v2.3.0" ]] ; then
else
# Simplified setup for 2.4+
cd ${OPENEXR_BUILD_DIR}
cmake --config ${OPENEXR_BUILD_TYPE} -G "$CMAKE_GENERATOR" \
cmake -DCMAKE_BUILD_TYPE=${OPENEXR_BUILD_TYPE} \
-DCMAKE_INSTALL_PREFIX="${OPENEXR_INSTALL_DIR}" \
-DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" \
-DILMBASE_PACKAGE_PREFIX="${OPENEXR_INSTALL_DIR}" \
@@ -86,6 +61,8 @@ else
-DBUILD_TESTING=0 \
-DPYILMBASE_ENABLE=0 \
-DOPENEXR_VIEWERS_ENABLE=0 \
-DINSTALL_OPENEXR_EXAMPLES=0 \
-DOPENEXR_INSTALL_EXAMPLES=0 \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_CXX_FLAGS="${OPENEXR_CXX_FLAGS}" \
${OPENEXR_CMAKE_FLAGS} ${OPENEXR_SOURCE_DIR}
+18 -14
View File
@@ -4,22 +4,22 @@
#
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/imageworks/OpenShadingLanguage
# 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}}
PUGIXML_VERSION=${PUGIXML_VERSION:=v1.11.4}
# 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}
LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=${PWD}/ext}
PUGIXML_INSTALL_DIR=${PUGIXML_INSTALL_DIR:=${LOCAL_DEPS_DIR}/dist}
#PUGIXML_BUILD_OPTS=${PUGIXML_BUILD_OPTS:=}
pwd
@@ -34,19 +34,23 @@ if [[ ! -e ${PUGIXML_SRC_DIR} ]] ; then
git clone ${PUGIXML_REPO} ${PUGIXML_SRC_DIR}
fi
cd ${PUGIXML_SRC_DIR}
echo "git checkout ${PUGIXML_BRANCH} --force"
git checkout ${PUGIXML_BRANCH} --force
echo "git checkout ${PUGIXML_VERSION} --force"
git checkout ${PUGIXML_VERSION} --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}
if [[ -z $DEP_DOWNLOAD_ONLY ]]; then
time cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${PUGIXML_INSTALL_DIR} \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_TESTS=OFF \
${PUGIXML_BUILD_OPTS} ..
time cmake --build . --config Release --target install
fi
# ls -R ${PUGIXML_INSTALL_DIR}
popd
#echo "listing .."
@@ -55,4 +59,4 @@ popd
# 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
export LD_LIBRARY_PATH=$pugixml_ROOT/lib:$pugixml_ROOT/lib64:$LD_LIBRARY_PATH
+13 -10
View File
@@ -7,8 +7,7 @@ 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:=2.4.3}
PYBIND11_BRANCH=${PYBIND11_BRANCH:=v${PYBIND11_VERSION}}
PYBIND11_VERSION=${PYBIND11_VERSION:=v2.8.1}
# Where to put pybind11 repo source (default to the ext area)
PYBIND11_SRC_DIR=${PYBIND11_SRC_DIR:=${PWD}/ext/pybind11}
@@ -35,18 +34,22 @@ if [[ ! -e ${PYBIND11_SRC_DIR} ]] ; then
git clone ${PYBIND11_REPO} ${PYBIND11_SRC_DIR}
fi
cd ${PYBIND11_SRC_DIR}
echo "git checkout ${PYBIND11_BRANCH} --force"
git checkout ${PYBIND11_BRANCH} --force
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}
if [[ -z $DEP_DOWNLOAD_ONLY ]]; then
time cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${PYBIND11_INSTALL_DIR} \
-DPYBIND11_TEST=OFF \
${PYBIND11_BUILD_OPTS} ..
time cmake --build . --config Release --target install
fi
# ls -R ${PYBIND11_INSTALL_DIR}
popd
#echo "listing .."
+66
View File
@@ -0,0 +1,66 @@
#!/usr/bin/env bash
# Utility script to download and build webp
#
# 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 webp to download if we don't have it yet
WEBP_REPO=${WEBP_REPO:=https://github.com/webmproject/libwebp.git}
WEBP_VERSION=${WEBP_VERSION:=v1.1.0}
# Where to put webp repo source (default to the ext area)
LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=${PWD}/ext}
WEBP_SRC_DIR=${WEBP_SRC_DIR:=${LOCAL_DEPS_DIR}/webp}
WEBP_BUILD_DIR=${WEBP_BUILD_DIR:=${WEBP_SRC_DIR}/build}
WEBP_INSTALL_DIR=${WEBP_INSTALL_DIR:=${LOCAL_DEPS_DIR}/dist}
WEBP_BUILD_TYPE=${WEBP_BUILD_TYPE:=${CMAKE_BUILD_TYPE:-Release}}
#WEBP_CONFIG_OPTS=${WEBP_CONFIG_OPTS:=}
pwd
echo "webp install dir will be: ${WEBP_INSTALL_DIR}"
mkdir -p ./ext
pushd ./ext
# Clone webp project from GitHub and build
if [[ ! -e ${WEBP_SRC_DIR} ]] ; then
echo "git clone ${WEBP_REPO} ${WEBP_SRC_DIR}"
git clone ${WEBP_REPO} ${WEBP_SRC_DIR}
fi
cd ${WEBP_SRC_DIR}
echo "git checkout ${WEBP_VERSION} --force"
git checkout ${WEBP_VERSION} --force
mkdir -p ${WEBP_BUILD_DIR}
cd ${WEBP_BUILD_DIR}
if [[ -z $DEP_DOWNLOAD_ONLY ]]; then
time cmake -DCMAKE_BUILD_TYPE=${WEBP_BUILD_TYPE} \
-DCMAKE_INSTALL_PREFIX=${WEBP_INSTALL_DIR} \
-DWEBP_BUILD_ANIM_UTILS=OFF \
-DWEBP_BUILD_CWEBP=OFF \
-DWEBP_BUILD_DWEBP=OFF \
-DWEBP_BUILD_VWEBP=OFF \
-DWEBP_BUILD_GIF2WEBPx=OFF \
-DWEBP_BUILD_IMG2WEBP=OFF \
-DWEBP_BUILD_EXTRAS=OFF \
-DBUILD_SHARED_LIBS=ON \
${WEBP_CONFIG_OPTS} ..
time cmake --build . --target install
fi
# ls -R ${WEBP_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 WebP_ROOT=$WEBP_INSTALL_DIR
+58
View File
@@ -0,0 +1,58 @@
#!/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}
if [[ -z $DEP_DOWNLOAD_ONLY ]]; then
time cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${ZLIB_INSTALL_DIR} \
${ZLIB_CONFIG_OPTS} ..
time cmake --build . --config Release --target install
fi
# 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
@@ -4,30 +4,16 @@
# any command in it fails. This is crucial for CI tests.
set -ex
# This script is run when CI system first starts up.
# It expects that ci-setenv.bash was run first, so $PLATFORM and $ARCH
# have been set.
if [[ -e src/build-scripts/ci-setenv.bash ]] ; then
source src/build-scripts/ci-setenv.bash
fi
if [[ ! -e build/$PLATFORM ]] ; then
mkdir -p build/$PLATFORM
fi
if [[ ! -e dist/$PLATFORM ]] ; then
mkdir -p dist/$PLATFORM
fi
if [[ "$USE_SIMD" != "" ]] ; then
MY_CMAKE_FLAGS="$MY_CMAKE_FLAGS -DUSE_SIMD=$USE_SIMD"
fi
if [[ "$DEBUG" == "1" ]] ; then
export CMAKE_BUILD_TYPE=Debug
if [[ -n "$FMT_VERSION" ]] ; then
MY_CMAKE_FLAGS="$MY_CMAKE_FLAGS -DBUILD_FMT_VERSION=$FMT_VERSION"
fi
pushd build/$PLATFORM
cmake ../.. -G "$CMAKE_GENERATOR" \
pushd build
cmake .. -G "$CMAKE_GENERATOR" \
-DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" \
-DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" \
-DCMAKE_INSTALL_PREFIX="$OpenImageIO_ROOT" \
@@ -40,17 +26,13 @@ if [[ "$BUILDTARGET" != "none" ]] ; then
time cmake --build . --target ${BUILDTARGET:=install} --config ${CMAKE_BUILD_TYPE}
fi
popd
#make $MAKEFLAGS VERBOSE=1 $BUILD_FLAGS config
#make $MAKEFLAGS $PAR_MAKEFLAGS $BUILD_FLAGS $BUILDTARGET
#echo "OpenImageIO_ROOT $OpenImageIO_ROOT"
#ls -R -l "$OpenImageIO_ROOT"
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
if [[ "${DEBUG_CI:=0}" != "0" ]] ; then
echo "PATH=$PATH"
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
echo "PYTHONPATH=$PYTHONPATH"
echo "ldd oiiotool"
ldd $OpenImageIO_ROOT/bin/oiiotool
fi
if [[ "$BUILDTARGET" == clang-format ]] ; then
@@ -61,7 +43,3 @@ if [[ "$BUILDTARGET" == clang-format ]] ; then
exit 1
fi
fi
# if [[ "$CODECOV" == 1 ]] ; then
# bash <(curl -s https://codecov.io/bash)
# fi
+26 -37
View File
@@ -4,31 +4,17 @@
# Since it sets many env variables needed by the caller, it should be run
# with 'source', not in a separate shell.
# Figure out the platform
if [[ $TRAVIS_OS_NAME == osx || $RUNNER_OS == macOS ]] ; then
export ARCH=macosx
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
export PLATFORM=$ARCH
if [[ "$DEBUG" == 1 ]] ; then
export PLATFORM=${PLATFORM}.debug
fi
echo "Architecture is $ARCH"
echo "Build platform name is $PLATFORM"
# Environment variables we always need
export PATH=/usr/local/bin/_ccache:/usr/lib/ccache:$PATH
export USE_CCACHE=${USE_CCACHE:=1}
export CCACHE_CPP2=1
export OpenImageIO_ROOT=$PWD/dist/$PLATFORM
export CCACHE_CPP2=
export CCACHE_DIR=/tmp/ccache
if [[ "${RUNNER_OS}" == "macOS" ]] ; then
export CCACHE_DIR=$HOME/.ccache
fi
mkdir -p $CCACHE_DIR
export OpenImageIO_ROOT=$PWD/dist
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
@@ -41,31 +27,31 @@ export PYTHONPATH=$OpenImageIO_ROOT/lib/python${PYTHON_VERSION}/site-packages:$P
export BUILD_MISSING_DEPS=${BUILD_MISSING_DEPS:=1}
export COMPILER=${COMPILER:=gcc}
export CXX=${CXX:=g++}
export CI=true
export OpenImageIO_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}
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
export PATH=${LOCAL_DEPS_DIR}/dist/bin:$PATH
export LD_LIBRARY_PATH=${LOCAL_DEPS_DIR}/dist/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=${LOCAL_DEPS_DIR}/dist/lib64:$LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=${LOCAL_DEPS_DIR}/dist/lib:$DYLD_LIBRARY_PATH
export OCIO="$PWD/testsuite/common/OpenColorIO/nuke-default/config.ocio"
export TESTSUITE_CLEANUP_ON_SUCCESS=${TESTSUITE_CLEANUP_ON_SUCCESS:=1}
mkdir -p build dist
echo "HOME = $HOME"
echo "PWD = $PWD"
echo "LOCAL_DEPS_DIR = $LOCAL_DEPS_DIR"
echo "uname -a: " `uname -a`
echo "uname -m: " `uname -m`
echo "uname -s: " `uname -s`
@@ -76,6 +62,9 @@ env | sort
if [[ `uname -s` == "Linux" ]] ; then
head -40 /proc/cpuinfo
elif [[ $ARCH == macosx ]] ; then
elif [[ "${RUNNER_OS}" == "macOS" ]] ; then
sysctl machdep.cpu.features
fi
# Save the env for use by other stages
src/build-scripts/save-env.bash
+18
View File
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
# Important: set -ex causes this whole script to terminate with error if
# any command in it fails. This is crucial for CI tests.
set -ex
$OpenImageIO_ROOT/bin/oiiotool --help || true
echo "Parallel test " ${CTEST_PARALLEL_LEVEL}
pushd build
time ctest -C ${CMAKE_BUILD_TYPE} -E broken --force-new-ctest-process \
--output-on-failure --timeout ${CTEST_TEST_TIMEOUT:=180} ${CTEST_ARGS}
popd
# if [[ "$CODECOV" == 1 ]] ; then
# bash <(curl -s https://codecov.io/bash)
# fi
Binary file not shown.
@@ -1,48 +0,0 @@
#!/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
+117 -77
View File
@@ -3,96 +3,136 @@
set -ex
#dpkg --list
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
time sudo apt-get update
#
# Install system packages when those are acceptable for dependencies.
#
if [[ "$ASWF_ORG" != "" ]] ; then
# Using ASWF CentOS container
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
export PATH=/opt/rh/devtoolset-6/root/usr/bin:/usr/local/bin:$PATH
# 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
#ls /etc/yum.repos.d
export CMAKE_PREFIX_PATH=/usr/lib/x86_64-linux-gnu:$CMAKE_PREFIX_PATH
sudo yum install -y giflib giflib-devel && true
sudo yum install -y opencv opencv-devel && true
sudo yum install -y ffmpeg ffmpeg-devel && true
if [[ "${EXTRA_DEP_PACKAGES}" != "" ]] ; then
time sudo yum install -y ${EXTRA_DEP_PACKAGES}
fi
else
# Using native Ubuntu runner
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 ccache g++ \
libboost-dev libboost-thread-dev libboost-filesystem-dev \
libilmbase-dev libopenexr-dev \
libtbb-dev \
libtiff-dev libgif-dev libpng-dev libraw-dev libwebp-dev \
libavcodec-dev libavformat-dev libswscale-dev libavutil-dev \
dcmtk libsquish-dev libopenvdb-dev \
libfreetype6-dev \
locales wget \
libopencolorio-dev \
libopencv-dev \
qt5-default \
libhdf5-dev
if [[ "${EXTRA_DEP_PACKAGES}" != "" ]] ; then
time sudo apt-get -q install -y ${EXTRA_DEP_PACKAGES}
fi
# Nonstandard python versions
if [[ "${PYTHON_VERSION}" == "3.9" ]] ; then
time sudo apt-get -q install -y python3.9-dev python3-numpy
pip3 --version
pip3 install numpy
elif [[ "$PYTHON_VERSION" == "2.7" ]] ; then
time sudo apt-get -q install -y python-dev python-numpy
else
pip3 install numpy
fi
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++-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
elif [[ "$CXX" == "g++-11" ]] ; then
time sudo apt-get install -y g++-11
fi
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
cmake --version
#dpkg --list
if [[ "$CXX" == "clang++" ]] ; then
#
# If we're using clang to compile on native Ubuntu, we need to install it.
# If on an ASWF CentOS docker container, it already is installed.
#
if [[ "$CXX" == "clang++" && "$ASWF_ORG" == "" ]] ; then
source src/build-scripts/build_llvm.bash
fi
#
# Packages we need to build from scratch.
#
source src/build-scripts/build_pybind11.bash
if [[ "$OPENEXR_VERSION" != "" ]] ; then
source src/build-scripts/build_openexr.bash
fi
if [[ "$WEBP_VERSION" != "" ]] ; then
source src/build-scripts/build_webp.bash
fi
if [[ "$LIBTIFF_VERSION" != "" ]] ; then
source src/build-scripts/build_libtiff.bash
fi
if [[ "$LIBRAW_VERSION" != "" ]] ; then
source src/build-scripts/build_libraw.bash
fi
if [[ "$OPENJPEG_VERSION" != "" ]] ; then
source src/build-scripts/build_OpenJPEG.bash
fi
if [[ "$PUGIXML_VERSION" != "" ]] ; then
source src/build-scripts/build_pugixml.bash
export MY_CMAKE_FLAGS+=" -DUSE_EXTERNAL_PUGIXML=1 "
fi
if [[ "$OPENCOLORIO_VERSION" != "" ]] ; then
source src/build-scripts/build_opencolorio.bash
fi
if [[ "$PTEX_VERSION" != "" ]] ; then
source src/build-scripts/build_Ptex.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
# Save the env for use by other stages
src/build-scripts/save-env.bash
+93 -70
View File
@@ -2,95 +2,127 @@
# 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
# https://github.com/OpenImageIO/oiio
# 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 PATH="$PATH:$DEP_DIR/bin:$DEP_DIR/lib:$VCPKG_INSTALLATION_ROOT/installed/x64-windows/bin:/bin:$PWD/ext/dist/bin:$PWD/ext/dist/lib"
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
#ls -l "C:/Program Files (x86)/Microsoft Visual Studio/*/Enterprise/VC/Tools/MSVC" && true
#ls -l "C:/Program Files (x86)/Microsoft Visual Studio" && true
if [[ "$PYTHON_VERSION" == "3.6" ]] ; then
export CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH;/c/hostedtoolcache/windows/Python/3.6.8/x64"
else
export CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH;/c/hostedtoolcache/windows/Python/3.7.9/x64"
export Python_EXECUTABLE="/c/hostedtoolcache/windows/Python/3.7.9/x64/python.exe"
export PYTHONPATH=$OpenImageIO_ROOT/lib/python${PYTHON_VERSION}/site-packages
fi
pip install numpy
########################################################################
# Dependency method #1: Use vcpkg (disabled)
#
# Currently we are not using this, but here it is for reference:
#
echo "All pre-installed VCPkg installs:"
vcpkg list
vcpkg update
echo "---------------"
# vcpkg update
#
# vcpkg install zlib:x64-windows
time vcpkg install boost-asio:x64-windows
time vcpkg install boost-container:x64-windows
time vcpkg install boost-filesystem:x64-windows
time vcpkg install boost-math:x64-windows
time vcpkg install boost-stacktrace:x64-windows
time vcpkg install boost-system:x64-windows
time vcpkg install boost-thread:x64-windows
# # vcpkg install zlib:x64-windows
vcpkg install tiff:x64-windows
vcpkg install libpng:x64-windows
vcpkg install giflib: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"
# # 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 CMAKE_PREFIX_PATH="$CMAKE_PREFIX_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
#
########################################################################
# curl --location https://ffmpeg.zeranoe.com/builds/win64/shared/ffmpeg-4.2.1-win64-shared.zip -o ffmpeg-libs.zip
# unzip ffmpeg-libs.zip
curl --location https://ffmpeg.zeranoe.com/builds/win64/dev/ffmpeg-4.2.1-win64-dev.zip -o ffmpeg-dev.zip
unzip ffmpeg-dev.zip
ls
ls -R *ffmpeg*
FFmpeg_ROOT=$PWD/ffmpeg-4.2.1-win64-dev
########################################################################
# 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
# We're currently getting libtiff from vcpkg
#src/build-scripts/build_libtiff.bash
#export TIFF_ROOT=$PWD/ext/dist
# We're currently getting jpeg from vcpkg
# 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"
mkdir ext
# ZLib
pushd ext
git clone -b v1.2.11 https://github.com/madler/zlib.git
cd zlib
mkdir -p $INT_DIR
cd $INT_DIR
cmake ../.. -G "$CMAKE_GENERATOR" -DCMAKE_CONFIGURATION_TYPES="$CMAKE_BUILD_TYPE" -DCMAKE_PREFIX_PATH="$DEP_DIR" -DCMAKE_INSTALL_PREFIX="$DEP_DIR"
cmake --build . --config $CMAKE_BUILD_TYPE --target install
popd
export MY_CMAKE_FLAGS="$MY_CMAKE_FLAGS -DZLIB_LIBRARY=$DEP_DIR/lib/zlib.lib"
export OPENEXR_CMAKE_FLAGS="$OPENEXR_CMAKE_FLAGS -DZLIB_LIBRARY=$DEP_DIR/lib/zlib.lib"
source src/build-scripts/build_pybind11.bash
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
@@ -102,22 +134,13 @@ echo "DEP_DIR $DEP_DIR :"
ls -R -l "$DEP_DIR"
# 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"
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
# source src/build-scripts/build_opencolorio.bash
if [[ "$PYTHON_VERSION" == "3.6" ]] ; then
export CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH;/c/hostedtoolcache/windows/Python/3.6.8/x64"
fi
# Save the env for use by other stages
src/build-scripts/save-env.bash
+30 -45
View File
@@ -16,62 +16,47 @@ if [[ `which brew` == "" ]] ; then
fi
brew update >/dev/null
#brew update >/dev/null
echo ""
echo "Before my brew installs:"
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.
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.
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
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.
brew install --display-times llvm
fi
# All cases except for clang-format target, we need the dependencies.
brew install --display-times -q gcc ccache cmake ninja boost || true
brew link --overwrite gcc
brew unlink python@2.7 || true
brew unlink python@3.9 || true
brew unlink python@3.8 || true
brew link --overwrite --force python@${PYTHON_VERSION} || true
#brew upgrade --display-times -q cmake || true
#brew install --display-times -q libtiff
brew install --display-times -q imath openexr opencolorio
#brew install --display-times -q libpng giflib webp
brew install --display-times -q jpeg-turbo openjpeg
brew install --display-times -q freetype libraw dcmtk pybind11 numpy || true
brew install --display-times -q ffmpeg libheif libsquish ptex || true
brew install --display-times -q tbb || true
brew install --display-times -q openvdb || true
brew install --display-times -q opencv || true
brew install --display-times -q qt@5
echo ""
echo "After brew installs:"
brew list --versions
# Needed on some systems
pip install numpy
if [[ $PYTHON_VERSION != "2.7" ]] ; then
pip3 install numpy
else
pip install numpy
fi
# 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/opt/llvm/bin:$PATH ;
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/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
# Save the env for use by other stages
src/build-scripts/save-env.bash
+10 -4
View File
@@ -4,11 +4,17 @@ if [[ ! -e ../oiio-images ]] ; then
git clone https://github.com/OpenImageIO/oiio-images.git ../oiio-images
fi
if [[ ! -e ../libtiffpic ]] ; then
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
# if [[ ! -e ../libtiffpic ]] ; then
# 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
if [[ ! -e ../openexr-images ]] ; then
git clone https://github.com/openexr/openexr-images.git ../openexr-images
fi
# if [[ ! -e ../bmpsuite ]] ; then
# mkdir ../bmpsuite
# curl -o bmpsuite.zip http://entropymine.com/jason/bmpsuite/bmpsuite.zip
# unzip bmpsuite.zip -d ../bmpsuite
# fi
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
# Save the env for use by other stages. Exclude things that we know aren't
# needed.
printenv \
| sort \
| grep -v ASWF_ \
| grep -v GITHUB_ \
| grep -v NVIDIA_ \
| grep -v RUNNER_ \
| grep -v _= \
| fgrep -v "\*" \
>> $GITHUB_ENV
echo "save-env: GITHUB_ENV=${GITHUB_ENV}"
cat $GITHUB_ENV
echo "---------"
+1 -1
View File
@@ -1,6 +1,6 @@
# Copyright 2008-present Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
# https://github.com/OpenImageIO/oiio
add_oiio_plugin (cineoninput.cpp
libcineon/Cineon.cpp libcineon/OutStream.cpp libcineon/Codec.cpp
+27 -27
View File
@@ -1,6 +1,6 @@
// Copyright 2008-present Contributors to the OpenImageIO project.
// SPDX-License-Identifier: BSD-3-Clause
// https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
// https://github.com/OpenImageIO/oiio
#include <cmath>
@@ -79,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())) {
errorf("Could not open file \"%s\"", name);
errorfmt("Could not open file \"{}\"", name);
return false;
}
m_cin.SetInStream(m_stream);
if (!m_cin.ReadHeader()) {
errorf("Could not read header");
error("Could not read header");
return false;
}
@@ -101,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: errorf("Unsupported bit depth %d", maxbits); return false;
default: errorfmt("Unsupported bit depth {}", maxbits); return false;
}
m_spec = ImageSpec(m_cin.header.Width(), m_cin.header.Height(),
m_cin.header.NumberOfElements(), typedesc);
@@ -184,7 +184,7 @@ CineonInput::open(const std::string& name, ImageSpec& newspec)
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));
Strutil::sprintf("Gamma%.2g", g));
break;
}
@@ -223,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 (!std::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 (!std::isinf(floats[0]) && !std::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 (!std::isinf(m_cin.header.x(i)))
#define CINEON_SET_ATTRIB_FLOAT_N(x) \
#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);
@@ -369,7 +369,7 @@ bool
CineonInput::read_native_scanline(int subimage, int miplevel, int y, int /*z*/,
void* data)
{
lock_guard lock(m_mutex);
lock_guard lock(*this);
if (!seek_subimage(subimage, miplevel))
return false;
@@ -41,6 +41,7 @@
#include <limits>
#include <OpenImageIO/strutil.h>
#include <OpenImageIO/sysutil.h>
#include "CineonHeader.h"
#include "EndianSwap.h"
@@ -540,7 +541,6 @@ void cineon::IndustryHeader::SetFilmEdgeCode(const char *edge)
void cineon::GenericHeader::SetCreationTimeDate(const long sec)
{
struct tm *tm_time;
char str[32];
#ifdef _WIN32
@@ -548,8 +548,9 @@ void cineon::GenericHeader::SetCreationTimeDate(const long sec)
#endif
const time_t t = time_t(sec);
tm_time = ::localtime(&t);
::strftime(str, 32, "%Y:%m:%d:%H:%M:%S%Z", tm_time);
struct tm localtm;
OIIO::Sysutil::get_local_time(&t, &localtm);
::strftime(str, 32, "%Y:%m:%d:%H:%M:%S%Z", &localtm);
OIIO::Strutil::safe_strcpy(this->creationDate, str, 11);
OIIO::Strutil::safe_strcpy(this->creationTime, str + 11, 12);
}
@@ -557,7 +558,6 @@ void cineon::GenericHeader::SetCreationTimeDate(const long sec)
void cineon::GenericHeader::SetSourceTimeDate(const long sec)
{
struct tm *tm_time;
char str[32];
#ifdef _WIN32
@@ -565,8 +565,9 @@ void cineon::GenericHeader::SetSourceTimeDate(const long sec)
#endif
const time_t t = time_t(sec);
tm_time = ::localtime(&t);
::strftime(str, 32, "%Y:%m:%d:%H:%M:%S%Z", tm_time);
struct tm localtm;
OIIO::Sysutil::get_local_time(&t, &localtm);
::strftime(str, 32, "%Y:%m:%d:%H:%M:%S%Z", &localtm);
OIIO::Strutil::safe_strcpy(this->sourceDate, str, 11);
OIIO::Strutil::safe_strcpy(this->sourceTime, str + 11, 12);
}
@@ -83,12 +83,13 @@ namespace cineon
void RleCompress(IB *src, IB *dst, const int bufsize, const int len, BufferAccess &access)
{
IB ch;
int count;
// int count;
int i;
int index = bufsize - 1;
bool start = true;
//bool match = true;
#if 0 /* This seems to not be used */
// for each data type, have maximum length of rle datum
// subtract one so it the LSBit can be used to state
int maxCount;
@@ -102,13 +103,13 @@ namespace cineon
maxCount = 0xffff - 1;
else
maxCount = 1000000; // high number for floats, doubles
#endif
for (i = len - 1; i >= 0; i--)
{
if (start)
{
count = 1;
// count = 1;
start = false;
ch = src[i];
dst[index--] = ch;
+34 -6
View File
@@ -3,13 +3,38 @@
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@)
if (NOT @OPENIMAGEIO_CONFIG_DO_NOT_FIND_IMATH@ AND NOT OPENIMAGEIO_CONFIG_DO_NOT_FIND_IMATH)
if (@OpenEXR_VERSION@ VERSION_GREATER_EQUAL 3.0)
find_dependency(Imath @Imath_VERSION@
HINTS @Imath_DIR@)
elseif (@OpenEXR_VERSION@ VERSION_GREATER_EQUAL 2.4 AND @FOUND_OPENEXR_WITH_CONFIG@)
find_dependency(IlmBase @OpenEXR_VERSION@
HINTS @IlmBase_DIR@ @OpenEXR_DIR@)
find_dependency(OpenEXR @OpenEXR_VERSION@
HINTS @OpenEXR_DIR@)
find_dependency(ZLIB @ZLIB_VERSION@) # Because OpenEXR doesn't do it
find_dependency(Threads) # Because OpenEXR doesn't do it
endif ()
endif ()
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@")
# Compute the installation prefix relative to this file
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)
# There's no guarantee that CMAKE_INSTALL_XXXDIR is a relative path so we extract the final component to handle asbolute paths
get_filename_component(_INCLUDE_DIR_NAME "@CMAKE_INSTALL_INCLUDEDIR@" NAME)
get_filename_component(_LIB_DIR_NAME "@CMAKE_INSTALL_LIBDIR@" NAME)
set_and_check (@PROJECT_NAME@_INCLUDE_DIR "${_IMPORT_PREFIX}/${_INCLUDE_DIR_NAME}")
set_and_check (@PROJECT_NAME@_INCLUDES "${_IMPORT_PREFIX}/${_INCLUDE_DIR_NAME}")
set_and_check (@PROJECT_NAME@_LIB_DIR "${_IMPORT_PREFIX}/${_LIB_DIR_NAME}")
set (@PROJECT_NAME@_PLUGIN_SEARCH_PATH "@PLUGIN_SEARCH_PATH_NATIVE@")
if (NOT @FOUND_OPENEXR_WITH_CONFIG@)
list (APPEND @PROJECT_NAME@_INCLUDES ${IMATH_INCLUDES} ${OPENEXR_INCLUDES})
endif ()
set (OIIO_USING_IMATH_VERSION_MAJOR @Imath_VERSION_MAJOR@)
set (OIIO_USING_IMATH_VERSION_MINOR @Imath_VERSION_MINOR@)
#...logic to determine installedPrefix from the own location...
#set (@PROJECT_NAME@_CONFIG_DIR "${installedPrefix}/@CONFIG_INSTALL_DIR@")
@@ -17,3 +42,6 @@ set (@PROJECT_NAME@_PLUGIN_SEARCH_PATH "@PLUGIN_SEARCH_PATH_NATIVE@")
include ("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
check_required_components ("@PROJECT_NAME@")
# Set a CMake variable that says if this OpenImageIO build has OCIO support
set (@PROJECT_NAME@_HAS_OpenColorIO @OPENCOLORIO_FOUND@)
+80
View File
@@ -0,0 +1,80 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio
# 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 can be specified with NAME, otherwise is inferred from the
# subdirectory name. The source files of the binary can be specified with
# SRC, otherwise are inferred to be all the .cpp files within the
# subdirectory. Optional compile DEFINITIONS, private INCLUDE_DIRS, and
# private 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
# expected to be called *after* the OpenImageIO target is declared), it will
# create a new target to build the full plugin. On the other hand, if
# EMBEDPLUGINS is 1 (in which case this should be called *before* the
# OpenImageIO target is declared), it will merely append the required
# definitions, includes, and libraries to lists format_plugin_blah that will
# be handed off too the setup of the later OpenImageIO target.
#
macro (add_oiio_plugin)
cmake_parse_arguments (_plugin "" "NAME" "SRC;INCLUDE_DIRS;LINK_LIBRARIES;DEFINITIONS" ${ARGN})
# Arguments: <prefix> <options> <one_value_keywords> <multi_value_keywords> args...
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 ()
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 ()
+2 -2
View File
@@ -1,11 +1,11 @@
# Copyright 2008-present Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
# https://github.com/OpenImageIO/oiio
# 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
# nonempty by contains a non-true/nonzero value, store false in the
# variable named by <enablevar>, otherwise store true.
function (check_is_enabled pkgname enablevar)
string (TOUPPER ${pkgname} pkgname_upper)
+202
View File
@@ -0,0 +1,202 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio
set (REQUIRED_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)")
option (ALWAYS_PREFER_CONFIG "Prefer a dependency's exported config file if it's available" OFF)
# Utility function to list the names and values of all variables matching
# the pattern (case-insensitive)
function (dump_matching_variables pattern)
string (TOLOWER ${pattern} _pattern_lower)
get_cmake_property(_allvars VARIABLES)
list (SORT _allvars)
foreach (_var IN LISTS _allvars)
string (TOLOWER ${_var} _var_lower)
if (_var_lower MATCHES ${_pattern_lower})
message (STATUS " ${_var} = ${${_var}}")
endif ()
endforeach ()
endfunction ()
# 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/nonzero
# 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 $PKGNAME_FOUND.
# * Optional DEFINITIONS <string>... are passed to add_definitions if the
# package is found.
# * Optional SETVARIABLES <id>... is a list of CMake variables to set to
# TRUE if the package is found (they will not be set or changed if the
# package is not 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.
# * Optional VERSION_MIN and VERSION_MAX, if supplied, give minimum and
# maximum versions that will be accepted. The min is inclusive, the max
# is exclusive (i.e., check for min <= version < max). Note that this is
# not the same as providing a version number to find_package, which
# checks compatibility, not minimum. Sometimes we really do just want to
# say a minimum or a range. (N.B. When our minimum CMake >= 3.19, the
# built-in way to do this is with version ranges passed to
# find_package.)
# * Optional RECOMMEND_MIN, if supplied, gives a minimum recommended
# version, accepting but warning if it is below this number (even
# if above the true minimum version accepted). The warning message
# can give an optional explanation, passed as RECOMMEND_MIN_REASON.
# * Optional PREFER_CONFIG, if supplied, tries to use an exported config
# file from the package before using a FindPackage.cmake module.
# * Optional DEBUG turns on extra debugging information related to how
# this package is found.
#
# 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 # prefix
# noValueKeywords:
"REQUIRED;PREFER_CONFIG;DEBUG"
# singleValueKeywords:
"ENABLE;ISDEPOF;VERSION_MIN;VERSION_MAX;RECOMMEND_MIN;RECOMMEND_MIN_REASON"
# multiValueKeywords:
"DEFINITIONS;PRINT;DEPS;SETVARIABLES"
# argsToParse:
${ARGN})
string (TOLOWER ${pkgname} pkgname_lower)
string (TOUPPER ${pkgname} pkgname_upper)
set (_pkg_VERBOSE ${VERBOSE})
if (_pkg_DEBUG)
set (_pkg_VERBOSE ON)
endif ()
if (NOT _pkg_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 ()
set (_config_status "")
if (_enable OR _pkg_REQUIRED)
if (${pkgname}_FOUND OR ${pkgname_upper}_FOUND)
# was already found
elseif (_pkg_PREFER_CONFIG OR ALWAYS_PREFER_CONFIG)
find_package (${pkgname} CONFIG ${_pkg_UNPARSED_ARGUMENTS})
if (${pkgname}_FOUND OR ${pkgname_upper}_FOUND)
set (_config_status "from CONFIG")
endif ()
endif ()
if (NOT (${pkgname}_FOUND OR ${pkgname_upper}_FOUND))
find_package (${pkgname} ${_pkg_UNPARSED_ARGUMENTS})
endif()
if ((${pkgname}_FOUND OR ${pkgname_upper}_FOUND)
AND ${pkgname}_VERSION
AND (_pkg_VERSION_MIN OR _pkg_VERSION_MAX))
if ((_pkg_VERSION_MIN AND ${pkgname}_VERSION VERSION_LESS _pkg_VERSION_MIN)
OR (_pkg_VERSION_MAX AND ${pkgname}_VERSION VERSION_GREATER _pkg_VERSION_MAX))
message (STATUS "${ColorRed}${pkgname} ${${pkgname}_VERSION} is outside the required range ${_pkg_VERSION_MIN}...${_pkg_VERSION_MAX} ${ColorReset}")
unset (${pkgname}_FOUND)
unset (${pkgname}_VERSION)
unset (${pkgname_upper}_FOUND)
unset (${pkgname_upper}_VERSION)
endif ()
endif ()
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} ${_config_status}${ColorReset}")
add_definitions (${_pkg_DEFINITIONS})
foreach (_v IN LISTS _pkg_SETVARIABLES)
set (${_v} TRUE)
endforeach ()
if (_pkg_RECOMMEND_MIN)
if (${${pkgname}_VERSION} VERSION_LESS ${_pkg_RECOMMEND_MIN})
message (STATUS "${ColorYellow}Recommend ${pkgname} >= ${_pkg_RECOMMEND_MIN} ${_pkg_RECOMMEND_MIN_REASON} ${ColorReset}")
endif ()
endif ()
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}")
elseif (EXISTS "${PROJECT_SOURCE_DIR}/src/build-scripts/build_${pkgname_upper}.bash")
message (STATUS "${ColorRed} Maybe this will help: src/build-scripts/build_${pkgname_upper}.bash ${ColorReset}")
elseif (EXISTS "${PROJECT_SOURCE_DIR}/src/build-scripts/build_${pkgname_lower}.bash")
message (STATUS "${ColorRed} Maybe this will help: src/build-scripts/build_${pkgname_lower}.bash ${ColorReset}")
elseif (EXISTS "${PROJECT_SOURCE_DIR}/src/build-scripts/build_lib${pkgname_lower}.bash")
message (STATUS "${ColorRed} Maybe this will help: src/build-scripts/build_lib${pkgname_lower}.bash ${ColorReset}")
endif ()
if (_pkg_REQUIRED)
message (FATAL_ERROR "${ColorRed}${pkgname} is required, aborting.${ColorReset}")
endif ()
endif()
if (_pkg_VERBOSE AND (${pkgname}_FOUND OR ${pkgname_upper}_FOUND OR _pkg_DEBUG))
if (_pkg_DEBUG)
dump_matching_variables (${pkgname})
endif ()
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 ()
else ()
if (NOT _quietskip)
message (STATUS "${ColorRed}Not using ${pkgname} -- disabled ${_disablereason} ${ColorReset}")
endif ()
endif ()
endmacro()
+1 -1
View File
@@ -1,6 +1,6 @@
# Copyright 2008-present Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
# https://github.com/OpenImageIO/oiio
# Define color codes for pretty terminal output
+86 -74
View File
@@ -1,6 +1,6 @@
# Copyright 2008-present Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
# https://github.com/OpenImageIO/oiio
###########################################################################
#
@@ -27,11 +27,13 @@ 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 14 CACHE STRING
"C++ standard to build with (14, 17, 20, etc.)")
set (DOWNSTREAM_CXX_STANDARD 14 CACHE STRING
"C++ minimum standard to impose on downstream clients")
set (CMAKE_CXX_STANDARD_REQUIRED ON)
set (CMAKE_CXX_EXTENSIONS OFF)
message (STATUS "Building for C++${CMAKE_CXX_STANDARD}")
message (STATUS "Building with C++${CMAKE_CXX_STANDARD}, downstream minimum C++${DOWNSTREAM_CXX_STANDARD}")
###########################################################################
@@ -80,18 +82,22 @@ endif ()
###########################################################################
# Turn on more detailed warnings and optionally consider warnings as errors
#
option (STOP_ON_WARNING "Stop building if there are any compiler warnings" ON)
if (${PROJECT_NAME}_SUPPORTED_RELEASE)
option (STOP_ON_WARNING "Stop building if there are any compiler warnings" OFF)
else ()
option (STOP_ON_WARNING "Stop building if there are any compiler warnings" ON)
endif()
option (EXTRA_WARNINGS "Enable lots of extra pedantic warnings" OFF)
if (NOT MSVC)
add_compile_options ("-Wall")
if (EXTRA_WARNINGS)
add_compile_options ("-Wextra")
endif ()
if (STOP_ON_WARNING OR DEFINED ENV{CI})
if (STOP_ON_WARNING OR DEFINED ENV{${PROJECT_NAME}_CI})
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.
# N.B. Force CI builds to use -Werror, even if STOP_ON_WARNING has
# been switched off by default, which we may do in release
# branches.
endif ()
endif ()
@@ -111,12 +117,12 @@ set (CXX_VISIBILITY_PRESET "hidden" CACHE STRING "Symbol visibility (hidden or d
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
if (${CXX_VISIBILITY_PRESET} STREQUAL "hidden" AND VISIBILITY_MAP_FILE 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.
# other versions of our dependencies.
set (VISIBILITY_MAP_COMMAND "-Wl,--version-script=${VISIBILITY_MAP_FILE}")
endif ()
@@ -143,7 +149,7 @@ if (CMAKE_COMPILER_IS_CLANG OR CMAKE_COMPILER_IS_APPLECLANG)
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
# Don't warn about using unknown preprocessor symbols in `#if`
add_compile_options ("-Wno-expansion-to-defined")
endif ()
endif ()
@@ -185,25 +191,47 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD"
endif ()
# We will use this for ccache and timing
set (MY_RULE_LAUNCH "")
###########################################################################
# 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
# been compiled previously with identical 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.
# not found on the system, it will simply be silently 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}))
message (STATUS "Ignoring ccache because clang + Qt + env CCACHE_CPP2 is not set")
else ()
set_property (GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property (GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
set (MY_RULE_LAUNCH ccache)
endif ()
endif ()
###########################################################################
# Build time debugging aid: time all compile & link commands
#
# Note, though, that this is not especially helpful when doing a parallel
# build. If you wish to time individual compile commands, it's best to also
# set `-j 1` or CMAKE_BUILD_PARALLEL_LEVEL to 1.
option (TIME_COMMANDS "Time each compile and link command" OFF)
if (TIME_COMMANDS)
set (MY_RULE_LAUNCH "${CMAKE_COMMAND} -E time ${MY_RULE_LAUNCH}")
endif ()
# Note: This must be after any option that alters MY_RULE_LAUNCH
if (MY_RULE_LAUNCH)
set_property (GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${MY_RULE_LAUNCH})
set_property (GLOBAL PROPERTY RULE_LAUNCH_LINK ${MY_RULE_LAUNCH})
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
@@ -236,8 +264,8 @@ endif ()
###########################################################################
# 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 USE_SIMD option may be set to a comma-separated list of machine /
# instruction set options, such as "avx3,f16c". The list will be parsed and
# the proper compiler directives added to generate code for those ISA
# capabilities.
#
@@ -280,25 +308,6 @@ include (CMakePushCheckState)
include (CheckCXXSourceRuns)
include (CheckLibraryExists)
###########################################################################
# 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 ()
check_cxx_source_runs("
#include <regex>
int main() {
std::string r = std::regex_replace(std::string(\"abc\"), std::regex(\"b\"), \" \");
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 ()
###########################################################################
# Check if we need libatomic on this platform. We shouldn't on mainstream
@@ -432,43 +441,45 @@ endif ()
# 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
ENV LLVM_DIRECTORY
NO_DEFAULT_PATH
DOC "Path to clang-format executable")
find_program (CLANG_FORMAT_EXE NAMES clang-format bin/clang-format)
if (CLANG_FORMAT_EXE)
message (STATUS "clang-format found: ${CLANG_FORMAT_EXE}")
# Start with the list of files to include when formatting...
file (GLOB_RECURSE FILES_TO_FORMAT ${CLANG_FORMAT_INCLUDES})
# ... then process any list of excludes we are given
foreach (_pat ${CLANG_FORMAT_EXCLUDES})
file (GLOB_RECURSE _excl ${_pat})
list (REMOVE_ITEM FILES_TO_FORMAT ${_excl})
endforeach ()
#message (STATUS "clang-format file list: ${FILES_TO_FORMAT}")
file (COPY ${CMAKE_CURRENT_SOURCE_DIR}/.clang-format
DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
add_custom_target (clang-format
COMMAND "${CLANG_FORMAT_EXE}" -i -style=file ${FILES_TO_FORMAT} )
else ()
message (STATUS "clang-format not found.")
# Note: skip all of this checking, setup, and cmake-format target if this
# is being built as a subproject.
if (PROJECT_IS_TOP_LEVEL)
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/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
ENV LLVM_DIRECTORY
NO_DEFAULT_PATH
DOC "Path to clang-format executable")
find_program (CLANG_FORMAT_EXE NAMES clang-format bin/clang-format)
if (CLANG_FORMAT_EXE)
message (STATUS "clang-format found: ${CLANG_FORMAT_EXE}")
# Start with the list of files to include when formatting...
file (GLOB_RECURSE FILES_TO_FORMAT ${CLANG_FORMAT_INCLUDES})
# ... then process any list of excludes we are given
foreach (_pat ${CLANG_FORMAT_EXCLUDES})
file (GLOB_RECURSE _excl ${_pat})
list (REMOVE_ITEM FILES_TO_FORMAT ${_excl})
endforeach ()
#message (STATUS "clang-format file list: ${FILES_TO_FORMAT}")
file (COPY ${CMAKE_CURRENT_SOURCE_DIR}/.clang-format
DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
add_custom_target (clang-format
COMMAND "${CLANG_FORMAT_EXE}" -i -style=file ${FILES_TO_FORMAT} )
else ()
message (STATUS "clang-format not found.")
endif ()
endif ()
###########################################################################
# Another way to sneak in custom compiler and DSO linking flags.
#
@@ -527,9 +538,10 @@ endif ()
###########################################################################
# Any extra logic to be run only for CI builds goes here.
# We expect our own CI runs to define env variable ${PROJECT_NAME}_CI
#
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 (DEFINED ENV{${PROJECT_NAME}_CI})
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.
+131 -159
View File
@@ -1,6 +1,6 @@
# Copyright 2008-present Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
# https://github.com/OpenImageIO/oiio
###########################################################################
# Find external dependencies
@@ -25,153 +25,50 @@ 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)
include (FindThreads)
###########################################################################
# Boost setup
if (LINKSTATIC)
set (Boost_USE_STATIC_LIBS ON)
if (MSVC)
add_definitions (-DBOOST_ALL_NO_LIB=1)
endif ()
else ()
if (MSVC)
if (MSVC)
# Disable automatic linking using pragma comment(lib,...) of boost libraries upon including of a header
add_definitions (-DBOOST_ALL_NO_LIB=1)
endif ()
# If the build system hasn't been specifically told how to link Boost, link it the same way as other
# OIIO dependencies:
if (NOT DEFINED Boost_USE_STATIC_LIBS)
set (Boost_USE_STATIC_LIBS "${LINKSTATIC}")
endif ()
if (MSVC)
# Not linking Boost as static libraries: either an explicit setting or LINKSTATIC is FALSE:
if (NOT Boost_USE_STATIC_LIBS)
add_definitions (-DBOOST_ALL_DYN_LINK=1)
endif ()
endif ()
if (BOOST_CUSTOM)
set (Boost_FOUND true)
# N.B. For a custom version, the caller had better set up the variables
# Boost_VERSION, Boost_INCLUDE_DIRS, Boost_LIBRARY_DIRS, Boost_LIBRARIES.
else ()
set (Boost_COMPONENTS filesystem system thread)
if (NOT USE_STD_REGEX)
list (APPEND Boost_COMPONENTS regex)
endif ()
# 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
)
checked_find_package (Boost REQUIRED
VERSION_MIN 1.53
COMPONENTS ${Boost_COMPONENTS}
RECOMMEND_MIN 1.66
RECOMMEND_MIN_REASON "Boost 1.66 is the oldest version our CI tests against"
PRINT Boost_INCLUDE_DIRS Boost_LIBRARIES )
endif ()
# On Linux, Boost 1.55 and higher seems to need to link against -lrt
@@ -192,26 +89,59 @@ link_directories ("${Boost_LIBRARY_DIRS}")
# 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)
checked_find_package (TIFF REQUIRED
VERSION_MIN 3.9
RECOMMEND_MIN 4.0
RECOMMEND_MIN_REASON "to support >4GB files")
# 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 ()
checked_find_package (OpenEXR REQUIRED
VERSION_MIN 2.3
RECOMMEND_MIN 2.4
PRINT IMATH_INCLUDES OPENEXR_INCLUDES)
# Force Imath includes to be before everything else to ensure that we have
# the right Imath/OpenEXR version, not some older version in the system
# library. This shoudn't be necessary, except for the common case of people
# building against Imath/OpenEXR 3.x when there is still a system-level
# install version of 2.x.
include_directories(BEFORE ${IMATH_INCLUDES} ${OPENEXR_INCLUDES})
if (MSVC AND NOT LINKSTATIC)
add_definitions (-DOPENEXR_DLL) # Is this needed for new versions?
endif ()
if (OPENEXR_VERSION VERSION_GREATER_EQUAL 3.0)
set (OIIO_USING_IMATH 3)
else ()
set (OIIO_USING_IMATH 2)
endif ()
set (OPENIMAGEIO_IMATH_TARGETS
# For OpenEXR/Imath 3.x:
$<TARGET_NAME_IF_EXISTS:Imath::Imath>
$<TARGET_NAME_IF_EXISTS:Imath::Half>
# For OpenEXR >= 2.4/2.5 with reliable exported targets
$<TARGET_NAME_IF_EXISTS:IlmBase::Imath>
$<TARGET_NAME_IF_EXISTS:IlmBase::Half>
$<TARGET_NAME_IF_EXISTS:IlmBase::Iex>
# For OpenEXR <= 2.3:
${ILMBASE_LIBRARIES} )
set (OPENIMAGEIO_OPENEXR_TARGETS
# For OpenEXR/Imath 3.x:
$<TARGET_NAME_IF_EXISTS:OpenEXR::OpenEXR>
# For OpenEXR >= 2.4/2.5 with reliable exported targets
$<TARGET_NAME_IF_EXISTS:OpenEXR::IlmImf>
$<TARGET_NAME_IF_EXISTS:IlmBase::IlmThread>
$<TARGET_NAME_IF_EXISTS:IlmBase::Iex>
# For OpenEXR <= 2.3:
${OPENEXR_LIBRARIES} )
set (OPENIMAGEIO_IMATH_DEPENDENCY_VISIBILITY "PUBLIC" CACHE STRING
"Should we expose Imath library dependency as PUBLIC or PRIVATE")
set (OPENIMAGEIO_CONFIG_DO_NOT_FIND_IMATH OFF CACHE BOOL
"Exclude find_dependency(Imath) from the exported OpenImageIOConfig.cmake")
# JPEG -- prefer Turbo-JPEG to regular libjpeg
checked_find_package (JPEGTurbo
DEFINITIONS -DUSE_JPEG_TURBO=1
PRINT JPEG_INCLUDES JPEG_LIBRARIES)
PRINT JPEG_INCLUDES JPEG_INCLUDE_DIRS
JPEG_LIBRARIES JPEG_VERSION)
if (NOT JPEG_FOUND) # Try to find the non-turbo version
checked_find_package (JPEG REQUIRED)
endif ()
@@ -222,9 +152,14 @@ endif ()
option (USE_EXTERNAL_PUGIXML "Use an externally built shared library version of the pugixml library" OFF)
if (USE_EXTERNAL_PUGIXML)
checked_find_package (pugixml REQUIRED
VERSION_MIN 1.8
DEFINITIONS -DUSE_EXTERNAL_PUGIXML=1)
else ()
message (STATUS "Using internal PugiXML")
endif()
# From pythonutils.cmake
find_python()
###########################################################################
@@ -241,34 +176,71 @@ endif ()
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_OCIO=1 -DUSE_OPENCOLORIO=1
# PREFER_CONFIG
)
if (NOT OPENCOLORIO_FOUND)
set (OPENCOLORIO_FOUND 0)
endif ()
checked_find_package (OpenCV 3.0
DEFINITIONS -DUSE_OPENCV=1)
# Intel TBB
set (TBB_USE_DEBUG_BUILD OFF)
checked_find_package (TBB 2017
DEFINITIONS -DUSE_TBB=1
ISDEPOF OpenVDB)
DEFINITIONS -DUSE_TBB=1
PREFER_CONFIG)
checked_find_package (DCMTK VERSION_MIN 3.6.1) # For DICOM images
checked_find_package (FFmpeg VERSION_MIN 3.0)
checked_find_package (GIF
VERSION_MIN 4
RECOMMEND_MIN 5.0
RECOMMEND_MIN_REASON "for stability and thread safety")
# For HEIF/HEIC/AVIF formats
checked_find_package (Libheif VERSION_MIN 1.3
RECOMMEND_MIN 1.7
RECOMMEND_MIN_REASON "for AVIF support")
if (APPLE AND LIBHEIF_VERSION VERSION_GREATER_EQUAL 1.10 AND LIBHEIF_VERSION VERSION_LESS 1.11)
message (WARNING "Libheif 1.10 on Apple is known to be broken, disabling libheif support")
set (Libheif_FOUND 0)
endif ()
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)
RECOMMEND_MIN 0.18
RECOMMEND_MIN_REASON "for ACES support and better camera metadata"
PRINT LibRaw_r_LIBRARIES)
if (LibRaw_FOUND AND LibRaw_VERSION VERSION_LESS 0.20 AND CMAKE_CXX_STANDARD VERSION_GREATER_EQUAL 17)
message (STATUS "${ColorYellow}WARNING When building for C++17, LibRaw should be 0.20 or higher (found ${LibRaw_VERSION}). You may get errors, depending on the compiler.${ColorReset}")
# Currently, we issue the above warning and let them take their chances.
# If we wish to disable the LibRaw<0.20/C++17 combination that may fail,
# just uncomment the following two lines.
# set (LibRaw_FOUND 0)
# set (LIBRAW_FOUND 0)
endif ()
checked_find_package (OpenJPEG VERSION_MIN 2.0
RECOMMEND_MIN 2.2
RECOMMEND_MIN_REASON "for multithreading support")
# Note: Recent OpenJPEG versions have exported cmake configs, but we don't
# find them reliable at all, so we stick to our FindOpenJPEG.cmake module.
checked_find_package (OpenVDB
VERSION_MIN 5.0
DEPS TBB
DEFINITIONS -DUSE_OPENVDB=1)
checked_find_package (Ptex PREFER_CONFIG)
if (NOT Ptex_FOUND OR NOT Ptex_VERSION)
# Fallback for inadequate Ptex exported configs. This will eventually
# disappear when we can 100% trust Ptex's exports.
unset (Ptex_FOUND)
checked_find_package (Ptex)
endif ()
checked_find_package (WebP)
option (USE_R3DSDK "Enable R3DSDK (RED camera) support" OFF)
checked_find_package (R3DSDK) # RED camera
@@ -348,7 +320,7 @@ endif ()
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")
set (BUILD_FMT_VERSION "8.0.0" 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
+61
View File
@@ -0,0 +1,61 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio
# 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 specified with SRC, otherwise are
# inferred to be all the .cpp files within the subdirectory. Optional
# compile DEFINITIONS, private INCLUDE_DIRS, and private 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).
#
# If -DENABLE_INSTALL_<executable>=OFF was specified, the target will be built
# (in the build area) but will not be installed.
#
# 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")
check_is_enabled (INSTALL_${_target_NAME} _target_NAME_INSTALL_enabled)
if (_target_NAME_INSTALL_enabled)
install_targets (${_target_NAME})
endif ()
else ()
message (STATUS "${ColorRed}Disabling ${_target_NAME} ${ColorReset}")
endif ()
endmacro ()
+53 -7
View File
@@ -18,7 +18,7 @@
# Modifications:
# Copyright 2008-present Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
# https://github.com/OpenImageIO/oiio
if (FFMPEG_INCLUDES AND FFMPEG_LIBRARIES)
set (FFmpeg_FOUND TRUE)
@@ -39,6 +39,7 @@ else ()
HINTS ${_FFMPEG_AVCODEC_INCLUDE_DIRS}
PATH_SUFFIXES ffmpeg libav
)
set (FFMPEG_INCLUDES ${FFMPEG_AVCODEC_INCLUDE_DIR})
find_library(FFMPEG_LIBAVCODEC
NAMES avcodec
@@ -55,15 +56,61 @@ else ()
find_library(FFMPEG_LIBSWSCALE
NAMES swscale
HINTS ${_FFMPEG_SWSCALE_LIBRARY_DIRS} )
endif ()
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (FFmpeg
if (FFMPEG_INCLUDES)
file(STRINGS "${FFMPEG_INCLUDES}/libavcodec/version.h" TMP
REGEX "^#define LIBAVCODEC_VERSION_MAJOR .*$")
string (REGEX MATCHALL "[0-9]+[.0-9]+" LIBAVCODEC_VERSION_MAJOR ${TMP})
file(STRINGS "${FFMPEG_INCLUDES}/libavcodec/version.h" TMP
REGEX "^#define LIBAVCODEC_VERSION_MINOR .*$")
string (REGEX MATCHALL "[0-9]+[.0-9]+" LIBAVCODEC_VERSION_MINOR ${TMP})
file(STRINGS "${FFMPEG_INCLUDES}/libavcodec/version.h" TMP
REGEX "^#define LIBAVCODEC_VERSION_MICRO .*$")
string (REGEX MATCHALL "[0-9]+[.0-9]+" LIBAVCODEC_VERSION_MICRO ${TMP})
set (LIBAVCODEC_VERSION "${LIBAVCODEC_VERSION_MAJOR}.${LIBAVCODEC_VERSION_MINOR}.${LIBAVCODEC_VERSION_MICRO}")
if (LIBAVCODEC_VERSION VERSION_GREATER_EQUAL 59.18.100)
set (FFMPEG_VERSION 5.0)
elseif (LIBAVCODEC_VERSION VERSION_GREATER_EQUAL 58.134.100)
set (FFMPEG_VERSION 4.4)
elseif (LIBAVCODEC_VERSION VERSION_GREATER_EQUAL 58.91.100)
set (FFMPEG_VERSION 4.3)
elseif (LIBAVCODEC_VERSION VERSION_GREATER_EQUAL 58.54.100)
set (FFMPEG_VERSION 4.2)
elseif (LIBAVCODEC_VERSION VERSION_GREATER_EQUAL 58.35.100)
set (FFMPEG_VERSION 4.1)
elseif (LIBAVCODEC_VERSION VERSION_GREATER_EQUAL 58.18.100)
set (FFMPEG_VERSION 4.0)
elseif (LIBAVCODEC_VERSION VERSION_GREATER_EQUAL 57.107.100)
set (FFMPEG_VERSION 3.4)
elseif (LIBAVCODEC_VERSION VERSION_GREATER_EQUAL 57.89.100)
set (FFMPEG_VERSION 3.3)
elseif (LIBAVCODEC_VERSION VERSION_GREATER_EQUAL 57.64.100)
set (FFMPEG_VERSION 3.2)
elseif (LIBAVCODEC_VERSION VERSION_GREATER_EQUAL 57.48.100)
set (FFMPEG_VERSION 3.1)
elseif (LIBAVCODEC_VERSION VERSION_GREATER_EQUAL 57.24.100)
set (FFMPEG_VERSION 3.0)
elseif (LIBAVCODEC_VERSION VERSION_GREATER_EQUAL 56.60.100)
set (FFMPEG_VERSION 2.8)
elseif (LIBAVCODEC_VERSION VERSION_GREATER_EQUAL 56.41.100)
set (FFMPEG_VERSION 2.7)
elseif (LIBAVCODEC_VERSION VERSION_GREATER_EQUAL 56.26.100)
set (FFMPEG_VERSION 2.6)
else ()
set (FFMPEG_VERSION 1.0)
endif ()
set (FFmpeg_VERSION ${FFMPEG_VERSION})
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
@@ -72,10 +119,9 @@ else ()
${FFMPEG_LIBAVUTIL}
${FFMPEG_LIBSWSCALE}
)
endif ()
endif ()
mark_as_advanced (
FFMPEG_INCLUDES FFMPEG_LIBRARIES
)
-47
View File
@@ -1,47 +0,0 @@
# 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
)
+12
View File
@@ -29,6 +29,12 @@ 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")
file(STRINGS "${JPEG_INCLUDE_DIR}/jconfig.h"
jpeg_lib_version REGEX "^#define[\t ]+JPEG_LIB_VERSION[\t ]+.*")
if (jpeg_lib_version)
string(REGEX REPLACE "^#define[\t ]+JPEG_LIB_VERSION[\t ]+([0-9]+).*"
"\\1" JPEG_VERSION "${jpeg_lib_version}")
endif ()
endif ()
# handle the QUIETLY and REQUIRED arguments and set JPEG_FOUND to TRUE if
@@ -37,6 +43,12 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(JPEG DEFAULT_MSG JPEG_LIBRARIES JPEG_INCLUDE_D
if (JPEG_FOUND)
set (JPEGTURBO_FOUND true)
# Use an intermediary target named "JPEG::JPEG" to match libjpeg's export
if(NOT TARGET JPEG::JPEG)
add_library(JPEG::JPEG INTERFACE IMPORTED)
target_link_libraries(JPEG::JPEG INTERFACE ${JPEG_LIBRARY})
endif()
endif ()
mark_as_advanced(JPEG_LIBRARIES JPEG_INCLUDE_DIRS )
+10 -1
View File
@@ -87,6 +87,15 @@ MARK_AS_ADVANCED(LibRaw_VERSION_STRING
if (LINKSTATIC)
# Necessary?
find_package (Jasper)
if (JASPER_FOUND)
set (LibRaw_r_LIBRARIES ${LibRaw_r_LIBRARIES} ${JASPER_LIBRARIES})
endif()
find_library (LCMS2_LIBRARIES NAMES lcms2)
set (LibRaw_r_LIBRARIES ${LibRaw_r_LIBRARIES} ${JASPER_LIBRARIES} ${LCMS2_LIBRARIES})
if (LCMS2_LIBRARIES)
set (LibRaw_r_LIBRARIES ${LibRaw_r_LIBRARIES} ${LCMS2_LIBRARIES})
endif()
if (MSVC)
set (LibRaw_r_DEFINITIONS ${LibRaw_r_DEFINITIONS} -DLIBRAW_NODLL)
set (LibRaw_DEFINITIONS ${LibRaw_DEFINITIONS} -DLIBRAW_NODLL)
endif()
endif ()
+27 -8
View File
@@ -11,6 +11,7 @@
# LIBSQUISH_VERSION Version of Libsquish (e.g., 3.6.2)
include (FindPackageHandleStandardArgs)
include (SelectLibraryConfigurations)
find_path (LIBSQUISH_INCLUDE_DIR squish.h
HINTS
@@ -18,11 +19,11 @@ find_path (LIBSQUISH_INCLUDE_DIR squish.h
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_library (LIBSQUISH_LIBRARY_RELEASE squish
HINTS ${LIBSQUISH_LIBRARY_PATH} ENV LIBSQUISH_LIBRARY_PATH)
find_library (LIBSQUISH_LIBRARY_DEBUG squishd
HINTS ${LIBSQUISH_LIBRARY_PATH} ENV LIBSQUISH_LIBRARY_PATH)
select_library_configurations(LIBSQUISH)
find_package_handle_standard_args (Libsquish
REQUIRED_VARS
@@ -32,15 +33,33 @@ find_package_handle_standard_args (Libsquish
if (Libsquish_FOUND)
set (LIBSQUISH_INCLUDES ${LIBSQUISH_INCLUDE_DIR})
set (LIBSQUISH_LIBRARIES ${LIBSQUISH_LIBRARY})
if (NOT LIBSQUISH_LIBRARIES)
set (LIBSQUISH_LIBRARIES ${LIBSQUISH_LIBRARY})
endif ()
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}")
if (LIBSQUISH_LIBRARY_RELEASE)
set_property(TARGET Libsquish::Libsquish APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Libsquish::Libsquish PROPERTIES
IMPORTED_LOCATION_RELEASE "${LIBSQUISH_LIBRARY_RELEASE}")
endif ()
if (LIBSQUISH_LIBRARY_DEBUG)
set_property(TARGET Libsquish::Libsquish APPEND PROPERTY
IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(Libsquish::Libsquish PROPERTIES
IMPORTED_LOCATION_DEBUG "${LIBSQUISH_LIBRARY_DEBUG}")
endif ()
if (NOT LIBSQUISH_LIBRARY_RELEASE AND NOT LIBSQUISH_LIBRARY_DEBUG)
set_property(TARGET Libsquish::Libsquish APPEND PROPERTY
IMPORTED_LOCATION "${LIBSQUISH_LIBRARY}")
endif ()
endif ()
endif ()
+6 -7
View File
@@ -36,8 +36,10 @@ if (EXISTS "${_ocv_version_file}")
string (REGEX MATCHALL "[0-9]+" CV_VERSION_REVISION ${TMP})
if (CV_VERSION_EPOCH)
set (OpenCV_VERSION "${CV_VERSION_EPOCH}.${CV_VERSION_MAJOR}.${CV_VERSION_MINOR}")
string(REPLACE "." "" OpenCV_VERSION_SUFFIX "${OpenCV_VERSION}")
else ()
set (OpenCV_VERSION "${CV_VERSION_MAJOR}.${CV_VERSION_MINOR}.${CV_VERSION_REVISION}")
string(REPLACE "." "" OpenCV_VERSION_SUFFIX "${OpenCV_VERSION}")
endif ()
endif ()
@@ -49,13 +51,7 @@ set (libdirs "${PROJECT_SOURCE_DIR}/lib"
/usr/local/opt/opencv3/lib
)
if (NOT ${OpenCV_VERSION} VERSION_LESS 4.0.0)
set (opencv_components opencv_core opencv_imgproc opencv_videoio)
elseif (NOT ${OpenCV_VERSION} VERSION_LESS 3.0.0)
set (opencv_components opencv_videoio opencv_imgproc opencv_core)
else (NOT ${OpenCV_VERSION} VERSION_LESS 2.0.0)
set (opencv_components opencv_highgui opencv_imgproc opencv_core)
endif ()
set (opencv_components opencv_core opencv_imgproc opencv_videoio opencv_core${OpenCV_VERSION_SUFFIX} opencv_imgproc${OpenCV_VERSION_SUFFIX} opencv_videoio${OpenCV_VERSION_SUFFIX})
foreach (component ${opencv_components})
find_library (${component}_lib
NAMES ${component}
@@ -73,6 +69,9 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS (OpenCV
if (OPENCV_FOUND)
set (OpenCV_INCLUDES ${OpenCV_INCLUDE_DIR})
set (OpenCV_LIBRARIES ${OpenCV_LIBS})
foreach (component ${opencv_components})
list (APPEND OpenCV_${component}_LIBRARIES ${${component}_lib})
endforeach ()
endif ()
MARK_AS_ADVANCED (OpenCV_INCLUDE_DIR OpenCV_LIBS)
+61 -12
View File
@@ -1,14 +1,44 @@
# Module to find OpenColorIO
#
# This module will first look into the directories hinted by the variables:
# - OpenColorIO_ROOT, OPENCOLORIO_INCLUDE_PATH, OPENCOLORIO_LIBRARY_PATH
# - OpenColorIO_ROOT
#
# This module defines the following variables:
# This module defines the following targets:
#
# - OpenColorIO::OpenColorIO
#
# Old style CMake, this module also defines the following variables:
#
# 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
#
# Hints and overrides:
#
# - OPENCOLORIO_INTERFACE_LINK_LIBRARIES - override for interface link
# libraries on the OpenColorIO::OpenColorIO target.
# - OPENCOLORIO_NO_CONFIG - if ON, this module will be used even if an
# OCIO >= 2.1 cmake config is found. If OFF (the default), a config file
# will be perferred if found.
#
# OpenColorIO 2.1 exports proper cmake config files on its own.
# Once OCIO 2.1 is our new minimum, this FindOpenColorIO.cmake will
# eventually be deprecated and disappear.
#
if (NOT OPENCOLORIO_NO_CONFIG)
find_package(OpenColorIO CONFIG)
endif ()
if (TARGET OpenColorIO::OpenColorIO)
if (OPENCOLORIO_INTERFACE_LINK_LIBRARIES)
set_target_properties(OpenColorIO::OpenColorIO PROPERTIES
INTERFACE_LINK_LIBRARIES "${OPENCOLORIO_INTERFACE_LINK_LIBRARIES}")
endif ()
else ()
# vvvv the rest is if no OCIO exported config file is found
include (FindPackageHandleStandardArgs)
include (FindPackageMessage)
@@ -23,8 +53,23 @@ find_path (OPENCOLORIO_INCLUDE_DIR
/opt/local/include
DOC "The directory where OpenColorIO/OpenColorIO.h resides")
if (EXISTS "${OPENCOLORIO_INCLUDE_DIR}/OpenColorIO/OpenColorABI.h")
# Search twice, because this symbol changed between OCIO 1.x and 2.x
file(STRINGS "${OPENCOLORIO_INCLUDE_DIR}/OpenColorIO/OpenColorABI.h" TMP
REGEX "^#define OCIO_VERSION_STR[ \t].*$")
if (NOT TMP)
file(STRINGS "${OPENCOLORIO_INCLUDE_DIR}/OpenColorIO/OpenColorABI.h" TMP
REGEX "^#define OCIO_VERSION[ \t].*$")
endif ()
string (REGEX MATCHALL "([0-9]+)\\.([0-9]+)\\.[0-9]+" OPENCOLORIO_VERSION ${TMP})
set (OPENCOLORIO_VERSION_MAJOR ${CMAKE_MATCH_1})
set (OPENCOLORIO_VERSION_MINOR ${CMAKE_MATCH_2})
endif ()
find_library (OPENCOLORIO_LIBRARY
NAMES OCIO OpenColorIO
NAMES
OpenColorIO
OpenColorIO_${OPENCOLORIO_VERSION_MAJOR}_${OPENCOLORIO_VERSION_MINOR}
HINTS
${OPENCOLORIO_LIBRARY_PATH}
ENV OPENCOLORIO_LIBRARY_PATH
@@ -35,19 +80,13 @@ find_library (OPENCOLORIO_LIBRARY
/opt/local/lib
DOC "The OCIO library")
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)
if (OpenColorIO_FOUND)
set (OPENCOLORIO_INCLUDES ${OPENCOLORIO_INCLUDE_DIR})
set (OPENCOLORIO_LIBRARIES ${OPENCOLORIO_LIBRARY})
set (OPENCOLORIO_DEFINITIONS "")
@@ -58,11 +97,20 @@ if (OPENCOLORIO_FOUND)
set_property(TARGET OpenColorIO::OpenColorIO APPEND PROPERTY
IMPORTED_LOCATION "${OPENCOLORIO_LIBRARIES}")
if (LINKSTATIC)
if (OPENCOLORIO_INTERFACE_LINK_LIBRARIES)
set_target_properties(OpenColorIO::OpenColorIO PROPERTIES
INTERFACE_COMPILE_DEFINITIONS "-DOpenColorIO_STATIC")
INTERFACE_LINK_LIBRARIES "${OPENCOLORIO_INTERFACE_LINK_LIBRARIES}")
endif ()
if (LINKSTATIC)
target_compile_definitions(OpenColorIO::OpenColorIO
INTERFACE "-DOpenColorIO_STATIC")
endif()
endif ()
if (NOT TARGET OpenColorIO::OpenColorIOHeaders)
add_library(OpenColorIO::OpenColorIOHeaders INTERFACE IMPORTED)
set_target_properties(OpenColorIO::OpenColorIOHeaders PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${OPENCOLORIO_INCLUDES}")
endif ()
endif ()
if (OpenColorIO_FOUND AND LINKSTATIC)
@@ -82,3 +130,4 @@ if (OpenColorIO_FOUND AND LINKSTATIC)
endif ()
endif ()
endif()
+127 -14
View File
@@ -1,15 +1,118 @@
# Module to find OpenEXR.
# Module to find OpenEXR and Imath.
#
# I'm afraid this is a mess, due to needing to support a wide range of
# OpenEXR versions.
#
# For OpenEXR & Imath 3.0, this will establish the following imported
# targets:
#
# Imath::Imath
# Imath::Half
# OpenEXR::OpenEXR
# OpenEXR::Iex
# OpenEXR::IlmThread
#
# For OpenEXR 2.4 & 2.5, it will establish the following imported targets:
#
# IlmBase::Imath
# IlmBase::Half
# IlmBase::Iex
# IlmBase::IlmThread
# OpenEXR::IlmImf
#
# For all versions -- but for OpenEXR < 2.4 the only thing this sets --
# are the following CMake variables:
#
# This module will set
# OPENEXR_FOUND true, if found
# OPENEXR_INCLUDES directory where headers are found
# OPENEXR_INCLUDES directory where OpenEXR headers are found
# OPENEXR_LIBRARIES libraries for OpenEXR + IlmBase
# ILMBASE_LIBRARIES libraries just IlmBase
# OPENEXR_VERSION OpenEXR version (accurate for >= 2.0.0,
# otherwise will just guess 1.6.1)
# IMATH_INCLUDES directory where Imath headers are found
# ILMBASE_INCLUDES directory where IlmBase headers are found
# ILMBASE_LIBRARIES libraries just IlmBase
#
#
# First, try to fine just the right config files
find_package(Imath CONFIG)
if (NOT TARGET Imath::Imath)
# Couldn't find Imath::Imath, maybe it's older and has IlmBase?
find_package(IlmBase CONFIG)
endif ()
find_package(OpenEXR CONFIG)
if (TARGET OpenEXR::OpenEXR AND TARGET Imath::Imath)
# OpenEXR 3.x if both of these targets are found
set (FOUND_OPENEXR_WITH_CONFIG 1)
if (NOT OpenEXR_FIND_QUIETLY)
message (STATUS "Found CONFIG for OpenEXR 3 (OpenEXR_VERSION=${OpenEXR_VERSION})")
endif ()
# Mimic old style variables
set (OPENEXR_VERSION ${OpenEXR_VERSION})
get_target_property(IMATH_INCLUDES Imath::Imath INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(ILMBASE_INCLUDES Imath::Imath INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(ILMBASE_IMATH_LIBRARY Imath::Imath INTERFACE_LINK_LIBRARIES)
get_target_property(IMATH_LIBRARY Imath::Imath INTERFACE_LINK_LIBRARIES)
get_target_property(OPENEXR_IEX_LIBRARY OpenEXR::Iex INTERFACE_LINK_LIBRARIES)
get_target_property(OPENEXR_ILMTHREAD_LIBRARY OpenEXR::IlmThread INTERFACE_LINK_LIBRARIES)
set (ILMBASE_LIBRARIES ${ILMBASE_IMATH_LIBRARY})
set (ILMBASE_FOUND true)
get_target_property(OPENEXR_INCLUDES OpenEXR::OpenEXR INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(OPENEXR_ILMIMF_LIBRARY OpenEXR::OpenEXR INTERFACE_LINK_LIBRARIES)
set (OPENEXR_LIBRARIES ${OPENEXR_ILMIMF_LIBRARY} ${OPENEXR_IEX_LIBRARY} ${OPENEXR_ILMTHREAD_LIBRARY} ${ILMBASE_LIBRARIES})
set (OPENEXR_FOUND true)
# Link with pthreads if required
find_package (Threads)
if (CMAKE_USE_PTHREADS_INIT)
list (APPEND ILMBASE_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
endif ()
elseif (TARGET OpenEXR::IlmImf AND TARGET IlmBase::Imath AND
(OPENEXR_VERSION VERSION_GREATER_EQUAL 2.4 OR OpenEXR_VERSION VERSION_GREATER_EQUAL 2.4))
# OpenEXR 2.4 or 2.5 with exported config
set (FOUND_OPENEXR_WITH_CONFIG 1)
if (NOT OpenEXR_FIND_QUIETLY)
message (STATUS "Found CONFIG for OpenEXR 2 (OpenEXR_VERSION=${OpenEXR_VERSION})")
endif ()
# Mimic old style variables
get_target_property(ILMBASE_INCLUDES IlmBase::IlmBaseConfig INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(IMATH_INCLUDES IlmBase::IlmBaseConfig INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(ILMBASE_Imath_LIBRARY IlmBase::Imath INTERFACE_LINK_LIBRARIES)
get_target_property(ILMBASE_IMATH_LIBRARY IlmBase::Imath INTERFACE_LINK_LIBRARIES)
get_target_property(ILMBASE_HALF_LIBRARY IlmBase::Half INTERFACE_LINK_LIBRARIES)
get_target_property(OPENEXR_IEX_LIBRARY IlmBase::Iex INTERFACE_LINK_LIBRARIES)
get_target_property(OPENEXR_ILMTHREAD_LIBRARY IlmBase::IlmThread INTERFACE_LINK_LIBRARIES)
set (ILMBASE_LIBRARIES ${ILMBASE_IMATH_LIBRARY} ${ILMBASE_HALF_LIBRARY} ${OPENEXR_IEX_LIBRARY} ${OPENEXR_ILMTHREAD_LIBRARY})
set (ILMBASE_FOUND true)
get_target_property(OPENEXR_INCLUDES OpenEXR::IlmImfConfig INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(OPENEXR_ILMIMF_LIBRARY OpenEXR::IlmImf INTERFACE_LINK_LIBRARIES)
set (OPENEXR_LIBRARIES ${OPENEXR_ILMIMF_LIBRARY} ${ILMBASE_LIBRARIES})
set (OPENEXR_FOUND true)
# Link with pthreads if required
find_package (Threads)
if (CMAKE_USE_PTHREADS_INIT)
list (APPEND ILMBASE_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
endif ()
# Correct for how old OpenEXR config exports set the directory one
# level lower than we prefer it.
string(REGEX REPLACE "include/OpenEXR$" "include" ILMBASE_INCLUDES "${ILMBASE_INCLUDES}")
string(REGEX REPLACE "include/OpenEXR$" "include" IMATH_INCLUDES "${IMATH_INCLUDES}")
string(REGEX REPLACE "include/OpenEXR$" "include" OPENEXR_INCLUDES "${OPENEXR_INCLUDES}")
else ()
# OpenEXR 2.x older versions without a config or whose configs we don't
# trust.
set (FOUND_OPENEXR_WITH_CONFIG 0)
# Other standard issue macros
include (FindPackageHandleStandardArgs)
include (SelectLibraryConfigurations)
@@ -63,21 +166,23 @@ find_path (OPENEXR_INCLUDE_PATH OpenEXR/OpenEXRConfig.h
# Try to figure out version number
if (DEFINED _OPENEXR_VERSION AND NOT "${_OPENEXR_VERSION}" STREQUAL "")
set (OPENEXR_VERSION "${_OPENEXR_VERSION}")
string (REGEX REPLACE "([0-9]+)\\.[0-9\\.]+" "\\1" OPENEXR_VERSION_MAJOR "${_OPENEXR_VERSION}")
string (REGEX REPLACE "[0-9]+\\.([0-9]+)(\\.[0-9]+)?" "\\1" OPENEXR_VERSION_MINOR "${_OPENEXR_VERSION}")
set (OpenEXR_VERSION "${_OPENEXR_VERSION}")
string (REGEX REPLACE "([0-9]+)\\.[0-9\\.]+" "\\1" OpenEXR_VERSION_MAJOR "${_OPENEXR_VERSION}")
string (REGEX REPLACE "[0-9]+\\.([0-9]+)(\\.[0-9]+)?" "\\1" OpenEXR_VERSION_MINOR "${_OPENEXR_VERSION}")
elseif (EXISTS "${OPENEXR_INCLUDE_PATH}/OpenEXR/ImfMultiPartInputFile.h")
# Must be at least 2.0
file(STRINGS "${OPENEXR_INCLUDE_PATH}/OpenEXR/OpenEXRConfig.h" TMP REGEX "^#define OPENEXR_VERSION_STRING .*$")
string (REGEX MATCHALL "[0-9]+[.0-9]+" OPENEXR_VERSION ${TMP})
string (REGEX MATCHALL "[0-9]+[.0-9]+" OpenEXR_VERSION ${TMP})
file(STRINGS "${OPENEXR_INCLUDE_PATH}/OpenEXR/OpenEXRConfig.h" TMP REGEX "^#define OPENEXR_VERSION_MAJOR .*$")
string (REGEX MATCHALL "[0-9]+" OPENEXR_VERSION_MAJOR ${TMP})
string (REGEX MATCHALL "[0-9]+" OpenEXR_VERSION_MAJOR ${TMP})
file(STRINGS "${OPENEXR_INCLUDE_PATH}/OpenEXR/OpenEXRConfig.h" TMP REGEX "^#define OPENEXR_VERSION_MINOR .*$")
string (REGEX MATCHALL "[0-9]+" OPENEXR_VERSION_MINOR ${TMP})
string (REGEX MATCHALL "[0-9]+" OpenEXR_VERSION_MINOR ${TMP})
else ()
# Assume an old one, predates 2.x that had versions
set (OPENEXR_VERSION 1.6.1)
set (OPENEXR_MAJOR 1)
set (OPENEXR_MINOR 6)
set (OpenEXR_VERSION 1.6.1)
set (OpenEXR_VERSION_MAJOR 1)
set (OpenEXR_VERSION_MINOR 6)
endif ()
@@ -119,9 +224,9 @@ foreach (COMPONENT ${_openexr_components})
string (TOUPPER ${COMPONENT} UPPERCOMPONENT)
# First try with the version embedded
find_library (OPENEXR_${UPPERCOMPONENT}_LIBRARY
NAMES ${COMPONENT}-${OPENEXR_VERSION_MAJOR}_${OPENEXR_VERSION_MINOR}
NAMES ${COMPONENT}-${OpenEXR_VERSION_MAJOR}_${OpenEXR_VERSION_MINOR}
${COMPONENT}
${COMPONENT}-${OPENEXR_VERSION_MAJOR}_${OPENEXR_VERSION_MINOR}_d
${COMPONENT}-${OpenEXR_VERSION_MAJOR}_${OpenEXR_VERSION_MINOR}_d
${COMPONENT}_d
HINTS ${OPENEXR_LIBRARY_DIR} $ENV{OPENEXR_LIBRARY_DIR}
${GENERIC_LIBRARY_PATHS} )
@@ -131,17 +236,23 @@ find_package_handle_standard_args (OpenEXR
REQUIRED_VARS ILMBASE_INCLUDE_PATH OPENEXR_INCLUDE_PATH
OPENEXR_IMATH_LIBRARY OPENEXR_ILMIMF_LIBRARY
OPENEXR_IEX_LIBRARY OPENEXR_HALF_LIBRARY
VERSION_VAR OPENEXR_VERSION
)
if (OPENEXR_FOUND)
set (OPENEXR_VERSION_MAJOR ${OpenEXR_VERSION_MAJOR})
set (OPENEXR_VERSION_MINOR ${OpenEXR_VERSION_MINOR})
set (Imath_VERSION_MAJOR ${OpenEXR_VERSION_MAJOR})
set (Imath_VERSION_MINOR ${OpenEXR_VERSION_MINOR})
set (ILMBASE_FOUND TRUE)
set (ILMBASE_INCLUDES ${ILMBASE_INCLUDE_PATH})
set (IMATH_INCLUDES ${ILMBASE_INCLUDE_PATH})
set (OPENEXR_INCLUDES ${OPENEXR_INCLUDE_PATH})
set (ILMBASE_INCLUDE_DIR ${ILMBASE_INCLUDE_PATH})
set (IMATH_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")
set (FINDOPENEXR_FALLBACK TRUE)
endif ()
mark_as_advanced(
@@ -153,3 +264,5 @@ mark_as_advanced(
# Restore the original CMAKE_FIND_LIBRARY_SUFFIXES
set (CMAKE_FIND_LIBRARY_SUFFIXES ${_openexr_orig_suffixes})
endif ()
-127
View File
@@ -1,127 +0,0 @@
###########################################################################
# OpenImageIO https://www.openimageio.org
# 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
#
###########################################################################
#
# CMake module to find OpenImageIO
#
# This module will set
# 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.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
if (NOT OPENIMAGEIO_ROOT_DIR AND NOT $ENV{OPENIMAGEIO_ROOT_DIR} STREQUAL "")
set (OPENIMAGEIO_ROOT_DIR $ENV{OPENIMAGEIO_ROOT_DIR})
endif ()
find_library ( OPENIMAGEIO_LIBRARY
NAMES OpenImageIO${OIIO_LIBNAME_SUFFIX}
HINTS ${OPENIMAGEIO_ROOT_DIR}
PATH_SUFFIXES lib64 lib )
find_path ( OPENIMAGEIO_INCLUDE_DIR
NAMES OpenImageIO/imageio.h
HINTS ${OPENIMAGEIO_ROOT_DIR} )
find_program ( OIIOTOOL_BIN
NAMES oiiotool
HINTS ${OPENIMAGEIO_ROOT_DIR} )
# Try to figure out version number
set (OIIO_VERSION_HEADER "${OPENIMAGEIO_INCLUDE_DIR}/OpenImageIO/oiioversion.h")
if (EXISTS "${OIIO_VERSION_HEADER}")
file (STRINGS "${OIIO_VERSION_HEADER}" TMP REGEX "^#define OIIO_VERSION_MAJOR .*$")
string (REGEX MATCHALL "[0-9]+" OPENIMAGEIO_VERSION_MAJOR ${TMP})
file (STRINGS "${OIIO_VERSION_HEADER}" TMP REGEX "^#define OIIO_VERSION_MINOR .*$")
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})
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 ()
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (OpenImageIO
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_LIBRARY
)
@@ -1,7 +1,7 @@
# Module to find OpenJpeg.
#
# This module will first look into the directories defined by the variables:
# - OpenJpeg_ROOT
# - OpenJPEG_ROOT
#
# This module defines the following variables:
#
@@ -17,7 +17,8 @@ macro (PREFIX_FIND_INCLUDE_DIR prefix includefile libpath_var)
string (TOUPPER ${prefix}_INCLUDE_DIR tmp_varname)
find_path(${tmp_varname} ${includefile}
PATHS ${${libpath_var}}
NO_DEFAULT_PATH
PATH_SUFFIXES openjpeg openjpeg-2.0 openjpeg-2.1 openjpeg-2.2
openjpeg-2.3 openjpeg-2.4 openjpeg-2.5
)
if (${tmp_varname})
mark_as_advanced (${tmp_varname})
@@ -31,12 +32,10 @@ macro (PREFIX_FIND_LIB prefix libname libpath_var liblist_var cachelist_var)
find_library(${tmp_prefix}_LIBRARY_RELEASE
NAMES ${libname}
PATHS ${${libpath_var}}
NO_DEFAULT_PATH
)
find_library(${tmp_prefix}_LIBRARY_DEBUG
NAMES ${libname}d ${libname}_d ${libname}debug ${libname}_debug
PATHS ${${libpath_var}}
NO_DEFAULT_PATH
)
# Properly define ${tmp_prefix}_LIBRARY (cached) and ${tmp_prefix}_LIBRARIES
select_library_configurations (${tmp_prefix})
@@ -56,22 +55,9 @@ endmacro ()
# Generic search paths
set (OpenJpeg_include_paths
/usr/local/include/openjpeg-2.3
/usr/local/include/openjpeg-2.2
/usr/local/include/openjpeg-2.1
/usr/local/include/openjpeg-2.0
/usr/local/include/openjpeg
/usr/local/include
/usr/include/openjpeg-2.3
/usr/include/openjpeg-2.2
/usr/include/openjpeg-2.1
/usr/include/openjpeg
/usr/include
/opt/local/include
/opt/local/include/openjpeg-2.3
/opt/local/include/openjpeg-2.2
/opt/local/include/openjpeg-2.1
/opt/local/include/openjpeg-2.0)
)
set (OpenJpeg_library_paths
/usr/lib
@@ -80,23 +66,6 @@ set (OpenJpeg_library_paths
/sw/lib
/opt/local/lib)
if (OpenJpeg_ROOT)
set (OpenJpeg_library_paths
${OpenJpeg_ROOT}/lib
${OpenJpeg_ROOT}/lib64
${OpenJpeg_ROOT}/bin
${OpenJpeg_library_paths}
)
set (OpenJpeg_include_paths
${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()
# Locate the header files
@@ -149,7 +118,7 @@ else ()
endif ()
# Use the standard function to handle OPENJPEG_FOUND
FIND_PACKAGE_HANDLE_STANDARD_ARGS (OpenJpeg
FIND_PACKAGE_HANDLE_STANDARD_ARGS (OpenJPEG
VERSION_VAR OPENJPEG_VERSION
REQUIRED_VARS OPENJPEG_INCLUDE_DIR ${OpenJpeg_libvars})
+4 -4
View File
@@ -79,11 +79,11 @@ 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
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
set_property(TARGET OpenVDB::openvdb APPEND PROPERTY
IMPORTED_LOCATION "${OPENVDB_LIBRARIES}")
endif ()
endif ()
@@ -92,13 +92,13 @@ if (PTEX_INCLUDE_DIR AND EXISTS "${PTEX_INCLUDE_DIR}/PtexVersion.h" )
file(STRINGS "${PTEX_INCLUDE_DIR}/PtexVersion.h" TMP REGEX "^#define PtexAPIVersion.*$")
string(REGEX MATCHALL "[0-9]+" API ${TMP})
file(STRINGS "${PTEX_INCLUDE_DIR}/PtexVersion.h" TMP REGEX "^#define PtexFileMajorVersion.*$")
file(STRINGS "${PTEX_INCLUDE_DIR}/PtexVersion.h" TMP REGEX "^#define PtexLibraryMajorVersion.*$")
string(REGEX MATCHALL "[0-9]+" MAJOR ${TMP})
file(STRINGS "${PTEX_INCLUDE_DIR}/PtexVersion.h" TMP REGEX "^#define PtexFileMinorVersion.*$")
file(STRINGS "${PTEX_INCLUDE_DIR}/PtexVersion.h" TMP REGEX "^#define PtexLibraryMinorVersion.*$")
string(REGEX MATCHALL "[0-9]+" MINOR ${TMP})
set(PTEX_VERSION ${API}.${MAJOR}.${MINOR})
set(PTEX_VERSION ${MAJOR}.${MINOR})
elseif (PTEX_INCLUDE_DIR AND EXISTS "${PTEX_INCLUDE_DIR}/Ptexture.h" )
@@ -111,13 +111,13 @@ elseif (PTEX_INCLUDE_DIR AND EXISTS "${PTEX_INCLUDE_DIR}/Ptexture.h" )
file(STRINGS "${PTEX_INCLUDE_DIR}/Ptexture.h" TMP REGEX "^#define PtexFileMinorVersion.*$")
string(REGEX MATCHALL "[0-9]+" MINOR ${TMP})
set(PTEX_VERSION ${API}.${MAJOR}.${MINOR})
set(PTEX_VERSION ${MAJOR}.${MINOR})
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(PTex
find_package_handle_standard_args(Ptex
REQUIRED_VARS
PTEX_INCLUDE_DIR
PTEX_LIBRARY
@@ -126,7 +126,19 @@ find_package_handle_standard_args(PTex
)
if (PTEX_FOUND)
set(Ptex_FOUND TRUE)
set(PTEX_LIBRARIES ${PTEX_LIBRARY})
set(PTEX_INCLUDES ${PTEX_INCLUDE_DIR})
set(Ptex_VERSION ${PTEX_VERSION})
if (NOT TARGET Ptex::Ptex_dynamic)
add_library(Ptex::Ptex_dynamic UNKNOWN IMPORTED)
set_target_properties(Ptex::Ptex_dynamic PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${PTEX_INCLUDES}")
if (PTEX_LIBRARIES)
set_property(TARGET Ptex::Ptex_dynamic APPEND PROPERTY
IMPORTED_LOCATION "${PTEX_LIBRARIES}")
endif ()
endif ()
else ()
set (PTEX_INCLUDE_DIR "")
endif()
+22 -4
View File
@@ -74,7 +74,7 @@
# tbbmalloc, tbbmalloc_debug, tbb_preview, or
# tbb_preview_debug.
#
# The following varibles should be used to build and link with TBB:
# The following variables should be used to build and link with TBB:
#
# * TBB_INCLUDE_DIRS - The include directory for TBB.
# * TBB_LIBRARIES - The libraries to link against to use TBB.
@@ -134,7 +134,7 @@ if(NOT TBB_FOUND)
# Find the TBB include dir
##################################
find_path(TBB_INCLUDE_DIRS tbb/tbb.h
find_path(TBB_INCLUDE_DIRS tbb/tbb_stddef.h
HINTS ${TBB_INCLUDE_DIR} ${TBB_SEARCH_DIR}
PATHS ${TBB_DEFAULT_SEARCH_DIR})
@@ -208,7 +208,25 @@ if(NOT TBB_FOUND)
REQUIRED_VARS TBB_INCLUDE_DIRS TBB_LIBRARIES
HANDLE_COMPONENTS
VERSION_VAR TBB_VERSION)
mark_as_advanced(TBB_INCLUDE_DIRS TBB_LIBRARIES)
mark_as_advanced(TBB_INCLUDE_DIRS TBB_LIBRARIES)
set(_tbb_version_file)
# Add targets
if (TBB_FOUND)
if (NOT TARGET TBB::tbb)
add_library(TBB::tbb UNKNOWN IMPORTED)
set_target_properties(TBB::tbb PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${TBB_INCLUDE_DIRS})
set_property(TARGET TBB::tbb APPEND PROPERTY
IMPORTED_LOCATION ${TBB_tbb_LIBRARY})
endif ()
if (NOT TARGET TBB::tbbmalloc)
add_library(TBB::tbbmalloc UNKNOWN IMPORTED)
set_target_properties(TBB::tbbmalloc PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${TBB_INCLUDE_DIRS})
set_property(TARGET TBB::tbbmalloc APPEND PROPERTY
IMPORTED_LOCATION ${TBB_tbbmalloc_LIBRARY})
endif ()
endif()
endif()
+63
View File
@@ -0,0 +1,63 @@
# 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
#
# This doesn't work, because the webp headers don't seem to include any
# definitions giving the version:
# 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)
find_library (WEBPDEMUX_LIBRARY webpdemux
HINTS
${WEBP_LIBRARY_PATH}
ENV WEBP_LIBRARY_PATH)
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (WebP
REQUIRED_VARS WEBP_INCLUDE_DIR
WEBP_LIBRARY WEBPDEMUX_LIBRARY
)
if (WebP_FOUND)
set (WEBP_INCLUDES "${WEBP_INCLUDE_DIR}")
set (WEBP_LIBRARIES ${WEBP_LIBRARY} ${WEBPDEMUX_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_LIBRARY})
endif ()
if (NOT TARGET WebP::WebPDemux)
add_library(WebP::WebPDemux UNKNOWN IMPORTED)
set_target_properties(WebP::WebPDemux PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${WEBP_INCLUDES})
set_property(TARGET WebP::WebPDemux APPEND PROPERTY
IMPORTED_LOCATION ${WEBPDEMUX_LIBRARY})
endif ()
endif ()
mark_as_advanced (
WEBP_INCLUDE_DIR
WEBP_LIBRARY
WEBPDEMUX_LIBRARY
)
-49
View File
@@ -1,49 +0,0 @@
# 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
)
+79
View File
@@ -0,0 +1,79 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio
# Find the pugixml XML parsing library.
#
# Sets the usual variables expected for find_package scripts:
#
# PUGIXML_INCLUDES - header location
# PUGIXML_LIBRARIES - library to link against
# PUGIXML_FOUND - true if pugixml was found.
# First try the config files and hope they're good enough
find_package (pugixml CONFIG)
if (TARGET pugixml::pugixml)
# New pugixml (>= 1.11) has nice config files we can rely on and makes a
# pugixml::pugixml target.
if (VERBOSE)
message (STATUS "Found CONFIG for pugixml (>=1.11)")
endif ()
set (PUGIXML_FOUND true)
set (pugixml_FOUND true)
get_target_property(PUGIXML_INCLUDES pugixml::pugixml INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(PUGIXML_LIBRARIES pugixml::pugixml INTERFACE_LINK_LIBRARIES)
# elseif (TARGET pugixml)
# # But older pugixml (<= 1.10) has mediocre config files that are not
# # reliable in practice. They also only define a "pugixml" target but
# # not "pugixml::pugixml". So just fall through to the "no config" case
# # below, and figure everything out by hand.
else ()
# If no config file is found for PugiXML, do it the old fashioned way.
find_path (PUGIXML_INCLUDE_DIR
NAMES pugixml.hpp
PATH_SUFFIXES pugixml-1.8 pugixml-1.9 pugixml-1.10)
set (pugixml_required_vars PUGIXML_INCLUDE_DIR)
find_library (PUGIXML_LIBRARY
NAMES pugixml
PATH_SUFFIXES pugixml-1.8 pugixml-1.9 pugixml-1.10)
if (PUGIXML_INCLUDE_DIR)
file (STRINGS "${PUGIXML_INCLUDE_DIR}/pugixml.hpp" TMP REGEX "define PUGIXML_VERSION .*$")
string (REGEX MATCHALL "[0-9]+" PUGIXML_CODED_VERSION ${TMP})
if (PUGIXML_CODED_VERSION VERSION_GREATER_EQUAL 1000)
math (EXPR PUGIXML_VERSION_MAJOR "${PUGIXML_CODED_VERSION} / 1000")
math (EXPR PUGIXML_VERSION_MINOR "(${PUGIXML_CODED_VERSION} % 1000) / 10")
else ()
math (EXPR PUGIXML_VERSION_MAJOR "${PUGIXML_CODED_VERSION} / 100")
math (EXPR PUGIXML_VERSION_MINOR "(${PUGIXML_CODED_VERSION} % 100) / 10")
endif ()
set (PUGIXML_VERSION ${PUGIXML_VERSION_MAJOR}.${PUGIXML_VERSION_MINOR})
endif ()
# 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 OR pugixml_FOUND)
set (PUGIXML_INCLUDES ${PUGIXML_INCLUDE_DIR})
set (PUGIXML_LIBRARIES ${PUGIXML_LIBRARY})
if (NOT TARGET pugixml::pugixml)
add_library(pugixml::pugixml UNKNOWN IMPORTED)
set_target_properties(pugixml::pugixml PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${PUGIXML_INCLUDES}")
if (PUGIXML_LIBRARIES)
set_property(TARGET pugixml::pugixml APPEND PROPERTY
IMPORTED_LOCATION "${PUGIXML_LIBRARIES}")
endif ()
endif ()
endif ()
mark_as_advanced (PUGIXML_LIBRARY PUGIXML_INCLUDE_DIR)
endif()
-257
View File
@@ -1,257 +0,0 @@
# 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 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
# expected to be called *after* the OpenImageIO target is declared), it will
# create a new target to build the full plugin. On the other hand, if
# EMBEDPLUGINS is 1 (in which case this should be called *before* the
# OpenImageIO target is declared), it will merely append the required
# definitions, includs, and libraries to lists format_plugin_blah that will
# be handed off too the setup of the later OpenImageIO target.
#
macro (add_oiio_plugin)
cmake_parse_arguments (_plugin "" "NAME" "SRC;INCLUDE_DIRS;LINK_LIBRARIES;DEFINITIONS" ${ARGN})
# Arguments: <prefix> <options> <one_value_keywords> <multi_value_keywords> args...
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 ()
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:
# oiio_set_testenv ( testname
# testsuite - The root of all tests ${CMAKE_SOURCE_DIR}/testsuite
# testsrcdir - Current test directory in ${CMAKE_SOURCE_DIR}
# testdir - Current test sandbox in ${CMAKE_BINARY_DIR}
# IMAGEDIR - Optional path to image reference/compare directory)
#
macro (oiio_set_testenv testname testsuite testsrcdir testdir IMAGEDIR)
set_property(TEST ${testname} PROPERTY ENVIRONMENT
"OIIO_TESTSUITE_ROOT=${testsuite}"
";OIIO_TESTSUITE_SRC=${testsrcdir}"
";OIIO_TESTSUITE_CUR=${testdir}")
if (NOT ${IMAGEDIR} STREQUAL "")
set_property(TEST ${testname} APPEND PROPERTY ENVIRONMENT
"OIIO_TESTSUITE_IMAGEDIR=${IMAGEDIR}")
endif()
endmacro ()
# oiio_add_tests() - add a set of test cases.
#
# Usage:
# oiio_add_tests ( test1 [ test2 ... ]
# [ IMAGEDIR name_of_reference_image_directory ]
# [ 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;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.
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.
message (STATUS "\n\nDid not find ${_ats_testdir}")
message (STATUS " -> Will not run tests ${_ats_UNPARSED_ARGUMENTS}")
message (STATUS " -> You can find it at ${_ats_URL}\n")
else ()
# Add the tests if all is well.
set (_has_generator_expr TRUE)
foreach (_testname ${_ats_UNPARSED_ARGUMENTS})
set (_testsuite "${CMAKE_SOURCE_DIR}/testsuite")
set (_testsrcdir "${_testsuite}/${_testname}")
set (_testdir "${CMAKE_BINARY_DIR}/testsuite/${_testname}")
if (_ats_TESTNAME)
set (_testname "${_ats_TESTNAME}")
endif ()
if (_ats_LABEL MATCHES "broken")
set (_testname "${_testname}-broken")
endif ()
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 ${_runtest} )
oiio_set_testenv("${_testname}" "${_testsuite}"
"${_testsrcdir}" "${_testdir}" "${_ats_testdir}")
# For texture tests, add a second test using batch mode as well.
if (_testname MATCHES "texture")
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}" "${_testsuite}"
"${_testsrcdir}" "${_testdir}.batch" "${_ats_testdir}")
endif ()
#if (VERBOSE)
# message (STATUS "TEST ${_testname}: ${_runtest}")
#endif ()
endforeach ()
if (VERBOSE)
message (STATUS "TESTS: ${_ats_UNPARSED_ARGUMENTS}")
endif ()
endif ()
endmacro ()
+54
View File
@@ -0,0 +1,54 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio/
#########################################################################
# Packaging
set (CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set (CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set (CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
# "Vendor" is only used in copyright notices, so we use the same thing that
# the rest of the copyright notices say.
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}-${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")
file (RENAME "${CMAKE_BINARY_DIR}/cpack/LICENSE.md" "${CMAKE_BINARY_DIR}/cpack/License.txt")
set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_BINARY_DIR}/cpack/License.txt")
file (COPY "${PROJECT_SOURCE_DIR}/README.md" DESTINATION "${CMAKE_BINARY_DIR}/cpack")
set (CPACK_RESOURCE_FILE_README "${CMAKE_BINARY_DIR}/cpack/README.md")
set (CPACK_RESOURCE_FILE_WELCOME "${PROJECT_SOURCE_DIR}/src/doc/Welcome.txt")
#SET (CPACK_STRIP_FILES Do we need this?)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set (CPACK_GENERATOR "TGZ;STGZ;RPM;DEB")
set (CPACK_SOURCE_GENERATOR "TGZ")
endif ()
if (APPLE)
set (CPACK_GENERATOR "TGZ;STGZ;PackageMaker")
set (CPACK_SOURCE_GENERATOR "TGZ")
endif ()
if (WIN32)
set (CPACK_GENERATOR "NSIS")
set(CPACK_PACKAGE_EXECUTABLES "iv" "iv - Image Viewer")
# set(CPACK_CREATE_DESCTOP_LINKS "iv" "iv - Image Viewer")
set(CPACK_NSIS_MODIFY_PATH ON)
include (InstallRequiredSystemLibraries)
endif ()
set (CPACK_SOURCE_PACKAGE_FILE_NAME ${PROJECT_NAME}-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}-source)
#set (CPACK_SOURCE_STRIP_FILES Do we need this?)
set (CPACK_SOURCE_IGNORE_FILES ".*~")
set (CPACK_COMPONENT_UNSPECIFIED_HIDDEN TRUE)
set (CPACK_COMPONENT_UNSPECIFIED_REQUIRED TRUE)
set (CPACK_COMPONENTS_ALL user developer documentation Unspecified)
set (CPACK_COMPONENT_USER_DISPLAY_NAME "Applications")
set (CPACK_COMPONENT_DEVELOPER_DISPLAY_NAME "Developer files")
set (CPACK_COMPONENT_DOCUMENTATION_DISPLAY_NAME "Documentation")
set (CPACK_COMPONENT_USER_DESCRIPTION
"Applications: oiiotool, iv, iinfo, iconvert, idiff, igrep, maketx and libraries")
set (CPACK_COMPONENT_DEVELOPER_DESCRIPTION "Include files")
set (CPACK_COMPONENT_DOCUMENTATION_DESCRIPTION "OpenImageIO documentation")
set (CPACK_COMPONENT_DEVELOPER_DEPENDS user)
include (CPack)
+58 -41
View File
@@ -1,21 +1,22 @@
# Copyright 2008-present Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
# https://github.com/OpenImageIO/oiio
# Python-related options.
option (USE_PYTHON "Build the Python bindings" ON)
set (PYTHON_VERSION "2.7" CACHE STRING "Target version of python to find")
set (PYTHON_VERSION "" 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")
if (WIN32)
set (PYLIB_LIB_TYPE SHARED CACHE STRING "Type of library to build for python module (MODULE or SHARED)")
else ()
set (PYLIB_LIB_TYPE MODULE CACHE STRING "Type of library to build for python module (MODULE or SHARED)")
endif ()
# 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)
@@ -24,31 +25,38 @@ macro (find_python)
# Attempt to find the desired version, but fall back to other
# additional versions.
checked_find_package (PythonInterp ${PYTHON_VERSION} REQUIRED)
unset (_req)
if (USE_PYTHON)
set (_req REQUIRED)
if (PYTHON_VERSION)
list (APPEND _req EXACT)
endif ()
endif ()
checked_find_package (Python ${PYTHON_VERSION}
${_req}
COMPONENTS Interpreter Development
PRINT Python_VERSION Python_EXECUTABLE
Python_LIBRARIES
Python_Development_FOUND
Python_Interpreter_FOUND )
# The version that was found may not be the default or user
# defined one.
set (PYTHON_VERSION_FOUND ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
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 ()
# Give hints to subsequent pybind11 searching to ensure that it finds
# exactly the same version that we found.
set (PythonInterp_FIND_VERSION PYTHON_VERSION_FOUND)
set (PythonInterp_FIND_VERSION_MAJOR ${Python_VERSION_MAJOR})
if (NOT DEFINED PYTHON_SITE_DIR)
set (PYTHON_SITE_DIR "${CMAKE_INSTALL_LIBDIR}/python${PYTHON_VERSION_FOUND}/site-packages")
endif ()
if (VERBOSE)
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}")
endif ()
endmacro()
@@ -56,7 +64,7 @@ endmacro()
# pybind11
macro (setup_python_module)
cmake_parse_arguments (lib "" "TARGET;MODULE;LIBS" "SOURCES" ${ARGN})
cmake_parse_arguments (lib "" "TARGET;MODULE" "SOURCES;LIBS" ${ARGN})
# Arguments: <prefix> <options> <one_value_keywords> <multi_value_keywords> args...
set (target_name ${lib_TARGET})
@@ -66,20 +74,22 @@ macro (setup_python_module)
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})
pybind11_add_module(${target_name} ${PYLIB_LIB_TYPE} ${lib_SOURCES})
# # Add the library itself
# add_library (${target_name} MODULE ${lib_SOURCES})
#
# 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})
target_link_libraries (${target_name}
PRIVATE ${lib_LIBS} ${SANITIZE_LIBRARIES})
set (_module_LINK_FLAGS "${VISIBILITY_MAP_COMMAND} ${EXTRA_DSO_LINK_ARGS}")
if (UNIX AND NOT APPLE)
# Hide symbols from any static dependent libraries embedded here.
set (_module_LINK_FLAGS "${_module_LINK_FLAGS} -Wl,--exclude-libs,ALL")
endif ()
set_target_properties (${target_name} PROPERTIES LINK_FLAGS ${_module_LINK_FLAGS})
# Exclude the 'lib' prefix from the name
if (NOT PYLIB_LIB_PREFIX)
@@ -87,7 +97,8 @@ macro (setup_python_module)
PRIVATE "PYMODULE_NAME=${lib_MODULE}")
set_target_properties (${target_name} PROPERTIES
OUTPUT_NAME ${lib_MODULE}
PREFIX "")
# PREFIX ""
)
else ()
target_compile_definitions(${target_name}
PRIVATE "PYMODULE_NAME=Py${lib_MODULE}")
@@ -96,6 +107,12 @@ macro (setup_python_module)
PREFIX lib)
endif ()
# Even if using a debug postfix, don't use it for the python module, or
# python won't find it properly.
set_target_properties(PyOpenImageIO PROPERTIES
DEBUG_POSTFIX "")
# This is only needed for SpComp2
if (PYLIB_INCLUDE_SONAME)
if (VERBOSE)
message(STATUS "Setting Py${lib_MODULE} SOVERSION to: ${SOVERSION}")
@@ -105,11 +122,11 @@ macro (setup_python_module)
SOVERSION ${SOVERSION} )
endif()
if (WIN32)
set_target_properties (${target_name} PROPERTIES
DEBUG_POSTFIX "_d"
SUFFIX ".pyd")
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"
+371
View File
@@ -0,0 +1,371 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio/
include (CTest)
# 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_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_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" )
# set(OIIO_TESTSUITE_IMAGEDIR "${PROJECT_SOURCE_DIR}/.." CACHE PATH
set(OIIO_TESTSUITE_IMAGEDIR "${PROJECT_BINARY_DIR}/testsuite" CACHE PATH
"Location of oiio-images, openexr-images, libtiffpic, etc.." )
# oiio_set_testenv() - add environment variables to a test
#
# Usage:
# oiio_set_testenv ( testname
# testsuite - The root of all tests ${CMAKE_SOURCE_DIR}/testsuite
# testsrcdir - Current test directory in ${CMAKE_SOURCE_DIR}
# testdir - Current test sandbox in ${CMAKE_BINARY_DIR}
# IMAGEDIR - Optional path to image reference/compare directory)
#
macro (oiio_set_testenv testname testsuite testsrcdir testdir IMAGEDIR)
set_property(TEST ${testname} PROPERTY ENVIRONMENT
"OIIO_TESTSUITE_ROOT=${testsuite}"
";OIIO_TESTSUITE_SRC=${testsrcdir}"
";OIIO_TESTSUITE_CUR=${testdir}")
if (NOT ${IMAGEDIR} STREQUAL "")
set_property(TEST ${testname} APPEND PROPERTY ENVIRONMENT
"OIIO_TESTSUITE_IMAGEDIR=${IMAGEDIR}")
endif()
endmacro ()
# oiio_add_tests() - add a set of test cases.
#
# Usage:
# oiio_add_tests ( test1 [ test2 ... ]
# [ IMAGEDIR name_of_reference_image_directory ]
# [ 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;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.
foreach (_var ${_ats_FOUNDVAR})
if (NOT ${_var})
set (_ats_LABEL "broken")
endif ()
endforeach ()
set (_test_disabled 0)
foreach (_var ${_ats_ENABLEVAR})
if ((NOT "${${_var}}" STREQUAL "" AND NOT "${${_var}}") OR
(NOT "$ENV{${_var}}" STREQUAL "" AND NOT "$ENV{${_var}}"))
set (_ats_LABEL "broken")
set (_test_disabled 1)
endif ()
endforeach ()
if (_test_disabled)
message (STATUS "Skipping test(s) ${_ats_UNPARSED_ARGUMENTS} because of disabled ${_ats_ENABLEVAR}")
elseif (_ats_IMAGEDIR AND NOT EXISTS ${_ats_testdir})
# If the directory containing reference data (images) for the test
# isn't found, point the user at the URL.
message (STATUS "\n\nDid not find ${_ats_testdir}")
message (STATUS " -> Will not run tests ${_ats_UNPARSED_ARGUMENTS}")
message (STATUS " -> You can find it at ${_ats_URL}\n")
else ()
# Add the tests if all is well.
set (_has_generator_expr TRUE)
foreach (_testname ${_ats_UNPARSED_ARGUMENTS})
set (_testsuite "${CMAKE_SOURCE_DIR}/testsuite")
set (_testsrcdir "${_testsuite}/${_testname}")
set (_testdir "${CMAKE_BINARY_DIR}/testsuite/${_testname}")
if (_ats_TESTNAME)
set (_testname "${_ats_TESTNAME}")
endif ()
if (_ats_LABEL MATCHES "broken")
set (_testname "${_testname}-broken")
endif ()
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 ${_runtest} )
oiio_set_testenv("${_testname}" "${_testsuite}"
"${_testsrcdir}" "${_testdir}" "${_ats_testdir}")
# For texture tests, add a second test using batch mode as well.
if (_testname MATCHES "texture")
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}" "${_testsuite}"
"${_testsrcdir}" "${_testdir}.batch" "${_ats_testdir}")
endif ()
#if (VERBOSE)
# message (STATUS "TEST ${_testname}: ${_runtest}")
#endif ()
endforeach ()
if (VERBOSE)
message (STATUS "TESTS: ${_ats_UNPARSED_ARGUMENTS}")
endif ()
endif ()
endmacro ()
# The tests are organized into a macro so it can be called after all the
# directories with plugins are included.
#
macro (oiio_add_all_tests)
# Tests that require oiio-images:
oiio_add_tests (gpsread
oiiotool oiiotool-attribs oiiotool-copy
oiiotool-xform
maketx oiiotool-maketx
misnamed-file
texture-crop texture-cropover
texture-filtersize
texture-filtersize-stochastic
texture-overscan
texture-wrapfill
texture-res texture-maxres
IMAGEDIR oiio-images URL "Recent checkout of oiio-images"
)
# Remaining freestanding tests:
oiio_add_tests (
cmake-consumer
nonwhole-tiles
oiiotool-composite oiiotool-control
oiiotool-fixnan
oiiotool-pattern
oiiotool-readerror
oiiotool-subimage oiiotool-text
diff
dither dup-channels
jpeg-corrupt
missingcolor
null
rational
texture-derivs texture-fill
texture-flipt texture-gettexels texture-gray
texture-interp-bicubic
texture-blurtube
texture-half texture-uint16
texture-interp-bilinear
texture-interp-closest
texture-mip-nomip texture-mip-onelevel
texture-mip-trilinear
texture-mip-stochastictrilinear
texture-mip-stochasticaniso
texture-missing
texture-pointsample
texture-udim texture-udim2
texture-uint8
texture-width0blur
texture-fat texture-skinny
)
# Add tests that require the Python bindings if we built the Python
# bindings. This is mostly the test that are specifically about testing
# the Python bindings themselves, but also a handful of tests that are
# mainly about other things but happen to use Python in order to perform
# thee test.
# 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 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
python-texturesys
IMAGEDIR oiio-images
)
endif ()
oiio_add_tests (oiiotool-color
FOUNDVAR OPENCOLORIO_FOUND)
if (NOT DEFINED ENV{${PROJECT_NAME}_CI})
oiio_add_tests (texture-icwrite)
endif ()
# 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
ENABLEVAR ENABLE_BMP
IMAGEDIR oiio-images/bmpsuite)
oiio_add_tests (dpx
ENABLEVAR ENABLE_DPX
IMAGEDIR oiio-images URL "Recent checkout of oiio-images")
oiio_add_tests (dds
ENABLEVAR ENABLE_DDS
IMAGEDIR oiio-images/dds URL "Recent checkout of oiio-images")
oiio_add_tests (fits
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 (hdr
ENABLEVAR ENABLE_HDR
IMAGEDIR openexr-images
URL http://github.com/AcademySoftwareFoundation/openexr-images)
oiio_add_tests (heif
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 perchannel
oiiotool-deep
IMAGEDIR openexr-images
URL http://github.com/AcademySoftwareFoundation/openexr-images)
if (NOT DEFINED ENV{${PROJECT_NAME}_CI})
oiio_add_tests (openexr-damaged
IMAGEDIR openexr-images
URL http://github.com/AcademySoftwareFoundation/openexr-images)
endif ()
oiio_add_tests (openvdb texture-texture3d
FOUNDVAR OpenVDB_FOUND ENABLEVAR ENABLE_OpenVDB)
oiio_add_tests (png
ENABLEVAR ENABLE_PNG
IMAGEDIR oiio-images)
oiio_add_tests (pnm
ENABLEVAR ENABLE_PNM
IMAGEDIR oiio-images)
oiio_add_tests (psd psd-colormodes
ENABLEVAR ENABLE_PSD
IMAGEDIR 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)
oiio_add_tests (rla
ENABLEVAR ENABLE_RLA
IMAGEDIR oiio-images)
oiio_add_tests (sgi
ENABLEVAR ENABLE_SGI
IMAGEDIR oiio-images)
oiio_add_tests (targa
ENABLEVAR ENABLE_TARGA
IMAGEDIR oiio-images)
oiio_add_tests (tiff-suite tiff-depths tiff-misc
IMAGEDIR oiio-images/libtiffpic)
oiio_add_tests (webp
FOUNDVAR WebP_FOUND ENABLEVAR ENABLE_WebP
IMAGEDIR oiio-images/webp)
oiio_add_tests (zfile ENABLEVAR ENABLE_ZFILE
IMAGEDIR oiio-images)
if (SPI_TESTS)
oiio_add_tests (oiiotool-spi
FOUNDVAR SPI_TESTS
IMAGEDIR spi-oiio-tests
URL "noplace -- it's SPI specific tests")
endif ()
endmacro()
set (OIIO_LOCAL_TESTDATA_ROOT "${CMAKE_SOURCE_DIR}/.." CACHE PATH
"Directory to check for local copies of testsuite data")
option (OIIO_DOWNLOAD_MISSING_TESTDATA "Try to download any missing test data" ON)
function (oiio_get_test_data name)
cmake_parse_arguments (_ogtd "" "REPO;BRANCH" "" ${ARGN})
# Arguments: <prefix> <options> <one_value_keywords> <multi_value_keywords> args...
if (IS_DIRECTORY "${OIIO_LOCAL_TESTDATA_ROOT}/${name}"
AND NOT EXISTS "${CMAKE_BINARY_DIR}/testsuite/${name}")
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.14)
# Just make a link if we can
message (STATUS "Linking ${name} from ${OIIO_LOCAL_TESTDATA_ROOT}/../${name}")
file (CREATE_LINK "${OIIO_LOCAL_TESTDATA_ROOT}/${name}"
"${CMAKE_BINARY_DIR}/testsuite/${name}"
SYMBOLIC COPY_ON_ERROR)
else ()
# Older cmake -- copy
message (STATUS "Copying ${name} from ${OIIO_LOCAL_TESTDATA_ROOT}/../${name}")
file (COPY "${OIIO_LOCAL_TESTDATA_ROOT}/${name}"
DESTINATION "${CMAKE_BINARY_DIR}/testsuite")
endif ()
elseif (IS_DIRECTORY "${CMAKE_BINARY_DIR}/testsuite/${name}")
message (STATUS "Test data for ${name} already present in testsuite")
elseif (OIIO_DOWNLOAD_MISSING_TESTDATA)
# Test data directory didn't exist -- fetch it
if (_ogtd_REPO)
message (STATUS "Cloning ${name} from ${_ogtd_REPO}")
if (NOT _ogtd_BRANCH)
set (_ogtd_BRANCH master)
endif ()
find_package (Git)
if (Git_FOUND AND GIT_EXECUTABLE)
execute_process(COMMAND ${GIT_EXECUTABLE} clone --depth 1
${_ogtd_REPO} -b ${_ogtd_BRANCH}
${CMAKE_BINARY_DIR}/testsuite/${name})
else ()
message (WARNING "Could not find Git executable, could not download test data from ${_ogtd_REPO}")
endif ()
endif ()
else ()
message (STATUS "Missing test data ${name}")
endif ()
endfunction()
function (oiio_setup_test_data)
oiio_get_test_data (oiio-images
REPO https://github.com/OpenImageIO/oiio-images.git)
oiio_get_test_data (openexr-images
REPO https://github.com/AcademySoftwareFoundation/openexr-images.git)
oiio_get_test_data (fits-images)
oiio_get_test_data (j2kp4files_v1_5)
endfunction ()
+3 -2
View File
@@ -1,11 +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
# https://github.com/OpenImageIO/oiio
if (Libsquish_FOUND)
# External libsquish was found -- use it
add_oiio_plugin (ddsinput.cpp
LINK_LIBRARIES Libsquish::Libsquish
INCLUDE_DIRS ${LIBSQUISH_INCLUDES}
LINK_LIBRARIES ${LIBSQUISH_LIBRARIES}
)
else ()
# No external libsquish was found -- use the embedded version.
+1 -1
View File
@@ -1,6 +1,6 @@
// Copyright 2008-present Contributors to the OpenImageIO project.
// SPDX-License-Identifier: BSD-3-Clause
// https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
// https://github.com/OpenImageIO/oiio
#pragma once
+36 -42
View File
@@ -1,6 +1,6 @@
// Copyright 2008-present Contributors to the OpenImageIO project.
// SPDX-License-Identifier: BSD-3-Clause
// https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
// https://github.com/OpenImageIO/oiio
#include <cmath>
#include <cstdio>
@@ -27,16 +27,22 @@ public:
DDSInput() { init(); }
virtual ~DDSInput() { close(); }
virtual const char* format_name(void) const override { return "dds"; }
virtual int supports(string_view feature) const override
{
return feature == "ioproxy";
}
virtual bool open(const std::string& name, ImageSpec& newspec) override;
virtual bool open(const std::string& name, ImageSpec& spec,
const ImageSpec& config) override;
virtual bool close() override;
virtual int current_subimage(void) const override
{
lock_guard lock(m_mutex);
lock_guard lock(*this);
return m_subimage;
}
virtual int current_miplevel(void) const override
{
lock_guard lock(m_mutex);
lock_guard lock(*this);
return m_miplevel;
}
virtual bool seek_subimage(int subimage, int miplevel) override;
@@ -47,7 +53,6 @@ public:
private:
std::string m_filename; ///< Stash the filename
FILE* m_file; ///< Open image handle
std::vector<unsigned char> m_buf; ///< Buffer the image pixels
int m_subimage;
int m_miplevel;
@@ -58,17 +63,16 @@ private:
int m_greenL, m_greenR; ///< Bit shifts to extract green channel
int m_blueL, m_blueR; ///< Bit shifts to extract blue channel
int m_alphaL, m_alphaR; ///< Bit shifts to extract alpha channel
dds_header m_dds; ///< DDS header
dds_header m_dds; ///< DDS header
/// Reset everything to initial state
///
void init()
{
m_file = NULL;
m_subimage = -1;
m_miplevel = -1;
m_buf.clear();
ioproxy_clear();
}
/// Helper function: read the image as scanlines (all but cubemaps).
@@ -90,16 +94,6 @@ private:
/// Helper function: performs the actual pixel decoding.
bool internal_readimg(unsigned char* dst, int w, int h, int d);
/// Helper: read, with error detection
///
bool fread(void* buf, size_t itemsize, size_t nitems)
{
size_t n = ::fread(buf, itemsize, nitems, m_file);
if (n != nitems)
errorf("Read error");
return n == nitems;
}
};
@@ -127,22 +121,29 @@ OIIO_PLUGIN_EXPORTS_END
bool
DDSInput::open(const std::string& name, ImageSpec& newspec,
const ImageSpec& config)
{
ioproxy_retrieve_from_config(config);
return open(name, newspec);
}
bool
DDSInput::open(const std::string& name, ImageSpec& newspec)
{
m_filename = name;
m_file = Filesystem::fopen(name, "rb");
if (!m_file) {
errorf("Could not open file \"%s\"", name);
if (!ioproxy_use_or_open(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
// struct from file; to address 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 (!ioread(&m_dds.memb, sizeof(m_dds.memb), 1)) \
return false
RH(fourCC);
@@ -155,7 +156,7 @@ DDSInput::open(const std::string& name, ImageSpec& newspec)
RH(mipmaps);
// advance the file pointer by 44 bytes (reserved fields)
fseek(m_file, 44, SEEK_CUR);
ioseek(44, SEEK_CUR);
// pixel format struct
RH(fmt.size);
@@ -172,7 +173,7 @@ DDSInput::open(const std::string& name, ImageSpec& newspec)
RH(caps.flags2);
// advance the file pointer by 8 bytes (reserved fields)
fseek(m_file, 8, SEEK_CUR);
ioseek(8, SEEK_CUR);
#undef RH
if (bigendian()) {
// DDS files are little-endian
@@ -384,7 +385,7 @@ DDSInput::internal_seek_subimage(int cubeface, int miplevel, unsigned int& w,
}
}
// seek to the offset we've found
fseek(m_file, ofs, SEEK_SET);
ioseek(ofs, SEEK_SET);
}
@@ -454,15 +455,14 @@ DDSInput::seek_subimage(int subimage, int miplevel)
tempstr += ((char*)&m_dds.fmt.fourCC)[3];
m_spec.attribute("compression", tempstr);
}
m_spec.attribute("oiio:BitsPerSample", m_dds.fmt.bpp);
if (m_dds.fmt.bpp)
m_spec.attribute("oiio:BitsPerSample", m_dds.fmt.bpp);
m_spec.default_channel_names();
// detect texture type
if (m_dds.caps.flags2 & DDS_CAPS2_VOLUME) {
m_spec.attribute("texturetype", "Volume Texture");
m_spec.attribute("textureformat", "Volume Texture");
} else if (m_dds.caps.flags2 & DDS_CAPS2_CUBEMAP) {
m_spec.attribute("texturetype", "Environment");
m_spec.attribute("textureformat", "CubeFace Environment");
// check available cube map sides
std::string sides = "";
@@ -495,7 +495,6 @@ DDSInput::seek_subimage(int subimage, int miplevel)
}
m_spec.attribute("dds:CubeMapSides", sides);
} else {
m_spec.attribute("texturetype", "Plain Texture");
m_spec.attribute("textureformat", "Plain Texture");
}
@@ -525,7 +524,7 @@ DDSInput::internal_readimg(unsigned char* dst, int w, int h, int d)
std::vector<squish::u8> tmp(
squish::GetStorageRequirements(w, h, flags));
// load image into buffer
if (!fread(&tmp[0], tmp.size(), 1))
if (!ioread(&tmp[0], tmp.size(), 1))
return false;
// decompress image
squish::DecompressImage(dst, w, h, &tmp[0], flags);
@@ -551,14 +550,14 @@ DDSInput::internal_readimg(unsigned char* dst, int w, int h, int d)
// HACK: shortcut for luminance
if (m_dds.fmt.flags & DDS_PF_LUMINANCE) {
return fread(dst, w * m_Bpp, h);
return ioread(dst, w * m_Bpp, h);
}
int k, pixel = 0;
for (int z = 0; z < d; z++) {
for (int y = 0; y < h; y++) {
for (int x = 0; x < w; x++) {
if (!fread(&pixel, 1, m_Bpp))
if (!ioread(&pixel, 1, m_Bpp))
return false;
k = (z * h * w + y * w + x) * m_spec.nchannels;
dst[k + 0] = ((pixel & m_dds.fmt.rmask) >> m_redR)
@@ -582,7 +581,7 @@ DDSInput::internal_readimg(unsigned char* dst, int w, int h, int d)
bool
DDSInput::readimg_scanlines()
{
//std::cerr << "[dds] readimg: " << ftell (m_file) << "\n";
//std::cerr << "[dds] readimg: " << ftell() << "\n";
// resize destination buffer
m_buf.resize(m_spec.scanline_bytes() * m_spec.height * m_spec.depth
/*/ (1 << m_miplevel)*/);
@@ -608,11 +607,6 @@ DDSInput::readimg_tiles()
bool
DDSInput::close()
{
if (m_file) {
fclose(m_file);
m_file = NULL;
}
init(); // Reset to initial state
return true;
}
@@ -623,7 +617,7 @@ bool
DDSInput::read_native_scanline(int subimage, int miplevel, int y, int z,
void* data)
{
lock_guard lock(m_mutex);
lock_guard lock(*this);
if (!seek_subimage(subimage, miplevel))
return false;
@@ -644,7 +638,7 @@ bool
DDSInput::read_native_tile(int subimage, int miplevel, int x, int y, int z,
void* data)
{
lock_guard lock(m_mutex);
lock_guard lock(*this);
if (!seek_subimage(subimage, miplevel))
return false;
+1 -1
View File
@@ -53,6 +53,6 @@ private:
bool m_transparent;
};
} // namespace sqish
} // namespace squish
#endif // ndef SQUISH_COLOURSET_H
+1 -1
View File
@@ -1,6 +1,6 @@
# Copyright 2008-present Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
# https://github.com/OpenImageIO/oiio
if (DCMTK_FOUND)
add_oiio_plugin (dicominput.cpp
+2 -2
View File
@@ -1,6 +1,6 @@
// Copyright 2008-present Contributors to the OpenImageIO project.
// SPDX-License-Identifier: BSD-3-Clause
// https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
// https://github.com/OpenImageIO/oiio
#include <OpenImageIO/fmath.h>
#include <OpenImageIO/imageio.h>
@@ -326,7 +326,7 @@ bool
DICOMInput::read_native_scanline(int subimage, int miplevel, int y, int /*z*/,
void* data)
{
lock_guard lock(m_mutex);
lock_guard lock(*this);
if (!seek_subimage(subimage, miplevel))
return false;
if (y < 0 || y >= m_spec.height) // out of range scanline
+4
View File
@@ -3,5 +3,9 @@
*.log
*.out
*.toc
*.turd
/openimageio.ilg
/openimageio.ind
_markdown_openimageio/
_minted-openimageio/
_static/
+4 -7
View File
@@ -1,12 +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
# https://github.com/OpenImageIO/oiio
project(documentation)
set (public_docs
"${OpenImageIO_SOURCE_DIR}/LICENSE.md"
"${OpenImageIO_SOURCE_DIR}/LICENSE-THIRD-PARTY.md"
"${OpenImageIO_SOURCE_DIR}/THIRD-PARTY.md"
"${OpenImageIO_SOURCE_DIR}/CHANGES.md"
CHANGES-0.x.md
CHANGES-1.x.md
@@ -21,10 +21,7 @@ endif()
# generate man pages using txt2man and a tiny python script to munge the
# result of "$tool --help"
find_program(TXT2MAN txt2man)
if (NOT PYTHONINTERP_FOUND)
find_package(PythonInterp)
endif ()
if (UNIX AND TXT2MAN AND PYTHONINTERP_FOUND)
if (UNIX AND TXT2MAN AND Python_Interpreter_FOUND)
message (STATUS "Unix man page documentation will be generated")
set (cli_tools oiiotool iinfo maketx idiff igrep iconvert)
@@ -37,7 +34,7 @@ if (UNIX AND TXT2MAN AND PYTHONINTERP_FOUND)
list (APPEND manpage_files ${outfile})
add_custom_command (OUTPUT ${outfile}
COMMAND ${tool} --help |
${PYTHON_EXECUTABLE} "${documentation_SOURCE_DIR}/help2man_preformat.py" |
${Python_EXECUTABLE} "${documentation_SOURCE_DIR}/help2man_preformat.py" |
${TXT2MAN} -v OpenImageIO -s 1 -t ${tool} > ${outfile}
DEPENDS ${tool} help2man_preformat.py)
endforeach()
+16 -6
View File
@@ -99,7 +99,7 @@ OUTPUT_LANGUAGE = English
# Possible values are: None, LTR, RTL and Context.
# The default value is: None.
OUTPUT_TEXT_DIRECTION = None
#OUTPUT_TEXT_DIRECTION = None
# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member
# descriptions after the members that are listed in the file and class
@@ -1120,7 +1120,7 @@ ALPHABETICAL_INDEX = YES
# Minimum value: 1, maximum value: 20, default value: 5.
# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
COLS_IN_ALPHA_INDEX = 5
# COLS_IN_ALPHA_INDEX = 5
# In case all classes in a project start with a common prefix, all classes will
# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
@@ -1850,7 +1850,7 @@ LATEX_HIDE_INDICES = NO
# The default value is: NO.
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_SOURCE_CODE = YES
# LATEX_SOURCE_CODE = YES
# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
# bibliography, e.g. plainnat, or ieeetr. See
@@ -1940,7 +1940,7 @@ RTF_EXTENSIONS_FILE =
# The default value is: NO.
# This tag requires that the tag GENERATE_RTF is set to YES.
RTF_SOURCE_CODE = NO
# RTF_SOURCE_CODE = NO
#---------------------------------------------------------------------------
# Configuration options related to the man page output
@@ -2045,7 +2045,7 @@ DOCBOOK_OUTPUT = docbook
# The default value is: NO.
# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
DOCBOOK_PROGRAMLISTING = NO
# DOCBOOK_PROGRAMLISTING = NO
#---------------------------------------------------------------------------
# Configuration options for the AutoGen Definitions output
@@ -2155,18 +2155,28 @@ INCLUDE_FILE_PATTERNS = *.h
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
PREDEFINED = DOXYGEN_SHOULD_SKIP_THIS \
OIIO_DOXYGEN:=1 \
OIIO_NO_SANITIZE_ADDRESS:= \
OIIO_API:= \
OIIO_UTIL_API:= \
OIIOC_API:= \
OIIO_HOSTDEVICE= \
OIIO_NAMESPACE_BEGIN="namespace OIIO {" \
OIIO_NAMESPACE_END="}" \
OIIO_CONSTEXPR14=constexpr \
OIIO_CONSTEXPR17=constexpr \
OIIO_CONSTEXPR20=constexpr \
OIIO_INLINE_CONSTEXPR="inline constexpr" \
OIIO_PURE_FUNC= \
OIIO_CONST_FUNC= \
OIIO_MAYBE_UNUSED= \
OIIO_NODISCARD=[[nodiscard]] \
OIIO_FORCEINLINE=inline
OIIO_DEPRECATED:=[[deprecated]] \
OIIO_FORMAT_DEPRECATED:= \
OIIO_FORCEINLINE=inline \
IMATH_HALF_H_=1 \
INCLUDED_IMATHVEC_H=1 \
INCLUDED_IMATHMATRIX_H=1 \
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
+15 -29
View File
@@ -1,7 +1,7 @@
.PHONY: figures
include ../make/detectplatform.mk
BUILDDIR := ../../build/${platform}
#include ../make/detectplatform.mk
BUILDDIR := ../../build
ifeq (${OIIOTOOL},)
ifneq (${shell ls ${BUILDDIR}/bin/oiiotool},)
OIIOTOOL := "${BUILDDIR}/bin/oiiotool"
@@ -11,26 +11,23 @@ ifeq (${OIIOTOOL},)
endif
PDFLATEX := pdflatex -file-line-error --halt-on-error -interaction=errorstopmode
# by default, just make the document
all: openimageio.pdf
help:
@echo "help"
@echo "BUILDDIR=${BUILDDIR}"
@echo "Interesting targets:"
@echo " sphinx Build html docs in BUILDDIR/sphinx"
@echo " sphinxpdf Build pdf docs in BUILDDIR/sphinx"
@echo " doxygen Doxygen pre-pass needed before sphinx"
@echo " doxygenclean Reset doxygen pass"
@echo " figures Rebuild all figures (DON'T DO THIS!)"
@echo " cleanfigures Clear all figures (DEFINITELY DON'T DO THIS!)"
# @echo "Sphinx targets:"
# @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(SPHINXBUILDDIR)" $(SPHINXOPTS) $(O)
# document making rule: use pdflatex
openimageio.pdf: *.tex *.aux figures.turd
${PDFLATEX} openimageio.tex
.PHONY: help Makefile
# special command 'make index' to regenerate the index
index: openimageio_index
openimageio_index: figures
${PDFLATEX} openimageio.tex
${PDFLATEX} openimageio.tex
makeindex openimageio
${PDFLATEX} openimageio.tex
figures:
(cmake -E make_directory figures ; \
cd figures ; \
@@ -45,13 +42,6 @@ cleanfigures:
cmake -E remove_directory figures
help:
@echo "help"
@echo "BUILDDIR=${BUILDDIR}"
@echo "Sphinx targets:"
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(SPHINXBUILDDIR)" $(SPHINXOPTS) $(O)
doxygen:
echo "make doxygen TBD"
@@ -72,10 +62,6 @@ SPHINXBUILD = sphinx-build
SOURCEDIR = .
SPHINXBUILDDIR = ../../build/sphinx
# Put it first so that "make" without argument is like "make help".
#help:
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).

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