Mercurial > hg > orthanc-stone
annotate Resources/CMake/QtConfiguration.cmake @ 1199:922d2e61aa5d
RadiograpyScene: can now remove any layer + new key wrappers for Delete/Backspace
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Thu, 28 Nov 2019 18:28:15 +0100 |
parents | b60d70e8b55c |
children | 4f99c7905f8d 2d8ab34c8c91 |
rev | line source |
---|---|
276
5de5699ad570
first display in QCairoWidget; no mouse interaction yet
am@osimis.io
parents:
274
diff
changeset
|
1 # Stone of Orthanc |
5de5699ad570
first display in QCairoWidget; no mouse interaction yet
am@osimis.io
parents:
274
diff
changeset
|
2 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
5de5699ad570
first display in QCairoWidget; no mouse interaction yet
am@osimis.io
parents:
274
diff
changeset
|
3 # Department, University Hospital of Liege, Belgium |
439 | 4 # Copyright (C) 2017-2019 Osimis S.A., Belgium |
276
5de5699ad570
first display in QCairoWidget; no mouse interaction yet
am@osimis.io
parents:
274
diff
changeset
|
5 # |
5de5699ad570
first display in QCairoWidget; no mouse interaction yet
am@osimis.io
parents:
274
diff
changeset
|
6 # This program is free software: you can redistribute it and/or |
5de5699ad570
first display in QCairoWidget; no mouse interaction yet
am@osimis.io
parents:
274
diff
changeset
|
7 # modify it under the terms of the GNU Affero General Public License |
5de5699ad570
first display in QCairoWidget; no mouse interaction yet
am@osimis.io
parents:
274
diff
changeset
|
8 # as published by the Free Software Foundation, either version 3 of |
5de5699ad570
first display in QCairoWidget; no mouse interaction yet
am@osimis.io
parents:
274
diff
changeset
|
9 # the License, or (at your option) any later version. |
5de5699ad570
first display in QCairoWidget; no mouse interaction yet
am@osimis.io
parents:
274
diff
changeset
|
10 # |
5de5699ad570
first display in QCairoWidget; no mouse interaction yet
am@osimis.io
parents:
274
diff
changeset
|
11 # This program is distributed in the hope that it will be useful, but |
5de5699ad570
first display in QCairoWidget; no mouse interaction yet
am@osimis.io
parents:
274
diff
changeset
|
12 # WITHOUT ANY WARRANTY; without even the implied warranty of |
5de5699ad570
first display in QCairoWidget; no mouse interaction yet
am@osimis.io
parents:
274
diff
changeset
|
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
5de5699ad570
first display in QCairoWidget; no mouse interaction yet
am@osimis.io
parents:
274
diff
changeset
|
14 # Affero General Public License for more details. |
5de5699ad570
first display in QCairoWidget; no mouse interaction yet
am@osimis.io
parents:
274
diff
changeset
|
15 # |
5de5699ad570
first display in QCairoWidget; no mouse interaction yet
am@osimis.io
parents:
274
diff
changeset
|
16 # You should have received a copy of the GNU Affero General Public License |
5de5699ad570
first display in QCairoWidget; no mouse interaction yet
am@osimis.io
parents:
274
diff
changeset
|
17 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
5de5699ad570
first display in QCairoWidget; no mouse interaction yet
am@osimis.io
parents:
274
diff
changeset
|
18 |
5de5699ad570
first display in QCairoWidget; no mouse interaction yet
am@osimis.io
parents:
274
diff
changeset
|
19 |
365
ef31240a73f6
no automatic call to moc and uic, CircleMeasureTracker using Orthanc fonts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
320
diff
changeset
|
20 set(CMAKE_AUTOMOC OFF) |
ef31240a73f6
no automatic call to moc and uic, CircleMeasureTracker using Orthanc fonts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
320
diff
changeset
|
21 set(CMAKE_AUTOUIC OFF) |
276
5de5699ad570
first display in QCairoWidget; no mouse interaction yet
am@osimis.io
parents:
274
diff
changeset
|
22 |
1040 | 23 if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase") |
24 # Linux Standard Base version 5 ships Qt 4.2.3 | |
25 include(Qt4Macros) | |
320
10d188d6e5cc
compatibility with Qt4
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
292
diff
changeset
|
26 |
1041
95939fa925f6
LinuxStandardBaseUic.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1040
diff
changeset
|
27 # The script "LinuxStandardBaseUic.py" is just a wrapper around the |
95939fa925f6
LinuxStandardBaseUic.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1040
diff
changeset
|
28 # "uic" compiler from LSB that does not support the "<?xml ...?>" |
95939fa925f6
LinuxStandardBaseUic.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1040
diff
changeset
|
29 # header that is automatically added by Qt Creator |
95939fa925f6
LinuxStandardBaseUic.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1040
diff
changeset
|
30 set(QT_UIC_EXECUTABLE ${CMAKE_CURRENT_LIST_DIR}/LinuxStandardBaseUic.py) |
95939fa925f6
LinuxStandardBaseUic.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1040
diff
changeset
|
31 |
1040 | 32 set(QT_MOC_EXECUTABLE ${LSB_PATH}/bin/moc) |
33 | |
34 include_directories( | |
35 ${LSB_PATH}/include/QtCore | |
36 ${LSB_PATH}/include/QtGui | |
37 ${LSB_PATH}/include/QtOpenGL | |
320
10d188d6e5cc
compatibility with Qt4
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
292
diff
changeset
|
38 ) |
365
ef31240a73f6
no automatic call to moc and uic, CircleMeasureTracker using Orthanc fonts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
320
diff
changeset
|
39 |
1044
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
40 link_libraries(QtCore QtGui QtOpenGL) |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
41 |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
42 |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
43 ## |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
44 ## This part is adapted from file "Qt4Macros.cmake" shipped with |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
45 ## CMake 3.5.1, released under the following license: |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
46 ## |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
47 ##============================================================================= |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
48 ## Copyright 2005-2009 Kitware, Inc. |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
49 ## |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
50 ## Distributed under the OSI-approved BSD License (the "License"); |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
51 ## see accompanying file Copyright.txt for details. |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
52 ## |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
53 ## This software is distributed WITHOUT ANY WARRANTY; without even the |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
54 ## implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
55 ## See the License for more information. |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
56 ##============================================================================= |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
57 ## |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
58 macro (ORTHANC_QT_WRAP_UI outfiles) |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
59 QT4_EXTRACT_OPTIONS(ui_files ui_options ui_target ${ARGN}) |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
60 foreach (it ${ui_files}) |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
61 get_filename_component(outfile ${it} NAME_WE) |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
62 get_filename_component(infile ${it} ABSOLUTE) |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
63 set(outfile ${CMAKE_CURRENT_BINARY_DIR}/ui_${outfile}.h) |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
64 add_custom_command(OUTPUT ${outfile} |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
65 COMMAND ${QT_UIC_EXECUTABLE} |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
66 ARGS ${ui_options} -o ${outfile} ${infile} |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
67 MAIN_DEPENDENCY ${infile} VERBATIM) |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
68 set(${outfiles} ${${outfiles}} ${outfile}) |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
69 endforeach () |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
70 endmacro () |
365
ef31240a73f6
no automatic call to moc and uic, CircleMeasureTracker using Orthanc fonts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
320
diff
changeset
|
71 |
1044
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
72 macro (ORTHANC_QT_WRAP_CPP outfiles ) |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
73 QT4_GET_MOC_FLAGS(moc_flags) |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
74 QT4_EXTRACT_OPTIONS(moc_files moc_options moc_target ${ARGN}) |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
75 foreach (it ${moc_files}) |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
76 get_filename_component(outfile ${it} NAME_WE) |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
77 get_filename_component(infile ${it} ABSOLUTE) |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
78 set(outfile ${CMAKE_CURRENT_BINARY_DIR}/moc_${outfile}.cxx) |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
79 add_custom_command(OUTPUT ${outfile} |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
80 COMMAND ${QT_MOC_EXECUTABLE} |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
81 ARGS ${infile} "${moc_flags}" -o ${outfile} |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
82 MAIN_DEPENDENCY ${infile} VERBATIM) |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
83 set(${outfiles} ${${outfiles}} ${outfile}) |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
84 endforeach () |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
85 endmacro () |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
86 ## |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
87 ## End of "Qt4Macros.cmake" adaptation. |
b60d70e8b55c
compatibility macros for LSB and Qt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
88 ## |
1040 | 89 |
90 else() | |
91 # Not using Linux Standard Base | |
92 # Find the QtWidgets library | |
93 find_package(Qt5Widgets QUIET) | |
94 | |
95 if (Qt5Widgets_FOUND) | |
96 message("Qt5 has been detected") | |
97 find_package(Qt5Core REQUIRED) | |
98 link_libraries( | |
99 Qt5::Widgets | |
100 Qt5::Core | |
101 ) | |
102 | |
103 if (ENABLE_OPENGL) | |
104 find_package(Qt5OpenGL REQUIRED) | |
105 link_libraries( | |
106 Qt5::OpenGL | |
107 ) | |
108 endif() | |
109 | |
110 # Create aliases for the CMake commands | |
111 macro(ORTHANC_QT_WRAP_UI) | |
112 QT5_WRAP_UI(${ARGN}) | |
113 endmacro() | |
114 | |
115 macro(ORTHANC_QT_WRAP_CPP) | |
116 QT5_WRAP_CPP(${ARGN}) | |
117 endmacro() | |
118 | |
119 else() | |
120 message("Qt5 has not been found, trying with Qt4") | |
121 find_package(Qt4 REQUIRED QtGui) | |
122 link_libraries( | |
123 Qt4::QtGui | |
124 ) | |
125 | |
126 if (ENABLE_OPENGL) | |
127 find_package(Qt4 REQUIRED QtOpenGL) | |
128 link_libraries( | |
129 Qt4::QtOpenGL | |
130 ) | |
131 endif() | |
132 | |
133 # Create aliases for the CMake commands | |
134 macro(ORTHANC_QT_WRAP_UI) | |
135 QT4_WRAP_UI(${ARGN}) | |
136 endmacro() | |
137 | |
138 macro(ORTHANC_QT_WRAP_CPP) | |
139 QT4_WRAP_CPP(${ARGN}) | |
140 endmacro() | |
141 endif() | |
320
10d188d6e5cc
compatibility with Qt4
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
292
diff
changeset
|
142 endif() |
276
5de5699ad570
first display in QCairoWidget; no mouse interaction yet
am@osimis.io
parents:
274
diff
changeset
|
143 |
1028 | 144 |
145 if (ENABLE_STONE_DEPRECATED) | |
146 list(APPEND QT_SOURCES | |
1040 | 147 ${ORTHANC_STONE_ROOT}/Applications/Qt/QCairoWidget.cpp |
148 ${ORTHANC_STONE_ROOT}/Applications/Qt/QStoneMainWindow.cpp | |
1028 | 149 ${ORTHANC_STONE_ROOT}/Applications/Qt/QtStoneApplicationRunner.cpp |
150 ) | |
151 | |
152 ORTHANC_QT_WRAP_CPP(QT_SOURCES | |
1040 | 153 ${ORTHANC_STONE_ROOT}/Applications/Qt/QCairoWidget.h |
1028 | 154 ${ORTHANC_STONE_ROOT}/Applications/Qt/QStoneMainWindow.h |
155 ) | |
156 endif() | |
157 | |
365
ef31240a73f6
no automatic call to moc and uic, CircleMeasureTracker using Orthanc fonts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
320
diff
changeset
|
158 |
ef31240a73f6
no automatic call to moc and uic, CircleMeasureTracker using Orthanc fonts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
320
diff
changeset
|
159 # NB: Including CMAKE_CURRENT_BINARY_DIR is mandatory, as the CMake |
ef31240a73f6
no automatic call to moc and uic, CircleMeasureTracker using Orthanc fonts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
320
diff
changeset
|
160 # macros for Qt will put their result in that directory, which cannot |
ef31240a73f6
no automatic call to moc and uic, CircleMeasureTracker using Orthanc fonts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
320
diff
changeset
|
161 # be changed. |
ef31240a73f6
no automatic call to moc and uic, CircleMeasureTracker using Orthanc fonts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
320
diff
changeset
|
162 # https://stackoverflow.com/a/4016784/881731 |
276
5de5699ad570
first display in QCairoWidget; no mouse interaction yet
am@osimis.io
parents:
274
diff
changeset
|
163 |
365
ef31240a73f6
no automatic call to moc and uic, CircleMeasureTracker using Orthanc fonts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
320
diff
changeset
|
164 include_directories( |
ef31240a73f6
no automatic call to moc and uic, CircleMeasureTracker using Orthanc fonts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
320
diff
changeset
|
165 ${ORTHANC_STONE_ROOT}/Applications/Qt/ |
ef31240a73f6
no automatic call to moc and uic, CircleMeasureTracker using Orthanc fonts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
320
diff
changeset
|
166 ${CMAKE_CURRENT_BINARY_DIR} |
ef31240a73f6
no automatic call to moc and uic, CircleMeasureTracker using Orthanc fonts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
320
diff
changeset
|
167 ) |
ef31240a73f6
no automatic call to moc and uic, CircleMeasureTracker using Orthanc fonts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
320
diff
changeset
|
168 |