Skip to content

Commit

Permalink
build: gcc-14 support, testing, CI (#4270)
Browse files Browse the repository at this point in the history
* Switch runner type for bleeding edge, use gcc14 and python 3.12

* Various minor gcc-14 + C++20 + Python 3.12 fixes

Notable: gcc14 warns about std::atomic_load for share_ptr as deprecated,
since C++20 provides a true atomic shared pointer.

Signed-off-by: Larry Gritz <[email protected]>
  • Loading branch information
lgritz committed May 28, 2024
1 parent b33e591 commit a185e6e
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 11 deletions.
17 changes: 11 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -308,16 +308,16 @@ jobs:
USE_OPENVDB=0
WEBP_VERSION=v1.3.0
# The installed OpenVDB has a TLS conflict with Python 3.8
- desc: bleeding edge gcc13 C++20 py3.10 OCIO/libtiff/exr-master boost1.74 avx2
- desc: bleeding edge gcc14 C++20 py3.12 OCIO/libtiff/exr-master boost1.74 avx2
nametag: linux-bleeding-edge
runner: ubuntu-22.04
cc_compiler: gcc-13
cxx_compiler: g++-13
runner: ubuntu-24.04
cc_compiler: gcc-14
cxx_compiler: g++-14
cxx_std: 20
fmt_ver: master
openexr_ver: main
pybind11_ver: master
python_ver: "3.10"
python_ver: "3.12"
simd: avx2,f16c
setenvs: export LIBJPEGTURBO_VERSION=main
LIBRAW_VERSION=master
Expand All @@ -326,9 +326,12 @@ jobs:
OPENJPEG_VERSION=master
PTEX_VERSION=main
PUGIXML_VERSION=master
USE_OPENVDB=0
WEBP_VERSION=main
OIIO_CMAKE_FLAGS="-DFORTIFY_SOURCE=2"
QT_VERSION=6
EXTRA_DEP_PACKAGES="python3.12-dev python3-numpy"
PIP_INSTALLS="none"
USE_OPENVDB=0
# The installed OpenVDB has a TLS conflict with Python 3.8
- desc: clang14 C++20 avx2 exr3.1 ocio2.1
nametag: linux-clang14
Expand Down Expand Up @@ -431,6 +434,7 @@ jobs:
path: /tmp/ccache
key: ${{github.job}}-${{matrix.nametag}}-${{ steps.ccache_cache_keys.outputs.date }}
restore-keys: ${{github.job}}-
save-always: true
- name: Build setup
run: |
${{matrix.setenvs}}
Expand Down Expand Up @@ -509,6 +513,7 @@ jobs:
path: /Users/runner/.ccache
key: ${{github.job}}-${{matrix.nametag}}-${{ steps.ccache_cache_keys.outputs.date }}
restore-keys: ${{github.job}}-
save-always: true
- name: Build setup
run: |
${{matrix.setenvs}}
Expand Down
2 changes: 1 addition & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ NEW or CHANGED MINIMUM dependencies since the last major release are **bold**.
* The default build mode is C++14. This can be controlled by via the
CMake configuration flag: `-DCMAKE_CXX_STANDARD=17`, etc.
* ADVISORY: We expect that OIIO 2.6 in 2024 will require C++17 or higher.
* Compilers: gcc 6.1 - 13.1, clang 3.4 - 18, MSVS 2017 - 2019,
* Compilers: gcc 6.1 - 14.1, clang 3.4 - 18, MSVS 2017 - 2019,
Intel icc 17+, Intel OneAPI C++ compiler 2022+.
* **CMake >= 3.15** (tested through 3.28)
* **OpenEXR/Imath >= 2.4** (recommended: 3.1 or higher; tested through 3.2
Expand Down
11 changes: 7 additions & 4 deletions src/build-scripts/gh-installdeps.bash
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,11 @@ else
# Nonstandard python versions
if [[ "${PYTHON_VERSION}" == "3.9" ]] ; then
time sudo apt-get -q install -y python3.9-dev python3-numpy
pip3 --version
pip3 install numpy
elif [[ "$PYTHON_VERSION" == "2.7" ]] ; then
time sudo apt-get -q install -y python-dev python-numpy
else
pip3 install numpy
fi
if [[ "${PIP_INSTALLS:=numpy}" != "none" ]] ; then
time pip3 install ${PIP_INSTALLS}
fi

if [[ "$USE_LIBHEIF" != "0" ]] ; then
Expand All @@ -132,6 +131,10 @@ else
time sudo apt-get install -y g++-11
elif [[ "$CXX" == "g++-12" ]] ; then
time sudo apt-get install -y g++-12
elif [[ "$CXX" == "g++-13" ]] ; then
time sudo apt-get install -y g++-13
elif [[ "$CXX" == "g++-14" ]] ; then
time sudo apt-get install -y g++-14
fi

if [[ "$CXX" == "icpc" || "$CC" == "icc" || "$USE_ICC" != "" || "$USE_ICX" != "" ]] ; then
Expand Down
5 changes: 5 additions & 0 deletions src/libtexture/imagecache_pvt.h
Original file line number Diff line number Diff line change
Expand Up @@ -368,11 +368,16 @@ class OIIO_API ImageCacheFile final : public RefCnt {
bool m_broken; ///< has errors; can't be used properly
bool m_allow_release = true; ///< Allow the file to release()?
std::string m_broken_message; ///< Error message for why it's broken
#if __cpp_lib_atomic_shared_ptr >= 201711L /* C++20 has atomic<shared_pr> */
// Open ImageInput, NULL if closed
std::atomic<std::shared_ptr<ImageInput>> m_input;
#else
std::shared_ptr<ImageInput> m_input; ///< Open ImageInput, NULL if closed
// Note that m_input, the shared pointer itself, is NOT safe to
// access directly. ALWAYS retrieve its value with get_imageinput
// (it's thread-safe to use that result) and set its value with
// set_imageinput -- those are guaranteed thread-safe.
#endif
std::vector<SubimageInfo> m_subimages; ///< Info on each subimage
TexFormat m_texformat; ///< Which texture format
TextureOpt::Wrap m_swrap; ///< Default wrap modes
Expand Down
12 changes: 12 additions & 0 deletions src/python/py_imagecache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,11 @@ declare_imagecache(py::module& m)
.def("resolve_filename",
[](ImageCacheWrap& ic, const std::string& filename) {
py::gil_scoped_release gil;
#if PY_MAJOR_VERSION >= 3
return ic.m_cache->resolve_filename(filename);
#else
return PY_STR(ic.m_cache->resolve_filename(filename));
#endif
})
// .def("get_image_info", &ImageCacheWrap::get_image_info)
.def(
Expand Down Expand Up @@ -147,14 +151,22 @@ declare_imagecache(py::module& m)
.def(
"geterror",
[](ImageCacheWrap& self, bool clear) {
#if PY_MAJOR_VERSION >= 3
return self.m_cache->geterror(clear);
#else
return PY_STR(self.m_cache->geterror(clear));
#endif
},
"clear"_a = true)
.def(
"getstats",
[](ImageCacheWrap& ic, int level) {
py::gil_scoped_release gil;
#if PY_MAJOR_VERSION >= 3
return ic.m_cache->getstats(level);
#else
return PY_STR(ic.m_cache->getstats(level));
#endif
},
"level"_a = 1)
.def(
Expand Down

0 comments on commit a185e6e

Please sign in to comment.