LogicSignal: Replaced TRUE/FALSE with true/false
[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.3.0)
24
25 if(ENABLE_DECODE)
26         list(APPEND PKGDEPS libsigrokdecode>=0.3.0)
27 endif()
28
29 find_package(PkgConfig)
30 pkg_check_modules(PKGDEPS REQUIRED ${PKGDEPS})
31
32 find_package(Boost 1.42 COMPONENTS filesystem system unit_test_framework REQUIRED)
33
34 # Find the platform's thread library (needed for C++11 threads).
35 # This will set ${CMAKE_THREAD_LIBS_INIT} to the correct, OS-specific value.
36 find_package(Threads 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/util.cpp
45         ${PROJECT_SOURCE_DIR}/pv/view/cursorpair.cpp
46         ${PROJECT_SOURCE_DIR}/pv/data/analog.cpp
47         ${PROJECT_SOURCE_DIR}/pv/data/analogsnapshot.cpp
48         ${PROJECT_SOURCE_DIR}/pv/data/logic.cpp
49         ${PROJECT_SOURCE_DIR}/pv/data/logicsnapshot.cpp
50         ${PROJECT_SOURCE_DIR}/pv/data/snapshot.cpp
51         ${PROJECT_SOURCE_DIR}/pv/data/signaldata.cpp
52         ${PROJECT_SOURCE_DIR}/pv/prop/double.cpp
53         ${PROJECT_SOURCE_DIR}/pv/prop/enum.cpp
54         ${PROJECT_SOURCE_DIR}/pv/prop/int.cpp
55         ${PROJECT_SOURCE_DIR}/pv/prop/property.cpp
56         ${PROJECT_SOURCE_DIR}/pv/prop/string.cpp
57         ${PROJECT_SOURCE_DIR}/pv/prop/binding/binding.cpp
58         ${PROJECT_SOURCE_DIR}/pv/view/analogsignal.cpp
59         ${PROJECT_SOURCE_DIR}/pv/view/cursor.cpp
60         ${PROJECT_SOURCE_DIR}/pv/view/cursorheader.cpp
61         ${PROJECT_SOURCE_DIR}/pv/view/cursorpair.cpp
62         ${PROJECT_SOURCE_DIR}/pv/view/header.cpp
63         ${PROJECT_SOURCE_DIR}/pv/view/logicsignal.cpp
64         ${PROJECT_SOURCE_DIR}/pv/view/marginwidget.cpp
65         ${PROJECT_SOURCE_DIR}/pv/view/ruler.cpp
66         ${PROJECT_SOURCE_DIR}/pv/view/selectableitem.cpp
67         ${PROJECT_SOURCE_DIR}/pv/view/signal.cpp
68         ${PROJECT_SOURCE_DIR}/pv/view/timemarker.cpp
69         ${PROJECT_SOURCE_DIR}/pv/view/trace.cpp
70         ${PROJECT_SOURCE_DIR}/pv/view/tracepalette.cpp
71         ${PROJECT_SOURCE_DIR}/pv/view/view.cpp
72         ${PROJECT_SOURCE_DIR}/pv/view/viewport.cpp
73         ${PROJECT_SOURCE_DIR}/pv/widgets/colourbutton.cpp
74         ${PROJECT_SOURCE_DIR}/pv/widgets/colourpopup.cpp
75         ${PROJECT_SOURCE_DIR}/pv/widgets/popup.cpp
76         ${PROJECT_SOURCE_DIR}/pv/widgets/wellarray.cpp
77         data/analogsnapshot.cpp
78         data/logicsnapshot.cpp
79         test.cpp
80 )
81
82 # This list includes only QObject derived class headers.
83 set(pulseview_TEST_HEADERS
84         ${PROJECT_SOURCE_DIR}/pv/sigsession.h
85         ${PROJECT_SOURCE_DIR}/pv/prop/double.h
86         ${PROJECT_SOURCE_DIR}/pv/prop/enum.h
87         ${PROJECT_SOURCE_DIR}/pv/prop/int.h
88         ${PROJECT_SOURCE_DIR}/pv/prop/property.h
89         ${PROJECT_SOURCE_DIR}/pv/prop/string.h
90         ${PROJECT_SOURCE_DIR}/pv/prop/binding/deviceoptions.h
91         ${PROJECT_SOURCE_DIR}/pv/view/cursor.h
92         ${PROJECT_SOURCE_DIR}/pv/view/cursorheader.h
93         ${PROJECT_SOURCE_DIR}/pv/view/header.h
94         ${PROJECT_SOURCE_DIR}/pv/view/logicsignal.h
95         ${PROJECT_SOURCE_DIR}/pv/view/marginwidget.h
96         ${PROJECT_SOURCE_DIR}/pv/view/ruler.h
97         ${PROJECT_SOURCE_DIR}/pv/view/selectableitem.h
98         ${PROJECT_SOURCE_DIR}/pv/view/signal.h
99         ${PROJECT_SOURCE_DIR}/pv/view/timemarker.h
100         ${PROJECT_SOURCE_DIR}/pv/view/trace.h
101         ${PROJECT_SOURCE_DIR}/pv/view/view.h
102         ${PROJECT_SOURCE_DIR}/pv/view/viewport.h
103         ${PROJECT_SOURCE_DIR}/pv/widgets/colourbutton.h
104         ${PROJECT_SOURCE_DIR}/pv/widgets/colourpopup.h
105         ${PROJECT_SOURCE_DIR}/pv/widgets/popup.h
106         ${PROJECT_SOURCE_DIR}/pv/widgets/wellarray.h
107 )
108
109 if(ENABLE_DECODE)
110         list(APPEND pulseview_TEST_SOURCES
111                 ${PROJECT_SOURCE_DIR}/pv/data/decoderstack.cpp
112                 ${PROJECT_SOURCE_DIR}/pv/data/decode/annotation.cpp
113                 ${PROJECT_SOURCE_DIR}/pv/data/decode/decoder.cpp
114                 ${PROJECT_SOURCE_DIR}/pv/data/decode/row.cpp
115                 ${PROJECT_SOURCE_DIR}/pv/data/decode/rowdata.cpp
116                 ${PROJECT_SOURCE_DIR}/pv/prop/binding/decoderoptions.cpp
117                 ${PROJECT_SOURCE_DIR}/pv/view/decodetrace.cpp
118                 ${PROJECT_SOURCE_DIR}/pv/widgets/decodergroupbox.cpp
119                 ${PROJECT_SOURCE_DIR}/pv/widgets/decodermenu.cpp
120                 data/decoderstack.cpp
121         )
122
123         list(APPEND pulseview_TEST_HEADERS
124                 ${PROJECT_SOURCE_DIR}/pv/data/decoderstack.h
125                 ${PROJECT_SOURCE_DIR}/pv/view/decodetrace.h
126                 ${PROJECT_SOURCE_DIR}/pv/widgets/decodergroupbox.h
127                 ${PROJECT_SOURCE_DIR}/pv/widgets/decodermenu.h
128         )
129 endif()
130
131 qt4_wrap_cpp(pulseview_TEST_HEADERS_MOC ${pulseview_TEST_HEADERS})
132
133 if(ENABLE_DECODE)
134         add_definitions(-DENABLE_DECODE)
135 endif()
136
137 # On MinGW we need to use static linking.
138 if(NOT WIN32)
139         add_definitions(-DBOOST_TEST_DYN_LINK)
140 endif()
141
142 add_definitions(${QT_DEFINITIONS})
143
144 include_directories(
145         ${Boost_INCLUDE_DIRS}
146         ${PKGDEPS_INCLUDE_DIRS}
147 )
148
149 set(PULSEVIEW_LINK_LIBS
150         ${Boost_LIBRARIES}
151         ${PKGDEPS_LIBRARIES}
152         ${QT_LIBRARIES}
153         ${CMAKE_THREAD_LIBS_INIT}
154 )
155
156 if(WIN32)
157         # Workaround for a MinGW linking issue.
158         list(APPEND PULSEVIEW_LINK_LIBS "-llzma -llcms2")
159 endif()
160
161 add_executable(pulseview-test
162         ${pulseview_TEST_SOURCES}
163         ${pulseview_TEST_HEADERS_MOC}
164 )
165
166 target_link_libraries(pulseview-test ${PULSEVIEW_LINK_LIBS})
167