Skip to content

Commit cff7c00

Browse files
committed
Add Windows x86 and ARM64 builds and installers
- Add Win32 and ARM64 matrix entries to build-and-test.yml (ARM64 is cross-compiled, build-only without tests) - Add -Architecture parameter to build script, passed as -A to cmake - Use CMAKE_SYSTEM_PROCESSOR for arch detection (correct for cross-compile) - Make Product.wxs arch-aware: SystemFolder for x86, System64Folder for x64/arm64, unique UpgradeCode per architecture for side-by-side install - Refactor release.yml package-windows into a matrix job (x64/x86/arm64) producing MSI + ZIP for each architecture
1 parent f6440b5 commit cff7c00

5 files changed

Lines changed: 81 additions & 17 deletions

File tree

.github/workflows/build-and-test.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ jobs:
2020
matrix:
2121
include:
2222
- os: windows-latest
23+
artifact-name: windows-x64-binaries
24+
arch: x64
25+
- os: windows-latest
26+
artifact-name: windows-x86-binaries
27+
arch: Win32
28+
- os: windows-latest
29+
artifact-name: windows-arm64-binaries
30+
arch: ARM64
2331
- os: ubuntu-22.04
2432
artifact-name: linux-x64-binaries
2533
- os: ubuntu-22.04-arm
@@ -41,16 +49,24 @@ jobs:
4149
run: sudo apt-get update && sudo apt-get install -y unixodbc unixodbc-dev
4250

4351
- name: Build, install and test
52+
if: matrix.arch != 'ARM64'
4453
shell: pwsh
4554
env:
4655
API_GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47-
run: Invoke-Build test -Configuration Release -File ./firebird-odbc-driver.build.ps1
56+
run: Invoke-Build test -Configuration Release -Architecture ${{ matrix.arch }} -File ./firebird-odbc-driver.build.ps1
57+
58+
- name: Build only (cross-compile)
59+
if: matrix.arch == 'ARM64'
60+
shell: pwsh
61+
env:
62+
API_GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63+
run: Invoke-Build build -Configuration Release -Architecture ${{ matrix.arch }} -File ./firebird-odbc-driver.build.ps1
4864

4965
- name: Upload artifacts (Windows)
5066
if: runner.os == 'Windows'
5167
uses: actions/upload-artifact@v4
5268
with:
53-
name: windows-x64-binaries
69+
name: ${{ matrix.artifact-name }}
5470
path: |
5571
build/Release/FirebirdODBC.dll
5672
build/Release/FirebirdODBC.lib

.github/workflows/release.yml

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,22 @@ jobs:
4343
needs: [build-and-test, release]
4444
runs-on: windows-latest
4545

46+
strategy:
47+
matrix:
48+
include:
49+
- artifact: windows-x64-binaries
50+
wix-arch: x64
51+
target-arch: x64
52+
suffix: win-x64
53+
- artifact: windows-x86-binaries
54+
wix-arch: x86
55+
target-arch: x86
56+
suffix: win-x86
57+
- artifact: windows-arm64-binaries
58+
wix-arch: arm64
59+
target-arch: arm64
60+
suffix: win-arm64
61+
4662
steps:
4763
- uses: actions/checkout@v4
4864
with:
@@ -53,7 +69,7 @@ jobs:
5369
- name: Download Windows artifacts
5470
uses: actions/download-artifact@v4
5571
with:
56-
name: windows-x64-binaries
72+
name: ${{ matrix.artifact }}
5773
path: artifacts
5874

5975
- name: Install WiX Toolset
@@ -71,8 +87,9 @@ jobs:
7187
-d ProductVersion=$msiVersion `
7288
-d DriverPath="$dllPath" `
7389
-d Configuration=Release `
74-
-arch x64 `
75-
-o "firebird-odbc-driver-$version-win-x64.msi" `
90+
-d TargetArch=${{ matrix.target-arch }} `
91+
-arch ${{ matrix.wix-arch }} `
92+
-o "firebird-odbc-driver-$version-${{ matrix.suffix }}.msi" `
7693
installer/Product.wxs
7794
7895
- name: Package Windows ZIP
@@ -87,14 +104,14 @@ jobs:
87104
Copy-Item "README.md" -Destination $packageDir -ErrorAction SilentlyContinue
88105
89106
Compress-Archive -Path "$packageDir/*" `
90-
-DestinationPath "firebird-odbc-driver-$version-win-x64.zip"
107+
-DestinationPath "firebird-odbc-driver-$version-${{ matrix.suffix }}.zip"
91108
92109
- name: Upload release assets
93110
uses: softprops/action-gh-release@v2
94111
with:
95112
files: |
96-
firebird-odbc-driver-${{ needs.release.outputs.version }}-win-x64.msi
97-
firebird-odbc-driver-${{ needs.release.outputs.version }}-win-x64.zip
113+
firebird-odbc-driver-${{ needs.release.outputs.version }}-${{ matrix.suffix }}.msi
114+
firebird-odbc-driver-${{ needs.release.outputs.version }}-${{ matrix.suffix }}.zip
98115
99116
package-linux:
100117
needs: [build-and-test, release]

CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,15 @@ option(BUILD_TESTING "Build tests" ON)
4444
# ---------------------------------------------------------------------------
4545
# CPU architecture detection (from PR #248)
4646
# ---------------------------------------------------------------------------
47-
set(FBODBC_ARCH ${CMAKE_HOST_SYSTEM_PROCESSOR})
47+
# Prefer CMAKE_SYSTEM_PROCESSOR (correct for cross-compilation, e.g. -A Win32
48+
# or -A ARM64 on MSVC), fall back to CMAKE_HOST_SYSTEM_PROCESSOR for native.
49+
if(CMAKE_SYSTEM_PROCESSOR)
50+
set(FBODBC_ARCH ${CMAKE_SYSTEM_PROCESSOR})
51+
else()
52+
set(FBODBC_ARCH ${CMAKE_HOST_SYSTEM_PROCESSOR})
53+
endif()
4854

49-
if(FBODBC_ARCH STREQUAL "x86" OR FBODBC_ARCH STREQUAL "i686")
55+
if(FBODBC_ARCH STREQUAL "x86" OR FBODBC_ARCH STREQUAL "i686" OR FBODBC_ARCH STREQUAL "X86")
5056
add_definitions(-DFBODBC_ARCH_X86)
5157
message(STATUS "Architecture: ${FBODBC_ARCH} (x86)")
5258
elseif(FBODBC_ARCH STREQUAL "x86_64" OR FBODBC_ARCH STREQUAL "AMD64")

firebird-odbc-driver.build.ps1

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,18 @@
77
88
.Parameter Configuration
99
Build configuration: Debug (default) or Release.
10+
11+
.Parameter Architecture
12+
Target architecture for Windows cross-compilation (Win32, x64, ARM64).
13+
Ignored on Linux. When set, passed to cmake as '-A <arch>'.
1014
#>
1115

1216
param(
1317
[ValidateSet('Debug', 'Release')]
14-
[string]$Configuration = 'Debug'
18+
[string]$Configuration = 'Debug',
19+
20+
[ValidateSet('', 'Win32', 'x64', 'ARM64')]
21+
[string]$Architecture = ''
1522
)
1623

1724
# Detect OS
@@ -42,7 +49,11 @@ task clean {
4249

4350
# Synopsis: Build the driver and tests (default task).
4451
task build {
45-
exec { cmake -B $BuildDir -S $BuildRoot "-DCMAKE_BUILD_TYPE=$Configuration" -DBUILD_TESTING=ON }
52+
$cmakeArgs = @('-B', $BuildDir, '-S', $BuildRoot, "-DCMAKE_BUILD_TYPE=$Configuration", '-DBUILD_TESTING=ON')
53+
if ($IsWindowsOS -and $Architecture) {
54+
$cmakeArgs += @('-A', $Architecture)
55+
}
56+
exec { cmake @cmakeArgs }
4657

4758
if ($IsWindowsOS) {
4859
exec { cmake --build $BuildDir --config $Configuration }

installer/Product.wxs

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<!-- $(ProductVersion) — e.g. 3.5.0.0 -->
55
<!-- $(DriverPath) — full path to FirebirdODBC.dll -->
66
<!-- $(Configuration) — Debug or Release -->
7+
<!-- $(TargetArch) — x86, x64, or arm64 -->
78

89
<?define DriverName = "Firebird ODBC Driver" ?>
910

@@ -13,11 +14,24 @@
1314
<?define DriverName = "Firebird ODBC Driver (Debug)" ?>
1415
<?endif?>
1516

17+
<!-- Architecture-specific settings: system folder and UpgradeCode -->
18+
<!-- Each architecture gets a unique UpgradeCode so they can coexist -->
19+
<?if $(TargetArch) = "x86" ?>
20+
<?define SystemDir = "SystemFolder" ?>
21+
<?define UpgradeGuid = "D1A2B3C4-5E6F-7A8B-9C0D-1E2F3A4B5C6D" ?>
22+
<?elseif $(TargetArch) = "arm64" ?>
23+
<?define SystemDir = "System64Folder" ?>
24+
<?define UpgradeGuid = "E2B3C4D5-6F7A-8B9C-0D1E-2F3A4B5C6D7E" ?>
25+
<?else?>
26+
<?define SystemDir = "System64Folder" ?>
27+
<?define UpgradeGuid = "A7F3E2B1-4C5D-6E7F-8A9B-0C1D2E3F4A5B" ?>
28+
<?endif?>
29+
1630
<Package
1731
Name="$(DriverName)"
1832
Manufacturer="Firebird Foundation"
1933
Version="$(ProductVersion)"
20-
UpgradeCode="A7F3E2B1-4C5D-6E7F-8A9B-0C1D2E3F4A5B"
34+
UpgradeCode="$(UpgradeGuid)"
2135
Scope="perMachine"
2236
Compressed="yes">
2337

@@ -27,7 +41,7 @@
2741
<MediaTemplate EmbedCab="yes" />
2842

2943
<!-- The driver DLL -->
30-
<StandardDirectory Id="System64Folder">
44+
<StandardDirectory Id="$(SystemDir)">
3145
<Component Id="DriverDLL" Guid="B8F4E3C2-5D6E-7F8A-9B0C-1D2E3F4A5B6C">
3246
<File Id="FirebirdODBCDll"
3347
Source="$(DriverPath)"
@@ -37,11 +51,11 @@
3751
</StandardDirectory>
3852

3953
<!-- ODBC Driver registration -->
40-
<Component Id="OdbcDriverReg" Directory="System64Folder"
54+
<Component Id="OdbcDriverReg" Directory="$(SystemDir)"
4155
Guid="C9F5E4D3-6E7F-8A9B-0C1D-2E3F4A5B6C7D">
4256
<RegistryKey Root="HKLM" Key="SOFTWARE\ODBC\ODBCINST.INI\$(DriverName)">
43-
<RegistryValue Name="Driver" Type="string" Value="[System64Folder]FirebirdODBC.dll" />
44-
<RegistryValue Name="Setup" Type="string" Value="[System64Folder]FirebirdODBC.dll" />
57+
<RegistryValue Name="Driver" Type="string" Value="[$(SystemDir)]FirebirdODBC.dll" />
58+
<RegistryValue Name="Setup" Type="string" Value="[$(SystemDir)]FirebirdODBC.dll" />
4559
<RegistryValue Name="APILevel" Type="string" Value="1" />
4660
<RegistryValue Name="ConnectFunctions" Type="string" Value="YYY" />
4761
<RegistryValue Name="DriverODBCVer" Type="string" Value="03.51" />

0 commit comments

Comments
 (0)