Skip to content

Commit

Permalink
Fix glscopeclient Windows zip/MSI missing dependencies(using mingw-bu…
Browse files Browse the repository at this point in the history
…ndledlls instead of ldd ...)

Add ngscopeclient Installation/Windows portable zip/MSI installer build
Fix GitHub CI build-windows.yml upload-artifact to export glscopeclient & ngscopeclient msi/portable zip
  • Loading branch information
bvernoux committed Jun 9, 2023
1 parent 2f4cf45 commit 36fac89
Show file tree
Hide file tree
Showing 7 changed files with 948 additions and 34 deletions.
20 changes: 16 additions & 4 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,26 @@ jobs:
name: glscopeclient-windows
path: msys2/*.zst

- name: Upload Artifacts (portable zip)
- name: Upload Artifacts (glscopeclient portable zip)
uses: actions/upload-artifact@v3
with:
name: glscopeclient-windows-portable
path: build/dist/windows_x64
path: build/dist/glscopeclient*.zip

- name: Upload Artifacts (MSI)
- name: Upload Artifacts (glscopeclient MSI)
uses: actions/upload-artifact@v3
with:
name: glscopeclient-windows.msi
path: build/dist/*.msi
path: build/dist/glscopeclient*.msi

- name: Upload Artifacts (ngscopeclient portable zip)
uses: actions/upload-artifact@v3
with:
name: ngscopeclient-windows-portable
path: build/dist/ngscopeclient*.zip

- name: Upload Artifacts (ngscopeclient MSI)
uses: actions/upload-artifact@v3
with:
name: ngscopeclient-windows.msi
path: build/dist/ngscopeclient*.msi
79 changes: 49 additions & 30 deletions src/glscopeclient/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -147,61 +147,80 @@ add_dependencies(glscopeclient
icons
)

# Windows portable zip/MSI installer build
# glscopeclient Windows portable zip/MSI installer build
if(WIXPATH AND WIN32)
# Run the command to get /mingw64/bin full path using where gcc
execute_process(
COMMAND where gcc
RESULT_VARIABLE GCC_RESULT
OUTPUT_VARIABLE GCC_OUTPUT
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# Check the result of the command
if(NOT GCC_RESULT EQUAL 0)
message(FATAL_ERROR "gcc not found!")
endif()
# Get the directory path from gcc output which corresponds to full path related to /mingw64/bin
get_filename_component(MINGW64_BIN_PATH ${GCC_OUTPUT} DIRECTORY)
# Print the path (optional)
message("MINGW64_BIN_PATH: ${MINGW64_BIN_PATH}")

add_custom_target(
dist_windows_x64
COMMENT "Creating dist/windows_x64..."
glscopeclient_dist_windows_x64
COMMENT "Creating dist/glscopeclient_windows_x64..."
DEPENDS glscopeclient
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/dist/windows_x64
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/dist/glscopeclient_windows_x64
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/src/glscopeclient/gradients ${CMAKE_BINARY_DIR}/dist/windows_x64/gradients
${CMAKE_SOURCE_DIR}/src/glscopeclient/gradients ${CMAKE_BINARY_DIR}/dist/glscopeclient_windows_x64/gradients
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/src/glscopeclient/shaders ${CMAKE_BINARY_DIR}/dist/windows_x64/shaders
${CMAKE_SOURCE_DIR}/src/glscopeclient/shaders ${CMAKE_BINARY_DIR}/dist/glscopeclient_windows_x64/shaders
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/src/glscopeclient/styles ${CMAKE_BINARY_DIR}/dist/windows_x64/styles
${CMAKE_SOURCE_DIR}/src/glscopeclient/styles ${CMAKE_BINARY_DIR}/dist/glscopeclient_windows_x64/styles
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/src/glscopeclient/icons ${CMAKE_BINARY_DIR}/dist/windows_x64/icons
${CMAKE_SOURCE_DIR}/src/glscopeclient/icons ${CMAKE_BINARY_DIR}/dist/glscopeclient_windows_x64/icons
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/src/glscopeclient/masks ${CMAKE_BINARY_DIR}/dist/windows_x64/masks
${CMAKE_SOURCE_DIR}/src/glscopeclient/masks ${CMAKE_BINARY_DIR}/dist/glscopeclient_windows_x64/masks
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 ${CMAKE_BINARY_DIR}/lib/scopeprotocols/shaders ${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\")
${CMAKE_BINARY_DIR}/dist/glscopeclient_windows_x64
COMMAND bash -c \"cp -R ${CMAKE_BINARY_DIR}/lib/scopeprotocols/shaders ${CMAKE_BINARY_DIR}/dist/glscopeclient_windows_x64\"
COMMAND bash -c \"cp -R /mingw64/share/licenses ${CMAKE_BINARY_DIR}/dist/glscopeclient_windows_x64\"
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/dist/glscopeclient_windows_x64/lib
COMMAND bash -c \"cp -R /mingw64/lib/gdk-pixbuf-2.0 ${CMAKE_BINARY_DIR}/dist/glscopeclient_windows_x64/lib\"
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/dist/glscopeclient_windows_x64/share/icons
COMMAND bash -c \"cp -R /mingw64/share/icons/hicolor ${CMAKE_BINARY_DIR}/dist/glscopeclient_windows_x64/share/icons\"
COMMAND bash -c \"cp -R /mingw64/share/icons/Adwaita ${CMAKE_BINARY_DIR}/dist/glscopeclient_windows_x64/share/icons\"
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/dist/glscopeclient_windows_x64/share/glib-2.0
COMMAND bash -c \"cp -R /mingw64/share/glib-2.0/schemas ${CMAKE_BINARY_DIR}/dist/glscopeclient_windows_x64/share/glib-2.0\"
COMMAND bash -c \"cd ${CMAKE_BINARY_DIR}/dist/glscopeclient_windows_x64 && glib-compile-schemas ./share/glib-2.0/schemas\"
COMMAND bash -c \"cp /mingw64/bin/gdbus.exe ${CMAKE_BINARY_DIR}/dist/glscopeclient_windows_x64\"
COMMAND bash -c \"wget https://github.com/bvernoux/mingw-bundledlls/releases/download/v0.2.4/mingw-bundledlls-0.2.4-1-x86_64.pkg.tar.zst && pacman -U --noconfirm mingw-bundledlls-*.pkg.tar.zst && rm -f mingw-bundledlls-*.pkg.tar.zst\"
COMMAND bash -c \"export MINGW_BUNDLEDLLS_SEARCH_PATH='${MINGW64_BIN_PATH}\;../../lib/graphwidget\;../../lib/log\;../../lib/scopeexports\;../../lib/scopehal\;../../lib/scopeprotocols\;../../lib/xptools' && mingw-bundledlls ${CMAKE_BINARY_DIR}/dist/glscopeclient_windows_x64/glscopeclient.exe --copy\")

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
glscopeclient_portable_zip_windows_x64 ALL
COMMENT "Creating portable zip from dist/glscopeclient_dist_windows_x64..."
DEPENDS glscopeclient_dist_windows_x64
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/dist/glscopeclient_windows_x64
COMMAND ${CMAKE_COMMAND} -E tar "cf" "${CMAKE_BINARY_DIR}/dist/glscopeclient-${GLSCOPECLIENT_VERSION}-windows-x64-portable.zip" --format=zip -- .)

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
glscopeclient_msi_windows_x64 ALL
COMMENT "Creating glscopeclient Windows x64 MSI..."
DEPENDS glscopeclient_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}/heat dir dist/glscopeclient_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)
COMMAND ${WIXPATH}/light -nologo glscopeclient-files.wixobj glscopeclient.wixobj -b dist/glscopeclient_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()
Expand Down
83 changes: 83 additions & 0 deletions src/ngscopeclient/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,86 @@ target_link_libraries(ngscopeclient
${SIGCXX_LIBRARIES}
)

# ngscopeclient Windows portable zip/MSI installer build
if(WIXPATH AND WIN32)
# Run the command to get /mingw64/bin full path using where gcc
execute_process(
COMMAND where gcc
RESULT_VARIABLE GCC_RESULT
OUTPUT_VARIABLE GCC_OUTPUT
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# Check the result of the command
if(NOT GCC_RESULT EQUAL 0)
message(FATAL_ERROR "gcc not found!")
endif()
# Get the directory path from gcc output which corresponds to full path related to /mingw64/bin
get_filename_component(MINGW64_BIN_PATH ${GCC_OUTPUT} DIRECTORY)
# Print the path (optional)
message("MINGW64_BIN_PATH: ${MINGW64_BIN_PATH}")
add_custom_target(
ngscopeclient_dist_windows_x64
COMMENT "Creating dist/ngscopeclient_windows_x64..."
DEPENDS ngscopeclient
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/dist/ngscopeclient_windows_x64
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/src/ngscopeclient/fonts ${CMAKE_BINARY_DIR}/dist/ngscopeclient_windows_x64/fonts
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/src/ngscopeclient/icons ${CMAKE_BINARY_DIR}/dist/ngscopeclient_windows_x64/icons
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/src/ngscopeclient/masks ${CMAKE_BINARY_DIR}/dist/ngscopeclient_windows_x64/masks
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/src/ngscopeclient/shaders ${CMAKE_BINARY_DIR}/dist/ngscopeclient_windows_x64/shaders

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/scopeexports/libscopeexports.dll
${CMAKE_BINARY_DIR}/lib/scopehal/libscopehal.dll
${CMAKE_BINARY_DIR}/lib/scopeprotocols/libscopeprotocols.dll
${CMAKE_BINARY_DIR}/src/ngscopeclient/ngscopeclient.exe
${CMAKE_BINARY_DIR}/dist/ngscopeclient_windows_x64
COMMAND bash -c \"cp -R ${CMAKE_BINARY_DIR}/lib/scopeprotocols/shaders ${CMAKE_BINARY_DIR}/dist/ngscopeclient_windows_x64\"
COMMAND bash -c \"cp -R /mingw64/share/licenses ${CMAKE_BINARY_DIR}/dist/ngscopeclient_windows_x64\"
COMMAND bash -c \"wget https://github.com/bvernoux/mingw-bundledlls/releases/download/v0.2.4/mingw-bundledlls-0.2.4-1-x86_64.pkg.tar.zst && pacman -U --noconfirm mingw-bundledlls-*.pkg.tar.zst && rm -f mingw-bundledlls-*.pkg.tar.zst\"
COMMAND bash -c \"export MINGW_BUNDLEDLLS_SEARCH_PATH='${MINGW64_BIN_PATH}\;../../lib/graphwidget\;../../lib/log\;../../lib/scopeexports\;../../lib/scopehal\;../../lib/scopeprotocols\;../../lib/xptools' && mingw-bundledlls ${CMAKE_BINARY_DIR}/dist/ngscopeclient_windows_x64/ngscopeclient.exe --copy\")

add_custom_target(
ngscopeclient_portable_zip_windows_x64 ALL
COMMENT "Creating portable zip from dist/ngscopeclient_dist_windows_x64..."
DEPENDS ngscopeclient_dist_windows_x64
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/dist/ngscopeclient_windows_x64
COMMAND ${CMAKE_COMMAND} -E tar "cf" "${CMAKE_BINARY_DIR}/dist/ngscopeclient-${NGSCOPECLIENT_VERSION}-windows-x64-portable.zip" --format=zip -- .)

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

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

install(TARGETS ngscopeclient RUNTIME)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/src/ngscopeclient/fonts
DESTINATION share/ngscopeclient)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/src/ngscopeclient/icons
DESTINATION share/ngscopeclient)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/src/ngscopeclient/masks
DESTINATION share/ngscopeclient)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/src/ngscopeclient/shaders
DESTINATION share/ngscopeclient)

install(FILES ${CMAKE_SOURCE_DIR}/src/ngscopeclient/ngscopeclient.desktop
DESTINATION share/applications)
6 changes: 6 additions & 0 deletions src/ngscopeclient/ngscopeclient.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[Desktop Entry]
Encoding=UTF-8
Name=ngscopeclient
Type=Application
Exec=ngscopeclient
Categories=Development;Electronics
Loading

0 comments on commit 36fac89

Please sign in to comment.