Replaced QToolBar in probes popup
[pulseview.git] / test / CMakeLists.txt
1 ##
2 ## This file is part of the PulseView project.
3 ##
4 ## Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
5 ## Copyright (C) 2012 Alexandru Gagniuc <mr.nuke.me@gmail.com>
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
21 option(ENABLE_DECODE "Build with libsigrokdecode" FALSE)
22
23 list(APPEND PKGDEPS libsigrok>=0.2.0)
24
25 if(ENABLE_DECODE)
26         list(APPEND PKGDEPS libsigrokdecode>=0.2.0)
27 endif()
28
29 find_package(PkgConfig)
30 pkg_check_modules(PKGDEPS REQUIRED ${PKGDEPS})
31
32 # Find the platform's thread library (needed for boost-thread).
33 # This will set ${CMAKE_THREAD_LIBS_INIT} to the correct, OS-specific value.
34 find_package(Threads)
35
36 find_package(Boost 1.42 COMPONENTS system thread unit_test_framework REQUIRED)
37
38 find_program(QT_QMAKE_EXECUTABLE NAMES qmake4 qmake-qt4 qmake-mac)
39 find_package(Qt4 REQUIRED)
40
41 set(pulseview_TEST_SOURCES
42         ${PROJECT_SOURCE_DIR}/pv/devicemanager.cpp
43         ${PROJECT_SOURCE_DIR}/pv/sigsession.cpp
44         ${PROJECT_SOURCE_DIR}/pv/view/cursorpair.cpp
45         ${PROJECT_SOURCE_DIR}/pv/data/analog.cpp
46         ${PROJECT_SOURCE_DIR}/pv/data/analogsnapshot.cpp
47         ${PROJECT_SOURCE_DIR}/pv/data/logic.cpp
48         ${PROJECT_SOURCE_DIR}/pv/data/logicsnapshot.cpp
49         ${PROJECT_SOURCE_DIR}/pv/data/snapshot.cpp
50         ${PROJECT_SOURCE_DIR}/pv/data/signaldata.cpp
51         ${PROJECT_SOURCE_DIR}/pv/prop/int.cpp
52         ${PROJECT_SOURCE_DIR}/pv/prop/property.cpp
53         ${PROJECT_SOURCE_DIR}/pv/prop/string.cpp
54         ${PROJECT_SOURCE_DIR}/pv/prop/binding/binding.cpp
55         ${PROJECT_SOURCE_DIR}/pv/view/analogsignal.cpp
56         ${PROJECT_SOURCE_DIR}/pv/view/cursor.cpp
57         ${PROJECT_SOURCE_DIR}/pv/view/cursorpair.cpp
58         ${PROJECT_SOURCE_DIR}/pv/view/header.cpp
59         ${PROJECT_SOURCE_DIR}/pv/view/logicsignal.cpp
60         ${PROJECT_SOURCE_DIR}/pv/view/marginwidget.cpp
61         ${PROJECT_SOURCE_DIR}/pv/view/ruler.cpp
62         ${PROJECT_SOURCE_DIR}/pv/view/selectableitem.cpp
63         ${PROJECT_SOURCE_DIR}/pv/view/signal.cpp
64         ${PROJECT_SOURCE_DIR}/pv/view/timemarker.cpp
65         ${PROJECT_SOURCE_DIR}/pv/view/trace.cpp
66         ${PROJECT_SOURCE_DIR}/pv/view/tracepalette.cpp
67         ${PROJECT_SOURCE_DIR}/pv/view/view.cpp
68         ${PROJECT_SOURCE_DIR}/pv/view/viewport.cpp
69         ${PROJECT_SOURCE_DIR}/pv/widgets/colourbutton.cpp
70         ${PROJECT_SOURCE_DIR}/pv/widgets/colourpopup.cpp
71         ${PROJECT_SOURCE_DIR}/pv/widgets/popup.cpp
72         ${PROJECT_SOURCE_DIR}/pv/widgets/wellarray.cpp
73         data/analogsnapshot.cpp
74         data/logicsnapshot.cpp
75         test.cpp
76 )
77
78 # This list includes only QObject derived class headers.
79 set(pulseview_TEST_HEADERS
80         ${PROJECT_SOURCE_DIR}/pv/sigsession.h
81         ${PROJECT_SOURCE_DIR}/pv/prop/int.h
82         ${PROJECT_SOURCE_DIR}/pv/prop/property.h
83         ${PROJECT_SOURCE_DIR}/pv/prop/string.h
84         ${PROJECT_SOURCE_DIR}/pv/view/cursor.h
85         ${PROJECT_SOURCE_DIR}/pv/view/header.h
86         ${PROJECT_SOURCE_DIR}/pv/view/logicsignal.h
87         ${PROJECT_SOURCE_DIR}/pv/view/marginwidget.h
88         ${PROJECT_SOURCE_DIR}/pv/view/ruler.h
89         ${PROJECT_SOURCE_DIR}/pv/view/selectableitem.h
90         ${PROJECT_SOURCE_DIR}/pv/view/signal.h
91         ${PROJECT_SOURCE_DIR}/pv/view/timemarker.h
92         ${PROJECT_SOURCE_DIR}/pv/view/trace.h
93         ${PROJECT_SOURCE_DIR}/pv/view/view.h
94         ${PROJECT_SOURCE_DIR}/pv/view/viewport.h
95         ${PROJECT_SOURCE_DIR}/pv/widgets/colourbutton.h
96         ${PROJECT_SOURCE_DIR}/pv/widgets/colourpopup.h
97         ${PROJECT_SOURCE_DIR}/pv/widgets/popup.h
98         ${PROJECT_SOURCE_DIR}/pv/widgets/wellarray.h
99 )
100
101 if(ENABLE_DECODE)
102         list(APPEND pulseview_TEST_SOURCES
103                 ${PROJECT_SOURCE_DIR}/pv/data/decoderstack.cpp
104                 ${PROJECT_SOURCE_DIR}/pv/data/decode/decoder.cpp
105                 ${PROJECT_SOURCE_DIR}/pv/data/decode/annotation.cpp
106                 ${PROJECT_SOURCE_DIR}/pv/prop/binding/decoderoptions.cpp
107                 ${PROJECT_SOURCE_DIR}/pv/view/decodetrace.cpp
108                 ${PROJECT_SOURCE_DIR}/pv/widgets/decodergroupbox.cpp
109                 ${PROJECT_SOURCE_DIR}/pv/widgets/decodermenu.cpp
110                 data/decoderstack.cpp
111         )
112
113         list(APPEND pulseview_TEST_HEADERS
114                 ${PROJECT_SOURCE_DIR}/pv/data/decoderstack.h
115                 ${PROJECT_SOURCE_DIR}/pv/view/decodetrace.h
116                 ${PROJECT_SOURCE_DIR}/pv/widgets/decodergroupbox.h
117                 ${PROJECT_SOURCE_DIR}/pv/widgets/decodermenu.h
118         )
119 endif()
120
121 qt4_wrap_cpp(pulseview_TEST_HEADERS_MOC ${pulseview_TEST_HEADERS})
122
123 if(ENABLE_DECODE)
124         add_definitions(-DENABLE_DECODE)
125 endif()
126
127 add_definitions(-DBOOST_TEST_DYN_LINK)
128 add_definitions(${QT_DEFINITIONS})
129
130 include_directories(
131         ${Boost_INCLUDE_DIRS}
132         ${PKGDEPS_INCLUDE_DIRS}
133 )
134
135 set(PULSEVIEW_LINK_LIBS
136         ${Boost_LIBRARIES}
137         ${CMAKE_THREAD_LIBS_INIT}
138         ${PKGDEPS_LIBRARIES}
139         ${QT_LIBRARIES}
140 )
141
142 add_executable(pulseview-test
143         ${pulseview_TEST_SOURCES}
144         ${pulseview_TEST_HEADERS_MOC}
145 )
146
147 target_link_libraries(pulseview-test ${PULSEVIEW_LINK_LIBS})
148