Skip to content

Changes to make it easier to hide the Imath dependency #3322

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 7, 2022

Conversation

lgritz
Copy link
Collaborator

@lgritz lgritz commented Feb 4, 2022

  • 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.

* `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.
@lgritz lgritz merged commit 1921787 into AcademySoftwareFoundation:master Feb 7, 2022
@lgritz lgritz deleted the lg-imathdep branch February 7, 2022 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant