From d903095d973922761071ea675f380f5c4c3cf2ad Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 24 Mar 2017 23:48:20 +0100 Subject: options, compat: instantiate common templates in their .dll's --- compat/simple-mat.cpp | 3 +++ compat/simple-mat.hpp | 14 ++++++++++++++ options/value.cpp | 3 ++- options/value.hpp | 29 +++++++++++++++++++++++------ 4 files changed, 42 insertions(+), 7 deletions(-) create mode 100644 compat/simple-mat.cpp diff --git a/compat/simple-mat.cpp b/compat/simple-mat.cpp new file mode 100644 index 00000000..d00a4157 --- /dev/null +++ b/compat/simple-mat.cpp @@ -0,0 +1,3 @@ +#define OTR_SIMPLE_MAT_TEMPLATE_UNIT + +#include "simple-mat.hpp" diff --git a/compat/simple-mat.hpp b/compat/simple-mat.hpp index a1509f4d..186043c0 100644 --- a/compat/simple-mat.hpp +++ b/compat/simple-mat.hpp @@ -274,3 +274,17 @@ Mat operator*(const Mat& self, num other) return ret; } +#ifdef OTR_SIMPLE_MAT_TEMPLATE_UNIT +# define OTR_SIMPLE_MAT_TEMPLATE_EXTERN +# define OTR_SIMPLE_MAT_TEMPLATE_DECLSPEC OPENTRACK_COMPAT_EXPORT +#else +# define OTR_SIMPLE_MAT_TEMPLATE_EXTERN extern +# define OTR_SIMPLE_MAT_TEMPLATE_DECLSPEC +#endif + +OTR_SIMPLE_MAT_TEMPLATE_EXTERN template class OTR_SIMPLE_MAT_TEMPLATE_DECLSPEC Mat; +OTR_SIMPLE_MAT_TEMPLATE_EXTERN template class OTR_SIMPLE_MAT_TEMPLATE_DECLSPEC Mat; +OTR_SIMPLE_MAT_TEMPLATE_EXTERN template class OTR_SIMPLE_MAT_TEMPLATE_DECLSPEC Mat; +OTR_SIMPLE_MAT_TEMPLATE_EXTERN template class OTR_SIMPLE_MAT_TEMPLATE_DECLSPEC Mat; +OTR_SIMPLE_MAT_TEMPLATE_EXTERN template class OTR_SIMPLE_MAT_TEMPLATE_DECLSPEC Mat; + diff --git a/options/value.cpp b/options/value.cpp index 36e05dac..af0da89f 100644 --- a/options/value.cpp +++ b/options/value.cpp @@ -6,6 +6,7 @@ * notice appear in all copies. */ +#define OTR_OPTIONS_VALUE_TEMPLATE_UNIT #include "value.hpp" namespace options { @@ -32,4 +33,4 @@ namespace detail } } -} +} // ns options diff --git a/options/value.hpp b/options/value.hpp index 2021bd3e..84416a94 100644 --- a/options/value.hpp +++ b/options/value.hpp @@ -8,8 +8,11 @@ #pragma once -#include "connector.hpp" +#include "export.hpp" + +#include "compat/util.hpp" +#include "connector.hpp" #include "bundle.hpp" #include "slider.hpp" #include @@ -135,14 +138,14 @@ template using value_element_type_t = typename value_element_type template class value final : public base_value { -public: - using element_type = detail::value_element_type_t; - static bool is_equal(const QVariant& val1, const QVariant& val2) { return val1.value() == val2.value(); } +public: + using element_type = detail::value_element_type_t; + t operator=(const t& datum) { const element_type tmp = static_cast(datum); @@ -206,5 +209,19 @@ private: const t def; }; - -} +#ifdef OTR_OPTIONS_VALUE_TEMPLATE_UNIT +# define OTR_OPTIONS_VALUE_TEMPLATE_EXTERN +# define OTR_OPTIONS_VALUE_TEMPLATE_DECLSPEC OPENTRACK_OPTIONS_EXPORT +#else +# define OTR_OPTIONS_VALUE_TEMPLATE_EXTERN extern +# define OTR_OPTIONS_VALUE_TEMPLATE_DECLSPEC +#endif + +OTR_OPTIONS_VALUE_TEMPLATE_EXTERN template class OTR_OPTIONS_VALUE_TEMPLATE_DECLSPEC value; +OTR_OPTIONS_VALUE_TEMPLATE_EXTERN template class OTR_OPTIONS_VALUE_TEMPLATE_DECLSPEC value; +OTR_OPTIONS_VALUE_TEMPLATE_EXTERN template class OTR_OPTIONS_VALUE_TEMPLATE_DECLSPEC value; +OTR_OPTIONS_VALUE_TEMPLATE_EXTERN template class OTR_OPTIONS_VALUE_TEMPLATE_DECLSPEC value; +OTR_OPTIONS_VALUE_TEMPLATE_EXTERN template class OTR_OPTIONS_VALUE_TEMPLATE_DECLSPEC value; +OTR_OPTIONS_VALUE_TEMPLATE_EXTERN template class OTR_OPTIONS_VALUE_TEMPLATE_DECLSPEC value>; + +} // ns options -- cgit v1.2.3