From b36d8550c43e11d3b86cf7ace35483c8957835a3 Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Thu, 11 Oct 2012 23:03:04 +0200 Subject: [PATCH 01/16] Add missing include. This breaks the build on Windows/MinGW otherwise, since stdlib.h is needed for free(). --- logicdatasnapshot.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/logicdatasnapshot.cpp b/logicdatasnapshot.cpp index 10744cf..5d65055 100644 --- a/logicdatasnapshot.cpp +++ b/logicdatasnapshot.cpp @@ -22,6 +22,7 @@ #include #include +#include #include #include -- 2.30.2 From 0615f1b66144c4a1b6ba601a1f3f5db02c88dda4 Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Thu, 11 Oct 2012 22:10:10 +0100 Subject: [PATCH 02/16] Added install rule --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index afbe0df..21e4927 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -145,3 +145,5 @@ endif(WIN32) enable_testing() add_test(test ${CMAKE_CURRENT_BINARY_DIR}/pulseview-test) + +install(PROGRAMS pulseview DESTINATION bin/) -- 2.30.2 From 77e8ac522c85ca2a54e9d400fe3ea1d304f4347a Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Fri, 12 Oct 2012 20:53:47 +0100 Subject: [PATCH 03/16] Made unit tests optional --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 21e4927..4ba2577 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -122,6 +122,8 @@ target_link_libraries(pulseview ) endif(WIN32) +if(ENABLE_TESTS) + add_definitions(-DBOOST_TEST_DYN_LINK) add_executable(pulseview-test @@ -147,3 +149,5 @@ enable_testing() add_test(test ${CMAKE_CURRENT_BINARY_DIR}/pulseview-test) install(PROGRAMS pulseview DESTINATION bin/) + +endif(ENABLE_TESTS) -- 2.30.2 From 68c4a3b3562ea90a2afbbffea4e903194fdc38bc Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Fri, 12 Oct 2012 21:02:47 +0100 Subject: [PATCH 04/16] Added a copyright header to CMakeLists.txt --- CMakeLists.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4ba2577..79f4e40 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,3 +1,22 @@ +## +## This file is part of pulseview +## +## Copyright (C) 2012 Joel Holdsworth +## +## 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 . +## + cmake_minimum_required(VERSION 2.6) include(FindPkgConfig) -- 2.30.2 From b3f22de060b73f15ad3eb2dabee04a0b4f5d947e Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Fri, 12 Oct 2012 21:20:44 +0100 Subject: [PATCH 05/16] Corrected project name in header comments --- CMakeLists.txt | 2 +- about.cpp | 2 +- about.h | 2 +- datasnapshot.cpp | 2 +- datasnapshot.h | 2 +- logicdata.cpp | 2 +- logicdata.h | 2 +- logicdatasnapshot.cpp | 2 +- logicdatasnapshot.h | 2 +- logicsignal.cpp | 2 +- logicsignal.h | 2 +- main.cpp | 2 +- mainwindow.cpp | 2 +- mainwindow.h | 2 +- pv/view/header.cpp | 2 +- pv/view/header.h | 2 +- pv/view/ruler.cpp | 2 +- pv/view/ruler.h | 2 +- pv/view/view.cpp | 2 +- pv/view/view.h | 2 +- pv/view/viewport.cpp | 2 +- pv/view/viewport.h | 2 +- samplingbar.cpp | 2 +- samplingbar.h | 2 +- signal.cpp | 2 +- signal.h | 2 +- signaldata.cpp | 2 +- signaldata.h | 2 +- sigsession.cpp | 2 +- sigsession.h | 2 +- test/logicdatasnapshot.cpp | 2 +- test/test.cpp | 2 +- 32 files changed, 32 insertions(+), 32 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 79f4e40..c17e77f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ ## -## This file is part of pulseview +## This file is part of PulseView. ## ## Copyright (C) 2012 Joel Holdsworth ## diff --git a/about.cpp b/about.cpp index f030054..0551654 100644 --- a/about.cpp +++ b/about.cpp @@ -1,5 +1,5 @@ /* - * This file is part of the sigrok project. + * This file is part of the PulseView project. * * Copyright (C) 2012 Joel Holdsworth * diff --git a/about.h b/about.h index 8e95af9..76c5065 100644 --- a/about.h +++ b/about.h @@ -1,5 +1,5 @@ /* - * This file is part of the sigrok project. + * This file is part of the PulseView project. * * Copyright (C) 2012 Joel Holdsworth * diff --git a/datasnapshot.cpp b/datasnapshot.cpp index df411f3..6933ea1 100644 --- a/datasnapshot.cpp +++ b/datasnapshot.cpp @@ -1,5 +1,5 @@ /* - * This file is part of the sigrok project. + * This file is part of the PulseView project. * * Copyright (C) 2012 Joel Holdsworth * diff --git a/datasnapshot.h b/datasnapshot.h index c768e11..3bf12f9 100644 --- a/datasnapshot.h +++ b/datasnapshot.h @@ -1,5 +1,5 @@ /* - * This file is part of the sigrok project. + * This file is part of the PulseView project. * * Copyright (C) 2012 Joel Holdsworth * diff --git a/logicdata.cpp b/logicdata.cpp index 4e398d8..73d35d7 100644 --- a/logicdata.cpp +++ b/logicdata.cpp @@ -1,5 +1,5 @@ /* - * This file is part of the sigrok project. + * This file is part of the PulseView project. * * Copyright (C) 2012 Joel Holdsworth * diff --git a/logicdata.h b/logicdata.h index 1bf7fd3..cde8eef 100644 --- a/logicdata.h +++ b/logicdata.h @@ -1,5 +1,5 @@ /* - * This file is part of the sigrok project. + * This file is part of the PulseView project. * * Copyright (C) 2012 Joel Holdsworth * diff --git a/logicdatasnapshot.cpp b/logicdatasnapshot.cpp index 5d65055..62d8a90 100644 --- a/logicdatasnapshot.cpp +++ b/logicdatasnapshot.cpp @@ -1,5 +1,5 @@ /* - * This file is part of the sigrok project. + * This file is part of the PulseView project. * * Copyright (C) 2012 Joel Holdsworth * diff --git a/logicdatasnapshot.h b/logicdatasnapshot.h index f3c637c..16e8edd 100644 --- a/logicdatasnapshot.h +++ b/logicdatasnapshot.h @@ -1,5 +1,5 @@ /* - * This file is part of the sigrok project. + * This file is part of the PulseView project. * * Copyright (C) 2012 Joel Holdsworth * diff --git a/logicsignal.cpp b/logicsignal.cpp index 77ecb2e..5be9b01 100644 --- a/logicsignal.cpp +++ b/logicsignal.cpp @@ -1,5 +1,5 @@ /* - * This file is part of the sigrok project. + * This file is part of the PulseView project. * * Copyright (C) 2012 Joel Holdsworth * diff --git a/logicsignal.h b/logicsignal.h index da9c3a4..81fe6a4 100644 --- a/logicsignal.h +++ b/logicsignal.h @@ -1,5 +1,5 @@ /* - * This file is part of the sigrok project. + * This file is part of the PulseView project. * * Copyright (C) 2012 Joel Holdsworth * diff --git a/main.cpp b/main.cpp index e63c87d..d15cff8 100644 --- a/main.cpp +++ b/main.cpp @@ -1,5 +1,5 @@ /* - * This file is part of the sigrok project. + * This file is part of the PulseView project. * * Copyright (C) 2012 Joel Holdsworth * diff --git a/mainwindow.cpp b/mainwindow.cpp index 2183934..df250ef 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1,5 +1,5 @@ /* - * This file is part of the sigrok project. + * This file is part of the PulseView project. * * Copyright (C) 2012 Joel Holdsworth * diff --git a/mainwindow.h b/mainwindow.h index e80ceb9..c0a4248 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -1,5 +1,5 @@ /* - * This file is part of the sigrok project. + * This file is part of the PulseView project. * * Copyright (C) 2012 Joel Holdsworth * diff --git a/pv/view/header.cpp b/pv/view/header.cpp index bf003a4..4efc0ab 100644 --- a/pv/view/header.cpp +++ b/pv/view/header.cpp @@ -1,5 +1,5 @@ /* - * This file is part of the sigrok project. + * This file is part of the PulseView project. * * Copyright (C) 2012 Joel Holdsworth * diff --git a/pv/view/header.h b/pv/view/header.h index 36b786c..f7979c6 100644 --- a/pv/view/header.h +++ b/pv/view/header.h @@ -1,5 +1,5 @@ /* - * This file is part of the sigrok project. + * This file is part of the PulseView project. * * Copyright (C) 2012 Joel Holdsworth * diff --git a/pv/view/ruler.cpp b/pv/view/ruler.cpp index 743a11f..84a6a2d 100644 --- a/pv/view/ruler.cpp +++ b/pv/view/ruler.cpp @@ -1,5 +1,5 @@ /* - * This file is part of the sigrok project. + * This file is part of the PulseView project. * * Copyright (C) 2012 Joel Holdsworth * diff --git a/pv/view/ruler.h b/pv/view/ruler.h index 7eccc8c..18b565e 100644 --- a/pv/view/ruler.h +++ b/pv/view/ruler.h @@ -1,5 +1,5 @@ /* - * This file is part of the sigrok project. + * This file is part of the PulseView project. * * Copyright (C) 2012 Joel Holdsworth * diff --git a/pv/view/view.cpp b/pv/view/view.cpp index dcf6032..697d071 100644 --- a/pv/view/view.cpp +++ b/pv/view/view.cpp @@ -1,5 +1,5 @@ /* - * This file is part of the sigrok project. + * This file is part of the PulseView project. * * Copyright (C) 2012 Joel Holdsworth * diff --git a/pv/view/view.h b/pv/view/view.h index 07e67f2..042fa96 100644 --- a/pv/view/view.h +++ b/pv/view/view.h @@ -1,5 +1,5 @@ /* - * This file is part of the sigrok project. + * This file is part of the PulseView project. * * Copyright (C) 2012 Joel Holdsworth * diff --git a/pv/view/viewport.cpp b/pv/view/viewport.cpp index 593edef..d837067 100644 --- a/pv/view/viewport.cpp +++ b/pv/view/viewport.cpp @@ -1,5 +1,5 @@ /* - * This file is part of the sigrok project. + * This file is part of the PulseView project. * * Copyright (C) 2012 Joel Holdsworth * diff --git a/pv/view/viewport.h b/pv/view/viewport.h index e32ab09..e2517fa 100644 --- a/pv/view/viewport.h +++ b/pv/view/viewport.h @@ -1,5 +1,5 @@ /* - * This file is part of the sigrok project. + * This file is part of the PulseView project. * * Copyright (C) 2012 Joel Holdsworth * diff --git a/samplingbar.cpp b/samplingbar.cpp index 4ff27ea..b2ca6e0 100644 --- a/samplingbar.cpp +++ b/samplingbar.cpp @@ -1,5 +1,5 @@ /* - * This file is part of the sigrok project. + * This file is part of the PulseView project. * * Copyright (C) 2012 Joel Holdsworth * diff --git a/samplingbar.h b/samplingbar.h index ad26962..695c5aa 100644 --- a/samplingbar.h +++ b/samplingbar.h @@ -1,5 +1,5 @@ /* - * This file is part of the sigrok project. + * This file is part of the PulseView project. * * Copyright (C) 2012 Joel Holdsworth * diff --git a/signal.cpp b/signal.cpp index 436d6ba..77ee301 100644 --- a/signal.cpp +++ b/signal.cpp @@ -1,5 +1,5 @@ /* - * This file is part of the sigrok project. + * This file is part of the PulseView project. * * Copyright (C) 2012 Joel Holdsworth * diff --git a/signal.h b/signal.h index 7d59bb4..27bd556 100644 --- a/signal.h +++ b/signal.h @@ -1,5 +1,5 @@ /* - * This file is part of the sigrok project. + * This file is part of the PulseView project. * * Copyright (C) 2012 Joel Holdsworth * diff --git a/signaldata.cpp b/signaldata.cpp index be44dee..d2573ff 100644 --- a/signaldata.cpp +++ b/signaldata.cpp @@ -1,5 +1,5 @@ /* - * This file is part of the sigrok project. + * This file is part of the PulseView project. * * Copyright (C) 2012 Joel Holdsworth * diff --git a/signaldata.h b/signaldata.h index 463d4fa..d85d436 100644 --- a/signaldata.h +++ b/signaldata.h @@ -1,5 +1,5 @@ /* - * This file is part of the sigrok project. + * This file is part of the PulseView project. * * Copyright (C) 2012 Joel Holdsworth * diff --git a/sigsession.cpp b/sigsession.cpp index 47d9585..ac96833 100644 --- a/sigsession.cpp +++ b/sigsession.cpp @@ -1,5 +1,5 @@ /* - * This file is part of the sigrok project. + * This file is part of the PulseView project. * * Copyright (C) 2012 Joel Holdsworth * diff --git a/sigsession.h b/sigsession.h index f6b1d8e..f7ec385 100644 --- a/sigsession.h +++ b/sigsession.h @@ -1,5 +1,5 @@ /* - * This file is part of the sigrok project. + * This file is part of the PulseView project. * * Copyright (C) 2012 Joel Holdsworth * diff --git a/test/logicdatasnapshot.cpp b/test/logicdatasnapshot.cpp index b86066c..4e31bfa 100644 --- a/test/logicdatasnapshot.cpp +++ b/test/logicdatasnapshot.cpp @@ -1,5 +1,5 @@ /* - * This file is part of the sigrok project. + * This file is part of the PulseView project. * * Copyright (C) 2012 Joel Holdsworth * diff --git a/test/test.cpp b/test/test.cpp index 2c278c0..04c9981 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -1,5 +1,5 @@ /* - * This file is part of the sigrok project. + * This file is part of the PulseView project. * * Copyright (C) 2012 Joel Holdsworth * -- 2.30.2 From 190fc91a86d732c7c9d14603b6bf263894a0e159 Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Fri, 12 Oct 2012 22:32:39 +0200 Subject: [PATCH 06/16] Small consistency fix in a header. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c17e77f..0cebe79 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ ## -## This file is part of PulseView. +## This file is part of the PulseView project. ## ## Copyright (C) 2012 Joel Holdsworth ## -- 2.30.2 From 8f94be14588c7a7ca0f483b649d7a7b5b5f45ae9 Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Fri, 12 Oct 2012 22:08:06 +0200 Subject: [PATCH 07/16] Add initial NSIS file for building a win installer. --- contrib/pulseview.nsi | 287 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 287 insertions(+) create mode 100644 contrib/pulseview.nsi diff --git a/contrib/pulseview.nsi b/contrib/pulseview.nsi new file mode 100644 index 0000000..7ba8172 --- /dev/null +++ b/contrib/pulseview.nsi @@ -0,0 +1,287 @@ +## +## This file is part of the PulseView project. +## +## Copyright (C) 2012 Uwe Hermann +## +## 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, write to the Free Software +## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +## + +# +# This file is used to create the PulseView Windows installer via NSIS. +# +# NSIS documentation: +# http://nsis.sourceforge.net/Docs/ +# http://nsis.sourceforge.net/Docs/Modern%20UI%202/Readme.html +# + +# Include the "Modern UI" header, which gives us the usual Windows look-n-feel. +!include "MUI2.nsh" + + +# --- Global stuff ------------------------------------------------------------ + +# Installer/product name. +Name "PulseView" + +# Filename of the installer executable. +OutFile "pulseview-0.1.0-installer.exe" + +# Where to install the application. +InstallDir "$PROGRAMFILES\sigrok\pulseview" + +# Request admin privileges for Windows Vista and Windows 7. +# http://nsis.sourceforge.net/Docs/Chapter4.html +RequestExecutionLevel admin + +# Local helper definitions. +!define REGSTR "Software\Microsoft\Windows\CurrentVersion\Uninstall\pulseview" + + +# --- MUI interface configuration --------------------------------------------- + +# Use the following icon for the installer EXE file. +!define MUI_ICON "..\icons\sigrok-logo-notext.ico" + +# Show a nice image at the top of each installer page. +!define MUI_HEADERIMAGE + +# Don't automatically go to the Finish page so the user can check the log. +!define MUI_FINISHPAGE_NOAUTOCLOSE + +# Upon "cancel", ask the user if he really wants to abort the installer. +!define MUI_ABORTWARNING + +# Don't force the user to accept the license, just show it. +# Details: http://trac.videolan.org/vlc/ticket/3124 +!define MUI_LICENSEPAGE_BUTTON $(^NextBtn) +!define MUI_LICENSEPAGE_TEXT_BOTTOM "Click Next to continue." + +# File name of the Python installer MSI file. +!define PY_INST "python-3.2.2.msi" + +# Standard install path of the Python installer (do not change!). +!define PY_BIN "c:\Python32" + + +# --- MUI pages --------------------------------------------------------------- + +# Show a nice "Welcome to the ... Setup Wizard" page. +!insertmacro MUI_PAGE_WELCOME + +# Show the license of the project. +!insertmacro MUI_PAGE_LICENSE "..\COPYING" + +# Show a screen which allows the user to select which components to install. +!insertmacro MUI_PAGE_COMPONENTS + +# Allow the user to select a different install directory. +!insertmacro MUI_PAGE_DIRECTORY + +# Perform the actual installation, i.e. install the files. +!insertmacro MUI_PAGE_INSTFILES + +# Show a final "We're done, click Finish to close this wizard" message. +!insertmacro MUI_PAGE_FINISH + +# Pages used for the uninstaller. +!insertmacro MUI_UNPAGE_WELCOME +!insertmacro MUI_UNPAGE_CONFIRM +!insertmacro MUI_UNPAGE_INSTFILES +!insertmacro MUI_UNPAGE_FINISH + + +# --- MUI language files ------------------------------------------------------ + +# Select an installer language (required!). +!insertmacro MUI_LANGUAGE "English" + + +# --- Default section --------------------------------------------------------- + +Section "PulseView (required)" Section1 + + # This section is gray (can't be disabled) in the component list. + SectionIn RO + + # Install the file(s) specified below into the specified directory. + SetOutPath "$INSTDIR" + + # License file + File "..\COPYING" + + # sigrok libs + File "c:\MinGW\msys\1.0\local\lib\libsigrok.a" + File "c:\MinGW\msys\1.0\local\lib\libsigrokdecode.a" + + # PulseView + File "c:\MinGW\msys\1.0\local\bin\pulseview.exe" + + # Icon + File "..\icons\sigrok-logo-notext.ico" + + # MinGW libs + File "c:\MinGW\bin\mingwm10.dll" + File "c:\MinGW\bin\libgcc_s_dw2-1.dll" + File "c:\MinGW\bin\intl.dll" + File "c:\MinGW\bin\libiconv-2.dll" + File "c:\MinGW\bin\libstdc++-6.dll" + + # MSYS libs. + File "c:\MinGW\msys\1.0\bin\msys-1.0.dll" + File "c:\MinGW\msys\1.0\bin\msys-z.dll" + + # External libs + File "c:\MinGW\msys\1.0\local\bin\libglib-2.0-0.dll" + File "c:\MinGW\msys\1.0\local\bin\libgthread-2.0-0.dll" + File "c:\MinGW\msys\1.0\local\bin\libusb-1.0.dll" + File "c:\MinGW\msys\1.0\local\bin\zlib1.dll" + File "c:\MinGW\msys\1.0\local\bin\libzip-2.dll" + File "c:\MinGW\msys\1.0\local\bin\libusb0.dll" + File "c:\MinGW\msys\1.0\local\bin\libftdi.dll" + + # Qt libs + File "c:\QtSDK\Desktop\Qt\4.7.4\mingw\bin\QtCore4.dll" + File "c:\QtSDK\Desktop\Qt\4.7.4\mingw\bin\QtGui4.dll" + + # Install the file(s) specified below into the specified directory. + SetOutPath "$INSTDIR\decoders" + + # Protocol decoders + File /r /x "__pycache__" \ + "c:\MinGW\msys\1.0\local\share\libsigrokdecode\decoders\*" + + # Generate the uninstaller executable. + WriteUninstaller "$INSTDIR\Uninstall.exe" + + # Create a sub-directory in the start menu. + CreateDirectory "$SMPROGRAMS\sigrok" + CreateDirectory "$SMPROGRAMS\sigrok\pulseview" + + # Create a shortcut for PulseView application. + CreateShortCut "$SMPROGRAMS\sigrok\pulseview\PulseView.lnk" \ + "$INSTDIR\pulseview.exe" "" "$INSTDIR\pulseview.exe" \ + 0 SW_SHOWNORMAL \ + "" "Open-source, portable logic analyzer software" + + # Create a shortcut for the uninstaller. + CreateShortCut "$SMPROGRAMS\sigrok\pulseview\Uninstall.lnk" \ + "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0 \ + SW_SHOWNORMAL "" "Uninstall PulseView" + + # Create registry keys for "Add/remove programs" in the control panel. + WriteRegStr HKLM "${REGSTR}" "DisplayName" "PulseView" + WriteRegStr HKLM "${REGSTR}" "UninstallString" \ + "$\"$INSTDIR\Uninstall.exe$\"" + WriteRegStr HKLM "${REGSTR}" "InstallLocation" "$\"$INSTDIR$\"" + WriteRegStr HKLM "${REGSTR}" "DisplayIcon" \ + "$\"$INSTDIR\sigrok-logo-notext.ico$\"" + WriteRegStr HKLM "${REGSTR}" "Publisher" "sigrok" + WriteRegStr HKLM "${REGSTR}" "HelpLink" \ + "http://sigrok.org/wiki/PulseView" + WriteRegStr HKLM "${REGSTR}" "URLUpdateInfo" \ + "http://sigrok.org/wiki/Downloads" + WriteRegStr HKLM "${REGSTR}" "URLInfoAbout" "http://sigrok.org" + WriteRegStr HKLM "${REGSTR}" "DisplayVersion" "0.1.0" + WriteRegStr HKLM "${REGSTR}" "Contact" \ + "sigrok-devel@lists.sourceforge.org" + WriteRegStr HKLM "${REGSTR}" "Comments" \ + "This is a Qt based sigrok GUI." + + # Display "Remove" instead of "Modify/Remove" in the control panel. + WriteRegDWORD HKLM "${REGSTR}" "NoModify" 1 + WriteRegDWORD HKLM "${REGSTR}" "NoRepair" 1 + +SectionEnd + + +# --- Python installer section ------------------------------------------------ + +Section "Python" Section2 + + # Copy the Python installer MSI file into the temporary directory. + SetOutPath "$TEMP" + File "c:\${PY_INST}" + + # Run the Python installer MSI file from within our installer. + ExecWait '"msiexec" /i "$TEMP\${PY_INST}" /QB- /passive ALLUSERS=1' + + # Remove Python installer MSI file again. + Delete "$TEMP\${PY_INST}" + +SectionEnd + + +# --- Uninstaller section ----------------------------------------------------- + +Section "Uninstall" + + # Always delete the uninstaller first (yes, this really works). + Delete "$INSTDIR\Uninstall.exe" + + # Delete the application, the application data, and related libs. + Delete "$INSTDIR\COPYING" + Delete "$INSTDIR\libsigrok.a" + Delete "$INSTDIR\libsigrokdecode.a" + Delete "$INSTDIR\pulseview.exe" + Delete "$INSTDIR\sigrok-logo-notext.ico" + Delete "$INSTDIR\mingwm10.dll" + Delete "$INSTDIR\libgcc_s_dw2-1.dll" + Delete "$INSTDIR\intl.dll" + Delete "$INSTDIR\libiconv-2.dll" + Delete "$INSTDIR\libstdc++-6.dll" + Delete "$INSTDIR\msys-1.0.dll" + Delete "$INSTDIR\msys-z.dll" + Delete "$INSTDIR\libglib-2.0-0.dll" + Delete "$INSTDIR\libgthread-2.0-0.dll" + Delete "$INSTDIR\libusb-1.0.dll" + Delete "$INSTDIR\zlib1.dll" + Delete "$INSTDIR\libzip-2.dll" + Delete "$INSTDIR\libusb0.dll" + Delete "$INSTDIR\libftdi.dll" + Delete "$INSTDIR\QtCore4.dll" + Delete "$INSTDIR\QtGui4.dll" + + # Delete all decoders and everything else in decoders/. + # There could be *.pyc files or __pycache__ subdirs and so on. + RMDir /r "$INSTDIR\decoders\*" + + # Delete the install directory and its sub-directories. + RMDir "$INSTDIR\decoders" + RMDir "$INSTDIR" + + # Delete the links from the start menu. + Delete "$SMPROGRAMS\sigrok\pulseview\PulseView.lnk" + Delete "$SMPROGRAMS\sigrok\pulseview\Uninstall.lnk" + + # Delete the sub-directory in the start menu. + RMDir "$SMPROGRAMS\sigrok\pulseview" + RMDir "$SMPROGRAMS\sigrok" + + # Delete the registry key(s). + DeleteRegKey HKLM "${REGSTR}" + +SectionEnd + + +# --- Component selection section descriptions -------------------------------- + +LangString DESC_Section1 ${LANG_ENGLISH} "This installs the PulseView GUI, the protocol decoders, and all required libraries." +LangString DESC_Section2 ${LANG_ENGLISH} "This installs Python 3.2 in its default location of c:\Python32. If you already have Python 3.2 installed, you don't need to re-install it." + +!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN +!insertmacro MUI_DESCRIPTION_TEXT ${Section1} $(DESC_Section1) +!insertmacro MUI_DESCRIPTION_TEXT ${Section2} $(DESC_Section2) +!insertmacro MUI_FUNCTION_DESCRIPTION_END + -- 2.30.2 From 51e77110d4316fd0106f8306f5e1f0523c5bf7d7 Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Fri, 12 Oct 2012 22:41:01 +0100 Subject: [PATCH 08/16] Moved all classes into the pv namespace --- CMakeLists.txt | 36 ++++++++++--------- main.cpp | 4 +-- about.cpp => pv/about.cpp | 6 +++- about.h => pv/about.h | 4 +++ about.ui => pv/about.ui | 0 datasnapshot.cpp => pv/datasnapshot.cpp | 4 +++ datasnapshot.h => pv/datasnapshot.h | 4 +++ logicdata.cpp => pv/logicdata.cpp | 4 +++ logicdata.h => pv/logicdata.h | 4 +++ .../logicdatasnapshot.cpp | 4 +++ logicdatasnapshot.h => pv/logicdatasnapshot.h | 4 +++ logicsignal.cpp => pv/logicsignal.cpp | 4 +++ logicsignal.h => pv/logicsignal.h | 4 +++ mainwindow.cpp => pv/mainwindow.cpp | 4 +++ mainwindow.h => pv/mainwindow.h | 18 +++++----- samplingbar.cpp => pv/samplingbar.cpp | 4 +++ samplingbar.h => pv/samplingbar.h | 4 +++ signal.cpp => pv/signal.cpp | 4 +++ signal.h => pv/signal.h | 4 +++ signaldata.cpp => pv/signaldata.cpp | 6 +++- signaldata.h => pv/signaldata.h | 4 +++ sigsession.cpp => pv/sigsession.cpp | 4 +++ sigsession.h => pv/sigsession.h | 4 +++ pv/view/header.cpp | 4 +-- pv/view/view.cpp | 6 ++-- pv/view/view.h | 3 +- pv/view/viewport.cpp | 4 +-- test/logicdatasnapshot.cpp | 4 ++- 28 files changed, 121 insertions(+), 38 deletions(-) rename about.cpp => pv/about.cpp (98%) rename about.h => pv/about.h (97%) rename about.ui => pv/about.ui (100%) rename datasnapshot.cpp => pv/datasnapshot.cpp (97%) rename datasnapshot.h => pv/datasnapshot.h (97%) rename logicdata.cpp => pv/logicdata.cpp (97%) rename logicdata.h => pv/logicdata.h (97%) rename logicdatasnapshot.cpp => pv/logicdatasnapshot.cpp (99%) rename logicdatasnapshot.h => pv/logicdatasnapshot.h (98%) rename logicsignal.cpp => pv/logicsignal.cpp (99%) rename logicsignal.h => pv/logicsignal.h (98%) rename mainwindow.cpp => pv/mainwindow.cpp (99%) rename mainwindow.h => pv/mainwindow.h (98%) rename samplingbar.cpp => pv/samplingbar.cpp (99%) rename samplingbar.h => pv/samplingbar.h (97%) rename signal.cpp => pv/signal.cpp (98%) rename signal.h => pv/signal.h (98%) rename signaldata.cpp => pv/signaldata.cpp (96%) rename signaldata.h => pv/signaldata.h (96%) rename sigsession.cpp => pv/sigsession.cpp (99%) rename sigsession.h => pv/sigsession.h (98%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0cebe79..3741e2a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,17 +39,17 @@ find_package(Boost 1.46 COMPONENTS unit_test_framework REQUIRED) set(VERSION 0.1.0) set(pulseview_SOURCES - about.cpp - datasnapshot.cpp - logicdata.cpp - logicdatasnapshot.cpp - logicsignal.cpp main.cpp - mainwindow.cpp - samplingbar.cpp - signaldata.cpp - sigsession.cpp - signal.cpp + pv/about.cpp + pv/datasnapshot.cpp + pv/logicdata.cpp + pv/logicdatasnapshot.cpp + pv/logicsignal.cpp + pv/mainwindow.cpp + pv/samplingbar.cpp + pv/signaldata.cpp + pv/sigsession.cpp + pv/signal.cpp pv/view/header.cpp pv/view/ruler.cpp pv/view/view.cpp @@ -57,10 +57,10 @@ set(pulseview_SOURCES ) set(pulseview_HEADERS - about.h - mainwindow.h - samplingbar.h - sigsession.h + pv/about.h + pv/mainwindow.h + pv/samplingbar.h + pv/sigsession.h pv/view/header.h pv/view/ruler.h pv/view/view.h @@ -68,7 +68,7 @@ set(pulseview_HEADERS ) set(pulseview_FORMS - about.ui + pv/about.ui ) set(pulseview_RESOURCES @@ -76,10 +76,10 @@ set(pulseview_RESOURCES ) set(pulseview_TEST_SOURCES + pv/datasnapshot.cpp + pv/logicdatasnapshot.cpp test/logicdatasnapshot.cpp test/test.cpp - datasnapshot.cpp - logicdatasnapshot.cpp ) qt4_wrap_cpp(pulseview_HEADERS_MOC ${pulseview_HEADERS}) @@ -95,12 +95,14 @@ add_definitions(-DAPP_VERSION="${VERSION}") if(WIN32) include_directories( ${include_directories} + ${CMAKE_CURRENT_BINARY_DIR} ${Boost_INCLUDE_DIRS} ${PKGDEPS_STATIC_INCLUDE_DIRS} ) else(WIN32) include_directories( ${include_directories} + ${CMAKE_CURRENT_BINARY_DIR} ${Boost_INCLUDE_DIRS} ${PKGDEPS_INCLUDE_DIRS} ) diff --git a/main.cpp b/main.cpp index d15cff8..41f8589 100644 --- a/main.cpp +++ b/main.cpp @@ -26,7 +26,7 @@ extern "C" { #include #include -#include "mainwindow.h" +#include "pv/mainwindow.h" int main(int argc, char *argv[]) { @@ -63,7 +63,7 @@ int main(int argc, char *argv[]) } /* Initialise the main window */ - MainWindow w; + pv::MainWindow w; w.show(); /* Run the application */ diff --git a/about.cpp b/pv/about.cpp similarity index 98% rename from about.cpp rename to pv/about.cpp index 0551654..48c1f59 100644 --- a/about.cpp +++ b/pv/about.cpp @@ -25,7 +25,7 @@ extern "C" { #include #include "about.h" -#include "ui_about.h" +#include extern "C" { /* __STDC_FORMAT_MACROS is required for PRIu64 and friends (in C++). */ @@ -34,6 +34,8 @@ extern "C" { #include } +namespace pv { + About::About(QWidget *parent) : QDialog(parent), ui(new Ui::About) @@ -108,3 +110,5 @@ About::~About() { delete ui; } + +} // namespace pv diff --git a/about.h b/pv/about.h similarity index 97% rename from about.h rename to pv/about.h index 76c5065..31392b2 100644 --- a/about.h +++ b/pv/about.h @@ -31,6 +31,8 @@ namespace Ui { class About; } +namespace pv { + class About : public QDialog { Q_OBJECT @@ -44,4 +46,6 @@ private: std::auto_ptr supportedDoc; }; +} // namespace pv + #endif // ABOUT_H diff --git a/about.ui b/pv/about.ui similarity index 100% rename from about.ui rename to pv/about.ui diff --git a/datasnapshot.cpp b/pv/datasnapshot.cpp similarity index 97% rename from datasnapshot.cpp rename to pv/datasnapshot.cpp index 6933ea1..31acca1 100644 --- a/datasnapshot.cpp +++ b/pv/datasnapshot.cpp @@ -24,6 +24,8 @@ #include #include +namespace pv { + DataSnapshot::DataSnapshot(int unit_size) : _data(NULL), _sample_count(0), @@ -49,3 +51,5 @@ void DataSnapshot::append_data(void *data, uint64_t samples) data, samples * _unit_size); _sample_count += samples; } + +} // namespace pv diff --git a/datasnapshot.h b/pv/datasnapshot.h similarity index 97% rename from datasnapshot.h rename to pv/datasnapshot.h index 3bf12f9..221ebcd 100644 --- a/datasnapshot.h +++ b/pv/datasnapshot.h @@ -22,6 +22,8 @@ extern "C" { #include } +namespace pv { + class DataSnapshot { public: @@ -39,3 +41,5 @@ protected: uint64_t _sample_count; int _unit_size; }; + +} // namespace pv diff --git a/logicdata.cpp b/pv/logicdata.cpp similarity index 97% rename from logicdata.cpp rename to pv/logicdata.cpp index 73d35d7..c8b3b84 100644 --- a/logicdata.cpp +++ b/pv/logicdata.cpp @@ -24,6 +24,8 @@ using namespace boost; using namespace std; +namespace pv { + LogicData::LogicData(const sr_datafeed_meta_logic &meta) : SignalData(meta.samplerate > 0 ? meta.samplerate : 1), _num_probes(meta.num_probes) @@ -45,3 +47,5 @@ deque< shared_ptr >& LogicData::get_snapshots() { return _snapshots; } + +} // namespace pv diff --git a/logicdata.h b/pv/logicdata.h similarity index 97% rename from logicdata.h rename to pv/logicdata.h index cde8eef..b21d50a 100644 --- a/logicdata.h +++ b/pv/logicdata.h @@ -27,6 +27,8 @@ extern "C" { #include } +namespace pv { + class LogicDataSnapshot; class LogicData : public SignalData @@ -47,3 +49,5 @@ private: std::deque< boost::shared_ptr > _snapshots; }; + +} // namespace pv diff --git a/logicdatasnapshot.cpp b/pv/logicdatasnapshot.cpp similarity index 99% rename from logicdatasnapshot.cpp rename to pv/logicdatasnapshot.cpp index 62d8a90..347b7e2 100644 --- a/logicdatasnapshot.cpp +++ b/pv/logicdatasnapshot.cpp @@ -31,6 +31,8 @@ using namespace std; +namespace pv { + const int LogicDataSnapshot::MipMapScalePower = 4; const int LogicDataSnapshot::MipMapScaleFactor = 1 << MipMapScalePower; const float LogicDataSnapshot::LogMipMapScaleFactor = logf(MipMapScaleFactor); @@ -353,3 +355,5 @@ int64_t LogicDataSnapshot::pow2_ceil(int64_t x, unsigned int power) const int64_t p = 1 << power; return ((x < 0) ? x : (x + p - 1)) / p * p; } + +} // namespace pv diff --git a/logicdatasnapshot.h b/pv/logicdatasnapshot.h similarity index 98% rename from logicdatasnapshot.h rename to pv/logicdatasnapshot.h index 16e8edd..2154120 100644 --- a/logicdatasnapshot.h +++ b/pv/logicdatasnapshot.h @@ -31,6 +31,8 @@ namespace LogicDataSnapshotTest { class LongPulses; } +namespace pv { + class LogicDataSnapshot : public DataSnapshot { private: @@ -95,3 +97,5 @@ private: friend class LogicDataSnapshotTest::Pulses; friend class LogicDataSnapshotTest::LongPulses; }; + +} // namespace pv diff --git a/logicsignal.cpp b/pv/logicsignal.cpp similarity index 99% rename from logicsignal.cpp rename to pv/logicsignal.cpp index 5be9b01..7543f13 100644 --- a/logicsignal.cpp +++ b/pv/logicsignal.cpp @@ -29,6 +29,8 @@ using namespace boost; using namespace std; +namespace pv { + const float LogicSignal::Margin = 10.0f; const float LogicSignal::Oversampling = 2.0f; @@ -152,3 +154,5 @@ int LogicSignal::get_nominal_offset(const QRect &rect) const { return rect.bottom() - Margin; } + +} // namespace pv diff --git a/logicsignal.h b/pv/logicsignal.h similarity index 98% rename from logicsignal.h rename to pv/logicsignal.h index 81fe6a4..e12f0ca 100644 --- a/logicsignal.h +++ b/pv/logicsignal.h @@ -22,6 +22,8 @@ #include +namespace pv { + class LogicData; class LogicSignal : public Signal @@ -73,3 +75,5 @@ private: int _probe_index; boost::shared_ptr _data; }; + +} // namespace pv diff --git a/mainwindow.cpp b/pv/mainwindow.cpp similarity index 99% rename from mainwindow.cpp rename to pv/mainwindow.cpp index df250ef..2c48dfc 100644 --- a/mainwindow.cpp +++ b/pv/mainwindow.cpp @@ -47,6 +47,8 @@ extern "C" { #include } +namespace pv { + MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { @@ -173,3 +175,5 @@ void MainWindow::run_stop() _sampling_bar->get_record_length(), _sampling_bar->get_sample_rate()); } + +} // namespace pv diff --git a/mainwindow.h b/pv/mainwindow.h similarity index 98% rename from mainwindow.h rename to pv/mainwindow.h index c0a4248..88cbd6f 100644 --- a/mainwindow.h +++ b/pv/mainwindow.h @@ -25,14 +25,6 @@ #include "sigsession.h" -class SamplingBar; - -namespace pv { -namespace view { -class View; -} -} - class QAction; class QMenuBar; class QMenu; @@ -41,6 +33,14 @@ class QStatusBar; class QToolBar; class QWidget; +namespace pv { + +class SamplingBar; + +namespace view { +class View; +} + class MainWindow : public QMainWindow { Q_OBJECT @@ -86,4 +86,6 @@ private slots: void run_stop(); }; +} // namespace pv + #endif // MAINWINDOW_H diff --git a/samplingbar.cpp b/pv/samplingbar.cpp similarity index 99% rename from samplingbar.cpp rename to pv/samplingbar.cpp index b2ca6e0..3104743 100644 --- a/samplingbar.cpp +++ b/pv/samplingbar.cpp @@ -30,6 +30,8 @@ extern "C" { #include "samplingbar.h" +namespace pv { + const uint64_t SamplingBar::RecordLengths[11] = { 1000000, 2000000, @@ -186,3 +188,5 @@ void SamplingBar::on_device_selected() { update_sample_rate_selector(); } + +} // namespace pv diff --git a/samplingbar.h b/pv/samplingbar.h similarity index 97% rename from samplingbar.h rename to pv/samplingbar.h index 695c5aa..170379e 100644 --- a/samplingbar.h +++ b/pv/samplingbar.h @@ -30,6 +30,8 @@ class QAction; +namespace pv { + class SamplingBar : public QToolBar { Q_OBJECT @@ -67,4 +69,6 @@ private: QToolButton _run_stop_button; }; +} // namespace pv + #endif // SAMPLINGBAR_H diff --git a/signal.cpp b/pv/signal.cpp similarity index 98% rename from signal.cpp rename to pv/signal.cpp index 77ee301..92ef808 100644 --- a/signal.cpp +++ b/pv/signal.cpp @@ -22,6 +22,8 @@ #include "extdef.h" +namespace pv { + const QSizeF Signal::LabelPadding(4, 0); Signal::Signal(QString name) : @@ -87,3 +89,5 @@ void Signal::paint_label(QPainter &p, const QRect &rect) p.setPen((colour.lightness() > 64) ? Qt::black : Qt::white); p.drawText(label_rect, Qt::AlignCenter | Qt::AlignVCenter, text); } + +} // namespace pv diff --git a/signal.h b/pv/signal.h similarity index 98% rename from signal.h rename to pv/signal.h index 27bd556..2351a2f 100644 --- a/signal.h +++ b/pv/signal.h @@ -26,6 +26,8 @@ #include +namespace pv { + class SignalData; class Signal @@ -73,3 +75,5 @@ protected: protected: QString _name; }; + +} // namespace pv diff --git a/signaldata.cpp b/pv/signaldata.cpp similarity index 96% rename from signaldata.cpp rename to pv/signaldata.cpp index d2573ff..cf0cb21 100644 --- a/signaldata.cpp +++ b/pv/signaldata.cpp @@ -22,6 +22,8 @@ using namespace std; +namespace pv { + SignalData::SignalData(double samplerate) : _samplerate(samplerate), _start_time(0) @@ -36,4 +38,6 @@ double SignalData::get_samplerate() const double SignalData::get_start_time() const { return _start_time; -} \ No newline at end of file +} + +} // namespace pv diff --git a/signaldata.h b/pv/signaldata.h similarity index 96% rename from signaldata.h rename to pv/signaldata.h index d85d436..57cd543 100644 --- a/signaldata.h +++ b/pv/signaldata.h @@ -20,6 +20,8 @@ #include +namespace pv { + class SignalData { public: @@ -33,3 +35,5 @@ protected: const double _samplerate; const double _start_time; }; + +} // namespace pv diff --git a/sigsession.cpp b/pv/sigsession.cpp similarity index 99% rename from sigsession.cpp rename to pv/sigsession.cpp index ac96833..40c46f0 100644 --- a/sigsession.cpp +++ b/pv/sigsession.cpp @@ -31,6 +31,8 @@ using namespace boost; using namespace std; +namespace pv { + // TODO: This should not be necessary SigSession* SigSession::_session = NULL; @@ -178,3 +180,5 @@ void SigSession::data_feed_in_proc(const struct sr_dev_inst *sdi, assert(_session); _session->data_feed_in(sdi, packet); } + +} // namespace pv diff --git a/sigsession.h b/pv/sigsession.h similarity index 98% rename from sigsession.h rename to pv/sigsession.h index f7ec385..40fce89 100644 --- a/sigsession.h +++ b/pv/sigsession.h @@ -32,6 +32,8 @@ extern "C" { #include } +namespace pv { + class LogicData; class LogicDataSnapshot; class Signal; @@ -77,4 +79,6 @@ private: static SigSession *_session; }; +} // namespace pv + #endif // SIGSESSION_H diff --git a/pv/view/header.cpp b/pv/view/header.cpp index 4efc0ab..aaa98ab 100644 --- a/pv/view/header.cpp +++ b/pv/view/header.cpp @@ -21,8 +21,8 @@ #include "header.h" #include "view.h" -#include "../../signal.h" -#include "../../sigsession.h" +#include "../signal.h" +#include "../sigsession.h" #include diff --git a/pv/view/view.cpp b/pv/view/view.cpp index 697d071..9c4920f 100644 --- a/pv/view/view.cpp +++ b/pv/view/view.cpp @@ -32,9 +32,9 @@ #include "view.h" #include "viewport.h" -#include "../../logicdata.h" -#include "../../logicdatasnapshot.h" -#include "../../sigsession.h" +#include "../logicdata.h" +#include "../logicdatasnapshot.h" +#include "../sigsession.h" using namespace boost; using namespace std; diff --git a/pv/view/view.h b/pv/view/view.h index 042fa96..d2abbf0 100644 --- a/pv/view/view.h +++ b/pv/view/view.h @@ -25,9 +25,10 @@ #include +namespace pv { + class SigSession; -namespace pv { namespace view { class Header; diff --git a/pv/view/viewport.cpp b/pv/view/viewport.cpp index d837067..c1490fc 100644 --- a/pv/view/viewport.cpp +++ b/pv/view/viewport.cpp @@ -21,8 +21,8 @@ #include "view.h" #include "viewport.h" -#include "../../sigsession.h" -#include "../../signal.h" +#include "../sigsession.h" +#include "../signal.h" #include diff --git a/test/logicdatasnapshot.cpp b/test/logicdatasnapshot.cpp index 4e31bfa..503b1dd 100644 --- a/test/logicdatasnapshot.cpp +++ b/test/logicdatasnapshot.cpp @@ -24,10 +24,12 @@ #include #include "../extdef.h" -#include "../logicdatasnapshot.h" +#include "../pv/logicdatasnapshot.h" using namespace std; +using pv::LogicDataSnapshot; + BOOST_AUTO_TEST_SUITE(LogicDataSnapshotTest) void push_logic(LogicDataSnapshot &s, unsigned int length, uint8_t value) -- 2.30.2 From bc1c1462b366a327e2abfc3c0169ab2f657533a5 Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Fri, 12 Oct 2012 23:42:49 +0100 Subject: [PATCH 09/16] Moved install rule out of test section in CMakeLists.txt --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3741e2a..41e6231 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -143,6 +143,8 @@ target_link_libraries(pulseview ) endif(WIN32) +install(PROGRAMS pulseview DESTINATION bin/) + if(ENABLE_TESTS) add_definitions(-DBOOST_TEST_DYN_LINK) @@ -169,6 +171,4 @@ endif(WIN32) enable_testing() add_test(test ${CMAKE_CURRENT_BINARY_DIR}/pulseview-test) -install(PROGRAMS pulseview DESTINATION bin/) - endif(ENABLE_TESTS) -- 2.30.2 From 951c583c1928fb0aeaea4b980114bcf74c362c42 Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Fri, 12 Oct 2012 23:43:52 +0100 Subject: [PATCH 10/16] Indented if statements in CMakeLists.txt --- CMakeLists.txt | 108 ++++++++++++++++++++++++------------------------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 41e6231..07c2d4b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,7 +30,7 @@ pkg_check_modules(PKGDEPS REQUIRED # On Windows/MinGW we explicitly point cmake to the Boost directory. if(WIN32) -set(BOOST_ROOT /usr/local) + set(BOOST_ROOT /usr/local) endif(WIN32) find_package(Qt4 REQUIRED) @@ -93,32 +93,32 @@ add_definitions(-DAPP_VERSION="${VERSION}") # On Windows/MinGW we need PKGDEPS_STATIC_INCLUDE_DIRS. if(WIN32) -include_directories( - ${include_directories} - ${CMAKE_CURRENT_BINARY_DIR} - ${Boost_INCLUDE_DIRS} - ${PKGDEPS_STATIC_INCLUDE_DIRS} -) + include_directories( + ${include_directories} + ${CMAKE_CURRENT_BINARY_DIR} + ${Boost_INCLUDE_DIRS} + ${PKGDEPS_STATIC_INCLUDE_DIRS} + ) else(WIN32) -include_directories( - ${include_directories} - ${CMAKE_CURRENT_BINARY_DIR} - ${Boost_INCLUDE_DIRS} - ${PKGDEPS_INCLUDE_DIRS} -) + include_directories( + ${include_directories} + ${CMAKE_CURRENT_BINARY_DIR} + ${Boost_INCLUDE_DIRS} + ${PKGDEPS_INCLUDE_DIRS} + ) endif(WIN32) # On Windows/MinGW we need PKGDEPS_STATIC_LIBRARY_DIRS. if(WIN32) -link_directories( - ${Boost_LIBRARY_DIRS} - ${PKGDEPS_STATIC_LIBRARY_DIRS} -) + link_directories( + ${Boost_LIBRARY_DIRS} + ${PKGDEPS_STATIC_LIBRARY_DIRS} + ) else(WIN32) -link_directories( - ${Boost_LIBRARY_DIRS} - ${PKGDEPS_LIBRARY_DIRS} -) + link_directories( + ${Boost_LIBRARY_DIRS} + ${PKGDEPS_LIBRARY_DIRS} + ) endif(WIN32) add_executable(pulseview @@ -130,45 +130,45 @@ add_executable(pulseview # On Windows/MinGW we need PKGDEPS_STATIC_LIBRARIES. if(WIN32) -target_link_libraries(pulseview - ${Boost_LIBRARIES} - ${PKGDEPS_STATIC_LIBRARIES} - ${QT_LIBRARIES} -) + target_link_libraries(pulseview + ${Boost_LIBRARIES} + ${PKGDEPS_STATIC_LIBRARIES} + ${QT_LIBRARIES} + ) else(WIN32) -target_link_libraries(pulseview - ${Boost_LIBRARIES} - ${PKGDEPS_LIBRARIES} - ${QT_LIBRARIES} -) + target_link_libraries(pulseview + ${Boost_LIBRARIES} + ${PKGDEPS_LIBRARIES} + ${QT_LIBRARIES} + ) endif(WIN32) install(PROGRAMS pulseview DESTINATION bin/) if(ENABLE_TESTS) -add_definitions(-DBOOST_TEST_DYN_LINK) - -add_executable(pulseview-test - ${pulseview_TEST_SOURCES} -) - -# On Windows/MinGW we need PKGDEPS_STATIC_LIBRARIES. -if(WIN32) -target_link_libraries(pulseview-test - ${Boost_LIBRARIES} - ${PKGDEPS_STATIC_LIBRARIES} - ${QT_LIBRARIES} -) -else(WIN32) -target_link_libraries(pulseview-test - ${Boost_LIBRARIES} - ${PKGDEPS_LIBRARIES} - ${QT_LIBRARIES} -) -endif(WIN32) - -enable_testing() -add_test(test ${CMAKE_CURRENT_BINARY_DIR}/pulseview-test) + add_definitions(-DBOOST_TEST_DYN_LINK) + + add_executable(pulseview-test + ${pulseview_TEST_SOURCES} + ) + + # On Windows/MinGW we need PKGDEPS_STATIC_LIBRARIES. + if(WIN32) + target_link_libraries(pulseview-test + ${Boost_LIBRARIES} + ${PKGDEPS_STATIC_LIBRARIES} + ${QT_LIBRARIES} + ) + else(WIN32) + target_link_libraries(pulseview-test + ${Boost_LIBRARIES} + ${PKGDEPS_LIBRARIES} + ${QT_LIBRARIES} + ) + endif(WIN32) + + enable_testing() + add_test(test ${CMAKE_CURRENT_BINARY_DIR}/pulseview-test) endif(ENABLE_TESTS) -- 2.30.2 From 30588653813298efbf329cb542cf03bf78320380 Mon Sep 17 00:00:00 2001 From: Alexandru Gagniuc Date: Fri, 12 Oct 2012 23:51:14 +0100 Subject: [PATCH 11/16] Added section headers to CMakeLists.txt --- CMakeLists.txt | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 07c2d4b..3adb967 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,7 @@ ## This file is part of the PulseView project. ## ## Copyright (C) 2012 Joel Holdsworth +## Copyright (C) 2012 Alexandru Gagniuc ## ## 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 @@ -22,6 +23,10 @@ include(FindPkgConfig) project(pulseview) +#=============================================================================== +#= Dependencies +#------------------------------------------------------------------------------- + find_package(PkgConfig) pkg_check_modules(PKGDEPS REQUIRED libsigrokdecode>=0.1.0 @@ -38,6 +43,10 @@ find_package(Boost 1.46 COMPONENTS unit_test_framework REQUIRED) set(VERSION 0.1.0) +#=============================================================================== +#= Sources +#------------------------------------------------------------------------------- + set(pulseview_SOURCES main.cpp pv/about.cpp @@ -88,9 +97,17 @@ qt4_add_resources(pulseview_RESOURCES_RCC ${pulseview_RESOURCES}) include(${QT_USE_FILE}) +#=============================================================================== +#= Global Definitions +#------------------------------------------------------------------------------- + add_definitions(${QT_DEFINITIONS}) add_definitions(-DAPP_VERSION="${VERSION}") +#=============================================================================== +#= Global Include Directories +#------------------------------------------------------------------------------- + # On Windows/MinGW we need PKGDEPS_STATIC_INCLUDE_DIRS. if(WIN32) include_directories( @@ -108,6 +125,10 @@ else(WIN32) ) endif(WIN32) +#=============================================================================== +#= Linker Configuration +#------------------------------------------------------------------------------- + # On Windows/MinGW we need PKGDEPS_STATIC_LIBRARY_DIRS. if(WIN32) link_directories( @@ -143,8 +164,16 @@ else(WIN32) ) endif(WIN32) +#=============================================================================== +#= Installation +#------------------------------------------------------------------------------- + install(PROGRAMS pulseview DESTINATION bin/) +#=============================================================================== +#= Tests +#------------------------------------------------------------------------------- + if(ENABLE_TESTS) add_definitions(-DBOOST_TEST_DYN_LINK) -- 2.30.2 From 506523c1f161152fe4eab0f7b72374fd07078c31 Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Fri, 12 Oct 2012 23:11:41 +0100 Subject: [PATCH 12/16] Offer unit tests with a cmake option --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3adb967..512ad18 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,6 +23,12 @@ include(FindPkgConfig) project(pulseview) +#=============================================================================== +#= User Options +#------------------------------------------------------------------------------- + +option(ENABLE_TESTS "Enable unit tests" FALSE) + #=============================================================================== #= Dependencies #------------------------------------------------------------------------------- -- 2.30.2 From b04e278da5b0a9aa7d5e62bbb40f32f0e51f662d Mon Sep 17 00:00:00 2001 From: Alexandru Gagniuc Date: Fri, 12 Oct 2012 23:56:25 +0100 Subject: [PATCH 13/16] Unify the if(WIN32) defines The if(WIN32)/else(WIN32)/endif(WIN32) is an archaic cmake syntax. Remove all the if(WIN32) clauses, and use an option to specify whether we want to link to the static versions of libsigrok*. That's basically what the WIN32 clauses were doing anyway. This makes the "what is going on" more readeable. On WIN32, automatically set this option to link to the static libraries. --- CMakeLists.txt | 89 +++++++++++++++++++------------------------------- 1 file changed, 33 insertions(+), 56 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 512ad18..60d7bfa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,13 @@ project(pulseview) #------------------------------------------------------------------------------- option(ENABLE_TESTS "Enable unit tests" FALSE) +option(STATIC_PKGDEPS_LIBS "Statically link to sigrok libraries" FALSE) + +if(WIN32) + # On Windows/MinGW we need to statically link to libraries + # This option is user configurable, but enable it by default on win32 + set(STATIC_PKGDEPS_LIBS TRUE) +endif() #=============================================================================== #= Dependencies @@ -114,39 +121,35 @@ add_definitions(-DAPP_VERSION="${VERSION}") #= Global Include Directories #------------------------------------------------------------------------------- -# On Windows/MinGW we need PKGDEPS_STATIC_INCLUDE_DIRS. -if(WIN32) - include_directories( - ${include_directories} - ${CMAKE_CURRENT_BINARY_DIR} - ${Boost_INCLUDE_DIRS} - ${PKGDEPS_STATIC_INCLUDE_DIRS} - ) -else(WIN32) - include_directories( - ${include_directories} - ${CMAKE_CURRENT_BINARY_DIR} - ${Boost_INCLUDE_DIRS} - ${PKGDEPS_INCLUDE_DIRS} - ) -endif(WIN32) +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${Boost_INCLUDE_DIRS} +) + +if(STATIC_PKGDEPS_LIBS) + include_directories(${PKGDEPS_STATIC_INCLUDE_DIRS}) +else() + include_directories(${PKGDEPS_INCLUDE_DIRS}) +endif() #=============================================================================== #= Linker Configuration #------------------------------------------------------------------------------- -# On Windows/MinGW we need PKGDEPS_STATIC_LIBRARY_DIRS. -if(WIN32) - link_directories( - ${Boost_LIBRARY_DIRS} - ${PKGDEPS_STATIC_LIBRARY_DIRS} - ) -else(WIN32) - link_directories( - ${Boost_LIBRARY_DIRS} - ${PKGDEPS_LIBRARY_DIRS} - ) -endif(WIN32) +link_directories(${Boost_LIBRARY_DIRS}) + +set(PULSEVIEW_LINK_LIBS + ${Boost_LIBRARIES} + ${QT_LIBRARIES} +) + +if(STATIC_PKGDEPS_LIBS) + link_directories(${PKGDEPS_STATIC_LIBRARY_DIRS}) + list(APPEND PULSEVIEW_LINK_LIBS ${PKGDEPS_STATIC_LIBRARIES}) +else() + link_directories(${PKGDEPS_LIBRARY_DIRS}) + list(APPEND PULSEVIEW_LINK_LIBS ${PKGDEPS_LIBRARIES}) +endif() add_executable(pulseview ${pulseview_SOURCES} @@ -155,20 +158,7 @@ add_executable(pulseview ${pulseview_RESOURCES_RCC} ) -# On Windows/MinGW we need PKGDEPS_STATIC_LIBRARIES. -if(WIN32) - target_link_libraries(pulseview - ${Boost_LIBRARIES} - ${PKGDEPS_STATIC_LIBRARIES} - ${QT_LIBRARIES} - ) -else(WIN32) - target_link_libraries(pulseview - ${Boost_LIBRARIES} - ${PKGDEPS_LIBRARIES} - ${QT_LIBRARIES} - ) -endif(WIN32) +target_link_libraries(pulseview ${PULSEVIEW_LINK_LIBS}) #=============================================================================== #= Installation @@ -188,20 +178,7 @@ if(ENABLE_TESTS) ${pulseview_TEST_SOURCES} ) - # On Windows/MinGW we need PKGDEPS_STATIC_LIBRARIES. - if(WIN32) - target_link_libraries(pulseview-test - ${Boost_LIBRARIES} - ${PKGDEPS_STATIC_LIBRARIES} - ${QT_LIBRARIES} - ) - else(WIN32) - target_link_libraries(pulseview-test - ${Boost_LIBRARIES} - ${PKGDEPS_LIBRARIES} - ${QT_LIBRARIES} - ) - endif(WIN32) + target_link_libraries(pulseview-test ${PULSEVIEW_LINK_LIBS}) enable_testing() add_test(test ${CMAKE_CURRENT_BINARY_DIR}/pulseview-test) -- 2.30.2 From 075fb4995aaaf521502571d26da62a6923555eff Mon Sep 17 00:00:00 2001 From: Alexandru Gagniuc Date: Fri, 12 Oct 2012 15:38:06 -0500 Subject: [PATCH 14/16] Generate a config.h file for versioning Versioning was already handled in CMakeLists.txt, but it was handled in a non-standard and unclear manner. We used set(VERSION for starters. While this is valid CMake syntax, VERSION is also a reserved word in cmake, depending on the context. We were communicating the version information by a compile-time define, again, not a recommended practice. Change versioning to the more standard way of set(*VERSION_MAJOR set(*VERSION_MINOR set(*VERSION_MICRO set(*VERSION_STRING Instead of defining the version at compile time, generate a config.h file with the version information. Signed-off-by: Alexandru Gagniuc --- CMakeLists.txt | 17 +++++++++++++++-- config.h.in | 29 +++++++++++++++++++++++++++++ main.cpp | 5 ++++- 3 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 config.h.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 60d7bfa..2448a32 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,7 +54,21 @@ endif(WIN32) find_package(Qt4 REQUIRED) find_package(Boost 1.46 COMPONENTS unit_test_framework REQUIRED) -set(VERSION 0.1.0) +#=============================================================================== +#= Config Header +#------------------------------------------------------------------------------- + +set(PV_VERSION_MAJOR 0) +set(PV_VERSION_MINOR 1) +set(PV_VERSION_MICRO 0) +set(PV_VERSION_STRING + ${PV_VERSION_MAJOR}.${PV_VERSION_MINOR}.${PV_VERSION_MICRO} +) + +configure_file ( + ${PROJECT_SOURCE_DIR}/config.h.in + ${PROJECT_BINARY_DIR}/config.h +) #=============================================================================== #= Sources @@ -115,7 +129,6 @@ include(${QT_USE_FILE}) #------------------------------------------------------------------------------- add_definitions(${QT_DEFINITIONS}) -add_definitions(-DAPP_VERSION="${VERSION}") #=============================================================================== #= Global Include Directories diff --git a/config.h.in b/config.h.in new file mode 100644 index 0000000..ea9b0d4 --- /dev/null +++ b/config.h.in @@ -0,0 +1,29 @@ +/* + * This file is part of pulseview. + * + * Copyright (C) 2012 Alexandru Gagniuc + * + * 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 . + */ + +#ifndef _PULSEVIEW_CONFIG_H +#define _PULSEVIEW_CONFIG_H + +/* Pulseview version information */ +#define PV_VERSION_MAJOR @PV_VERSION_MAJOR@ +#define PV_VERSION_MINOR @PV_VERSION_MINOR@ +#define PV_VERSION_MICRO @PV_VERSION_MICRO@ +#define PV_VERSION_STRING "@PV_VERSION_STRING@" + +#endif diff --git a/main.cpp b/main.cpp index 41f8589..661c84a 100644 --- a/main.cpp +++ b/main.cpp @@ -26,14 +26,17 @@ extern "C" { #include #include + #include "pv/mainwindow.h" +#include "config.h" + int main(int argc, char *argv[]) { QApplication a(argc, argv); /* Set some application metadata. */ - QApplication::setApplicationVersion(APP_VERSION); + QApplication::setApplicationVersion(PV_VERSION_STRING); QApplication::setApplicationName("PulseView"); QApplication::setOrganizationDomain("http://www.sigrok.org"); -- 2.30.2 From 6a6772b7da8fcc841c2db16dfec5b26cd5bcd8b0 Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Sat, 13 Oct 2012 00:13:44 +0100 Subject: [PATCH 15/16] Use C++ style comments in main.cpp --- main.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/main.cpp b/main.cpp index 661c84a..febe729 100644 --- a/main.cpp +++ b/main.cpp @@ -35,27 +35,27 @@ int main(int argc, char *argv[]) { QApplication a(argc, argv); - /* Set some application metadata. */ + // Set some application metadata QApplication::setApplicationVersion(PV_VERSION_STRING); QApplication::setApplicationName("PulseView"); QApplication::setOrganizationDomain("http://www.sigrok.org"); - /* Initialise libsigrok */ + // Initialise libsigrok if (sr_init() != SR_OK) { qDebug() << "ERROR: libsigrok init failed."; return 1; } - /* Initialise libsigrokdecode */ + // Initialise libsigrokdecode if (srd_init(NULL) != SRD_OK) { qDebug() << "ERROR: libsigrokdecode init failed."; return 1; } - /* Load the protocol decoders */ + // Load the protocol decoders srd_decoder_load_all(); - /* Initialize all libsigrok drivers. */ + // Initialize all libsigrok drivers sr_dev_driver **const drivers = sr_driver_list(); for (sr_dev_driver **driver = drivers; *driver; driver++) { if (sr_driver_init(*driver) != SR_OK) { @@ -65,14 +65,14 @@ int main(int argc, char *argv[]) } } - /* Initialise the main window */ + // Initialise the main window pv::MainWindow w; w.show(); - /* Run the application */ + // Run the application const int ret = a.exec(); - /* Destroy libsigrokdecode and libsigrok */ + // Destroy libsigrokdecode and libsigrok srd_exit(); sr_exit(); -- 2.30.2 From cef18fc6160f8f5055f2617fbe06eb082c2a7bd5 Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Sat, 13 Oct 2012 00:36:12 +0100 Subject: [PATCH 16/16] Made extdef.h a global include --- CMakeLists.txt | 1 + pv/logicdatasnapshot.cpp | 2 +- pv/logicsignal.cpp | 4 ++-- pv/signal.cpp | 4 ++-- pv/view/ruler.cpp | 2 +- test/logicdatasnapshot.cpp | 3 ++- 6 files changed, 9 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2448a32..c645935 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -136,6 +136,7 @@ add_definitions(${QT_DEFINITIONS}) include_directories( ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} ${Boost_INCLUDE_DIRS} ) diff --git a/pv/logicdatasnapshot.cpp b/pv/logicdatasnapshot.cpp index 347b7e2..2b3e8ca 100644 --- a/pv/logicdatasnapshot.cpp +++ b/pv/logicdatasnapshot.cpp @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "extdef.h" +#include #include #include diff --git a/pv/logicsignal.cpp b/pv/logicsignal.cpp index 7543f13..fe5572d 100644 --- a/pv/logicsignal.cpp +++ b/pv/logicsignal.cpp @@ -18,9 +18,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include +#include -#include "extdef.h" +#include #include "logicdata.h" #include "logicdatasnapshot.h" diff --git a/pv/signal.cpp b/pv/signal.cpp index 92ef808..282d272 100644 --- a/pv/signal.cpp +++ b/pv/signal.cpp @@ -18,9 +18,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "signal.h" +#include -#include "extdef.h" +#include "signal.h" namespace pv { diff --git a/pv/view/ruler.cpp b/pv/view/ruler.cpp index 84a6a2d..a2e280b 100644 --- a/pv/view/ruler.cpp +++ b/pv/view/ruler.cpp @@ -21,7 +21,7 @@ #include "ruler.h" #include "view.h" -#include "../../extdef.h" +#include #include #include diff --git a/test/logicdatasnapshot.cpp b/test/logicdatasnapshot.cpp index 503b1dd..02d7195 100644 --- a/test/logicdatasnapshot.cpp +++ b/test/logicdatasnapshot.cpp @@ -18,12 +18,13 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include + #define __STDC_LIMIT_MACROS #include #include -#include "../extdef.h" #include "../pv/logicdatasnapshot.h" using namespace std; -- 2.30.2