Tuesday, November 5, 2013

assimp--3.0.1270 clang patch

clang has some different style from gcc. assimp works perfectly with gcc but no luck with clang.

I googled a lot and borrow some patches online. This is tested with linux 64bit clang 3.3 and android ndk clang 3.3


diff -rup assimp--3.0.1270-source-only/code/BoostWorkaround/boost/tuple/tuple.hpp assimp--3.0.1270-source-only_patched/code/BoostWorkaround/boost/tuple/tuple.hpp
--- assimp--3.0.1270-source-only/code/BoostWorkaround/boost/tuple/tuple.hpp 2011-05-31 14:14:16.000000000 -0400
+++ assimp--3.0.1270-source-only_patched/code/BoostWorkaround/boost/tuple/tuple.hpp 2013-11-05 23:11:03.399290388 -0500
@@ -175,13 +175,13 @@ namespace boost {
// Get a specific tuple element
template <unsigned N>
typename detail::type_getter<T0,0,typename very_long::next_type, N>::type& get () {
- return m.get<N>();
+ return m.template get<N>();
}

// ... and the const version
template <unsigned N>
const typename detail::type_getter<T0,0,typename very_long::next_type, N>::type& get () const {
- return m.get<N>();
+ return m.template get<N>();
}


@@ -208,14 +208,14 @@ namespace boost {
template <unsigned N,typename T0,typename T1,typename T2,typename T3,typename T4>
inline typename tuple<T0,T1,T2,T3,T4>::very_long::template type_getter<N>::type& get (
tuple<T0,T1,T2,T3,T4>& m) {
- return m.get<N>();
+ return m.template get<N>();
}

// ... and the const version
template <unsigned N,typename T0,typename T1,typename T2,typename T3,typename T4>
inline const typename tuple<T0,T1,T2,T3,T4>::very_long::template type_getter<N>::type& get (
const tuple<T0,T1,T2,T3,T4>& m) {
- return m.get<N>();
+ return m.template get<N>();
}

// Constructs a tuple with 5 elements
@@ -224,11 +224,11 @@ namespace boost {
const T1& t1,const T2& t2,const T3& t3,const T4& t4) {

tuple <T0,T1,T2,T3,T4> t;
- t.get<0>() = t0;
- t.get<1>() = t1;
- t.get<2>() = t2;
- t.get<3>() = t3;
- t.get<4>() = t4;
+ t.template get<0>() = t0;
+ t.template get<1>() = t1;
+ t.template get<2>() = t2;
+ t.template get<3>() = t3;
+ t.template get<4>() = t4;
return t;
}

@@ -237,10 +237,10 @@ namespace boost {
inline tuple <T0,T1,T2,T3> make_tuple (const T0& t0,
const T1& t1,const T2& t2,const T3& t3) {
tuple <T0,T1,T2,T3> t;
- t.get<0>() = t0;
- t.get<1>() = t1;
- t.get<2>() = t2;
- t.get<3>() = t3;
+ t.template get<0>() = t0;
+ t.template get<1>() = t1;
+ t.template get<2>() = t2;
+ t.template get<3>() = t3;
return t;
}

@@ -249,9 +249,9 @@ namespace boost {
inline tuple <T0,T1,T2> make_tuple (const T0& t0,
const T1& t1,const T2& t2) {
tuple <T0,T1,T2> t;
- t.get<0>() = t0;
- t.get<1>() = t1;
- t.get<2>() = t2;
+ t.template get<0>() = t0;
+ t.template get<1>() = t1;
+ t.template get<2>() = t2;
return t;
}

@@ -260,8 +260,8 @@ namespace boost {
inline tuple <T0,T1> make_tuple (const T0& t0,
const T1& t1) {
tuple <T0,T1> t;
- t.get<0>() = t0;
- t.get<1>() = t1;
+ t.template get<0>() = t0;
+ t.template get<1>() = t1;
return t;
}

@@ -269,7 +269,7 @@ namespace boost {
template <typename T0>
inline tuple <T0> make_tuple (const T0& t0) {
tuple <T0> t;
- t.get<0>() = t0;
+ t.template get<0>() = t0;
return t;
}

diff -rup assimp--3.0.1270-source-only/code/STEPFile.h assimp--3.0.1270-source-only_patched/code/STEPFile.h
--- assimp--3.0.1270-source-only/code/STEPFile.h 2012-02-02 22:38:30.000000000 -0500
+++ assimp--3.0.1270-source-only_patched/code/STEPFile.h 2013-11-05 22:57:01.020885314 -0500
@@ -195,13 +195,13 @@ namespace STEP {
// conversion support.
template <typename T>
const T& ResolveSelect(const DB& db) const {
- return Couple<T>(db).MustGetObject(To<EXPRESS::ENTITY>())->To<T>();
+ return Couple<T>(db).MustGetObject(To<EXPRESS::ENTITY>())->template To<T>();
}

template <typename T>
const T* ResolveSelectPtr(const DB& db) const {
const EXPRESS::ENTITY* e = ToPtr<EXPRESS::ENTITY>();
- return e?Couple<T>(db).MustGetObject(*e)->ToPtr<T>():(const T*)0;
+ return e?Couple<T>(db).MustGetObject(*e)->template ToPtr<T>():(const T*)0;
}

public:




No comments:

Post a Comment