diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f705b32..25cf330 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,127 +9,11 @@ on: jobs: build: - name: Build on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ ubuntu-22.04, macos-latest, windows-latest ] - build_type: [ Release ] - include: - - os: windows-latest - generator: "Visual Studio 17 2022" - - os: ubuntu-22.04 - generator: "Unix Makefiles" - - os: macos-latest - generator: "Unix Makefiles" - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - # Install Qt for all platforms - - name: Install Qt - uses: jurplel/install-qt-action@v3 - with: - version: '6.5.0' - host: ${{ matrix.os == 'windows-latest' && 'windows' || matrix.os == 'macos-latest' && 'mac' || 'linux' }} - target: 'desktop' - arch: ${{ matrix.os == 'windows-latest' && 'win64_msvc2019_64' || matrix.os == 'macos-latest' && 'clang_64' || 'gcc_64' }} - modules: 'qtserialport' - setup-python: true - - # Install additional Linux dependencies if needed - - name: Install additional Linux dependencies - if: matrix.os == 'ubuntu-22.04' - run: | - sudo apt-get update - sudo apt-get install -y libgl1-mesa-dev libxkbcommon-x11-0 - - # macOS code signing setup - - name: Import Code-Signing Certificates - if: matrix.os == 'macos-latest' - uses: Apple-Actions/import-codesign-certs@v2 - with: - p12-file-base64: ${{ secrets.APPLE_CERTIFICATE_BASE64 }} - p12-password: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} - keychain-password: ${{ github.run_id }} - - - name: Configure CMake - run: > - cmake -B ${{github.workspace}}/build - -G "${{matrix.generator}}" - -DCMAKE_BUILD_TYPE=${{matrix.build_type}} - -DCMAKE_PREFIX_PATH=${{env.Qt6_DIR}} - ${{ matrix.os == 'macos-latest' && '-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"' || '' }} - - - name: Build - run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}} - - # After the build step but before code signing, add: - - name: Deploy and Sign Qt dependencies - if: matrix.os == 'macos-latest' - run: | - echo "Deploying and signing Qt frameworks to app bundle" - macdeployqt "${{github.workspace}}/build/Owon1041.app" -always-overwrite -verbose=2 -sign-for-notarization="Developer ID Application: ${{ vars.APPLE_SIGNING_ID }}" - - # macOS code signing - - name: Sign the macOS application - if: matrix.os == 'macos-latest' - run: | - echo "Signing with Developer ID Application: ${{ vars.APPLE_SIGNING_ID }}" - /usr/bin/codesign --force --options runtime --sign "Developer ID Application: ${{ vars.APPLE_SIGNING_ID }}" --verbose "${{github.workspace}}/build/Owon1041.app" - - # macOS notarization (optional but recommended) - - name: Notarize the macOS application - if: matrix.os == 'macos-latest' - env: - APPLE_ID: ${{ secrets.APPLE_ID }} - APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} - run: | - # Create a ZIP archive of the app - ditto -c -k --keepParent "${{github.workspace}}/build/owon1041.app" "${{github.workspace}}/build/owon1041.zip" - - # Notarize the app - xcrun notarytool submit "${{github.workspace}}/build/owon1041.zip" \ - --apple-id "$APPLE_ID" \ - --password "$APPLE_ID_PASSWORD" \ - --team-id "${{ vars.APPLE_TEAM_ID }}" \ - --wait - - # Staple the notarization ticket - xcrun stapler staple "${{github.workspace}}/build/owon1041.app" - - - name: Upload Windows artifacts - if: matrix.os == 'windows-latest' - uses: actions/upload-artifact@v4 - with: - name: windows-build - path: ${{github.workspace}}/build/Release/owon1041.exe - if-no-files-found: error - - - name: Upload macOS artifacts - if: matrix.os == 'macos-latest' - uses: actions/upload-artifact@v4 - with: - name: macos-build - path: ${{github.workspace}}/build/owon1041.app - if-no-files-found: error - - # For Linux - - name: Debug build output - if: matrix.os == 'ubuntu-22.04' - run: | - echo "Listing build directory contents:" - ls -la ${{github.workspace}}/build/ - echo "Finding executable by name:" - find ${{github.workspace}}/build -name "Owon*" -type f -executable - - - name: Upload Linux artifacts - if: matrix.os == 'ubuntu-22.04' - uses: actions/upload-artifact@v4 - with: - name: linux-build - path: ${{github.workspace}}/build/Owon1041 - if-no-files-found: error \ No newline at end of file + uses: ./.github/workflows/workflow-base.yml + with: + artifact_name_prefix: build-artifacts + secrets: + APPLE_CERTIFICATE_BASE64: ${{ secrets.APPLE_CERTIFICATE_BASE64 }} + APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} + APPLE_ID: ${{ secrets.APPLE_ID }} + APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fdbd4a9..c287c3c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,207 +3,37 @@ name: Create Release on: push: tags: - - 'v*.*.*' # Will trigger on tags like v1.0.0, v2.1.3, etc. + - 'v*.*.*' jobs: build: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-22.04, macos-latest, windows-latest] - build_type: [ Release ] - include: - - os: windows-latest - generator: "Visual Studio 17 2022" - - os: ubuntu-22.04 - generator: "Unix Makefiles" - - os: macos-latest - generator: "Unix Makefiles" - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - # Extract version from tag - - name: Extract version from tag - id: get_version - run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT - shell: bash - - # Install Qt for all platforms - - name: Install Qt - uses: jurplel/install-qt-action@v3 - with: - version: '6.5.0' - host: ${{ matrix.os == 'windows-latest' && 'windows' || matrix.os == 'macos-latest' && 'mac' || 'linux' }} - target: 'desktop' - arch: ${{ matrix.os == 'windows-latest' && 'win64_msvc2019_64' || matrix.os == 'macos-latest' && 'clang_64' || 'gcc_64' }} - modules: 'qtserialport' - setup-python: true - - # Install additional Linux dependencies if needed - - name: Install additional Linux dependencies - if: matrix.os == 'ubuntu-22.04' - run: | - sudo apt-get update - sudo apt-get install -y libgl1-mesa-dev libxkbcommon-x11-0 - - # macOS code signing setup - - name: Import Code-Signing Certificates - if: matrix.os == 'macos-latest' - uses: Apple-Actions/import-codesign-certs@v2 - with: - p12-file-base64: ${{ secrets.APPLE_CERTIFICATE_BASE64 }} - p12-password: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} - keychain-password: ${{ github.run_id }} - - - name: Configure CMake - run: > - cmake -B ${{github.workspace}}/build - -G "${{matrix.generator}}" - -DCMAKE_BUILD_TYPE=${{matrix.build_type}} - -DCMAKE_PREFIX_PATH=${{env.Qt6_DIR}} - ${{ matrix.os == 'macos-latest' && '-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"' || '' }} - - - name: Build - run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}} - - # Deploy and sign Qt components in one step (preferred method) - - name: Deploy and Sign Qt dependencies - if: matrix.os == 'macos-latest' - run: | - echo "Deploying and signing Qt frameworks to app bundle" - echo "Qt directory: $Qt6_DIR" - ls -la "${{github.workspace}}/build/" - - # Fix case sensitivity issue if needed - if [ -d "${{github.workspace}}/build/owon1041.app" ] && [ ! -d "${{github.workspace}}/build/Owon1041.app" ]; then - echo "Renaming app bundle for consistency" - mv "${{github.workspace}}/build/owon1041.app" "${{github.workspace}}/build/Owon1041.app" - fi - - # Deploy and sign - macdeployqt "${{github.workspace}}/build/Owon1041.app" -always-overwrite -verbose=3 -sign-for-notarization="Developer ID Application: ${{ vars.APPLE_SIGNING_ID }}" - - # Verify deployment - echo "Verifying deployment:" - ls -la "${{github.workspace}}/build/Owon1041.app/Contents/Frameworks/" - ls -la "${{github.workspace}}/build/Owon1041.app/Contents/PlugIns/" - otool -L "${{github.workspace}}/build/Owon1041.app/Contents/MacOS/Owon1041" - - # If the one-step approach above fails, uncomment this block: - # - name: Sign individual components manually - # if: matrix.os == 'macos-latest' - # run: | - # echo "Signing all Qt frameworks and plugins in the app bundle" - # # Sign frameworks - # find "${{github.workspace}}/build/Owon1041.app/Contents/Frameworks" -type f -name "*.framework" -o -name "*.dylib" | while read -r file; do - # echo "Signing $file" - # /usr/bin/codesign --force --options runtime --sign "Developer ID Application: ${{ vars.APPLE_SIGNING_ID }}" --verbose "$file" - # done - # - # # Sign plugins - # find "${{github.workspace}}/build/Owon1041.app/Contents/PlugIns" -type f -name "*.dylib" | while read -r file; do - # echo "Signing $file" - # /usr/bin/codesign --force --options runtime --sign "Developer ID Application: ${{ vars.APPLE_SIGNING_ID }}" --verbose "$file" - # done - # - # # Then sign the main app bundle - # - name: Sign the macOS application - # if: matrix.os == 'macos-latest' - # run: | - # echo "Signing with Developer ID Application: ${{ vars.APPLE_SIGNING_ID }}" - # /usr/bin/codesign --force --options runtime --sign "Developer ID Application: ${{ vars.APPLE_SIGNING_ID }}" --verbose "${{github.workspace}}/build/Owon1041.app" - - # macOS notarization - - name: Notarize the macOS application - if: matrix.os == 'macos-latest' - env: - APPLE_ID: ${{ secrets.APPLE_ID }} - APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} - run: | - # Create a ZIP archive of the app - ditto -c -k --keepParent "${{github.workspace}}/build/Owon1041.app" "${{github.workspace}}/build/Owon1041.zip" - - # Notarize the app - xcrun notarytool submit "${{github.workspace}}/build/Owon1041.zip" \ - --apple-id "$APPLE_ID" \ - --password "$APPLE_ID_PASSWORD" \ - --team-id "${{ vars.APPLE_TEAM_ID }}" \ - --wait - - # Staple the notarization ticket - xcrun stapler staple "${{github.workspace}}/build/Owon1041.app" - - # Create release packages - - name: Create macOS package - if: matrix.os == 'macos-latest' - run: | - # Create a DMG - hdiutil create -volname "Owon1041" -srcfolder "${{github.workspace}}/build/Owon1041.app" -ov -format UDZO "${{github.workspace}}/build/Owon1041-${{ steps.get_version.outputs.VERSION }}.dmg" - - - name: Create Windows installer - if: matrix.os == 'windows-latest' - run: | - # Fix case sensitivity if needed - if (Test-Path "${{github.workspace}}\build\Release\owon1041.exe" -PathType Leaf) { - echo "Using lowercase executable name" - 7z a -tzip "${{github.workspace}}\build\Owon1041-${{ steps.get_version.outputs.VERSION }}-Windows.zip" "${{github.workspace}}\build\Release\owon1041.exe" - } else { - echo "Using uppercase executable name" - 7z a -tzip "${{github.workspace}}\build\Owon1041-${{ steps.get_version.outputs.VERSION }}-Windows.zip" "${{github.workspace}}\build\Release\Owon1041.exe" - } - - - name: Create Linux package - if: matrix.os == 'ubuntu-22.04' - run: | - # Check executable name capitalization - if [ -f "${{github.workspace}}/build/owon1041" ]; then - tar -czvf "${{github.workspace}}/build/Owon1041-${{ steps.get_version.outputs.VERSION }}-Linux.tar.gz" -C "${{github.workspace}}/build" owon1041 - else - tar -czvf "${{github.workspace}}/build/Owon1041-${{ steps.get_version.outputs.VERSION }}-Linux.tar.gz" -C "${{github.workspace}}/build" Owon1041 - fi - - # Upload artifacts - - name: Upload release artifacts - uses: actions/upload-artifact@v4 - with: - name: release-artifacts-${{ matrix.os }} - path: | - ${{ matrix.os == 'macos-latest' && github.workspace }}/build/*.dmg - ${{ matrix.os == 'windows-latest' && github.workspace }}/build/*.zip - ${{ matrix.os == 'ubuntu-22.04' && github.workspace }}/build/*.tar.gz - if-no-files-found: error + uses: ./.github/workflows/workflow-base.yml + with: + artifact_name_prefix: release-artifacts + secrets: + APPLE_CERTIFICATE_BASE64: ${{ secrets.APPLE_CERTIFICATE_BASE64 }} + APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} + APPLE_ID: ${{ secrets.APPLE_ID }} + APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} release: needs: build runs-on: ubuntu-latest permissions: - contents: write # Add this to ensure the workflow has permission to create releases + contents: write steps: - uses: actions/checkout@v4 - # Extract version from tag - name: Extract version from tag id: get_version run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT - # Download all artifacts - name: Download all artifacts uses: actions/download-artifact@v4 with: path: artifacts - # Debug step to see what files are available - - name: List downloaded artifacts - run: | - echo "Listing all downloaded artifacts:" - find artifacts -type f | sort - - # Create release - name: Create Release - id: create_release uses: softprops/action-gh-release@v1 with: tag_name: v${{ steps.get_version.outputs.VERSION }} @@ -213,7 +43,7 @@ jobs: generate_release_notes: true files: | artifacts/**/*.dmg - artifacts/**/*.zip - artifacts/**/*.tar.gz + artifacts/**/*.msi + artifacts/**/*.deb env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/workflow-base.yml b/.github/workflows/workflow-base.yml new file mode 100644 index 0000000..04ab08e --- /dev/null +++ b/.github/workflows/workflow-base.yml @@ -0,0 +1,203 @@ +name: Reusable Build and Package + +on: + workflow_call: + inputs: + build_type: + required: false + type: string + default: 'Release' + artifact_name_prefix: + required: false + type: string + default: 'artifacts' + secrets: + APPLE_CERTIFICATE_BASE64: + required: false + APPLE_CERTIFICATE_PASSWORD: + required: false + APPLE_ID: + required: false + APPLE_ID_PASSWORD: + required: false + +jobs: + build: + name: Build on ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-22.04, macos-latest, windows-latest, debian-trixie] + include: + - os: windows-latest + runner: windows-latest + generator: "Visual Studio 17 2022" + - os: ubuntu-22.04 + runner: ubuntu-22.04 + generator: "Unix Makefiles" + - os: debian-trixie + runner: ubuntu-latest + generator: "Unix Makefiles" + container: "debian:trixie" + - os: macos-latest + runner: macos-latest + generator: "Unix Makefiles" + + runs-on: ${{ matrix.runner }} + container: ${{ matrix.container }} + + env: + APPLE_CERTIFICATE_BASE64: ${{ secrets.APPLE_CERTIFICATE_BASE64 }} + APPLE_ID: ${{ secrets.APPLE_ID }} + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + # Extract version + - name: Get version + id: get_version + run: | + if [[ $GITHUB_REF == refs/tags/v* ]]; then + echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT + elif [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then + echo "VERSION=0.0.0-PR${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT + else + echo "VERSION=0.0.0-build${{ github.run_number }}" >> $GITHUB_OUTPUT + fi + shell: bash + + # Install Qt for Windows and macOS + - name: Install Qt (Win/Mac) + if: runner.os != 'Linux' + uses: jurplel/install-qt-action@v3 + with: + version: '6.8.2' + host: ${{ matrix.os == 'windows-latest' && 'windows' || 'mac' }} + target: 'desktop' + arch: ${{ matrix.os == 'windows-latest' && 'win64_msvc2022_64' || 'clang_64' }} + modules: 'qtserialport' + setup-python: true + + # Install Linux dependencies including Qt + - name: Install Linux dependencies + if: runner.os == 'Linux' + shell: bash + run: | + QT_SERIALPORT="libqt6serialport6-dev" + if [[ "${{ matrix.os }}" == "debian-trixie" ]]; then + QT_SERIALPORT="qt6-serialport-dev" + fi + + if command -v sudo > /dev/null; then + sudo apt-get update + sudo apt-get install -y \ + qt6-base-dev \ + $QT_SERIALPORT \ + libgl1-mesa-dev \ + libxkbcommon-x11-0 \ + libicu-dev \ + libdouble-conversion-dev \ + libpcre2-16-0 \ + build-essential \ + cmake \ + ninja-build + else + apt-get update + apt-get install -y \ + qt6-base-dev \ + $QT_SERIALPORT \ + libgl1-mesa-dev \ + libxkbcommon-x11-0 \ + libicu-dev \ + libdouble-conversion-dev \ + libpcre2-16-0 \ + build-essential \ + cmake \ + ninja-build + fi + + # macOS code signing setup + - name: Import Code-Signing Certificates + if: matrix.os == 'macos-latest' && env.APPLE_CERTIFICATE_BASE64 != '' + uses: Apple-Actions/import-codesign-certs@v2 + with: + p12-file-base64: ${{ env.APPLE_CERTIFICATE_BASE64 }} + p12-password: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} + keychain-password: ${{ github.run_id }} + + - name: Configure CMake + run: > + cmake -B ${{github.workspace}}/build + -G "${{matrix.generator}}" + -DCMAKE_BUILD_TYPE=${{inputs.build_type}} + -DCMAKE_PREFIX_PATH=${{runner.os == 'Linux' && '/usr/lib/x86_64-linux-gnu/cmake/Qt6' || env.Qt6_DIR}} + -DAPP_VERSION=${{ steps.get_version.outputs.VERSION }} + ${{ matrix.os == 'macos-latest' && '-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"' || '' }} + + - name: Build + run: cmake --build ${{github.workspace}}/build --config ${{inputs.build_type}} + + # Deploy and sign Qt components (macOS) + - name: Deploy and Sign Qt dependencies + if: matrix.os == 'macos-latest' + run: | + # Fix case sensitivity issue if needed + if [ -d "${{github.workspace}}/build/owon1041.app" ] && [ ! -d "${{github.workspace}}/build/Owon1041.app" ]; then + mv "${{github.workspace}}/build/owon1041.app" "${{github.workspace}}/build/Owon1041.app" + fi + + # Deploy and sign + SIGN_ARG="" + if [[ "${{ vars.APPLE_SIGNING_ID }}" != "" ]]; then + SIGN_ARG="-sign-for-notarization=\"Developer ID Application: ${{ vars.APPLE_SIGNING_ID }}\"" + fi + + eval macdeployqt "${{github.workspace}}/build/Owon1041.app" -always-overwrite -verbose=3 $SIGN_ARG + + # macOS notarization + - name: Notarize the macOS application + if: matrix.os == 'macos-latest' && env.APPLE_ID != '' + env: + APPLE_ID: ${{ env.APPLE_ID }} + APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} + run: | + ditto -c -k --keepParent "${{github.workspace}}/build/Owon1041.app" "${{github.workspace}}/build/Owon1041.zip" + xcrun notarytool submit "${{github.workspace}}/build/Owon1041.zip" \ + --apple-id "$APPLE_ID" \ + --password "$APPLE_ID_PASSWORD" \ + --team-id "${{ vars.APPLE_TEAM_ID }}" \ + --wait + xcrun stapler staple "${{github.workspace}}/build/Owon1041.app" + + # Create packages + - name: Create macOS package + if: matrix.os == 'macos-latest' + run: | + hdiutil create -volname "Owon1041" -srcfolder "${{github.workspace}}/build/Owon1041.app" -ov -format UDZO "${{github.workspace}}/build/Owon1041-${{ steps.get_version.outputs.VERSION }}.dmg" + + - name: Create Windows installer + if: matrix.os == 'windows-latest' + shell: pwsh + run: | + & "$env:Qt6_DIR\bin\windeployqt.exe" --release --no-translations --no-opengl-sw --no-system-d3d-compiler "${{github.workspace}}\build\Release\Owon1041.exe" + cd ${{github.workspace}}/build + cpack -G WIX -C ${{inputs.build_type}} + + - name: Create Linux package + if: runner.os == 'Linux' + run: | + cd ${{github.workspace}}/build + cpack -G DEB + + # Upload artifacts + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: ${{ inputs.artifact_name_prefix }}-${{ matrix.os }} + path: | + ${{ github.workspace }}/build/*.dmg + ${{ github.workspace }}/build/*.msi + ${{ github.workspace }}/build/*.deb + if-no-files-found: error diff --git a/CMakeLists.txt b/CMakeLists.txt index 4826606..1b27014 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,21 @@ cmake_minimum_required(VERSION 3.16) -project(Owon1041 VERSION 1.0.0 LANGUAGES CXX) + +# Set version from variable if provided, otherwise use default +if(APP_VERSION) + # CMake project() VERSION must be numeric (major.minor.patch[.tweak]) + # Extract the numeric part (e.g., 0.0.0 from 0.0.0-PR6) + string(REGEX MATCH "^[0-9]+\\.[0-9]+\\.[0-9]+" APP_VERSION_NUMERIC "${APP_VERSION}") + if(APP_VERSION_NUMERIC) + project(Owon1041 VERSION ${APP_VERSION_NUMERIC} LANGUAGES CXX) + else() + project(Owon1041 VERSION 1.0.0 LANGUAGES CXX) + endif() + # Keep the full version for later use (packaging, etc.) + set(FULL_APP_VERSION ${APP_VERSION}) +else() + project(Owon1041 VERSION 1.0.0 LANGUAGES CXX) + set(FULL_APP_VERSION "1.0.0") +endif() # Add this near the top, after your project() declaration if(APPLE) @@ -24,6 +40,7 @@ set(QT_COMMON_PATHS "/usr/local/opt/qt@6" "/usr/local/opt/qt6" "/usr/local/qt6" + "C:/Qt/6.8.2/msvc2022_64" "C:/Qt/6.5.0/msvc2019_64" "C:/Qt/6.5.0/mingw_64" ) @@ -64,6 +81,10 @@ if(APPLE) set_source_files_properties(${APP_ICON_MACOSX} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources") set(PLATFORM_SPECIFIC_ICON_FILES ${APP_ICON_MACOSX}) +elseif(WIN32) + # Windows icon (requires a resource file) + set(APP_ICON_WINDOWS "${CMAKE_CURRENT_SOURCE_DIR}/Owon1041.rc") + set(PLATFORM_SPECIFIC_ICON_FILES ${APP_ICON_WINDOWS}) elseif(UNIX AND NOT APPLE) # Linux doesn't use resource files in the executable directly set(PLATFORM_SPECIFIC_ICON_FILES "") @@ -140,8 +161,43 @@ elseif(UNIX AND NOT APPLE) DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/256x256/apps ) - # Install SVG icon - install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/linux/icons/scalable/owon1041.svg - DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps + # Install SVG icon (if exists) + if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/linux/icons/scalable/owon1041.svg") + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/linux/icons/scalable/owon1041.svg + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps + ) + endif() +elseif(WIN32) + # Installation paths for Windows + include(GNUInstallDirs) + install(TARGETS Owon1041 + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) -endif() \ No newline at end of file +endif() + +# CPack configuration +set(CPACK_PACKAGE_NAME "Owon1041") +set(CPACK_PACKAGE_VENDOR "MacWake") +set(CPACK_PACKAGE_VERSION "${FULL_APP_VERSION}") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "OWON XDM-1041 Multimeter Interface") +set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/doc/README.md") + +if(WIN32) + set(CPACK_GENERATOR "WIX") + set(CPACK_WIX_UPGRADE_GUID "D9A1C5B0-1234-5678-90AB-CDEF12345678") # Generate a real one if needed + set(CPACK_WIX_PRODUCT_ICON "${CMAKE_CURRENT_SOURCE_DIR}/Owon1041.ico") + set(CPACK_PACKAGE_INSTALL_DIRECTORY "Owon1041") + # Start menu entry + set(CPACK_PACKAGE_EXECUTABLES "Owon1041" "Owon1041") + set(CPACK_CREATE_DESKTOP_LINKS "Owon1041") + set(CPACK_WIX_PROGRAM_MENU_FOLDER "Owon1041") +elseif(UNIX AND NOT APPLE) + set(CPACK_GENERATOR "DEB") + set(CPACK_DEBIAN_PACKAGE_MAINTAINER "MacWake ") + set(CPACK_DEBIAN_PACKAGE_DEPENDS "libqt6widgets6, libqt6serialport6, libqt6gui6, libqt6core6") + # For distinct Debian/Ubuntu packages, we might need to adjust dependencies or names in GHA + set(CPACK_DEBIAN_PACKAGE_SECTION "utils") + set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional") +endif() + +include(CPack) \ No newline at end of file diff --git a/Owon1041.ico b/Owon1041.ico new file mode 100644 index 0000000..9af80c4 Binary files /dev/null and b/Owon1041.ico differ diff --git a/Owon1041.png b/Owon1041.png new file mode 100644 index 0000000..dd7f4c7 Binary files /dev/null and b/Owon1041.png differ diff --git a/Owon1041.rc b/Owon1041.rc new file mode 100644 index 0000000..25a14ad --- /dev/null +++ b/Owon1041.rc @@ -0,0 +1 @@ +IDI_ICON1 ICON DISCARDABLE "Owon1041.ico"