AcademySoftwareFoundation / OpenImageIO

Reading, writing, and processing images in a wide variety of file formats, using a format-agnostic API, aimed at VFX applications.

Home Page:https://openimageio.readthedocs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dump Boost from dependencies

lgritz opened this issue · comments

Boost used to be much more important to us, but over the years, most of the things we needed from boost have migrated to the C++11, 14, or 17 standard libraries. In more modern times, Boost is a very heavyweight dependency which causes a disproportionate amount of build pain, considering how very little of it we use. We don't use any boost classes in our public APIs, so removing legacy boost use is purely about internals and won't affect users at all. It's primarily a concern to people building OIIO, who have to make sure they have acceptable boost versions built as well. I think we can easily replace the very few remaining uses with alternatives and remove the Boost dependency entirely. They remaining uses are:

boost::filesystem

This is only used in filesystem.cpp, and only for C++14 builds (when using a C++17-capable compiler, we already automatically switch to using std::filesystem. So there is no real work to be done here, it will be part of the bump o C++17 minimum. I'm just listing it to be complete.

boost::thread_specific_ptr

This is used in several places. I wish there were a robust, single-header, dependency-free implementation of this were around and with a compatible license, but I haven't been able to find it. Maybe it's out there and somebody else can find it? Maybe just the parts we need can be extracted from Boost or some other large library that has the equivalent? Maybe since we use it in such a narrow way, we can just write our own minimal implementation?

Note that although this looks similar in spirit to C++ thread_local, it's different because thread_local must be of static scope, and we need something that can be a class member.

boost::container::flat_map and flat_set

This will eventually be in C++23, but we're nowhere near being able to assume that's available. But I believe there are several acceptable single-header implementations that we could use which exactly emulate what will be in C++23 but work with older C++ versions. Or, possibly, just write it ourselves since we probably only use a tiny fraction of the features that will be in the std version.

boost::algorithm functions: ifind_first, ifind_last, to_upper, to_lower

These are not really difficult to rewrite from scratch ourselves. Somebody just needs to do it.

boost::stacktrace

This is only used in sysutil.cpp. This will be eventually replaced by C++23 std::stacktrace, but that's too far away for us to rely on now. However, I bet that (like all other C++ future library classes) there are multiple adequate implementations out there that we can use with older C++. Maybe somebody reading this already has their favourite to recommend.

That's it! Those are the only boost artifacts we have left in the code base. It feels totally doable.

Tasks

boost::algorithm eliminated by #4181