diff --git a/source/blender/blenkernel/BKE_attribute_access.hh b/source/blender/blenkernel/BKE_attribute_access.hh index ef43e21b739..baa918d9949 100644 --- a/source/blender/blenkernel/BKE_attribute_access.hh +++ b/source/blender/blenkernel/BKE_attribute_access.hh @@ -248,7 +248,7 @@ template class OutputAttribute_Typed { VMutableArray *varray_ = nullptr; public: - OutputAttribute_Typed() = default; + OutputAttribute_Typed(); OutputAttribute_Typed(OutputAttribute attribute) : attribute_(std::move(attribute)) { if (attribute_) { @@ -257,8 +257,8 @@ template class OutputAttribute_Typed { } } - OutputAttribute_Typed(OutputAttribute_Typed &&other) = default; - ~OutputAttribute_Typed() = default; + OutputAttribute_Typed(OutputAttribute_Typed &&other); + ~OutputAttribute_Typed(); OutputAttribute_Typed &operator=(OutputAttribute_Typed &&other) { @@ -316,6 +316,13 @@ template class OutputAttribute_Typed { } }; +/* These are not defined in the class directly, because when defining them there, the external + * template instantiation does not work, resulting in longer compile times. */ +template inline OutputAttribute_Typed::OutputAttribute_Typed() = default; +template +inline OutputAttribute_Typed::OutputAttribute_Typed(OutputAttribute_Typed &&other) = default; +template inline OutputAttribute_Typed::~OutputAttribute_Typed() = default; + /** * A basic container around DNA CustomData so that its users * don't have to implement special copy and move constructors. @@ -501,3 +508,15 @@ template inline MutableSpan OutputAttribute::as_span() } } // namespace blender::bke + +/* -------------------------------------------------------------------- + * Extern template instantiations that are defined in `intern/extern_implementations.cc`. + */ + +namespace blender::bke { +extern template class OutputAttribute_Typed; +extern template class OutputAttribute_Typed; +extern template class OutputAttribute_Typed; +extern template class OutputAttribute_Typed; +extern template class OutputAttribute_Typed; +} // namespace blender::bke diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index fb7fdd1ac21..5a4bc148c0a 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -134,6 +134,7 @@ set(SRC intern/editmesh_cache.c intern/editmesh_tangent.c intern/effect.c + intern/extern_implementations.cc intern/fcurve.c intern/fcurve_cache.c intern/fcurve_driver.c diff --git a/source/blender/blenkernel/intern/extern_implementations.cc b/source/blender/blenkernel/intern/extern_implementations.cc new file mode 100644 index 00000000000..07a4b6fc455 --- /dev/null +++ b/source/blender/blenkernel/intern/extern_implementations.cc @@ -0,0 +1,27 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include "BKE_attribute_access.hh" + +namespace blender::bke { + +template class OutputAttribute_Typed; +template class OutputAttribute_Typed; +template class OutputAttribute_Typed; +template class OutputAttribute_Typed; +template class OutputAttribute_Typed; + +} // namespace blender::bke