##// END OF EJS Templates
Merge pull request 131 from SCIQLOP-Initialisation feature/InitDataSourceController...
perrinel -
r23:73015bd6234f merge
parent child
Show More
@@ -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 15 # Find dependent libraries
16 16 # ========================
17 SET(LIBRARIES)
18 SET(EXTERN_LIBRARIES)
17 find_package(sciqlop-gui)
18
19 message("Librairies inclues dans APP: ${SCIQLOP-GUI_LIBRARIES}")
20 SET(LIBRARIES ${SCIQLOP-GUI_LIBRARIES})
19 21 SET(EXTERN_SHARED_LIBRARIES)
20 22
23 INCLUDE_DIRECTORIES(${SCIQLOP-GUI_INCLUDE_DIR})
24
21 25 # Add sqpcore to the list of libraries to use
22 26 list(APPEND LIBRARIES ${SQPCORE_LIBRARY_NAME})
23 27
24 # Include sqpcore directory
25 include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../sqpcore/src")
28 # Include core directory
29 include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../core/include")
26 30
27 31 # Add dependent shared libraries
28 32 list(APPEND SHARED_LIBRARIES ${SQPCORE_SHARED_LIBRARIES})
@@ -61,7 +65,6 QT5_WRAP_UI(UIS_HDRS
61 65 ADD_EXECUTABLE(${EXECUTABLE_NAME} ${APPLICATION_SOURCES} ${RCC_HDRS} ${UIS_HDRS})
62 66 set_property(TARGET ${EXECUTABLE_NAME} PROPERTY CXX_STANDARD 14)
63 67 set_property(TARGET ${EXECUTABLE_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
64
65 68 target_link_libraries(${EXECUTABLE_NAME}
66 69 ${LIBRARIES})
67 70
@@ -83,7 +86,7 IF(BUILD_TESTS)
83 86 INCLUDE_DIRECTORIES(${SOURCES_DIR})
84 87 FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp)
85 88 FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h)
86 SET( TEST_LIBRARIES ${LIBRARIES} ${EXTERN_LIBRARIES})
89 SET( TEST_LIBRARIES ${LIBRARIES})
87 90
88 91 FOREACH( testFile ${TESTS_SOURCES} )
89 92 GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY )
@@ -104,7 +107,7 IF(BUILD_TESTS)
104 107
105 108 ADD_TEST( NAME ${testName} COMMAND ${testName} )
106 109
107 SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${EXTERN_SHARED_LIBRARIES})
110 SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName})
108 111 ENDFOREACH( testFile )
109 112
110 113 LIST(APPEND testFilesToFormat ${TESTS_SOURCES})
1 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
@@ -20,18 +20,18
20 20 -- Mail : alexis.jeandet@member.fsf.org
21 21 ----------------------------------------------------------------------------*/
22 22 #include "mainwindow.h"
23 #include <QApplication>
24 23 #include <QProcessEnvironment>
25 24 #include <QThread>
26 //#include <omp.h>
25 #include <SqpApplication.h>
26 #include <omp.h>
27 27 #include <qglobal.h>
28 28
29 29 int main(int argc, char *argv[])
30 30 {
31 QApplication a(argc, argv);
32 QApplication::setOrganizationName("LPP");
33 QApplication::setOrganizationDomain("lpp.fr");
34 QApplication::setApplicationName("SciQLop");
31 SqpApplication a(argc, argv);
32 SqpApplication::setOrganizationName("LPP");
33 SqpApplication::setOrganizationDomain("lpp.fr");
34 SqpApplication::setApplicationName("SciQLop");
35 35 MainWindow w;
36 36 w.show();
37 37
@@ -26,7 +26,7
26 26 #include <QDateTime>
27 27 #include <QDir>
28 28 #include <QFileDialog>
29 //#include <omp.h>
29 #include <omp.h>
30 30 //#include <network/filedownloader.h>
31 31 //#include <qlopdatabase.h>
32 32 //#include <qlopsettings.h>
1 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
@@ -10,9 +10,15 SET (LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dist/${CMAKE_BUILD_TYPE})
10 10 #
11 11 # Compile the diffents modules
12 12 #
13 ADD_SUBDIRECTORY("${CMAKE_SOURCE_DIR}/sqpcore")
14 #ADD_SUBDIRECTORY("${CMAKE_SOURCE_DIR}/sqpgui")
15 ADD_SUBDIRECTORY("${CMAKE_SOURCE_DIR}/sqpapp")
13 set(sciqlop-core_DIR "${CMAKE_SOURCE_DIR}/core/cmake")
14 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${sciqlop-core_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 24 # Code formatting
@@ -4,18 +4,18
4 4 # Debug or release
5 5 #
6 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")
10 MESSAGE (STATUS "Build in Debug")
11 SET (CMAKE_BUILD_TYPE "Debug")
12 SET (DEBUG_SUFFIX "d")
13 ELSE()
14 MESSAGE (STATUS "Build in Release")
15 SET (CMAKE_BUILD_TYPE "Release")
16 SET (SCIQLOP_BUILD_TYPE "Release")
17 SET (DEBUG_SUFFIX "")
18 ENDIF()
9 #IF(SCIQLOP_BUILD_TYPE MATCHES "Debug")
10 # MESSAGE (STATUS "Build in Debug")
11 # SET (CMAKE_BUILD_TYPE "Debug")
12 # SET (DEBUG_SUFFIX "d")
13 #ELSE()
14 # MESSAGE (STATUS "Build in Release")
15 # SET (CMAKE_BUILD_TYPE "Release")
16 # SET (SCIQLOP_BUILD_TYPE "Release")
17 # SET (DEBUG_SUFFIX "")
18 #ENDIF()
19 19
20 20 #
21 21 # Need to compile tests?
@@ -1,15 +1,19
1 1
2 ## sqpcore - CMakeLists.txt
2 ## core - CMakeLists.txt
3 3 STRING(TOLOWER ${CMAKE_PROJECT_NAME} LIBRARY_PREFFIX)
4 SET(SQPCORE_LIBRARY_NAME "${LIBRARY_PREFFIX}_sqpcore${DEBUG_SUFFIX}")
4 SET(SQPCORE_LIBRARY_NAME "${LIBRARY_PREFFIX}_core${DEBUG_SUFFIX}")
5 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 11 # Set a variable to display a warning in the version files.
8 12 SET(SCIQLOP_CMAKE_GENERATION_WARNING "DON'T CHANGE THIS FILE. AUTOGENERATED BY CMAKE.")
9 13 # Generate the version file from the cmake version variables. The version
10 14 # variables are defined in the cmake/sciqlop_version.cmake file.
11 15 CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/resources/Version.h.in"
12 "${SOURCES_DIR}/Version.h")
16 "${INCLUDES_DIR}/Version.h")
13 17 CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/resources/Version.cpp.in"
14 18 "${SOURCES_DIR}/Version.cpp")
15 19
@@ -22,6 +26,7 SCIQLOP_FIND_QT(Core)
22 26 # Compile the library library
23 27 #
24 28 FILE (GLOB_RECURSE MODULE_SOURCES
29 ${INCLUDES_DIR}/*.h
25 30 ${SOURCES_DIR}/*.c
26 31 ${SOURCES_DIR}/*.cpp
27 32 ${SOURCES_DIR}/*.h)
@@ -29,7 +34,7 FILE (GLOB_RECURSE MODULE_SOURCES
29 34 ADD_LIBRARY(${SQPCORE_LIBRARY_NAME} ${MODULE_SOURCES})
30 35 set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD 14)
31 36 set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
32 TARGET_LINK_LIBRARIES(${SQPCORE_LIBRARY_NAME} ${EXTERN_LIBRARIES})
37 TARGET_LINK_LIBRARIES(${SQPCORE_LIBRARY_NAME})
33 38 qt5_use_modules(${SQPCORE_LIBRARY_NAME} Core)
34 39
35 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 67 INCLUDE_DIRECTORIES(${SOURCES_DIR})
63 68 FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp)
64 69 FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h)
65 SET( TEST_LIBRARIES ${SQPCORE_LIBRARY_NAME} ${EXTERN_LIBRARIES})
70 SET( TEST_LIBRARIES ${SQPCORE_LIBRARY_NAME})
66 71
67 72 FOREACH( testFile ${TESTS_SOURCES} )
68 73 GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY )
1 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
@@ -1,11 +1,15
1 1
2 ## sqpgui - CMakeLists.txt
2 ## gui - CMakeLists.txt
3 3 STRING(TOLOWER ${CMAKE_PROJECT_NAME} LIBRARY_PREFFIX)
4 SET(SQPGUI_LIBRARY_NAME "${LIBRARY_PREFFIX}_sqpgui${DEBUG_SUFFIX}")
4 SET(SQPGUI_LIBRARY_NAME "${LIBRARY_PREFFIX}_gui${DEBUG_SUFFIX}")
5 5 SET(SOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src")
6 SET(INCLUDE_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/include)
7 SET(UI_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/ui)
8 SET(RES_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/resources)
6 SET(INCLUDES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
7 SET(UI_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/ui")
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 14 # Set a variable to display a warning in the version files.
11 15 SET(SCIQLOP_CMAKE_GENERATION_WARNING "DON'T CHANGE THIS FILE. AUTOGENERATED BY CMAKE.")
@@ -16,15 +20,21 SET(SCIQLOP_CMAKE_GENERATION_WARNING "DON'T CHANGE THIS FILE. AUTOGENERATED BY C
16 20 SCIQLOP_FIND_QT(Core Widgets)
17 21
18 22 #
19 # Compile the library library
20 #
21 FILE (GLOB_RECURSE MODULE_SOURCES
22 ${SOURCES_DIR}/*.c
23 ${SOURCES_DIR}/*.cpp
24 ${SOURCES_DIR}/*.h)
23 # Find dependent libraries
24 # ========================
25 find_package(sciqlop-core)
26
27 message("Librairies inclues dans APP: ${SCIQLOP-CORE_LIBRARIES}")
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 39 # Ui files
30 40 FILE (GLOB_RECURSE PROJECT_FORMS ${UI_FOLDER}/*.ui)
@@ -32,6 +42,16 FILE (GLOB_RECURSE PROJECT_FORMS ${UI_FOLDER}/*.ui)
32 42 # Resources files
33 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 55 QT5_ADD_RESOURCES(RCC_HDRS
36 56 ${PROJECT_RESOURCES}
37 57 )
@@ -40,13 +60,12 QT5_WRAP_UI(UIS_HDRS
40 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 65 set_property(TARGET ${SQPGUI_LIBRARY_NAME} PROPERTY CXX_STANDARD 14)
48 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 69 qt5_use_modules(${SQPGUI_LIBRARY_NAME} Core Widgets)
51 70
52 71 # From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html
@@ -63,7 +82,7 ENDIF()
63 82 SCIQLOP_SET_TO_PARENT_SCOPE(SQPGUI_LIBRARY_NAME)
64 83
65 84 # Copy extern shared libraries to the lib folder
66 SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPGUI_LIBRARY_NAME} ${EXTERN_SHARED_LIBRARIES})
85 SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPGUI_LIBRARY_NAME})
67 86
68 87 # Add the files to the list of files to be analyzed
69 88 LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES})
@@ -79,7 +98,7 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} ${EXTERN_LIBRARIES})
101 SET( TEST_LIBRARIES ${SQPGUI_LIBRARY_NAME})
83 102
84 103 FOREACH( testFile ${TESTS_SOURCES} )
85 104 GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY )
General Comments 0
You need to be logged in to leave comments. Login now