2 ## This file is part of the PulseView project.
4 ## Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
5 ## Copyright (C) 2012 Alexandru Gagniuc <mr.nuke.me@gmail.com>
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.
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.
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/>.
21 option(ENABLE_DECODE "Build with libsigrokdecode" FALSE)
23 list(APPEND PKGDEPS libsigrok>=0.3.0)
26 list(APPEND PKGDEPS libsigrokdecode>=0.3.0)
29 find_package(PkgConfig)
30 pkg_check_modules(PKGDEPS REQUIRED ${PKGDEPS})
32 find_package(Boost 1.42 COMPONENTS filesystem system unit_test_framework REQUIRED)
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)
38 find_program(QT_QMAKE_EXECUTABLE NAMES qmake4 qmake-qt4 qmake-mac)
39 find_package(Qt4 REQUIRED)
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
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
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
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
131 qt4_wrap_cpp(pulseview_TEST_HEADERS_MOC ${pulseview_TEST_HEADERS})
134 add_definitions(-DENABLE_DECODE)
137 # On MinGW we need to use static linking.
139 add_definitions(-DBOOST_TEST_DYN_LINK)
142 add_definitions(${QT_DEFINITIONS})
145 ${Boost_INCLUDE_DIRS}
146 ${PKGDEPS_INCLUDE_DIRS}
149 set(PULSEVIEW_LINK_LIBS
153 ${CMAKE_THREAD_LIBS_INIT}
157 # Workaround for a MinGW linking issue.
158 list(APPEND PULSEVIEW_LINK_LIBS "-llzma -llcms2")
161 add_executable(pulseview-test
162 ${pulseview_TEST_SOURCES}
163 ${pulseview_TEST_HEADERS_MOC}
166 target_link_libraries(pulseview-test ${PULSEVIEW_LINK_LIBS})