Skip to content

Commit

Permalink
exrcheck: update CMakeLists.txt to install the tool (AcademySoftwareF…
Browse files Browse the repository at this point in the history
…oundation#1983)

* add an OPENEXR_INSTALL_DEVELOPER_TOOLS option

This new option will control whether or not the tools
considered to be "developer" tools should be installed.
These are tools useful for developing and debugging OpenEXR
itself that might not be suitable for distribution to end
users. exrcheck is currently the only tool considered to be
a developer tool.

Signed-off-by: Matt Johnson <matt.johnson@epicgames.com>

* exrcheck: update CMakeLists.txt to enable developer tool installation

This makes the CMakeLists.txt for exrcheck look like other
tools like exrinfo and uncomments the CMake call to install
the tool. One difference though is that exrcheck is considered
a developer tool, and as such is only installed when the
OPENEXR_INSTALL_DEVELOPER_TOOLS option is enabled.

Signed-off-by: Matt Johnson <matt.johnson@epicgames.com>

---------

Signed-off-by: Matt Johnson <matt.johnson@epicgames.com>
  • Loading branch information
mattyjams authored Feb 27, 2025
1 parent df16295 commit 4077187
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ set(OPENEXR_LIB_VERSION "${OPENEXR_LIB_SOVERSION}.${OPENEXR_VERSION}") # e.g. "3

option(OPENEXR_INSTALL "Install OpenEXR libraries" ON)
option(OPENEXR_INSTALL_TOOLS "Install OpenEXR tools" ON)
option(OPENEXR_INSTALL_DEVELOPER_TOOLS "Install OpenEXR developer tools" OFF)

if(OPENEXR_INSTALL OR OPENEXR_INSTALL_TOOLS)
if(OPENEXR_INSTALL OR OPENEXR_INSTALL_TOOLS OR OPENEXR_INSTALL_DEVELOPER_TOOLS)
# uninstall target
if(NOT TARGET uninstall)
configure_file(
Expand Down
1 change: 1 addition & 0 deletions cmake/OpenEXRSetup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ option(OPENEXR_BUILD_LIBS "Enables building of main libraries" ON)
# Whether to build the various command line utility programs
option(OPENEXR_BUILD_TOOLS "Enables building of utility programs" ON)
option(OPENEXR_INSTALL_TOOLS "Install OpenEXR tools" ON)
option(OPENEXR_INSTALL_DEVELOPER_TOOLS "Install OpenEXR developer tools" OFF)

option(OPENEXR_BUILD_EXAMPLES "Build and install OpenEXR examples" ON)

Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ OPENEXR_BUILD_PYTHON = 'ON'
OPENEXR_BUILD_EXAMPLES = 'OFF'
OPENEXR_BUILD_TOOLS = 'OFF'
OPENEXR_INSTALL_TOOLS = 'OFF'
OPENEXR_INSTALL_DEVELOPER_TOOLS = 'OFF'
OPENEXR_INSTALL_PKG_CONFIG = 'OFF'
OPENEXR_FORCE_INTERNAL_DEFLATE = 'ON'
OPENEXR_FORCE_INTERNAL_IMATH = 'ON'
Expand Down
9 changes: 7 additions & 2 deletions src/bin/exrcheck/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ target_link_libraries(exrcheck OpenEXR::OpenEXR OpenEXR::OpenEXRUtil)
set_target_properties(exrcheck PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
)
# install(TARGETS exrcheck DESTINATION ${CMAKE_INSTALL_BINDIR})
if(WIN32 AND BUILD_SHARED_LIBS)

# exrcheck is considered a "developer" tool, so only install it
# when installation of developer tools is enabled.
if(OPENEXR_INSTALL_DEVELOPER_TOOLS)
install(TARGETS exrcheck DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
if(WIN32 AND (BUILD_SHARED_LIBS OR OPENEXR_BUILD_BOTH_STATIC_SHARED))
target_compile_definitions(exrcheck PRIVATE OPENEXR_DLL)
endif()
6 changes: 6 additions & 0 deletions website/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,12 @@ Component Options
Install the binary programs (exrheader, exrinfo,
exrmakepreview, etc). Default is ``ON``.

* ``OPENEXR_INSTALL_DEVELOPER_TOOLS``

Install the binary programs useful for developing
and/or debugging OpenEXR itself (e.g. exrcheck).
Default is ``OFF``.

* ``OPENEXR_BUILD_EXAMPLES``

Build the example code. Default is ``ON``.
Expand Down
10 changes: 10 additions & 0 deletions website/tools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ separately. To further include the tools in the OpenEXR installation
after build (i.e. ``cmake --target install``), configure with
``OPENEXR_INSTALL_TOOLS=ON``. Both are on by default.

In addition, some tools such as ``exrcheck`` are considered "developer"
tools in that they are useful when developing and debugging OpenEXR
itself. These tools may be helpful in identifying security issues,
and as a result it is not recommended that they be used with untrusted
input files. Although they will still be built and available in the
build directory when the ``OPENEXR_BUILD_TOOLS=ON`` option is used,
a separate ``OPENEXR_INSTALL_DEVELOPER_TOOLS=ON`` option should be
enabled if installation of the developer tools is desired. That option
is off by default.

.. toctree::
:caption: Tools
:titlesonly:
Expand Down

0 comments on commit 4077187

Please sign in to comment.