Skip to content

Commit 5b50e61

Browse files
committed
fix(client-cpp): force x64 for Visual Studio Windows packages
VS2017 generator defaults to Win32; pass -DCMAKE_GENERATOR_PLATFORM=x64 on Windows via Maven profile. Add CI PE check that iotdb_session.dll is x64.
1 parent 8cacdb1 commit 5b50e61

3 files changed

Lines changed: 46 additions & 1 deletion

File tree

.github/workflows/client-cpp-package.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,20 @@ jobs:
387387
MVN_ARGS+=("-Dcmake.generator=${CMAKE_GENERATOR}")
388388
fi
389389
"${MVN_ARGS[@]}"
390+
- name: Verify Windows SDK is x64
391+
shell: pwsh
392+
run: |
393+
$dll = "iotdb-client/client-cpp/target/install/lib/iotdb_session.dll"
394+
if (-not (Test-Path $dll)) {
395+
throw "Missing $dll"
396+
}
397+
$bytes = [System.IO.File]::ReadAllBytes($dll)
398+
$peOffset = [BitConverter]::ToInt32($bytes, 0x3C)
399+
$machine = [BitConverter]::ToUInt16($bytes, $peOffset + 4)
400+
if ($machine -ne 0x8664) {
401+
throw "Expected PE32+ x64 (machine=0x8664), got 0x$($machine.ToString('X4'))"
402+
}
403+
Write-Host "Verified x64 DLL: $dll"
390404
- name: Resolve package zip
391405
id: pkg
392406
shell: bash

iotdb-client/client-cpp/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,16 @@ mvn -P with-cpp -pl iotdb-client/client-cpp -am -DskipTests `
119119
-Dcmake.generator="Visual Studio 16 2019" `
120120
-Dclient.cpp.package.classifier=windows-x86_64-vs2019 package
121121
122-
# Visual Studio 2017
122+
# Visual Studio 2017 (CMake uses -A x64 on Windows automatically)
123123
mvn -P with-cpp -pl iotdb-client/client-cpp -am -DskipTests `
124124
-Dcmake.generator="Visual Studio 15 2017" `
125125
-Dclient.cpp.package.classifier=windows-x86_64-vs2017 package
126126
```
127127

128+
On Windows, the build passes `-DCMAKE_GENERATOR_PLATFORM=x64` so Visual Studio
129+
generators target **x64** (VS2017 otherwise defaults to Win32).
130+
```
131+
128132
## CMake options
129133
130134
All of these can be set on the Maven command line (`-DWITH_SSL=ON`, etc.) or

iotdb-client/client-cpp/pom.xml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,33 @@
258258
<os.suffix>win</os.suffix>
259259
</properties>
260260
</profile>
261+
<!-- Visual Studio generators (esp. VS2017) default to Win32 unless -A x64 is set. -->
262+
<profile>
263+
<id>client-cpp-vs-x64</id>
264+
<activation>
265+
<os>
266+
<family>windows</family>
267+
</os>
268+
</activation>
269+
<build>
270+
<plugins>
271+
<plugin>
272+
<groupId>io.github.cmake-maven-plugin</groupId>
273+
<artifactId>cmake-maven-plugin</artifactId>
274+
<executions>
275+
<execution>
276+
<id>cmake-generate</id>
277+
<configuration>
278+
<options combine.children="append">
279+
<option>-DCMAKE_GENERATOR_PLATFORM=x64</option>
280+
</options>
281+
</configuration>
282+
</execution>
283+
</executions>
284+
</plugin>
285+
</plugins>
286+
</build>
287+
</profile>
261288
<profile>
262289
<id>.skipTests</id>
263290
<activation>

0 commit comments

Comments
 (0)