Skip to content

Commit b1f56fd

Browse files
committed
Fix windows build
1 parent e13cead commit b1f56fd

File tree

3 files changed

+20
-21
lines changed

3 files changed

+20
-21
lines changed

.github/workflows/build.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,11 +308,25 @@ jobs:
308308
python-version: ${{ matrix.python-version }}
309309
free-disk-space: "false"
310310

311+
- name: Make clang-cl the default “cl”
312+
shell: bash
313+
run: |
314+
mkdir -p "$GITHUB_WORKSPACE/bin"
315+
cat >"$GITHUB_WORKSPACE/bin/cl.cmd" <<'EOF'
316+
@echo off
317+
"C:\Program Files\LLVM\bin\clang-cl.exe" %*
318+
EOF
319+
320+
echo "$GITHUB_WORKSPACE/bin" > "$GITHUB_PATH"
321+
chmod +x "$GITHUB_WORKSPACE/bin/cl.cmd"
322+
311323
- name: Use clang-cl
312324
run: |
313-
echo 'C:\Program Files\LLVM\bin' > "$GITHUB_PATH"
314-
echo 'CC=clang-cl' >> "$GITHUB_ENV"
315-
echo 'CXX=clang-cl' >> "$GITHUB_ENV"
325+
echo "C:\Program Files\LLVM\bin" >> "$GITHUB_PATH"
326+
echo "CC=clang-cl" >> "$GITHUB_ENV"
327+
echo "CXX=clang-cl" >> "$GITHUB_ENV"
328+
echo "DISTUTILS_USE_SDK=1" >> "$GITHUB_ENV"
329+
echo "CFLAGS=/D__SIZEOF_INT128__=0" >> "$GITHUB_ENV"
316330
317331
- name: Show compiler
318332
run: '"C:\Program Files\LLVM\bin\clang-cl" --version | head -n 1'

crates/model/cbindgen.toml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,7 @@ includes = []
55
sys_includes = ["stdint.h", "Python.h"]
66
no_includes = true
77
tab_width = 4
8-
after_includes = """\n
9-
#ifdef HIGH_PRECISION /* only when the Rust feature is enabled */
10-
/* Clang & GCC both understand __int128. CL on Windows (MSVC) does not,
11-
but when we compile with clang-cl (or on *nix) it works fine. */
12-
#ifdef __SIZEOF_INT128__ /* defined by all targets that actually support it */
13-
typedef __uint128_t uint128_t;
14-
typedef __int128_t int128_t;
15-
#endif
16-
#endif
17-
"""
8+
after_includes = "\n#ifdef __SIZEOF_INT128__\n typedef __uint128_t uint128_t;\n typedef __int128_t int128_t;\n#endif"
189

1910
[defines]
2011
"feature = high-precision" = "HIGH_PRECISION"

nautilus_trader/core/includes/model.h

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,11 @@
55
#include <stdint.h>
66
#include <Python.h>
77

8-
9-
#ifdef HIGH_PRECISION /* only when the Rust feature is enabled */
10-
/* Clang & GCC both understand __int128. CL on Windows (MSVC) does not,
11-
but when we compile with clang-cl (or on *nix) it works fine. */
12-
#ifdef __SIZEOF_INT128__ /* defined by all targets that actually support it */
8+
#ifdef __SIZEOF_INT128__
139
typedef __uint128_t uint128_t;
14-
typedef __int128_t int128_t;
15-
#endif
10+
typedef __int128_t int128_t;
1611
#endif
1712

18-
1913
#define DEPTH10_LEN 10
2014

2115
/**

0 commit comments

Comments
 (0)