Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
azonenberg committed Jun 22, 2021
2 parents 5855e49 + 0d57b61 commit 0308578
Show file tree
Hide file tree
Showing 6 changed files with 544 additions and 1 deletion.
23 changes: 23 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,26 @@ jobs:
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 (portable zip)
uses: actions/upload-artifact@v2
with:
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
60 changes: 60 additions & 0 deletions src/glscopeclient/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,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

0 comments on commit 0308578

Please sign in to comment.