Skip to content
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

Govern library version by OpenEXRVersion.h #1386

Merged
merged 7 commits into from
Apr 27, 2023

Conversation

meshula
Copy link
Contributor

@meshula meshula commented Apr 22, 2023

This PR is a prerequisite for the "single file" version of OpenEXRCore in order that the "single file" version can be used without the invocation of CMake to configure files.

It shifts responsibility for the maintenance of the canonical version number from the CMakeLists.txt file at the root, to macros found in OpenEXRVersion.h. Moving forward, we'd modify the version number in that header file, and the CMake script will automatically pick it up.

This gives a build system agnostic way to manage the versioning of the library.

@Vertexwahn I imagine this would also simplify maintenance of the Bazel build if the Bazel script was modified to parse the version automatically.

@Vertexwahn
Copy link
Contributor

Vertexwahn commented Apr 22, 2023

I like the idea.

Would also suggest modifying OpenEXRConig.h.in:

#define OPENEXR_VERSION_MAJOR @OpenEXR_VERSION_MAJOR@
#define OPENEXR_VERSION_MINOR @OpenEXR_VERSION_MINOR@
#define OPENEXR_VERSION_PATCH @OpenEXR_VERSION_PATCH@

->

#include  "OpenEXRVersion.h"
#define OPENEXR_VERSION_MAJOR VERSION_MAJOR
#define OPENEXR_VERSION_MINOR VERSION_MINOR
#define OPENEXR_VERSION_PATCH VERSION_PATCH

Maybe we can also get rid of some other CMake Variables, such as:

        "@OPENEXR_LIB_VERSION@": "3.2.0",
        "@OPENEXR_NAMESPACE_CUSTOM@": "3.2.0",
        "@OPENEXR_PACKAGE_NAME@": "OpenEXR 3.2.0",
        "@OPENEXR_VERSION_EXTRA@": "",

@meshula
Copy link
Contributor Author

meshula commented Apr 22, 2023

Ah, thanks for spotting the rest of them. I'll take another pass.

@meshula
Copy link
Contributor Author

meshula commented Apr 23, 2023

Ok, I think this is the one.... Config relies on Version. Minimal changes to cmake scripts.

@Vertexwahn Unfortunately I can't eliminate those other variables as part of this. They are part of linux pkg and so number shenanigans, so they're out of the realm of things I'm comfortable messing around with!

@meshula
Copy link
Contributor Author

meshula commented Apr 23, 2023

@Vertexwahn to get the Bazel build up, I need to make OpenEXRVersion.h visible during the build, or it needs to be installed before the build starts (see the corresponding change to CMakelists.txt). How can I address it in the Bazel script?

@Vertexwahn
Copy link
Contributor

Vertexwahn commented Apr 23, 2023

BUILD.bazel should be changed this way (OpenEXRVersion.h needs to be visible - there a different approaches to do it - since I want to stay as close as possible to the CMake version I suggest the following:

# SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) Contributors to the OpenEXR Project.

load("@bazel_skylib//rules:expand_template.bzl", "expand_template")

config_setting(
    name = "windows",
    constraint_values = ["@platforms//os:windows"],
)

expand_template(
    name = "IexConfig",
    out = "src/lib/Iex/IexConfig.h",
    substitutions = {
        "@IEX_INTERNAL_NAMESPACE@": "Iex_3_2",
        "@IEX_NAMESPACE_CUSTOM@": "0",
        "@IEX_NAMESPACE@": "Iex",
    },
    template = "cmake/IexConfig.h.in",
)

expand_template(
    name = "IexConfigInternal",
    out = "src/lib/Iex/IexConfigInternal.h",
    substitutions = {
        "#cmakedefine HAVE_UCONTEXT_H 1": "/* #undef HAVE_UCONTEXT_H */",
        "#cmakedefine IEX_HAVE_CONTROL_REGISTER_SUPPORT 1": "/* #undef IEX_HAVE_CONTROL_REGISTER_SUPPORT */",
        "#cmakedefine IEX_HAVE_SIGCONTEXT_CONTROL_REGISTER_SUPPORT 1": "/* #undef IEX_HAVE_SIGCONTEXT_CONTROL_REGISTER_SUPPORT */",
    },
    template = "cmake/IexConfigInternal.h.in",
)

expand_template(
    name = "IlmThreadConfig",
    out = "src/lib/IlmThread/IlmThreadConfig.h",
    substitutions = {
        "@ILMTHREAD_INTERNAL_NAMESPACE@": "IlmThread_3_2",
        "@ILMTHREAD_NAMESPACE_CUSTOM@": "0",
        "@ILMTHREAD_NAMESPACE@": "IlmThread",
        "#cmakedefine01 ILMTHREAD_HAVE_POSIX_SEMAPHORES": "#define ILMTHREAD_HAVE_POSIX_SEMAPHORES 0",
        "#cmakedefine01 ILMTHREAD_THREADING_ENABLED": "#define ILMTHREAD_THREADING_ENABLED 1",
    },
    template = "cmake/IlmThreadConfig.h.in",
)

expand_template(
    name = "OpenEXRConfig",
    out = "src/lib/OpenEXR/OpenEXRConfig.h",
    substitutions = {
        "@OPENEXR_IMF_NAMESPACE@": "Imf",
        "@OPENEXR_INTERNAL_IMF_NAMESPACE@": "Imf_3_2",
        "@OPENEXR_LIB_VERSION@": "3.2.0",
        "@OPENEXR_NAMESPACE_CUSTOM@": "3.2.0",
        "@OPENEXR_PACKAGE_NAME@": "OpenEXR 3.2.0",
        "@OPENEXR_VERSION_EXTRA@": "",
        "@OPENEXR_VERSION@": "3.2.0",
        "#cmakedefine OPENEXR_ENABLE_API_VISIBILITY": "#define OPENEXR_ENABLE_API_VISIBILITY",
        "#cmakedefine OPENEXR_HAVE_LARGE_STACK 1": "/* #undef OPENEXR_HAVE_LARGE_STACK */",
    },
    template = "cmake/OpenEXRConfig.h.in",
)

expand_template(
    name = "OpenEXRConfigInternal",
    out = "src/lib/OpenEXR/OpenEXRConfigInternal.h",
    substitutions = {
        "#cmakedefine OPENEXR_IMF_HAVE_COMPLETE_IOMANIP 1": "#define OPENEXR_IMF_HAVE_COMPLETE_IOMANIP 1",
        "#cmakedefine OPENEXR_IMF_HAVE_DARWIN 1": "/* #undef OPENEXR_IMF_HAVE_DARWIN */",
        "#cmakedefine OPENEXR_IMF_HAVE_GCC_INLINE_ASM_AVX 1": "/* #undef OPENEXR_IMF_HAVE_GCC_INLINE_ASM_AVX */",
        "#cmakedefine OPENEXR_IMF_HAVE_LINUX_PROCFS 1": "/* #undef OPENEXR_IMF_HAVE_LINUX_PROCFS */",
        "#cmakedefine OPENEXR_IMF_HAVE_SYSCONF_NPROCESSORS_ONLN 1": "/* #undef OPENEXR_IMF_HAVE_SYSCONF_NPROCESSORS_ONLN */",
        "#cmakedefine OPENEXR_MISSING_ARM_VLD1 0": "/* #undef OPENEXR_MISSING_ARM_VLD1 */",
    },
    template = "cmake/OpenEXRConfigInternal.h.in",
)

cc_library(
    name = "Iex",
    srcs = [
        "src/lib/Iex/IexBaseExc.cpp",
        "src/lib/Iex/IexMathFloatExc.cpp",
        "src/lib/Iex/IexMathFpu.cpp",
        "src/lib/Iex/IexThrowErrnoExc.cpp",
        "src/lib/OpenEXRCore/OpenEXRVersion.h",
    ],
    hdrs = [
        "src/lib/Iex/Iex.h",
        "src/lib/Iex/IexBaseExc.h",
        "src/lib/Iex/IexConfig.h",
        "src/lib/Iex/IexConfigInternal.h",
        "src/lib/Iex/IexErrnoExc.h",
        "src/lib/Iex/IexExport.h",
        "src/lib/Iex/IexForward.h",
        "src/lib/Iex/IexMacros.h",
        "src/lib/Iex/IexMathExc.h",
        "src/lib/Iex/IexMathFloatExc.h",
        "src/lib/Iex/IexMathFpu.h",
        "src/lib/Iex/IexMathIeeeExc.h",
        "src/lib/Iex/IexNamespace.h",
        "src/lib/Iex/IexThrowErrnoExc.h",
        "src/lib/OpenEXR/OpenEXRConfig.h",
    ],
    features = select({
        ":windows": ["windows_export_all_symbols"],
        "//conditions:default": [],
    }),
    includes = [
        "src/lib/Iex",
        "src/lib/OpenEXR",
        "src/lib/OpenEXRCore",
    ],
)

cc_library(
    name = "IlmThread",
    srcs = [
        "src/lib/IlmThread/IlmThread.cpp",
        "src/lib/IlmThread/IlmThreadPool.cpp",
        "src/lib/IlmThread/IlmThreadSemaphore.cpp",
        "src/lib/IlmThread/IlmThreadSemaphoreOSX.cpp",
        "src/lib/IlmThread/IlmThreadSemaphorePosix.cpp",
        "src/lib/IlmThread/IlmThreadSemaphorePosixCompat.cpp",
        "src/lib/IlmThread/IlmThreadSemaphoreWin32.cpp",
        "src/lib/OpenEXRCore/OpenEXRVersion.h",
    ],
    hdrs = [
        "src/lib/IlmThread/IlmThread.h",
        "src/lib/IlmThread/IlmThreadConfig.h",
        "src/lib/IlmThread/IlmThreadExport.h",
        "src/lib/IlmThread/IlmThreadForward.h",
        "src/lib/IlmThread/IlmThreadMutex.h",
        "src/lib/IlmThread/IlmThreadNamespace.h",
        "src/lib/IlmThread/IlmThreadPool.h",
        "src/lib/IlmThread/IlmThreadSemaphore.h",
    ],
    features = select({
        ":windows": ["windows_export_all_symbols"],
        "//conditions:default": [],
    }),
    includes = [
        "src/lib/IlmThread",
        "src/lib/OpenEXRCore",
    ],
    deps = [":Iex"],
)

cc_library(
    name = "OpenEXR",
    srcs = [
        "src/lib/OpenEXR/ImfAcesFile.cpp",
        "src/lib/OpenEXR/ImfAttribute.cpp",
        "src/lib/OpenEXR/ImfB44Compressor.cpp",
        "src/lib/OpenEXR/ImfBoxAttribute.cpp",
        "src/lib/OpenEXR/ImfCRgbaFile.cpp",
        "src/lib/OpenEXR/ImfChannelList.cpp",
        "src/lib/OpenEXR/ImfChannelListAttribute.cpp",
        "src/lib/OpenEXR/ImfChromaticities.cpp",
        "src/lib/OpenEXR/ImfChromaticitiesAttribute.cpp",
        "src/lib/OpenEXR/ImfCompositeDeepScanLine.cpp",
        "src/lib/OpenEXR/ImfCompressionAttribute.cpp",
        "src/lib/OpenEXR/ImfCompressor.cpp",
        "src/lib/OpenEXR/ImfConvert.cpp",
        "src/lib/OpenEXR/ImfDeepCompositing.cpp",
        "src/lib/OpenEXR/ImfDeepFrameBuffer.cpp",
        "src/lib/OpenEXR/ImfDeepImageStateAttribute.cpp",
        "src/lib/OpenEXR/ImfDeepScanLineInputFile.cpp",
        "src/lib/OpenEXR/ImfDeepScanLineInputPart.cpp",
        "src/lib/OpenEXR/ImfDeepScanLineOutputFile.cpp",
        "src/lib/OpenEXR/ImfDeepScanLineOutputPart.cpp",
        "src/lib/OpenEXR/ImfDeepTiledInputFile.cpp",
        "src/lib/OpenEXR/ImfDeepTiledInputPart.cpp",
        "src/lib/OpenEXR/ImfDeepTiledOutputFile.cpp",
        "src/lib/OpenEXR/ImfDeepTiledOutputPart.cpp",
        "src/lib/OpenEXR/ImfDoubleAttribute.cpp",
        "src/lib/OpenEXR/ImfDwaCompressor.cpp",
        "src/lib/OpenEXR/ImfEnvmap.cpp",
        "src/lib/OpenEXR/ImfEnvmapAttribute.cpp",
        "src/lib/OpenEXR/ImfFastHuf.cpp",
        "src/lib/OpenEXR/ImfFloatAttribute.cpp",
        "src/lib/OpenEXR/ImfFloatVectorAttribute.cpp",
        "src/lib/OpenEXR/ImfFrameBuffer.cpp",
        "src/lib/OpenEXR/ImfFramesPerSecond.cpp",
        "src/lib/OpenEXR/ImfGenericInputFile.cpp",
        "src/lib/OpenEXR/ImfGenericOutputFile.cpp",
        "src/lib/OpenEXR/ImfHeader.cpp",
        "src/lib/OpenEXR/ImfHuf.cpp",
        "src/lib/OpenEXR/ImfIDManifest.cpp",
        "src/lib/OpenEXR/ImfIDManifestAttribute.cpp",
        "src/lib/OpenEXR/ImfIO.cpp",
        "src/lib/OpenEXR/ImfInputFile.cpp",
        "src/lib/OpenEXR/ImfInputPart.cpp",
        "src/lib/OpenEXR/ImfInputPartData.cpp",
        "src/lib/OpenEXR/ImfIntAttribute.cpp",
        "src/lib/OpenEXR/ImfKeyCode.cpp",
        "src/lib/OpenEXR/ImfKeyCodeAttribute.cpp",
        "src/lib/OpenEXR/ImfLineOrderAttribute.cpp",
        "src/lib/OpenEXR/ImfLut.cpp",
        "src/lib/OpenEXR/ImfMatrixAttribute.cpp",
        "src/lib/OpenEXR/ImfMisc.cpp",
        "src/lib/OpenEXR/ImfMultiPartInputFile.cpp",
        "src/lib/OpenEXR/ImfMultiPartOutputFile.cpp",
        "src/lib/OpenEXR/ImfMultiView.cpp",
        "src/lib/OpenEXR/ImfOpaqueAttribute.cpp",
        "src/lib/OpenEXR/ImfOutputFile.cpp",
        "src/lib/OpenEXR/ImfOutputPart.cpp",
        "src/lib/OpenEXR/ImfOutputPartData.cpp",
        "src/lib/OpenEXR/ImfPartType.cpp",
        "src/lib/OpenEXR/ImfPizCompressor.cpp",
        "src/lib/OpenEXR/ImfPreviewImage.cpp",
        "src/lib/OpenEXR/ImfPreviewImageAttribute.cpp",
        "src/lib/OpenEXR/ImfPxr24Compressor.cpp",
        "src/lib/OpenEXR/ImfRational.cpp",
        "src/lib/OpenEXR/ImfRationalAttribute.cpp",
        "src/lib/OpenEXR/ImfRgbaFile.cpp",
        "src/lib/OpenEXR/ImfRgbaYca.cpp",
        "src/lib/OpenEXR/ImfRle.cpp",
        "src/lib/OpenEXR/ImfRleCompressor.cpp",
        "src/lib/OpenEXR/ImfScanLineInputFile.cpp",
        "src/lib/OpenEXR/ImfStandardAttributes.cpp",
        "src/lib/OpenEXR/ImfStdIO.cpp",
        "src/lib/OpenEXR/ImfStringAttribute.cpp",
        "src/lib/OpenEXR/ImfStringVectorAttribute.cpp",
        "src/lib/OpenEXR/ImfSystemSpecific.cpp",
        "src/lib/OpenEXR/ImfTestFile.cpp",
        "src/lib/OpenEXR/ImfThreading.cpp",
        "src/lib/OpenEXR/ImfTileDescriptionAttribute.cpp",
        "src/lib/OpenEXR/ImfTileOffsets.cpp",
        "src/lib/OpenEXR/ImfTiledInputFile.cpp",
        "src/lib/OpenEXR/ImfTiledInputPart.cpp",
        "src/lib/OpenEXR/ImfTiledMisc.cpp",
        "src/lib/OpenEXR/ImfTiledOutputFile.cpp",
        "src/lib/OpenEXR/ImfTiledOutputPart.cpp",
        "src/lib/OpenEXR/ImfTiledRgbaFile.cpp",
        "src/lib/OpenEXR/ImfTimeCode.cpp",
        "src/lib/OpenEXR/ImfTimeCodeAttribute.cpp",
        "src/lib/OpenEXR/ImfVecAttribute.cpp",
        "src/lib/OpenEXR/ImfVersion.cpp",
        "src/lib/OpenEXR/ImfWav.cpp",
        "src/lib/OpenEXR/ImfZip.cpp",
        "src/lib/OpenEXR/ImfZipCompressor.cpp",
        "src/lib/OpenEXR/b44ExpLogTable.h",
        "src/lib/OpenEXR/dwaLookups.h",
    ],
    hdrs = [
        "src/lib/Iex/IexConfig.h",
        "src/lib/Iex/IexConfigInternal.h",
        "src/lib/IlmThread/IlmThreadConfig.h",
        "src/lib/OpenEXR/ImfAcesFile.h",
        "src/lib/OpenEXR/ImfArray.h",
        "src/lib/OpenEXR/ImfAttribute.h",
        "src/lib/OpenEXR/ImfAutoArray.h",
        "src/lib/OpenEXR/ImfB44Compressor.h",
        "src/lib/OpenEXR/ImfBoxAttribute.h",
        "src/lib/OpenEXR/ImfCRgbaFile.h",
        "src/lib/OpenEXR/ImfChannelList.h",
        "src/lib/OpenEXR/ImfChannelListAttribute.h",
        "src/lib/OpenEXR/ImfCheckedArithmetic.h",
        "src/lib/OpenEXR/ImfChromaticities.h",
        "src/lib/OpenEXR/ImfChromaticitiesAttribute.h",
        "src/lib/OpenEXR/ImfCompositeDeepScanLine.h",
        "src/lib/OpenEXR/ImfCompression.h",
        "src/lib/OpenEXR/ImfCompressionAttribute.h",
        "src/lib/OpenEXR/ImfCompressor.h",
        "src/lib/OpenEXR/ImfConvert.h",
        "src/lib/OpenEXR/ImfDeepCompositing.h",
        "src/lib/OpenEXR/ImfDeepFrameBuffer.h",
        "src/lib/OpenEXR/ImfDeepImageState.h",
        "src/lib/OpenEXR/ImfDeepImageStateAttribute.h",
        "src/lib/OpenEXR/ImfDeepScanLineInputFile.h",
        "src/lib/OpenEXR/ImfDeepScanLineInputPart.h",
        "src/lib/OpenEXR/ImfDeepScanLineOutputFile.h",
        "src/lib/OpenEXR/ImfDeepScanLineOutputPart.h",
        "src/lib/OpenEXR/ImfDeepTiledInputFile.h",
        "src/lib/OpenEXR/ImfDeepTiledInputPart.h",
        "src/lib/OpenEXR/ImfDeepTiledOutputFile.h",
        "src/lib/OpenEXR/ImfDeepTiledOutputPart.h",
        "src/lib/OpenEXR/ImfDoubleAttribute.h",
        "src/lib/OpenEXR/ImfDwaCompressor.h",
        "src/lib/OpenEXR/ImfDwaCompressorSimd.h",
        "src/lib/OpenEXR/ImfEnvmap.h",
        "src/lib/OpenEXR/ImfEnvmapAttribute.h",
        "src/lib/OpenEXR/ImfExport.h",
        "src/lib/OpenEXR/ImfFastHuf.h",
        "src/lib/OpenEXR/ImfFloatAttribute.h",
        "src/lib/OpenEXR/ImfFloatVectorAttribute.h",
        "src/lib/OpenEXR/ImfForward.h",
        "src/lib/OpenEXR/ImfFrameBuffer.h",
        "src/lib/OpenEXR/ImfFramesPerSecond.h",
        "src/lib/OpenEXR/ImfGenericInputFile.h",
        "src/lib/OpenEXR/ImfGenericOutputFile.h",
        "src/lib/OpenEXR/ImfHeader.h",
        "src/lib/OpenEXR/ImfHuf.h",
        "src/lib/OpenEXR/ImfIDManifest.h",
        "src/lib/OpenEXR/ImfIDManifestAttribute.h",
        "src/lib/OpenEXR/ImfIO.h",
        "src/lib/OpenEXR/ImfInputFile.h",
        "src/lib/OpenEXR/ImfInputPart.h",
        "src/lib/OpenEXR/ImfInputPartData.h",
        "src/lib/OpenEXR/ImfInputStreamMutex.h",
        "src/lib/OpenEXR/ImfInt64.h",
        "src/lib/OpenEXR/ImfIntAttribute.h",
        "src/lib/OpenEXR/ImfKeyCode.h",
        "src/lib/OpenEXR/ImfKeyCodeAttribute.h",
        "src/lib/OpenEXR/ImfLineOrder.h",
        "src/lib/OpenEXR/ImfLineOrderAttribute.h",
        "src/lib/OpenEXR/ImfLut.h",
        "src/lib/OpenEXR/ImfMatrixAttribute.h",
        "src/lib/OpenEXR/ImfMisc.h",
        "src/lib/OpenEXR/ImfMultiPartInputFile.h",
        "src/lib/OpenEXR/ImfMultiPartOutputFile.h",
        "src/lib/OpenEXR/ImfMultiView.h",
        "src/lib/OpenEXR/ImfName.h",
        "src/lib/OpenEXR/ImfNamespace.h",
        "src/lib/OpenEXR/ImfOpaqueAttribute.h",
        "src/lib/OpenEXR/ImfOptimizedPixelReading.h",
        "src/lib/OpenEXR/ImfOutputFile.h",
        "src/lib/OpenEXR/ImfOutputPart.h",
        "src/lib/OpenEXR/ImfOutputPartData.h",
        "src/lib/OpenEXR/ImfOutputStreamMutex.h",
        "src/lib/OpenEXR/ImfPartHelper.h",
        "src/lib/OpenEXR/ImfPartType.h",
        "src/lib/OpenEXR/ImfPixelType.h",
        "src/lib/OpenEXR/ImfPizCompressor.h",
        "src/lib/OpenEXR/ImfPreviewImage.h",
        "src/lib/OpenEXR/ImfPreviewImageAttribute.h",
        "src/lib/OpenEXR/ImfPxr24Compressor.h",
        "src/lib/OpenEXR/ImfRational.h",
        "src/lib/OpenEXR/ImfRationalAttribute.h",
        "src/lib/OpenEXR/ImfRgba.h",
        "src/lib/OpenEXR/ImfRgbaFile.h",
        "src/lib/OpenEXR/ImfRgbaYca.h",
        "src/lib/OpenEXR/ImfRle.h",
        "src/lib/OpenEXR/ImfRleCompressor.h",
        "src/lib/OpenEXR/ImfScanLineInputFile.h",
        "src/lib/OpenEXR/ImfSimd.h",
        "src/lib/OpenEXR/ImfStandardAttributes.h",
        "src/lib/OpenEXR/ImfStdIO.h",
        "src/lib/OpenEXR/ImfStringAttribute.h",
        "src/lib/OpenEXR/ImfStringVectorAttribute.h",
        "src/lib/OpenEXR/ImfSystemSpecific.h",
        "src/lib/OpenEXR/ImfTestFile.h",
        "src/lib/OpenEXR/ImfThreading.h",
        "src/lib/OpenEXR/ImfTileDescription.h",
        "src/lib/OpenEXR/ImfTileDescriptionAttribute.h",
        "src/lib/OpenEXR/ImfTileOffsets.h",
        "src/lib/OpenEXR/ImfTiledInputFile.h",
        "src/lib/OpenEXR/ImfTiledInputPart.h",
        "src/lib/OpenEXR/ImfTiledMisc.h",
        "src/lib/OpenEXR/ImfTiledOutputFile.h",
        "src/lib/OpenEXR/ImfTiledOutputPart.h",
        "src/lib/OpenEXR/ImfTiledRgbaFile.h",
        "src/lib/OpenEXR/ImfTimeCode.h",
        "src/lib/OpenEXR/ImfTimeCodeAttribute.h",
        "src/lib/OpenEXR/ImfVecAttribute.h",
        "src/lib/OpenEXR/ImfVersion.h",
        "src/lib/OpenEXR/ImfWav.h",
        "src/lib/OpenEXR/ImfXdr.h",
        "src/lib/OpenEXR/ImfZip.h",
        "src/lib/OpenEXR/ImfZipCompressor.h",
        "src/lib/OpenEXR/OpenEXRConfig.h",
        "src/lib/OpenEXR/OpenEXRConfigInternal.h",
    ],
    copts = select({
        ":windows": [],
        "//conditions:default": [
            "-Wno-error",
        ],
    }),
    features = select({
        ":windows": ["windows_export_all_symbols"],
        "//conditions:default": [],
    }),
    includes = ["src/lib/OpenEXR"],
    linkopts =
        select({
            ":windows": [],
            "//conditions:default": [
                "-pthread",
            ],
        }),
    visibility = ["//visibility:public"],
    deps = [
        ":IlmThread",
        "@Imath",
        "@net_zlib_zlib//:zlib",
    ],
)

cc_test(
    name = "IexTest",
    srcs = [
        "src/test/IexTest/main.cpp",
        "src/test/IexTest/testBaseExc.cpp",
        "src/test/IexTest/testBaseExc.h",
    ],
    includes = ["src/test/IexTest"],
    tags = ["manual"],  # This test is not build and executed in the CI
    deps = [
        ":Iex",
    ],
)

cc_binary(
    name = "exr2aces",
    srcs = ["src/bin/exr2aces/main.cpp"],
    deps = [
        ":OpenEXR",
    ],
)

cc_binary(
    name = "exrheader",
    srcs = ["src/bin/exrheader/main.cpp"],
    deps = [
        ":OpenEXR",
    ],
)

cc_binary(
    name = "exrenvmap",
    srcs = [
        "src/bin/exrenvmap/EnvmapImage.cpp",
        "src/bin/exrenvmap/blurImage.cpp",
        "src/bin/exrenvmap/main.cpp",
        "src/bin/exrenvmap/makeCubeMap.cpp",
        "src/bin/exrenvmap/makeLatLongMap.cpp",
        "src/bin/exrenvmap/readInputImage.cpp",
        "src/bin/exrenvmap/resizeImage.cpp",
    ] + glob(["src/bin/exrenvmap/*.h"]),
    includes = [
        "src/bin/exrenvmap",
    ],
    deps = [
        ":OpenEXR",
    ],
)

cc_binary(
    name = "exrstdattr",
    srcs = ["src/bin/exrstdattr/main.cpp"],
    deps = [
        ":OpenEXR",
    ],
)

Here is the diff:

--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -53,9 +53,6 @@ expand_template(
         "@OPENEXR_NAMESPACE_CUSTOM@": "3.2.0",
         "@OPENEXR_PACKAGE_NAME@": "OpenEXR 3.2.0",
         "@OPENEXR_VERSION_EXTRA@": "",
-        "@OPENEXR_VERSION_MAJOR@": "3",
-        "@OPENEXR_VERSION_MINOR@": "2",
-        "@OPENEXR_VERSION_PATCH@": "0",
         "@OPENEXR_VERSION@": "3.2.0",
         "#cmakedefine OPENEXR_ENABLE_API_VISIBILITY": "#define OPENEXR_ENABLE_API_VISIBILITY",
         "#cmakedefine OPENEXR_HAVE_LARGE_STACK 1": "/* #undef OPENEXR_HAVE_LARGE_STACK */",
@@ -84,6 +81,7 @@ cc_library(
         "src/lib/Iex/IexMathFloatExc.cpp",
         "src/lib/Iex/IexMathFpu.cpp",
         "src/lib/Iex/IexThrowErrnoExc.cpp",
+        "src/lib/OpenEXRCore/OpenEXRVersion.h",
     ],
     hdrs = [
         "src/lib/Iex/Iex.h",
@@ -109,6 +107,7 @@ cc_library(
     includes = [
         "src/lib/Iex",
         "src/lib/OpenEXR",
+        "src/lib/OpenEXRCore",
     ],
 )
 
@@ -122,6 +121,7 @@ cc_library(
         "src/lib/IlmThread/IlmThreadSemaphorePosix.cpp",
         "src/lib/IlmThread/IlmThreadSemaphorePosixCompat.cpp",
         "src/lib/IlmThread/IlmThreadSemaphoreWin32.cpp",
+        "src/lib/OpenEXRCore/OpenEXRVersion.h",
     ],
     hdrs = [
         "src/lib/IlmThread/IlmThread.h",
@@ -137,7 +137,10 @@ cc_library(
         ":windows": ["windows_export_all_symbols"],
         "//conditions:default": [],
     }),
-    includes = ["src/lib/IlmThread"],
+    includes = [
+        "src/lib/IlmThread",
+        "src/lib/OpenEXRCore",
+    ],
     deps = [":Iex"],
 )

A more Bazel way of doing it would be probable to introduce an own target for Version.h - but that is something that does not exist on the CMake site

@meshula
Copy link
Contributor Author

meshula commented Apr 23, 2023

I like the idea of a target, although I may defer that to a second pass, depending on how much I'm able to upgrade cmake skills in the time I have available.

Thank you very much for the patch!

BUILD.bazel Outdated Show resolved Hide resolved
@@ -71,11 +71,13 @@ endif()

configure_file(OpenEXRConfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/OpenEXRConfig.h)
configure_file(OpenEXRConfigInternal.h.in ${CMAKE_CURRENT_BINARY_DIR}/OpenEXRConfigInternal.h)
configure_file(../src/lib/OpenEXRCore/OpenEXRVersion.h ${CMAKE_CURRENT_BINARY_DIR}/OpenEXRVersion.h COPYONLY)
Copy link
Contributor

Choose a reason for hiding this comment

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

this should not be needed (see below)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This one is funky ~ the reason it's there is because OpenEXRConfig.h needs to include <OpenEXRVersion.h> and the file isn't visible to Config, in the ${CMAKE_CURRENT_BINARY_DIR} prior to installation, and so catch-22 style, the library can't be built without this copy. So the COPYONLY thing is just to get a copy of the file into the binary dir at build time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Our usual "qualify the path" pattern doesn't work, since config is in binary_dir where the qualified paths don't work.


if(OPENEXR_INSTALL)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/OpenEXRConfig.h
${CMAKE_CURRENT_BINARY_DIR}/OpenEXRVersion.h
Copy link
Contributor

Choose a reason for hiding this comment

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

couldn't this just be ${CMAKE_PROJECT_SOURCE_DIR}/src/lib/OpenEXRCore/OpenEXRVersion.h?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah yes

src/lib/OpenEXRCore/OpenEXRVersion.h Outdated Show resolved Hide resolved
@@ -0,0 +1,11 @@
//
Copy link
Contributor

Choose a reason for hiding this comment

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

the other include files in OpenEXRCore are snake_case. In my twisted mind, snake_case == C, CamelCase == C++, not sure if we want to keep with that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I needed OpenEXRCore to be able to see the file without reaching laterally into another directory which is why it's here; and then I couldn't parse in my mind, is this file "more like" OpenEXRConfig.h, or is it "more like" something that should be here. My first thought had been to put it in "OpenEXR", but "OpenEXR" is higher level than core, so it seemed like opening the door to an unintended dependency cycle (Core needs EXR needs Core).

I'm happy to make it snakecase to tell a cleaner story.

Signed-off-by: Nick Porcino <meshula@hotmail.com>
Signed-off-by: Nick Porcino <meshula@hotmail.com>
Signed-off-by: Nick Porcino <meshula@hotmail.com>
@meshula
Copy link
Contributor Author

meshula commented Apr 26, 2023

@Vertexwahn I saw Kimball's note that after rebasing on his change the Bazel script would fail, I'm not following why that is, or what the fix is. I'm especially confused that it didn't fail on windows, but did on mac/linux. Any help appreciated.

@Vertexwahn
Copy link
Contributor

Vertexwahn commented Apr 26, 2023

@meshula Just add "src/lib/OpenEXRCore/OpenEXRVersion.h", to srcs of OpenEXRCore

The diff

diff --git a/BUILD.bazel b/BUILD.bazel
index 542837f9..ceb26444 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -202,6 +202,7 @@ cc_library(
         "src/lib/OpenEXRCore/debug.c",
         "src/lib/OpenEXR/OpenEXRConfig.h",
         "src/lib/IlmThread/IlmThreadConfig.h",
+        "src/lib/OpenEXRCore/OpenEXRVersion.h",
     ],
     hdrs = [
         "src/lib/OpenEXRCore/openexr.h",

The BUILD.bazel file should look like this:

# SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) Contributors to the OpenEXR Project.

load("@bazel_skylib//rules:expand_template.bzl", "expand_template")

config_setting(
    name = "windows",
    constraint_values = ["@platforms//os:windows"],
)

expand_template(
    name = "IexConfig",
    out = "src/lib/Iex/IexConfig.h",
    substitutions = {
        "@IEX_INTERNAL_NAMESPACE@": "Iex_3_2",
        "@IEX_NAMESPACE_CUSTOM@": "0",
        "@IEX_NAMESPACE@": "Iex",
    },
    template = "cmake/IexConfig.h.in",
)

expand_template(
    name = "IexConfigInternal",
    out = "src/lib/Iex/IexConfigInternal.h",
    substitutions = {
        "#cmakedefine HAVE_UCONTEXT_H 1": "/* #undef HAVE_UCONTEXT_H */",
        "#cmakedefine IEX_HAVE_CONTROL_REGISTER_SUPPORT 1": "/* #undef IEX_HAVE_CONTROL_REGISTER_SUPPORT */",
        "#cmakedefine IEX_HAVE_SIGCONTEXT_CONTROL_REGISTER_SUPPORT 1": "/* #undef IEX_HAVE_SIGCONTEXT_CONTROL_REGISTER_SUPPORT */",
    },
    template = "cmake/IexConfigInternal.h.in",
)

expand_template(
    name = "IlmThreadConfig",
    out = "src/lib/IlmThread/IlmThreadConfig.h",
    substitutions = {
        "@ILMTHREAD_INTERNAL_NAMESPACE@": "IlmThread_3_2",
        "@ILMTHREAD_NAMESPACE_CUSTOM@": "0",
        "@ILMTHREAD_NAMESPACE@": "IlmThread",
        "#cmakedefine01 ILMTHREAD_HAVE_POSIX_SEMAPHORES": "#define ILMTHREAD_HAVE_POSIX_SEMAPHORES 0",
        "#cmakedefine01 ILMTHREAD_THREADING_ENABLED": "#define ILMTHREAD_THREADING_ENABLED 1",
    },
    template = "cmake/IlmThreadConfig.h.in",
)

expand_template(
    name = "OpenEXRConfig",
    out = "src/lib/OpenEXR/OpenEXRConfig.h",
    substitutions = {
        "@OPENEXR_IMF_NAMESPACE@": "Imf",
        "@OPENEXR_INTERNAL_IMF_NAMESPACE@": "Imf_3_2",
        "@OPENEXR_LIB_VERSION@": "3.2.0",
        "@OPENEXR_NAMESPACE_CUSTOM@": "3.2.0",
        "@OPENEXR_PACKAGE_NAME@": "OpenEXR 3.2.0",
        "@OPENEXR_VERSION_EXTRA@": "",
        "@OPENEXR_VERSION@": "3.2.0",
        "#cmakedefine OPENEXR_ENABLE_API_VISIBILITY": "#define OPENEXR_ENABLE_API_VISIBILITY",
        "#cmakedefine OPENEXR_HAVE_LARGE_STACK 1": "/* #undef OPENEXR_HAVE_LARGE_STACK */",
    },
    template = "cmake/OpenEXRConfig.h.in",
)

expand_template(
    name = "OpenEXRConfigInternal",
    out = "src/lib/OpenEXR/OpenEXRConfigInternal.h",
    substitutions = {
        "#cmakedefine OPENEXR_IMF_HAVE_COMPLETE_IOMANIP 1": "#define OPENEXR_IMF_HAVE_COMPLETE_IOMANIP 1",
        "#cmakedefine OPENEXR_IMF_HAVE_DARWIN 1": "/* #undef OPENEXR_IMF_HAVE_DARWIN */",
        "#cmakedefine OPENEXR_IMF_HAVE_GCC_INLINE_ASM_AVX 1": "/* #undef OPENEXR_IMF_HAVE_GCC_INLINE_ASM_AVX */",
        "#cmakedefine OPENEXR_IMF_HAVE_LINUX_PROCFS 1": "/* #undef OPENEXR_IMF_HAVE_LINUX_PROCFS */",
        "#cmakedefine OPENEXR_IMF_HAVE_SYSCONF_NPROCESSORS_ONLN 1": "/* #undef OPENEXR_IMF_HAVE_SYSCONF_NPROCESSORS_ONLN */",
        "#cmakedefine OPENEXR_MISSING_ARM_VLD1 0": "/* #undef OPENEXR_MISSING_ARM_VLD1 */",
    },
    template = "cmake/OpenEXRConfigInternal.h.in",
)

cc_library(
    name = "Iex",
    srcs = [
        "src/lib/Iex/IexBaseExc.cpp",
        "src/lib/Iex/IexMathFloatExc.cpp",
        "src/lib/Iex/IexMathFpu.cpp",
        "src/lib/Iex/IexThrowErrnoExc.cpp",
        "src/lib/OpenEXRCore/OpenEXRVersion.h",
    ],
    hdrs = [
        "src/lib/Iex/Iex.h",
        "src/lib/Iex/IexBaseExc.h",
        "src/lib/Iex/IexConfig.h",
        "src/lib/Iex/IexConfigInternal.h",
        "src/lib/Iex/IexErrnoExc.h",
        "src/lib/Iex/IexExport.h",
        "src/lib/Iex/IexForward.h",
        "src/lib/Iex/IexMacros.h",
        "src/lib/Iex/IexMathExc.h",
        "src/lib/Iex/IexMathFloatExc.h",
        "src/lib/Iex/IexMathFpu.h",
        "src/lib/Iex/IexMathIeeeExc.h",
        "src/lib/Iex/IexNamespace.h",
        "src/lib/Iex/IexThrowErrnoExc.h",
        "src/lib/OpenEXR/OpenEXRConfig.h",
    ],
    features = select({
        ":windows": ["windows_export_all_symbols"],
        "//conditions:default": [],
    }),
    includes = [
        "src/lib/Iex",
        "src/lib/OpenEXR",
        "src/lib/OpenEXRCore",
    ],
)

cc_library(
    name = "IlmThread",
    srcs = [
        "src/lib/IlmThread/IlmThread.cpp",
        "src/lib/IlmThread/IlmThreadPool.cpp",
        "src/lib/IlmThread/IlmThreadSemaphore.cpp",
        "src/lib/IlmThread/IlmThreadSemaphoreOSX.cpp",
        "src/lib/IlmThread/IlmThreadSemaphorePosix.cpp",
        "src/lib/IlmThread/IlmThreadSemaphorePosixCompat.cpp",
        "src/lib/IlmThread/IlmThreadSemaphoreWin32.cpp",
        "src/lib/OpenEXRCore/OpenEXRVersion.h",
    ],
    hdrs = [
        "src/lib/IlmThread/IlmThread.h",
        "src/lib/IlmThread/IlmThreadConfig.h",
        "src/lib/IlmThread/IlmThreadExport.h",
        "src/lib/IlmThread/IlmThreadForward.h",
        "src/lib/IlmThread/IlmThreadMutex.h",
        "src/lib/IlmThread/IlmThreadNamespace.h",
        "src/lib/IlmThread/IlmThreadPool.h",
        "src/lib/IlmThread/IlmThreadSemaphore.h",
    ],
    features = select({
        ":windows": ["windows_export_all_symbols"],
        "//conditions:default": [],
    }),
    includes = [
        "src/lib/IlmThread",
        "src/lib/OpenEXRCore",
    ],
    deps = [":Iex"],
)

cc_library(
    name = "OpenEXRCore",
    srcs = [
        "src/lib/OpenEXRCore/backward_compatibility.h",
        "src/lib/OpenEXRCore/internal_attr.h",
        "src/lib/OpenEXRCore/internal_channel_list.h",
        "src/lib/OpenEXRCore/internal_coding.h",
        "src/lib/OpenEXRCore/internal_constants.h",
        "src/lib/OpenEXRCore/internal_compress.h",
        "src/lib/OpenEXRCore/internal_decompress.h",
        "src/lib/OpenEXRCore/internal_file.h",
        "src/lib/OpenEXRCore/internal_float_vector.h",
        "src/lib/OpenEXRCore/internal_huf.h",
        "src/lib/OpenEXRCore/internal_memory.h",
        "src/lib/OpenEXRCore/internal_opaque.h",
        "src/lib/OpenEXRCore/internal_posix_file_impl.h",
        "src/lib/OpenEXRCore/internal_win32_file_impl.h",
        "src/lib/OpenEXRCore/internal_preview.h",
        "src/lib/OpenEXRCore/internal_string.h",
        "src/lib/OpenEXRCore/internal_string_vector.h",
        "src/lib/OpenEXRCore/internal_structs.h",
        "src/lib/OpenEXRCore/internal_util.h",
        "src/lib/OpenEXRCore/internal_xdr.h",
        "src/lib/OpenEXRCore/internal_rle.c",
        "src/lib/OpenEXRCore/internal_zip.c",
        "src/lib/OpenEXRCore/internal_pxr24.c",
        "src/lib/OpenEXRCore/internal_b44.c",
        "src/lib/OpenEXRCore/internal_b44_table.c",
        "src/lib/OpenEXRCore/internal_piz.c",
        "src/lib/OpenEXRCore/internal_dwa.c",
        "src/lib/OpenEXRCore/internal_huf.c",
        "src/lib/OpenEXRCore/attributes.c",
        "src/lib/OpenEXRCore/string.c",
        "src/lib/OpenEXRCore/string_vector.c",
        "src/lib/OpenEXRCore/float_vector.c",
        "src/lib/OpenEXRCore/channel_list.c",
        "src/lib/OpenEXRCore/opaque.c",
        "src/lib/OpenEXRCore/preview.c",
        "src/lib/OpenEXRCore/base.c",
        "src/lib/OpenEXRCore/context.c",
        "src/lib/OpenEXRCore/memory.c",
        "src/lib/OpenEXRCore/internal_structs.c",
        "src/lib/OpenEXRCore/part.c",
        "src/lib/OpenEXRCore/part_attr.c",
        "src/lib/OpenEXRCore/std_attr.c",
        "src/lib/OpenEXRCore/parse_header.c",
        "src/lib/OpenEXRCore/write_header.c",
        "src/lib/OpenEXRCore/chunk.c",
        "src/lib/OpenEXRCore/coding.c",
        "src/lib/OpenEXRCore/compression.c",
        "src/lib/OpenEXRCore/decoding.c",
        "src/lib/OpenEXRCore/encoding.c",
        "src/lib/OpenEXRCore/pack.c",
        "src/lib/OpenEXRCore/unpack.c",
        "src/lib/OpenEXRCore/validation.c",
        "src/lib/OpenEXRCore/debug.c",
        "src/lib/OpenEXR/OpenEXRConfig.h",
        "src/lib/IlmThread/IlmThreadConfig.h",
        "src/lib/OpenEXRCore/OpenEXRVersion.h",
    ],
    hdrs = [
        "src/lib/OpenEXRCore/openexr.h",
        "src/lib/OpenEXRCore/openexr_attr.h",
        "src/lib/OpenEXRCore/openexr_base.h",
        "src/lib/OpenEXRCore/openexr_chunkio.h",
        "src/lib/OpenEXRCore/openexr_coding.h",
        "src/lib/OpenEXRCore/openexr_compression.h",
        "src/lib/OpenEXRCore/openexr_conf.h",
        "src/lib/OpenEXRCore/openexr_context.h",
        "src/lib/OpenEXRCore/openexr_decode.h",
        "src/lib/OpenEXRCore/openexr_debug.h",
        "src/lib/OpenEXRCore/openexr_encode.h",
        "src/lib/OpenEXRCore/openexr_errors.h",
        "src/lib/OpenEXRCore/openexr_part.h",
        "src/lib/OpenEXRCore/openexr_std_attr.h",
    ],
    copts = select({
        ":windows": [],
        "//conditions:default": [
            "-Wno-error",
        ],
    }),
    features = select({
        ":windows": ["windows_export_all_symbols"],
        "//conditions:default": [],
    }),
    includes = ["src/lib/OpenEXRCore", "src/lib/OpenEXR", "src/lib/IlmThread"],
    linkopts =
        select({
            ":windows": [],
            "//conditions:default": [
                "-pthread",
            ],
        }),
    visibility = ["//visibility:public"],
    deps = [
        "@Imath", "@libdeflate",
    ],
)

cc_library(
    name = "OpenEXR",
    srcs = [
        "src/lib/OpenEXR/ImfAcesFile.cpp",
        "src/lib/OpenEXR/ImfAttribute.cpp",
        "src/lib/OpenEXR/ImfB44Compressor.cpp",
        "src/lib/OpenEXR/ImfBoxAttribute.cpp",
        "src/lib/OpenEXR/ImfCRgbaFile.cpp",
        "src/lib/OpenEXR/ImfChannelList.cpp",
        "src/lib/OpenEXR/ImfChannelListAttribute.cpp",
        "src/lib/OpenEXR/ImfChromaticities.cpp",
        "src/lib/OpenEXR/ImfChromaticitiesAttribute.cpp",
        "src/lib/OpenEXR/ImfCompositeDeepScanLine.cpp",
        "src/lib/OpenEXR/ImfCompressionAttribute.cpp",
        "src/lib/OpenEXR/ImfCompressor.cpp",
        "src/lib/OpenEXR/ImfConvert.cpp",
        "src/lib/OpenEXR/ImfDeepCompositing.cpp",
        "src/lib/OpenEXR/ImfDeepFrameBuffer.cpp",
        "src/lib/OpenEXR/ImfDeepImageStateAttribute.cpp",
        "src/lib/OpenEXR/ImfDeepScanLineInputFile.cpp",
        "src/lib/OpenEXR/ImfDeepScanLineInputPart.cpp",
        "src/lib/OpenEXR/ImfDeepScanLineOutputFile.cpp",
        "src/lib/OpenEXR/ImfDeepScanLineOutputPart.cpp",
        "src/lib/OpenEXR/ImfDeepTiledInputFile.cpp",
        "src/lib/OpenEXR/ImfDeepTiledInputPart.cpp",
        "src/lib/OpenEXR/ImfDeepTiledOutputFile.cpp",
        "src/lib/OpenEXR/ImfDeepTiledOutputPart.cpp",
        "src/lib/OpenEXR/ImfDoubleAttribute.cpp",
        "src/lib/OpenEXR/ImfDwaCompressor.cpp",
        "src/lib/OpenEXR/ImfEnvmap.cpp",
        "src/lib/OpenEXR/ImfEnvmapAttribute.cpp",
        "src/lib/OpenEXR/ImfFastHuf.cpp",
        "src/lib/OpenEXR/ImfFloatAttribute.cpp",
        "src/lib/OpenEXR/ImfFloatVectorAttribute.cpp",
        "src/lib/OpenEXR/ImfFrameBuffer.cpp",
        "src/lib/OpenEXR/ImfFramesPerSecond.cpp",
        "src/lib/OpenEXR/ImfGenericInputFile.cpp",
        "src/lib/OpenEXR/ImfGenericOutputFile.cpp",
        "src/lib/OpenEXR/ImfHeader.cpp",
        "src/lib/OpenEXR/ImfHuf.cpp",
        "src/lib/OpenEXR/ImfIDManifest.cpp",
        "src/lib/OpenEXR/ImfIDManifestAttribute.cpp",
        "src/lib/OpenEXR/ImfIO.cpp",
        "src/lib/OpenEXR/ImfInputFile.cpp",
        "src/lib/OpenEXR/ImfInputPart.cpp",
        "src/lib/OpenEXR/ImfInputPartData.cpp",
        "src/lib/OpenEXR/ImfIntAttribute.cpp",
        "src/lib/OpenEXR/ImfKeyCode.cpp",
        "src/lib/OpenEXR/ImfKeyCodeAttribute.cpp",
        "src/lib/OpenEXR/ImfLineOrderAttribute.cpp",
        "src/lib/OpenEXR/ImfLut.cpp",
        "src/lib/OpenEXR/ImfMatrixAttribute.cpp",
        "src/lib/OpenEXR/ImfMisc.cpp",
        "src/lib/OpenEXR/ImfMultiPartInputFile.cpp",
        "src/lib/OpenEXR/ImfMultiPartOutputFile.cpp",
        "src/lib/OpenEXR/ImfMultiView.cpp",
        "src/lib/OpenEXR/ImfOpaqueAttribute.cpp",
        "src/lib/OpenEXR/ImfOutputFile.cpp",
        "src/lib/OpenEXR/ImfOutputPart.cpp",
        "src/lib/OpenEXR/ImfOutputPartData.cpp",
        "src/lib/OpenEXR/ImfPartType.cpp",
        "src/lib/OpenEXR/ImfPizCompressor.cpp",
        "src/lib/OpenEXR/ImfPreviewImage.cpp",
        "src/lib/OpenEXR/ImfPreviewImageAttribute.cpp",
        "src/lib/OpenEXR/ImfPxr24Compressor.cpp",
        "src/lib/OpenEXR/ImfRational.cpp",
        "src/lib/OpenEXR/ImfRationalAttribute.cpp",
        "src/lib/OpenEXR/ImfRgbaFile.cpp",
        "src/lib/OpenEXR/ImfRgbaYca.cpp",
        "src/lib/OpenEXR/ImfRle.cpp",
        "src/lib/OpenEXR/ImfRleCompressor.cpp",
        "src/lib/OpenEXR/ImfScanLineInputFile.cpp",
        "src/lib/OpenEXR/ImfStandardAttributes.cpp",
        "src/lib/OpenEXR/ImfStdIO.cpp",
        "src/lib/OpenEXR/ImfStringAttribute.cpp",
        "src/lib/OpenEXR/ImfStringVectorAttribute.cpp",
        "src/lib/OpenEXR/ImfSystemSpecific.cpp",
        "src/lib/OpenEXR/ImfTestFile.cpp",
        "src/lib/OpenEXR/ImfThreading.cpp",
        "src/lib/OpenEXR/ImfTileDescriptionAttribute.cpp",
        "src/lib/OpenEXR/ImfTileOffsets.cpp",
        "src/lib/OpenEXR/ImfTiledInputFile.cpp",
        "src/lib/OpenEXR/ImfTiledInputPart.cpp",
        "src/lib/OpenEXR/ImfTiledMisc.cpp",
        "src/lib/OpenEXR/ImfTiledOutputFile.cpp",
        "src/lib/OpenEXR/ImfTiledOutputPart.cpp",
        "src/lib/OpenEXR/ImfTiledRgbaFile.cpp",
        "src/lib/OpenEXR/ImfTimeCode.cpp",
        "src/lib/OpenEXR/ImfTimeCodeAttribute.cpp",
        "src/lib/OpenEXR/ImfVecAttribute.cpp",
        "src/lib/OpenEXR/ImfVersion.cpp",
        "src/lib/OpenEXR/ImfWav.cpp",
        "src/lib/OpenEXR/ImfZip.cpp",
        "src/lib/OpenEXR/ImfZipCompressor.cpp",
        "src/lib/OpenEXR/b44ExpLogTable.h",
        "src/lib/OpenEXR/dwaLookups.h",
    ],
    hdrs = [
        "src/lib/Iex/IexConfig.h",
        "src/lib/Iex/IexConfigInternal.h",
        "src/lib/IlmThread/IlmThreadConfig.h",
        "src/lib/OpenEXR/ImfAcesFile.h",
        "src/lib/OpenEXR/ImfArray.h",
        "src/lib/OpenEXR/ImfAttribute.h",
        "src/lib/OpenEXR/ImfAutoArray.h",
        "src/lib/OpenEXR/ImfB44Compressor.h",
        "src/lib/OpenEXR/ImfBoxAttribute.h",
        "src/lib/OpenEXR/ImfCRgbaFile.h",
        "src/lib/OpenEXR/ImfChannelList.h",
        "src/lib/OpenEXR/ImfChannelListAttribute.h",
        "src/lib/OpenEXR/ImfCheckedArithmetic.h",
        "src/lib/OpenEXR/ImfChromaticities.h",
        "src/lib/OpenEXR/ImfChromaticitiesAttribute.h",
        "src/lib/OpenEXR/ImfCompositeDeepScanLine.h",
        "src/lib/OpenEXR/ImfCompression.h",
        "src/lib/OpenEXR/ImfCompressionAttribute.h",
        "src/lib/OpenEXR/ImfCompressor.h",
        "src/lib/OpenEXR/ImfConvert.h",
        "src/lib/OpenEXR/ImfDeepCompositing.h",
        "src/lib/OpenEXR/ImfDeepFrameBuffer.h",
        "src/lib/OpenEXR/ImfDeepImageState.h",
        "src/lib/OpenEXR/ImfDeepImageStateAttribute.h",
        "src/lib/OpenEXR/ImfDeepScanLineInputFile.h",
        "src/lib/OpenEXR/ImfDeepScanLineInputPart.h",
        "src/lib/OpenEXR/ImfDeepScanLineOutputFile.h",
        "src/lib/OpenEXR/ImfDeepScanLineOutputPart.h",
        "src/lib/OpenEXR/ImfDeepTiledInputFile.h",
        "src/lib/OpenEXR/ImfDeepTiledInputPart.h",
        "src/lib/OpenEXR/ImfDeepTiledOutputFile.h",
        "src/lib/OpenEXR/ImfDeepTiledOutputPart.h",
        "src/lib/OpenEXR/ImfDoubleAttribute.h",
        "src/lib/OpenEXR/ImfDwaCompressor.h",
        "src/lib/OpenEXR/ImfDwaCompressorSimd.h",
        "src/lib/OpenEXR/ImfEnvmap.h",
        "src/lib/OpenEXR/ImfEnvmapAttribute.h",
        "src/lib/OpenEXR/ImfExport.h",
        "src/lib/OpenEXR/ImfFastHuf.h",
        "src/lib/OpenEXR/ImfFloatAttribute.h",
        "src/lib/OpenEXR/ImfFloatVectorAttribute.h",
        "src/lib/OpenEXR/ImfForward.h",
        "src/lib/OpenEXR/ImfFrameBuffer.h",
        "src/lib/OpenEXR/ImfFramesPerSecond.h",
        "src/lib/OpenEXR/ImfGenericInputFile.h",
        "src/lib/OpenEXR/ImfGenericOutputFile.h",
        "src/lib/OpenEXR/ImfHeader.h",
        "src/lib/OpenEXR/ImfHuf.h",
        "src/lib/OpenEXR/ImfIDManifest.h",
        "src/lib/OpenEXR/ImfIDManifestAttribute.h",
        "src/lib/OpenEXR/ImfIO.h",
        "src/lib/OpenEXR/ImfInputFile.h",
        "src/lib/OpenEXR/ImfInputPart.h",
        "src/lib/OpenEXR/ImfInputPartData.h",
        "src/lib/OpenEXR/ImfInputStreamMutex.h",
        "src/lib/OpenEXR/ImfInt64.h",
        "src/lib/OpenEXR/ImfIntAttribute.h",
        "src/lib/OpenEXR/ImfKeyCode.h",
        "src/lib/OpenEXR/ImfKeyCodeAttribute.h",
        "src/lib/OpenEXR/ImfLineOrder.h",
        "src/lib/OpenEXR/ImfLineOrderAttribute.h",
        "src/lib/OpenEXR/ImfLut.h",
        "src/lib/OpenEXR/ImfMatrixAttribute.h",
        "src/lib/OpenEXR/ImfMisc.h",
        "src/lib/OpenEXR/ImfMultiPartInputFile.h",
        "src/lib/OpenEXR/ImfMultiPartOutputFile.h",
        "src/lib/OpenEXR/ImfMultiView.h",
        "src/lib/OpenEXR/ImfName.h",
        "src/lib/OpenEXR/ImfNamespace.h",
        "src/lib/OpenEXR/ImfOpaqueAttribute.h",
        "src/lib/OpenEXR/ImfOptimizedPixelReading.h",
        "src/lib/OpenEXR/ImfOutputFile.h",
        "src/lib/OpenEXR/ImfOutputPart.h",
        "src/lib/OpenEXR/ImfOutputPartData.h",
        "src/lib/OpenEXR/ImfOutputStreamMutex.h",
        "src/lib/OpenEXR/ImfPartHelper.h",
        "src/lib/OpenEXR/ImfPartType.h",
        "src/lib/OpenEXR/ImfPixelType.h",
        "src/lib/OpenEXR/ImfPizCompressor.h",
        "src/lib/OpenEXR/ImfPreviewImage.h",
        "src/lib/OpenEXR/ImfPreviewImageAttribute.h",
        "src/lib/OpenEXR/ImfPxr24Compressor.h",
        "src/lib/OpenEXR/ImfRational.h",
        "src/lib/OpenEXR/ImfRationalAttribute.h",
        "src/lib/OpenEXR/ImfRgba.h",
        "src/lib/OpenEXR/ImfRgbaFile.h",
        "src/lib/OpenEXR/ImfRgbaYca.h",
        "src/lib/OpenEXR/ImfRle.h",
        "src/lib/OpenEXR/ImfRleCompressor.h",
        "src/lib/OpenEXR/ImfScanLineInputFile.h",
        "src/lib/OpenEXR/ImfSimd.h",
        "src/lib/OpenEXR/ImfStandardAttributes.h",
        "src/lib/OpenEXR/ImfStdIO.h",
        "src/lib/OpenEXR/ImfStringAttribute.h",
        "src/lib/OpenEXR/ImfStringVectorAttribute.h",
        "src/lib/OpenEXR/ImfSystemSpecific.h",
        "src/lib/OpenEXR/ImfTestFile.h",
        "src/lib/OpenEXR/ImfThreading.h",
        "src/lib/OpenEXR/ImfTileDescription.h",
        "src/lib/OpenEXR/ImfTileDescriptionAttribute.h",
        "src/lib/OpenEXR/ImfTileOffsets.h",
        "src/lib/OpenEXR/ImfTiledInputFile.h",
        "src/lib/OpenEXR/ImfTiledInputPart.h",
        "src/lib/OpenEXR/ImfTiledMisc.h",
        "src/lib/OpenEXR/ImfTiledOutputFile.h",
        "src/lib/OpenEXR/ImfTiledOutputPart.h",
        "src/lib/OpenEXR/ImfTiledRgbaFile.h",
        "src/lib/OpenEXR/ImfTimeCode.h",
        "src/lib/OpenEXR/ImfTimeCodeAttribute.h",
        "src/lib/OpenEXR/ImfVecAttribute.h",
        "src/lib/OpenEXR/ImfVersion.h",
        "src/lib/OpenEXR/ImfWav.h",
        "src/lib/OpenEXR/ImfXdr.h",
        "src/lib/OpenEXR/ImfZip.h",
        "src/lib/OpenEXR/ImfZipCompressor.h",
        "src/lib/OpenEXR/OpenEXRConfig.h",
        "src/lib/OpenEXR/OpenEXRConfigInternal.h",
    ],
    copts = select({
        ":windows": [],
        "//conditions:default": [
            "-Wno-error",
        ],
    }),
    features = select({
        ":windows": ["windows_export_all_symbols"],
        "//conditions:default": [],
    }),
    includes = ["src/lib/OpenEXR"],
    linkopts =
        select({
            ":windows": [],
            "//conditions:default": [
                "-pthread",
            ],
        }),
    visibility = ["//visibility:public"],
    deps = [
        ":IlmThread",
        ":OpenEXRCore",
        "@Imath",
    ],
)

cc_test(
    name = "IexTest",
    srcs = [
        "src/test/IexTest/main.cpp",
        "src/test/IexTest/testBaseExc.cpp",
        "src/test/IexTest/testBaseExc.h",
    ],
    includes = ["src/test/IexTest"],
    tags = ["manual"],  # This test is not build and executed in the CI
    deps = [
        ":Iex",
    ],
)

cc_binary(
    name = "exr2aces",
    srcs = ["src/bin/exr2aces/main.cpp"],
    deps = [
        ":OpenEXR",
    ],
)

cc_binary(
    name = "exrheader",
    srcs = ["src/bin/exrheader/main.cpp"],
    deps = [
        ":OpenEXR",
    ],
)

cc_binary(
    name = "exrenvmap",
    srcs = [
        "src/bin/exrenvmap/EnvmapImage.cpp",
        "src/bin/exrenvmap/blurImage.cpp",
        "src/bin/exrenvmap/main.cpp",
        "src/bin/exrenvmap/makeCubeMap.cpp",
        "src/bin/exrenvmap/makeLatLongMap.cpp",
        "src/bin/exrenvmap/readInputImage.cpp",
        "src/bin/exrenvmap/resizeImage.cpp",
    ] + glob(["src/bin/exrenvmap/*.h"]),
    includes = [
        "src/bin/exrenvmap",
    ],
    deps = [
        ":OpenEXR",
    ],
)

cc_binary(
    name = "exrstdattr",
    srcs = ["src/bin/exrstdattr/main.cpp"],
    deps = [
        ":OpenEXR",
    ],
)

@meshula
Copy link
Contributor Author

meshula commented Apr 26, 2023

Ah, I see. The rule would be that every file referenced must be exhaustively listed in a Bazel build.

Signed-off-by: Nick Porcino <meshula@hotmail.com>
Signed-off-by: Nick Porcino <meshula@hotmail.com>
@meshula meshula merged commit 9ef5625 into AcademySoftwareFoundation:main Apr 27, 2023
@cary-ilm cary-ilm added the v3.2.0 label Jul 9, 2023
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.

None yet

4 participants