]>
Commit | Line | Data |
---|---|---|
68c4a3b3 | 1 | ## |
190fc91a | 2 | ## This file is part of the PulseView project. |
68c4a3b3 JH |
3 | ## |
4 | ## Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk> | |
3933e8a9 | 5 | ## Copyright (C) 2012-2013 Alexandru Gagniuc <mr.nuke.me@gmail.com> |
68c4a3b3 JH |
6 | ## |
7 | ## This program is free software: you can redistribute it and/or modify | |
8 | ## it under the terms of the GNU General Public License as published by | |
9 | ## the Free Software Foundation, either version 2 of the License, or | |
10 | ## (at your option) any later version. | |
11 | ## | |
12 | ## This program is distributed in the hope that it will be useful, | |
13 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | ## GNU General Public License for more details. | |
16 | ## | |
17 | ## You should have received a copy of the GNU General Public License | |
18 | ## along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 | ## | |
20 | ||
7ba41e7e | 21 | cmake_minimum_required(VERSION 2.8.6) |
0cf9fb24 | 22 | |
df944399 | 23 | include(FindPkgConfig) |
52bbe600 | 24 | include(GNUInstallDirs) |
df944399 | 25 | |
0cf9fb24 JH |
26 | set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake") |
27 | include(cotire) | |
28 | ||
a8d3fb2d | 29 | project(pulseview) |
df944399 | 30 | |
30588653 | 31 | #=============================================================================== |
506523c1 JH |
32 | #= User Options |
33 | #------------------------------------------------------------------------------- | |
34 | ||
5f606159 | 35 | option(DISABLE_WERROR "Build without -Werror" FALSE) |
140181a4 | 36 | option(ENABLE_SIGNALS "Build with UNIX signals" TRUE) |
506523c1 | 37 | option(ENABLE_TESTS "Enable unit tests" FALSE) |
7d297a01 | 38 | option(STATIC_PKGDEPS_LIBS "Statically link to (pkgconfig) libraries" FALSE) |
b04e278d AG |
39 | |
40 | if(WIN32) | |
7d297a01 UH |
41 | # On Windows/MinGW we need to statically link to libraries. |
42 | # This option is user configurable, but enable it by default on win32. | |
b04e278d | 43 | set(STATIC_PKGDEPS_LIBS TRUE) |
6987ceeb UH |
44 | |
45 | # For boost-thread we need two additional settings on win32: | |
46 | set(Boost_USE_STATIC_LIBS on) | |
47 | add_definitions(-DBOOST_THREAD_USE_LIB) | |
140181a4 JH |
48 | |
49 | # Windsws does not support UNIX signals | |
50 | set(ENABLE_SIGNALS FALSE) | |
b04e278d | 51 | endif() |
506523c1 JH |
52 | |
53 | #=============================================================================== | |
30588653 AG |
54 | #= Dependencies |
55 | #------------------------------------------------------------------------------- | |
56 | ||
d52d8455 | 57 | list(APPEND PKGDEPS |
0dfbf7ff | 58 | libsigrok>=0.2.0 |
0de8fb27 | 59 | libsigrokdecode>=0.2.0 |
df944399 JH |
60 | ) |
61 | ||
d52d8455 JH |
62 | find_package(PkgConfig) |
63 | pkg_check_modules(PKGDEPS REQUIRED ${PKGDEPS}) | |
64 | ||
71df4fb7 | 65 | FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake4 qmake-qt4 qmake-mac) |
2e2946fe JH |
66 | find_package(Qt4 REQUIRED) |
67 | ||
3933e8a9 AG |
68 | # Find the platform's thread library (needed for boost-thread). |
69 | # This will set ${CMAKE_THREAD_LIBS_INIT} to the correct, OS-specific value. | |
70 | find_package(Threads) | |
71 | ||
c800a80b UH |
72 | if(WIN32) |
73 | # On Windows/MinGW the we need to use 'thread_win32' instead of 'thread'. | |
74 | # The library is named libboost_thread_win32* (not libboost_thread*). | |
080af0bd | 75 | find_package(Boost 1.42 COMPONENTS system thread_win32 REQUIRED) |
ff4e6332 | 76 | else() |
080af0bd | 77 | find_package(Boost 1.42 COMPONENTS system thread REQUIRED) |
c800a80b | 78 | endif() |
df944399 | 79 | |
075fb499 AG |
80 | #=============================================================================== |
81 | #= Config Header | |
82 | #------------------------------------------------------------------------------- | |
83 | ||
f7951df4 | 84 | set(PV_TITLE PulseView) |
d4384c6d | 85 | set(PV_DESCRIPTION "A GUI for sigrok") |
f7951df4 | 86 | |
075fb499 AG |
87 | set(PV_VERSION_MAJOR 0) |
88 | set(PV_VERSION_MINOR 1) | |
89 | set(PV_VERSION_MICRO 0) | |
90 | set(PV_VERSION_STRING | |
91 | ${PV_VERSION_MAJOR}.${PV_VERSION_MINOR}.${PV_VERSION_MICRO} | |
92 | ) | |
93 | ||
94 | configure_file ( | |
95 | ${PROJECT_SOURCE_DIR}/config.h.in | |
96 | ${PROJECT_BINARY_DIR}/config.h | |
97 | ) | |
df944399 | 98 | |
30588653 AG |
99 | #=============================================================================== |
100 | #= Sources | |
101 | #------------------------------------------------------------------------------- | |
102 | ||
a8d3fb2d | 103 | set(pulseview_SOURCES |
df944399 | 104 | main.cpp |
107ca6d3 | 105 | pv/devicemanager.cpp |
51e77110 | 106 | pv/mainwindow.cpp |
51e77110 | 107 | pv/sigsession.cpp |
1b1ec774 JH |
108 | pv/data/analog.cpp |
109 | pv/data/analogsnapshot.cpp | |
110 | pv/data/logic.cpp | |
111 | pv/data/logicsnapshot.cpp | |
112 | pv/data/signaldata.cpp | |
113 | pv/data/snapshot.cpp | |
acda14b8 | 114 | pv/dialogs/about.cpp |
9663c82b | 115 | pv/dialogs/connect.cpp |
c8c28626 | 116 | pv/dialogs/decoder.cpp |
d755562a | 117 | pv/dialogs/deviceoptions.cpp |
de1d99bb | 118 | pv/prop/bool.cpp |
b912c99c | 119 | pv/prop/double.cpp |
820c3dea | 120 | pv/prop/enum.cpp |
a2b92157 | 121 | pv/prop/int.cpp |
c8df6005 JH |
122 | pv/prop/property.cpp |
123 | pv/prop/binding/binding.cpp | |
3820592a | 124 | pv/prop/binding/deviceoptions.cpp |
404aad0e | 125 | pv/toolbars/contextbar.cpp |
f4c92e1c | 126 | pv/toolbars/samplingbar.cpp |
aba1dd16 | 127 | pv/view/analogsignal.cpp |
cabce982 | 128 | pv/view/cursor.cpp |
b42d25c4 | 129 | pv/view/cursorpair.cpp |
55d3603d | 130 | pv/view/decodesignal.cpp |
1d8dca91 | 131 | pv/view/header.cpp |
c23b29d6 | 132 | pv/view/marginwidget.cpp |
8d634081 | 133 | pv/view/logicsignal.cpp |
ccdd3ef5 | 134 | pv/view/ruler.cpp |
f1283456 | 135 | pv/view/selectableitem.cpp |
8d634081 | 136 | pv/view/signal.cpp |
cd6c8ee2 | 137 | pv/view/timemarker.cpp |
931f20b0 | 138 | pv/view/trace.cpp |
cdf7bea7 JH |
139 | pv/view/view.cpp |
140 | pv/view/viewport.cpp | |
df944399 JH |
141 | ) |
142 | ||
23b02a82 | 143 | # This list includes only QObject derrived class headers |
a8d3fb2d | 144 | set(pulseview_HEADERS |
51e77110 | 145 | pv/mainwindow.h |
51e77110 | 146 | pv/sigsession.h |
acda14b8 | 147 | pv/dialogs/about.h |
9663c82b | 148 | pv/dialogs/connect.h |
ed773982 | 149 | pv/dialogs/deviceoptions.h |
404aad0e | 150 | pv/toolbars/contextbar.h |
f4c92e1c | 151 | pv/toolbars/samplingbar.h |
3efda736 | 152 | pv/view/cursor.h |
1d8dca91 | 153 | pv/view/header.h |
b08d7222 | 154 | pv/view/logicsignal.h |
c23b29d6 | 155 | pv/view/marginwidget.h |
ccdd3ef5 | 156 | pv/view/ruler.h |
2a2512b2 JH |
157 | pv/view/selectableitem.h |
158 | pv/view/signal.h | |
3efda736 | 159 | pv/view/timemarker.h |
931f20b0 | 160 | pv/view/trace.h |
cdf7bea7 JH |
161 | pv/view/view.h |
162 | pv/view/viewport.h | |
df944399 JH |
163 | ) |
164 | ||
a8d3fb2d | 165 | set(pulseview_FORMS |
acda14b8 | 166 | pv/dialogs/about.ui |
df944399 JH |
167 | ) |
168 | ||
a8d3fb2d JH |
169 | set(pulseview_RESOURCES |
170 | pulseview.qrc | |
df944399 JH |
171 | ) |
172 | ||
140181a4 JH |
173 | if(ENABLE_SIGNALS) |
174 | list(APPEND pulseview_SOURCES signalhandler.cpp) | |
175 | list(APPEND pulseview_HEADERS signalhandler.h) | |
176 | endif() | |
177 | ||
a8d3fb2d JH |
178 | qt4_wrap_cpp(pulseview_HEADERS_MOC ${pulseview_HEADERS}) |
179 | qt4_wrap_ui(pulseview_FORMS_HEADERS ${pulseview_FORMS}) | |
180 | qt4_add_resources(pulseview_RESOURCES_RCC ${pulseview_RESOURCES}) | |
df944399 JH |
181 | |
182 | include(${QT_USE_FILE}) | |
183 | ||
30588653 AG |
184 | #=============================================================================== |
185 | #= Global Definitions | |
186 | #------------------------------------------------------------------------------- | |
187 | ||
df944399 | 188 | add_definitions(${QT_DEFINITIONS}) |
a9974171 | 189 | add_definitions(-Wall -Wextra) |
5f606159 JH |
190 | |
191 | if(NOT DISABLE_WERROR) | |
192 | add_definitions(-Werror) | |
193 | endif() | |
df944399 | 194 | |
30588653 AG |
195 | #=============================================================================== |
196 | #= Global Include Directories | |
197 | #------------------------------------------------------------------------------- | |
198 | ||
b04e278d AG |
199 | include_directories( |
200 | ${CMAKE_CURRENT_BINARY_DIR} | |
cef18fc6 | 201 | ${CMAKE_CURRENT_SOURCE_DIR} |
b04e278d AG |
202 | ${Boost_INCLUDE_DIRS} |
203 | ) | |
204 | ||
205 | if(STATIC_PKGDEPS_LIBS) | |
206 | include_directories(${PKGDEPS_STATIC_INCLUDE_DIRS}) | |
207 | else() | |
208 | include_directories(${PKGDEPS_INCLUDE_DIRS}) | |
209 | endif() | |
df944399 | 210 | |
30588653 AG |
211 | #=============================================================================== |
212 | #= Linker Configuration | |
213 | #------------------------------------------------------------------------------- | |
214 | ||
b04e278d AG |
215 | link_directories(${Boost_LIBRARY_DIRS}) |
216 | ||
217 | set(PULSEVIEW_LINK_LIBS | |
218 | ${Boost_LIBRARIES} | |
3933e8a9 | 219 | ${CMAKE_THREAD_LIBS_INIT} |
b04e278d AG |
220 | ${QT_LIBRARIES} |
221 | ) | |
222 | ||
223 | if(STATIC_PKGDEPS_LIBS) | |
224 | link_directories(${PKGDEPS_STATIC_LIBRARY_DIRS}) | |
225 | list(APPEND PULSEVIEW_LINK_LIBS ${PKGDEPS_STATIC_LIBRARIES}) | |
226 | else() | |
227 | link_directories(${PKGDEPS_LIBRARY_DIRS}) | |
228 | list(APPEND PULSEVIEW_LINK_LIBS ${PKGDEPS_LIBRARIES}) | |
229 | endif() | |
df944399 | 230 | |
5a13850b | 231 | add_executable(${PROJECT_NAME} |
a8d3fb2d JH |
232 | ${pulseview_SOURCES} |
233 | ${pulseview_HEADERS_MOC} | |
234 | ${pulseview_FORMS_HEADERS} | |
235 | ${pulseview_RESOURCES_RCC} | |
df944399 JH |
236 | ) |
237 | ||
5a13850b | 238 | target_link_libraries(${PROJECT_NAME} ${PULSEVIEW_LINK_LIBS}) |
0cf9fb24 | 239 | cotire(${PROJECT_NAME}) |
f0fa92c6 | 240 | |
b0d8c0dc UH |
241 | if(WIN32) |
242 | # Pass -mwindows so that no "DOS box" will open when PulseView is started. | |
243 | set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-mwindows") | |
244 | endif() | |
245 | ||
30588653 AG |
246 | #=============================================================================== |
247 | #= Installation | |
248 | #------------------------------------------------------------------------------- | |
249 | ||
52bbe600 | 250 | # Install the executable. |
cd6606c2 AG |
251 | install(TARGETS ${PROJECT_NAME} DESTINATION bin/) |
252 | ||
52bbe600 UH |
253 | # Install the manpage. |
254 | install(FILES doc/pulseview.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT doc) | |
255 | ||
cd6606c2 AG |
256 | #=============================================================================== |
257 | #= Packaging (handled by CPack) | |
258 | #------------------------------------------------------------------------------- | |
259 | ||
b02a8cbf JH |
260 | set(CPACK_PACKAGE_VERSION_MAJOR ${PV_VERSION_MAJOR}) |
261 | set(CPACK_PACKAGE_VERSION_MINOR ${PV_VERSION_MINOR}) | |
262 | set(CPACK_PACKAGE_VERSION_PATCH ${PV_VERSION_MICRO}) | |
cd6606c2 AG |
263 | set(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_CURRENT_SOURCE_DIR}/README) |
264 | set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/COPYING) | |
265 | set(CPACK_SOURCE_IGNORE_FILES ${CMAKE_CURRENT_BINARY_DIR} ".gitignore" ".git") | |
4b413894 JH |
266 | set(CPACK_SOURCE_PACKAGE_FILE_NAME |
267 | "${CMAKE_PROJECT_NAME}-${PV_VERSION_MAJOR}.${PV_VERSION_MINOR}.${PV_VERSION_MICRO}") | |
1d2fb87d | 268 | set(CPACK_SOURCE_GENERATOR "TGZ") |
cd6606c2 AG |
269 | |
270 | include(CPack) | |
bc1c1462 | 271 | |
30588653 AG |
272 | #=============================================================================== |
273 | #= Tests | |
274 | #------------------------------------------------------------------------------- | |
275 | ||
77e8ac52 | 276 | if(ENABLE_TESTS) |
fb746bcc | 277 | add_subdirectory(test) |
951c583c | 278 | enable_testing() |
fb746bcc | 279 | add_test(test ${CMAKE_CURRENT_BINARY_DIR}/test/pulseview-test) |
77e8ac52 | 280 | endif(ENABLE_TESTS) |