Skip to content

Commit

Permalink
Merge pull request #61 from kambala-decapitator/windows-adjustments
Browse files Browse the repository at this point in the history
Windows adjustments
  • Loading branch information
CvH committed Feb 24, 2024
2 parents a12fa15 + 14f5e36 commit 583ef6b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 13 deletions.
17 changes: 12 additions & 5 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}
Expand All @@ -50,6 +51,7 @@ jobs:
with:
arch: x64
toolset: 14.29

- name: Setup msys2
uses: msys2/setup-msys2@v2
if: ${{ matrix.platform == 'windows-mingw' }}
Expand All @@ -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
22 changes: 14 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 "$<TARGET_FILE_NAME:LibreELEC.USB-SD.Creator>")
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 583ef6b

Please sign in to comment.