@@ -186,51 +186,152 @@ jobs:
186186 name : rust-windows
187187 path : mock-trading-server-${{ steps.get_version.outputs.VERSION }}-windows-x86_64.exe
188188
189- build-cpp :
190- name : Build C++ Client
189+ build-cpp-linux :
190+ name : Build C++ Client (Linux)
191191 runs-on : ubuntu-latest
192- container : public.ecr.aws/amazonlinux/amazonlinux:2023
192+ strategy :
193+ matrix :
194+ include :
195+ - arch : x86_64
196+ platform : linux/amd64
197+ container : public.ecr.aws/amazonlinux/amazonlinux:2023
198+ - arch : aarch64
199+ platform : linux/arm64
200+ container : public.ecr.aws/amazonlinux/amazonlinux:2023
193201 steps :
194- - name : Install build tools
195- run : |
196- yum install -y gcc-c++ make git tar gzip boost-devel openssl-devel python3-pip zlib-devel
197- # Install newer CMake (AL2023 has 3.22, but we need 3.27+)
198- pip3 install cmake --upgrade
199- # Ensure cmake from pip is in PATH
200- export PATH="/usr/local/bin:$HOME/.local/bin:$PATH"
201- echo "/usr/local/bin" >> $GITHUB_PATH
202- echo "$HOME/.local/bin" >> $GITHUB_PATH
203- cmake --version
202+ - name : Set up QEMU
203+ if : matrix.arch == 'aarch64'
204+ uses : docker/setup-qemu-action@v3
205+ with :
206+ platforms : arm64
207+
208+ - name : Checkout code
209+ uses : actions/checkout@v5
210+ with :
211+ submodules : recursive
212+
213+ - name : Get version
214+ id : get_version
215+ run : echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
204216
217+ - name : Build in container
218+ run : |
219+ docker run --rm --platform ${{ matrix.platform }} \
220+ -v ${{ github.workspace }}:/workspace \
221+ -w /workspace \
222+ ${{ matrix.container }} \
223+ bash -c '
224+ yum install -y gcc-c++ make git tar gzip openssl-devel python3-pip zlib-devel
225+ pip3 install cmake --upgrade
226+ export PATH="/usr/local/bin:$HOME/.local/bin:$PATH"
227+ cd cpp-client
228+ cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_VERSION_MINIMUM=3.5
229+ cmake --build build --config Release
230+ cd build
231+ tar -czf ../../cpp-client-${{ steps.get_version.outputs.VERSION }}-linux-${{ matrix.arch }}.tar.gz hft_client
232+ '
233+
234+ - name : Upload artifact
235+ uses : actions/upload-artifact@v4
236+ with :
237+ name : cpp-linux-${{ matrix.arch }}
238+ path : cpp-client-${{ steps.get_version.outputs.VERSION }}-linux-${{ matrix.arch }}.tar.gz
239+
240+ build-cpp-macos :
241+ name : Build C++ Client (macOS)
242+ runs-on : ${{ matrix.os }}
243+ strategy :
244+ matrix :
245+ include :
246+ - os : macos-13
247+ arch : x86_64
248+ - os : macos-14
249+ arch : arm64
250+ steps :
205251 - name : Checkout code
206252 uses : actions/checkout@v5
207253 with :
208254 submodules : recursive
209255
256+ - name : Install dependencies
257+ run : |
258+ brew install cmake openssl@3
259+
210260 - name : Get version
211261 id : get_version
212262 run : echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
213263
214264 - name : Build
215265 working-directory : cpp-client
216266 run : |
217- cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_VERSION_MINIMUM=3.5
267+ export OPENSSL_ROOT_DIR=$(brew --prefix openssl@3)
268+ cmake -B build \
269+ -DCMAKE_BUILD_TYPE=Release \
270+ -DOPENSSL_ROOT_DIR=$OPENSSL_ROOT_DIR
218271 cmake --build build --config Release
219272
220273 - name : Create tarball
221274 run : |
222275 cd cpp-client/build
223- tar -czf ../../cpp-client-${{ steps.get_version.outputs.VERSION }}.tar.gz .
276+ tar -czf ../../cpp-client-${{ steps.get_version.outputs.VERSION }}-macos-${{ matrix.arch }}.tar.gz hft_client
277+
278+ - name : Upload artifact
279+ uses : actions/upload-artifact@v4
280+ with :
281+ name : cpp-macos-${{ matrix.arch }}
282+ path : cpp-client-${{ steps.get_version.outputs.VERSION }}-macos-${{ matrix.arch }}.tar.gz
283+
284+ build-cpp-windows :
285+ name : Build C++ Client (Windows)
286+ runs-on : windows-latest
287+ steps :
288+ - name : Checkout code
289+ uses : actions/checkout@v5
290+ with :
291+ submodules : recursive
292+
293+ - name : Setup vcpkg
294+ run : |
295+ git clone https://github.com/Microsoft/vcpkg.git
296+ cd vcpkg
297+ .\bootstrap-vcpkg.bat
298+ .\vcpkg integrate install
299+
300+ - name : Install dependencies (static)
301+ run : |
302+ cd vcpkg
303+ .\vcpkg install openssl:x64-windows-static zlib:x64-windows-static
304+
305+ - name : Get version
306+ id : get_version
307+ shell : bash
308+ run : echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
224309
225- - name : Upload tarball
310+ - name : Build (static linking)
311+ shell : bash
312+ working-directory : cpp-client
313+ run : |
314+ cmake -B build \
315+ -DCMAKE_BUILD_TYPE=Release \
316+ -DCMAKE_TOOLCHAIN_FILE=../vcpkg/scripts/buildsystems/vcpkg.cmake \
317+ -DVCPKG_TARGET_TRIPLET=x64-windows-static
318+ cmake --build build --config Release
319+
320+ - name : Create archive
321+ shell : bash
322+ run : |
323+ cd cpp-client/build/Release
324+ 7z a ../../../cpp-client-${{ steps.get_version.outputs.VERSION }}-windows-x86_64.zip hft_client.exe
325+
326+ - name : Upload artifact
226327 uses : actions/upload-artifact@v4
227328 with :
228- name : cpp-client
229- path : cpp-client-${{ steps.get_version.outputs.VERSION }}.tar.gz
329+ name : cpp-windows-x86_64
330+ path : cpp-client-${{ steps.get_version.outputs.VERSION }}-windows-x86_64.zip
230331
231332 create-release :
232333 name : Create GitHub Release
233- needs : [build-java, build-rust-linux, build-rust-macos, build-rust-windows, build-cpp]
334+ needs : [build-java, build-rust-linux, build-rust-macos, build-rust-windows, build-cpp-linux, build-cpp-macos, build-cpp-windows ]
234335 runs-on : ubuntu-latest
235336 steps :
236337 - name : Checkout code
@@ -284,8 +385,8 @@ jobs:
284385 ### 📦 Components
285386
286387 - **Java Trading Client** - ✅ Cross-platform (all architectures)
287- - **Rust Mock Server** - ✅ Linux (x86_64 & ARM64), macOS (Intel & Apple Silicon), Windows
288- - **C++ Client** - ✅ Linux x86_64
388+ - **Rust Mock Server** - ✅ Linux (x86_64 & ARM64/Graviton ), macOS (Intel & Apple Silicon), Windows
389+ - **C++ Client** - ✅ Multi-platform: Linux ( x86_64 & ARM64/Graviton), macOS (Intel & Apple Silicon), Windows
289390 - **Configuration Samples** - 📝 All config files with documentation
290391
291392 ### 🚀 Quick Start
@@ -300,6 +401,33 @@ jobs:
300401 java -jar ExchangeFlow-${{ steps.get_version.outputs.VERSION }}.jar
301402 \`\`\`
302403
404+ **C++ Client (choose your platform):**
405+ - **Linux x86_64:**
406+ \`\`\`bash
407+ tar -xzf cpp-client-${{ steps.get_version.outputs.VERSION }}-linux-x86_64.tar.gz
408+ ./hft_client
409+ \`\`\`
410+ - **Linux ARM64 (Graviton2/3/4):**
411+ \`\`\`bash
412+ tar -xzf cpp-client-${{ steps.get_version.outputs.VERSION }}-linux-aarch64.tar.gz
413+ ./hft_client
414+ \`\`\`
415+ - **macOS Intel:**
416+ \`\`\`bash
417+ tar -xzf cpp-client-${{ steps.get_version.outputs.VERSION }}-macos-x86_64.tar.gz
418+ ./hft_client
419+ \`\`\`
420+ - **macOS Apple Silicon:**
421+ \`\`\`bash
422+ tar -xzf cpp-client-${{ steps.get_version.outputs.VERSION }}-macos-arm64.tar.gz
423+ ./hft_client
424+ \`\`\`
425+ - **Windows:**
426+ \`\`\`powershell
427+ Expand-Archive cpp-client-${{ steps.get_version.outputs.VERSION }}-windows-x86_64.zip
428+ .\\hft_client.exe
429+ \`\`\`
430+
303431 **Rust Server (choose your platform):**
304432 - **Linux x86_64:** \`./mock-trading-server-${{ steps.get_version.outputs.VERSION }}-linux-x86_64\`
305433 - **Linux ARM64 (Graviton):** \`./mock-trading-server-${{ steps.get_version.outputs.VERSION }}-linux-aarch64\`
0 commit comments