Skip to content

Clarify #include policy and make usage consistent#2369

Merged
cary-ilm merged 4 commits into
AcademySoftwareFoundation:mainfrom
cary-ilm:header-dir-doc
May 5, 2026
Merged

Clarify #include policy and make usage consistent#2369
cary-ilm merged 4 commits into
AcademySoftwareFoundation:mainfrom
cary-ilm:header-dir-doc

Conversation

@cary-ilm
Copy link
Copy Markdown
Member

This explains the OpenEXR policy regarding the "OpenEXR/" subdirectory for include files: headers are installed under the "OpenEXR" subdirectory, and the library supports application code that uses either the bare header or the "OpenEXR subdirectory, i.e either one of:

#include <ImfHeader.h>
#include <OpenEXR/ImfHeader.h>

Both cmake config and pkg-config add -I$include and -I$include/OpenEXR as compilation args.

This policy is explained for users in the "Header Layout and #include Policy" section in website/install.rst.

Internally, all library and tool source includes bare headers, without the "OpenEXR" since the source tree maintains headers local to each library, not in a common OpenEXR directory. The only exception is code in the source tree that is expected to mimic example application code.

Internally, all library and tool source includes files via quotes "" when the header in question is either in the local directory or is one of the public headers installed in the OpenEXR. Others are included via brackets <>. Previously, this was inconsistent. Imath headers are included via <> because they come from another project.

This should address #1095

Comment thread website/install.rst Outdated
``OpenEXRCore``, ``OpenEXRUtil``, ``Iex``, ``IlmThread``), not in a
single common ``OpenEXR`` folder, they are included internally as bare
files, without a ``OpenEXR/`` subdirectory. This intentionally differs
from the installed layout.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be worth mentioning how OpenEXR includes Imath? Some user-facing header files do #includes of Imath without the prefix,, so when compiling against OpenEXR, it's always necessary to include the Imath folder itself.

(It does seem like this section conflates the library's internal design with how the application code should use the library. Perhaps a separate section on 'building code against OpenEXR' would be valuable, particularly for projects that aren't built with CMake)

@cary-ilm
Copy link
Copy Markdown
Member Author

cary-ilm commented May 1, 2026

@peterhillman, I split the header section in the install instructions into two, one for application code, here:
https://openexr--2369.org.readthedocs.build/en/2369/install.html#headers-and-include-policy

and separate section addressing the layout of headers within the OpenEXR source tree:
https://openexr--2369.org.readthedocs.build/en/2369/install.html#headers-in-the-openexr-source-tree

cary-ilm added 3 commits May 4, 2026 09:14
This explains the OpenEXR policy regarding the "OpenEXR/" subdirectory
for include files: headers are installed under the "OpenEXR"
subdirectory, and the library supports application code that uses
either the bare header or the "OpenEXR subdirectory, i.e either one
of:

    #include <ImfHeader.h>
    #include <OpenEXR/ImfHeader.h>

Both cmake config and pkg-config add -I$include and -I$include/OpenEXR
as compilation args.

This policy is explained for users in the "Header Layout and #include
Policy" section in website/install.rst.

Internally, all library and tool source includes bare headers, without
the "OpenEXR" since the source tree maintains headers local to each
library, not in a common OpenEXR directory. The only exception is code
in the source tree that is expected to mimic example application code.

Internally, all library and tool source includes files via quotes ""
when the header in question is either in the local directory or is one
of the public headers installed in the OpenEXR. Others are included
via brackets <>.  Previously, this was inconsistent.  Imath headers
are included via <> because they come from another project.

Signed-off-by: Cary Phillips <cary@ilm.com>
Signed-off-by: Cary Phillips <cary@ilm.com>
Signed-off-by: Cary Phillips <cary@ilm.com>
Copy link
Copy Markdown
Contributor

@peterhillman peterhillman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@cary-ilm cary-ilm merged commit 662ec14 into AcademySoftwareFoundation:main May 5, 2026
51 of 53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants