X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=CMakeLists.txt;h=3b41bff7980c1d1dcd7ba28870d846e42a556d1e;hp=2448a32f3e00229897925fac339ef90bfe479586;hb=60b0c2daf2291a8358e3905515c1dfa47956590f;hpb=075fb4995aaaf521502571d26da62a6923555eff diff --git a/CMakeLists.txt b/CMakeLists.txt index 2448a32f..3b41bff7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,11 +28,11 @@ project(pulseview) #------------------------------------------------------------------------------- option(ENABLE_TESTS "Enable unit tests" FALSE) -option(STATIC_PKGDEPS_LIBS "Statically link to sigrok libraries" FALSE) +option(STATIC_PKGDEPS_LIBS "Statically link to (pkgconfig) libraries" FALSE) if(WIN32) - # On Windows/MinGW we need to statically link to libraries - # This option is user configurable, but enable it by default on win32 + # On Windows/MinGW we need to statically link to libraries. + # This option is user configurable, but enable it by default on win32. set(STATIC_PKGDEPS_LIBS TRUE) endif() @@ -49,15 +49,23 @@ pkg_check_modules(PKGDEPS REQUIRED # On Windows/MinGW we explicitly point cmake to the Boost directory. if(WIN32) set(BOOST_ROOT /usr/local) -endif(WIN32) +endif() find_package(Qt4 REQUIRED) + +if(ENABLE_TESTS) find_package(Boost 1.46 COMPONENTS unit_test_framework REQUIRED) +else() +find_package(Boost 1.46) +endif() #=============================================================================== #= Config Header #------------------------------------------------------------------------------- +set(PV_TITLE PulseView) +set(PV_DESCRIPTION "A GUI for sigrok") + set(PV_VERSION_MAJOR 0) set(PV_VERSION_MINOR 1) set(PV_VERSION_MICRO 0) @@ -111,13 +119,6 @@ set(pulseview_RESOURCES pulseview.qrc ) -set(pulseview_TEST_SOURCES - pv/datasnapshot.cpp - pv/logicdatasnapshot.cpp - test/logicdatasnapshot.cpp - test/test.cpp -) - qt4_wrap_cpp(pulseview_HEADERS_MOC ${pulseview_HEADERS}) qt4_wrap_ui(pulseview_FORMS_HEADERS ${pulseview_FORMS}) qt4_add_resources(pulseview_RESOURCES_RCC ${pulseview_RESOURCES}) @@ -136,6 +137,7 @@ add_definitions(${QT_DEFINITIONS}) include_directories( ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} ${Boost_INCLUDE_DIRS} ) @@ -164,36 +166,27 @@ else() list(APPEND PULSEVIEW_LINK_LIBS ${PKGDEPS_LIBRARIES}) endif() -add_executable(pulseview +add_executable(${PROJECT_NAME} ${pulseview_SOURCES} ${pulseview_HEADERS_MOC} ${pulseview_FORMS_HEADERS} ${pulseview_RESOURCES_RCC} ) -target_link_libraries(pulseview ${PULSEVIEW_LINK_LIBS}) +target_link_libraries(${PROJECT_NAME} ${PULSEVIEW_LINK_LIBS}) #=============================================================================== #= Installation #------------------------------------------------------------------------------- -install(PROGRAMS pulseview DESTINATION bin/) +install(PROGRAMS ${PROJECT_NAME} DESTINATION bin/) #=============================================================================== #= Tests #------------------------------------------------------------------------------- if(ENABLE_TESTS) - - add_definitions(-DBOOST_TEST_DYN_LINK) - - add_executable(pulseview-test - ${pulseview_TEST_SOURCES} - ) - - target_link_libraries(pulseview-test ${PULSEVIEW_LINK_LIBS}) - + add_subdirectory(test) enable_testing() - add_test(test ${CMAKE_CURRENT_BINARY_DIR}/pulseview-test) - + add_test(test ${CMAKE_CURRENT_BINARY_DIR}/test/pulseview-test) endif(ENABLE_TESTS)