##// 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 }
@@ -1,144 +1,147
1 1
2 2 ## sciqlop - CMakeLists.txt
3 3 SET(EXECUTABLE_NAME "sciqlop")
4 4 SET(SOURCES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/)
5 5 SET(INCLUDE_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/include)
6 6 SET(UI_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/src)
7 7 SET(RES_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/resources)
8 8
9 9 #
10 10 # Find Qt modules
11 11 #
12 12 SCIQLOP_FIND_QT(Core Widgets)
13 13
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})
29 33
30 34 # Retrieve the location of the dynamic library to copy it to the output path
31 35 #get_property(sqpcoreLocation TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY LOCATION)
32 36 list(APPEND SHARED_LIBRARIES_FROM_TARGETS ${sqpcoreLocation})
33 37
34 38 #
35 39 # Compile the application
36 40 #
37 41 FILE (GLOB_RECURSE APPLICATION_SOURCES
38 42 ${SOURCES_DIR}/*.c
39 43 ${SOURCES_DIR}/*.cpp
40 44 ${SOURCES_DIR}/*.h)
41 45
42 46 # Headers files (.h)
43 47 FILE (GLOB_RECURSE PROJECT_HEADERS ${INCLUDE_FOLDER}/*.h)
44 48
45 49 # Ui files
46 50 FILE (GLOB_RECURSE PROJECT_FORMS ${UI_FOLDER}/*.ui)
47 51
48 52 # Resources files
49 53 FILE (GLOB_RECURSE PROJECT_RESOURCES ${RES_FOLDER}/*.qrc)
50 54
51 55 # Retrieve resources files
52 56 FILE (GLOB_RECURSE APPLICATION_RESOURCES ${RES_FOLDER}/*.qrc)
53 57
54 58 QT5_ADD_RESOURCES(RCC_HDRS ${APPLICATION_RESOURCES} )
55 59
56 60 QT5_WRAP_UI(UIS_HDRS
57 61 ${PROJECT_FORMS}
58 62 )
59 63
60 64
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
68 71 # Link with Qt5 modules
69 72 qt5_use_modules(${EXECUTABLE_NAME} Core Widgets)
70 73
71 74
72 75 # Add the files to the list of files to be analyzed
73 76 LIST(APPEND CHECKSTYLE_INPUT_FILES ${APPLICATION_SOURCES})
74 77 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES)
75 78 # Vera++ exclusion files
76 79 #LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/path/to/exclusionFiles.tcl)
77 80 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES)
78 81
79 82 #
80 83 # Compile the tests
81 84 #
82 85 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 )
90 93 GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE )
91 94
92 95 # Add to the list of sources files all the sources in the same
93 96 # directory that aren't another test
94 97 FILE (GLOB currentTestSources
95 98 ${testDirectory}/*.c
96 99 ${testDirectory}/*.cpp
97 100 ${testDirectory}/*.h)
98 101 LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES})
99 102 LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS})
100 103
101 104 ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources})
102 105 TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES} )
103 106 qt5_use_modules(${testName} Test)
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})
111 114 LIST(APPEND testFilesToFormat ${TESTS_HEADERS})
112 115 LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat})
113 116 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
114 117 ENDIF(BUILD_TESTS)
115 118
116 119 #
117 120 # Set the files that must be formatted by clang-format.
118 121 #
119 122 LIST (APPEND FORMATTING_INPUT_FILES ${APPLICATION_SOURCES})
120 123 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
121 124
122 125 #
123 126 # Set the directories that doxygen must browse to generate the
124 127 # documentation.
125 128 #
126 129 # Source directories:
127 130 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs")
128 131 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
129 132 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS)
130 133 # Source directories to exclude from the documentation generation
131 134 #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*")
132 135 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS)
133 136
134 137 #
135 138 # Set the directories with the sources to analyze and propagate the
136 139 # modification to the parent scope
137 140 #
138 141 # Source directories to analyze:
139 142 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
140 143 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests")
141 144 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS)
142 145 # Source directories to exclude from the analysis
143 146 #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir")
144 147 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS)
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
@@ -1,39 +1,39
1 1 /*------------------------------------------------------------------------------
2 2 -- This file is a part of the QLop Software
3 3 -- Copyright (C) 2015, Plasma Physics Laboratory - CNRS
4 4 --
5 5 -- This program is free software; you can redistribute it and/or modify
6 6 -- it under the terms of the GNU General Public License as published by
7 7 -- the Free Software Foundation; either version 2 of the License, or
8 8 -- (at your option) any later version.
9 9 --
10 10 -- This program is distributed in the hope that it will be useful,
11 11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 13 -- GNU General Public License for more details.
14 14 --
15 15 -- You should have received a copy of the GNU General Public License
16 16 -- along with this program; if not, write to the Free Software
17 17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 18 -------------------------------------------------------------------------------*/
19 19 /*-- Author : Alexis Jeandet
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
38 38 return a.exec();
39 39 }
@@ -1,104 +1,104
1 1 /*------------------------------------------------------------------------------
2 2 -- This file is a part of the QLop Software
3 3 -- Copyright (C) 2015, Plasma Physics Laboratory - CNRS
4 4 --
5 5 -- This program is free software; you can redistribute it and/or modify
6 6 -- it under the terms of the GNU General Public License as published by
7 7 -- the Free Software Foundation; either version 2 of the License, or
8 8 -- (at your option) any later version.
9 9 --
10 10 -- This program is distributed in the hope that it will be useful,
11 11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 13 -- GNU General Public License for more details.
14 14 --
15 15 -- You should have received a copy of the GNU General Public License
16 16 -- along with this program; if not, write to the Free Software
17 17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 18 -------------------------------------------------------------------------------*/
19 19 /*-- Author : Alexis Jeandet
20 20 -- Mail : alexis.jeandet@member.fsf.org
21 21 ----------------------------------------------------------------------------*/
22 22 #include "mainwindow.h"
23 23 #include "ui_mainwindow.h"
24 24 #include <QAction>
25 25 #include <QDate>
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>
33 33 //#include <qlopgui.h>
34 34 //#include <spacedata.h>
35 35 //#include "qlopcore.h"
36 36 //#include "qlopcodecmanager.h"
37 37 //#include "cdfcodec.h"
38 38 //#include "amdatxtcodec.h"
39 39 //#include <qlopplotmanager.h>
40 40
41 41
42 42 MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow)
43 43 {
44 44 ui->setupUi(this);
45 45 /* QLopGUI::registerMenuBar(menuBar());
46 46 this->setWindowIcon(QIcon(":/sciqlopLOGO.svg"));
47 47 this->m_progressWidget = new QWidget();
48 48 this->m_progressLayout = new QVBoxLayout(this->m_progressWidget);
49 49 this->m_progressWidget->setLayout(this->m_progressLayout);
50 50 this->m_progressWidget->setWindowModality(Qt::WindowModal);
51 51 m_progressThreadIds = (int*) malloc(OMP_THREADS*sizeof(int));
52 52 for(int i=0;i<OMP_THREADS;i++)
53 53 {
54 54 this->m_progress.append(new QProgressBar(this->m_progressWidget));
55 55 this->m_progress.last()->setMinimum(0);
56 56 this->m_progress.last()->setMaximum(100);
57 57 this->m_progressLayout->addWidget(this->m_progress.last());
58 58 this->m_progressWidget->hide();
59 59 this->m_progressThreadIds[i] = -1;
60 60 }
61 61 this->m_progressWidget->setWindowTitle("Loading File");
62 62 const QList<QLopService*>ServicesToLoad=QList<QLopService*>()
63 63 << QLopCore::self()
64 64 << QLopPlotManager::self()
65 65 << QLopCodecManager::self()
66 66 << FileDownloader::self()
67 67 << QLopDataBase::self()
68 68 << SpaceData::self();
69 69
70 70 CDFCodec::registerToManager();
71 71 AMDATXTCodec::registerToManager();
72 72
73 73
74 74 for(int i=0;i<ServicesToLoad.count();i++)
75 75 {
76 76 qDebug()<<ServicesToLoad.at(i)->serviceName();
77 77 ServicesToLoad.at(i)->initialize(); //must be called before getGUI
78 78 QDockWidget* wdgt=ServicesToLoad.at(i)->getGUI();
79 79 if(wdgt)
80 80 {
81 81 wdgt->setAllowedAreas(Qt::AllDockWidgetAreas);
82 82 this->addDockWidget(Qt::TopDockWidgetArea,wdgt);
83 83 }
84 84 PythonQt::self()->getMainModule().addObject(ServicesToLoad.at(i)->serviceName(),(QObject*)ServicesToLoad.at(i));
85 85 }*/
86 86 }
87 87
88 88 MainWindow::~MainWindow()
89 89 {
90 90 delete ui;
91 91 }
92 92
93 93
94 94 void MainWindow::changeEvent(QEvent *e)
95 95 {
96 96 QMainWindow::changeEvent(e);
97 97 switch (e->type()) {
98 98 case QEvent::LanguageChange:
99 99 ui->retranslateUi(this);
100 100 break;
101 101 default:
102 102 break;
103 103 }
104 104 }
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
@@ -1,31 +1,37
1 1 #
2 2 # Sciqlop_modules.cmake
3 3 #
4 4 # Set ouptut directories
5 5 #
6 6 SET (EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dist/${CMAKE_BUILD_TYPE})
7 7 SET (LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dist/${CMAKE_BUILD_TYPE})
8 8
9 9
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
19 25 #
20 26 INCLUDE ("cmake/sciqlop_formatting.cmake")
21 27
22 28 #
23 29 # Documentation generation
24 30 #
25 31 INCLUDE ("cmake/sciqlop_doxygen.cmake")
26 32
27 33 #
28 34 # Source code analysis
29 35 #
30 36 INCLUDE ("cmake/sciqlop_code_analysis.cmake")
31 37 INCLUDE ("cmake/sciqlop_code_cppcheck.cmake")
@@ -1,90 +1,90
1 1 #
2 2 # sciqlop_params : Define compilation parameters
3 3 #
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?
22 22 #
23 23 OPTION (BUILD_TESTS "Build the tests" OFF)
24 24 ENABLE_TESTING(${BUILD_TESTS})
25 25
26 26 #
27 27 # Path to the folder for sciqlop's extern libraries.
28 28 #
29 29 # When looking for an external library in sciqlop, we look to the following
30 30 # folders:
31 31 # - The specific folder for the library (generally of the form <LIBRARY>_ROOT_DIR
32 32 # - The global Sciqlop extern folder
33 33 # - The system folders.
34 34 #
35 35 # If a dependency is found in the global extern folder or a specific folder for
36 36 # the library, then it is installed with the sciqlop libraries. If it is found
37 37 # in the system folders, it is not. This behavior can be overriden with the
38 38 # <LIBRARY>_COPY_SHARED_LIBRARIES flag.
39 39 #
40 40 set(SCIQLOP_EXTERN_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/extern"
41 41 CACHE PATH "Path to the folder for sciqlop's extern libraries")
42 42 option(SCIQLOP_FORCE_UPDATE_EXT_ROOT_DIR "Force the <LIBRARY>_ROOT_DIR to be updated to the global sciqlop extern folder"
43 43 OFF)
44 44
45 45 if (SCIQLOP_FORCE_UPDATE_EXT_ROOT_DIR)
46 46 set(libRootDirForceValue FORCE)
47 47 else()
48 48 set(libRootDirForceValue)
49 49 endif()
50 50
51 51
52 52
53 53 #
54 54 # Static or shared libraries
55 55 #
56 56 OPTION (BUILD_SHARED_LIBS "Build the shared libraries" ON)
57 57
58 58 # Generate position independant code (-fPIC)
59 59 SET(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
60 60
61 61 #
62 62 # Configure installation directories
63 63 #
64 64 IF (UNIX)
65 65 SET(defaultBin "bin")
66 66 SET(defaultInc "include/sciqlop")
67 67
68 68 # 32 or 64 bits compiler
69 69 IF( CMAKE_SIZEOF_VOID_P EQUAL 8 )
70 70 SET(defaultLib "lib64/sciqlop")
71 71 ELSE()
72 72 SET(defaultLib "lib/sciqlop")
73 73 ENDIF()
74 74
75 75 SET(defaultDoc "share/docs/sciqlop")
76 76 ELSE()
77 77 SET(defaultBin "bin")
78 78 SET(defaultInc "include/sciqlop")
79 79 SET(defaultLib "lib/sciqlop")
80 80 SET(defaultDoc "docs/sciqlop")
81 81 ENDIF()
82 82
83 83 SET(INSTALL_BINARY_DIR "${defaultBin}" CACHE STRING
84 84 "Installation directory for binaries")
85 85 SET(INSTALL_LIBRARY_DIR "${defaultLib}" CACHE STRING
86 86 "Installation directory for libraries")
87 87 SET(INSTALL_INCLUDE_DIR "${defaultInc}" CACHE STRING
88 88 "Installation directory for headers")
89 89 SET(INSTALL_DOCUMENTATION_DIR "${defaultDoc}" CACHE STRING
90 90 "Installation directory for documentations")
@@ -1,123 +1,128
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
16 20 #
17 21 # Find Qt modules
18 22 #
19 23 SCIQLOP_FIND_QT(Core)
20 24
21 25 #
22 26 # Compile the library library
23 27 #
24 28 FILE (GLOB_RECURSE MODULE_SOURCES
25 ${SOURCES_DIR}/*.c
26 ${SOURCES_DIR}/*.cpp
29 ${INCLUDES_DIR}/*.h
30 ${SOURCES_DIR}/*.c
31 ${SOURCES_DIR}/*.cpp
27 32 ${SOURCES_DIR}/*.h)
28 33
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
36 41 # Entries in the COMPILE_DEFINITIONS are prefixed with -D or /D and added to the compile line in an unspecified order.
37 42 # The DEFINE_SYMBOL target property is also added as a compile definition as a special convenience case for SHARED and MODULE library targets
38 43 IF(BUILD_SHARED_LIBS)
39 44 SET_TARGET_PROPERTIES(${SQPCORE_LIBRARY_NAME} PROPERTIES COMPILE_DEFINITIONS "SCIQLOP_EXPORT")
40 45 ELSE()
41 46 TARGET_COMPILE_DEFINITIONS(${SQPCORE_LIBRARY_NAME} PUBLIC "SCIQLOP_STATIC_LIBRARIES")
42 47 ENDIF()
43 48
44 49 # Set the variable to parent scope so that the other projects can copy the
45 50 # dependent shared libraries
46 51 SCIQLOP_SET_TO_PARENT_SCOPE(SQPCORE_LIBRARY_NAME)
47 52
48 53 # Copy extern shared libraries to the lib folder
49 54 SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPCORE_LIBRARY_NAME} ${EXTERN_SHARED_LIBRARIES})
50 55
51 56 # Add the files to the list of files to be analyzed
52 57 LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES})
53 58 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES)
54 59 # Vera++ exclusion files
55 60 #LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/path/to/exclusionFiles.tcl)
56 61 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES)
57 62
58 63 #
59 64 # Compile the tests
60 65 #
61 66 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 )
69 74 GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE )
70 75
71 76 # Add to the list of sources files all the sources in the same
72 77 # directory that aren't another test
73 78 FILE (GLOB currentTestSources
74 79 ${testDirectory}/*.c
75 80 ${testDirectory}/*.cpp
76 81 ${testDirectory}/*.h)
77 82 LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES})
78 83 LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS})
79 84
80 85 ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources})
81 86 TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES} )
82 87 qt5_use_modules(${testName} Test)
83 88
84 89 ADD_TEST( NAME ${testName} COMMAND ${testName} )
85 90
86 91 SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${EXTERN_SHARED_LIBRARIES})
87 92 ENDFOREACH( testFile )
88 93
89 94 LIST(APPEND testFilesToFormat ${TESTS_SOURCES})
90 95 LIST(APPEND testFilesToFormat ${TESTS_HEADERS})
91 96 LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat})
92 97 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
93 98 ENDIF(BUILD_TESTS)
94 99
95 100 #
96 101 # Set the files that must be formatted by clang-format.
97 102 #
98 103 LIST (APPEND FORMATTING_INPUT_FILES ${MODULE_SOURCES})
99 104 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
100 105
101 106 #
102 107 # Set the directories that doxygen must browse to generate the
103 108 # documentation.
104 109 #
105 110 # Source directories:
106 111 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs")
107 112 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
108 113 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS)
109 114 # Source directories to exclude from the documentation generation
110 115 #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*")
111 116 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS)
112 117
113 118 #
114 119 # Set the directories with the sources to analyze and propagate the
115 120 # modification to the parent scope
116 121 #
117 122 # Source directories to analyze:
118 123 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
119 124 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests")
120 125 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS)
121 126 # Source directories to exclude from the analysis
122 127 #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir")
123 128 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS)
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,140 +1,159
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.")
12
16
13 17 #
14 18 # Find Qt modules
15 19 #
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)
31 41
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 )
38 58
39 59 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
53 72 # Entries in the COMPILE_DEFINITIONS are prefixed with -D or /D and added to the compile line in an unspecified order.
54 73 # The DEFINE_SYMBOL target property is also added as a compile definition as a special convenience case for SHARED and MODULE library targets
55 74 IF(BUILD_SHARED_LIBS)
56 75 SET_TARGET_PROPERTIES(${SQPGUI_LIBRARY_NAME} PROPERTIES COMPILE_DEFINITIONS "SCIQLOP_EXPORT")
57 76 ELSE()
58 77 TARGET_COMPILE_DEFINITIONS(${SQPGUI_LIBRARY_NAME} PUBLIC "SCIQLOP_STATIC_LIBRARIES")
59 78 ENDIF()
60 79
61 80 # Set the variable to parent scope so that the other projects can copy the
62 81 # dependent shared libraries
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})
67
85 SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPGUI_LIBRARY_NAME})
86
68 87 # Add the files to the list of files to be analyzed
69 88 LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES})
70 89 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES)
71 90 # Vera++ exclusion files
72 91 #LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/path/to/exclusionFiles.tcl)
73 92 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES)
74 93
75 94 #
76 95 # Compile the tests
77 96 #
78 97 IF(BUILD_TESTS)
79 INCLUDE_DIRECTORIES(${SOURCES_DIR})
80 FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp)
81 FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h)
82 SET( TEST_LIBRARIES ${SQPGUI_LIBRARY_NAME} ${EXTERN_LIBRARIES})
83
84 FOREACH( testFile ${TESTS_SOURCES} )
85 GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY )
86 GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE )
87
88 # Add to the list of sources files all the sources in the same
89 # directory that aren't another test
90 FILE (GLOB currentTestSources
91 ${testDirectory}/*.c
92 ${testDirectory}/*.cpp
93 ${testDirectory}/*.h)
94 LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES})
95 LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS})
96
97 ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources})
98 TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES} )
99 qt5_use_modules(${testName} Test)
100
101 ADD_TEST( NAME ${testName} COMMAND ${testName} )
98 INCLUDE_DIRECTORIES(${SOURCES_DIR})
99 FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp)
100 FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h)
101 SET( TEST_LIBRARIES ${SQPGUI_LIBRARY_NAME})
102
103 FOREACH( testFile ${TESTS_SOURCES} )
104 GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY )
105 GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE )
106
107 # Add to the list of sources files all the sources in the same
108 # directory that aren't another test
109 FILE (GLOB currentTestSources
110 ${testDirectory}/*.c
111 ${testDirectory}/*.cpp
112 ${testDirectory}/*.h)
113 LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES})
114 LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS})
115
116 ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources})
117 TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES} )
118 qt5_use_modules(${testName} Test)
119
120 ADD_TEST( NAME ${testName} COMMAND ${testName} )
102 121
103 122 SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${EXTERN_SHARED_LIBRARIES})
104 ENDFOREACH( testFile )
123 ENDFOREACH( testFile )
105 124
106 LIST(APPEND testFilesToFormat ${TESTS_SOURCES})
107 LIST(APPEND testFilesToFormat ${TESTS_HEADERS})
108 LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat})
125 LIST(APPEND testFilesToFormat ${TESTS_SOURCES})
126 LIST(APPEND testFilesToFormat ${TESTS_HEADERS})
127 LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat})
109 128 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
110 129 ENDIF(BUILD_TESTS)
111
130
112 131 #
113 132 # Set the files that must be formatted by clang-format.
114 133 #
115 134 LIST (APPEND FORMATTING_INPUT_FILES ${MODULE_SOURCES})
116 135 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
117 136
118 #
119 # Set the directories that doxygen must browse to generate the
137 #
138 # Set the directories that doxygen must browse to generate the
120 139 # documentation.
121 #
140 #
122 141 # Source directories:
123 142 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs")
124 143 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
125 144 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS)
126 145 # Source directories to exclude from the documentation generation
127 146 #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*")
128 147 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS)
129 148
130 #
131 # Set the directories with the sources to analyze and propagate the
149 #
150 # Set the directories with the sources to analyze and propagate the
132 151 # modification to the parent scope
133 #
134 # Source directories to analyze:
152 #
153 # Source directories to analyze:
135 154 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
136 155 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests")
137 156 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS)
138 157 # Source directories to exclude from the analysis
139 158 #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir")
140 159 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS)
General Comments 0
You need to be logged in to leave comments. Login now