Skip to content

Commit

Permalink
Convert Windows Release to CMake
Browse files Browse the repository at this point in the history
  • Loading branch information
HTRamsey committed Apr 11, 2024
1 parent fdb5b55 commit f04aade
Show file tree
Hide file tree
Showing 5 changed files with 139 additions and 198 deletions.
91 changes: 91 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Windows

on:
push:
branches:
- master
- 'Stable*'
tags:
- 'v*'
paths-ignore:
- 'docs/**'
- 'android/**'
pull_request:
paths-ignore:
- 'docs/**'
- 'android/**'

jobs:
build:
runs-on: windows-latest

strategy:
matrix:
BuildType: [Debug, Release]

defaults:
run:
shell: cmd

env:
QT_VERSION: 6.6.3
ARTIFACT: QGroundControl-installer.exe

steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
submodules: recursive
fetch-tags: true

- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{ env.QT_VERSION }}
aqtversion: ==3.1.*
host: windows
target: desktop
arch: win64_msvc2019_64
dir: ${{ runner.temp }}
modules: qtcharts qtlocation qtpositioning qtspeech qt5compat qtmultimedia qtserialport qtimageformats qtshadertools qtconnectivity qtquick3d
setup-python: true
cache: true

- name: Setup GStreamer
uses: blinemedical/setup-gstreamer@v1
with:
version: 1.18.6

- name: Install Dependencies
run: choco install --no-progress ninja -y

- name: Set up Visual Studio shell
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64

- name: Create build directory
run: mkdir ${{ runner.temp }}\shadow_build_dir

- name: Configure
working-directory: ${{ runner.temp }}\shadow_build_dir
run: cmake -S ${{ github.workspace }} -B . -G Ninja ^
-DCMAKE_BUILD_TYPE=${{ matrix.BuildType }} ^
-DQGC_STABLE_BUILD=${{ github.ref_type == 'tag' || contains(github.ref, 'Stable') && 'ON' || 'OFF' }}

- name: Build
working-directory: ${{ runner.temp }}\shadow_build_dir
run: cmake --build . --target all --config ${{ matrix.BuildType }}

- name: Install
working-directory: ${{ runner.temp }}\shadow_build_dir
run: cmake --install . --config ${{ matrix.BuildType }}

- name: Upload Build File
uses: ./.github/actions/upload
if: matrix.BuildType == 'Release'
with:
artifact_name: ${{ env.ARTIFACT }}
aws_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
source: ''
97 changes: 0 additions & 97 deletions .github/workflows/windows_debug.yml

This file was deleted.

101 changes: 0 additions & 101 deletions .github/workflows/windows_release.yml

This file was deleted.

2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -294,4 +294,6 @@ if(LINUX)
DESTINATION ${CMAKE_INSTALL_DATADIR}/metainfo/
)
install(SCRIPT "${CMAKE_SOURCE_DIR}/cmake/CreateAppImage.cmake")
elseif(WIN32)
install(SCRIPT "${CMAKE_SOURCE_DIR}/cmake/CreateWinInstaller.cmake")
endif()
46 changes: 46 additions & 0 deletions cmake/CreateWinInstaller.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
message(STATUS "Creating Win Installer")

include(CMakePrintHelpers)

set(QGC_INSTALLER_SOURCE "${CMAKE_CURRENT_LIST_DIR}/../deploy/windows")
cmake_print_variables(QGC_INSTALLER_SOURCE)

set(QGC_INSTALLER_ICON "${QGC_INSTALLER_SOURCE}/WindowsQGC.ico")
set(QGC_INSTALLER_HEADER_BITMAP "${QGC_INSTALLER_SOURCE}/installheader.bmp")
set(QGC_INSTALLER_DRIVER_MSI "${QGC_INSTALLER_SOURCE}/driver.msi")
cmake_print_variables( QGC_INSTALLER_ICON QGC_INSTALLER_HEADER_BITMAP QGC_INSTALLER_DRIVER_MSI)

set(QGC_NSIS_INSTALLER_SCRIPT "${QGC_INSTALLER_SOURCE}/nullsoft_installer.nsi")
set(QGC_NSIS_INSTALLER_CMD "C:/Program Files (x86)/NSIS/makensis.exe")
cmake_print_variables(QGC_NSIS_INSTALLER_SCRIPT QGC_NSIS_INSTALLER_CMD)

set(QGC_NSIS_INSTALLER_PARAMETERS_LIST)
list(APPEND QGC_NSIS_INSTALLER_PARAMETERS_LIST "/DDRIVER_MSI=\"${QGC_INSTALLER_DRIVER_MSI}\"")
list(APPEND QGC_NSIS_INSTALLER_PARAMETERS_LIST "/DINSTALLER_ICON=\"${QGC_INSTALLER_ICON}\"")
list(APPEND QGC_NSIS_INSTALLER_PARAMETERS_LIST "/DHEADER_BITMAP=\"${QGC_INSTALLER_HEADER_BITMAP}\"")
list(APPEND QGC_NSIS_INSTALLER_PARAMETERS_LIST "/DAPPNAME=\"QGroundControl\"")
list(APPEND QGC_NSIS_INSTALLER_PARAMETERS_LIST "/DEXENAME=\"QGroundControl\"")
list(APPEND QGC_NSIS_INSTALLER_PARAMETERS_LIST "/DORGNAME=\"Dronecode Foundation\"")
list(APPEND QGC_NSIS_INSTALLER_PARAMETERS_LIST "/DDESTDIR=${CMAKE_BINARY_DIR}/staging")
list(APPEND QGC_NSIS_INSTALLER_PARAMETERS_LIST "/NOCD")
list(APPEND QGC_NSIS_INSTALLER_PARAMETERS_LIST "\"/XOutFile ${CMAKE_BINARY_DIR}/QGroundControl-installer.exe\"")
list(APPEND QGC_NSIS_INSTALLER_PARAMETERS_LIST "\"${QGC_NSIS_INSTALLER_SCRIPT}\"")
cmake_print_variables(QGC_NSIS_INSTALLER_PARAMETERS_LIST)

list(JOIN QGC_NSIS_INSTALLER_PARAMETERS_LIST " " QGC_NSIS_INSTALLER_PARAMETERS_STR)
cmake_print_variables(QGC_NSIS_INSTALLER_PARAMETERS_STR)

separate_arguments(QGC_NSIS_INSTALLER_PARAMETERS WINDOWS_COMMAND "${QGC_NSIS_INSTALLER_PARAMETERS_STR}")
cmake_print_variables(QGC_NSIS_INSTALLER_PARAMETERS)

message(STATUS "Win Installer Command: \"COMMAND ${QGC_NSIS_INSTALLER_CMD} ${QGC_NSIS_INSTALLER_PARAMETERS}\"")

execute_process(
COMMAND "${QGC_NSIS_INSTALLER_CMD} ${QGC_NSIS_INSTALLER_PARAMETERS}"
RESULTS_VARIABLE NSIS_RESULT
OUTPUT_VARIABLE NSIS_OUTPUT
ERROR_VARIABLE NSIS_ERROR
OUTPUT_STRIP_TRAILING_WHITESPACE
)

cmake_print_variables(NSIS_RESULT NSIS_OUTPUT NSIS_ERROR)

0 comments on commit f04aade

Please sign in to comment.