Skip to content

Commit a185e6e

Browse files
committed
build: gcc-14 support, testing, CI (#4270)
* 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 <lg@larrygritz.com>
1 parent b33e591 commit a185e6e

File tree

5 files changed

+36
-11
lines changed

5 files changed

+36
-11
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -308,16 +308,16 @@ jobs:
308308
USE_OPENVDB=0
309309
WEBP_VERSION=v1.3.0
310310
# The installed OpenVDB has a TLS conflict with Python 3.8
311-
- desc: bleeding edge gcc13 C++20 py3.10 OCIO/libtiff/exr-master boost1.74 avx2
311+
- desc: bleeding edge gcc14 C++20 py3.12 OCIO/libtiff/exr-master boost1.74 avx2
312312
nametag: linux-bleeding-edge
313-
runner: ubuntu-22.04
314-
cc_compiler: gcc-13
315-
cxx_compiler: g++-13
313+
runner: ubuntu-24.04
314+
cc_compiler: gcc-14
315+
cxx_compiler: g++-14
316316
cxx_std: 20
317317
fmt_ver: master
318318
openexr_ver: main
319319
pybind11_ver: master
320-
python_ver: "3.10"
320+
python_ver: "3.12"
321321
simd: avx2,f16c
322322
setenvs: export LIBJPEGTURBO_VERSION=main
323323
LIBRAW_VERSION=master
@@ -326,9 +326,12 @@ jobs:
326326
OPENJPEG_VERSION=master
327327
PTEX_VERSION=main
328328
PUGIXML_VERSION=master
329-
USE_OPENVDB=0
330329
WEBP_VERSION=main
331330
OIIO_CMAKE_FLAGS="-DFORTIFY_SOURCE=2"
331+
QT_VERSION=6
332+
EXTRA_DEP_PACKAGES="python3.12-dev python3-numpy"
333+
PIP_INSTALLS="none"
334+
USE_OPENVDB=0
332335
# The installed OpenVDB has a TLS conflict with Python 3.8
333336
- desc: clang14 C++20 avx2 exr3.1 ocio2.1
334337
nametag: linux-clang14
@@ -431,6 +434,7 @@ jobs:
431434
path: /tmp/ccache
432435
key: ${{github.job}}-${{matrix.nametag}}-${{ steps.ccache_cache_keys.outputs.date }}
433436
restore-keys: ${{github.job}}-
437+
save-always: true
434438
- name: Build setup
435439
run: |
436440
${{matrix.setenvs}}
@@ -509,6 +513,7 @@ jobs:
509513
path: /Users/runner/.ccache
510514
key: ${{github.job}}-${{matrix.nametag}}-${{ steps.ccache_cache_keys.outputs.date }}
511515
restore-keys: ${{github.job}}-
516+
save-always: true
512517
- name: Build setup
513518
run: |
514519
${{matrix.setenvs}}

INSTALL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ NEW or CHANGED MINIMUM dependencies since the last major release are **bold**.
1818
* The default build mode is C++14. This can be controlled by via the
1919
CMake configuration flag: `-DCMAKE_CXX_STANDARD=17`, etc.
2020
* ADVISORY: We expect that OIIO 2.6 in 2024 will require C++17 or higher.
21-
* Compilers: gcc 6.1 - 13.1, clang 3.4 - 18, MSVS 2017 - 2019,
21+
* Compilers: gcc 6.1 - 14.1, clang 3.4 - 18, MSVS 2017 - 2019,
2222
Intel icc 17+, Intel OneAPI C++ compiler 2022+.
2323
* **CMake >= 3.15** (tested through 3.28)
2424
* **OpenEXR/Imath >= 2.4** (recommended: 3.1 or higher; tested through 3.2

src/build-scripts/gh-installdeps.bash

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,11 @@ else
100100
# Nonstandard python versions
101101
if [[ "${PYTHON_VERSION}" == "3.9" ]] ; then
102102
time sudo apt-get -q install -y python3.9-dev python3-numpy
103-
pip3 --version
104-
pip3 install numpy
105103
elif [[ "$PYTHON_VERSION" == "2.7" ]] ; then
106104
time sudo apt-get -q install -y python-dev python-numpy
107-
else
108-
pip3 install numpy
105+
fi
106+
if [[ "${PIP_INSTALLS:=numpy}" != "none" ]] ; then
107+
time pip3 install ${PIP_INSTALLS}
109108
fi
110109

111110
if [[ "$USE_LIBHEIF" != "0" ]] ; then
@@ -132,6 +131,10 @@ else
132131
time sudo apt-get install -y g++-11
133132
elif [[ "$CXX" == "g++-12" ]] ; then
134133
time sudo apt-get install -y g++-12
134+
elif [[ "$CXX" == "g++-13" ]] ; then
135+
time sudo apt-get install -y g++-13
136+
elif [[ "$CXX" == "g++-14" ]] ; then
137+
time sudo apt-get install -y g++-14
135138
fi
136139

137140
if [[ "$CXX" == "icpc" || "$CC" == "icc" || "$USE_ICC" != "" || "$USE_ICX" != "" ]] ; then

src/libtexture/imagecache_pvt.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,11 +368,16 @@ class OIIO_API ImageCacheFile final : public RefCnt {
368368
bool m_broken; ///< has errors; can't be used properly
369369
bool m_allow_release = true; ///< Allow the file to release()?
370370
std::string m_broken_message; ///< Error message for why it's broken
371+
#if __cpp_lib_atomic_shared_ptr >= 201711L /* C++20 has atomic<shared_pr> */
372+
// Open ImageInput, NULL if closed
373+
std::atomic<std::shared_ptr<ImageInput>> m_input;
374+
#else
371375
std::shared_ptr<ImageInput> m_input; ///< Open ImageInput, NULL if closed
372376
// Note that m_input, the shared pointer itself, is NOT safe to
373377
// access directly. ALWAYS retrieve its value with get_imageinput
374378
// (it's thread-safe to use that result) and set its value with
375379
// set_imageinput -- those are guaranteed thread-safe.
380+
#endif
376381
std::vector<SubimageInfo> m_subimages; ///< Info on each subimage
377382
TexFormat m_texformat; ///< Which texture format
378383
TextureOpt::Wrap m_swrap; ///< Default wrap modes

src/python/py_imagecache.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,11 @@ declare_imagecache(py::module& m)
117117
.def("resolve_filename",
118118
[](ImageCacheWrap& ic, const std::string& filename) {
119119
py::gil_scoped_release gil;
120+
#if PY_MAJOR_VERSION >= 3
121+
return ic.m_cache->resolve_filename(filename);
122+
#else
120123
return PY_STR(ic.m_cache->resolve_filename(filename));
124+
#endif
121125
})
122126
// .def("get_image_info", &ImageCacheWrap::get_image_info)
123127
.def(
@@ -147,14 +151,22 @@ declare_imagecache(py::module& m)
147151
.def(
148152
"geterror",
149153
[](ImageCacheWrap& self, bool clear) {
154+
#if PY_MAJOR_VERSION >= 3
155+
return self.m_cache->geterror(clear);
156+
#else
150157
return PY_STR(self.m_cache->geterror(clear));
158+
#endif
151159
},
152160
"clear"_a = true)
153161
.def(
154162
"getstats",
155163
[](ImageCacheWrap& ic, int level) {
156164
py::gil_scoped_release gil;
165+
#if PY_MAJOR_VERSION >= 3
166+
return ic.m_cache->getstats(level);
167+
#else
157168
return PY_STR(ic.m_cache->getstats(level));
169+
#endif
158170
},
159171
"level"_a = 1)
160172
.def(

0 commit comments

Comments
 (0)