@@ -0,0 +1,21 | |||||
|
1 | # - Try to find sciqlop-core | |||
|
2 | # Once done this will define | |||
|
3 | # SCIQLOP-CORE_FOUND - System has sciqlop-core | |||
|
4 | # SCIQLOP-CORE_INCLUDE_DIR - The sciqlop-core include directories | |||
|
5 | # SCIQLOP-CORE_LIBRARIES - The libraries needed to use sciqlop-core | |||
|
6 | ||||
|
7 | if(SCIQLOP-CORE_FOUND) | |||
|
8 | return() | |||
|
9 | endif(SCIQLOP-CORE_FOUND) | |||
|
10 | ||||
|
11 | set(SCIQLOP-CORE_INCLUDE_DIR ${sciqlop-core_DIR}/../include) | |||
|
12 | ||||
|
13 | set (OS_LIB_EXTENSION "so") | |||
|
14 | ||||
|
15 | if(WIN32) | |||
|
16 | set (OS_LIB_EXTENSION "dll") | |||
|
17 | endif(WIN32) | |||
|
18 | # TODO: Add Mac Support | |||
|
19 | set(SCIQLOP-CORE_LIBRARIES ${LIBRARY_OUTPUT_PATH}/libsciqlop_core${DEBUG_SUFFIX}.${OS_LIB_EXTENSION}) | |||
|
20 | ||||
|
21 | set(SCIQLOP-CORE_FOUND TRUE) |
@@ -0,0 +1,461 | |||||
|
1 | /* | |||
|
2 | ==================================================================== | |||
|
3 | A Smart Pointer to IMPLementation (i.e. Smart PIMPL or just SPIMPL). | |||
|
4 | ==================================================================== | |||
|
5 | ||||
|
6 | Version: 1.1 | |||
|
7 | ||||
|
8 | Latest version: | |||
|
9 | https://github.com/oliora/samples/blob/master/spimpl.h | |||
|
10 | Rationale and description: | |||
|
11 | http://oliora.github.io/2015/12/29/pimpl-and-rule-of-zero.html | |||
|
12 | ||||
|
13 | Copyright (c) 2015 Andrey Upadyshev (oliora@gmail.com) | |||
|
14 | ||||
|
15 | Distributed under the Boost Software License, Version 1.0. | |||
|
16 | See http://www.boost.org/LICENSE_1_0.txt | |||
|
17 | ||||
|
18 | Changes history | |||
|
19 | --------------- | |||
|
20 | v1.1: | |||
|
21 | - auto_ptr support is disabled by default for C++17 compatibility | |||
|
22 | v1.0: | |||
|
23 | - Released | |||
|
24 | */ | |||
|
25 | ||||
|
26 | #ifndef SPIMPL_H_ | |||
|
27 | #define SPIMPL_H_ | |||
|
28 | ||||
|
29 | #include <cassert> | |||
|
30 | #include <memory> | |||
|
31 | #include <type_traits> | |||
|
32 | ||||
|
33 | ||||
|
34 | #if defined _MSC_VER && _MSC_VER < 1900 // MS Visual Studio before VS2015 | |||
|
35 | #define SPIMPL_NO_CPP11_NOEXCEPT | |||
|
36 | #define SPIMPL_NO_CPP11_CONSTEXPR | |||
|
37 | #define SPIMPL_NO_CPP11_DEFAULT_MOVE_SPEC_FUNC | |||
|
38 | #endif | |||
|
39 | ||||
|
40 | #if !defined SPIMPL_NO_CPP11_NOEXCEPT | |||
|
41 | #define SPIMPL_NOEXCEPT noexcept | |||
|
42 | #else | |||
|
43 | #define SPIMPL_NOEXCEPT | |||
|
44 | #endif | |||
|
45 | ||||
|
46 | #if !defined SPIMPL_NO_CPP11_CONSTEXPR | |||
|
47 | #define SPIMPL_CONSTEXPR constexpr | |||
|
48 | #else | |||
|
49 | #define SPIMPL_CONSTEXPR | |||
|
50 | #endif | |||
|
51 | ||||
|
52 | // define SPIMPL_HAS_AUTO_PTR to enable constructor and assignment operator that accept | |||
|
53 | // std::auto_ptr | |||
|
54 | // TODO: auto detect std::auto_ptr support | |||
|
55 | ||||
|
56 | ||||
|
57 | namespace spimpl { | |||
|
58 | namespace details { | |||
|
59 | template <class T> | |||
|
60 | T *default_copy(T *src) | |||
|
61 | { | |||
|
62 | static_assert(sizeof(T) > 0, "default_copy cannot copy incomplete type"); | |||
|
63 | static_assert(!std::is_void<T>::value, "default_copy cannot copy incomplete type"); | |||
|
64 | return new T(*src); | |||
|
65 | } | |||
|
66 | ||||
|
67 | template <class T> | |||
|
68 | void default_delete(T *p) SPIMPL_NOEXCEPT | |||
|
69 | { | |||
|
70 | static_assert(sizeof(T) > 0, "default_delete cannot delete incomplete type"); | |||
|
71 | static_assert(!std::is_void<T>::value, "default_delete cannot delete incomplete type"); | |||
|
72 | delete p; | |||
|
73 | } | |||
|
74 | ||||
|
75 | template <class T> | |||
|
76 | struct default_deleter { | |||
|
77 | using type = void (*)(T *); | |||
|
78 | }; | |||
|
79 | ||||
|
80 | template <class T> | |||
|
81 | using default_deleter_t = typename default_deleter<T>::type; | |||
|
82 | ||||
|
83 | template <class T> | |||
|
84 | struct default_copier { | |||
|
85 | using type = T *(*)(T *); | |||
|
86 | }; | |||
|
87 | ||||
|
88 | template <class T> | |||
|
89 | using default_copier_t = typename default_copier<T>::type; | |||
|
90 | ||||
|
91 | template <class T, class D, class C> | |||
|
92 | struct is_default_manageable | |||
|
93 | : public std::integral_constant<bool, std::is_same<D, default_deleter_t<T> >::value | |||
|
94 | && std::is_same<C, default_copier_t<T> >::value> { | |||
|
95 | }; | |||
|
96 | } | |||
|
97 | ||||
|
98 | ||||
|
99 | template <class T, class Deleter = details::default_deleter_t<T>, | |||
|
100 | class Copier = details::default_copier_t<T> > | |||
|
101 | class impl_ptr { | |||
|
102 | private: | |||
|
103 | static_assert(!std::is_array<T>::value, | |||
|
104 | "impl_ptr specialization for arrays is not implemented"); | |||
|
105 | struct dummy_t_ { | |||
|
106 | int dummy__; | |||
|
107 | }; | |||
|
108 | ||||
|
109 | public: | |||
|
110 | using pointer = T *; | |||
|
111 | using element_type = T; | |||
|
112 | using copier_type = typename std::decay<Copier>::type; | |||
|
113 | using deleter_type = typename std::decay<Deleter>::type; | |||
|
114 | using unique_ptr_type = std::unique_ptr<T, deleter_type>; | |||
|
115 | using is_default_manageable = details::is_default_manageable<T, deleter_type, copier_type>; | |||
|
116 | ||||
|
117 | SPIMPL_CONSTEXPR impl_ptr() SPIMPL_NOEXCEPT : ptr_(nullptr, deleter_type{}), | |||
|
118 | copier_(copier_type{}) | |||
|
119 | { | |||
|
120 | } | |||
|
121 | ||||
|
122 | SPIMPL_CONSTEXPR impl_ptr(std::nullptr_t) SPIMPL_NOEXCEPT : impl_ptr() {} | |||
|
123 | ||||
|
124 | template <class D, class C> | |||
|
125 | impl_ptr(pointer p, D &&d, C &&c, | |||
|
126 | typename std::enable_if<std::is_convertible<D, deleter_type>::value | |||
|
127 | && std::is_convertible<C, copier_type>::value, | |||
|
128 | dummy_t_>::type | |||
|
129 | = dummy_t_()) SPIMPL_NOEXCEPT : ptr_(std::move(p), std::forward<D>(d)), | |||
|
130 | copier_(std::forward<C>(c)) | |||
|
131 | { | |||
|
132 | } | |||
|
133 | ||||
|
134 | template <class U> | |||
|
135 | impl_ptr(U *u, typename std::enable_if<std::is_convertible<U *, pointer>::value | |||
|
136 | && is_default_manageable::value, | |||
|
137 | dummy_t_>::type | |||
|
138 | = dummy_t_()) SPIMPL_NOEXCEPT | |||
|
139 | : impl_ptr(u, &details::default_delete<T>, &details::default_copy<T>) | |||
|
140 | { | |||
|
141 | } | |||
|
142 | ||||
|
143 | impl_ptr(const impl_ptr &r) : impl_ptr(r.clone()) {} | |||
|
144 | ||||
|
145 | #ifndef SPIMPL_NO_CPP11_DEFAULT_MOVE_SPEC_FUNC | |||
|
146 | impl_ptr(impl_ptr &&r) SPIMPL_NOEXCEPT = default; | |||
|
147 | #else | |||
|
148 | impl_ptr(impl_ptr &&r) SPIMPL_NOEXCEPT : ptr_(std::move(r.ptr_)), copier_(std::move(r.copier_)) | |||
|
149 | { | |||
|
150 | } | |||
|
151 | #endif | |||
|
152 | ||||
|
153 | #ifdef SPIMPL_HAS_AUTO_PTR | |||
|
154 | template <class U> | |||
|
155 | impl_ptr(std::auto_ptr<U> &&u, typename std::enable_if<std::is_convertible<U *, pointer>::value | |||
|
156 | && is_default_manageable::value, | |||
|
157 | dummy_t_>::type | |||
|
158 | = dummy_t_()) SPIMPL_NOEXCEPT | |||
|
159 | : ptr_(u.release(), &details::default_delete<T>), | |||
|
160 | copier_(&details::default_copy<T>) | |||
|
161 | { | |||
|
162 | } | |||
|
163 | #endif | |||
|
164 | ||||
|
165 | template <class U> | |||
|
166 | impl_ptr(std::unique_ptr<U> &&u, | |||
|
167 | typename std::enable_if<std::is_convertible<U *, pointer>::value | |||
|
168 | && is_default_manageable::value, | |||
|
169 | dummy_t_>::type | |||
|
170 | = dummy_t_()) SPIMPL_NOEXCEPT : ptr_(u.release(), &details::default_delete<T>), | |||
|
171 | copier_(&details::default_copy<T>) | |||
|
172 | { | |||
|
173 | } | |||
|
174 | ||||
|
175 | template <class U, class D, class C> | |||
|
176 | impl_ptr(std::unique_ptr<U, D> &&u, C &&c, | |||
|
177 | typename std::enable_if<std::is_convertible<U *, pointer>::value | |||
|
178 | && std::is_convertible<D, deleter_type>::value | |||
|
179 | && std::is_convertible<C, copier_type>::value, | |||
|
180 | dummy_t_>::type | |||
|
181 | = dummy_t_()) SPIMPL_NOEXCEPT : ptr_(std::move(u)), | |||
|
182 | copier_(std::forward<C>(c)) | |||
|
183 | { | |||
|
184 | } | |||
|
185 | ||||
|
186 | template <class U, class D, class C> | |||
|
187 | impl_ptr(impl_ptr<U, D, C> &&u, | |||
|
188 | typename std::enable_if<std::is_convertible<U *, pointer>::value | |||
|
189 | && std::is_convertible<D, deleter_type>::value | |||
|
190 | && std::is_convertible<C, copier_type>::value, | |||
|
191 | dummy_t_>::type | |||
|
192 | = dummy_t_()) SPIMPL_NOEXCEPT : ptr_(std::move(u.ptr_)), | |||
|
193 | copier_(std::move(u.copier_)) | |||
|
194 | { | |||
|
195 | } | |||
|
196 | ||||
|
197 | impl_ptr &operator=(const impl_ptr &r) | |||
|
198 | { | |||
|
199 | if (this == &r) | |||
|
200 | return *this; | |||
|
201 | ||||
|
202 | return operator=(r.clone()); | |||
|
203 | } | |||
|
204 | ||||
|
205 | #ifndef SPIMPL_NO_CPP11_DEFAULT_MOVE_SPEC_FUNC | |||
|
206 | impl_ptr &operator=(impl_ptr &&r) SPIMPL_NOEXCEPT = default; | |||
|
207 | #else | |||
|
208 | impl_ptr &operator=(impl_ptr &&r) SPIMPL_NOEXCEPT | |||
|
209 | { | |||
|
210 | ptr_ = std::move(r.ptr_); | |||
|
211 | copier_ = std::move(r.copier_); | |||
|
212 | return *this; | |||
|
213 | } | |||
|
214 | #endif | |||
|
215 | ||||
|
216 | template <class U, class D, class C> | |||
|
217 | typename std::enable_if<std::is_convertible<U *, pointer>::value | |||
|
218 | && std::is_convertible<D, deleter_type>::value | |||
|
219 | && std::is_convertible<C, copier_type>::value, | |||
|
220 | impl_ptr &>::type | |||
|
221 | operator=(impl_ptr<U, D, C> &&u) SPIMPL_NOEXCEPT | |||
|
222 | { | |||
|
223 | ptr_ = std::move(u.ptr_); | |||
|
224 | copier_ = std::move(u.copier_); | |||
|
225 | return *this; | |||
|
226 | } | |||
|
227 | ||||
|
228 | template <class U, class D, class C> | |||
|
229 | typename std::enable_if<std::is_convertible<U *, pointer>::value | |||
|
230 | && std::is_convertible<D, deleter_type>::value | |||
|
231 | && std::is_convertible<C, copier_type>::value, | |||
|
232 | impl_ptr &>::type | |||
|
233 | operator=(const impl_ptr<U, D, C> &u) | |||
|
234 | { | |||
|
235 | return operator=(u.clone()); | |||
|
236 | } | |||
|
237 | ||||
|
238 | // | |||
|
239 | ||||
|
240 | #ifdef SPIMPL_HAS_AUTO_PTR | |||
|
241 | template <class U> | |||
|
242 | typename std::enable_if<std::is_convertible<U *, pointer>::value | |||
|
243 | && is_default_manageable::value, | |||
|
244 | impl_ptr &>::type | |||
|
245 | operator=(std::auto_ptr<U> &&u) SPIMPL_NOEXCEPT | |||
|
246 | { | |||
|
247 | return operator=(impl_ptr(std::move(u))); | |||
|
248 | } | |||
|
249 | #endif | |||
|
250 | ||||
|
251 | template <class U> | |||
|
252 | typename std::enable_if<std::is_convertible<U *, pointer>::value | |||
|
253 | && is_default_manageable::value, | |||
|
254 | impl_ptr &>::type | |||
|
255 | operator=(std::unique_ptr<U> &&u) SPIMPL_NOEXCEPT | |||
|
256 | { | |||
|
257 | return operator=(impl_ptr(std::move(u))); | |||
|
258 | } | |||
|
259 | ||||
|
260 | impl_ptr clone() const | |||
|
261 | { | |||
|
262 | return impl_ptr(ptr_ ? copier_(ptr_.get()) : nullptr, ptr_.get_deleter(), copier_); | |||
|
263 | } | |||
|
264 | ||||
|
265 | typename std::remove_reference<T>::type &operator*() const { return *ptr_; } | |||
|
266 | pointer operator->() const SPIMPL_NOEXCEPT { return get(); } | |||
|
267 | pointer get() const SPIMPL_NOEXCEPT { return ptr_.get(); } | |||
|
268 | ||||
|
269 | void swap(impl_ptr &u) SPIMPL_NOEXCEPT | |||
|
270 | { | |||
|
271 | using std::swap; | |||
|
272 | ptr_.swap(u.ptr_); | |||
|
273 | swap(copier_, u.copier_); | |||
|
274 | } | |||
|
275 | ||||
|
276 | pointer release() SPIMPL_NOEXCEPT { return ptr_.release(); } | |||
|
277 | ||||
|
278 | unique_ptr_type release_unique() SPIMPL_NOEXCEPT { return std::move(ptr_); } | |||
|
279 | ||||
|
280 | explicit operator bool() const SPIMPL_NOEXCEPT { return static_cast<bool>(ptr_); } | |||
|
281 | ||||
|
282 | typename std::remove_reference<deleter_type>::type &get_deleter() SPIMPL_NOEXCEPT | |||
|
283 | { | |||
|
284 | return ptr_.get_deleter(); | |||
|
285 | } | |||
|
286 | const typename std::remove_reference<deleter_type>::type &get_deleter() const SPIMPL_NOEXCEPT | |||
|
287 | { | |||
|
288 | return ptr_.get_deleter(); | |||
|
289 | } | |||
|
290 | ||||
|
291 | typename std::remove_reference<copier_type>::type &get_copier() SPIMPL_NOEXCEPT | |||
|
292 | { | |||
|
293 | return copier_; | |||
|
294 | } | |||
|
295 | const typename std::remove_reference<copier_type>::type &get_copier() const SPIMPL_NOEXCEPT | |||
|
296 | { | |||
|
297 | return copier_; | |||
|
298 | } | |||
|
299 | ||||
|
300 | private: | |||
|
301 | unique_ptr_type ptr_; | |||
|
302 | copier_type copier_; | |||
|
303 | }; | |||
|
304 | ||||
|
305 | ||||
|
306 | template <class T, class D, class C> | |||
|
307 | inline void swap(impl_ptr<T, D, C> &l, impl_ptr<T, D, C> &r) SPIMPL_NOEXCEPT | |||
|
308 | { | |||
|
309 | l.swap(r); | |||
|
310 | } | |||
|
311 | ||||
|
312 | ||||
|
313 | template <class T1, class D1, class C1, class T2, class D2, class C2> | |||
|
314 | inline bool operator==(const impl_ptr<T1, D1, C1> &l, const impl_ptr<T2, D2, C2> &r) | |||
|
315 | { | |||
|
316 | return l.get() == r.get(); | |||
|
317 | } | |||
|
318 | ||||
|
319 | template <class T1, class D1, class C1, class T2, class D2, class C2> | |||
|
320 | inline bool operator!=(const impl_ptr<T1, D1, C1> &l, const impl_ptr<T2, D2, C2> &r) | |||
|
321 | { | |||
|
322 | return !(l == r); | |||
|
323 | } | |||
|
324 | ||||
|
325 | template <class T1, class D1, class C1, class T2, class D2, class C2> | |||
|
326 | inline bool operator<(const impl_ptr<T1, D1, C1> &l, const impl_ptr<T2, D2, C2> &r) | |||
|
327 | { | |||
|
328 | using P1 = typename impl_ptr<T1, D1, C1>::pointer; | |||
|
329 | using P2 = typename impl_ptr<T2, D2, C2>::pointer; | |||
|
330 | using CT = typename std::common_type<P1, P2>::type; | |||
|
331 | return std::less<CT>()(l.get(), r.get()); | |||
|
332 | } | |||
|
333 | ||||
|
334 | template <class T1, class D1, class C1, class T2, class D2, class C2> | |||
|
335 | inline bool operator>(const impl_ptr<T1, D1, C1> &l, const impl_ptr<T2, D2, C2> &r) | |||
|
336 | { | |||
|
337 | return r < l; | |||
|
338 | } | |||
|
339 | ||||
|
340 | template <class T1, class D1, class C1, class T2, class D2, class C2> | |||
|
341 | inline bool operator<=(const impl_ptr<T1, D1, C1> &l, const impl_ptr<T2, D2, C2> &r) | |||
|
342 | { | |||
|
343 | return !(r < l); | |||
|
344 | } | |||
|
345 | ||||
|
346 | template <class T1, class D1, class C1, class T2, class D2, class C2> | |||
|
347 | inline bool operator>=(const impl_ptr<T1, D1, C1> &l, const impl_ptr<T2, D2, C2> &r) | |||
|
348 | { | |||
|
349 | return !(l < r); | |||
|
350 | } | |||
|
351 | ||||
|
352 | template <class T, class D, class C> | |||
|
353 | inline bool operator==(const impl_ptr<T, D, C> &p, std::nullptr_t) SPIMPL_NOEXCEPT | |||
|
354 | { | |||
|
355 | return !p; | |||
|
356 | } | |||
|
357 | ||||
|
358 | template <class T, class D, class C> | |||
|
359 | inline bool operator==(std::nullptr_t, const impl_ptr<T, D, C> &p) SPIMPL_NOEXCEPT | |||
|
360 | { | |||
|
361 | return !p; | |||
|
362 | } | |||
|
363 | ||||
|
364 | template <class T, class D, class C> | |||
|
365 | inline bool operator!=(const impl_ptr<T, D, C> &p, std::nullptr_t) SPIMPL_NOEXCEPT | |||
|
366 | { | |||
|
367 | return static_cast<bool>(p); | |||
|
368 | } | |||
|
369 | ||||
|
370 | template <class T, class D, class C> | |||
|
371 | inline bool operator!=(std::nullptr_t, const impl_ptr<T, D, C> &p) SPIMPL_NOEXCEPT | |||
|
372 | { | |||
|
373 | return static_cast<bool>(p); | |||
|
374 | } | |||
|
375 | ||||
|
376 | template <class T, class D, class C> | |||
|
377 | inline bool operator<(const impl_ptr<T, D, C> &l, std::nullptr_t) | |||
|
378 | { | |||
|
379 | using P = typename impl_ptr<T, D, C>::pointer; | |||
|
380 | return std::less<P>()(l.get(), nullptr); | |||
|
381 | } | |||
|
382 | ||||
|
383 | template <class T, class D, class C> | |||
|
384 | inline bool operator<(std::nullptr_t, const impl_ptr<T, D, C> &p) | |||
|
385 | { | |||
|
386 | using P = typename impl_ptr<T, D, C>::pointer; | |||
|
387 | return std::less<P>()(nullptr, p.get()); | |||
|
388 | } | |||
|
389 | ||||
|
390 | template <class T, class D, class C> | |||
|
391 | inline bool operator>(const impl_ptr<T, D, C> &p, std::nullptr_t) | |||
|
392 | { | |||
|
393 | return nullptr < p; | |||
|
394 | } | |||
|
395 | ||||
|
396 | template <class T, class D, class C> | |||
|
397 | inline bool operator>(std::nullptr_t, const impl_ptr<T, D, C> &p) | |||
|
398 | { | |||
|
399 | return p < nullptr; | |||
|
400 | } | |||
|
401 | ||||
|
402 | template <class T, class D, class C> | |||
|
403 | inline bool operator<=(const impl_ptr<T, D, C> &p, std::nullptr_t) | |||
|
404 | { | |||
|
405 | return !(nullptr < p); | |||
|
406 | } | |||
|
407 | ||||
|
408 | template <class T, class D, class C> | |||
|
409 | inline bool operator<=(std::nullptr_t, const impl_ptr<T, D, C> &p) | |||
|
410 | { | |||
|
411 | return !(p < nullptr); | |||
|
412 | } | |||
|
413 | ||||
|
414 | template <class T, class D, class C> | |||
|
415 | inline bool operator>=(const impl_ptr<T, D, C> &p, std::nullptr_t) | |||
|
416 | { | |||
|
417 | return !(p < nullptr); | |||
|
418 | } | |||
|
419 | ||||
|
420 | template <class T, class D, class C> | |||
|
421 | inline bool operator>=(std::nullptr_t, const impl_ptr<T, D, C> &p) | |||
|
422 | { | |||
|
423 | return !(nullptr < p); | |||
|
424 | } | |||
|
425 | ||||
|
426 | ||||
|
427 | template <class T, class... Args> | |||
|
428 | inline impl_ptr<T> make_impl(Args &&... args) | |||
|
429 | { | |||
|
430 | return impl_ptr<T>(new T(std::forward<Args>(args)...), &details::default_delete<T>, | |||
|
431 | &details::default_copy<T>); | |||
|
432 | } | |||
|
433 | ||||
|
434 | ||||
|
435 | // Helpers to manage unique impl, stored in std::unique_ptr | |||
|
436 | ||||
|
437 | template <class T, class Deleter = void (*)(T *)> | |||
|
438 | using unique_impl_ptr = std::unique_ptr<T, Deleter>; | |||
|
439 | ||||
|
440 | template <class T, class... Args> | |||
|
441 | inline unique_impl_ptr<T> make_unique_impl(Args &&... args) | |||
|
442 | { | |||
|
443 | static_assert(!std::is_array<T>::value, "unique_impl_ptr does not support arrays"); | |||
|
444 | return unique_impl_ptr<T>(new T(std::forward<Args>(args)...), &details::default_delete<T>); | |||
|
445 | } | |||
|
446 | } | |||
|
447 | ||||
|
448 | namespace std { | |||
|
449 | template <class T, class D, class C> | |||
|
450 | struct hash<spimpl::impl_ptr<T, D, C> > { | |||
|
451 | using argument_type = spimpl::impl_ptr<T, D, C>; | |||
|
452 | using result_type = size_t; | |||
|
453 | ||||
|
454 | result_type operator()(const argument_type &p) const SPIMPL_NOEXCEPT | |||
|
455 | { | |||
|
456 | return hash<typename argument_type::pointer>()(p.get()); | |||
|
457 | } | |||
|
458 | }; | |||
|
459 | } | |||
|
460 | ||||
|
461 | #endif // SPIMPL_H_ |
@@ -0,0 +1,39 | |||||
|
1 | #ifndef SCIQLOP_DATASOURCECONTROLLER_H | |||
|
2 | #define SCIQLOP_DATASOURCECONTROLLER_H | |||
|
3 | ||||
|
4 | #include "DataSourceController.h" | |||
|
5 | ||||
|
6 | #include <QLoggingCategory> | |||
|
7 | #include <QObject> | |||
|
8 | ||||
|
9 | #include <Common/spimpl.h> | |||
|
10 | ||||
|
11 | Q_DECLARE_LOGGING_CATEGORY(LOG_DataSourceController) | |||
|
12 | ||||
|
13 | /** | |||
|
14 | * @brief The DataSourceController class aims to make the link between SciQlop | |||
|
15 | * and its plugins. This is the intermediate class that SciQlop have to use | |||
|
16 | * in the way to connect a data source. Please first use load method to intialize | |||
|
17 | * a plugin specified by its metadata name (JSON plugin source) then others specifics | |||
|
18 | * method will ba able to access it. | |||
|
19 | * You can load a data source driver plugin then create a data source. | |||
|
20 | */ | |||
|
21 | class DataSourceController : public QObject { | |||
|
22 | Q_OBJECT | |||
|
23 | public: | |||
|
24 | explicit DataSourceController(QObject *parent = 0); | |||
|
25 | virtual ~DataSourceController(); | |||
|
26 | ||||
|
27 | public slots: | |||
|
28 | /// Manage init/end of the controller | |||
|
29 | void initialize(); | |||
|
30 | void finalize(); | |||
|
31 | ||||
|
32 | private: | |||
|
33 | void waitForFinish(); | |||
|
34 | ||||
|
35 | class DataSourceControllerPrivate; | |||
|
36 | spimpl::unique_impl_ptr<DataSourceControllerPrivate> impl; | |||
|
37 | }; | |||
|
38 | ||||
|
39 | #endif // SCIQLOP_DATASOURCECONTROLLER_H |
@@ -0,0 +1,45 | |||||
|
1 | #include "DataSource/DataSourceController.h" | |||
|
2 | ||||
|
3 | #include <QMutex> | |||
|
4 | #include <QThread> | |||
|
5 | ||||
|
6 | Q_LOGGING_CATEGORY(LOG_DataSourceController, "dataSourceController") | |||
|
7 | ||||
|
8 | class DataSourceController::DataSourceControllerPrivate { | |||
|
9 | public: | |||
|
10 | DataSourceControllerPrivate() {} | |||
|
11 | ||||
|
12 | QMutex m_WorkingMutex; | |||
|
13 | }; | |||
|
14 | ||||
|
15 | DataSourceController::DataSourceController(QObject *parent) | |||
|
16 | : impl{spimpl::make_unique_impl<DataSourceControllerPrivate>()} | |||
|
17 | { | |||
|
18 | qCDebug(LOG_DataSourceController()) << tr("Construction du DataSourceController") | |||
|
19 | << QThread::currentThread(); | |||
|
20 | } | |||
|
21 | ||||
|
22 | DataSourceController::~DataSourceController() | |||
|
23 | { | |||
|
24 | qCDebug(LOG_DataSourceController()) << tr("Desctruction du DataSourceController") | |||
|
25 | << QThread::currentThread(); | |||
|
26 | this->waitForFinish(); | |||
|
27 | } | |||
|
28 | ||||
|
29 | void DataSourceController::initialize() | |||
|
30 | { | |||
|
31 | qCDebug(LOG_DataSourceController()) << tr("initialize du DataSourceController") | |||
|
32 | << QThread::currentThread(); | |||
|
33 | impl->m_WorkingMutex.lock(); | |||
|
34 | qCDebug(LOG_DataSourceController()) << tr("initialize du DataSourceController END"); | |||
|
35 | } | |||
|
36 | ||||
|
37 | void DataSourceController::finalize() | |||
|
38 | { | |||
|
39 | impl->m_WorkingMutex.unlock(); | |||
|
40 | } | |||
|
41 | ||||
|
42 | void DataSourceController::waitForFinish() | |||
|
43 | { | |||
|
44 | QMutexLocker locker(&impl->m_WorkingMutex); | |||
|
45 | } |
@@ -0,0 +1,21 | |||||
|
1 | # - Try to find sciqlop-gui | |||
|
2 | # Once done this will define | |||
|
3 | # SCIQLOP-GUI_FOUND - System has sciqlop-gui | |||
|
4 | # SCIQLOP-GUI_INCLUDE_DIR - The sciqlop-gui include directories | |||
|
5 | # SCIQLOP-GUI_LIBRARIES - The libraries needed to use sciqlop-gui | |||
|
6 | ||||
|
7 | if(SCIQLOP-GUI_FOUND) | |||
|
8 | return() | |||
|
9 | endif(SCIQLOP-GUI_FOUND) | |||
|
10 | ||||
|
11 | set(SCIQLOP-GUI_INCLUDE_DIR ${sciqlop-gui_DIR}/../include) | |||
|
12 | ||||
|
13 | set (OS_LIB_EXTENSION "so") | |||
|
14 | ||||
|
15 | if(WIN32) | |||
|
16 | set (OS_LIB_EXTENSION "dll") | |||
|
17 | endif(WIN32) | |||
|
18 | # TODO: Add Mac Support | |||
|
19 | set(SCIQLOP-GUI_LIBRARIES ${LIBRARY_OUTPUT_PATH}/libsciqlop_gui${DEBUG_SUFFIX}.${OS_LIB_EXTENSION}) | |||
|
20 | ||||
|
21 | set(SCIQLOP-GUI_FOUND TRUE) |
@@ -0,0 +1,33 | |||||
|
1 | #ifndef SCIQLOP_SQPAPPLICATION_H | |||
|
2 | #define SCIQLOP_SQPAPPLICATION_H | |||
|
3 | ||||
|
4 | #include "SqpApplication.h" | |||
|
5 | ||||
|
6 | #include <QApplication> | |||
|
7 | #include <QLoggingCategory> | |||
|
8 | ||||
|
9 | #include <Common/spimpl.h> | |||
|
10 | ||||
|
11 | Q_DECLARE_LOGGING_CATEGORY(LOG_SqpApplication) | |||
|
12 | ||||
|
13 | /** | |||
|
14 | * @brief The SqpApplication class aims to make the link between SciQlop | |||
|
15 | * and its plugins. This is the intermediate class that SciQlop have to use | |||
|
16 | * in the way to connect a data source. Please first use load method to intialize | |||
|
17 | * a plugin specified by its metadata name (JSON plugin source) then others specifics | |||
|
18 | * method will ba able to access it. | |||
|
19 | * You can load a data source driver plugin then create a data source. | |||
|
20 | */ | |||
|
21 | class SqpApplication : public QApplication { | |||
|
22 | Q_OBJECT | |||
|
23 | public: | |||
|
24 | explicit SqpApplication(int &argc, char **argv); | |||
|
25 | virtual ~SqpApplication(); | |||
|
26 | void initialize(); | |||
|
27 | ||||
|
28 | private: | |||
|
29 | class SqpApplicationPrivate; | |||
|
30 | spimpl::unique_impl_ptr<SqpApplicationPrivate> impl; | |||
|
31 | }; | |||
|
32 | ||||
|
33 | #endif // SCIQLOP_SQPAPPLICATION_H |
@@ -0,0 +1,46 | |||||
|
1 | #include "SqpApplication.h" | |||
|
2 | ||||
|
3 | #include <DataSource/DataSourceController.h> | |||
|
4 | #include <QThread> | |||
|
5 | ||||
|
6 | Q_LOGGING_CATEGORY(LOG_SqpApplication, "SqpApplication") | |||
|
7 | ||||
|
8 | class SqpApplication::SqpApplicationPrivate { | |||
|
9 | public: | |||
|
10 | SqpApplicationPrivate() {} | |||
|
11 | ~SqpApplicationPrivate() | |||
|
12 | { | |||
|
13 | qCInfo(LOG_SqpApplication()) << tr("Desctruction du SqpApplicationPrivate"); | |||
|
14 | ; | |||
|
15 | m_DataSourceControllerThread.quit(); | |||
|
16 | m_DataSourceControllerThread.wait(); | |||
|
17 | } | |||
|
18 | ||||
|
19 | std::unique_ptr<DataSourceController> m_DataSourceController; | |||
|
20 | QThread m_DataSourceControllerThread; | |||
|
21 | }; | |||
|
22 | ||||
|
23 | ||||
|
24 | SqpApplication::SqpApplication(int &argc, char **argv) | |||
|
25 | : QApplication(argc, argv), impl{spimpl::make_unique_impl<SqpApplicationPrivate>()} | |||
|
26 | { | |||
|
27 | qCInfo(LOG_SqpApplication()) << tr("Construction du SqpApplication"); | |||
|
28 | ||||
|
29 | impl->m_DataSourceController = std::make_unique<DataSourceController>(); | |||
|
30 | impl->m_DataSourceController->moveToThread(&impl->m_DataSourceControllerThread); | |||
|
31 | ||||
|
32 | connect(&impl->m_DataSourceControllerThread, &QThread::started, | |||
|
33 | impl->m_DataSourceController.get(), &DataSourceController::initialize); | |||
|
34 | connect(&impl->m_DataSourceControllerThread, &QThread::finished, | |||
|
35 | impl->m_DataSourceController.get(), &DataSourceController::finalize); | |||
|
36 | ||||
|
37 | impl->m_DataSourceControllerThread.start(); | |||
|
38 | } | |||
|
39 | ||||
|
40 | SqpApplication::~SqpApplication() | |||
|
41 | { | |||
|
42 | } | |||
|
43 | ||||
|
44 | void SqpApplication::initialize() | |||
|
45 | { | |||
|
46 | } |
@@ -14,15 +14,19 SCIQLOP_FIND_QT(Core Widgets) | |||||
14 | # |
|
14 | # | |
15 | # Find dependent libraries |
|
15 | # Find dependent libraries | |
16 | # ======================== |
|
16 | # ======================== | |
17 | SET(LIBRARIES) |
|
17 | find_package(sciqlop-gui) | |
18 | SET(EXTERN_LIBRARIES) |
|
18 | ||
|
19 | message("Librairies inclues dans APP: ${SCIQLOP-GUI_LIBRARIES}") | |||
|
20 | SET(LIBRARIES ${SCIQLOP-GUI_LIBRARIES}) | |||
19 | SET(EXTERN_SHARED_LIBRARIES) |
|
21 | SET(EXTERN_SHARED_LIBRARIES) | |
20 |
|
22 | |||
|
23 | INCLUDE_DIRECTORIES(${SCIQLOP-GUI_INCLUDE_DIR}) | |||
|
24 | ||||
21 | # Add sqpcore to the list of libraries to use |
|
25 | # Add sqpcore to the list of libraries to use | |
22 | list(APPEND LIBRARIES ${SQPCORE_LIBRARY_NAME}) |
|
26 | list(APPEND LIBRARIES ${SQPCORE_LIBRARY_NAME}) | |
23 |
|
27 | |||
24 |
# Include |
|
28 | # Include core directory | |
25 |
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../ |
|
29 | include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../core/include") | |
26 |
|
30 | |||
27 | # Add dependent shared libraries |
|
31 | # Add dependent shared libraries | |
28 | list(APPEND SHARED_LIBRARIES ${SQPCORE_SHARED_LIBRARIES}) |
|
32 | list(APPEND SHARED_LIBRARIES ${SQPCORE_SHARED_LIBRARIES}) | |
@@ -61,7 +65,6 QT5_WRAP_UI(UIS_HDRS | |||||
61 | ADD_EXECUTABLE(${EXECUTABLE_NAME} ${APPLICATION_SOURCES} ${RCC_HDRS} ${UIS_HDRS}) |
|
65 | ADD_EXECUTABLE(${EXECUTABLE_NAME} ${APPLICATION_SOURCES} ${RCC_HDRS} ${UIS_HDRS}) | |
62 | set_property(TARGET ${EXECUTABLE_NAME} PROPERTY CXX_STANDARD 14) |
|
66 | set_property(TARGET ${EXECUTABLE_NAME} PROPERTY CXX_STANDARD 14) | |
63 | set_property(TARGET ${EXECUTABLE_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) |
|
67 | set_property(TARGET ${EXECUTABLE_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) | |
64 |
|
||||
65 | target_link_libraries(${EXECUTABLE_NAME} |
|
68 | target_link_libraries(${EXECUTABLE_NAME} | |
66 | ${LIBRARIES}) |
|
69 | ${LIBRARIES}) | |
67 |
|
70 | |||
@@ -83,7 +86,7 IF(BUILD_TESTS) | |||||
83 | INCLUDE_DIRECTORIES(${SOURCES_DIR}) |
|
86 | INCLUDE_DIRECTORIES(${SOURCES_DIR}) | |
84 | FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp) |
|
87 | FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp) | |
85 | FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h) |
|
88 | FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h) | |
86 |
|
|
89 | SET( TEST_LIBRARIES ${LIBRARIES}) | |
87 |
|
90 | |||
88 | FOREACH( testFile ${TESTS_SOURCES} ) |
|
91 | FOREACH( testFile ${TESTS_SOURCES} ) | |
89 | GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY ) |
|
92 | GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY ) | |
@@ -104,7 +107,7 IF(BUILD_TESTS) | |||||
104 |
|
107 | |||
105 | ADD_TEST( NAME ${testName} COMMAND ${testName} ) |
|
108 | ADD_TEST( NAME ${testName} COMMAND ${testName} ) | |
106 |
|
109 | |||
107 |
SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} |
|
110 | SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName}) | |
108 | ENDFOREACH( testFile ) |
|
111 | ENDFOREACH( testFile ) | |
109 |
|
112 | |||
110 | LIST(APPEND testFilesToFormat ${TESTS_SOURCES}) |
|
113 | LIST(APPEND testFilesToFormat ${TESTS_SOURCES}) |
1 | NO CONTENT: file renamed from sqpapp/resources/qlopapp.qrc to app/resources/qlopapp.qrc |
|
NO CONTENT: file renamed from sqpapp/resources/qlopapp.qrc to app/resources/qlopapp.qrc |
1 | NO CONTENT: file renamed from sqpapp/resources/sciqlopLOGO.svg to app/resources/sciqlopLOGO.svg |
|
NO CONTENT: file renamed from sqpapp/resources/sciqlopLOGO.svg to app/resources/sciqlopLOGO.svg |
@@ -20,18 +20,18 | |||||
20 | -- Mail : alexis.jeandet@member.fsf.org |
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #include "mainwindow.h" |
|
22 | #include "mainwindow.h" | |
23 | #include <QApplication> |
|
|||
24 | #include <QProcessEnvironment> |
|
23 | #include <QProcessEnvironment> | |
25 | #include <QThread> |
|
24 | #include <QThread> | |
26 |
|
|
25 | #include <SqpApplication.h> | |
|
26 | #include <omp.h> | |||
27 | #include <qglobal.h> |
|
27 | #include <qglobal.h> | |
28 |
|
28 | |||
29 | int main(int argc, char *argv[]) |
|
29 | int main(int argc, char *argv[]) | |
30 | { |
|
30 | { | |
31 |
|
|
31 | SqpApplication a(argc, argv); | |
32 |
|
|
32 | SqpApplication::setOrganizationName("LPP"); | |
33 |
|
|
33 | SqpApplication::setOrganizationDomain("lpp.fr"); | |
34 |
|
|
34 | SqpApplication::setApplicationName("SciQLop"); | |
35 | MainWindow w; |
|
35 | MainWindow w; | |
36 | w.show(); |
|
36 | w.show(); | |
37 |
|
37 |
@@ -26,7 +26,7 | |||||
26 | #include <QDateTime> |
|
26 | #include <QDateTime> | |
27 | #include <QDir> |
|
27 | #include <QDir> | |
28 | #include <QFileDialog> |
|
28 | #include <QFileDialog> | |
29 |
|
|
29 | #include <omp.h> | |
30 | //#include <network/filedownloader.h> |
|
30 | //#include <network/filedownloader.h> | |
31 | //#include <qlopdatabase.h> |
|
31 | //#include <qlopdatabase.h> | |
32 | //#include <qlopsettings.h> |
|
32 | //#include <qlopsettings.h> |
1 | NO CONTENT: file renamed from sqpapp/src/mainwindow.h to app/src/mainwindow.h |
|
NO CONTENT: file renamed from sqpapp/src/mainwindow.h to app/src/mainwindow.h |
1 | NO CONTENT: file renamed from sqpapp/src/mainwindow.ui to app/src/mainwindow.ui |
|
NO CONTENT: file renamed from sqpapp/src/mainwindow.ui to app/src/mainwindow.ui |
@@ -10,9 +10,15 SET (LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dist/${CMAKE_BUILD_TYPE}) | |||||
10 | # |
|
10 | # | |
11 | # Compile the diffents modules |
|
11 | # Compile the diffents modules | |
12 | # |
|
12 | # | |
13 |
|
|
13 | set(sciqlop-core_DIR "${CMAKE_SOURCE_DIR}/core/cmake") | |
14 | #ADD_SUBDIRECTORY("${CMAKE_SOURCE_DIR}/sqpgui") |
|
14 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${sciqlop-core_DIR}") | |
15 |
ADD_SUBDIRECTORY("${CMAKE_SOURCE_DIR}/ |
|
15 | ADD_SUBDIRECTORY("${CMAKE_SOURCE_DIR}/core") | |
|
16 | ||||
|
17 | set(sciqlop-gui_DIR "${CMAKE_SOURCE_DIR}/gui/cmake") | |||
|
18 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${sciqlop-gui_DIR}") | |||
|
19 | ADD_SUBDIRECTORY("${CMAKE_SOURCE_DIR}/gui") | |||
|
20 | ||||
|
21 | ADD_SUBDIRECTORY("${CMAKE_SOURCE_DIR}/app") | |||
16 |
|
22 | |||
17 | # |
|
23 | # | |
18 | # Code formatting |
|
24 | # Code formatting |
@@ -4,18 +4,18 | |||||
4 | # Debug or release |
|
4 | # Debug or release | |
5 | # |
|
5 | # | |
6 | # As the "NMake Makefiles" forces by default the CMAKE_BUILD_TYPE variable to Debug, SCIQLOP_BUILD_TYPE variable is used to be sure that the debug mode is a user choice |
|
6 | # As the "NMake Makefiles" forces by default the CMAKE_BUILD_TYPE variable to Debug, SCIQLOP_BUILD_TYPE variable is used to be sure that the debug mode is a user choice | |
7 | SET(SCIQLOP_BUILD_TYPE "Release" CACHE STRING "Choose to compile in Debug or Release mode") |
|
7 | #SET(SCIQLOP_BUILD_TYPE "Release" CACHE STRING "Choose to compile in Debug or Release mode") | |
8 |
|
8 | |||
9 | IF(SCIQLOP_BUILD_TYPE MATCHES "Debug") |
|
9 | #IF(SCIQLOP_BUILD_TYPE MATCHES "Debug") | |
10 | MESSAGE (STATUS "Build in Debug") |
|
10 | # MESSAGE (STATUS "Build in Debug") | |
11 | SET (CMAKE_BUILD_TYPE "Debug") |
|
11 | # SET (CMAKE_BUILD_TYPE "Debug") | |
12 | SET (DEBUG_SUFFIX "d") |
|
12 | # SET (DEBUG_SUFFIX "d") | |
13 | ELSE() |
|
13 | #ELSE() | |
14 | MESSAGE (STATUS "Build in Release") |
|
14 | # MESSAGE (STATUS "Build in Release") | |
15 | SET (CMAKE_BUILD_TYPE "Release") |
|
15 | # SET (CMAKE_BUILD_TYPE "Release") | |
16 | SET (SCIQLOP_BUILD_TYPE "Release") |
|
16 | # SET (SCIQLOP_BUILD_TYPE "Release") | |
17 | SET (DEBUG_SUFFIX "") |
|
17 | # SET (DEBUG_SUFFIX "") | |
18 | ENDIF() |
|
18 | #ENDIF() | |
19 |
|
19 | |||
20 | # |
|
20 | # | |
21 | # Need to compile tests? |
|
21 | # Need to compile tests? |
@@ -1,15 +1,19 | |||||
1 |
|
1 | |||
2 |
## |
|
2 | ## core - CMakeLists.txt | |
3 | STRING(TOLOWER ${CMAKE_PROJECT_NAME} LIBRARY_PREFFIX) |
|
3 | STRING(TOLOWER ${CMAKE_PROJECT_NAME} LIBRARY_PREFFIX) | |
4 |
SET(SQPCORE_LIBRARY_NAME "${LIBRARY_PREFFIX}_ |
|
4 | SET(SQPCORE_LIBRARY_NAME "${LIBRARY_PREFFIX}_core${DEBUG_SUFFIX}") | |
5 | SET(SOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/") |
|
5 | SET(SOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/") | |
|
6 | SET(INCLUDES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include/") | |||
|
7 | ||||
|
8 | # Include core directory | |||
|
9 | include_directories("${INCLUDES_DIR}") | |||
6 |
|
10 | |||
7 | # Set a variable to display a warning in the version files. |
|
11 | # Set a variable to display a warning in the version files. | |
8 | SET(SCIQLOP_CMAKE_GENERATION_WARNING "DON'T CHANGE THIS FILE. AUTOGENERATED BY CMAKE.") |
|
12 | SET(SCIQLOP_CMAKE_GENERATION_WARNING "DON'T CHANGE THIS FILE. AUTOGENERATED BY CMAKE.") | |
9 | # Generate the version file from the cmake version variables. The version |
|
13 | # Generate the version file from the cmake version variables. The version | |
10 | # variables are defined in the cmake/sciqlop_version.cmake file. |
|
14 | # variables are defined in the cmake/sciqlop_version.cmake file. | |
11 | CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/resources/Version.h.in" |
|
15 | CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/resources/Version.h.in" | |
12 |
|
|
16 | "${INCLUDES_DIR}/Version.h") | |
13 | CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/resources/Version.cpp.in" |
|
17 | CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/resources/Version.cpp.in" | |
14 | "${SOURCES_DIR}/Version.cpp") |
|
18 | "${SOURCES_DIR}/Version.cpp") | |
15 |
|
19 | |||
@@ -22,14 +26,15 SCIQLOP_FIND_QT(Core) | |||||
22 | # Compile the library library |
|
26 | # Compile the library library | |
23 | # |
|
27 | # | |
24 | FILE (GLOB_RECURSE MODULE_SOURCES |
|
28 | FILE (GLOB_RECURSE MODULE_SOURCES | |
25 | ${SOURCES_DIR}/*.c |
|
29 | ${INCLUDES_DIR}/*.h | |
26 |
|
|
30 | ${SOURCES_DIR}/*.c | |
|
31 | ${SOURCES_DIR}/*.cpp | |||
27 | ${SOURCES_DIR}/*.h) |
|
32 | ${SOURCES_DIR}/*.h) | |
28 |
|
33 | |||
29 | ADD_LIBRARY(${SQPCORE_LIBRARY_NAME} ${MODULE_SOURCES}) |
|
34 | ADD_LIBRARY(${SQPCORE_LIBRARY_NAME} ${MODULE_SOURCES}) | |
30 | set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD 14) |
|
35 | set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD 14) | |
31 | set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) |
|
36 | set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) | |
32 |
TARGET_LINK_LIBRARIES(${SQPCORE_LIBRARY_NAME} |
|
37 | TARGET_LINK_LIBRARIES(${SQPCORE_LIBRARY_NAME}) | |
33 | qt5_use_modules(${SQPCORE_LIBRARY_NAME} Core) |
|
38 | qt5_use_modules(${SQPCORE_LIBRARY_NAME} Core) | |
34 |
|
39 | |||
35 | # From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html |
|
40 | # From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html | |
@@ -62,7 +67,7 IF(BUILD_TESTS) | |||||
62 | INCLUDE_DIRECTORIES(${SOURCES_DIR}) |
|
67 | INCLUDE_DIRECTORIES(${SOURCES_DIR}) | |
63 | FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp) |
|
68 | FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp) | |
64 | FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h) |
|
69 | FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h) | |
65 |
SET( TEST_LIBRARIES ${SQPCORE_LIBRARY_NAME} |
|
70 | SET( TEST_LIBRARIES ${SQPCORE_LIBRARY_NAME}) | |
66 |
|
71 | |||
67 | FOREACH( testFile ${TESTS_SOURCES} ) |
|
72 | FOREACH( testFile ${TESTS_SOURCES} ) | |
68 | GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY ) |
|
73 | GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY ) |
1 | NO CONTENT: file renamed from sqpcore/resources/Version.cpp.in to core/resources/Version.cpp.in |
|
NO CONTENT: file renamed from sqpcore/resources/Version.cpp.in to core/resources/Version.cpp.in |
1 | NO CONTENT: file renamed from sqpcore/resources/Version.h.in to core/resources/Version.h.in |
|
NO CONTENT: file renamed from sqpcore/resources/Version.h.in to core/resources/Version.h.in |
@@ -1,30 +1,40 | |||||
1 |
|
1 | |||
2 |
## |
|
2 | ## gui - CMakeLists.txt | |
3 | STRING(TOLOWER ${CMAKE_PROJECT_NAME} LIBRARY_PREFFIX) |
|
3 | STRING(TOLOWER ${CMAKE_PROJECT_NAME} LIBRARY_PREFFIX) | |
4 |
SET(SQPGUI_LIBRARY_NAME "${LIBRARY_PREFFIX}_ |
|
4 | SET(SQPGUI_LIBRARY_NAME "${LIBRARY_PREFFIX}_gui${DEBUG_SUFFIX}") | |
5 | SET(SOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src") |
|
5 | SET(SOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src") | |
6 |
SET(INCLUDE |
|
6 | SET(INCLUDES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include") | |
7 | SET(UI_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/ui) |
|
7 | SET(UI_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/ui") | |
8 | SET(RES_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/resources) |
|
8 | SET(RES_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/resources") | |
|
9 | ||||
|
10 | # Include gui directory | |||
|
11 | include_directories("${INCLUDES_DIR}") | |||
|
12 | include_directories("${CMAKE_CURRENT_BINARY_DIR}") | |||
9 |
|
13 | |||
10 | # Set a variable to display a warning in the version files. |
|
14 | # Set a variable to display a warning in the version files. | |
11 | SET(SCIQLOP_CMAKE_GENERATION_WARNING "DON'T CHANGE THIS FILE. AUTOGENERATED BY CMAKE.") |
|
15 | SET(SCIQLOP_CMAKE_GENERATION_WARNING "DON'T CHANGE THIS FILE. AUTOGENERATED BY CMAKE.") | |
12 |
|
16 | |||
13 | # |
|
17 | # | |
14 | # Find Qt modules |
|
18 | # Find Qt modules | |
15 | # |
|
19 | # | |
16 | SCIQLOP_FIND_QT(Core Widgets) |
|
20 | SCIQLOP_FIND_QT(Core Widgets) | |
17 |
|
21 | |||
18 | # |
|
22 | # | |
19 | # Compile the library library |
|
23 | # Find dependent libraries | |
20 | # |
|
24 | # ======================== | |
21 | FILE (GLOB_RECURSE MODULE_SOURCES |
|
25 | find_package(sciqlop-core) | |
22 | ${SOURCES_DIR}/*.c |
|
26 | ||
23 | ${SOURCES_DIR}/*.cpp |
|
27 | message("Librairies inclues dans APP: ${SCIQLOP-CORE_LIBRARIES}") | |
24 | ${SOURCES_DIR}/*.h) |
|
28 | SET(LIBRARIES ${SCIQLOP-CORE_LIBRARIES}) | |
|
29 | ||||
|
30 | INCLUDE_DIRECTORIES(${SCIQLOP-CORE_INCLUDE_DIR}) | |||
|
31 | ||||
|
32 | # Add sqpcore to the list of libraries to use | |||
|
33 | list(APPEND LIBRARIES ${SQPCORE_LIBRARY_NAME}) | |||
|
34 | ||||
|
35 | # Add dependent shared libraries | |||
|
36 | list(APPEND SHARED_LIBRARIES ${SQPCORE_SHARED_LIBRARIES}) | |||
25 |
|
37 | |||
26 | # Headers files (.h) |
|
|||
27 | FILE (GLOB_RECURSE PROJECT_HEADERS ${INCLUDE_FOLDER}/*.h) |
|
|||
28 |
|
38 | |||
29 | # Ui files |
|
39 | # Ui files | |
30 | FILE (GLOB_RECURSE PROJECT_FORMS ${UI_FOLDER}/*.ui) |
|
40 | FILE (GLOB_RECURSE PROJECT_FORMS ${UI_FOLDER}/*.ui) | |
@@ -32,6 +42,16 FILE (GLOB_RECURSE PROJECT_FORMS ${UI_FOLDER}/*.ui) | |||||
32 | # Resources files |
|
42 | # Resources files | |
33 | FILE (GLOB_RECURSE PROJECT_RESOURCES ${RES_FOLDER}/*.qrc) |
|
43 | FILE (GLOB_RECURSE PROJECT_RESOURCES ${RES_FOLDER}/*.qrc) | |
34 |
|
44 | |||
|
45 | # | |||
|
46 | # Compile the library library | |||
|
47 | # | |||
|
48 | FILE (GLOB_RECURSE MODULE_SOURCES | |||
|
49 | ${INCLUDES_DIR}/*.h | |||
|
50 | ${SOURCES_DIR}/*.c | |||
|
51 | ${SOURCES_DIR}/*.cpp | |||
|
52 | ${SOURCES_DIR}/*.h | |||
|
53 | ${PROJECT_FORMS}) | |||
|
54 | ||||
35 | QT5_ADD_RESOURCES(RCC_HDRS |
|
55 | QT5_ADD_RESOURCES(RCC_HDRS | |
36 | ${PROJECT_RESOURCES} |
|
56 | ${PROJECT_RESOURCES} | |
37 | ) |
|
57 | ) | |
@@ -40,15 +60,14 QT5_WRAP_UI(UIS_HDRS | |||||
40 | ${PROJECT_FORMS} |
|
60 | ${PROJECT_FORMS} | |
41 | ) |
|
61 | ) | |
42 |
|
62 | |||
43 | include_directories("${CMAKE_CURRENT_BINARY_DIR}") |
|
|||
44 | message(CURRENT INCLUDE : ${CMAKE_CURRENT_BINARY_DIR}) |
|
|||
45 |
|
63 | |||
46 | ADD_LIBRARY(${SQPGUI_LIBRARY_NAME} ${MODULE_SOURCES} ${UIS_HDRS}) |
|
64 | ADD_LIBRARY(${SQPGUI_LIBRARY_NAME} ${MODULE_SOURCES} ${UIS_HDRS} ${RCC_HDRS}) | |
47 | set_property(TARGET ${SQPGUI_LIBRARY_NAME} PROPERTY CXX_STANDARD 14) |
|
65 | set_property(TARGET ${SQPGUI_LIBRARY_NAME} PROPERTY CXX_STANDARD 14) | |
48 | set_property(TARGET ${SQPGUI_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) |
|
66 | set_property(TARGET ${SQPGUI_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) | |
49 | TARGET_LINK_LIBRARIES(${SQPGUI_LIBRARY_NAME} ${EXTERN_LIBRARIES}) |
|
67 | ||
|
68 | TARGET_LINK_LIBRARIES(${SQPGUI_LIBRARY_NAME} ${LIBRARIES}) | |||
50 | qt5_use_modules(${SQPGUI_LIBRARY_NAME} Core Widgets) |
|
69 | qt5_use_modules(${SQPGUI_LIBRARY_NAME} Core Widgets) | |
51 |
|
70 | |||
52 | # From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html |
|
71 | # From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html | |
53 | # Entries in the COMPILE_DEFINITIONS are prefixed with -D or /D and added to the compile line in an unspecified order. |
|
72 | # Entries in the COMPILE_DEFINITIONS are prefixed with -D or /D and added to the compile line in an unspecified order. | |
54 | # The DEFINE_SYMBOL target property is also added as a compile definition as a special convenience case for SHARED and MODULE library targets |
|
73 | # The DEFINE_SYMBOL target property is also added as a compile definition as a special convenience case for SHARED and MODULE library targets | |
@@ -63,8 +82,8 ENDIF() | |||||
63 | SCIQLOP_SET_TO_PARENT_SCOPE(SQPGUI_LIBRARY_NAME) |
|
82 | SCIQLOP_SET_TO_PARENT_SCOPE(SQPGUI_LIBRARY_NAME) | |
64 |
|
83 | |||
65 | # Copy extern shared libraries to the lib folder |
|
84 | # Copy extern shared libraries to the lib folder | |
66 |
SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPGUI_LIBRARY_NAME} |
|
85 | SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPGUI_LIBRARY_NAME}) | |
67 |
|
86 | |||
68 | # Add the files to the list of files to be analyzed |
|
87 | # Add the files to the list of files to be analyzed | |
69 | LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES}) |
|
88 | LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES}) | |
70 | SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES) |
|
89 | SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES) | |
@@ -76,49 +95,49 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES) | |||||
76 | # Compile the tests |
|
95 | # Compile the tests | |
77 | # |
|
96 | # | |
78 | IF(BUILD_TESTS) |
|
97 | IF(BUILD_TESTS) | |
79 |
|
|
98 | INCLUDE_DIRECTORIES(${SOURCES_DIR}) | |
80 |
|
|
99 | FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp) | |
81 |
|
|
100 | FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h) | |
82 |
SET( TEST_LIBRARIES ${SQPGUI_LIBRARY_NAME} |
|
101 | SET( TEST_LIBRARIES ${SQPGUI_LIBRARY_NAME}) | |
83 |
|
102 | |||
84 |
|
|
103 | FOREACH( testFile ${TESTS_SOURCES} ) | |
85 |
|
|
104 | GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY ) | |
86 |
|
|
105 | GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE ) | |
87 |
|
106 | |||
88 |
|
|
107 | # Add to the list of sources files all the sources in the same | |
89 |
|
|
108 | # directory that aren't another test | |
90 |
|
|
109 | FILE (GLOB currentTestSources | |
91 | ${testDirectory}/*.c |
|
110 | ${testDirectory}/*.c | |
92 |
|
|
111 | ${testDirectory}/*.cpp | |
93 |
|
|
112 | ${testDirectory}/*.h) | |
94 |
|
|
113 | LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES}) | |
95 |
|
|
114 | LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS}) | |
96 |
|
115 | |||
97 |
|
|
116 | ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources}) | |
98 |
|
|
117 | TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES} ) | |
99 |
|
|
118 | qt5_use_modules(${testName} Test) | |
100 |
|
119 | |||
101 |
|
|
120 | ADD_TEST( NAME ${testName} COMMAND ${testName} ) | |
102 |
|
121 | |||
103 | SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${EXTERN_SHARED_LIBRARIES}) |
|
122 | SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${EXTERN_SHARED_LIBRARIES}) | |
104 |
|
|
123 | ENDFOREACH( testFile ) | |
105 |
|
124 | |||
106 |
|
|
125 | LIST(APPEND testFilesToFormat ${TESTS_SOURCES}) | |
107 |
|
|
126 | LIST(APPEND testFilesToFormat ${TESTS_HEADERS}) | |
108 |
|
|
127 | LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat}) | |
109 | SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES) |
|
128 | SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES) | |
110 | ENDIF(BUILD_TESTS) |
|
129 | ENDIF(BUILD_TESTS) | |
111 |
|
130 | |||
112 | # |
|
131 | # | |
113 | # Set the files that must be formatted by clang-format. |
|
132 | # Set the files that must be formatted by clang-format. | |
114 | # |
|
133 | # | |
115 | LIST (APPEND FORMATTING_INPUT_FILES ${MODULE_SOURCES}) |
|
134 | LIST (APPEND FORMATTING_INPUT_FILES ${MODULE_SOURCES}) | |
116 | SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES) |
|
135 | SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES) | |
117 |
|
136 | |||
118 |
# |
|
137 | # | |
119 |
# Set the directories that doxygen must browse to generate the |
|
138 | # Set the directories that doxygen must browse to generate the | |
120 | # documentation. |
|
139 | # documentation. | |
121 |
# |
|
140 | # | |
122 | # Source directories: |
|
141 | # Source directories: | |
123 | LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs") |
|
142 | LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs") | |
124 | LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src") |
|
143 | LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src") | |
@@ -127,11 +146,11 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS) | |||||
127 | #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*") |
|
146 | #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*") | |
128 | SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS) |
|
147 | SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS) | |
129 |
|
148 | |||
130 |
# |
|
149 | # | |
131 |
# Set the directories with the sources to analyze and propagate the |
|
150 | # Set the directories with the sources to analyze and propagate the | |
132 | # modification to the parent scope |
|
151 | # modification to the parent scope | |
133 |
# |
|
152 | # | |
134 |
# Source directories to analyze: |
|
153 | # Source directories to analyze: | |
135 | LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src") |
|
154 | LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src") | |
136 | LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests") |
|
155 | LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests") | |
137 | SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS) |
|
156 | SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS) |
General Comments 0
You need to be logged in to leave comments.
Login now