summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-03-24 23:48:20 +0100
committerStanislaw Halik <sthalik@misaki.pl>2017-03-24 23:48:20 +0100
commitd903095d973922761071ea675f380f5c4c3cf2ad (patch)
treec2b8a90cec0bb77dd4d789c96b75ccc694aa79fa
parent007f8c41475ddbad34f29593bf0b744ebbca4a2a (diff)
options, compat: instantiate common templates in their .dll's
-rw-r--r--compat/simple-mat.cpp3
-rw-r--r--compat/simple-mat.hpp14
-rw-r--r--options/value.cpp3
-rw-r--r--options/value.hpp29
4 files changed, 42 insertions, 7 deletions
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<num, h_, w_> operator*(const Mat<num, h_, w_>& 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<double, 6, 1>;
+OTR_SIMPLE_MAT_TEMPLATE_EXTERN template class OTR_SIMPLE_MAT_TEMPLATE_DECLSPEC Mat<double, 3, 1>;
+OTR_SIMPLE_MAT_TEMPLATE_EXTERN template class OTR_SIMPLE_MAT_TEMPLATE_DECLSPEC Mat<double, 1, 6>;
+OTR_SIMPLE_MAT_TEMPLATE_EXTERN template class OTR_SIMPLE_MAT_TEMPLATE_DECLSPEC Mat<double, 1, 3>;
+OTR_SIMPLE_MAT_TEMPLATE_EXTERN template class OTR_SIMPLE_MAT_TEMPLATE_DECLSPEC Mat<double, 3, 3>;
+
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 <type_traits>
@@ -135,14 +138,14 @@ template<typename t> using value_element_type_t = typename value_element_type<t>
template<typename t>
class value final : public base_value
{
-public:
- using element_type = detail::value_element_type_t<t>;
-
static bool is_equal(const QVariant& val1, const QVariant& val2)
{
return val1.value<element_type>() == val2.value<element_type>();
}
+public:
+ using element_type = detail::value_element_type_t<t>;
+
t operator=(const t& datum)
{
const element_type tmp = static_cast<element_type>(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<int>;
+OTR_OPTIONS_VALUE_TEMPLATE_EXTERN template class OTR_OPTIONS_VALUE_TEMPLATE_DECLSPEC value<double>;
+OTR_OPTIONS_VALUE_TEMPLATE_EXTERN template class OTR_OPTIONS_VALUE_TEMPLATE_DECLSPEC value<bool>;
+OTR_OPTIONS_VALUE_TEMPLATE_EXTERN template class OTR_OPTIONS_VALUE_TEMPLATE_DECLSPEC value<QString>;
+OTR_OPTIONS_VALUE_TEMPLATE_EXTERN template class OTR_OPTIONS_VALUE_TEMPLATE_DECLSPEC value<slider_value>;
+OTR_OPTIONS_VALUE_TEMPLATE_EXTERN template class OTR_OPTIONS_VALUE_TEMPLATE_DECLSPEC value<QList<QPointF>>;
+
+} // ns options