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

Bazel cherry picks #980

Merged
merged 3 commits into from
Mar 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/bazel_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ on:

jobs:
build:
runs-on: ubuntu-latest
name: Linux Ubuntu 20.04 Bazel build <GCC 9.3.0>
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2

- name: Mount bazel cache
uses: actions/cache@v1
uses: actions/cache@v2
with:
path: "/home/runner/.cache/bazel"
key: bazel
Expand Down
303 changes: 66 additions & 237 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,252 +1,80 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) Contributors to the OpenEXR Project.

load("//:bazel/third_party/openexr.bzl", "openexr_generate_header")

config_setting(
name = "windows_x86_64",
values = {"cpu": "x64_windows"},
visibility = ["//visibility:public"],
)

# generate "IexConfig.h"
IEX_CONFIG_H = """
// SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) Contributors to the OpenEXR Project.

// This file is auto-generated by the Bazel

#ifndef INCLUDED_IEX_CONFIG_H
#define INCLUDED_IEX_CONFIG_H 1

#pragma once

//
//
// C++ namespace configuration / options

//
// Current internal library namepace name
//
#define IEX_INTERNAL_NAMESPACE_CUSTOM 0
#define IEX_INTERNAL_NAMESPACE Iex_2_5

//
// Current public user namepace name
//

#define IEX_NAMESPACE_CUSTOM 0
#define IEX_NAMESPACE Iex

#endif // INCLUDED_IEX_CONFIG_H
"""

# generate "IexConfigInternal.h"
IEX_CONFIG_INTERNAL_H = """
// SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) Contributors to the OpenEXR Project.

#pragma once

//
// Dealing with FPEs
/* #undef HAVE_UCONTEXT_H */
/* #undef IEX_HAVE_CONTROL_REGISTER_SUPPORT */
/* #undef IEX_HAVE_SIGCONTEXT_CONTROL_REGISTER_SUPPORT */
"""

# generate "IlmThreadConfig.h"
ILMTHREAD_CONFIG_H = """
// SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) Contributors to the OpenEXR Project.

// This file is auto-generated by the Bazel

#ifndef INCLUDED_ILMTHREAD_CONFIG_H
#define INCLUDED_ILMTHREAD_CONFIG_H 1

#pragma once

//
//
// C++ namespace configuration / options

#define ILMTHREAD_THREADING_ENABLED 1
#define ILMTHREAD_HAVE_POSIX_SEMAPHORES 0

//
// Current internal library namepace name
//
#define ILMTHREAD_INTERNAL_NAMESPACE_CUSTOM 0
#define ILMTHREAD_INTERNAL_NAMESPACE IlmThread_2_5

//
// Current public user namepace name
//

#define ILMTHREAD_NAMESPACE_CUSTOM 0
#define ILMTHREAD_NAMESPACE IlmThread

#if defined(__cplusplus) && (__cplusplus >= 201402L)
# define ILMTHREAD_DEPRECATED(msg) [[deprecated(msg)]]
#endif

#ifndef ILMTHREAD_DEPRECATED
# ifdef _MSC_VER
# define ILMTHREAD_DEPRECATED(msg) __declspec(deprecated(msg))
# else
# define ILMTHREAD_DEPRECATED(msg) __attribute__((deprecated(msg)))
# endif
#endif

#endif // INCLUDED_ILMTHREAD_CONFIG_H
"""

genrule(
name = "generate_IexConfig_h",
outs = ["//:config/IexConfig.h"],
cmd = ("echo '%s' > $(OUTS)" % IEX_CONFIG_H),
visibility = ["//visibility:private"],
)

cc_library(
name = "iex_config",
srcs = [],
hdrs = ["//:config/IexConfig.h"],
includes = ["config"],
visibility = ["//visibility:public"],
)

genrule(
name = "generate_IexConfigInternal_h",
outs = ["//:config/IexConfigInternal.h"],
cmd = ("echo '%s' > $(OUTS)" % IEX_CONFIG_INTERNAL_H),
visibility = ["//visibility:private"],
)

cc_library(
name = "iex_config_internal",
srcs = [],
hdrs = ["//:config/IexConfigInternal.h"],
includes = ["config"],
visibility = ["//visibility:public"],
openexr_generate_header(
name = "IexConfig.h",
substitutions = {
"@IEX_NAMESPACE_CUSTOM@": "0",
"@IEX_INTERNAL_NAMESPACE@": "Iex_3_0",
"@IEX_NAMESPACE@": "Iex",
},
template = "cmake/IexConfig.h.in",
)

genrule(
name = "generate_IlmThreadConfig_h",
outs = ["//:config/IlmThreadConfig.h"],
cmd = ("echo '%s' > $(OUTS)" % ILMTHREAD_CONFIG_H),
visibility = ["//visibility:private"],
# generate "IexConfigInternal.h"
openexr_generate_header(
name = "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",
)

cc_library(
name = "ilmthread_config",
srcs = [],
hdrs = ["//:config/IlmThreadConfig.h"],
includes = ["config"],
visibility = ["//visibility:public"],
# generate "IlmThreadConfig.h"
openexr_generate_header(
name = "IlmThreadConfig.h",
substitutions = {
"#cmakedefine01 ILMTHREAD_THREADING_ENABLED": "#define ILMTHREAD_THREADING_ENABLED 1",
"#cmakedefine01 ILMTHREAD_HAVE_POSIX_SEMAPHORES": "#define ILMTHREAD_HAVE_POSIX_SEMAPHORES 0",
"@ILMTHREAD_NAMESPACE_CUSTOM@": "0",
"@ILMTHREAD_INTERNAL_NAMESPACE@": "IlmThread_3_0",
"@ILMTHREAD_NAMESPACE@": "IlmThread",
},
template = "cmake/IlmThreadConfig.h.in",
)

# generate "OpenEXRConfig.h"
OPEN_EXR_CONFIG_H = """
// SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) Contributors to the OpenEXR Project.

// This file is auto-generated by the configure step

#ifndef INCLUDED_OPENEXR_CONFIG_H
#define INCLUDED_OPENEXR_CONFIG_H 1

#pragma once

//
// Options / configuration based on O.S. / compiler
/////////////////////

//
// Define and set to 1 if the target system has support for large
// stack sizes.
//
/* #undef OPENEXR_HAVE_LARGE_STACK */

//////////////////////
//
// C++ namespace configuration / options

//
// Current internal library namepace name
//
#define OPENEXR_IMF_INTERNAL_NAMESPACE_CUSTOM 0
#define OPENEXR_IMF_INTERNAL_NAMESPACE Imf_2_5

//
// Current public user namepace name
//

#define OPENEXR_IMF_NAMESPACE_CUSTOM 0
#define OPENEXR_IMF_NAMESPACE Imf

//
// Version string for runtime access
//

#define OPENEXR_VERSION_STRING "2.5.99"
#define OPENEXR_PACKAGE_STRING "OpenEXR 2.5.99"

#define OPENEXR_VERSION_MAJOR 2
#define OPENEXR_VERSION_MINOR 5
#define OPENEXR_VERSION_PATCH 99
#define OPENEXR_VERSION_EXTRA ""

// Version as a single hex number, e.g. 0x01000300 == 1.0.3
#define OPENEXR_VERSION_HEX ((uint32_t(OPENEXR_VERSION_MAJOR) << 24) | \
(uint32_t(OPENEXR_VERSION_MINOR) << 16) | \
(uint32_t(OPENEXR_VERSION_PATCH) << 8))

#endif // INCLUDED_OPENEXR_CONFIG_H
"""

genrule(
name = "generate_OpenEXRConfig_h",
outs = ["//:config/OpenEXRConfig.h"],
cmd = ("echo '%s' > $(OUTS)" % OPEN_EXR_CONFIG_H),
visibility = ["//visibility:private"],
)

cc_library(
name = "openexr_config",
srcs = [],
hdrs = ["//:config/OpenEXRConfig.h"],
includes = ["config"],
visibility = ["//visibility:public"],
openexr_generate_header(
name = "OpenEXRConfig.h",
substitutions = {
"@OPENEXR_NAMESPACE_CUSTOM@": "0",
"@OPENEXR_INTERNAL_IMF_NAMESPACE@": "Imf_3_0",
"@OPENEXR_IMF_NAMESPACE@": "Imf",
"@OPENEXR_VERSION@": "3.0.0",
"@OPENEXR_PACKAGE_NAME@": "OpenEXR 3.0.0",
"@OPENEXR_VERSION_MAJOR@": "3",
"@OPENEXR_VERSION_MINOR@": "0",
"@OPENEXR_VERSION_PATCH@": "0",
"@OPENEXR_VERSION_EXTRA@": "",
"#cmakedefine OPENEXR_HAVE_LARGE_STACK 1": "/* #undef OPENEXR_HAVE_LARGE_STACK */",
"#cmakedefine OPENEXR_ENABLE_API_VISIBILITY": "#define OPENEXR_ENABLE_API_VISIBILITY",
"// This file is auto-generated by the configure step": "// This file is auto-generated by Bazel",
},
template = "cmake/OpenEXRConfig.h.in",
)

# generate "OpenEXRConfigInternal.h"
OPENEXRCONFIGINTERNAL_H = """
// SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) Contributors to the OpenEXR Project.

// This file is auto-generated by the configure step

#ifndef INCLUDED_OPENEXR_INTERNAL_CONFIG_H
#define INCLUDED_OPENEXR_INTERNAL_CONFIG_H 1

#pragma once
#define OPENEXR_IMF_HAVE_COMPLETE_IOMANIP 1
#endif // INCLUDED_OPENEXR_INTERNAL_CONFIG_H
"""

genrule(
name = "generate_OpenEXRConfigInternal_h",
outs = ["//:config/OpenEXRConfigInternal.h"],
cmd = ("echo '%s' > $(OUTS)" % OPENEXRCONFIGINTERNAL_H),
visibility = ["//visibility:private"],
)

cc_library(
name = "openexr_config_internal",
srcs = [],
hdrs = ["//:config/OpenEXRConfigInternal.h"],
includes = ["config"],
visibility = ["//visibility:public"],
openexr_generate_header(
name = "OpenEXRConfigInternal.h",
substitutions = {
"#cmakedefine OPENEXR_IMF_HAVE_LINUX_PROCFS 1": "/* #undef OPENEXR_IMF_HAVE_LINUX_PROCFS */",
"#cmakedefine OPENEXR_IMF_HAVE_DARWIN 1": "/* #undef OPENEXR_IMF_HAVE_DARWIN */",
"#cmakedefine OPENEXR_IMF_HAVE_COMPLETE_IOMANIP 1": "#define OPENEXR_IMF_HAVE_COMPLETE_IOMANIP 1",
"#cmakedefine OPENEXR_IMF_HAVE_SYSCONF_NPROCESSORS_ONLN 1": "/* #undef OPENEXR_IMF_HAVE_SYSCONF_NPROCESSORS_ONLN */",
"#cmakedefine OPENEXR_IMF_HAVE_GCC_INLINE_ASM_AVX 1": "/* #undef OPENEXR_IMF_HAVE_GCC_INLINE_ASM_AVX */",
},
template = "cmake/OpenEXRConfigInternal.h.in",
)

cc_library(
Expand All @@ -273,8 +101,9 @@ cc_library(
],
includes = ["src/lib/Iex"],
deps = [
":iex_config",
":iex_config_internal",
":OpenEXRConfig.h",
":IexConfig.h",
":IexConfigInternal.h",
],
)

Expand All @@ -301,7 +130,7 @@ cc_library(
includes = ["src/lib/IlmThread"],
deps = [
":Iex",
":ilmthread_config",
":IlmThreadConfig.h",
],
)

Expand Down Expand Up @@ -535,11 +364,11 @@ cc_library(
visibility = ["//visibility:public"],
deps = [
":IlmThread",
":iex_config",
":iex_config_internal",
":ilmthread_config",
":openexr_config",
":openexr_config_internal",
":IexConfig.h",
":IexConfigInternal.h",
":IlmThreadConfig.h",
":OpenEXRConfig.h",
":OpenEXRConfigInternal.h",
"@Imath",
"@zlib",
],
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ If you know of missing, please email: info@openexr.com.
* John Loy
* John Mertic
* Jonathan Stone
* Julian Amann
* Juri Abramov
* Karl Rasche
* Kevin Wheatley
Expand Down Expand Up @@ -59,7 +60,6 @@ If you know of missing, please email: info@openexr.com.
* Srinath Ravichandran
* Thanh Ha
* Thorsten Kaufmann
* Vertexwahn
* Wenzel Jakob
* Wojciech Jarosz
* Xo Wang
Expand Down
Loading