Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows portable zip/MSI package builds #358

Merged
merged 90 commits into from
Jun 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
db02e37
Windows portable zip/MSI package builds
May 21, 2021
8826a2f
Windows portable zip/MSI package builds (1)
May 21, 2021
e59d9bd
Windows portable zip/MSI package builds (2)
May 21, 2021
e0261e2
Windows portable zip/MSI package builds (3)
May 21, 2021
208f26d
Merge branch 'azonenberg:master' into master
someone--else May 21, 2021
f5d5017
#358: append dependent lib licenses into LICENSE.rtf
May 22, 2021
6b66f09
updated scopehal to latest
May 22, 2021
c19a69f
update submodules
umarcor May 25, 2021
f6541c5
ci/msys2: add PKGBUILD recipe for FFTS
umarcor May 17, 2021
8070750
ci: use make install
umarcor May 17, 2021
e0dbdb5
Merge branch 'azonenberg:master' into master
someone--else May 25, 2021
07cd746
Merge pull request #355 from umarcor/cmake-install
azonenberg May 25, 2021
a936d29
Fixed some bugs causing incorrect serialization IDs
azonenberg May 25, 2021
71a7a1b
Refactoring: began preparation for moving filter graph processing int…
azonenberg May 25, 2021
c2457d7
Added mutexing and toher setup for moving filter graph processing out…
azonenberg May 26, 2021
174c614
Moved DownloadWaveforms() into WaveformProcessingThread
azonenberg May 26, 2021
7105ee4
Moved filter pipeline into a background thread to improve UI responsi…
azonenberg May 26, 2021
8cc1694
Restructured thread synchronization to avoid missed events
azonenberg May 26, 2021
87db57b
Updated submodules. Refactored filters test to handle new TestWavefor…
azonenberg May 26, 2021
58f8469
update doc
umarcor May 29, 2021
3de2bc1
ci/msys2: FFTS is now available in MSYS2 repos
umarcor May 28, 2021
c6341a9
Merge pull request #363 from umarcor/clean-ffts
azonenberg May 29, 2021
3fea6cd
Updated readme to just point to manual for build instructions
azonenberg May 29, 2021
d5dd03a
ci: use msys2 recipe
umarcor May 29, 2021
6284ea4
update doc
umarcor May 29, 2021
86175cb
Merge pull request #364 from umarcor/msys2-recipe
azonenberg May 29, 2021
cfa50b5
Added vertical trigger position line. Fixes #362.
azonenberg May 31, 2021
510b518
Cursors now snap to digital and protocol edges if within 5 pixels. Fi…
azonenberg May 31, 2021
613118e
fix #345
spookyvision May 31, 2021
cb8482a
pthread compat wrapper
spookyvision May 31, 2021
15a189d
Merge pull request #366 from spookyvision/intel_mac
azonenberg May 31, 2021
945ccd5
pthread_compat: minor coding style fixes to curly braces, added heade…
azonenberg May 31, 2021
cda6586
Updated to latest scopehal
azonenberg May 31, 2021
486d390
Updated scopehal
azonenberg May 31, 2021
708a6b0
pthread_compat.cpp: include pthread_compat.h so we have the prototype
azonenberg May 31, 2021
b633ea7
Statistic configuration is now saved in scopesession files. Fixes #87.
azonenberg Jun 1, 2021
e2923cd
Fixed potential use-after-free in right click menu
azonenberg Jun 1, 2021
10c2c40
Connection dialog is no longer auto launched when glscopeclient start…
azonenberg Jun 2, 2021
0e57974
Added reecnt scopes list. Fixes #226.
azonenberg Jun 2, 2021
7b59c98
Fix null pointer dereference in graph editor
rroohhh Jun 2, 2021
f48679e
Updated to latest scopehal
azonenberg Jun 2, 2021
cde0925
OscilloscopeWindow: don't assume there's content in recent.yml. Fixes…
azonenberg Jun 2, 2021
ecfc6a2
Merge pull request #371 from rroohhh/right_click_drag
azonenberg Jun 2, 2021
139c79d
HistoryWindow: avoid naming collisions for multi-stream channels
azonenberg Jun 2, 2021
271904b
Added initial complex I/Q import support. Only handles 16-bit signed …
azonenberg Jun 2, 2021
0a7bd07
FilterDialog: support channels with multiple streams
azonenberg Jun 2, 2021
4bf7526
RefreshChannelsMenu: handle multiple streams
azonenberg Jun 3, 2021
2233146
Updated to latest scopehal
azonenberg Jun 3, 2021
217ec7c
OscilloscopeWindow: fixed DoLoadWaveformDataForScope loading multi-st…
azonenberg Jun 3, 2021
ceb14ff
Added "close" menu item. Fixes #369.
azonenberg Jun 3, 2021
dfa06c9
Use cmake option to set c++ standard
xzcvczx Jun 3, 2021
68d2138
Merge pull request #374 from xzcvczx/cmake_cxx11
azonenberg Jun 3, 2021
6e7f5e1
LC_NUMERIC is now set to "C" globally, and only changed to the user's…
azonenberg Jun 4, 2021
d392054
Updated scopehal. Fixed warning message in PreferenceTree for malform…
azonenberg Jun 4, 2021
3e96692
Updated scopehal
azonenberg Jun 4, 2021
3fbef2d
I/Q import now tries to guess sample rate based on file name metadata
azonenberg Jun 4, 2021
5d81755
merge upstream
May 21, 2021
46d062c
Windows portable zip/MSI package builds (2)
May 21, 2021
26c63e0
Windows portable zip/MSI package builds (3)
May 21, 2021
6d5e43c
#358: append dependent lib licenses into LICENSE.rtf
May 22, 2021
7f845e5
updated scopehal to latest
May 22, 2021
4c6da76
updated doc to latest
Jun 4, 2021
9032c41
merge upstream
Jun 4, 2021
ce4e6f1
remove potential glew duplication
May 31, 2021
c93c28a
Added toolbar button for "force trigger" event. Currently uses same i…
azonenberg Jun 6, 2021
5e253b3
Updated CMake minimum version to 3.14 since build fails on 3.13
azonenberg Jun 7, 2021
29164ed
Timebase properties dialog is now modeless
azonenberg Jun 12, 2021
ac7cd6e
Timebase properties dialog now includes controls for real vs equivale…
azonenberg Jun 12, 2021
77f29ea
TimebasePropertiesDialog: refreshed some stale fields when changing s…
azonenberg Jun 12, 2021
f5e1957
Added waveform generation filter category
azonenberg Jun 17, 2021
767510e
FilterGraphEditorWidget: filters with no inputs are now drawn in colu…
azonenberg Jun 17, 2021
0a63133
WaveformArea: filters with no inputs are considered scope channels an…
azonenberg Jun 17, 2021
9b32614
WaveformArea: Filters with no inputs are always legal to create
azonenberg Jun 17, 2021
625312a
Removed UsesCLFFT()
azonenberg Jun 18, 2021
bd764e1
Allow leaving driver arguments blank for demo scope
azonenberg Jun 18, 2021
fbfea2c
Allow waveform generation filters to be added to an empty session via…
azonenberg Jun 19, 2021
9833be2
OscilloscopeWindow: proper handling of sessions with no instruments a…
azonenberg Jun 19, 2021
179e05f
Fixed "continue" instead of "return" causing Windows build failures
azonenberg Jun 19, 2021
7e08472
glscopeclient: Find shared yaml-cpp on mingw
MegabytePhreak Jun 18, 2021
dad98ca
Fix some windows compile errors
MegabytePhreak Jun 18, 2021
e57ecd4
Fixed capitalization issue
azonenberg Jun 19, 2021
c345a61
OscilloscopeWindow: fixed crash when adding a channel to a closed ses…
azonenberg Jun 20, 2021
16258d1
OscilloscopeWindow: fixed one-shot trigger being treated as normal tr…
azonenberg Jun 21, 2021
0989d84
Fixed typo in comment
azonenberg Jun 21, 2021
ce75104
WaveformArea: fixed bug causing second cursor location to not snap co…
azonenberg Jun 21, 2021
0f5dee7
Windows portable zip/MSI package builds
May 21, 2021
cb81c2a
Copy Adwaita icons to Windows dist folder
someone--else Jun 21, 2021
1482c42
Don't copy /mingw64/lib/libffts.dll to Windows dist folder explicitly…
someone--else Jun 21, 2021
f97bcd2
.github/workflows/build.yml: rename MSI build folder to avoid conflict
someone--else Jun 21, 2021
0d57b61
.github/workflows/build.yml: fix missing \
someone--else Jun 21, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
68 changes: 33 additions & 35 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,59 +126,57 @@ jobs:

steps:

- run: git config --global core.autocrlf input
shell: bash

- uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0

- uses: msys2/setup-msys2@v2
with:
update: true
msystem: MINGW64
install: >-
install: |
git
make
mingw-w64-x86_64-gcc
mingw-w64-x86_64-cmake
mingw-w64-x86_64-glm
mingw-w64-x86_64-libsigc++
mingw-w64-x86_64-gtkmm3
mingw-w64-x86_64-yaml-cpp
mingw-w64-x86_64-glew
mingw-w64-x86_64-toolchain

- name: Clone and Build FFTS Library
- name: Build
run: |
git clone https://github.com/anthonix/ffts.git ../ffts
cd ../ffts
mkdir build
cd build
cmake \
-G"MSYS Makefiles" \
-DCMAKE_INSTALL_PREFIX=$MSYSTEM_PREFIX \
-DENABLE_SHARED=ON \
..
make -j4
make install
cd msys2
MINGW_ARCH=mingw64 makepkg-mingw --noconfirm --noprogressbar -sCLf

- name: Build
- name: Test
run: |
mkdir build
cd build
pacman -U --noconfirm msys2/*.zst
glscopeclient --help

- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: glscopeclient-windows
path: msys2/*.zst

- name: Build MSI / portable zip
run: |
mkdir build_msi
cd build_msi
cmake \
-G"MSYS Makefiles" \
-DBUILD_TESTING=OFF \
-DWIXPATH="/c/Program Files (x86)/WiX Toolset v3.11/bin" \
..
make -j4

- name: Upload Artifacts
- name: Upload Artifacts (portable zip)
uses: actions/upload-artifact@v2
with:
name: glscopeclient-windows
path: |
build/src/glscopeclient/glscopeclient.exe
build/src/glscopeclient/gradients/*
build/src/glscopeclient/shaders/*
build/src/glscopeclient/styles/*
build/lib/graphwidget/libgraphwidget.dll
build/lib/log/liblog.dll
build/lib/scopehal/libscopehal.dll
build/lib/scopeprotocols/libscopeprotocols.dll
name: glscopeclient-windows-portable
path: build_msi/dist/windows_x64

- name: Upload Artifacts (MSI)
uses: actions/upload-artifact@v2
with:
name: glscopeclient-windows.msi
path: build_msi/dist/*.msi
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ build
release-build
debug-build
analysis-build
asan-build
8 changes: 6 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.10)
cmake_minimum_required(VERSION 3.14)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
project(glscopeclient)

Expand All @@ -8,6 +8,10 @@ include(CTest)
set(BUILD_DOCS CACHE BOOL "Build the documentation")
set(ANALYZE CACHE BOOL "Run static analysis on the code, requires cppcheck and clang-analyzer to be installed")

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON) # error if compiler doesn't support c++11
set(CMAKE_CXX_EXTENSIONS OFF) # use c++11 instead of gnu++11

# Compiler flags
set(WARNINGS "-Wall -Wextra -Wuninitialized ")
set(WARNINGS "${WARNINGS} -Wshadow -Wpedantic -Wcast-align -Wwrite-strings")
Expand All @@ -19,7 +23,7 @@ elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(WARNINGS "${WARNINGS} -Wno-gnu-zero-variadic-macro-arguments")
endif()

set(CMAKE_CXX_FLAGS "-g ${WARNINGS} --std=c++11 -mtune=native -ffast-math")
set(CMAKE_CXX_FLAGS "-g ${WARNINGS} -mtune=native -ffast-math")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")

# clang doesn't properly use the attributes and so requires avx to build
Expand Down
44 changes: 1 addition & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,46 +6,4 @@ Applications for libscopehal

## Installation

### Linux
#### Install dependencies.

On Debian/Ubuntu:

```
sudo apt-get install build-essential cmake pkg-config libglm-dev libgtkmm-3.0-dev libsigc++-2.0-dev libyaml-cpp-dev liblxi-dev texlive texlive-fonts-extra libglew-dev catch2
```

If you are using an older stable release (such as Debian Buster), you may need to install catch2 from source (https://github.com/catchorg/Catch2). Alternatively, you may pass `-DBUILD_TESTING=OFF` to CMake to disable unit testing, which is not necessary if you are not contributing to the codebase.

#### Install FFTS library.

```
git clone https://github.com/anthonix/ffts.git
cd ffts
mkdir build
cd build
cmake .. -DENABLE_SHARED=ON
make -j4
sudo make install
```

#### Build scopehal and scopehal-apps.

```
git clone https://github.com/azonenberg/scopehal-apps.git --recurse-submodules
cd scopehal-apps
mkdir build
cd build
cmake ..
make
```

The executable is found under `build/src/glscopeclient/glscopeclient` and the manual under `build/doc/glscopeclient-manual.pdf`

#### Install scopehal and scopehal-apps.

There is currently no process for installing `scopehal` or `scopehal-apps`. At this moment, `glscopeclient` is intended to be run from the source directory (`src/glscopeclient`). We welcome your help in setting up a proper install process!

### Windows (experimental)

Refer to [the manual](https://www.antikernel.net/temp/glscopeclient-manual.pdf) for instructions regarding compilation on Windows systems.
Refer to the "getting started" chapter of [the manual](https://www.antikernel.net/temp/glscopeclient-manual.pdf).
2 changes: 1 addition & 1 deletion lib
Submodule lib updated 83 files
+3 −0 .gitmodules
+1 −0 OpenCL-CLHPP
+1 −1 log
+5 −0 scopehal/AgilentOscilloscope.cpp
+1 −0 scopehal/AgilentOscilloscope.h
+5 −0 scopehal/AntikernelLabsOscilloscope.cpp
+1 −0 scopehal/AntikernelLabsOscilloscope.h
+5 −0 scopehal/AntikernelLogicAnalyzer.cpp
+1 −0 scopehal/AntikernelLogicAnalyzer.h
+20 −3 scopehal/CMakeLists.txt
+58 −14 scopehal/DemoOscilloscope.cpp
+3 −3 scopehal/DemoOscilloscope.h
+3 −4 scopehal/DropoutTrigger.cpp
+154 −12 scopehal/Filter.cpp
+5 −8 scopehal/Filter.h
+2 −6 scopehal/FlowGraphNode.cpp
+347 −253 scopehal/LeCroyOscilloscope.cpp
+4 −0 scopehal/LeCroyOscilloscope.h
+456 −11 scopehal/MockOscilloscope.cpp
+15 −0 scopehal/MockOscilloscope.h
+267 −18 scopehal/Oscilloscope.cpp
+36 −0 scopehal/Oscilloscope.h
+4 −0 scopehal/OscilloscopeChannel.h
+4 −2 scopehal/PeakDetectionFilter.cpp
+40 −11 scopehal/PicoOscilloscope.cpp
+1 −0 scopehal/PicoOscilloscope.h
+3 −6 scopehal/PulseWidthTrigger.cpp
+5 −0 scopehal/RigolOscilloscope.cpp
+1 −0 scopehal/RigolOscilloscope.h
+7 −2 scopehal/RohdeSchwarzOscilloscope.cpp
+1 −0 scopehal/RohdeSchwarzOscilloscope.h
+5 −5 scopehal/RuntTrigger.cpp
+49 −28 scopehal/SParameters.cpp
+3 −2 scopehal/SParameters.h
+103 −86 scopehal/SiglentSCPIOscilloscope.cpp
+4 −0 scopehal/SiglentSCPIOscilloscope.h
+5 −0 scopehal/SignalGeneratorOscilloscope.cpp
+1 −0 scopehal/SignalGeneratorOscilloscope.h
+4 −4 scopehal/SlewRateTrigger.cpp
+7 −0 scopehal/TektronixOscilloscope.cpp
+1 −0 scopehal/TektronixOscilloscope.h
+1 −1 scopehal/TestWaveformSource.cpp
+2 −2 scopehal/TestWaveformSource.h
+39 −9 scopehal/TouchstoneParser.cpp
+3 −0 scopehal/TouchstoneParser.h
+6 −0 scopehal/Trigger.cpp
+53 −0 scopehal/Unit.cpp
+24 −0 scopehal/Unit.h
+115 −18 scopehal/scopehal.cpp
+8 −1 scopehal/scopehal.h
+10 −0 scopeprotocols/CMakeLists.txt
+3 −2 scopeprotocols/ChannelEmulationFilter.cpp
+59 −19 scopeprotocols/DeEmbedFilter.cpp
+9 −3 scopeprotocols/DeEmbedFilter.h
+85 −0 scopeprotocols/DigitalToNRZFilter.cpp
+59 −0 scopeprotocols/DigitalToNRZFilter.h
+100 −0 scopeprotocols/DigitalToPAM4Filter.cpp
+61 −0 scopeprotocols/DigitalToPAM4Filter.h
+1 −10 scopeprotocols/FFTFilter.cpp
+0 −2 scopeprotocols/FFTFilter.h
+2 −2 scopeprotocols/FIRFilter.cpp
+154 −0 scopeprotocols/JitterFilter.cpp
+61 −0 scopeprotocols/JitterFilter.h
+217 −0 scopeprotocols/NoiseFilter.cpp
+68 −0 scopeprotocols/NoiseFilter.h
+194 −0 scopeprotocols/PRBSGeneratorFilter.cpp
+67 −0 scopeprotocols/PRBSGeneratorFilter.h
+145 −0 scopeprotocols/StepGeneratorFilter.cpp
+64 −0 scopeprotocols/StepGeneratorFilter.h
+193 −0 scopeprotocols/TDRFilter.cpp
+79 −0 scopeprotocols/TDRFilter.h
+306 −0 scopeprotocols/TDRStepDeEmbedFilter.cpp
+85 −0 scopeprotocols/TDRStepDeEmbedFilter.h
+10 −3 scopeprotocols/TIEMeasurement.cpp
+141 −0 scopeprotocols/ToneGeneratorFilter.cpp
+62 −0 scopeprotocols/ToneGeneratorFilter.h
+2 −6 scopeprotocols/VerticalBathtub.cpp
+194 −0 scopeprotocols/WaveformGenerationFilter.cpp
+65 −0 scopeprotocols/WaveformGenerationFilter.h
+4 −1 scopeprotocols/kernels/DeEmbedFilter.cl
+6 −6 scopeprotocols/kernels/FIRFilter.cl
+10 −1 scopeprotocols/scopeprotocols.cpp
+9 −0 scopeprotocols/scopeprotocols.h
54 changes: 54 additions & 0 deletions msys2/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
_realname=scopehal-apps
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=ci
pkgrel=1
pkgdesc="scopehal-apps: applications for libscopehal (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64')
url="https://github.com/azonenberg/scopehal-apps"
license=('BSD-3-Clause')
groups=("${MINGW_PACKAGE_PREFIX}-eda")
depends=(
"${MINGW_PACKAGE_PREFIX}-glm"
"${MINGW_PACKAGE_PREFIX}-libsigc++"
"${MINGW_PACKAGE_PREFIX}-gtkmm3"
"${MINGW_PACKAGE_PREFIX}-yaml-cpp"
"${MINGW_PACKAGE_PREFIX}-glew"
"${MINGW_PACKAGE_PREFIX}-ffts"
)
makedepends=(
"${MINGW_PACKAGE_PREFIX}-gcc"
"${MINGW_PACKAGE_PREFIX}-cmake"
"make"
)

pkgver() {
cd "${srcdir}"/../..
echo '0.0.0.r'"$(git rev-list --count HEAD)"'.g'"$(git describe --all --long | sed 's/^.*-g\(.*\)/\1/')"
}

build() {
cd "${srcdir}"/../..

git remote set-url origin git://github.com/azonenberg/scopehal-apps
git submodule update --init --recursive

mkdir build
cd build
MSYS2_ARG_CONV_EXCL=-DCMAKE_INSTALL_PREFIX= cmake \
-G "MSYS Makefiles" \
-DCMAKE_INSTALL_PREFIX="${MINGW_PREFIX}" \
-DBUILD_TESTING=OFF \
../
cmake --build .
}

package() {
cd "${srcdir}"/../../build
make DESTDIR="${pkgdir}" install

_licenses="${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}"
mkdir -p "${_licenses}"
install -m 644 "${srcdir}"/../../LICENSE "${_licenses}"
}
74 changes: 69 additions & 5 deletions src/glscopeclient/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,19 @@ endif()
# GLEW and OpenGL are required
find_package(GLEW REQUIRED)
find_package(OpenGL REQUIRED)
find_package(Yaml REQUIRED)

# Git is used for git-describe based version generation if we have it
find_package(Git)

# Additional libraries on Windows
if(WIN32)
set(WIN_LIBS shlwapi)

# For some reason, find_package does not manage to find glew32 on Windows. Hardcoding for now.
set(GLEW_LIBRARIES "glew32")
# The packaging for yaml-cpp on mingw64 seems to be broken, not providing a
# libyaml-cpp.dll.a to be found by find_library inside of find_package(YAML)
# when using FindYAML.cmake, just set the library directly
set(YAML_LIBRARIES yaml-cpp)
else()
find_package(Yaml REQUIRED)
endif()

#Set up include paths
Expand All @@ -39,6 +41,7 @@ configure_file(glscopeclient-version.h.in glscopeclient-version.h)
###############################################################################
#C++ compilation
add_executable(glscopeclient
pthread_compat.cpp
ChannelPropertiesDialog.cpp
FileProgressDialog.cpp
FilterDialog.cpp
Expand Down Expand Up @@ -75,6 +78,7 @@ add_executable(glscopeclient
WaveformArea_cairo.cpp
WaveformGroup.cpp
WaveformGroupPropertiesDialog.cpp
WaveformProcessingThread.cpp

main.cpp
)
Expand All @@ -88,7 +92,7 @@ target_link_libraries(glscopeclient
${SIGCXX_LIBRARIES}
${OPENGL_LIBRARY}
${WIN_LIBS}
${GLEW_LIBRARIES}
GLEW::GLEW
${YAML_LIBRARIES}
)

Expand Down Expand Up @@ -124,6 +128,66 @@ add_dependencies(glscopeclient
icons
)

# Windows portable zip/MSI installer build
if(WIN32)
add_custom_target(
dist_windows_x64
COMMENT "Creating dist/windows_x64..."
DEPENDS glscopeclient
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/dist/windows_x64
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/src/glscopeclient/gradients ${CMAKE_BINARY_DIR}/dist/windows_x64/gradients
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/lib/scopeprotocols/kernels ${CMAKE_BINARY_DIR}/dist/windows_x64/kernels
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/src/glscopeclient/shaders ${CMAKE_BINARY_DIR}/dist/windows_x64/shaders
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/src/glscopeclient/styles ${CMAKE_BINARY_DIR}/dist/windows_x64/styles
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/src/glscopeclient/icons ${CMAKE_BINARY_DIR}/dist/windows_x64/icons
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_SOURCE_DIR}/src/LICENSE
${CMAKE_BINARY_DIR}/lib/graphwidget/libgraphwidget.dll
${CMAKE_BINARY_DIR}/lib/log/liblog.dll
${CMAKE_BINARY_DIR}/lib/scopehal/libscopehal.dll
${CMAKE_BINARY_DIR}/lib/scopeprotocols/libscopeprotocols.dll
${CMAKE_BINARY_DIR}/src/glscopeclient/glscopeclient.exe
${CMAKE_BINARY_DIR}/dist/windows_x64
COMMAND bash -c \"cp -R /mingw64/share/licenses ${CMAKE_BINARY_DIR}/dist/windows_x64\"
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/dist/windows_x64/lib
COMMAND bash -c \"cp -R /mingw64/lib/gdk-pixbuf-2.0 ${CMAKE_BINARY_DIR}/dist/windows_x64/lib\"
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/dist/windows_x64/share/icons
COMMAND bash -c \"cp -R /mingw64/share/icons/hicolor ${CMAKE_BINARY_DIR}/dist/windows_x64/share/icons\"
COMMAND bash -c \"cp -R /mingw64/share/icons/Adwaita ${CMAKE_BINARY_DIR}/dist/windows_x64/share/icons\"
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/dist/windows_x64/share/glib-2.0
COMMAND bash -c \"cp -R /mingw64/share/glib-2.0/schemas ${CMAKE_BINARY_DIR}/dist/windows_x64/share/glib-2.0\"
COMMAND bash -c \"cd ${CMAKE_BINARY_DIR}/dist/windows_x64 && glib-compile-schemas ./share/glib-2.0/schemas\"
COMMAND bash -c \"ldd ${CMAKE_BINARY_DIR}/dist/windows_x64/glscopeclient.exe | grep '\/mingw64\/bin\/.*dll' -o | xargs -I{} cp /mingw64/bin/gdbus.exe \\\"{}\\\" ${CMAKE_BINARY_DIR}/dist/windows_x64\")

add_custom_target(
portable_zip_windows_x64 ALL
COMMENT "Creating portable zip from dist/windows_x64..."
DEPENDS dist_windows_x64
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/dist/windows_x64
COMMAND ${CMAKE_COMMAND} -E tar "cf" "${CMAKE_BINARY_DIR}/dist/glscopeclient-${GLSCOPECLIENT_VERSION}-windows-x64-portable.zip" --format=zip -- .)

if(WIXPATH)
configure_file(wix/glscopeclient.wxs.in ${CMAKE_BINARY_DIR}/glscopeclient.wxs)
add_custom_target(
msi_windows_x64 ALL
COMMENT "Creating Windows x64 MSI..."
DEPENDS dist_windows_x64
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/src/glscopeclient/wix/LICENSE.rtf ${CMAKE_BINARY_DIR}
COMMAND ${WIXPATH}/heat dir dist/windows_x64 -gg -ke -scom -sreg -srd -cg AllFiles -dr APPLICATIONFOLDER -sfrag -template fragment -out glscopeclient-files.wxs
COMMAND ${WIXPATH}/candle -nologo glscopeclient-files.wxs -arch x64 -out glscopeclient-files.wixobj
COMMAND ${WIXPATH}/candle -nologo glscopeclient.wxs -arch x64 -out glscopeclient.wixobj -ext WixUIExtension -ext WixUtilExtension
COMMAND ${WIXPATH}/light -nologo glscopeclient-files.wixobj glscopeclient.wixobj -b dist/windows_x64 -out dist/glscopeclient-${GLSCOPECLIENT_VERSION}-windows-x64.msi -ext WixUIExtension -ext WixUtilExtension)
else()
message("Skipping MSI package build; define WIXPATH to enable")
endif()
endif()

###############################################################################
# Installation

Expand Down