Skip to content

Commit c2aa102

Browse files
Build mbedTLS and static libraries without MSVC_VER under clang-cl
An HXCPP_MSVC_LLVM build sets no MSVC_VER, which mbedTLS's C standard flag and the static library suffix still read, so mbedTLS got -std=c99, which clang-cl rejects, and static libraries a bare - suffix. They now follow isMsvc, as PCRE2 already does, and a missing version adds no suffix. A Windows job builds and runs the runtime tests with clang-cl. Follows HaxeFoundation/hxcpp#1361 Fixes #44
1 parent 620f065 commit c2aa102

4 files changed

Lines changed: 23 additions & 2 deletions

File tree

‎.github/workflows/main.yml‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,26 @@ jobs:
5959
- run: clang++ -arch arm64 -std=c++11 -c -DHX_MACOS -DHXCPP_M64 -Iinclude src/hx/gc/GcRegCapture.cpp -o capture.o
6060
name: Compile the register capture
6161

62+
check-msvc-llvm:
63+
name: Check MSVC builds with clang-cl
64+
runs-on: windows-latest
65+
steps:
66+
- name: checkout
67+
uses: actions/checkout@v4
68+
69+
- name: setup
70+
uses: ./.github/workflows/setup
71+
with:
72+
haxe: 4.3.7
73+
74+
- name: Build the runtime tests
75+
working-directory: test/haxe
76+
run: haxe compile.hxml -D HXCPP_MSVC_LLVM -D HXCPP_M64
77+
78+
- name: Run the runtime tests
79+
working-directory: test/haxe
80+
run: bin\TestMain
81+
6282
check-android:
6383
name: Build for Android (${{ matrix.abi }})
6484
strategy:

‎Changes.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ The first libhxcpp version. It is based on hxcpp 4.3 (the changes listed under 4
210210
* Changed the build tool to decide on colour from the terminal's environment instead of running tput, to honour NO_COLOR, and to take HXCPP_COLOR to force colour on (hxcpp #1146)
211211
* Added compile progress to the build tool: each group says how many files it compiles, and each file how many of them have finished (hxcpp #1140, #1423)
212212
* Added WinRT ARM64 builds: Setup's msvc-winrt-arm64-setup.bat exists, and they go to bin/WinRTArm64, where cpp.Lib.load looks. Desktop ARM64 objects move from obj/msvc*-armarm64 to obj/msvc*arm64 (hxcpp #1335)
213+
* Added MSVC builds with clang-cl and the LLVM tools, with -D HXCPP_MSVC_LLVM, and cross-compiling them from Linux with -D HXCPP_MSVC_ROOT (hxcpp #1361)
213214
* Added the libhxcpp define: a build that uses the library gets -D libhxcpp=<version>. Compare it with version("x.y.z"); a plain string comparison compares text
214215
* Added separate Linux ARMv7 and ARM64 build architectures (hxcpp #1355)
215216
* Fixed AndroidCompat.cpp closing its extern "C" section in the wrong place (hxcpp #1404)

‎project/thirdparty/mbedtls-files.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<include name="${this_dir}/mbedtls-flags.xml" />
1010

11-
<compilerflag value="-std=c99" unless="MSVC_VER" />
11+
<compilerflag value="-std=c99" unless="isMsvc" />
1212

1313
<!-- mbedTLS's symbols stay inside the binary that links them. hxcpp links
1414
Linux executables with -rdynamic, which exports every symbol of

‎toolchain/finish-setup.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
<setup name="msvc"/>
9797

9898
<section if="static_link" >
99-
<set name="MSVC_LIB_VERSION" value="-${MSVC_VER}" />
99+
<set name="MSVC_LIB_VERSION" value="-${MSVC_VER}" if="MSVC_VER" />
100100
</section>
101101

102102
<set name="LIBEXTRA" value="-19" if="MSVC19" />

0 commit comments

Comments
 (0)