From 936f99c3e7c5ebe19e8ccf249dcd11af4ec31149 Mon Sep 17 00:00:00 2001 From: dreamsourcelabTAI Date: Tue, 15 Feb 2022 17:48:08 +0800 Subject: [PATCH] update cmake script, and define python script path on linux --- DSView/CMakeLists.txt | 46 +++++++++++++++++++++++-- DSView.desktop => DSView/DSView.desktop | 0 DSView/cmake_clear | 2 +- DSView/config.h | 2 -- DSView/pv/appcontrol.cpp | 5 ++- DSView/pv/config/appconfig.cpp | 29 ++++++++++++++-- DSView/pv/config/appconfig.h | 1 + DreamSourceLab.rules | 1 - INSTALL | 2 +- libsigrok4DSL/backend.c | 2 +- libsigrok4DSL/hardware/DSL/dslogic.c | 3 +- libsigrok4DSL/hwdriver.c | 2 ++ libsigrok4DSL/input/in_wav.c | 4 +-- libsigrok4DSL/proto.h | 2 +- libsigrokdecode4DSL/config.h | 2 +- libsigrokdecode4DSL/version.h | 2 +- 16 files changed, 87 insertions(+), 18 deletions(-) rename DSView.desktop => DSView/DSView.desktop (100%) delete mode 100755 DreamSourceLab.rules diff --git a/DSView/CMakeLists.txt b/DSView/CMakeLists.txt index 554952fa..9d430c3e 100755 --- a/DSView/CMakeLists.txt +++ b/DSView/CMakeLists.txt @@ -26,6 +26,14 @@ include(GNUInstallDirs) set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake") +#SET(CMAKE_C_FLAGS_RELEASE "-g -DNDEBUG -O3") +#SET(CMAKE_CXX_FLAGS_RELEASE "-g -DNDEBUG -O3") + +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) #=============================================================================== @@ -95,9 +103,11 @@ find_package(Threads) find_package(PythonLibs 3 EXACT) find_package(Boost 1.42 COMPONENTS filesystem system thread REQUIRED) find_package(libusb-1.0 REQUIRED) +find_package(ZLIB REQUIRED) find_package(libzip REQUIRED) find_package(FFTW REQUIRED) + #=============================================================================== #= Config Header #------------------------------------------------------------------------------- @@ -106,8 +116,8 @@ set(DS_TITLE DSView) set(DS_DESCRIPTION "A GUI for instruments of DreamSourceLab") set(DS_VERSION_MAJOR 1) -set(DS_VERSION_MINOR 1) -set(DS_VERSION_MICRO 2) +set(DS_VERSION_MINOR 2) +set(DS_VERSION_MICRO 0) set(DS_VERSION_STRING ${DS_VERSION_MAJOR}.${DS_VERSION_MINOR}.${DS_VERSION_MICRO} ) @@ -214,6 +224,21 @@ set(DSView_SOURCES 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 ) set(DSView_HEADERS @@ -282,6 +307,21 @@ set(DSView_HEADERS 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 ) set(DSView_FORMS @@ -408,6 +448,8 @@ if(WIN32) set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-mwindows") endif() +target_link_libraries(DSView -lz) + if(ENABLE_COTIRE) include(cotire) diff --git a/DSView.desktop b/DSView/DSView.desktop similarity index 100% rename from DSView.desktop rename to DSView/DSView.desktop diff --git a/DSView/cmake_clear b/DSView/cmake_clear index bd2c87ba..bdbf6674 100755 --- a/DSView/cmake_clear +++ b/DSView/cmake_clear @@ -6,7 +6,7 @@ rm ./CMakeCache.txt rm ./*.cmake rm ./DSView rm ./DSView.qrc.depends -rm ./install_manifest.txt +#rm ./install_manifest.txt find . -name 'moc_*.cpp*' | xargs rm -rf find . -name 'qrc_*.cpp' | xargs rm -rf echo "rm cmake cache end..." diff --git a/DSView/config.h b/DSView/config.h index 067e528a..2636a3a2 100755 --- a/DSView/config.h +++ b/DSView/config.h @@ -31,6 +31,4 @@ #define DS_VERSION_MICRO 0 #define DS_VERSION_STRING "1.2.0" -#define DS_DEBUG_TRACE - #endif diff --git a/DSView/pv/appcontrol.cpp b/DSView/pv/appcontrol.cpp index ab7015c0..56cb67cb 100644 --- a/DSView/pv/appcontrol.cpp +++ b/DSView/pv/appcontrol.cpp @@ -92,10 +92,13 @@ bool AppControl::Init() #endif + //the python script path of decoder char path[256] = {0}; - QString dir = GetAppDataDir() + "/decoders"; + QString dir = GetDecodeScriptDir(); strcpy(path, dir.toUtf8().data()); + qDebug()<<"decode script path is:"<= 0.9.4 (optional, only needed to run unit tests) - libfftw3 >= 3.3 - - zlib + - zlib (on ubuntu, zlib package name is zlib1g-dev) Building and installing ----------------------- diff --git a/libsigrok4DSL/backend.c b/libsigrok4DSL/backend.c index 98776208..156922f5 100755 --- a/libsigrok4DSL/backend.c +++ b/libsigrok4DSL/backend.c @@ -472,7 +472,7 @@ SR_API void sr_hotplug_wait_timout(struct sr_context *ctx) { if (!ctx) { sr_err("%s(): libsigrok context was NULL.", __func__); - return SR_ERR; + return; } libusb_handle_events_timeout(ctx->libusb_ctx, &ctx->hotplug_tv); } diff --git a/libsigrok4DSL/hardware/DSL/dslogic.c b/libsigrok4DSL/hardware/DSL/dslogic.c index 345f9db9..66d8ff28 100755 --- a/libsigrok4DSL/hardware/DSL/dslogic.c +++ b/libsigrok4DSL/hardware/DSL/dslogic.c @@ -287,8 +287,9 @@ static GSList *scan(GSList *options) /* Find all DSLogic compatible devices and upload firmware to them. */ devices = NULL; - int usbnum = libusb_get_device_list(drvc->sr_ctx->libusb_ctx, &devlist); + libusb_get_device_list(drvc->sr_ctx->libusb_ctx, &devlist); int stdnum = 0; + for (i = 0; devlist[i]; i++) { if (conn) { diff --git a/libsigrok4DSL/hwdriver.c b/libsigrok4DSL/hwdriver.c index 5be41d3d..7ce483ac 100755 --- a/libsigrok4DSL/hwdriver.c +++ b/libsigrok4DSL/hwdriver.c @@ -481,6 +481,7 @@ SR_PRIV int sr_source_add(int fd, int events, int timeout, /* test usb device api */ +/* SR_API void sr_test_usb_api() { libusb_context *ctx; @@ -553,3 +554,4 @@ SR_API void sr_test_usb_api() libusb_exit(NULL); } +*/ diff --git a/libsigrok4DSL/input/in_wav.c b/libsigrok4DSL/input/in_wav.c index a576aa8a..d99b086b 100755 --- a/libsigrok4DSL/input/in_wav.c +++ b/libsigrok4DSL/input/in_wav.c @@ -94,7 +94,7 @@ static int init(struct sr_input *in, const char *filename) { struct sr_channel *probe; struct context *ctx; - char buf[40], probename[8]; + char buf[40], probename[15]; int i; if (get_wav_header(filename, buf) != SR_OK) @@ -120,7 +120,7 @@ static int init(struct sr_input *in, const char *filename) } for (i = 0; i < ctx->num_channels; i++) { - snprintf(probename, 8, "CH%d", i + 1); + sprintf(probename,"CH%d", i + 1); if (!(probe = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, probename))) return SR_ERR; in->sdi->channels = g_slist_append(in->sdi->channels, probe); diff --git a/libsigrok4DSL/proto.h b/libsigrok4DSL/proto.h index d7974307..3d500a8f 100755 --- a/libsigrok4DSL/proto.h +++ b/libsigrok4DSL/proto.h @@ -88,7 +88,7 @@ SR_API int sr_status_get(const struct sr_dev_inst *sdi, struct sr_status *status SR_API struct sr_config *sr_config_new(int key, GVariant *data); SR_API void sr_config_free(struct sr_config *src); -SR_API void sr_test_usb_api(); +//SR_API void sr_test_usb_api(); /*--------------------session.c----------------*/ typedef void (*sr_datafeed_callback_t)(const struct sr_dev_inst *sdi, diff --git a/libsigrokdecode4DSL/config.h b/libsigrokdecode4DSL/config.h index 1d480390..4bdef8cd 100644 --- a/libsigrokdecode4DSL/config.h +++ b/libsigrokdecode4DSL/config.h @@ -80,7 +80,7 @@ #define SRD_PACKAGE_VERSION_MINOR 6 /* Version of libsigrokdecode4DSL. */ -#define SRD_PACKAGE_VERSION_STRING "0.6.0-git-c708a00" +#define SRD_PACKAGE_VERSION_STRING "0.6.0-git-f18df52" /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 diff --git a/libsigrokdecode4DSL/version.h b/libsigrokdecode4DSL/version.h index d131411e..ca4e11d2 100644 --- a/libsigrokdecode4DSL/version.h +++ b/libsigrokdecode4DSL/version.h @@ -48,7 +48,7 @@ #define SRD_PACKAGE_VERSION_MICRO 0 /** The libsigrokdecode package version ("major.minor.micro") as string. */ -#define SRD_PACKAGE_VERSION_STRING "0.6.0-git-c708a00" +#define SRD_PACKAGE_VERSION_STRING "0.6.0-git-f18df52" /* * Library/libtool version macros (can be used for conditional compilation).