]> sigrok.org Git - pulseview.git/blob - CMakeLists.txt
Moved all classes into the pv namespace
[pulseview.git] / CMakeLists.txt
1 ##
2 ## This file is part of the PulseView project.
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
20 cmake_minimum_required(VERSION 2.6)
21 include(FindPkgConfig)
22
23 project(pulseview)
24
25 find_package(PkgConfig)
26 pkg_check_modules(PKGDEPS REQUIRED
27         libsigrokdecode>=0.1.0
28         libsigrok>=0.2.0
29 )
30
31 # On Windows/MinGW we explicitly point cmake to the Boost directory.
32 if(WIN32)
33 set(BOOST_ROOT /usr/local)
34 endif(WIN32)
35
36 find_package(Qt4 REQUIRED)
37 find_package(Boost 1.46 COMPONENTS unit_test_framework REQUIRED)
38
39 set(VERSION 0.1.0)
40
41 set(pulseview_SOURCES
42         main.cpp
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
53         pv/view/header.cpp
54         pv/view/ruler.cpp
55         pv/view/view.cpp
56         pv/view/viewport.cpp
57 )
58
59 set(pulseview_HEADERS
60         pv/about.h
61         pv/mainwindow.h
62         pv/samplingbar.h
63         pv/sigsession.h
64         pv/view/header.h
65         pv/view/ruler.h
66         pv/view/view.h
67         pv/view/viewport.h
68 )
69
70 set(pulseview_FORMS
71         pv/about.ui
72 )
73
74 set(pulseview_RESOURCES
75         pulseview.qrc
76 )
77
78 set(pulseview_TEST_SOURCES
79         pv/datasnapshot.cpp
80         pv/logicdatasnapshot.cpp
81         test/logicdatasnapshot.cpp
82         test/test.cpp
83 )
84
85 qt4_wrap_cpp(pulseview_HEADERS_MOC ${pulseview_HEADERS})
86 qt4_wrap_ui(pulseview_FORMS_HEADERS ${pulseview_FORMS})
87 qt4_add_resources(pulseview_RESOURCES_RCC ${pulseview_RESOURCES})
88
89 include(${QT_USE_FILE})
90
91 add_definitions(${QT_DEFINITIONS})
92 add_definitions(-DAPP_VERSION="${VERSION}")
93
94 # On Windows/MinGW we need PKGDEPS_STATIC_INCLUDE_DIRS.
95 if(WIN32)
96 include_directories(
97         ${include_directories}
98         ${CMAKE_CURRENT_BINARY_DIR}
99         ${Boost_INCLUDE_DIRS}
100         ${PKGDEPS_STATIC_INCLUDE_DIRS}
101 )
102 else(WIN32)
103 include_directories(
104         ${include_directories}
105         ${CMAKE_CURRENT_BINARY_DIR}
106         ${Boost_INCLUDE_DIRS}
107         ${PKGDEPS_INCLUDE_DIRS}
108 )
109 endif(WIN32)
110
111 # On Windows/MinGW we need PKGDEPS_STATIC_LIBRARY_DIRS.
112 if(WIN32)
113 link_directories(
114         ${Boost_LIBRARY_DIRS}
115         ${PKGDEPS_STATIC_LIBRARY_DIRS}
116 )
117 else(WIN32)
118 link_directories(
119         ${Boost_LIBRARY_DIRS}
120         ${PKGDEPS_LIBRARY_DIRS}
121 )
122 endif(WIN32)
123
124 add_executable(pulseview
125         ${pulseview_SOURCES}
126         ${pulseview_HEADERS_MOC}
127         ${pulseview_FORMS_HEADERS}
128         ${pulseview_RESOURCES_RCC}
129 )
130
131 # On Windows/MinGW we need PKGDEPS_STATIC_LIBRARIES.
132 if(WIN32)
133 target_link_libraries(pulseview
134         ${Boost_LIBRARIES}
135         ${PKGDEPS_STATIC_LIBRARIES}
136         ${QT_LIBRARIES}
137 )
138 else(WIN32)
139 target_link_libraries(pulseview
140         ${Boost_LIBRARIES}
141         ${PKGDEPS_LIBRARIES}
142         ${QT_LIBRARIES}
143 )
144 endif(WIN32)
145
146 if(ENABLE_TESTS)
147
148 add_definitions(-DBOOST_TEST_DYN_LINK)
149
150 add_executable(pulseview-test
151         ${pulseview_TEST_SOURCES}
152 )
153
154 # On Windows/MinGW we need PKGDEPS_STATIC_LIBRARIES.
155 if(WIN32)
156 target_link_libraries(pulseview-test
157         ${Boost_LIBRARIES}
158         ${PKGDEPS_STATIC_LIBRARIES}
159         ${QT_LIBRARIES}
160 )
161 else(WIN32)
162 target_link_libraries(pulseview-test
163         ${Boost_LIBRARIES}
164         ${PKGDEPS_LIBRARIES}
165         ${QT_LIBRARIES}
166 )
167 endif(WIN32)
168
169 enable_testing()
170 add_test(test ${CMAKE_CURRENT_BINARY_DIR}/pulseview-test)
171
172 install(PROGRAMS pulseview DESTINATION bin/)
173
174 endif(ENABLE_TESTS)