187e05652SNicolas BonnefonINCLUDE (CheckSymbolExists) 2f09fa651SNicolas BonnefonINCLUDE (CheckCXXSourceCompiles) 33104b268SNicolas BonnefonINCLUDE (CheckCXXCompilerFlag) 487e05652SNicolas Bonnefon 5f09fa651SNicolas Bonnefoncmake_minimum_required(VERSION 2.8.12) 684af0c9bSNicolas Bonnefonproject(glogg_tests) 784af0c9bSNicolas Bonnefon 887e05652SNicolas Bonnefon# Qt 9*1ee847caSNicolas Bonnefon 1084af0c9bSNicolas Bonnefonfind_program(QT_QMAKE_EXECUTABLE NAMES qmake PATHS $ENV{QT_DIR}/bin) 1184af0c9bSNicolas Bonnefonfind_package(Qt5Widgets REQUIRED) 12*1ee847caSNicolas Bonnefonfind_package(Qt5Test REQUIRED) 1384af0c9bSNicolas Bonnefon 1484af0c9bSNicolas Bonnefonset(CMAKE_AUTOMOC ON) 1584af0c9bSNicolas Bonnefonset(CMAKE_AUTOUIC ON) 1684af0c9bSNicolas Bonnefonset(CMAKE_INCLUDE_CURRENT_DIR ON) 1784af0c9bSNicolas Bonnefon 183104b268SNicolas Bonnefoncheck_cxx_compiler_flag(-Wall HAS_WALL) 193104b268SNicolas Bonnefon 203104b268SNicolas Bonnefonif(HAS_WALL) 213104b268SNicolas Bonnefon set(PARANOID_FLAGS "${PARANOID_FLAGS} -Wall") 223104b268SNicolas Bonnefonendif(HAS_WALL) 233104b268SNicolas Bonnefon 2487e05652SNicolas Bonnefon# Configuration 2587e05652SNicolas Bonnefoncheck_symbol_exists( symlink "unistd.h" HAVE_SYMLINK ) 2687e05652SNicolas Bonnefon 27f09fa651SNicolas Bonnefoncheck_cxx_source_compiles(CMAKE_REQUIRED_FLAGS="-std=c++11" " 28f09fa651SNicolas Bonnefon #include <memory> 29f09fa651SNicolas Bonnefon int main(int, int) 30f09fa651SNicolas Bonnefon { 31f09fa651SNicolas Bonnefon auto test = std::make_unique<void>(); 32f09fa651SNicolas Bonnefon return 0; 33f09fa651SNicolas Bonnefon } 34f09fa651SNicolas Bonnefon" HAVE_MAKE_UNIQUE) 35f09fa651SNicolas Bonnefon 3687e05652SNicolas Bonnefonconfigure_file(../config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) 3787e05652SNicolas Bonnefon 3884af0c9bSNicolas Bonnefon# Setup testing 3984af0c9bSNicolas Bonnefonenable_testing() 4084af0c9bSNicolas Bonnefoninclude_directories( 4184af0c9bSNicolas Bonnefon $ENV{GMOCK_HOME}/include 4284af0c9bSNicolas Bonnefon $ENV{GMOCK_HOME}/gtest/include 4384af0c9bSNicolas Bonnefon $ENV{BOOST_ROOT}/ 44a0936e1eSNicolas Bonnefon ../src/ 45a0936e1eSNicolas Bonnefon) 4684af0c9bSNicolas Bonnefonlink_directories($ENV{GMOCK_HOME}/mybuild $ENV{GMOCK_HOME}/mybuild/gtest) 4784af0c9bSNicolas Bonnefon 4884af0c9bSNicolas Bonnefon# Sources 4984af0c9bSNicolas Bonnefonset(glogg_SOURCES 5084af0c9bSNicolas Bonnefon ../src/session.cpp 5184af0c9bSNicolas Bonnefon ../src/data/abstractlogdata.cpp 5284af0c9bSNicolas Bonnefon ../src/data/logdata.cpp 5384af0c9bSNicolas Bonnefon ../src/data/logfiltereddata.cpp 5484af0c9bSNicolas Bonnefon ../src/data/logfiltereddataworkerthread.cpp 5584af0c9bSNicolas Bonnefon ../src/data/logdataworkerthread.cpp 5684af0c9bSNicolas Bonnefon ../src/mainwindow.cpp 5784af0c9bSNicolas Bonnefon ../src/crawlerwidget.cpp 5884af0c9bSNicolas Bonnefon ../src/abstractlogview.cpp 5984af0c9bSNicolas Bonnefon ../src/logmainview.cpp 6084af0c9bSNicolas Bonnefon ../src/filteredview.cpp 6184af0c9bSNicolas Bonnefon ../src/optionsdialog.cpp 6284af0c9bSNicolas Bonnefon ../src/persistentinfo.cpp 6384af0c9bSNicolas Bonnefon ../src/configuration.cpp 6484af0c9bSNicolas Bonnefon ../src/filtersdialog.cpp 6584af0c9bSNicolas Bonnefon ../src/filterset.cpp 6684af0c9bSNicolas Bonnefon ../src/savedsearches.cpp 6784af0c9bSNicolas Bonnefon ../src/infoline.cpp 6884af0c9bSNicolas Bonnefon ../src/menuactiontooltipbehavior.cpp 6984af0c9bSNicolas Bonnefon ../src/selection.cpp 7084af0c9bSNicolas Bonnefon ../src/quickfind.cpp 7184af0c9bSNicolas Bonnefon ../src/quickfindpattern.cpp 7284af0c9bSNicolas Bonnefon ../src/quickfindwidget.cpp 7384af0c9bSNicolas Bonnefon ../src/sessioninfo.cpp 7484af0c9bSNicolas Bonnefon ../src/recentfiles.cpp 7584af0c9bSNicolas Bonnefon ../src/overview.cpp 7684af0c9bSNicolas Bonnefon ../src/overviewwidget.cpp 7784af0c9bSNicolas Bonnefon ../src/marks.cpp 7884af0c9bSNicolas Bonnefon ../src/quickfindmux.cpp 7984af0c9bSNicolas Bonnefon ../src/signalmux.cpp 8084af0c9bSNicolas Bonnefon ../src/qtfilewatcher.cpp 8184af0c9bSNicolas Bonnefon ../src/tabbedcrawlerwidget.cpp 8284af0c9bSNicolas Bonnefon ../src/filewatcher.cpp 83c540156cSNicolas Bonnefon ../src/watchtowerlist.cpp 84a0936e1eSNicolas Bonnefon ../src/watchtower.cpp 8584b2179eSNicolas Bonnefon ../src/platformfilewatcher.cpp 8687e05652SNicolas Bonnefon) 8784af0c9bSNicolas Bonnefon 8884af0c9bSNicolas Bonnefonset(glogg_HEADERS 8984af0c9bSNicolas Bonnefon ../src/mainwindow.h 9084af0c9bSNicolas Bonnefon ../src/marks.h 9184af0c9bSNicolas Bonnefon ../src/filewatcher.h) 9284af0c9bSNicolas Bonnefon 93*1ee847caSNicolas Bonnefon# Unit tests 94*1ee847caSNicolas Bonnefonset(glogg_UTESTS 95a0936e1eSNicolas Bonnefon filewatcherTest.cpp 9684af0c9bSNicolas Bonnefon watchtowerTest.cpp 9784af0c9bSNicolas Bonnefon) 9884af0c9bSNicolas Bonnefon 99*1ee847caSNicolas Bonnefon# Integration tests 100*1ee847caSNicolas Bonnefonset(glogg_ITESTS 101*1ee847caSNicolas Bonnefon logdataTest.cpp 102*1ee847caSNicolas Bonnefon) 103*1ee847caSNicolas Bonnefon 104*1ee847caSNicolas Bonnefon# Performance tests 105*1ee847caSNicolas Bonnefonset(glogg_PTESTS 106*1ee847caSNicolas Bonnefon logdataPerfTest.cpp 107*1ee847caSNicolas Bonnefon) 108*1ee847caSNicolas Bonnefon 109*1ee847caSNicolas Bonnefon 11084af0c9bSNicolas Bonnefon# Options 11184af0c9bSNicolas Bonnefonif (WIN32) 112a0936e1eSNicolas Bonnefon set(FileWatcherEngine_SOURCES 113f09fa651SNicolas Bonnefon ../src/winwatchtowerdriver.cpp 114a0936e1eSNicolas Bonnefon ) 11587e05652SNicolas Bonnefonelse (WIN32) 116c540156cSNicolas Bonnefon set(FileWatcherEngine_SOURCES ../src/inotifywatchtowerdriver.cpp) 11784af0c9bSNicolas Bonnefonendif (WIN32) 11884af0c9bSNicolas Bonnefon 11984af0c9bSNicolas Bonnefon# Qt 1203104b268SNicolas Bonnefonset(CMAKE_CXX_FLAGS "${PARANOID_FLAGS} -fPIC -std=c++11 -DGLOGG_VERSION=\\\"unit_tests\\\" -g -gdwarf-2") 12184af0c9bSNicolas Bonnefon 12284af0c9bSNicolas Bonnefon# Add test cpp file 12384af0c9bSNicolas Bonnefonadd_executable(glogg_tests 12484af0c9bSNicolas Bonnefon ${glogg_SOURCES} 12584af0c9bSNicolas Bonnefon ${FileWatcherEngine_SOURCES} 126*1ee847caSNicolas Bonnefon ${glogg_UTESTS} 12784af0c9bSNicolas Bonnefon) 12884af0c9bSNicolas Bonnefon 12984af0c9bSNicolas Bonnefon# Link test executable against gtest & gtest_main 13084af0c9bSNicolas Bonnefontarget_link_libraries(glogg_tests gmock gtest gtest_main pthread Qt5::Widgets) 13184af0c9bSNicolas Bonnefon 132*1ee847caSNicolas Bonnefonadd_executable(glogg_itests 133*1ee847caSNicolas Bonnefon ${glogg_SOURCES} 134*1ee847caSNicolas Bonnefon ${FileWatcherEngine_SOURCES} 135*1ee847caSNicolas Bonnefon ${glogg_ITESTS} 136*1ee847caSNicolas Bonnefon itests.cpp 137*1ee847caSNicolas Bonnefon) 138*1ee847caSNicolas Bonnefon 139*1ee847caSNicolas Bonnefontarget_link_libraries(glogg_itests gmock gtest pthread Qt5::Widgets Qt5::Test) 140*1ee847caSNicolas Bonnefon 141*1ee847caSNicolas Bonnefonadd_executable(glogg_ptests 142*1ee847caSNicolas Bonnefon ${glogg_SOURCES} 143*1ee847caSNicolas Bonnefon ${FileWatcherEngine_SOURCES} 144*1ee847caSNicolas Bonnefon ${glogg_PTESTS} 145*1ee847caSNicolas Bonnefon itests.cpp 146*1ee847caSNicolas Bonnefon) 147*1ee847caSNicolas Bonnefon 148*1ee847caSNicolas Bonnefontarget_link_libraries(glogg_ptests gmock gtest pthread Qt5::Widgets Qt5::Test) 149*1ee847caSNicolas Bonnefon 15084af0c9bSNicolas Bonnefonadd_test( 15184af0c9bSNicolas Bonnefon NAME glogg_tests 15284af0c9bSNicolas Bonnefon COMMAND glogg_tests 15384af0c9bSNicolas Bonnefon) 154