Skip to content

Commit

Permalink
Experimental 32-bit Windows workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ralight committed Oct 29, 2024
1 parent fb9b115 commit 8991837
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 14 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/windows-x86.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Windows x86 build

on:
workflow_dispatch:
push:
branches: [ "master", "fixes", "develop" ]
tags: [ "v[0-9]+.*" ]
pull_request:
branches: [ "master", "fixes", "develop" ]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
mosquitto:
runs-on: windows-2022

steps:
- uses: actions/checkout@v4


- name: vcpkg build
uses: johnwason/vcpkg-action@v6
id: vcpkg
with:
manifest-dir: ${{ github.workspace }}
triplet: x86-windows
token: ${{ github.token }}
github-binarycache: true

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DWITH_LIBWEBSOCKETS=ON -DWITH_TESTS=OFF -DCMAKE_GENERATOR_PLATFORM=WIN32 -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x86-windows -DVCPKG_MANIFEST_MODE=ON
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

- uses: suisei-cn/[email protected]
id: vcredist
name: Download VC redistributable
with:
url: https://aka.ms/vs/17/release/vc_redist.x86.exe
target: ${{github.workspace}}/installer/

- name: Installer
uses: joncloud/makensis-action@v4
with:
script-file: ${{github.workspace}}/installer/mosquitto.nsi

- name: Upload installer to artifacts
uses: actions/upload-artifact@v4
with:
name: installer
path: ${{ github.workspace }}/installer/mosquitto*.exe
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
# To configure the build options either use the CMake gui, or run the command
# line utility including the "-i" option.

cmake_minimum_required(VERSION 3.5)
cmake_policy(SET CMP0042 NEW)
cmake_minimum_required(VERSION 3.18)

project(mosquitto)
set (VERSION 2.0.20)
Expand Down
40 changes: 28 additions & 12 deletions installer/mosquitto.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ Section "Files" SecInstall
SetOutPath "$INSTDIR"
File "..\logo\mosquitto.ico"
File "..\build\src\Release\mosquitto.exe"
File "..\build\apps\mosquitto_passwd\Release\mosquitto_passwd.exe"
File "..\build\apps\mosquitto_ctrl\Release\mosquitto_ctrl.exe"
File "..\build\apps\mosquitto_passwd\Release\mosquitto_passwd.exe"
File "..\build\client\Release\mosquitto_pub.exe"
File "..\build\client\Release\mosquitto_sub.exe"
File "..\build\client\Release\mosquitto_rr.exe"
Expand All @@ -63,12 +63,17 @@ Section "Files" SecInstall
File "..\README.md"
File "..\README-windows.txt"
File "..\README-letsencrypt.md"
;File "C:\pthreads\Pre-built.2\dll\x86\pthreadVC2.dll"
File "C:\OpenSSL-Win32\bin\libssl-1_1.dll"
File "C:\OpenSSL-Win32\bin\libcrypto-1_1.dll"
File "..\SECURITY.md"
File "..\edl-v10"
File "..\epl-v20"

File "..\build\vcpkg_installed\x86-windows-release\bin\cjson.dll"
File "..\build\vcpkg_installed\x86-windows-release\bin\libcrypto-3.dll"
File "..\build\vcpkg_installed\x86-windows-release\bin\libssl-3.dll"
File "..\build\vcpkg_installed\x86-windows-release\bin\pthreadVC3.dll"
File "..\build\vcpkg_installed\x86-windows-release\bin\uv.dll"
File "..\build\vcpkg_installed\x86-windows-release\bin\websockets.dll"

SetOutPath "$INSTDIR\devel"
File "..\build\lib\Release\mosquitto.lib"
File "..\build\lib\cpp\Release\mosquittopp.lib"
Expand All @@ -93,6 +98,13 @@ Section "Files" SecInstall
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
SectionEnd

Section "Visual Studio Runtime"
SetOutPath "$INSTDIR"
File "VC_redist.x86.exe"
ExecWait '"$INSTDIR\VC_redist.x86.exe" /quiet /norestart'
Delete "$INSTDIR\VC_redist.x86.exe"
SectionEnd

Section "Service" SecService
ExecWait '"$INSTDIR\mosquitto.exe" install'
ExecWait 'sc start mosquitto'
Expand All @@ -104,36 +116,41 @@ Section "Uninstall"
ExecWait '"$INSTDIR\mosquitto.exe" uninstall'
Sleep 1000

Delete "$INSTDIR\mosquitto.dll"
Delete "$INSTDIR\mosquitto.exe"
Delete "$INSTDIR\mosquitto_ctrl.exe"
Delete "$INSTDIR\mosquitto_passwd.exe"
Delete "$INSTDIR\mosquitto_pub.exe"
Delete "$INSTDIR\mosquitto_sub.exe"
Delete "$INSTDIR\mosquitto_rr.exe"
Delete "$INSTDIR\mosquitto.dll"
Delete "$INSTDIR\mosquitto_sub.exe"
Delete "$INSTDIR\mosquittopp.dll"
Delete "$INSTDIR\mosquitto_dynamic_security.dll"
Delete "$INSTDIR\aclfile.example"
Delete "$INSTDIR\ChangeLog.txt"
Delete "$INSTDIR\mosquitto.conf"
Delete "$INSTDIR\pwfile.example"
Delete "$INSTDIR\NOTICE.md"
Delete "$INSTDIR\README.md"
Delete "$INSTDIR\README-windows.txt"
Delete "$INSTDIR\README-letsencrypt.md"
;Delete "$INSTDIR\pthreadVC2.dll"
Delete "$INSTDIR\libssl-1_1.dll"
Delete "$INSTDIR\libcrypto-1_1.dll"
Delete "$INSTDIR\SECURITY.md"
Delete "$INSTDIR\edl-v10"
Delete "$INSTDIR\epl-v20"
Delete "$INSTDIR\mosquitto.ico"

Delete "$INSTDIR\cjson.dll"
Delete "$INSTDIR\libcrypto-3.dll"
Delete "$INSTDIR\libssl-3.dll"
Delete "$INSTDIR\pthreadVC3.dll"
Delete "$INSTDIR\uv.dll"
Delete "$INSTDIR\websockets.dll"

Delete "$INSTDIR\devel\mosquitto.h"
Delete "$INSTDIR\devel\mosquitto.lib"
Delete "$INSTDIR\devel\mosquitto_broker.h"
Delete "$INSTDIR\devel\mosquitto_plugin.h"
Delete "$INSTDIR\devel\mosquittopp.h"
Delete "$INSTDIR\devel\mosquittopp.lib"
Delete "$INSTDIR\devel\mqtt_protocol.h"
RMDir "$INSTDIR\devel\mosquitto"
RMDir "$INSTDIR\devel"

Delete "$INSTDIR\Uninstall.exe"
Expand All @@ -151,4 +168,3 @@ LangString DESC_SecService ${LANG_ENGLISH} "Install mosquitto as a Windows servi
!insertmacro MUI_DESCRIPTION_TEXT ${SecInstall} $(DESC_SecInstall)
!insertmacro MUI_DESCRIPTION_TEXT ${SecService} $(DESC_SecService)
!insertmacro MUI_FUNCTION_DESCRIPTION_END

0 comments on commit 8991837

Please sign in to comment.