diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 2747eb8..7c4a8af 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -13,11 +13,11 @@ jobs: - os: macos-latest platform: macos preset: release-macos - artifact: '*.dmg' + cpack: true - os: windows-latest platform: windows-msvc preset: release-msvc - artifact: '*.Win32.exe' + cpack: true useQtAction: true - os: windows-latest platform: windows-mingw @@ -34,6 +34,7 @@ jobs: MACOS_ASC_API_KEY: ${{ secrets.MACOS_ASC_API_KEY }} MACOS_CODE_SIGN_KEY_BASE64: ${{ secrets.MACOS_CODE_SIGN_KEY_BASE64 }} MACOS_KEYCHAIN_PASSWORD: ${{ secrets.MACOS_KEYCHAIN_PASSWORD }} + - name: Install Qt uses: jurplel/install-qt-action@v3 if: ${{ matrix.useQtAction }} @@ -50,6 +51,7 @@ jobs: with: arch: x64 toolset: 14.29 + - name: Setup msys2 uses: msys2/setup-msys2@v2 if: ${{ matrix.platform == 'windows-mingw' }} @@ -65,24 +67,29 @@ jobs: if: ${{ matrix.platform == 'windows-mingw' }} run: | echo "${{ runner.temp }}/msys64/mingw64/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + - name: Configure run: | cmake --preset ${{ matrix.preset || 'release' }} - name: Build run: | cmake --build --preset release + - name: Pack - if: ${{ matrix.artifact }} + if: ${{ matrix.cpack }} run: | cpack --preset release env: ASC_API_KEY_ID: ${{ secrets.MACOS_ASC_API_KEY_ID }} ASC_API_KEY_ISSUER: ${{ secrets.MACOS_ASC_API_KEY_ISSUER }} ASC_TEAM_ID: ${{ secrets.MACOS_ASC_TEAM_ID }} + - name: Pack zip + if: ${{ matrix.platform == 'windows-msvc' }} + run: | + cpack --preset release -G ZIP - name: Artifact - if: ${{ matrix.artifact }} uses: actions/upload-artifact@v4 with: - path: build/${{ matrix.artifact }} + path: build/cpack/LibreELEC.USB-SD.Creator.* name: ${{ matrix.platform }} compression-level: 0 diff --git a/CMakeLists.txt b/CMakeLists.txt index 43acc90..2e34d37 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,6 +29,7 @@ endif() # options if(WIN32) option(DUMMY_WRITE "Write image to local file named 'dummy_image_file' instead to real device (for testing)") + option(REQUIRE_ADMIN "Build exe that runs only as administrator" ON) endif() # dependencies @@ -125,19 +126,23 @@ qt_add_translations(LibreELEC.USB-SD.Creator ) if(WIN32) - if(MSVC) - set_target_properties(LibreELEC.USB-SD.Creator PROPERTIES - LINK_OPTIONS "/MANIFEST:NO" # disable default manifest - ) - endif() - target_sources(LibreELEC.USB-SD.Creator PUBLIC deviceenumerator_windows.cpp deviceenumerator_windows.h diskwriter_windows.cpp diskwriter_windows.h privileges.h - windows/winapp.rc ) + if(REQUIRE_ADMIN) + target_sources(LibreELEC.USB-SD.Creator PUBLIC + windows/winapp.rc + ) + if(MSVC) + set_target_properties(LibreELEC.USB-SD.Creator PROPERTIES + LINK_OPTIONS "/MANIFEST:NO" # disable default manifest + ) + endif() + endif() + configure_file("windows/winapp.rc.in" "${CMAKE_SOURCE_DIR}/windows/winapp.rc" @ONLY) set(qtDeployExecutable "$") @@ -215,10 +220,11 @@ if(qtDeployExecutable) endif() # cpack +set(CPACK_PACKAGE_DIRECTORY "cpack") set(CPACK_PACKAGE_NAME "${projectDisplayName}") set(CPACK_PACKAGE_VENDOR "LibreELEC") if(WIN32) - set(CPACK_PACKAGE_FILE_NAME "LibreELEC.USB-SD.Creator.Win32") + set(CPACK_PACKAGE_FILE_NAME "LibreELEC.USB-SD.Creator.x64") set(CPACK_GENERATOR INNOSETUP) elseif(APPLE) set(CPACK_PACKAGE_FILE_NAME "LibreELEC.USB-SD.Creator.macOS")