Skip to content

Commit 45aeea4

Browse files
committed
xrScriptEngine: add linux build
1 parent 0d7cdb6 commit 45aeea4

15 files changed

+117
-84
lines changed

src/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ add_subdirectory(xrCore)
99
#add_subdirectory(xrNetServer)
1010
#add_subdirectory(xrParticles)
1111
#add_subdirectory(xrPhysics)
12-
#add_subdirectory(xrScriptEngine)
12+
add_subdirectory(xrScriptEngine)
1313
#add_subdirectory(xrSound)

src/Common/object_cloner.h

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ struct CCloner
1515
struct CHelper
1616
{
1717
template <bool a>
18-
IC static void clone(const T& _1, T& _2)
18+
IC static void clone(std::enable_if_t<!a, const T&> _1, T& _2)
1919
{
2020
_2 = _1;
2121
}
2222

23-
template <>
24-
IC static void clone<true>(const T& _1, T& _2)
23+
template <bool a>
24+
IC static void clone(std::enable_if_t<a, const T&> _1, T& _2)
2525
{
26-
_2 = new object_type_traits::remove_pointer<T>::type(*_1);
26+
_2 = new typename object_type_traits::remove_pointer<T>::type(*_1);
2727
CCloner::clone(*_1, *_2);
2828
}
2929
};
@@ -34,18 +34,18 @@ struct CCloner
3434
template <typename T1, typename T2>
3535
IC static void clone(const std::pair<T1, T2>& _1, std::pair<T1, T2>& _2)
3636
{
37-
clone(const_cast<object_type_traits::remove_const<T1>::type&>(_1.first),
38-
const_cast<object_type_traits::remove_const<T1>::type&>(_2.first));
37+
clone(const_cast<typename object_type_traits::remove_const<T1>::type&>(_1.first),
38+
const_cast<typename object_type_traits::remove_const<T1>::type&>(_2.first));
3939
clone(_1.second, _2.second);
4040
}
4141

4242
template <typename T, int size>
4343
IC static void clone(const svector<T, size>& _1, svector<T, size>& _2)
4444
{
4545
_2.resize(_1.size());
46-
svector<T, size>::iterator J = _2.begin();
47-
svector<T, size>::const_iterator I = _1.begin();
48-
svector<T, size>::const_iterator E = _1.end();
46+
typename svector<T, size>::iterator J = _2.begin();
47+
typename svector<T, size>::const_iterator I = _1.begin();
48+
typename svector<T, size>::const_iterator E = _1.end();
4949
for (; I != E; ++I, ++J)
5050
clone(*I, *J);
5151
}
@@ -64,7 +64,7 @@ struct CCloner
6464

6565
for (; !_2.empty(); _2.pop())
6666
{
67-
std::queue<T1, T2>::value_type t;
67+
typename std::queue<T1, T2>::value_type t;
6868
CCloner::clone(_2.front(), t);
6969
__2.push(t);
7070
}
@@ -84,7 +84,7 @@ struct CCloner
8484

8585
for (; !_2.empty(); _2.pop())
8686
{
87-
T1<T2, T3>::value_type t;
87+
typename T1<T2, T3>::value_type t;
8888
CCloner::clone(_2.top(), t);
8989
__2.push(t);
9090
}
@@ -104,7 +104,7 @@ struct CCloner
104104

105105
for (; !_2.empty(); _2.pop())
106106
{
107-
T1<T2, T3, T4>::value_type t;
107+
typename T1<T2, T3, T4>::value_type t;
108108
CCloner::clone(_2.top(), t);
109109
__2.push(t);
110110
}
@@ -131,7 +131,7 @@ struct CCloner
131131
}
132132

133133
template <typename T1, typename T2>
134-
IC static void add(T1& data, typename T2& value)
134+
IC static void add(T1& data, T2& value)
135135
{
136136
data.insert(value);
137137
}
@@ -140,11 +140,11 @@ struct CCloner
140140
IC static void clone(const T& _1, T& _2)
141141
{
142142
_2.clear();
143-
T::const_iterator I = _1.begin();
144-
T::const_iterator E = _1.end();
143+
typename T::const_iterator I = _1.begin();
144+
typename T::const_iterator E = _1.end();
145145
for (; I != E; ++I)
146146
{
147-
T::value_type t;
147+
typename T::value_type t;
148148
CCloner::clone(*I, t);
149149
add(_2, t);
150150
}
@@ -155,13 +155,13 @@ struct CCloner
155155
struct CHelper4
156156
{
157157
template <bool a>
158-
IC static void clone(const T& _1, T& _2)
158+
IC static void clone(std::enable_if_t<!a, const T&> _1, T& _2)
159159
{
160-
CHelper<T>::clone<object_type_traits::is_pointer<T>::value>(_1, _2);
160+
CHelper<T>::template clone<object_type_traits::is_pointer<T>::value>(_1, _2);
161161
}
162162

163-
template <>
164-
IC static void clone<true>(const T& _1, T& _2)
163+
template <bool a>
164+
IC static void clone(std::enable_if_t<a, const T&> _1, T& _2)
165165
{
166166
CHelper3::clone(_1, _2);
167167
}
@@ -170,7 +170,7 @@ struct CCloner
170170
template <typename T>
171171
IC static void clone(const T& _1, T& _2)
172172
{
173-
CHelper4<T>::clone<object_type_traits::is_stl_container<T>::value>(_1, _2);
173+
CHelper4<T>::template clone<object_type_traits::is_stl_container<T>::value>(_1, _2);
174174
}
175175
};
176176

src/Common/object_comparer.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ struct CComparer
1818
struct CHelper
1919
{
2020
template <bool a>
21-
IC static bool compare(const T& a1, const T& a2, const P& p)
21+
IC static bool compare(std::enable_if_t<!a, const T&> a1, const T& a2, const P& p)
2222
{
2323
return p(a1, a2);
2424
}
2525

26-
template <>
27-
IC static bool compare<true>(const T& a1, const T& a2, const P& p)
26+
template <bool a>
27+
IC static bool compare(std::enable_if_t<a, const T&> a1, const T& a2, const P& p)
2828
{
2929
return CComparer::compare(*a1, *a2, p);
3030
}
@@ -119,8 +119,8 @@ struct CComparer
119119
if (a1.size() != a2.size())
120120
return p();
121121

122-
T::const_iterator I = a1.begin(), J = a2.begin();
123-
T::const_iterator E = a1.end();
122+
typename T::const_iterator I = a1.begin(), J = a2.begin();
123+
typename T::const_iterator E = a1.end();
124124
for (; I != E; ++I, ++J)
125125
if (!CComparer::compare(*I, *J, p))
126126
return false;
@@ -132,13 +132,13 @@ struct CComparer
132132
struct CHelper4
133133
{
134134
template <bool a>
135-
IC static bool compare(const T& a1, const T& a2, const P& p)
135+
IC static bool compare(std::enable_if_t<!a, const T&> a1, const T& a2, const P& p)
136136
{
137-
return CHelper<T>::compare<object_type_traits::is_pointer<T>::value>(a1, a2, p);
137+
return CHelper<T>::template compare<object_type_traits::is_pointer<T>::value>(a1, a2, p);
138138
}
139139

140-
template <>
141-
IC static bool compare<true>(const T& a1, const T& a2, const P& p)
140+
template <bool a>
141+
IC static bool compare(std::enable_if_t<a, const T&> a1, const T& a2, const P& p)
142142
{
143143
return CHelper3::compare(a1, a2, p);
144144
}
@@ -147,7 +147,7 @@ struct CComparer
147147
template <typename T>
148148
IC static bool compare(const T& a1, const T& a2, const P& p)
149149
{
150-
return CHelper4<T>::compare<object_type_traits::is_stl_container<T>::value>(a1, a2, p);
150+
return CHelper4<T>::template compare<object_type_traits::is_stl_container<T>::value>(a1, a2, p);
151151
}
152152
};
153153

src/Common/object_destroyer.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,12 @@ struct CDestroyer
7272
struct CHelper1
7373
{
7474
template <bool a>
75-
static void delete_data(T&)
75+
static void delete_data(std::enable_if_t<!a, T&>)
7676
{
7777
}
7878

79-
template <>
80-
static void delete_data<true>(T& data)
79+
template <bool a>
80+
static void delete_data(std::enable_if_t<a, T&> data)
8181
{
8282
data.destroy();
8383
}
@@ -87,13 +87,13 @@ struct CDestroyer
8787
struct CHelper2
8888
{
8989
template <bool a>
90-
static void delete_data(T& data)
90+
static void delete_data(std::enable_if_t<!a, T&> data)
9191
{
92-
CHelper1<T>::delete_data<object_type_traits::is_base_and_derived<IPureDestroyableObject, T>::value>(data);
92+
CHelper1<T>::template delete_data<object_type_traits::is_base_and_derived<IPureDestroyableObject, T>::value>(data);
9393
}
9494

95-
template <>
96-
static void delete_data<true>(T& data)
95+
template <bool a>
96+
static void delete_data(std::enable_if_t<a, T&> data)
9797
{
9898
if (data)
9999
CDestroyer::delete_data(*data);
@@ -116,13 +116,13 @@ struct CDestroyer
116116
struct CHelper4
117117
{
118118
template <bool a>
119-
static void delete_data(T& data)
119+
static void delete_data(std::enable_if_t<!a, T&> data)
120120
{
121-
CHelper2<T>::delete_data<object_type_traits::is_pointer<T>::value>(data);
121+
CHelper2<T>::template delete_data<object_type_traits::is_pointer<T>::value>(data);
122122
}
123123

124-
template <>
125-
static void delete_data<true>(T& data)
124+
template <bool a>
125+
static void delete_data(std::enable_if_t<a, T&> data)
126126
{
127127
CHelper3::delete_data(data);
128128
}
@@ -131,7 +131,7 @@ struct CDestroyer
131131
template <typename T>
132132
static void delete_data(T& data)
133133
{
134-
CHelper4<T>::delete_data<object_type_traits::is_stl_container<T>::value>(data);
134+
CHelper4<T>::template delete_data<object_type_traits::is_stl_container<T>::value>(data);
135135
}
136136
};
137137

src/Common/object_loader.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ struct CLoader
1818
struct CHelper1
1919
{
2020
template <bool a>
21-
static void load_data(T& data, M& stream, const P& /*p*/)
21+
static void load_data(std::enable_if_t<a, T&> data, M& stream, const P& /*p*/)
2222
{
2323
static_assert(!std::is_polymorphic<T>::value, "Cannot load polymorphic classes as binary data.");
2424
stream.r(&data, sizeof(T));
2525
}
2626

27-
template <>
28-
static void load_data<true>(T& data, M& stream, const P& /*p*/)
27+
template <bool a>
28+
static void load_data(std::enable_if_t<!a, T&> data, M& stream, const P& /*p*/)
2929
{
3030
T* data1 = const_cast<T*>(&data);
3131
data1->load(stream);
@@ -36,13 +36,13 @@ struct CLoader
3636
struct CHelper
3737
{
3838
template <bool pointer>
39-
static void load_data(T& data, M& stream, const P& p)
39+
static void load_data(std::enable_if_t<pointer, T&> data, M& stream, const P& p)
4040
{
4141
CHelper1<T>::load_data<object_type_traits::is_base_and_derived<ISerializable, T>::value>(data, stream, p);
4242
}
4343

44-
template <>
45-
static void load_data<true>(T& data, M& stream, const P& p)
44+
template <bool pointer>
45+
static void load_data(std::enable_if_t<!pointer, T&> data, M& stream, const P& p)
4646
{
4747
CLoader<M, P>::load_data(*(data = new typename object_type_traits::remove_pointer<T>::type()), stream, p);
4848
}
@@ -76,14 +76,14 @@ struct CLoader
7676
template <typename T1, typename T2>
7777
struct add_helper
7878
{
79-
template <bool>
80-
static void add(T1& data, T2& value)
79+
template <bool a>
80+
static void add(std::enable_if_t<a, T1&> data, T2& value)
8181
{
8282
data.push_back(value);
8383
}
8484

85-
template <>
86-
static void add<true>(T1& data, T2& value)
85+
template <bool a>
86+
static void add(std::enable_if_t<!a, T1&> data, T2& value)
8787
{
8888
data.insert(value);
8989
}
@@ -115,13 +115,13 @@ struct CLoader
115115
struct CHelper4
116116
{
117117
template <bool a>
118-
static void load_data(T& data, M& stream, const P& p)
118+
static void load_data(std::enable_if_t<a, T&> data, M& stream, const P& p)
119119
{
120120
CHelper<T>::load_data<object_type_traits::is_pointer<T>::value>(data, stream, p);
121121
}
122122

123-
template <>
124-
static void load_data<true>(T& data, M& stream, const P& p)
123+
template <bool a>
124+
static void load_data(std::enable_if_t<!a, T&> data, M& stream, const P& p)
125125
{
126126
CHelper3::load_data(data, stream, p);
127127
}

src/Common/object_saver.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ struct CSaver
1818
struct CHelper1
1919
{
2020
template <bool a>
21-
IC static void save_data(const T& data, M& stream, const P& /*p*/)
21+
IC static void save_data(std::enable_if_t<!a>, const T& data, M& stream, const P& /*p*/)
2222
{
2323
static_assert(!std::is_polymorphic<T>::value, "Cannot save polymorphic classes as binary data.");
2424
stream.w(&data, sizeof(T));
2525
}
2626

27-
template <>
28-
IC static void save_data<true>(const T& data, M& stream, const P& /*p*/)
27+
template <bool a>
28+
IC static void save_data(std::enable_if_t<a>, const T& data, M& stream, const P& /*p*/)
2929
{
3030
T* data1 = const_cast<T*>(&data);
3131
data1->save(stream);
@@ -36,13 +36,13 @@ struct CSaver
3636
struct CHelper
3737
{
3838
template <bool pointer>
39-
IC static void save_data(const T& data, M& stream, const P& p)
39+
IC static void save_data(std::enable_if_t<!pointer>, const T& data, M& stream, const P& p)
4040
{
41-
CHelper1<T>::save_data<object_type_traits::is_base_and_derived<ISerializable, T>::value>(data, stream, p);
41+
CHelper1<T>::template save_data<object_type_traits::is_base_and_derived<ISerializable, T>::value>(data, stream, p);
4242
}
4343

44-
template <>
45-
IC static void save_data<true>(const T& data, M& stream, const P& p)
44+
template <bool pointer>
45+
IC static void save_data(std::enable_if_t<pointer>, const T& data, M& stream, const P& p)
4646
{
4747
CSaver<M, P>::save_data(*data, stream, p);
4848
}
@@ -54,8 +54,8 @@ struct CSaver
5454
IC static void save_data(const T& data, M& stream, const P& p)
5555
{
5656
stream.w_u32((u32)data.size());
57-
T::const_iterator I = data.begin();
58-
T::const_iterator E = data.end();
57+
typename T::const_iterator I = data.begin();
58+
typename T::const_iterator E = data.end();
5959
for (; I != E; ++I)
6060
if (p(data, *I))
6161
CSaver<M, P>::save_data(*I, stream, p);
@@ -66,13 +66,13 @@ struct CSaver
6666
struct CHelper4
6767
{
6868
template <bool a>
69-
IC static void save_data(const T& data, M& stream, const P& p)
69+
IC static void save_data(std::enable_if_t<!a, const T&> data, M& stream, const P& p)
7070
{
71-
CHelper<T>::save_data<object_type_traits::is_pointer<T>::value>(data, stream, p);
71+
CHelper<T>::template save_data<object_type_traits::is_pointer<T>::value>(data, stream, p);
7272
}
7373

74-
template <>
75-
IC static void save_data<true>(const T& data, M& stream, const P& p)
74+
template <bool a>
75+
IC static void save_data(std::enable_if_t<a, const T&> data, M& stream, const P& p)
7676
{
7777
CHelper3::save_data(data, stream, p);
7878
}

src/xrScriptEngine/CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
project(xrScriptEngine)
2+
3+
list(APPEND DIRS
4+
"."
5+
"LuaStudio"
6+
)
7+
8+
add_dir("${DIRS}")
9+
10+
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/../../Externals/luabind ${CMAKE_CURRENT_SOURCE_DIR}/../../sdk/include )
11+
12+
add_library(${PROJECT_NAME} SHARED ${${PROJECT_NAME}__SOURCES} ${${PROJECT_NAME}__INCLUDES})
13+
14+
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
15+
target_link_libraries(${PROJECT_NAME} xrAPI xrCore luabind luajit)

0 commit comments

Comments
 (0)