2
0
forked from Ivasoft/DSView

update cmake script, and define python script path on linux

This commit is contained in:
dreamsourcelabTAI
2022-02-15 17:48:08 +08:00
parent f18df5288c
commit 936f99c3e7
16 changed files with 87 additions and 18 deletions

View File

@@ -26,6 +26,14 @@ include(GNUInstallDirs)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake") 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) project(DSView)
#=============================================================================== #===============================================================================
@@ -95,9 +103,11 @@ find_package(Threads)
find_package(PythonLibs 3 EXACT) find_package(PythonLibs 3 EXACT)
find_package(Boost 1.42 COMPONENTS filesystem system thread REQUIRED) find_package(Boost 1.42 COMPONENTS filesystem system thread REQUIRED)
find_package(libusb-1.0 REQUIRED) find_package(libusb-1.0 REQUIRED)
find_package(ZLIB REQUIRED)
find_package(libzip REQUIRED) find_package(libzip REQUIRED)
find_package(FFTW REQUIRED) find_package(FFTW REQUIRED)
#=============================================================================== #===============================================================================
#= Config Header #= Config Header
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
@@ -106,8 +116,8 @@ set(DS_TITLE DSView)
set(DS_DESCRIPTION "A GUI for instruments of DreamSourceLab") set(DS_DESCRIPTION "A GUI for instruments of DreamSourceLab")
set(DS_VERSION_MAJOR 1) set(DS_VERSION_MAJOR 1)
set(DS_VERSION_MINOR 1) set(DS_VERSION_MINOR 2)
set(DS_VERSION_MICRO 2) set(DS_VERSION_MICRO 0)
set(DS_VERSION_STRING set(DS_VERSION_STRING
${DS_VERSION_MAJOR}.${DS_VERSION_MINOR}.${DS_VERSION_MICRO} ${DS_VERSION_MAJOR}.${DS_VERSION_MINOR}.${DS_VERSION_MICRO}
) )
@@ -214,6 +224,21 @@ set(DSView_SOURCES
pv/dialogs/mathoptions.cpp pv/dialogs/mathoptions.cpp
pv/dialogs/regionoptions.cpp pv/dialogs/regionoptions.cpp
pv/view/xcursor.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 set(DSView_HEADERS
@@ -282,6 +307,21 @@ set(DSView_HEADERS
pv/view/analogsignal.h pv/view/analogsignal.h
pv/view/dsosignal.h pv/view/dsosignal.h
mystyle.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 set(DSView_FORMS
@@ -408,6 +448,8 @@ if(WIN32)
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-mwindows") set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-mwindows")
endif() endif()
target_link_libraries(DSView -lz)
if(ENABLE_COTIRE) if(ENABLE_COTIRE)
include(cotire) include(cotire)

View File

@@ -6,7 +6,7 @@ rm ./CMakeCache.txt
rm ./*.cmake rm ./*.cmake
rm ./DSView rm ./DSView
rm ./DSView.qrc.depends rm ./DSView.qrc.depends
rm ./install_manifest.txt #rm ./install_manifest.txt
find . -name 'moc_*.cpp*' | xargs rm -rf find . -name 'moc_*.cpp*' | xargs rm -rf
find . -name 'qrc_*.cpp' | xargs rm -rf find . -name 'qrc_*.cpp' | xargs rm -rf
echo "rm cmake cache end..." echo "rm cmake cache end..."

View File

@@ -31,6 +31,4 @@
#define DS_VERSION_MICRO 0 #define DS_VERSION_MICRO 0
#define DS_VERSION_STRING "1.2.0" #define DS_VERSION_STRING "1.2.0"
#define DS_DEBUG_TRACE
#endif #endif

View File

@@ -92,10 +92,13 @@ bool AppControl::Init()
#endif #endif
//the python script path of decoder
char path[256] = {0}; char path[256] = {0};
QString dir = GetAppDataDir() + "/decoders"; QString dir = GetDecodeScriptDir();
strcpy(path, dir.toUtf8().data()); strcpy(path, dir.toUtf8().data());
qDebug()<<"decode script path is:"<<dir;
// Initialise libsigrokdecode // Initialise libsigrokdecode
if (srd_init(path) != SRD_OK) if (srd_init(path) != SRD_OK)
{ {

View File

@@ -324,11 +324,11 @@ QString GetAppDataDir()
//applicationDirPath not end with '/' //applicationDirPath not end with '/'
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
QDir dir(QCoreApplication::applicationDirPath()); QDir dir(QCoreApplication::applicationDirPath());
if (dir.cd("..") && dir.cd("share") &&dir.cd("DSView")) if (dir.cd("..") && dir.cd("share") && dir.cd("DSView"))
{ {
return dir.absolutePath(); return dir.absolutePath();
} }
qDebug() << "dir is not exists:" << QCoreApplication::applicationDirPath() + "/../share/DSView"; qDebug() << "dir is not exists:" <<"../share/DSView";
assert(false); assert(false);
#else #else
return QCoreApplication::applicationDirPath(); return QCoreApplication::applicationDirPath();
@@ -340,7 +340,7 @@ QString GetResourceDir(){
if (dir.exists()){ if (dir.exists()){
return dir.absolutePath(); return dir.absolutePath();
} }
qDebug() << "dir is not exists:" << dir.absolutePath(); qDebug() << "app data dir is not exists:" << dir.absolutePath();
assert(false); assert(false);
} }
@@ -352,3 +352,26 @@ QString GetUserDataDir()
return QStandardPaths::writableLocation(QStandardPaths::DataLocation); return QStandardPaths::writableLocation(QStandardPaths::DataLocation);
#endif #endif
} }
QString GetDecodeScriptDir()
{
QString path = GetAppDataDir() + "/decoders";
#ifdef Q_OS_LINUX
QDir dir1;
// ../share/DSView/decoders
if (dir1.exists(path))
{
return path;
}
QDir dir(QCoreApplication::applicationDirPath());
// ../share/libsigrokdecode4DSL/decoders
if (dir.cd("..") && dir.cd("share") && dir.cd("libsigrokdecode4DSL") && dir.cd("decoders"))
{
return dir.absolutePath();
}
#endif
return path;
}

View File

@@ -37,6 +37,7 @@ QString GetIconPath();
QString GetAppDataDir(); QString GetAppDataDir();
QString GetResourceDir(); QString GetResourceDir();
QString GetUserDataDir(); QString GetUserDataDir();
QString GetDecodeScriptDir();
//------------------class //------------------class

View File

@@ -1 +0,0 @@
SUBSYSTEM=="usb", ATTRS{idVendor}=="2a0e", MODE="0666"

View File

@@ -26,7 +26,7 @@ Requirements
This is part of the standard OpenBSD install (not an extra package), apparently. This is part of the standard OpenBSD install (not an extra package), apparently.
- check >= 0.9.4 (optional, only needed to run unit tests) - check >= 0.9.4 (optional, only needed to run unit tests)
- libfftw3 >= 3.3 - libfftw3 >= 3.3
- zlib - zlib (on ubuntu, zlib package name is zlib1g-dev)
Building and installing Building and installing
----------------------- -----------------------

View File

@@ -472,7 +472,7 @@ SR_API void sr_hotplug_wait_timout(struct sr_context *ctx)
{ {
if (!ctx) { if (!ctx) {
sr_err("%s(): libsigrok context was NULL.", __func__); sr_err("%s(): libsigrok context was NULL.", __func__);
return SR_ERR; return;
} }
libusb_handle_events_timeout(ctx->libusb_ctx, &ctx->hotplug_tv); libusb_handle_events_timeout(ctx->libusb_ctx, &ctx->hotplug_tv);
} }

View File

@@ -287,8 +287,9 @@ static GSList *scan(GSList *options)
/* Find all DSLogic compatible devices and upload firmware to them. */ /* Find all DSLogic compatible devices and upload firmware to them. */
devices = NULL; 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; int stdnum = 0;
for (i = 0; devlist[i]; i++) { for (i = 0; devlist[i]; i++) {
if (conn) { if (conn) {

View File

@@ -481,6 +481,7 @@ SR_PRIV int sr_source_add(int fd, int events, int timeout,
/* /*
test usb device api test usb device api
*/ */
/*
SR_API void sr_test_usb_api() SR_API void sr_test_usb_api()
{ {
libusb_context *ctx; libusb_context *ctx;
@@ -553,3 +554,4 @@ SR_API void sr_test_usb_api()
libusb_exit(NULL); libusb_exit(NULL);
} }
*/

View File

@@ -94,7 +94,7 @@ static int init(struct sr_input *in, const char *filename)
{ {
struct sr_channel *probe; struct sr_channel *probe;
struct context *ctx; struct context *ctx;
char buf[40], probename[8]; char buf[40], probename[15];
int i; int i;
if (get_wav_header(filename, buf) != SR_OK) 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++) { 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))) if (!(probe = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, probename)))
return SR_ERR; return SR_ERR;
in->sdi->channels = g_slist_append(in->sdi->channels, probe); in->sdi->channels = g_slist_append(in->sdi->channels, probe);

View File

@@ -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 struct sr_config *sr_config_new(int key, GVariant *data);
SR_API void sr_config_free(struct sr_config *src); 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----------------*/ /*--------------------session.c----------------*/
typedef void (*sr_datafeed_callback_t)(const struct sr_dev_inst *sdi, typedef void (*sr_datafeed_callback_t)(const struct sr_dev_inst *sdi,

View File

@@ -80,7 +80,7 @@
#define SRD_PACKAGE_VERSION_MINOR 6 #define SRD_PACKAGE_VERSION_MINOR 6
/* Version of libsigrokdecode4DSL. */ /* 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 to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1 #define STDC_HEADERS 1

View File

@@ -48,7 +48,7 @@
#define SRD_PACKAGE_VERSION_MICRO 0 #define SRD_PACKAGE_VERSION_MICRO 0
/** The libsigrokdecode package version ("major.minor.micro") as string. */ /** 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). * Library/libtool version macros (can be used for conditional compilation).