]>
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> | |
30588653 | 5 | ## Copyright (C) 2012 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 | ||
df944399 JH |
21 | cmake_minimum_required(VERSION 2.6) |
22 | include(FindPkgConfig) | |
23 | ||
a8d3fb2d | 24 | project(pulseview) |
df944399 | 25 | |
30588653 | 26 | #=============================================================================== |
506523c1 JH |
27 | #= User Options |
28 | #------------------------------------------------------------------------------- | |
29 | ||
30 | option(ENABLE_TESTS "Enable unit tests" FALSE) | |
b04e278d AG |
31 | option(STATIC_PKGDEPS_LIBS "Statically link to sigrok libraries" FALSE) |
32 | ||
33 | if(WIN32) | |
34 | # On Windows/MinGW we need to statically link to libraries | |
35 | # This option is user configurable, but enable it by default on win32 | |
36 | set(STATIC_PKGDEPS_LIBS TRUE) | |
37 | endif() | |
506523c1 JH |
38 | |
39 | #=============================================================================== | |
30588653 AG |
40 | #= Dependencies |
41 | #------------------------------------------------------------------------------- | |
42 | ||
df944399 JH |
43 | find_package(PkgConfig) |
44 | pkg_check_modules(PKGDEPS REQUIRED | |
45 | libsigrokdecode>=0.1.0 | |
0dfbf7ff | 46 | libsigrok>=0.2.0 |
df944399 JH |
47 | ) |
48 | ||
4cd24a75 UH |
49 | # On Windows/MinGW we explicitly point cmake to the Boost directory. |
50 | if(WIN32) | |
951c583c | 51 | set(BOOST_ROOT /usr/local) |
4cd24a75 UH |
52 | endif(WIN32) |
53 | ||
df944399 | 54 | find_package(Qt4 REQUIRED) |
f0fa92c6 | 55 | find_package(Boost 1.46 COMPONENTS unit_test_framework REQUIRED) |
df944399 | 56 | |
075fb499 AG |
57 | #=============================================================================== |
58 | #= Config Header | |
59 | #------------------------------------------------------------------------------- | |
60 | ||
f7951df4 | 61 | set(PV_TITLE PulseView) |
d4384c6d | 62 | set(PV_DESCRIPTION "A GUI for sigrok") |
f7951df4 | 63 | |
075fb499 AG |
64 | set(PV_VERSION_MAJOR 0) |
65 | set(PV_VERSION_MINOR 1) | |
66 | set(PV_VERSION_MICRO 0) | |
67 | set(PV_VERSION_STRING | |
68 | ${PV_VERSION_MAJOR}.${PV_VERSION_MINOR}.${PV_VERSION_MICRO} | |
69 | ) | |
70 | ||
71 | configure_file ( | |
72 | ${PROJECT_SOURCE_DIR}/config.h.in | |
73 | ${PROJECT_BINARY_DIR}/config.h | |
74 | ) | |
df944399 | 75 | |
30588653 AG |
76 | #=============================================================================== |
77 | #= Sources | |
78 | #------------------------------------------------------------------------------- | |
79 | ||
a8d3fb2d | 80 | set(pulseview_SOURCES |
df944399 | 81 | main.cpp |
51e77110 JH |
82 | pv/about.cpp |
83 | pv/datasnapshot.cpp | |
84 | pv/logicdata.cpp | |
85 | pv/logicdatasnapshot.cpp | |
86 | pv/logicsignal.cpp | |
87 | pv/mainwindow.cpp | |
88 | pv/samplingbar.cpp | |
89 | pv/signaldata.cpp | |
90 | pv/sigsession.cpp | |
91 | pv/signal.cpp | |
1d8dca91 | 92 | pv/view/header.cpp |
ccdd3ef5 | 93 | pv/view/ruler.cpp |
cdf7bea7 JH |
94 | pv/view/view.cpp |
95 | pv/view/viewport.cpp | |
df944399 JH |
96 | ) |
97 | ||
a8d3fb2d | 98 | set(pulseview_HEADERS |
51e77110 JH |
99 | pv/about.h |
100 | pv/mainwindow.h | |
101 | pv/samplingbar.h | |
102 | pv/sigsession.h | |
1d8dca91 | 103 | pv/view/header.h |
ccdd3ef5 | 104 | pv/view/ruler.h |
cdf7bea7 JH |
105 | pv/view/view.h |
106 | pv/view/viewport.h | |
df944399 JH |
107 | ) |
108 | ||
a8d3fb2d | 109 | set(pulseview_FORMS |
51e77110 | 110 | pv/about.ui |
df944399 JH |
111 | ) |
112 | ||
a8d3fb2d JH |
113 | set(pulseview_RESOURCES |
114 | pulseview.qrc | |
df944399 JH |
115 | ) |
116 | ||
a8d3fb2d JH |
117 | qt4_wrap_cpp(pulseview_HEADERS_MOC ${pulseview_HEADERS}) |
118 | qt4_wrap_ui(pulseview_FORMS_HEADERS ${pulseview_FORMS}) | |
119 | qt4_add_resources(pulseview_RESOURCES_RCC ${pulseview_RESOURCES}) | |
df944399 JH |
120 | |
121 | include(${QT_USE_FILE}) | |
122 | ||
30588653 AG |
123 | #=============================================================================== |
124 | #= Global Definitions | |
125 | #------------------------------------------------------------------------------- | |
126 | ||
df944399 | 127 | add_definitions(${QT_DEFINITIONS}) |
df944399 | 128 | |
30588653 AG |
129 | #=============================================================================== |
130 | #= Global Include Directories | |
131 | #------------------------------------------------------------------------------- | |
132 | ||
b04e278d AG |
133 | include_directories( |
134 | ${CMAKE_CURRENT_BINARY_DIR} | |
cef18fc6 | 135 | ${CMAKE_CURRENT_SOURCE_DIR} |
b04e278d AG |
136 | ${Boost_INCLUDE_DIRS} |
137 | ) | |
138 | ||
139 | if(STATIC_PKGDEPS_LIBS) | |
140 | include_directories(${PKGDEPS_STATIC_INCLUDE_DIRS}) | |
141 | else() | |
142 | include_directories(${PKGDEPS_INCLUDE_DIRS}) | |
143 | endif() | |
df944399 | 144 | |
30588653 AG |
145 | #=============================================================================== |
146 | #= Linker Configuration | |
147 | #------------------------------------------------------------------------------- | |
148 | ||
b04e278d AG |
149 | link_directories(${Boost_LIBRARY_DIRS}) |
150 | ||
151 | set(PULSEVIEW_LINK_LIBS | |
152 | ${Boost_LIBRARIES} | |
153 | ${QT_LIBRARIES} | |
154 | ) | |
155 | ||
156 | if(STATIC_PKGDEPS_LIBS) | |
157 | link_directories(${PKGDEPS_STATIC_LIBRARY_DIRS}) | |
158 | list(APPEND PULSEVIEW_LINK_LIBS ${PKGDEPS_STATIC_LIBRARIES}) | |
159 | else() | |
160 | link_directories(${PKGDEPS_LIBRARY_DIRS}) | |
161 | list(APPEND PULSEVIEW_LINK_LIBS ${PKGDEPS_LIBRARIES}) | |
162 | endif() | |
df944399 | 163 | |
5a13850b | 164 | add_executable(${PROJECT_NAME} |
a8d3fb2d JH |
165 | ${pulseview_SOURCES} |
166 | ${pulseview_HEADERS_MOC} | |
167 | ${pulseview_FORMS_HEADERS} | |
168 | ${pulseview_RESOURCES_RCC} | |
df944399 JH |
169 | ) |
170 | ||
5a13850b | 171 | target_link_libraries(${PROJECT_NAME} ${PULSEVIEW_LINK_LIBS}) |
f0fa92c6 | 172 | |
30588653 AG |
173 | #=============================================================================== |
174 | #= Installation | |
175 | #------------------------------------------------------------------------------- | |
176 | ||
5a13850b | 177 | install(PROGRAMS ${PROJECT_NAME} DESTINATION bin/) |
bc1c1462 | 178 | |
30588653 AG |
179 | #=============================================================================== |
180 | #= Tests | |
181 | #------------------------------------------------------------------------------- | |
182 | ||
77e8ac52 | 183 | if(ENABLE_TESTS) |
fb746bcc | 184 | add_subdirectory(test) |
951c583c | 185 | enable_testing() |
fb746bcc | 186 | add_test(test ${CMAKE_CURRENT_BINARY_DIR}/test/pulseview-test) |
77e8ac52 | 187 | endif(ENABLE_TESTS) |