test/CMakeLists.txt: Fix MinGW build of the tests.
[pulseview.git] / test / CMakeLists.txt
index a8f152c165cf710bf64825bb4bed87f1793f75b6..57ca26f0026de927c6fb60a0c77e3fd2271ed415 100644 (file)
 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
 ##
 
-list(APPEND PKGDEPS
-       libsigrok>=0.2.0
-       libsigrokdecode>=0.2.0
-)
+option(ENABLE_DECODE "Build with libsigrokdecode" FALSE)
+
+list(APPEND PKGDEPS libsigrok>=0.2.0)
+
+if(ENABLE_DECODE)
+       list(APPEND PKGDEPS libsigrokdecode>=0.2.0)
+endif()
 
 find_package(PkgConfig)
 pkg_check_modules(PKGDEPS REQUIRED ${PKGDEPS})
@@ -30,9 +33,16 @@ pkg_check_modules(PKGDEPS REQUIRED ${PKGDEPS})
 # This will set ${CMAKE_THREAD_LIBS_INIT} to the correct, OS-specific value.
 find_package(Threads)
 
-find_package(Boost 1.46 COMPONENTS system unit_test_framework REQUIRED)
+if(WIN32)
+       # On Windows/MinGW we need to use 'thread_win32' instead of 'thread'.
+       # The library is named libboost_thread_win32* (not libboost_thread*).
+       find_package(Boost 1.42 COMPONENTS system thread_win32 unit_test_framework REQUIRED)
+else()
+       find_package(Boost 1.42 COMPONENTS system thread unit_test_framework REQUIRED)
+endif()
+
 
-#FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake4 qmake-qt4 qmake-mac)
+find_program(QT_QMAKE_EXECUTABLE NAMES qmake4 qmake-qt4 qmake-mac)
 find_package(Qt4 REQUIRED)
 
 set(pulseview_TEST_SOURCES
@@ -41,15 +51,17 @@ set(pulseview_TEST_SOURCES
        ${PROJECT_SOURCE_DIR}/pv/view/cursorpair.cpp
        ${PROJECT_SOURCE_DIR}/pv/data/analog.cpp
        ${PROJECT_SOURCE_DIR}/pv/data/analogsnapshot.cpp
-       ${PROJECT_SOURCE_DIR}/pv/data/decoder.cpp
        ${PROJECT_SOURCE_DIR}/pv/data/logic.cpp
        ${PROJECT_SOURCE_DIR}/pv/data/logicsnapshot.cpp
        ${PROJECT_SOURCE_DIR}/pv/data/snapshot.cpp
        ${PROJECT_SOURCE_DIR}/pv/data/signaldata.cpp
+       ${PROJECT_SOURCE_DIR}/pv/prop/int.cpp
+       ${PROJECT_SOURCE_DIR}/pv/prop/property.cpp
+       ${PROJECT_SOURCE_DIR}/pv/prop/string.cpp
+       ${PROJECT_SOURCE_DIR}/pv/prop/binding/binding.cpp
        ${PROJECT_SOURCE_DIR}/pv/view/analogsignal.cpp
        ${PROJECT_SOURCE_DIR}/pv/view/cursor.cpp
        ${PROJECT_SOURCE_DIR}/pv/view/cursorpair.cpp
-       ${PROJECT_SOURCE_DIR}/pv/view/decodesignal.cpp
        ${PROJECT_SOURCE_DIR}/pv/view/header.cpp
        ${PROJECT_SOURCE_DIR}/pv/view/logicsignal.cpp
        ${PROJECT_SOURCE_DIR}/pv/view/marginwidget.cpp
@@ -61,23 +73,22 @@ set(pulseview_TEST_SOURCES
        ${PROJECT_SOURCE_DIR}/pv/view/tracepalette.cpp
        ${PROJECT_SOURCE_DIR}/pv/view/view.cpp
        ${PROJECT_SOURCE_DIR}/pv/view/viewport.cpp
-       ${PROJECT_SOURCE_DIR}/pv/view/decode/annotation.cpp
        ${PROJECT_SOURCE_DIR}/pv/widgets/colourbutton.cpp
        ${PROJECT_SOURCE_DIR}/pv/widgets/colourpopup.cpp
        ${PROJECT_SOURCE_DIR}/pv/widgets/popup.cpp
        ${PROJECT_SOURCE_DIR}/pv/widgets/wellarray.cpp
        data/analogsnapshot.cpp
-       data/decoder.cpp
        data/logicsnapshot.cpp
        test.cpp
 )
 
-# This list includes only QObject derrived class headers
+# This list includes only QObject derived class headers.
 set(pulseview_TEST_HEADERS
        ${PROJECT_SOURCE_DIR}/pv/sigsession.h
-       ${PROJECT_SOURCE_DIR}/pv/data/decoder.h
+       ${PROJECT_SOURCE_DIR}/pv/prop/int.h
+       ${PROJECT_SOURCE_DIR}/pv/prop/property.h
+       ${PROJECT_SOURCE_DIR}/pv/prop/string.h
        ${PROJECT_SOURCE_DIR}/pv/view/cursor.h
-       ${PROJECT_SOURCE_DIR}/pv/view/decodesignal.h
        ${PROJECT_SOURCE_DIR}/pv/view/header.h
        ${PROJECT_SOURCE_DIR}/pv/view/logicsignal.h
        ${PROJECT_SOURCE_DIR}/pv/view/marginwidget.h
@@ -90,12 +101,41 @@ set(pulseview_TEST_HEADERS
        ${PROJECT_SOURCE_DIR}/pv/view/viewport.h
        ${PROJECT_SOURCE_DIR}/pv/widgets/colourbutton.h
        ${PROJECT_SOURCE_DIR}/pv/widgets/colourpopup.h
+       ${PROJECT_SOURCE_DIR}/pv/widgets/popup.h
        ${PROJECT_SOURCE_DIR}/pv/widgets/wellarray.h
 )
 
+if(ENABLE_DECODE)
+       list(APPEND pulseview_TEST_SOURCES
+               ${PROJECT_SOURCE_DIR}/pv/data/decoderstack.cpp
+               ${PROJECT_SOURCE_DIR}/pv/data/decode/decoder.cpp
+               ${PROJECT_SOURCE_DIR}/pv/data/decode/annotation.cpp
+               ${PROJECT_SOURCE_DIR}/pv/prop/binding/decoderoptions.cpp
+               ${PROJECT_SOURCE_DIR}/pv/view/decodetrace.cpp
+               ${PROJECT_SOURCE_DIR}/pv/widgets/decodergroupbox.cpp
+               ${PROJECT_SOURCE_DIR}/pv/widgets/decodermenu.cpp
+               data/decoderstack.cpp
+       )
+
+       list(APPEND pulseview_TEST_HEADERS
+               ${PROJECT_SOURCE_DIR}/pv/data/decoderstack.h
+               ${PROJECT_SOURCE_DIR}/pv/view/decodetrace.h
+               ${PROJECT_SOURCE_DIR}/pv/widgets/decodergroupbox.h
+               ${PROJECT_SOURCE_DIR}/pv/widgets/decodermenu.h
+       )
+endif()
+
 qt4_wrap_cpp(pulseview_TEST_HEADERS_MOC ${pulseview_TEST_HEADERS})
 
+if(ENABLE_DECODE)
+       add_definitions(-DENABLE_DECODE)
+endif()
+
+# On MinGW we need to use static linking.
+if(NOT WIN32)
 add_definitions(-DBOOST_TEST_DYN_LINK)
+endif()
+
 add_definitions(${QT_DEFINITIONS})
 
 include_directories(