update: Merge compiled scripts

This commit is contained in:
dreamsourcelabTAI 2022-05-16 16:51:19 +08:00
parent 10736a198f
commit 7b94e61bee
56 changed files with 680 additions and 4886 deletions

View File

@ -37,13 +37,10 @@ if (FFTW_INCLUDE_DIR AND FFTW_LIBRARY)
${FFTW_INCLUDE_DIR}
)
set(FFTW_LIBRARYS
set(FFTW_LIBRARIES
${FFTW_LIBRARY}
)
message(STATUS "Found FFTW:")
message(STATUS " - includes: ${FFTW_INCLUDE_DIR}")
message(STATUS " - libraries: ${FFTW_LIBRARY}")
endif(FFTW_INCLUDE_DIR AND FFTW_LIBRARY)

View File

@ -84,9 +84,9 @@ else (LIBUSB_1_LIBRARIES AND LIBUSB_1_INCLUDE_DIRS)
if (LIBUSB_1_FOUND)
if (NOT libusb_1_FIND_QUIETLY)
message(STATUS "Found libusb-1.0:")
message(STATUS " - Includes: ${LIBUSB_1_INCLUDE_DIRS}")
message(STATUS " - Libraries: ${LIBUSB_1_LIBRARIES}")
#message(STATUS "Found libusb-1.0:")
# message(STATUS " - Includes: ${LIBUSB_1_INCLUDE_DIRS}")
# message(STATUS " - Libraries: ${LIBUSB_1_LIBRARIES}")
endif (NOT libusb_1_FIND_QUIETLY)
else (LIBUSB_1_FOUND)
if (libusb_1_FIND_REQUIRED)

626
CMakeLists.txt Executable file
View File

@ -0,0 +1,626 @@
##
## This file is part of the DSView project.
##
## Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
## Copyright (C) 2012-2013 Alexandru Gagniuc <mr.nuke.me@gmail.com>
## Copyright (C) 2013-2022 DreamSourceLab <support@dreamsourcelab.com>
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 2 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
##
cmake_minimum_required(VERSION 2.8.6)
project(DSView)
#===============================================================================
#= Config Header
#-------------------------------------------------------------------------------
set(DS_TITLE DSView)
set(DS_DESCRIPTION "A GUI for instruments of DreamSourceLab")
set(DS_VERSION_MAJOR 1)
set(DS_VERSION_MINOR 2)
set(DS_VERSION_MICRO 0)
set(DS_VERSION_STRING ${DS_VERSION_MAJOR}.${DS_VERSION_MINOR}.${DS_VERSION_MICRO}-RC7 )
configure_file (
${PROJECT_SOURCE_DIR}/DSView/config.h.in
${PROJECT_BINARY_DIR}/DSView/config.h
)
#===============================================================================
#=pkg config
#-------------------------------------------------------------------------------
include(FindPkgConfig)
include(GNUInstallDirs)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake")
find_package(PkgConfig)
#===============================================================================
#= User Options
#-------------------------------------------------------------------------------
set(DISABLE_WERROR TRUE) #Build without -Werror
set(ENABLE_SIGNALS TRUE) #Build with UNIX signals
set(ENABLE_COTIRE FALSE) #Enable cotire
set(ENABLE_TESTS FALSE) #Enable unit tests
set(STATIC_PKGDEPS_LIBS FALSE) #Statically link to (pkg-config) libraries
if(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)
# Windows does not support UNIX signals.
set(ENABLE_SIGNALS FALSE)
endif()
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE)
endif()
#===============================================================================
#= glib-2.0
#-------------------------------------------------------------------------------
pkg_search_module(GLIB REQUIRED glib-2.0)
message("-- glib-2.0:")
MESSAGE(STATUS " - includes:" ${GLIB_INCLUDE_DIRS})
MESSAGE(STATUS " - libraries:" ${GLIB_LIBRARIES})
include_directories(${GLIB_INCLUDE_DIRS})
link_directories(${GLIB_LIBRARIES_DIRS})
#===============================================================================
#= python3
#-------------------------------------------------------------------------------
find_package(PythonLibs 3 REQUIRED)
message("-- python3:")
MESSAGE(STATUS " - includes:" ${PYTHON_INCLUDE_DIR})
MESSAGE(STATUS " - libraries:" ${PYTHON_LIBRARIES})
include_directories(${PYTHON_INCLUDE_DIR})
link_directories(${PYTHON_LIBRARIES})
#===============================================================================
#= FFTW
#-------------------------------------------------------------------------------
find_package(FFTW REQUIRED)
message("-- FFTW:")
MESSAGE(STATUS " - includes:" ${FFTW_INCLUDE_DIRS})
MESSAGE(STATUS " - libraries:" ${FFTW_LIBRARIES})
include_directories(${FFTW_INCLUDE_DIRS})
link_directories(${FFTW_LIBRARIES})
#===============================================================================
#= libusb-1.0
#-------------------------------------------------------------------------------
find_package(libusb-1.0 REQUIRED)
message("-- libusb-1.0:")
MESSAGE(STATUS " - includes:" ${LIBUSB_1_INCLUDE_DIRS})
MESSAGE(STATUS " - libraries:" ${LIBUSB_1_LIBRARIES})
include_directories(${LIBUSB_1_INCLUDE_DIRS})
link_directories(${LIBUSB_1_LIBRARIES})
#===============================================================================
#= zlib
#-------------------------------------------------------------------------------
find_package(ZLIB REQUIRED)
message("-- zlib:")
MESSAGE(STATUS " - includes:" ${ZLIB_INCLUDE_DIRS})
MESSAGE(STATUS " - libraries:" ${ZLIB_LIBRARIES})
include_directories(${ZLIB_INCLUDE_DIRS})
link_directories(${ZLIB_LIBRARIES})
#===============================================================================
#= libzip
#-------------------------------------------------------------------------------
find_package(libzip REQUIRED)
message("-- libzip:")
MESSAGE(STATUS " - includes:" ${PC_LIBZIP_INCLUDE_DIRS})
MESSAGE(STATUS " - libraries:" ${PC_LIBZIP_LIBRARIES})
include_directories(${PC_LIBZIP_INCLUDE_DIRS})
link_directories(${PC_LIBZIP_LIBRARIES})
#===============================================================================
#= Qt5
#-------------------------------------------------------------------------------
find_package(Qt5Core REQUIRED)
if(Qt5Core_FOUND)
message("-- Qt5:")
MESSAGE(STATUS " - includes:" ${Qt5Core_INCLUDE_DIRS})
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Gui REQUIRED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
set(QT_INCLUDE_DIRS ${Qt5Gui_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS})
set(QT_LIBRARIES Qt5::Gui Qt5::Widgets)
add_definitions(${Qt5Gui_DEFINITIONS} ${Qt5Widgets_DEFINITIONS})
else()
message(FATAL_ERROR "-- Have not fond qt5 core, please install it!")
endif()
#===============================================================================
#= Dependencies
#-------------------------------------------------------------------------------
list(APPEND PKGDEPS
)
###pkg_check_modules(PKGDEPS REQUIRED ${PKGDEPS})
find_package(Threads)
find_package(Boost 1.42 REQUIRED)
#===============================================================================
#= DSView sources
#-------------------------------------------------------------------------------
set(DSView_SOURCES
DSView/main.cpp
DSView/dsapplication.cpp
DSView/pv/sigsession.cpp
DSView/pv/mainwindow.cpp
DSView/pv/devicemanager.cpp
DSView/pv/data/snapshot.cpp
DSView/pv/data/signaldata.cpp
DSView/pv/data/logicsnapshot.cpp
DSView/pv/data/logic.cpp
DSView/pv/data/analogsnapshot.cpp
DSView/pv/data/analog.cpp
DSView/pv/dialogs/deviceoptions.cpp
DSView/pv/prop/property.cpp
DSView/pv/prop/int.cpp
DSView/pv/prop/enum.cpp
DSView/pv/prop/double.cpp
DSView/pv/prop/bool.cpp
DSView/pv/prop/binding/binding.cpp
DSView/pv/toolbars/samplingbar.cpp
DSView/pv/view/viewport.cpp
DSView/pv/view/view.cpp
DSView/pv/view/timemarker.cpp
DSView/pv/view/signal.cpp
DSView/pv/view/ruler.cpp
DSView/pv/view/logicsignal.cpp
DSView/pv/view/header.cpp
DSView/pv/view/cursor.cpp
DSView/pv/view/analogsignal.cpp
DSView/pv/prop/binding/deviceoptions.cpp
DSView/pv/toolbars/trigbar.cpp
DSView/pv/toolbars/filebar.cpp
DSView/pv/dock/protocoldock.cpp
DSView/pv/dock/triggerdock.cpp
DSView/pv/dock/measuredock.cpp
DSView/pv/dock/searchdock.cpp
DSView/pv/toolbars/logobar.cpp
DSView/pv/data/groupsnapshot.cpp
DSView/pv/view/groupsignal.cpp
DSView/pv/data/group.cpp
DSView/pv/dialogs/about.cpp
DSView/pv/dialogs/search.cpp
DSView/pv/data/dsosnapshot.cpp
DSView/pv/data/dso.cpp
DSView/pv/view/dsosignal.cpp
DSView/pv/view/dsldial.cpp
DSView/pv/dock/dsotriggerdock.cpp
DSView/pv/view/trace.cpp
DSView/pv/view/selectableitem.cpp
DSView/pv/data/decoderstack.cpp
DSView/pv/data/decode/rowdata.cpp
DSView/pv/data/decode/row.cpp
DSView/pv/data/decode/decoder.cpp
DSView/pv/data/decode/annotation.cpp
DSView/pv/view/decodetrace.cpp
DSView/pv/prop/binding/decoderoptions.cpp
DSView/pv/widgets/fakelineedit.cpp
DSView/pv/widgets/decodermenu.cpp
DSView/pv/widgets/decodergroupbox.cpp
DSView/pv/prop/string.cpp
DSView/pv/device/sessionfile.cpp
DSView/pv/device/inputfile.cpp
DSView/pv/device/file.cpp
DSView/pv/device/devinst.cpp
DSView/pv/dialogs/storeprogress.cpp
DSView/pv/storesession.cpp
DSView/pv/view/devmode.cpp
DSView/pv/device/device.cpp
DSView/pv/dialogs/waitingdialog.cpp
DSView/pv/dialogs/dsomeasure.cpp
DSView/pv/dialogs/calibration.cpp
DSView/pv/data/decodermodel.cpp
DSView/pv/dialogs/protocollist.cpp
DSView/pv/dialogs/protocolexp.cpp
DSView/pv/dialogs/fftoptions.cpp
DSView/pv/data/mathstack.cpp
DSView/pv/view/mathtrace.cpp
DSView/pv/toolbars/titlebar.cpp
DSView/pv/mainframe.cpp
DSView/pv/widgets/border.cpp
DSView/pv/dialogs/dsmessagebox.cpp
DSView/pv/dialogs/shadow.cpp
DSView/pv/dialogs/dsdialog.cpp
DSView/pv/dialogs/interval.cpp
DSView/pv/prop/binding/probeoptions.cpp
DSView/pv/view/viewstatus.cpp
DSView/pv/dialogs/lissajousoptions.cpp
DSView/pv/view/lissajoustrace.cpp
DSView/pv/view/spectrumtrace.cpp
DSView/pv/data/spectrumstack.cpp
DSView/pv/dialogs/mathoptions.cpp
DSView/pv/dialogs/regionoptions.cpp
DSView/pv/view/xcursor.cpp
DSView/pv/dock/protocoldock.cpp
DSView/pv/data/decoderstack.cpp
DSView/pv/data/decode/annotation.cpp
DSView/pv/data/decode/decoder.cpp
DSView/pv/data/decode/row.cpp
DSView/pv/data/decode/rowdata.cpp
DSView/pv/prop/binding/decoderoptions.cpp
DSView/pv/view/decodetrace.cpp
DSView/pv/widgets/decodergroupbox.cpp
DSView/pv/widgets/decodermenu.cpp
DSView/pv/config/appconfig.cpp
DSView/pv/appcontrol.cpp
DSView/pv/dstimer.cpp
DSView/pv/eventobject.cpp
DSView/pv/ZipMaker.cpp
DSView/pv/data/decode/annotationrestable.cpp
DSView/pv/data/decode/decoderstatus.cpp
DSView/pv/dock/protocolitemlayer.cpp
DSView/pv/ui/msgbox.cpp
DSView/pv/ui/dscombobox.cpp
DSView/pv/dsvdef.cpp
DSView/pv/minizip/zip.c
DSView/pv/minizip/unzip.c
DSView/pv/minizip/ioapi.c
DSView/pv/dialogs/applicationpardlg.cpp
DSView/pv/dock/keywordlineedit.cpp
DSView/pv/dock/searchcombobox.cpp
DSView/pv/dialogs/decoderoptionsdlg.cpp
)
set(DSView_HEADERS
DSView/mystyle.h
DSView/pv/sigsession.h
DSView/pv/mainwindow.h
DSView/pv/dialogs/deviceoptions.h
DSView/pv/prop/property.h
DSView/pv/prop/int.h
DSView/pv/prop/enum.h
DSView/pv/prop/double.h
DSView/pv/prop/bool.h
DSView/pv/toolbars/samplingbar.h
DSView/pv/view/viewport.h
DSView/pv/view/view.h
DSView/pv/view/timemarker.h
DSView/pv/view/ruler.h
DSView/pv/view/header.h
DSView/pv/view/cursor.h
DSView/pv/toolbars/trigbar.h
DSView/pv/toolbars/filebar.h
DSView/pv/dock/protocoldock.h
DSView/pv/dock/triggerdock.h
DSView/pv/dock/measuredock.h
DSView/pv/dock/searchdock.h
DSView/pv/toolbars/logobar.h
DSView/pv/dialogs/about.h
DSView/pv/dialogs/search.h
DSView/pv/dock/dsotriggerdock.h
DSView/pv/view/trace.h
DSView/pv/view/selectableitem.h
DSView/pv/data/decoderstack.h
DSView/pv/view/decodetrace.h
DSView/pv/widgets/fakelineedit.h
DSView/pv/widgets/decodermenu.h
DSView/pv/widgets/decodergroupbox.h
DSView/pv/prop/string.h
DSView/pv/device/devinst.h
DSView/pv/dialogs/storeprogress.h
DSView/pv/storesession.h
DSView/pv/view/devmode.h
DSView/pv/dialogs/waitingdialog.h
DSView/pv/dialogs/dsomeasure.h
DSView/pv/dialogs/calibration.h
DSView/pv/dialogs/protocollist.h
DSView/pv/dialogs/protocolexp.h
DSView/pv/dialogs/fftoptions.h
DSView/pv/data/mathstack.h
DSView/pv/view/mathtrace.h
DSView/pv/view/viewstatus.h
DSView/pv/toolbars/titlebar.h
DSView/pv/mainframe.h
DSView/pv/widgets/border.h
DSView/pv/dialogs/dsmessagebox.h
DSView/pv/dialogs/shadow.h
DSView/pv/dialogs/dsdialog.h
DSView/pv/dialogs/interval.h
DSView/pv/dialogs/lissajousoptions.h
DSView/pv/view/lissajoustrace.h
DSView/pv/view/spectrumtrace.h
DSView/pv/data/spectrumstack.h
DSView/pv/dialogs/mathoptions.h
DSView/pv/dialogs/regionoptions.h
DSView/pv/view/xcursor.h
DSView/pv/view/signal.h
DSView/pv/view/logicsignal.h
DSView/pv/view/analogsignal.h
DSView/pv/view/dsosignal.h
DSView/pv/dock/protocoldock.h
DSView/pv/data/decoderstack.h
DSView/pv/view/decodetrace.h
DSView/pv/widgets/decodergroupbox.h
DSView/pv/widgets/decodermenu.h
DSView/pv/config/appconfig.h
DSView/pv/appcontrol.h
DSView/pv/dstimer.h
DSView/pv/eventobject.h
DSView/pv/ZipMaker.h
DSView/pv/data/decode/annotationrestable.h
DSView/pv/data/decode/decoderstatus.h
DSView/pv/dock/protocolitemlayer.h
DSView/pv/ui/msgbox.h
DSView/pv/ui/dscombobox.h
DSView/pv/dsvdef.h
DSView/pv/minizip/zip.h
DSView/pv/minizip/unzip.h
DSView/pv/minizip/ioapi.h
DSView/pv/dialogs/applicationpardlg.h
DSView/pv/dock/keywordlineedit.h
DSView/pv/dock/searchcombobox.h
DSView/pv/dialogs/decoderoptionsdlg.h
)
#===============================================================================
#= libsigrok4DSL source
#-------------------------------------------------------------------------------
set(libsigrok4DSL_SOURCES
libsigrok4DSL/version.c
libsigrok4DSL/strutil.c
libsigrok4DSL/std.c
libsigrok4DSL/session_file.c
libsigrok4DSL/session_driver.c
libsigrok4DSL/session.c
libsigrok4DSL/log.c
libsigrok4DSL/hwdriver.c
libsigrok4DSL/error.c
libsigrok4DSL/backend.c
libsigrok4DSL/output/output.c
libsigrok4DSL/input/input.c
libsigrok4DSL/hardware/demo/demo.c
libsigrok4DSL/input/in_binary.c
libsigrok4DSL/input/in_vcd.c
libsigrok4DSL/input/in_wav.c
libsigrok4DSL/output/csv.c
libsigrok4DSL/output/gnuplot.c
libsigrok4DSL/output/srzip.c
libsigrok4DSL/output/vcd.c
libsigrok4DSL/hardware/DSL/dslogic.c
libsigrok4DSL/hardware/common/usb.c
libsigrok4DSL/hardware/common/ezusb.c
libsigrok4DSL/trigger.c
libsigrok4DSL/dsdevice.c
libsigrok4DSL/hardware/DSL/dscope.c
libsigrok4DSL/hardware/DSL/command.c
libsigrok4DSL/hardware/DSL/dsl.c
)
set(libsigrok4DSL_HEADERS
libsigrok4DSL/version.h
libsigrok4DSL/proto.h
libsigrok4DSL/libsigrok-internal.h
libsigrok4DSL/libsigrok.h
libsigrok4DSL/config.h
libsigrok4DSL/hardware/DSL/command.h
libsigrok4DSL/hardware/DSL/dsl.h
)
#===============================================================================
#= libsigrokdecode4DSL source
#-------------------------------------------------------------------------------
set(libsigrokdecode4DSL_SOURCES
libsigrokdecode4DSL/type_decoder.c
libsigrokdecode4DSL/srd.c
libsigrokdecode4DSL/module_sigrokdecode.c
libsigrokdecode4DSL/decoder.c
libsigrokdecode4DSL/error.c
libsigrokdecode4DSL/exception.c
libsigrokdecode4DSL/instance.c
libsigrokdecode4DSL/log.c
libsigrokdecode4DSL/session.c
libsigrokdecode4DSL/util.c
libsigrokdecode4DSL/version.c
)
set(libsigrokdecode4DSL_HEADERS
libsigrokdecode4DSL/libsigrokdecode-internal.h
libsigrokdecode4DSL/libsigrokdecode.h
libsigrokdecode4DSL/config.h
libsigrokdecode4DSL/version.h
)
set(DSView_FORMS
)
set(DSView_RESOURCES
DSView/DSView.qrc
DSView/themes/breeze.qrc
DSView/languages/language.qrc
)
if(WIN32)
# Use the DSView icon for the DSView.exe executable.
set(CMAKE_RC_COMPILE_OBJECT "${CMAKE_RC_COMPILER} -O coff -I${CMAKE_CURRENT_SOURCE_DIR} <SOURCE> <OBJECT>")
enable_language(RC)
list(APPEND DSView_SOURCES DSView/DSView.rc)
endif()
if(Qt5Core_FOUND)
qt5_wrap_cpp(DSView_HEADERS_MOC ${DSView_HEADERS})
qt5_wrap_ui(DSView_FORMS_HEADERS ${DSView_FORMS})
qt5_add_resources(DSView_RESOURCES_RCC ${DSView_RESOURCES})
endif()
#===============================================================================
#= Global Definitions
#-------------------------------------------------------------------------------
add_definitions(${QT_DEFINITIONS})
add_definitions(-Wall -Wextra -Wno-return-type -Wno-ignored-qualifiers)
if(NOT DISABLE_WERROR)
add_definitions(-Werror)
endif()
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
#===============================================================================
#= Global Include Directories
#-------------------------------------------------------------------------------
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${Boost_INCLUDE_DIRS}
${QT_INCLUDE_DIRS}
)
include_directories(
./DSView
./libsigrok4DSL
./libsigrokdecode4DSL
)
if(STATIC_PKGDEPS_LIBS)
include_directories(${PKGDEPS_STATIC_INCLUDE_DIRS})
else()
include_directories(${PKGDEPS_INCLUDE_DIRS})
endif()
#===============================================================================
#= Release flags
#-------------------------------------------------------------------------------
set(CMAKE_CXX_FLAGS "-Wall -Wextra")
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
add_compile_options(-O3)
#===============================================================================
#= Linker Configuration
#-------------------------------------------------------------------------------
link_directories(${Boost_LIBRARY_DIRS})
set(DSVIEW_LINK_LIBS
${CMAKE_THREAD_LIBS_INIT}
${Boost_LIBRARIES}
${QT_LIBRARIES}
${LIBUSB_1_LIBRARIES}
${FFTW_LIBRARIES}
${PYTHON_LIBRARIES}
${GLIB_LIBRARIES}
${ZLIB_LIBRARIES}
${PC_LIBZIP_LIBRARIES}
)
if(STATIC_PKGDEPS_LIBS)
link_directories(${PKGDEPS_STATIC_LIBRARY_DIRS})
list(APPEND DSVIEW_LINK_LIBS ${PKGDEPS_STATIC_LIBRARIES})
if(WIN32)
# Workaround for a MinGW linking issue.
list(APPEND PULSEVIEW_LINK_LIBS "-llzma -llcms2")
endif()
else()
link_directories(${PKGDEPS_LIBRARY_DIRS})
list(APPEND DSVIEW_LINK_LIBS ${PKGDEPS_LIBRARIES})
endif()
add_executable(${PROJECT_NAME}
${DSView_SOURCES}
${DSView_HEADERS_MOC}
${DSView_FORMS_HEADERS}
${DSView_RESOURCES_RCC}
${libsigrok4DSL_SOURCES}
${libsigrokdecode4DSL_SOURCES}
)
target_link_libraries(${PROJECT_NAME} ${DSVIEW_LINK_LIBS})
if(WIN32)
# Pass -mwindows so that no "DOS box" will open when PulseView is started.
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-mwindows")
endif()
if(ENABLE_COTIRE)
include(cotire)
cotire(${PROJECT_NAME})
endif()
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/build")
#===============================================================================
#= Installation
#-------------------------------------------------------------------------------
# Install the executable.
install(TARGETS ${PROJECT_NAME} DESTINATION bin)
install(DIRECTORY DSView/res DESTINATION share/DSView)
install(FILES DSView/icons/logo.svg DESTINATION share/DSView RENAME logo.svg)
install(FILES DSView/icons/logo.svg DESTINATION share/icons/hicolor/scalable/apps RENAME dsview.svg)
install(FILES DSView/icons/logo.svg DESTINATION share/pixmaps RENAME dsview.svg)
install(FILES DSView/DreamSourceLab.rules DESTINATION /lib/udev/rules.d RENAME 60-dreamsourcelab.rules)
install(FILES DSView/DSView.desktop DESTINATION /usr/share/applications RENAME dsview.desktop)
install(FILES NEWS25 DESTINATION share/DSView RENAME NEWS25)
install(FILES NEWS31 DESTINATION share/DSView RENAME NEWS31)
install(FILES ug25.pdf DESTINATION share/DSView RENAME ug25.pdf)
install(FILES ug31.pdf DESTINATION share/DSView RENAME ug31.pdf)
install(DIRECTORY libsigrokdecode4DSL/decoders DESTINATION share/libsigrokdecode4DSL)
#===============================================================================
#= Packaging (handled by CPack)
#-------------------------------------------------------------------------------
set(CPACK_PACKAGE_VERSION_MAJOR ${DS_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${DS_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${DS_VERSION_MICRO})
set(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_CURRENT_SOURCE_DIR}/DSView/README)
set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/DSView/COPYING)
set(CPACK_SOURCE_IGNORE_FILES ${CMAKE_CURRENT_BINARY_DIR} ".gitignore" ".git")
set(CPACK_SOURCE_PACKAGE_FILE_NAME
"${CMAKE_PROJECT_NAME}-${DS_VERSION_MAJOR}.${DS_VERSION_MINOR}.${DS_VERSION_MICRO}")
set(CPACK_SOURCE_GENERATOR "TGZ")
include(CPack)
#===============================================================================
#= Tests
#-------------------------------------------------------------------------------
if(ENABLE_TESTS)
add_subdirectory(test)
enable_testing()
add_test(test ${CMAKE_CURRENT_BINARY_DIR}/DSView/test/DSView-test)
endif(ENABLE_TESTS)

View File

@ -1,44 +0,0 @@
#libsigrok4DSL
#LIBSIGROK4DSL
FIND_PATH(LIBSIGROK4DSL_INCLUDE_DIR
NAMES
libsigrok.h
PATHS
/usr/local/include
/usr/include
PATH_SUFFIXES
libsigrok4DSL
)
FIND_LIBRARY(LIBSIGROK4DSL_LIBRARY
NAMES
sigrok4DSL
PATHS
/usr/local/lib
/usr/lib
PATH_SUFFIXES
libsigrok4DSL
)
if (LIBSIGROK4DSL_INCLUDE_DIR AND LIBSIGROK4DSL_LIBRARY)
set (LIBSIGROK4DSL_FOUND TRUE)
set(LIBSIGROK4DSL_INCLUDE_DIRS
${LIBSIGROK4DSL_INCLUDE_DIR}
)
set(LIBSIGROK4DSL_LIBRARYS
${LIBSIGROK4DSL_LIBRARY}
)
message(STATUS "Found libsigrok4DSL:")
message(STATUS " - includes: ${LIBSIGROK4DSL_INCLUDE_DIR}")
message(STATUS " - libraries: ${LIBSIGROK4DSL_LIBRARY}")
endif(LIBSIGROK4DSL_INCLUDE_DIR AND LIBSIGROK4DSL_LIBRARY)

View File

@ -1,44 +0,0 @@
#libsigrokdecode4DSL
#LIBSIGROKDECODE4DSL
FIND_PATH(LIBSIGROKDECODE4DSL_INCLUDE_DIR
NAMES
libsigrokdecode.h
PATHS
/usr/local/include
/usr/include
PATH_SUFFIXES
libsigrokdecode4DSL
)
FIND_LIBRARY(LIBSIGROKDECODE4DSL_LIBRARY
NAMES
sigrokdecode4DSL
PATHS
/usr/local/lib
/usr/lib
PATH_SUFFIXES
libsigrokdecode4DSL
)
if (LIBSIGROKDECODE4DSL_INCLUDE_DIR AND LIBSIGROKDECODE4DSL_LIBRARY)
set (LIBSIGROKDECODE4DSL_FOUND TRUE)
set(LIBSIGROKDECODE4DSL_INCLUDE_DIRS
${LIBSIGROKDECODE4DSL_INCLUDE_DIR}
)
set(LIBSIGROKDECODE4DSL_LIBRARYS
${LIBSIGROKDECODE4DSL_LIBRARY}
)
message(STATUS "Found libsigrokdecode4DSL:")
message(STATUS " - includes: ${LIBSIGROKDECODE4DSL_INCLUDE_DIR}")
message(STATUS " - libraries: ${LIBSIGROKDECODE4DSL_LIBRARY}")
endif(LIBSIGROKDECODE4DSL_INCLUDE_DIR AND LIBSIGROKDECODE4DSL_LIBRARY)

View File

@ -1,518 +0,0 @@
##
## This file is part of the DSView project.
##
## Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
## Copyright (C) 2012-2013 Alexandru Gagniuc <mr.nuke.me@gmail.com>
## Copyright (C) 2013-2014 DreamSourceLab <support@dreamsourcelab.com>
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 2 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
##
cmake_minimum_required(VERSION 2.8.6)
include(FindPkgConfig)
include(GNUInstallDirs)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake")
set(CMAKE_CXX_FLAGS "-Wall -Wextra")
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
project(DSView)
#===============================================================================
#= User Options
#-------------------------------------------------------------------------------
option(DISABLE_WERROR "Build without -Werror" TRUE)
option(ENABLE_SIGNALS "Build with UNIX signals" TRUE)
option(ENABLE_COTIRE "Enable cotire" FALSE)
option(ENABLE_TESTS "Enable unit tests" FALSE)
option(STATIC_PKGDEPS_LIBS "Statically link to (pkg-config) libraries" FALSE)
option(FORCE_QT4 "Force use of Qt4 even if Qt5 is available" 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.
set(STATIC_PKGDEPS_LIBS TRUE)
# Windows does not support UNIX signals.
set(ENABLE_SIGNALS FALSE)
endif()
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE)
endif()
#===============================================================================
#= Dependencies
#-------------------------------------------------------------------------------
list(APPEND PKGDEPS
"libzip >= 0.10"
"libusb-1.0 >= 1.0.16"
)
find_package(PkgConfig)
pkg_check_modules(PKGDEPS REQUIRED ${PKGDEPS})
pkg_search_module(GLIB REQUIRED glib-2.0)
message("-- glib-2.0:")
MESSAGE(STATUS " - includes:" ${GLIB_INCLUDE_DIRS})
MESSAGE(STATUS " - libraries:" ${GLIB_LIBRARIES})
include_directories(${GLIB_INCLUDE_DIRS})
link_directories(${GLIB_LIBRARIES_DIRS})
if(FORCE_QT4)
set(Qt5Core_FOUND FALSE)
message("- Set qt5core fond flase")
else()
#=============
# try to find qt5 package
#=============
find_package(Qt5Core QUIET)
endif()
if(Qt5Core_FOUND)
message("-- Using Qt5:")
message(" - includes:${Qt5Core_INCLUDE_DIRS}")
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Gui REQUIRED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
set(QT_INCLUDE_DIRS ${Qt5Gui_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS})
set(QT_LIBRARIES Qt5::Gui Qt5::Widgets)
add_definitions(${Qt5Gui_DEFINITIONS} ${Qt5Widgets_DEFINITIONS})
else()
message(WARNING "-- Have not fond qt5 core, please install it!")
find_program(QT_QMAKE_EXECUTABLE NAMES qmake4 qmake-qt4 qmake-mac)
find_package(Qt4 REQUIRED)
endif()
find_package(Threads)
find_package(PythonLibs 3 EXACT)
find_package(Boost 1.42 REQUIRED)
find_package(libusb-1.0 REQUIRED)
find_package(ZLIB REQUIRED)
find_package(libzip REQUIRED)
find_package(FFTW REQUIRED)
find_package(libsigrok4DSL REQUIRED)
find_package(libsigrokdecode4DSL REQUIRED)
#===============================================================================
#= Config Header
#-------------------------------------------------------------------------------
set(DS_TITLE DSView)
set(DS_DESCRIPTION "A GUI for instruments of DreamSourceLab")
set(DS_VERSION_MAJOR 1)
set(DS_VERSION_MINOR 2)
set(DS_VERSION_MICRO 0)
set(DS_VERSION_STRING
${DS_VERSION_MAJOR}.${DS_VERSION_MINOR}.${DS_VERSION_MICRO}-RC6
)
configure_file (
${PROJECT_SOURCE_DIR}/config.h.in
${PROJECT_BINARY_DIR}/config.h
)
#===============================================================================
#= Sources
#-------------------------------------------------------------------------------
set(DSView_SOURCES
main.cpp
pv/sigsession.cpp
pv/mainwindow.cpp
pv/devicemanager.cpp
pv/data/snapshot.cpp
pv/data/signaldata.cpp
pv/data/logicsnapshot.cpp
pv/data/logic.cpp
pv/data/analogsnapshot.cpp
pv/data/analog.cpp
pv/dialogs/deviceoptions.cpp
pv/prop/property.cpp
pv/prop/int.cpp
pv/prop/enum.cpp
pv/prop/double.cpp
pv/prop/bool.cpp
pv/prop/binding/binding.cpp
pv/toolbars/samplingbar.cpp
pv/view/viewport.cpp
pv/view/view.cpp
pv/view/timemarker.cpp
pv/view/signal.cpp
pv/view/ruler.cpp
pv/view/logicsignal.cpp
pv/view/header.cpp
pv/view/cursor.cpp
pv/view/analogsignal.cpp
pv/prop/binding/deviceoptions.cpp
pv/toolbars/trigbar.cpp
pv/toolbars/filebar.cpp
pv/dock/protocoldock.cpp
pv/dock/triggerdock.cpp
pv/dock/measuredock.cpp
pv/dock/searchdock.cpp
pv/toolbars/logobar.cpp
pv/data/groupsnapshot.cpp
pv/view/groupsignal.cpp
pv/data/group.cpp
pv/dialogs/about.cpp
pv/dialogs/search.cpp
pv/data/dsosnapshot.cpp
pv/data/dso.cpp
pv/view/dsosignal.cpp
pv/view/dsldial.cpp
pv/dock/dsotriggerdock.cpp
pv/view/trace.cpp
pv/view/selectableitem.cpp
pv/data/decoderstack.cpp
pv/data/decode/rowdata.cpp
pv/data/decode/row.cpp
pv/data/decode/decoder.cpp
pv/data/decode/annotation.cpp
pv/view/decodetrace.cpp
pv/prop/binding/decoderoptions.cpp
pv/widgets/fakelineedit.cpp
pv/widgets/decodermenu.cpp
pv/widgets/decodergroupbox.cpp
pv/prop/string.cpp
pv/device/sessionfile.cpp
pv/device/inputfile.cpp
pv/device/file.cpp
pv/device/devinst.cpp
pv/dialogs/storeprogress.cpp
pv/storesession.cpp
pv/view/devmode.cpp
pv/device/device.cpp
pv/dialogs/waitingdialog.cpp
pv/dialogs/dsomeasure.cpp
pv/dialogs/calibration.cpp
pv/data/decodermodel.cpp
pv/dialogs/protocollist.cpp
pv/dialogs/protocolexp.cpp
pv/dialogs/fftoptions.cpp
pv/data/mathstack.cpp
pv/view/mathtrace.cpp
dsapplication.cpp
pv/toolbars/titlebar.cpp
pv/mainframe.cpp
pv/widgets/border.cpp
pv/dialogs/dsmessagebox.cpp
pv/dialogs/shadow.cpp
pv/dialogs/dsdialog.cpp
pv/dialogs/interval.cpp
pv/prop/binding/probeoptions.cpp
pv/view/viewstatus.cpp
pv/dialogs/lissajousoptions.cpp
pv/view/lissajoustrace.cpp
pv/view/spectrumtrace.cpp
pv/data/spectrumstack.cpp
pv/dialogs/mathoptions.cpp
pv/dialogs/regionoptions.cpp
pv/view/xcursor.cpp
pv/config/appconfig.cpp
pv/appcontrol.cpp
pv/dstimer.cpp
pv/eventobject.cpp
pv/ZipMaker.cpp
pv/data/decode/annotationrestable.cpp
pv/data/decode/decoderstatus.cpp
pv/dock/protocolitemlayer.cpp
pv/ui/msgbox.cpp
pv/ui/dscombobox.cpp
pv/dsvdef.cpp
pv/minizip/zip.c
pv/minizip/unzip.c
pv/minizip/ioapi.c
pv/dialogs/applicationpardlg.cpp
pv/dock/keywordlineedit.cpp
pv/dock/searchcombobox.cpp
pv/dialogs/decoderoptionsdlg.cpp
)
set(DSView_HEADERS
pv/sigsession.h
pv/mainwindow.h
pv/dialogs/deviceoptions.h
pv/prop/property.h
pv/prop/int.h
pv/prop/enum.h
pv/prop/double.h
pv/prop/bool.h
pv/toolbars/samplingbar.h
pv/view/viewport.h
pv/view/view.h
pv/view/timemarker.h
pv/view/ruler.h
pv/view/header.h
pv/view/cursor.h
pv/toolbars/trigbar.h
pv/toolbars/filebar.h
pv/dock/protocoldock.h
pv/dock/triggerdock.h
pv/dock/measuredock.h
pv/dock/searchdock.h
pv/toolbars/logobar.h
pv/dialogs/about.h
pv/dialogs/search.h
pv/dock/dsotriggerdock.h
pv/view/trace.h
pv/view/selectableitem.h
pv/data/decoderstack.h
pv/view/decodetrace.h
pv/widgets/fakelineedit.h
pv/widgets/decodermenu.h
pv/widgets/decodergroupbox.h
pv/prop/string.h
pv/device/devinst.h
pv/dialogs/storeprogress.h
pv/storesession.h
pv/view/devmode.h
pv/dialogs/waitingdialog.h
pv/dialogs/dsomeasure.h
pv/dialogs/calibration.h
pv/dialogs/protocollist.h
pv/dialogs/protocolexp.h
pv/dialogs/fftoptions.h
pv/data/mathstack.h
pv/view/mathtrace.h
pv/view/viewstatus.h
pv/toolbars/titlebar.h
pv/mainframe.h
pv/widgets/border.h
pv/dialogs/dsmessagebox.h
pv/dialogs/shadow.h
pv/dialogs/dsdialog.h
pv/dialogs/interval.h
pv/dialogs/lissajousoptions.h
pv/view/lissajoustrace.h
pv/view/spectrumtrace.h
pv/data/spectrumstack.h
pv/dialogs/mathoptions.h
pv/dialogs/regionoptions.h
pv/view/xcursor.h
pv/view/signal.h
pv/view/logicsignal.h
pv/view/analogsignal.h
pv/view/dsosignal.h
mystyle.h
pv/config/appconfig.h
pv/appcontrol.h
pv/dstimer.h
pv/eventobject.h
pv/ZipMaker.h
pv/data/decode/annotationrestable.h
pv/data/decode/decoderstatus.h
pv/dock/protocolitemlayer.h
pv/ui/msgbox.h
pv/ui/dscombobox.h
pv/dsvdef.h
pv/minizip/zip.h
pv/minizip/unzip.h
pv/minizip/ioapi.h
pv/dialogs/applicationpardlg.h
pv/dock/keywordlineedit.h
pv/dock/searchcombobox.h
pv/dialogs/decoderoptionsdlg.h
)
set(DSView_FORMS
)
set(DSView_RESOURCES
DSView.qrc
themes/breeze.qrc
languages/language.qrc
)
list(APPEND DSView_SOURCES
pv/dock/protocoldock.cpp
pv/data/decoderstack.cpp
pv/data/decode/annotation.cpp
pv/data/decode/decoder.cpp
pv/data/decode/row.cpp
pv/data/decode/rowdata.cpp
pv/prop/binding/decoderoptions.cpp
pv/view/decodetrace.cpp
pv/widgets/decodergroupbox.cpp
pv/widgets/decodermenu.cpp
)
list(APPEND DSView_HEADERS
pv/dock/protocoldock.h
pv/data/decoderstack.h
pv/view/decodetrace.h
pv/widgets/decodergroupbox.h
pv/widgets/decodermenu.h
)
if(WIN32)
# Use the DSView icon for the DSView.exe executable.
set(CMAKE_RC_COMPILE_OBJECT "${CMAKE_RC_COMPILER} -O coff -I${CMAKE_CURRENT_SOURCE_DIR} <SOURCE> <OBJECT>")
enable_language(RC)
list(APPEND DSView_SOURCES DSView.rc)
endif()
if(Qt5Core_FOUND)
qt5_wrap_cpp(DSView_HEADERS_MOC ${DSView_HEADERS})
qt5_wrap_ui(DSView_FORMS_HEADERS ${DSView_FORMS})
qt5_add_resources(DSView_RESOURCES_RCC ${DSView_RESOURCES})
else()
qt4_wrap_cpp(DSView_HEADERS_MOC ${DSView_HEADERS})
qt4_wrap_ui(DSView_FORMS_HEADERS ${DSView_FORMS})
qt4_add_resources(DSView_RESOURCES_RCC ${DSView_RESOURCES})
include(${QT_USE_FILE})
endif()
#===============================================================================
#= Global Definitions
#-------------------------------------------------------------------------------
add_definitions(${QT_DEFINITIONS})
add_definitions(-std=c++11 -Wall -Wextra -Wno-return-type -Wno-ignored-qualifiers)
add_definitions(-DENABLE_DECODE)
if(NOT DISABLE_WERROR)
add_definitions(-Werror)
endif()
#===============================================================================
#= Global Include Directories
#-------------------------------------------------------------------------------
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${Boost_INCLUDE_DIRS}
${QT_INCLUDE_DIRS}
)
if(STATIC_PKGDEPS_LIBS)
include_directories(${PKGDEPS_STATIC_INCLUDE_DIRS})
else()
include_directories(${PKGDEPS_INCLUDE_DIRS})
endif()
#===============================================================================
#= Linker Configuration
#-------------------------------------------------------------------------------
link_directories(${Boost_LIBRARY_DIRS})
set(DSVIEW_LINK_LIBS
${Boost_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
${QT_LIBRARIES}
${LIBUSB_1_LIBRARIES}
${FFTW_LIBRARIES}
)
if(STATIC_PKGDEPS_LIBS)
link_directories(${PKGDEPS_STATIC_LIBRARY_DIRS})
list(APPEND DSVIEW_LINK_LIBS ${PKGDEPS_STATIC_LIBRARIES})
if(WIN32)
# Workaround for a MinGW linking issue.
list(APPEND PULSEVIEW_LINK_LIBS "-llzma -llcms2")
endif()
else()
link_directories(${PKGDEPS_LIBRARY_DIRS})
list(APPEND DSVIEW_LINK_LIBS ${PKGDEPS_LIBRARIES})
endif()
list(APPEND DSVIEW_LINK_LIBS ${PYTHON_LIBRARIES})
add_executable(${PROJECT_NAME}
${DSView_SOURCES}
${DSView_HEADERS_MOC}
${DSView_FORMS_HEADERS}
${DSView_RESOURCES_RCC}
)
target_link_libraries(${PROJECT_NAME} ${DSVIEW_LINK_LIBS})
if(WIN32)
# Pass -mwindows so that no "DOS box" will open when PulseView is started.
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-mwindows")
endif()
target_link_libraries(${PROJECT_NAME} -lz)
target_link_libraries(${PROJECT_NAME} ${GLIB_LIBRARIES})
target_link_libraries(${PROJECT_NAME} ${LIBSIGROK4DSL_LIBRARY})
target_link_libraries(${PROJECT_NAME} ${LIBSIGROKDECODE4DSL_LIBRARY})
target_link_libraries(${PROJECT_NAME} ${LIBUSB_1_LIBRARIES})
target_link_libraries(${PROJECT_NAME} ${PYTHON_LIBRARIES})
target_link_libraries(${PROJECT_NAME} ${FFTW_LIBRARYS})
if(ENABLE_COTIRE)
include(cotire)
cotire(${PROJECT_NAME})
endif()
set_target_properties(${PROJECT_NAME} PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
#===============================================================================
#= Installation
#-------------------------------------------------------------------------------
# Install the executable.
install(TARGETS ${PROJECT_NAME} DESTINATION bin)
install(DIRECTORY res DESTINATION share/${PROJECT_NAME})
install(FILES icons/logo.svg DESTINATION share/${PROJECT_NAME} RENAME logo.svg)
install(FILES icons/logo.svg DESTINATION share/icons/hicolor/scalable/apps RENAME dsview.svg)
install(FILES icons/logo.svg DESTINATION share/pixmaps RENAME dsview.svg)
install(FILES ../NEWS25 DESTINATION share/${PROJECT_NAME} RENAME NEWS25)
install(FILES ../NEWS31 DESTINATION share/${PROJECT_NAME} RENAME NEWS31)
install(FILES ../ug25.pdf DESTINATION share/${PROJECT_NAME} RENAME ug25.pdf)
install(FILES ../ug31.pdf DESTINATION share/${PROJECT_NAME} RENAME ug31.pdf)
install(FILES DreamSourceLab.rules DESTINATION /lib/udev/rules.d RENAME 60-dreamsourcelab.rules)
install(FILES DSView.desktop DESTINATION /usr/share/applications RENAME dsview.desktop)
#===============================================================================
#= Packaging (handled by CPack)
#-------------------------------------------------------------------------------
set(CPACK_PACKAGE_VERSION_MAJOR ${DS_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${DS_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${DS_VERSION_MICRO})
set(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_CURRENT_SOURCE_DIR}/README)
set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/COPYING)
set(CPACK_SOURCE_IGNORE_FILES ${CMAKE_CURRENT_BINARY_DIR} ".gitignore" ".git")
set(CPACK_SOURCE_PACKAGE_FILE_NAME
"${CMAKE_PROJECT_NAME}-${DS_VERSION_MAJOR}.${DS_VERSION_MINOR}.${DS_VERSION_MICRO}")
set(CPACK_SOURCE_GENERATOR "TGZ")
include(CPack)
#===============================================================================
#= Tests
#-------------------------------------------------------------------------------
if(ENABLE_TESTS)
add_subdirectory(test)
enable_testing()
add_test(test ${CMAKE_CURRENT_BINARY_DIR}/test/DSView-test)
endif(ENABLE_TESTS)

View File

@ -1,49 +0,0 @@
-------------------------------------------------------------------------------
INSTALL
-------------------------------------------------------------------------------
Requirements
------------
- git
- g++
- make
- libtool
- pkg-config >= 0.22
- cmake >= 2.6
- libglib >= 2.28.0
- Qt >= 4.5
- libboost >= 1.42 (including the following libs):
- libboost-system
- libboost-thread
- libsigrok4DSL >= 0.2.0
Building and installing
-----------------------
Get the DSView source code from: www.dreamsourcelab.com/download.html
In order to build it, run:
$ cd DSView
$ cmake .
$ make
For installing PulseView:
$ make install
See the following wiki page for more (OS-specific) instructions:
http://sigrok.org/wiki/Building
Creating a source distribution package
--------------------------------------
In order to build a source package begin with an unconfigured source tree.
$ mkdir dist
$ cd dist
$ cmake ..
$ make package_source

View File

@ -1,13 +0,0 @@
echo "rm cmake cache begin..."
rm ./cmake_install.cmake
rm -r ./CMakeFiles
rm ./Makefile
rm ./CMakeCache.txt
rm ./*.cmake
rm ./DSView
rm ./DSView.qrc.depends
sudo rm ./install_manifest.txt
find . -name 'moc_*.cpp*' | xargs rm -rf
find . -name 'qrc_*.cpp' | xargs rm -rf
echo "rm cmake cache end..."

View File

@ -30,6 +30,6 @@
#define DS_VERSION_MAJOR 1
#define DS_VERSION_MINOR 2
#define DS_VERSION_MICRO 0
#define DS_VERSION_STRING "1.2.0-RC6"
#define DS_VERSION_STRING "1.2.0-RC7"
#endif

View File

@ -41,8 +41,7 @@
#ifdef _WIN32
#include <windows.h>
#endif
//#include <libsigrok4DSL/libsigrok.h>
void usage()
{

View File

@ -21,8 +21,8 @@
#include "appcontrol.h"
#include <libsigrok4DSL/libsigrok.h>
#include <libsigrokdecode4DSL/libsigrokdecode.h>
#include "libsigrok.h"
#include "libsigrokdecode.h"
#include <QDir>
#include <QCoreApplication>
#include <QDebug>

View File

@ -24,7 +24,7 @@
#ifndef DSVIEW_PV_DATA_ANALOGSNAPSHOT_H
#define DSVIEW_PV_DATA_ANALOGSNAPSHOT_H
#include <libsigrok4DSL/libsigrok.h>
#include "libsigrok.h"
#include "snapshot.h"

View File

@ -20,7 +20,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <libsigrokdecode4DSL/libsigrokdecode.h>
#include "libsigrokdecode.h"
#include <vector>
#include <assert.h>

View File

@ -20,7 +20,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <libsigrokdecode4DSL/libsigrokdecode.h>
#include "libsigrokdecode.h"
#include "decoder.h"
#include <assert.h>

View File

@ -21,7 +21,7 @@
#include "row.h"
#include <libsigrokdecode4DSL/libsigrokdecode.h>
#include "libsigrokdecode.h"
#include <assert.h>
namespace pv {

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <libsigrokdecode4DSL/libsigrokdecode.h>
#include "libsigrokdecode.h"
#include "decode/annotation.h"
#include "decode/rowdata.h"

View File

@ -23,7 +23,7 @@
#ifndef DSVIEW_PV_DATA_DECODERSTACK_H
#define DSVIEW_PV_DATA_DECODERSTACK_H
#include <libsigrokdecode4DSL/libsigrokdecode.h>
#include "libsigrokdecode.h"
#include <list>
#include <boost/optional.hpp>
#include <QObject>

View File

@ -27,7 +27,7 @@
#include <vector>
#include <map>
#include <libsigrok4DSL/libsigrok.h>
#include "libsigrok.h"
#include "snapshot.h"
namespace DsoSnapshotTest {

View File

@ -24,7 +24,7 @@
#ifndef DSVIEW_PV_DATA_LOGICSNAPSHOT_H
#define DSVIEW_PV_DATA_LOGICSNAPSHOT_H
#include <libsigrok4DSL/libsigrok.h>
#include "libsigrok.h"
#include "snapshot.h"

View File

@ -28,7 +28,7 @@
#include <glib.h>
#include <stdint.h>
#include <libsigrok4DSL/libsigrok.h>
#include "libsigrok.h"
struct sr_dev_inst;
struct sr_channel;

View File

@ -20,7 +20,7 @@
*/
#include "decoderoptionsdlg.h"
#include <libsigrokdecode4DSL/libsigrokdecode.h>
#include "libsigrokdecode.h"
#include <QScrollArea>
#include <QDialogButtonBox>
#include <assert.h>

View File

@ -37,7 +37,7 @@
#include <QRadioButton>
#include <QTimer>
#include <libsigrok4DSL/libsigrok.h>
#include "libsigrok.h"
#include "../device/devinst.h"
#include "../prop/binding/deviceoptions.h"
#include "../prop/binding/probeoptions.h"

View File

@ -23,7 +23,7 @@
#ifndef DSVIEW_PV_PROTOCOLDOCK_H
#define DSVIEW_PV_PROTOCOLDOCK_H
#include <libsigrokdecode4DSL/libsigrokdecode.h>
#include "libsigrokdecode.h"
#include <QDockWidget>
#include <QPushButton>

View File

@ -35,7 +35,7 @@
#include <QApplication>
#include <math.h>
#include <libsigrok4DSL/libsigrok.h>
#include "libsigrok.h"
namespace pv {
namespace dock {

View File

@ -19,12 +19,10 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <libsigrokdecode4DSL/libsigrokdecode.h>
#include "libsigrokdecode.h"
#include "decoderoptions.h"
#include <boost/bind.hpp>
#include <boost/bind.hpp>
#include <boost/none_t.hpp>
#include "../../data/decoderstack.h"

View File

@ -29,7 +29,7 @@
#include <QString>
#include <libsigrok4DSL/libsigrok.h>
#include "libsigrok.h"
#include "binding.h"
namespace pv {

View File

@ -28,7 +28,7 @@
#include <QString>
#include <libsigrok4DSL/libsigrok.h>
#include "libsigrok.h"
#include "binding.h"
namespace pv {

View File

@ -21,8 +21,7 @@
*/
#include <libsigrokdecode4DSL/libsigrokdecode.h>
#include "libsigrokdecode.h"
#include "sigsession.h"
#include "mainwindow.h"

View File

@ -37,7 +37,7 @@
#include "interface/icallbacks.h"
#include "dstimer.h"
#include <libsigrok4DSL/libsigrok.h>
#include "libsigrok.h"
struct srd_decoder;
struct srd_channel;

View File

@ -56,7 +56,7 @@
#include <QTextCodec>
#endif
#include <libsigrokdecode4DSL/libsigrokdecode.h>
#include "libsigrokdecode.h"
#include "config/appconfig.h"
#include "dsvdef.h"

View File

@ -27,7 +27,7 @@
#include <string>
#include <thread>
#include <QObject>
#include <libsigrok4DSL/libsigrok.h>
#include "libsigrok.h"
#include "interface/icallbacks.h"

View File

@ -27,7 +27,7 @@
#include <QToolButton>
#include <QAction>
#include <QMenu>
#include <libsigrok4DSL/libsigrok.h>
#include "libsigrok.h"
#include "../sigsession.h"
#include "../interface/uicallback.h"

View File

@ -20,13 +20,11 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <libsigrokdecode4DSL/libsigrokdecode.h>
#include "libsigrokdecode.h"
#include "../dsvdef.h"
#include <boost/functional/hash.hpp>
#include <QAction>
#include <QFormLayout>
#include <QLabel>

View File

@ -34,7 +34,7 @@
#include <QToolButton>
#include <QLabel>
#include <libsigrok4DSL/libsigrok.h>
#include "libsigrok.h"
namespace pv {

View File

@ -20,7 +20,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <libsigrokdecode4DSL/libsigrokdecode.h>
#include "libsigrokdecode.h"
#include <QDebug>
#include <math.h>

View File

@ -34,7 +34,7 @@
#include <stdint.h>
#include <list>
#include <libsigrok4DSL/libsigrok.h>
#include "libsigrok.h"
#include "trace.h"
namespace pv {

View File

@ -28,7 +28,7 @@
#include <QPushButton>
#include <QToolButton>
#include <libsigrok4DSL/libsigrok.h>
#include "libsigrok.h"
namespace pv {

View File

@ -19,7 +19,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <libsigrokdecode4DSL/libsigrokdecode.h>
#include "libsigrokdecode.h"
#include "decodergroupbox.h"
#include "../data/decoderstack.h"

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <libsigrokdecode4DSL/libsigrokdecode.h>
#include "libsigrokdecode.h"
#include "decodermenu.h"
#include <assert.h>

43
INSTALL
View File

@ -26,16 +26,13 @@ Requirements
- check >= 0.9.4 (optional, only needed to run unit tests)
- libfftw3 >= 3.3
- zlib (on ubuntu, zlib package name is zlib1g-dev)
Building and installing
-----------------------
Step1: Get the DSView source code, and switch to right branch, the newest branch is dev-tai
$ git clone git://github.com/DreamSourceLab/DSView
Step2: Installing the requirements:
Step1: Installing the requirements:
please check your respective distro's package manager tool if you use other distros
Debian/Ubuntu:
@ -53,39 +50,15 @@ Arch:
python boost qt5 fftw
Step2: Get the DSView source code
$ git clone https://github.com/DreamSourceLab/DSView
Step3: Building
$ cd libsigrok4DSL
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install
$ cd ..
$ cd libsigrokdecode4DSL
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install
$ cd ..
$ cd DSView
$ cmake .
/*
* If this step fails,
* make sure that your pkg-config is properly configured
* to find the libsigrok and libsigrokdecode libraries
* (It's not by default in Fedora 23).
* To do this add "export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig"
* or "export PKG_CONFIG_PATH=/usr/lib/pkgconfig"
* or "export PKG_CONFIG_PATH=/usr/lib64/pkgconfig"
* to your ~/.bashrc and reload it `. ~/.bashrc`.
*/
$ make
$ make
$ sudo make install
See the following wiki page for more (OS-specific) instructions:
http://sigrok.org/wiki/Building

1
clean Executable file
View File

@ -0,0 +1 @@
./cmake_clear

View File

@ -1,12 +1,16 @@
echo "rm cmake cache begin..."
rm ./cmake_install.cmake
sudo rm -r ./build
rm -r ./CMakeFiles
rm ./cmake_install.cmake
rm ./Makefile
rm ./CMakeCache.txt
rm ./*.cmake
rm ./DSView
rm ./DSView.qrc.depends
#rm ./install_manifest.txt
find . -name 'moc_*.cpp*' | xargs rm -rf
find . -name 'qrc_*.cpp' | xargs rm -rf
rm ./install_manifest.txt
echo "rm cmake cache end..."

View File

@ -1,370 +0,0 @@
Installation Instructions
*************************
Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation,
Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved. This file is offered as-is,
without warranty of any kind.
Basic Installation
==================
Briefly, the shell commands `./configure; make; make install' should
configure, build, and install this package. The following
more-detailed instructions are generic; see the `README' file for
instructions specific to this package. Some packages provide this
`INSTALL' file but do not implement all of the features documented
below. The lack of an optional feature in a given package is not
necessarily a bug. More recommendations for GNU packages can be found
in *note Makefile Conventions: (standards)Makefile Conventions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, and a
file `config.log' containing compiler output (useful mainly for
debugging `configure').
It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=config.cache' or simply `-C') that saves
the results of its tests to speed up reconfiguring. Caching is
disabled by default to prevent problems with accidental use of stale
cache files.
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If you are using the cache, and at
some point `config.cache' contains results you don't want to keep, you
may remove or edit it.
The file `configure.ac' (or `configure.in') is used to create
`configure' by a program called `autoconf'. You need `configure.ac' if
you want to change it or regenerate `configure' using a newer version
of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system.
Running `configure' might take a while. While running, it prints
some messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package, generally using the just-built uninstalled binaries.
4. Type `make install' to install the programs and any data files and
documentation. When installing into a prefix owned by root, it is
recommended that the package be configured and built as a regular
user, and only the `make install' phase executed with root
privileges.
5. Optionally, type `make installcheck' to repeat any self-tests, but
this time using the binaries in their final installed location.
This target does not install anything. Running this target as a
regular user, particularly if the prior `make install' required
root privileges, verifies that the installation completed
correctly.
6. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
7. Often, you can also type `make uninstall' to remove the installed
files again. In practice, not all packages have tested that
uninstallation works correctly, even though it is required by the
GNU Coding Standards.
8. Some packages, particularly those that use Automake, provide `make
distcheck', which can by used by developers to test that all other
targets like `make install' and `make uninstall' work correctly.
This target is generally not run by end users.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. Run `./configure --help'
for details on some of the pertinent environment variables.
You can give `configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here
is an example:
./configure CC=c99 CFLAGS=-g LIBS=-lposix
*Note Defining Variables::, for more details.
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you can use GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'. This
is known as a "VPATH" build.
With a non-GNU `make', it is safer to compile the package for one
architecture at a time in the source code directory. After you have
installed the package for one architecture, use `make distclean' before
reconfiguring for another architecture.
On MacOS X 10.5 and later systems, you can create libraries and
executables that work on multiple system types--known as "fat" or
"universal" binaries--by specifying multiple `-arch' options to the
compiler but only a single `-arch' option to the preprocessor. Like
this:
./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
CPP="gcc -E" CXXCPP="g++ -E"
This is not guaranteed to produce working output in all cases, you
may have to build one architecture at a time and combine the results
using the `lipo' tool if you have problems.
Installation Names
==================
By default, `make install' installs the package's commands under
`/usr/local/bin', include files under `/usr/local/include', etc. You
can specify an installation prefix other than `/usr/local' by giving
`configure' the option `--prefix=PREFIX', where PREFIX must be an
absolute file name.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
PREFIX as the prefix for installing programs and libraries.
Documentation and other data files still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=DIR' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them. In general, the
default for these options is expressed in terms of `${prefix}', so that
specifying just `--prefix' will affect all of the other directory
specifications that were not explicitly provided.
The most portable way to affect installation locations is to pass the
correct locations to `configure'; however, many packages provide one or
both of the following shortcuts of passing variable assignments to the
`make install' command line to change installation locations without
having to reconfigure or recompile.
The first method involves providing an override variable for each
affected directory. For example, `make install
prefix=/alternate/directory' will choose an alternate location for all
directory configuration variables that were expressed in terms of
`${prefix}'. Any directories that were specified during `configure',
but not in terms of `${prefix}', must each be overridden at install
time for the entire installation to be relocated. The approach of
makefile variable overrides for each directory variable is required by
the GNU Coding Standards, and ideally causes no recompilation.
However, some platforms have known limitations with the semantics of
shared libraries that end up requiring recompilation when using this
method, particularly noticeable in packages that use GNU Libtool.
The second method involves providing the `DESTDIR' variable. For
example, `make install DESTDIR=/alternate/directory' will prepend
`/alternate/directory' before all installation names. The approach of
`DESTDIR' overrides is not required by the GNU Coding Standards, and
does not work on platforms that have drive letters. On the other hand,
it does better at avoiding recompilation issues, and works well even
when some directory options were not specified in terms of `${prefix}'
at `configure' time.
Optional Features
=================
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Some packages offer the ability to configure how verbose the
execution of `make' will be. For these packages, running `./configure
--enable-silent-rules' sets the default to minimal output, which can be
overridden with `make V=1'; while running `./configure
--disable-silent-rules' sets the default to verbose, which can be
overridden with `make V=0'.
Particular systems
==================
On HP-UX, the default C compiler is not ANSI C compatible. If GNU
CC is not installed, it is recommended to use the following options in
order to use an ANSI C compiler:
./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
and if that doesn't work, install pre-built binaries of GCC for HP-UX.
HP-UX `make' updates targets which have the same time stamps as
their prerequisites, which makes it generally unusable when shipped
generated files such as `configure' are involved. Use GNU `make'
instead.
On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
parse its `<wchar.h>' header file. The option `-nodtk' can be used as
a workaround. If GNU CC is not installed, it is therefore recommended
to try
./configure CC="cc"
and if that doesn't work, try
./configure CC="cc -nodtk"
On Solaris, don't put `/usr/ucb' early in your `PATH'. This
directory contains several dysfunctional programs; working variants of
these programs are available in `/usr/bin'. So, if you need `/usr/ucb'
in your `PATH', put it _after_ `/usr/bin'.
On Haiku, software installed for all users goes in `/boot/common',
not `/usr/local'. It is recommended to use the following options:
./configure --prefix=/boot/common
Specifying the System Type
==========================
There may be some features `configure' cannot figure out
automatically, but needs to determine by the type of machine the package
will run on. Usually, assuming the package is built to be run on the
_same_ architectures, `configure' can figure that out, but if it prints
a message saying it cannot guess the machine type, give it the
`--build=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name which has the form:
CPU-COMPANY-SYSTEM
where SYSTEM can have one of these forms:
OS
KERNEL-OS
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the machine type.
If you are _building_ compiler tools for cross-compiling, you should
use the option `--target=TYPE' to select the type of system they will
produce code for.
If you want to _use_ a cross compiler, that generates code for a
platform different from the build platform, you should specify the
"host" platform (i.e., that on which the generated programs will
eventually be run) with `--host=TYPE'.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Defining Variables
==================
Variables not defined in a site shell script can be set in the
environment passed to `configure'. However, some packages may run
configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
them in the `configure' command line, using `VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc
causes the specified `gcc' to be used as the C compiler (unless it is
overridden in the site shell script).
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
an Autoconf bug. Until the bug is fixed you can use this workaround:
CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
`configure' Invocation
======================
`configure' recognizes the following options to control how it
operates.
`--help'
`-h'
Print a summary of all of the options to `configure', and exit.
`--help=short'
`--help=recursive'
Print a summary of the options unique to this package's
`configure', and exit. The `short' variant lists options used
only in the top level, while the `recursive' variant lists options
also present in any nested packages.
`--version'
`-V'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`--cache-file=FILE'
Enable the cache: use and save the results of the tests in FILE,
traditionally `config.cache'. FILE defaults to `/dev/null' to
disable caching.
`--config-cache'
`-C'
Alias for `--cache-file=config.cache'.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`--prefix=DIR'
Use DIR as the installation prefix. *note Installation Names::
for more details, including other options available for fine-tuning
the installation locations.
`--no-create'
`-n'
Run the configure checks, but stop before creating any output
files.
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.

View File

@ -1,73 +0,0 @@
##
## This file is part of the libsigrok4DSL project.
##
## Copyright (C) 2010-2012 Bert Vermeulen <bert@biot.com>
## Copyright (C) 2012 Alexandru Gagniuc <mr.nuke.me@gmail.com>
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
##
ACLOCAL_AMFLAGS = -I autostuff
AM_CPPFLAGS = \
-I$(top_srcdir) \
-I/usr/include/glib-2.0
export AM_CPPFLAGS
SUBDIRS = hardware input output tests
lib_LTLIBRARIES = libsigrok4DSL.la
libsigrok4DSL_la_SOURCES = \
backend.c \
dsdevice.c \
session.c \
session_file.c \
session_driver.c \
hwdriver.c \
strutil.c \
log.c \
trigger.c \
version.c \
error.c \
std.c
libsigrok4DSL_la_LIBADD = \
$(LIBOBJS) \
hardware/libsigrok4DSLhardware.la \
input/libsigrok4DSLinput.la \
output/libsigrok4DSLoutput.la
libsigrok4DSL_la_LDFLAGS = $(SR_LIB_LDFLAGS)
library_includedir = $(includedir)/libsigrok4DSL
library_include_HEADERS = libsigrok.h proto.h version.h
noinst_HEADERS = libsigrok-internal.h
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libsigrok4DSL.pc
EXTRA_DIST = Doxyfile README.devices
MAINTAINERCLEANFILES = ChangeLog
.PHONY: ChangeLog
ChangeLog:
git --git-dir $(top_srcdir)/.git log > ChangeLog || touch ChangeLog
dist-hook: ChangeLog

View File

@ -1,60 +0,0 @@
#!/bin/sh
##
## This file is part of the libsigrok project.
##
## Copyright (C) 2010-2012 Bert Vermeulen <bert@biot.com>
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
##
OS=`uname`
LIBTOOLIZE=libtoolize
ACLOCAL_DIR=
if [ "x$OS" = "xDarwin" ]; then
LIBTOOLIZE=glibtoolize
if [ -d /sw/share/aclocal ]; then
# fink installs aclocal macros here
ACLOCAL_DIR="-I /sw/share/aclocal"
elif [ -d /opt/local/share/aclocal ]; then
# Macports installs aclocal macros here
ACLOCAL_DIR="-I /opt/local/share/aclocal"
elif [ -d /usr/local/share/aclocal ]; then
# Homebrew installs aclocal macros here
ACLOCAL_DIR="-I /usr/local/share/aclocal"
elif [ -d /usr/share/aclocal ]; then
# Xcode installs aclocal macros here
ACLOCAL_DIR="-I /usr/share/aclocal"
fi
elif [ "x$OS" = "xMINGW32_NT-5.1" ]; then
# Windows XP
ACLOCAL_DIR="-I /usr/local/share/aclocal"
elif [ "x$OS" = "xMINGW32_NT-6.0" ]; then
# Windows Vista
ACLOCAL_DIR="-I /usr/local/share/aclocal"
elif [ "x$OS" = "xMINGW32_NT-6.1" ]; then
# Windows 7
ACLOCAL_DIR="-I /usr/local/share/aclocal"
fi
echo "Generating build system..."
${LIBTOOLIZE} --install --copy --quiet || exit 1
aclocal ${ACLOCAL_DIR} || exit 1
autoheader || exit 1
automake --add-missing --copy || exit 1
autoconf || exit 1

View File

@ -1,270 +0,0 @@
##
## This file is part of the libsigrok project.
##
## Copyright (C) 2010-2012 Bert Vermeulen <bert@biot.com>
## Copyright (C) 2012 Alexandru Gagniuc <mr.nuke.me@gmail.com>
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
##
# We require at least autoconf 2.63 (AC_INIT format changed there).
AC_PREREQ([2.63])
# libsigrok package version number (NOT the same as shared lib version!).
m4_define([sr_package_version_major], [0])
m4_define([sr_package_version_minor], [2])
m4_define([sr_package_version_micro], [0])
m4_define([sr_package_version], [sr_package_version_major.sr_package_version_minor.sr_package_version_micro])
AC_INIT([libsigrok4DSL], [sr_package_version], [support@dreamsourcelab.com],
[libsigrok4DSL], [http://www.dreamsourcelab.com])
AC_CONFIG_HEADER([config.h])
AC_CONFIG_MACRO_DIR([autostuff])
AC_CONFIG_AUX_DIR([autostuff])
# We require at least automake 1.11 (needed for 'silent rules').
AM_INIT_AUTOMAKE([1.11 -Wall -Werror check-news color-tests])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
AH_TOP([#ifndef SR_CONFIG_H
#define SR_CONFIG_H /* To stop multiple inclusions. */])
AH_BOTTOM([#endif /* SR_CONFIG_H */])
# Enable more compiler warnings via -Wall and -Wextra. Add -fvisibility=hidden
# and enforce use of SR_API to explicitly mark all public API functions.
CFLAGS="$CFLAGS -Wall -Wextra -fvisibility=hidden -ludev -Wl,--rpath=/usr/local/lib"
# Checks for programs.
AC_PROG_CC
AC_PROG_CC_STDC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
# https://github.com/rsyslog/rsyslog/issues/1179
# Seems libtool doesn't honors ARFLAGS, but statically set AR_FLAGS=cru
# This causes a few warnings on build:
# "ar u modifier ignored since D is the default (see U)"
m4_divert_text([DEFAULTS], [: "${ARFLAGS=cr} ${AR_FLAGS=cr}"])
# Required for per-target flags or subdir-objects with C sources.
AM_PROG_CC_C_O
# Initialize libtool.
LT_INIT
# Initialize pkg-config.
# We require at least 0.22, as "Requires.private" behaviour changed there.
PKG_PROG_PKG_CONFIG([0.22])
# Library version for libsigrok (NOT the same as the package version).
# Carefully read the libtool docs before updating these numbers!
# The algorithm for determining which number to change (and how) is nontrivial!
# http://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info
SR_LIB_VERSION_CURRENT=1
SR_LIB_VERSION_REVISION=2
SR_LIB_VERSION_AGE=0
SR_LIB_VERSION="$SR_LIB_VERSION_CURRENT:$SR_LIB_VERSION_REVISION:$SR_LIB_VERSION_AGE"
SR_LIB_LDFLAGS="-version-info $SR_LIB_VERSION"
AC_SUBST(SR_LIB_VERSION_CURRENT)
AC_SUBST(SR_LIB_VERSION_REVISION)
AC_SUBST(SR_LIB_VERSION_AGE)
AC_SUBST(SR_LIB_VERSION)
AC_SUBST(SR_LIB_LDFLAGS)
AC_ARG_ENABLE(all-drivers, AC_HELP_STRING([--enable-all-drivers],
[enable all drivers by default [default=yes]]),
[HW_ENABLED_DEFAULT="$enableval"],
[HW_ENABLED_DEFAULT="yes"])
AC_ARG_ENABLE(demo, AC_HELP_STRING([--enable-demo],
[enable demo driver support [default=yes]]),
[HW_DEMO="$enableval"],
[HW_DEMO=$HW_ENABLED_DEFAULT])
AC_ARG_ENABLE(DSL, AC_HELP_STRING([--enable-DSL],
[enable DreamSourceLab hardware support [default=yes]]),
[HW_DSL="$enableval"],
[HW_DSL=$HW_ENABLED_DEFAULT])
# Checks for libraries.
case "$host" in
*mingw*)
# We need to link against the Winsock2 library for SCPI over TCP.
LIBS="$LIBS -lws2_32";;
esac
# This variable collects the pkg-config names of all detected libs.
# It is then used to construct the "Requires.private:" field in the
# libsigrok4DSL.pc file.
SR_PKGLIBS=""
# libm (the standard math library) is always needed.
AC_SEARCH_LIBS([pow], [m])
# libglib-2.0 is always needed. Abort if it's not found.
# Note: glib-2.0 is part of the libsigrok API (hard pkg-config requirement).
# We require at least 2.32.0 due to e.g. g_variant_new_fixed_array().
AM_PATH_GLIB_2_0([2.32.0],
[CFLAGS="$CFLAGS $GLIB_CFLAGS"; LIBS="$LIBS $GLIB_LIBS"])
# libzip is always needed. Abort if it's not found.
PKG_CHECK_MODULES([libzip], [libzip >= 0.10],
[CFLAGS="$CFLAGS $libzip_CFLAGS"; LIBS="$LIBS $libzip_LIBS";
SR_PKGLIBS="$SR_PKGLIBS libzip"])
# libserialport is only needed for some hardware drivers. Disable the
# respective drivers if it is not found.
PKG_CHECK_MODULES([libserialport], [libserialport >= 0.1.0],
[have_libserialport="yes"; CFLAGS="$CFLAGS $libserialport_CFLAGS";
LIBS="$LIBS $libserialport_LIBS";
SR_PKGLIBS="$SR_PKGLIBS libserialport"],
[have_libserialport="no"])
# Define HAVE_LIBSERIALPORT in config.h if we found libserialport.
if test "x$have_libserialport" != "xno"; then
AC_DEFINE_UNQUOTED(HAVE_LIBSERIALPORT, [1],
[Specifies whether we have libserialport.])
fi
# Serial port helper code is only compiled in if libserialport was found.
AM_CONDITIONAL(NEED_SERIAL, test "x$have_libserialport" != xno)
# libusb-1.0 is only needed for some hardware drivers. Disable the respective
# drivers if it is not found.
case "$host" in
*freebsd*)
# FreeBSD comes with an "integrated" libusb-1.0-style USB API.
# This means libusb-1.0 is always available, no need to check for it,
# and no need to (potentially) disable any drivers if it's not found.
AC_DEFINE_UNQUOTED(HAVE_LIBUSB_1_0, [1],
[Specifies whether we have a libusb.h header.])
;;
*)
PKG_CHECK_MODULES([libusb], [libusb-1.0 >= 1.0.9],
[have_libusb1_0="yes"; CFLAGS="$CFLAGS $libusb_CFLAGS";
LIBS="$LIBS $libusb_LIBS";
SR_PKGLIBS="$SR_PKGLIBS libusb-1.0"],
[have_libusb1_0="no"])
# Define HAVE_LIBUSB_1_0 in config.h if we found libusb-1.0.
if test "x$have_libusb1_0" != "xno"; then
AC_DEFINE_UNQUOTED(HAVE_LIBUSB_1_0, [1],
[Specifies whether we have a libusb.h header.])
fi
;;
esac
# The Check unit testing framework is optional. Disable if not found.
PKG_CHECK_MODULES([check], [check >= 0.9.4],
[have_check="yes"; CFLAGS="$CFLAGS $check_CFLAGS";
LIBS="$LIBS $check_LIBS"], [have_check="no"])
AM_CONDITIONAL(HAVE_CHECK, test x"$have_check" = "xyes")
# The OLS driver uses serial port file descriptors directly, and therefore
# will not currently work on Windows.
AC_SUBST(SR_PKGLIBS)
# Now set AM_CONDITIONALs and AC_DEFINEs for the enabled/disabled drivers.
AM_CONDITIONAL(HW_DEMO, test x$HW_DEMO = xyes)
if test "x$HW_DEMO" = "xyes"; then
AC_DEFINE(HAVE_LA_DEMO, 1, [Demo driver support])
fi
AM_CONDITIONAL(HW_DSL, test x$HW_DSL = xyes)
if test "x$HW_DSL" = "xyes"; then
AC_DEFINE(HAVE_DSL_DEVICE, 1, [DreamSourceLab hardware driver support])
fi
# Checks for header files.
# These are already checked: inttypes.h stdint.h stdlib.h string.h unistd.h.
AC_CHECK_HEADERS([fcntl.h sys/time.h termios.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_BIGENDIAN
AC_C_INLINE
AC_TYPE_INT8_T
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_INT64_T
AC_TYPE_UINT8_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_SIZE_T
# Checks for library functions.
AC_CHECK_FUNCS([gettimeofday memset strchr strcspn strdup strerror strncasecmp strstr strtol strtoul strtoull])
AC_SUBST(FIRMWARE_DIR, "$datadir/sigrok-firmware")
AC_SUBST(MAKEFLAGS, '--no-print-directory')
AC_SUBST(AM_LIBTOOLFLAGS, '--silent')
SR_PACKAGE_VERSION_MAJOR=sr_package_version_major
SR_PACKAGE_VERSION_MINOR=sr_package_version_minor
SR_PACKAGE_VERSION_MICRO=sr_package_version_micro
SR_PACKAGE_VERSION=sr_package_version
AC_SUBST(SR_PACKAGE_VERSION_MAJOR)
AC_SUBST(SR_PACKAGE_VERSION_MINOR)
AC_SUBST(SR_PACKAGE_VERSION_MICRO)
AC_SUBST(SR_PACKAGE_VERSION)
AC_CONFIG_FILES([Makefile version.h hardware/Makefile
hardware/demo/Makefile
hardware/common/Makefile
hardware/DSL/Makefile
input/Makefile
output/Makefile
libsigrok4DSL.pc
tests/Makefile
])
AC_OUTPUT
echo
echo "libsigrok configuration summary:"
echo
echo " - Package version (major.minor.micro): $SR_PACKAGE_VERSION"
echo " - Library version (current:revision:age): $SR_LIB_VERSION"
echo " - Prefix: $prefix"
echo " - Building on: $build"
echo " - Building for: $host"
echo
echo "Detected libraries:"
echo
# Note: This only works for libs with pkg-config integration.
for lib in "glib-2.0 >= 2.32.0" "libzip >= 0.10" "libserialport >= 0.1.0" "libusb-1.0 >= 1.0.9" "libftdi >= 0.16" "libudev >= 151" "alsa >= 1.0" "check >= 0.9.4"; do
if `$PKG_CONFIG --exists $lib`; then
ver=`$PKG_CONFIG --modversion $lib`
answer="yes ($ver)"
else
answer="no"
fi
echo " - $lib: $answer"
done
echo -e "\nEnabled hardware drivers:\n"
echo " - demo............................ $HW_DEMO"
echo " - DreamSourceLab.................. $HW_DSL"
echo

View File

@ -1,15 +0,0 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: libsigrok4DSL
Description: Backend library of DSView software based on libsigrok
URL: http://www.dreamsourcelab.com
Requires: glib-2.0
Requires.private: @SR_PKGLIBS@
Version: @VERSION@
Libs: -L${libdir} -lsigrok4DSL
Libs.private: -lm
Cflags: -I${includedir}

File diff suppressed because it is too large Load Diff

View File

@ -1,99 +0,0 @@
##
## This file is part of the libsigrokdecode project.
##
## Copyright (C) 2010 Uwe Hermann <uwe@hermann-uwe.de>
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, see <http://www.gnu.org/licenses/>.
##
ACLOCAL_AMFLAGS = -I m4
AM_LIBTOOLFLAGS = --silent
GNUMAKEFLAGS = --no-print-directory
DECODERS_DIR = $(pkgdatadir)/decoders
# Do not hard-code the decoders location on Windows.
if WIN32
AM_CPPFLAGS =
else
AM_CPPFLAGS = -DDECODERS_DIR='"$(DECODERS_DIR)"'
endif
# The tests CFLAGS are a superset of the libsigrokdecode CFLAGS.
AM_CFLAGS = $(SRD_EXTRA_CFLAGS) $(SRD_WFLAGS) $(TESTS_CFLAGS)
lib_LTLIBRARIES = libsigrokdecode4DSL.la
libsigrokdecode4DSL_la_SOURCES = \
srd.c \
session.c \
decoder.c \
instance.c \
log.c \
util.c \
exception.c \
module_sigrokdecode.c \
type_decoder.c \
error.c \
version.c
libsigrokdecode4DSL_la_LIBADD = $(SRD_EXTRA_LIBS) $(LIBSIGROKDECODE_LIBS)
libsigrokdecode4DSL_la_LDFLAGS = -version-info $(SRD_LIB_VERSION) -no-undefined
pkginclude_HEADERS = libsigrokdecode.h
nodist_pkginclude_HEADERS = version.h
noinst_HEADERS = libsigrokdecode-internal.h
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libsigrokdecode4DSL.pc
EXTRA_DIST = Doxyfile HACKING contrib/sigrok-logo-notext.png
if HAVE_CHECK
TESTS = tests/main
check_PROGRAMS = ${TESTS}
endif
tests_main_SOURCES = \
libsigrokdecode.h \
tests/lib.h \
tests/main.c \
tests/core.c \
tests/decoder.c \
tests/inst.c \
tests/session.c
tests_main_CPPFLAGS = -DDECODERS_TESTDIR='"$(abs_top_srcdir)/decoders"'
tests_main_LDADD = libsigrokdecode4DSL.la $(SRD_EXTRA_LIBS) $(TESTS_LIBS)
MAINTAINERCLEANFILES = ChangeLog
.PHONY: ChangeLog install-decoders
ChangeLog:
git --git-dir '$(top_srcdir)/.git' log >$@ || touch $@
dist-hook: ChangeLog
$(MKDIR_P) $(distdir)/tools
cp ${top_srcdir}/tools/install-decoders $(distdir)/tools
$(MKDIR_P) $(distdir)/decoders
${top_srcdir}/tools/install-decoders -i ${top_srcdir}/decoders \
-o $(distdir)/decoders
install-decoders:
$(MKDIR_P) $(DESTDIR)$(DECODERS_DIR)
$(PYTHON3) ${top_srcdir}/tools/install-decoders \
-i ${top_srcdir}/decoders -o $(DESTDIR)$(DECODERS_DIR)
install-data-hook: install-decoders

View File

@ -1,24 +0,0 @@
#!/bin/sh -e
##
## This file is part of the libsigrokdecode project.
##
## Copyright (C) 2010-2012 Bert Vermeulen <bert@biot.com>
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
##
test -n "$srcdir" || srcdir=`dirname "$0"`
test -n "$srcdir" || srcdir=.
autoreconf --force --install --verbose "$srcdir"

View File

@ -1,175 +0,0 @@
##
## This file is part of the libsigrokdecode project.
##
## Copyright (C) 2010 Bert Vermeulen <bert@biot.com>
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
##
# We require at least autoconf 2.63 (AC_INIT format changed there).
AC_PREREQ([2.63])
# libsigrokdecode package version number (NOT the same as shared lib version!).
AC_INIT([libsigrokdecode4DSL], [0.6.0],
[support@dreamsourcelab.com], [libsigrokdecode4DSL],
[http://www.dreamsourcelab.com])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([autostuff])
AC_CONFIG_HEADERS([config.h version.h])
# We require at least automake 1.11 (needed for 'silent rules').
AM_INIT_AUTOMAKE([1.11 -Wall -Werror no-define subdir-objects check-news color-tests])
AM_SILENT_RULES([yes])
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
AC_CANONICAL_HOST
# Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
# Required for per-target flags or subdir-objects with C sources.
AM_PROG_CC_C_O
# Set the standard the C library headers should conform to.
AH_VERBATIM([_POSIX_C_SOURCE], [/* The targeted POSIX standard. */
#ifndef _POSIX_C_SOURCE
# define _POSIX_C_SOURCE 200112L
#endif])
# Get compiler versions.
SR_PROG_VERSION([$CC], [srd_cc_version])
# Initialize libtool.
LT_INIT
# Set up the libsigrokdecode version defines.
SR_PKG_VERSION_SET([SRD_PACKAGE_VERSION], [AC_PACKAGE_VERSION])
# Library version for libsigrokdecode (NOT the same as the package version).
# Carefully read the libtool docs before updating these numbers!
# The algorithm for determining which number to change (and how) is nontrivial!
# http://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info
# Format: current:revision:age.
SR_LIB_VERSION_SET([SRD_LIB_VERSION], [4:0:0])
AM_CONDITIONAL([WIN32], [test -z "${host_os##mingw*}" || test -z "${host_os##cygwin*}"])
# Initialize pkg-config.
# We require at least 0.22, as "Requires.private" behaviour changed there.
PKG_PROG_PKG_CONFIG
############################
## Package dependencies ##
############################
# Initialize pkg-config.
# We require at least 0.22, as "Requires.private" behaviour changed there.
PKG_PROG_PKG_CONFIG([0.22])
# Collect the pkg-config module names of all dependencies in SRD_PKGLIBS.
# These are used to derive the compiler flags and for the "Requires.private"
# field in the generated libsigrokdecode.pc file.
SRD_PKGLIBS=
SRD_PKGLIBS_TESTS=
# Keep track of all checked modules so we can list them at the end.
SR_PKG_CHECK_SUMMARY([srd_pkglibs_summary])
# Python 3 is always needed.
SR_PKG_CHECK([python3], [SRD_PKGLIBS],
[python3 >= 3.2], [python-3.7 >= 3.7], [python-3.6 >= 3.6], [python-3.5 >= 3.5], [python-3.4 >= 3.4], [python-3.3 >= 3.3], [python-3.2 >= 3.2])
AS_IF([test "x$sr_have_python3" = xno],
[AC_MSG_ERROR([Cannot find Python 3 development headers.])])
# We also need to find the name of the python3 executable (for 'make install').
# Some OSes call this python3, some call it python3.2, etc. etc.
AC_ARG_VAR([PYTHON3], [Python 3 interpreter])
AC_CHECK_PROGS([PYTHON3], [python3.7 python3.6 python3.5 python3.4 python3.3 python3.2 python3])
AS_IF([test "x$PYTHON3" = x],
[AC_MSG_ERROR([Cannot find Python 3 interpreter.])])
######################
## Feature checks ##
######################
# Keep track of all checked modules so we can list them at the end.
SR_PKG_CHECK_SUMMARY([srd_pkglibs_opt_summary])
# The Check unit testing framework is optional. Disable if not found.
SR_PKG_CHECK([check], [SRD_PKGLIBS_TESTS], [check >= 0.9.4])
AM_CONDITIONAL([HAVE_CHECK], [test "x$sr_have_check" = xyes])
# Enable the C99 standard if possible, and enforce the use
# of SRD_API to explicitly mark all public API functions.
SRD_EXTRA_CFLAGS=
SR_CHECK_COMPILE_FLAGS([SRD_EXTRA_CFLAGS], [C99], [-std=c99 -c99 -AC99 -qlanglvl=extc99])
SR_CHECK_COMPILE_FLAGS([SRD_EXTRA_CFLAGS], [visibility], [-fvisibility=hidden])
# Select suitable compiler warning flags.
SR_ARG_ENABLE_WARNINGS([SRD_WFLAGS], [-Wall], [-Wall -Wextra -Wmissing-prototypes -Wshadow -Wformat=2 -Wno-format-nonliteral -Wfloat-equal])
# Link against libm, this is required (among other things) by Python.
SRD_EXTRA_LIBS=
SR_SEARCH_LIBS([SRD_EXTRA_LIBS], [pow], [m])
AC_SYS_LARGEFILE
AC_C_BIGENDIAN
##############################
## Finalize configuration ##
##############################
AC_SUBST([SRD_PKGLIBS])
# Retrieve the compile and link flags for all modules combined.
# Also, bail out at this point if any module dependency is not met.
PKG_CHECK_MODULES([LIBSIGROKDECODE], [glib-2.0 >= 2.34 $SRD_PKGLIBS])
PKG_CHECK_MODULES([TESTS], [$SRD_PKGLIBS_TESTS glib-2.0 $SRD_PKGLIBS])
srd_glib_version=`$PKG_CONFIG --modversion glib-2.0 2>&AS_MESSAGE_LOG_FD`
AC_DEFINE_UNQUOTED([CONF_HOST], ["$host"],
[The canonical host libsigrokdecode will run on.])
AC_CONFIG_FILES([Makefile libsigrokdecode4DSL.pc])
AC_OUTPUT
cat >&AS_MESSAGE_FD <<_EOF
libsigrokdecode configuration summary:
- Package version................. $SRD_PACKAGE_VERSION
- Library ABI version............. $SRD_LIB_VERSION
- Prefix.......................... $prefix
- Building on..................... $build
- Building for.................... $host
- Building shared / static........ $enable_shared / $enable_static
Compile configuration:
- C compiler...................... $CC
- C compiler version.............. $srd_cc_version
- C compiler flags................ $CFLAGS
- Additional C compiler flags..... $SRD_EXTRA_CFLAGS
- C compiler warnings............. $SRD_WFLAGS
- Linker flags.................... $LDFLAGS
Detected libraries (required):
- glib-2.0 >= 2.34................ $srd_glib_version
$srd_pkglibs_summary
Detected libraries (optional):
$srd_pkglibs_opt_summary
_EOF

View File

@ -1,18 +0,0 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
datarootdir=@datarootdir@
datadir=@datadir@
pkgdatadir=${datadir}/@PACKAGE_TARNAME@
decodersdir=${pkgdatadir}/decoders
Name: libsigrokdecode4DSL
Description: Protocol decoder library of DSView software based on libsigrokdecode
URL: http://www.dreamsourcelab.com
Requires: glib-2.0
Requires.private: @SRD_PKGLIBS@
Version: @SRD_PACKAGE_VERSION@
Libs: -L${libdir} -lsigrokdecode4DSL
Libs.private: @SRD_EXTRA_LIBS@
Cflags: -I${includedir}

View File

@ -1,449 +0,0 @@
##
## This file is part of the sigrok project.
##
## Copyright (C) 2009 Openismus GmbH
## Copyright (C) 2015 Daniel Elstner <daniel.kitta@gmail.com>
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
##
#serial 20150910
## SR_APPEND(var-name, [list-sep,] element)
##
## Append the shell word <element> to the shell variable named <var-name>,
## prefixed by <list-sep> unless the list was empty before appending. If
## only two arguments are supplied, <list-sep> defaults to a single space
## character.
##
AC_DEFUN([SR_APPEND],
[dnl
m4_assert([$# >= 2])[]dnl
$1=[$]{$1[}]m4_if([$#], [2], [[$]{$1:+' '}$2], [[$]{$1:+$2}$3])[]dnl
])
## SR_PREPEND(var-name, [list-sep,] element)
##
## Prepend the shell word <element> to the shell variable named <var-name>,
## suffixed by <list-sep> unless the list was empty before prepending. If
## only two arguments are supplied, <list-sep> defaults to a single space
## character.
##
AC_DEFUN([SR_PREPEND],
[dnl
m4_assert([$# >= 2])[]dnl
$1=m4_if([$#], [2], [$2[$]{$1:+' '}], [$3[$]{$1:+$2}])[$]$1[]dnl
])
## _SR_PKG_VERSION_SET(var-prefix, pkg-name, tag-prefix, base-version, major, minor, [micro])
##
m4_define([_SR_PKG_VERSION_SET],
[dnl
m4_assert([$# >= 6])[]dnl
$1=$4
sr_git_deps=
# Check if we can get revision information from git.
sr_head=`git -C "$srcdir" rev-parse --verify --short HEAD 2>&AS_MESSAGE_LOG_FD`
AS_IF([test "$?" = 0 && test "x$sr_head" != x], [dnl
test ! -f "$srcdir/.git/HEAD" \
|| sr_git_deps="$sr_git_deps \$(top_srcdir)/.git/HEAD"
sr_head_name=`git -C "$srcdir" rev-parse --symbolic-full-name HEAD 2>&AS_MESSAGE_LOG_FD`
AS_IF([test "$?" = 0 && test -f "$srcdir/.git/$sr_head_name"],
[sr_git_deps="$sr_git_deps \$(top_srcdir)/.git/$sr_head_name"])
# Append the revision hash unless we are exactly on a tagged release.
git -C "$srcdir" describe --match "$3$4" \
--exact-match >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD \
|| $1="[$]$1-git-$sr_head"
])
# Use $(wildcard) so that things do not break if for whatever
# reason these files do not exist anymore at make time.
AS_IF([test -n "$sr_git_deps"],
[SR_APPEND([CONFIG_STATUS_DEPENDENCIES], ["\$(wildcard$sr_git_deps)"])])
AC_SUBST([CONFIG_STATUS_DEPENDENCIES])[]dnl
AC_SUBST([$1])[]dnl
dnl
AC_DEFINE([$1_MAJOR], [$5], [Major version number of $2.])[]dnl
AC_DEFINE([$1_MINOR], [$6], [Minor version number of $2.])[]dnl
m4_ifval([$7], [AC_DEFINE([$1_MICRO], [$7], [Micro version number of $2.])])[]dnl
AC_DEFINE_UNQUOTED([$1_STRING], ["[$]$1"], [Version of $2.])[]dnl
])
## SR_PKG_VERSION_SET(var-prefix, version-triple)
##
## Set up substitution variables and macro definitions for the package
## version components. Derive the version suffix from the repository
## revision if possible.
##
## Substitutions: <var-prefix>
## Macro defines: <var-prefix>_{MAJOR,MINOR,MICRO,STRING}
##
AC_DEFUN([SR_PKG_VERSION_SET],
[dnl
m4_assert([$# >= 2])[]dnl
_SR_PKG_VERSION_SET([$1],
m4_defn([AC_PACKAGE_NAME]),
m4_defn([AC_PACKAGE_TARNAME])[-],
m4_expand([$2]),
m4_unquote(m4_split(m4_expand([$2]), [\.])))
])
## _SR_LIB_VERSION_SET(var-prefix, pkg-name, abi-triple, current, revision, age)
##
m4_define([_SR_LIB_VERSION_SET],
[dnl
m4_assert([$# >= 6])[]dnl
$1=$3
AC_SUBST([$1])[]dnl
AC_DEFINE([$1_CURRENT], [$4], [Binary version of $2.])[]dnl
AC_DEFINE([$1_REVISION], [$5], [Binary revision of $2.])[]dnl
AC_DEFINE([$1_AGE], [$6], [Binary age of $2.])[]dnl
AC_DEFINE([$1_STRING], ["$3"], [Binary version triple of $2.])[]dnl
])
## SR_LIB_VERSION_SET(var-prefix, abi-triple)
##
## Set up substitution variables and macro definitions for a library
## binary version.
##
## Substitutions: <var-prefix>
## Macro defines: <var-prefix>_{CURRENT,REVISION,AGE,STRING}
##
AC_DEFUN([SR_LIB_VERSION_SET],
[dnl
m4_assert([$# >= 1])[]dnl
_SR_LIB_VERSION_SET([$1],
m4_defn([AC_PACKAGE_NAME]),
[$2], m4_unquote(m4_split([$2], [:])))
])
## SR_SEARCH_LIBS(libs-var, function, search-libs,
## [action-if-found], [action-if-not-found], [other-libs])
##
## Same as AC_SEARCH_LIBS, except that the result is prepended
## to <libs-var> instead of LIBS. Calls AC_SUBST on <libs-var>.
##
AC_DEFUN([SR_SEARCH_LIBS],
[dnl
m4_assert([$# >= 3])[]dnl
sr_sl_save_LIBS=$LIBS
AC_SEARCH_LIBS([$2], [$3],,, m4_join([$6], [[$]$1]))
LIBS=$sr_sl_save_LIBS
AS_CASE([$ac_cv_search_$2], [no*],,
[SR_PREPEND([$1], [$ac_cv_search_$2])])
m4_ifvaln([$4$5], [AS_IF([test "x$ac_cv_search_$2" = xno], [$5], [$4])])[]dnl
AC_SUBST([$1])[]dnl
])
## _SR_VAR_SUMMARY(tag, var-name, line-leader, align-columns, align-char)
##
m4_define([_SR_VAR_SUMMARY], [dnl
$2=
$1_append() {
sr_aligned=`printf '%.$4s' "[$][1]m4_for([i], [1], [$4],, [$5])"`
$2="[$]{$2}$3$sr_aligned [$]2"'
'
}
])
## SR_VAR_SUMMARY(tag, [var-name = <tag>],
## [line-leader = [ - ]], [align-columns = 32], [align-char = .])
##
## Define a shell function <tag>_append() to be used for aggregating
## a summary of test results in the shell variable <var-name>.
##
AC_DEFUN([SR_VAR_SUMMARY],
[dnl
m4_assert([$# >= 1])[]dnl
_SR_VAR_SUMMARY([$1],
m4_default_quoted([$2], [$1]),
m4_default_quoted([$3], [ - ]),
m4_default_quoted([$4], [32]),
m4_default_quoted([$5], [.]))[]dnl
])
## SR_PKG_CHECK_SUMMARY([var-name = sr_pkg_check_summary],
## [line-leader = [ - ]], [align-columns = 32], [align-char = .])
##
## Prepare for the aggregation of package check results
## in the shell variable <var-name>.
##
AC_DEFUN([SR_PKG_CHECK_SUMMARY],
[SR_VAR_SUMMARY([sr_pkg_check_summary], $@)])
## SR_PKG_CHECK(tag, [collect-var], module...)
##
## Check for each pkg-config <module> in the argument list. <module> may
## include a version constraint.
##
## Output variables: sr_have_<tag>, sr_<tag>_version
##
AC_DEFUN([SR_PKG_CHECK],
[dnl
m4_assert([$# >= 3])[]dnl
AC_REQUIRE([PKG_PROG_PKG_CONFIG])[]dnl
AC_REQUIRE([SR_PKG_CHECK_SUMMARY])[]dnl
dnl
PKG_CHECK_EXISTS([$3], [dnl
sr_have_$1=yes
m4_ifval([$2], [SR_APPEND([$2], ["$3"])
])sr_$1_version=`$PKG_CONFIG --modversion "$3" 2>&AS_MESSAGE_LOG_FD`
sr_pkg_check_summary_append "$3" "$sr_$1_version"[]dnl
], [dnl
sr_pkg_check_summary_append "$3" no
m4_ifval([$4],
[SR_PKG_CHECK([$1], [$2], m4_shift3($@))],
[sr_have_$1=no sr_$1_version=])[]dnl
])
])
## SR_VAR_OPT_PKG([modules-var], [features-var])
##
## Enable the collection of SR_ARG_OPT_PKG results into the shell variables
## <modules-var> and <features-var>.
##
AC_DEFUN([SR_VAR_OPT_PKG],
[dnl
m4_define([_SR_VAR_OPT_PKG_MODULES], [$1])[]dnl
m4_define([_SR_VAR_OPT_PKG_FEATURES], [$2])[]dnl
m4_ifvaln([$1], [$1=])[]dnl
m4_ifvaln([$2], [$2=])[]dnl
])
## _SR_ARG_OPT_IMPL(sh-name, [features-var], opt-name,
## [cpp-name], [cond-name], check-commands)
##
m4_define([_SR_ARG_OPT_IMPL],
[dnl
AC_ARG_WITH([$3], [AS_HELP_STRING([--without-$3],
[disable $3 support [default=detect]])])
AS_IF([test "x$with_$1" = xno], [sr_have_$1=no],
[test "x$sr_have_$1" != xyes], [dnl
AC_MSG_CHECKING([for $3])
$6
AC_MSG_RESULT([$sr_have_$1])[]dnl
])
AS_IF([test "x$with_$1$sr_have_$1" = xyesno],
[AC_MSG_ERROR([$3 support requested, but it was not found.])])
AS_IF([test "x$sr_have_$1" = xyes], [m4_ifval([$2], [
SR_APPEND([$2], ["$3"])])[]m4_ifval([$4], [
AC_DEFINE([HAVE_$4], [1], [Whether $3 is available.])])[]dnl
])
m4_ifvaln([$5], [AM_CONDITIONAL([$5], [test "x$sr_have_$1" = xyes])])[]dnl
])
## _SR_ARG_OPT_CHECK(sh-name, [features-var], opt-name, [cpp-name],
## [cond-name], check-commands, [summary-result])
##
m4_define([_SR_ARG_OPT_CHECK],
[dnl
_SR_ARG_OPT_IMPL($@)
sr_pkg_check_summary_append "$3" m4_default([$7], ["$sr_have_$1"])
])
## SR_ARG_OPT_CHECK(opt-name, [cpp-name], [cond-name], check-commands,
## [summary-result = $sr_have_<opt-name>])
##
## Provide a --without-<opt-name> configure option for explicit disabling
## of an optional dependency. If not disabled, the availability of the
## optional dependency is auto-detected by running <check-commands>.
##
## The <check-commands> should set the shell variable sr_have_<opt-name>
## to "yes" if the dependency is available, otherwise to "no". Optionally,
## the <summary-result> argument may be used to generate a line in the
## configuration summary. If supplied, it should be a shell word which
## expands to the result to be displayed for the <opt-name> dependency.
##
## Use SR_VAR_OPT_PKG to generate lists of available modules and features.
##
AC_DEFUN([SR_ARG_OPT_CHECK],
[dnl
m4_assert([$# >= 4])[]dnl
AC_REQUIRE([SR_PKG_CHECK_SUMMARY])[]dnl
AC_REQUIRE([SR_VAR_OPT_PKG])[]dnl
dnl
_SR_ARG_OPT_CHECK(m4_expand([AS_TR_SH([$1])]),
m4_defn([_SR_VAR_OPT_PKG_FEATURES]),
$@)[]dnl
])
## _SR_ARG_OPT_PKG([features-var], [cond-name], opt-name,
## [cpp-name], sh-name, [modules-var], module...)
##
m4_define([_SR_ARG_OPT_PKG],
[dnl
_SR_ARG_OPT_IMPL([$5], [$1], [$3], [$4], [$2],
[SR_PKG_CHECK(m4_shiftn([4], $@))])
m4_ifvaln([$4], [AS_IF([test "x$sr_have_$5" = xyes],
[AC_DEFINE_UNQUOTED([CONF_$4_VERSION], ["$sr_$5_version"],
[Build-time version of $3.])])])[]dnl
])
## SR_ARG_OPT_PKG(opt-name, [cpp-name], [cond-name], module...)
##
## Provide a --without-<opt-name> configure option for explicit disabling
## of an optional dependency. If not disabled, the availability of the
## optional dependency is auto-detected.
##
## Each pkg-config <module> argument is checked in turn, and the first one
## found is selected. On success, the shell variable sr_have_<opt-name>
## is set to "yes", otherwise to "no". Optionally, a preprocessor macro
## HAVE_<cpp-name> and an Automake conditional <cond-name> are generated.
##
## Use SR_VAR_OPT_PKG to generate lists of available modules and features.
##
AC_DEFUN([SR_ARG_OPT_PKG],
[dnl
m4_assert([$# >= 4])[]dnl
AC_REQUIRE([PKG_PROG_PKG_CONFIG])[]dnl
AC_REQUIRE([SR_PKG_CHECK_SUMMARY])[]dnl
AC_REQUIRE([SR_VAR_OPT_PKG])[]dnl
dnl
_SR_ARG_OPT_PKG(m4_defn([_SR_VAR_OPT_PKG_FEATURES]),
[$3], [$1], [$2],
m4_expand([AS_TR_SH([$1])]),
m4_defn([_SR_VAR_OPT_PKG_MODULES]),
m4_shift3($@))[]dnl
])
## SR_PROG_VERSION(program, sh-var)
##
## Obtain the version of <program> and store it in <sh-var>.
##
AC_DEFUN([SR_PROG_VERSION],
[dnl
m4_assert([$# >= 2])[]dnl
sr_prog_ver=`$1 --version 2>&AS_MESSAGE_LOG_FD | sed 1q 2>&AS_MESSAGE_LOG_FD`
AS_CASE([[$]?:$sr_prog_ver],
[[0:*[0-9].[0-9]*]], [$2=$sr_prog_ver],
[$2=unknown])[]dnl
])
## SR_PROG_MAKE_ORDER_ONLY
##
## Check whether the make program supports order-only prerequisites.
## If so, set the substitution variable ORDER to '|', or to the empty
## string otherwise.
##
AC_DEFUN([SR_PROG_MAKE_ORDER_ONLY],
[dnl
AC_CACHE_CHECK([whether [$]{MAKE:-make} supports order-only prerequisites],
[sr_cv_prog_make_order_only], [
cat >conftest.mk <<'_SREOF'
a: b | c
a b c: ; @:
.PHONY: a b c
_SREOF
AS_IF([[$]{MAKE:-make} -f conftest.mk >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD],
[sr_cv_prog_make_order_only=yes], [sr_cv_prog_make_order_only=no])
rm -f conftest.mk
])
AS_IF([test "x$sr_cv_prog_make_order_only" = xyes], [ORDER='|'], [ORDER=])
AC_SUBST([ORDER])
AM_SUBST_NOTMAKE([ORDER])[]dnl
])
## SR_CHECK_COMPILE_FLAGS(flags-var, description, flags)
##
## Find a compiler flag for <description>. For each flag in <flags>, check
## if the compiler for the current language accepts it. On success, stop the
## search and append the last tested flag to <flags-var>. Calls AC_SUBST
## on <flags-var>.
##
AC_DEFUN([SR_CHECK_COMPILE_FLAGS],
[dnl
m4_assert([$# >= 3])[]dnl
AC_MSG_CHECKING([compiler flag for $2])
sr_ccf_result=no
sr_ccf_save_CPPFLAGS=$CPPFLAGS
for sr_flag in $3
do
CPPFLAGS="$sr_ccf_save_CPPFLAGS $sr_flag"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [sr_ccf_result=$sr_flag])
test "x$sr_ccf_result" = xno || break
done
CPPFLAGS=$sr_ccf_save_CPPFLAGS
AS_IF([test "x$sr_ccf_result" != xno],
[SR_APPEND([$1], [$sr_ccf_result])])
AC_MSG_RESULT([$sr_ccf_result])
AC_SUBST([$1])
])
## _SR_ARG_ENABLE_WARNINGS_ONCE
##
## Implementation helper macro of SR_ARG_ENABLE_WARNINGS. Pulled in
## through AC_REQUIRE so that it is only expanded once.
##
m4_define([_SR_ARG_ENABLE_WARNINGS_ONCE],
[dnl
AC_PROVIDE([$0])[]dnl
AC_ARG_ENABLE([warnings],
[AS_HELP_STRING([[--enable-warnings[=min|max|fatal|no]]],
[set compile pedantry level [default=max]])],
[sr_enable_warnings=$enableval],
[sr_enable_warnings=max])[]dnl
dnl
# Test whether the compiler accepts each flag. Look at standard output,
# since GCC only shows a warning message if an option is not supported.
sr_check_compile_warning_flags() {
for sr_flag
do
sr_cc_out=`$sr_cc $sr_warning_flags $sr_flag -c "$sr_conftest" 2>&1 || echo failed`
AS_IF([test "$?$sr_cc_out" = 0],
[SR_APPEND([sr_warning_flags], [$sr_flag])],
[AS_ECHO(["$sr_cc: $sr_cc_out"]) >&AS_MESSAGE_LOG_FD])
rm -f "conftest.[$]{OBJEXT:-o}"
done
}
])
## SR_ARG_ENABLE_WARNINGS(variable, min-flags, max-flags)
##
## Provide the --enable-warnings configure argument, set to "min" by default.
## <min-flags> and <max-flags> should be space-separated lists of compiler
## warning flags to use with --enable-warnings=min or --enable-warnings=max,
## respectively. Warning level "fatal" is the same as "max" but in addition
## enables -Werror mode.
##
## In order to determine the warning options to use with the C++ compiler,
## call AC_LANG([C++]) first to change the current language. If different
## output variables are used, it is also fine to call SR_ARG_ENABLE_WARNINGS
## repeatedly, once for each language setting.
##
AC_DEFUN([SR_ARG_ENABLE_WARNINGS],
[dnl
m4_assert([$# >= 3])[]dnl
AC_REQUIRE([_SR_ARG_ENABLE_WARNINGS_ONCE])[]dnl
dnl
AS_CASE([$ac_compile],
[[*'$CXXFLAGS '*]], [sr_lang='C++' sr_cc=$CXX sr_conftest="conftest.[$]{ac_ext:-cc}"],
[[*'$CFLAGS '*]], [sr_lang=C sr_cc=$CC sr_conftest="conftest.[$]{ac_ext:-c}"],
[AC_MSG_ERROR([[current language is neither C nor C++]])])
dnl
AC_MSG_CHECKING([which $sr_lang compiler warning flags to use])
sr_warning_flags=
AC_LANG_CONFTEST([AC_LANG_SOURCE([[
int main(int argc, char** argv) { return (argv != 0) ? argc : 0; }
]])])
AS_CASE([$sr_enable_warnings],
[no], [],
[min], [sr_check_compile_warning_flags $2],
[fatal], [sr_check_compile_warning_flags $3 -Werror],
[sr_check_compile_warning_flags $3])
rm -f "$sr_conftest"
AC_SUBST([$1], [$sr_warning_flags])
AC_MSG_RESULT([[$]{sr_warning_flags:-none}])[]dnl
])

View File

@ -1,125 +0,0 @@
#!/usr/bin/env python3
##
## This file is part of the libsigrokdecode project.
##
## Copyright (C) 2013 Bert Vermeulen <bert@biot.com>
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, see <http://www.gnu.org/licenses/>.
##
import errno
import os
import sys
from shutil import copy
from getopt import getopt
_inst_pp_col_max = 80
_inst_pp_col = 0
def _install_pretty_print(item):
"""Pretty print an install item. Enforce maximum line width."""
global _inst_pp_col
if item is None:
_inst_pp_col = 0
return
_inst_pp_col += len(item)
if _inst_pp_col > _inst_pp_col_max:
print()
_inst_pp_col = len(item)
print(item, end = "")
def install(srcdir, dstdir, s):
worklist = []
for pd in os.listdir(srcdir):
pd_dir = srcdir + '/' + pd
if not os.path.isdir(pd_dir):
continue
install_list = []
for f in os.listdir(pd_dir):
pd_file = pd_dir + '/' + f
if not os.path.isfile(pd_file):
continue
if f == 'config':
install_list.extend(config_get_extra_install(pd_file))
elif f[-3:] == '.py':
install_list.append(f)
if install_list:
worklist.append((pd, pd_dir, install_list))
worklist.sort()
print("Installing %d %s:" % (len(worklist), s))
for pd, pd_dir, install_list in worklist:
_install_pretty_print("{} ".format(pd))
pd_dst = os.path.join(dstdir, pd)
try:
os.mkdir(pd_dst)
except OSError as e:
if e.errno != errno.EEXIST:
raise
else:
pass
for f in install_list:
copy(os.path.join(pd_dir, f), pd_dst)
print()
_install_pretty_print(None)
def config_get_extra_install(config_file):
install_list = []
for line in open(config_file).read().split('\n'):
line = line.strip()
if len(line) == 0 or line[0] == '#':
continue
words = line.split()
if words[0] != 'extra-install':
continue
install_list.extend(words[1:])
return install_list
def usage(msg=None):
if msg:
print(msg)
ret = 1
else:
ret = 0
print("""Usage:
install-decoders [-i <decoder source>] -o <install path>""")
sys.exit(ret)
#
# main
#
src = 'decoders'
dst = None
try:
opts, args = getopt(sys.argv[1:], 'i:o:')
for opt, arg in opts:
if opt == '-i':
src = arg
elif opt == '-o':
dst = arg
except Exception as e:
usage(str(e))
if len(args) != 0 or dst is None:
usage()
install(src, dst, 'protocol decoders')
install(src + '/common', dst + '/common', 'common modules')