From 4077187e0a93bd6703332f071042e8b0054bc58d Mon Sep 17 00:00:00 2001 From: Matt Johnson Date: Wed, 26 Feb 2025 16:07:26 -0800 Subject: [PATCH] exrcheck: update CMakeLists.txt to install the tool (#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 * 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 --------- Signed-off-by: Matt Johnson --- CMakeLists.txt | 3 ++- cmake/OpenEXRSetup.cmake | 1 + pyproject.toml | 1 + src/bin/exrcheck/CMakeLists.txt | 9 +++++++-- website/install.rst | 6 ++++++ website/tools.rst | 10 ++++++++++ 6 files changed, 27 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 374d96ae04..582243484d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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( diff --git a/cmake/OpenEXRSetup.cmake b/cmake/OpenEXRSetup.cmake index 4fdce34622..d84b23de24 100644 --- a/cmake/OpenEXRSetup.cmake +++ b/cmake/OpenEXRSetup.cmake @@ -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) diff --git a/pyproject.toml b/pyproject.toml index 94f475970d..313502cb42 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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' diff --git a/src/bin/exrcheck/CMakeLists.txt b/src/bin/exrcheck/CMakeLists.txt index 6cf22bae84..50df143433 100644 --- a/src/bin/exrcheck/CMakeLists.txt +++ b/src/bin/exrcheck/CMakeLists.txt @@ -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() diff --git a/website/install.rst b/website/install.rst index ec5f05a412..a34beeb280 100644 --- a/website/install.rst +++ b/website/install.rst @@ -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``. diff --git a/website/tools.rst b/website/tools.rst index 3c1939514b..789d44984e 100644 --- a/website/tools.rst +++ b/website/tools.rst @@ -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: