]> sigrok.org Git - pulseview.git/blame - CMakeLists.txt
Indented if statements in CMakeLists.txt
[pulseview.git] / CMakeLists.txt
CommitLineData
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>
5##
6## This program is free software: you can redistribute it and/or modify
7## it under the terms of the GNU General Public License as published by
8## the Free Software Foundation, either version 2 of the License, or
9## (at your option) any later version.
10##
11## This program is distributed in the hope that it will be useful,
12## but WITHOUT ANY WARRANTY; without even the implied warranty of
13## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14## GNU General Public License for more details.
15##
16## You should have received a copy of the GNU General Public License
17## along with this program. If not, see <http://www.gnu.org/licenses/>.
18##
19
df944399
JH
20cmake_minimum_required(VERSION 2.6)
21include(FindPkgConfig)
22
a8d3fb2d 23project(pulseview)
df944399
JH
24
25find_package(PkgConfig)
26pkg_check_modules(PKGDEPS REQUIRED
27 libsigrokdecode>=0.1.0
0dfbf7ff 28 libsigrok>=0.2.0
df944399
JH
29)
30
4cd24a75
UH
31# On Windows/MinGW we explicitly point cmake to the Boost directory.
32if(WIN32)
951c583c 33 set(BOOST_ROOT /usr/local)
4cd24a75
UH
34endif(WIN32)
35
df944399 36find_package(Qt4 REQUIRED)
f0fa92c6 37find_package(Boost 1.46 COMPONENTS unit_test_framework REQUIRED)
df944399
JH
38
39set(VERSION 0.1.0)
40
a8d3fb2d 41set(pulseview_SOURCES
df944399 42 main.cpp
51e77110
JH
43 pv/about.cpp
44 pv/datasnapshot.cpp
45 pv/logicdata.cpp
46 pv/logicdatasnapshot.cpp
47 pv/logicsignal.cpp
48 pv/mainwindow.cpp
49 pv/samplingbar.cpp
50 pv/signaldata.cpp
51 pv/sigsession.cpp
52 pv/signal.cpp
1d8dca91 53 pv/view/header.cpp
ccdd3ef5 54 pv/view/ruler.cpp
cdf7bea7
JH
55 pv/view/view.cpp
56 pv/view/viewport.cpp
df944399
JH
57)
58
a8d3fb2d 59set(pulseview_HEADERS
51e77110
JH
60 pv/about.h
61 pv/mainwindow.h
62 pv/samplingbar.h
63 pv/sigsession.h
1d8dca91 64 pv/view/header.h
ccdd3ef5 65 pv/view/ruler.h
cdf7bea7
JH
66 pv/view/view.h
67 pv/view/viewport.h
df944399
JH
68)
69
a8d3fb2d 70set(pulseview_FORMS
51e77110 71 pv/about.ui
df944399
JH
72)
73
a8d3fb2d
JH
74set(pulseview_RESOURCES
75 pulseview.qrc
df944399
JH
76)
77
a8d3fb2d 78set(pulseview_TEST_SOURCES
51e77110
JH
79 pv/datasnapshot.cpp
80 pv/logicdatasnapshot.cpp
4ceab49a 81 test/logicdatasnapshot.cpp
f0fa92c6
JH
82 test/test.cpp
83)
84
a8d3fb2d
JH
85qt4_wrap_cpp(pulseview_HEADERS_MOC ${pulseview_HEADERS})
86qt4_wrap_ui(pulseview_FORMS_HEADERS ${pulseview_FORMS})
87qt4_add_resources(pulseview_RESOURCES_RCC ${pulseview_RESOURCES})
df944399
JH
88
89include(${QT_USE_FILE})
90
91add_definitions(${QT_DEFINITIONS})
92add_definitions(-DAPP_VERSION="${VERSION}")
93
c0d9e65d
UH
94# On Windows/MinGW we need PKGDEPS_STATIC_INCLUDE_DIRS.
95if(WIN32)
951c583c
JH
96 include_directories(
97 ${include_directories}
98 ${CMAKE_CURRENT_BINARY_DIR}
99 ${Boost_INCLUDE_DIRS}
100 ${PKGDEPS_STATIC_INCLUDE_DIRS}
101 )
c0d9e65d 102else(WIN32)
951c583c
JH
103 include_directories(
104 ${include_directories}
105 ${CMAKE_CURRENT_BINARY_DIR}
106 ${Boost_INCLUDE_DIRS}
107 ${PKGDEPS_INCLUDE_DIRS}
108 )
c0d9e65d 109endif(WIN32)
df944399 110
c0d9e65d
UH
111# On Windows/MinGW we need PKGDEPS_STATIC_LIBRARY_DIRS.
112if(WIN32)
951c583c
JH
113 link_directories(
114 ${Boost_LIBRARY_DIRS}
115 ${PKGDEPS_STATIC_LIBRARY_DIRS}
116 )
c0d9e65d 117else(WIN32)
951c583c
JH
118 link_directories(
119 ${Boost_LIBRARY_DIRS}
120 ${PKGDEPS_LIBRARY_DIRS}
121 )
c0d9e65d 122endif(WIN32)
df944399 123
a8d3fb2d
JH
124add_executable(pulseview
125 ${pulseview_SOURCES}
126 ${pulseview_HEADERS_MOC}
127 ${pulseview_FORMS_HEADERS}
128 ${pulseview_RESOURCES_RCC}
df944399
JH
129)
130
c0d9e65d
UH
131# On Windows/MinGW we need PKGDEPS_STATIC_LIBRARIES.
132if(WIN32)
951c583c
JH
133 target_link_libraries(pulseview
134 ${Boost_LIBRARIES}
135 ${PKGDEPS_STATIC_LIBRARIES}
136 ${QT_LIBRARIES}
137 )
c0d9e65d 138else(WIN32)
951c583c
JH
139 target_link_libraries(pulseview
140 ${Boost_LIBRARIES}
141 ${PKGDEPS_LIBRARIES}
142 ${QT_LIBRARIES}
143 )
c0d9e65d 144endif(WIN32)
f0fa92c6 145
bc1c1462
JH
146install(PROGRAMS pulseview DESTINATION bin/)
147
77e8ac52
JH
148if(ENABLE_TESTS)
149
951c583c
JH
150 add_definitions(-DBOOST_TEST_DYN_LINK)
151
152 add_executable(pulseview-test
153 ${pulseview_TEST_SOURCES}
154 )
155
156 # On Windows/MinGW we need PKGDEPS_STATIC_LIBRARIES.
157 if(WIN32)
158 target_link_libraries(pulseview-test
159 ${Boost_LIBRARIES}
160 ${PKGDEPS_STATIC_LIBRARIES}
161 ${QT_LIBRARIES}
162 )
163 else(WIN32)
164 target_link_libraries(pulseview-test
165 ${Boost_LIBRARIES}
166 ${PKGDEPS_LIBRARIES}
167 ${QT_LIBRARIES}
168 )
169 endif(WIN32)
170
171 enable_testing()
172 add_test(test ${CMAKE_CURRENT_BINARY_DIR}/pulseview-test)
0615f1b6 173
77e8ac52 174endif(ENABLE_TESTS)