Skip to content

Commit c9fc268

Browse files
committed
Update cmake.yml
1 parent d76234d commit c9fc268

File tree

1 file changed

+20
-55
lines changed

1 file changed

+20
-55
lines changed

.github/workflows/cmake.yml

Lines changed: 20 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
# This workflow is for a CMake project running on multiple platforms.
2-
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-multi-platform.yml
3-
name: CMake Build and Test
1+
name: CMake Build and Test
42

53
on:
64
workflow_call:
75
inputs:
86
build_type:
9-
description: 'Build type (e.g., "Debug", "Release", "RelWithDebInfo", "MinSizeRel")'
10-
default: '"Debug"'
7+
description: 'Build type (e.g., "Debug", "Release")'
8+
default: '"Release"'
119
required: true
1210
type: string
1311
upload_artifacts:
@@ -21,42 +19,34 @@ jobs:
2119
runs-on: ${{ matrix.os }}
2220

2321
strategy:
24-
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
2522
fail-fast: false
26-
27-
# Set up a matrix to run the following 3 configurations:
28-
# 1. <Windows, Release, latest MSVC compiler toolchain on the default runner image, default generator>
29-
# 2. <Linux, Release, latest GCC compiler toolchain on the default runner image, default generator>
30-
# 3. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator>
31-
#
32-
# To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list.
3323
matrix:
34-
os: [ubuntu-latest, windows-latest, macOS-latest]
35-
build_type: ${{ fromJSON(format('[{0}]', inputs.build_type || '"Debug","Release"')) }}
24+
os: [ubuntu-22.04, windows-latest, macos-latest]
25+
build_type: [Release]
3626
c_compiler: [gcc, clang, cl]
3727
include:
3828
- os: windows-latest
3929
c_compiler: cl
4030
cpp_compiler: cl
41-
- os: ubuntu-latest
31+
- os: ubuntu-22.04
4232
c_compiler: gcc
4333
cpp_compiler: g++
44-
- os: ubuntu-latest
34+
- os: ubuntu-22.04
4535
c_compiler: clang
4636
cpp_compiler: clang++
47-
- os: macOS-latest
37+
- os: macos-latest
4838
c_compiler: clang
4939
cpp_compiler: clang++
5040
exclude:
5141
- os: windows-latest
5242
c_compiler: gcc
5343
- os: windows-latest
5444
c_compiler: clang
55-
- os: ubuntu-latest
45+
- os: ubuntu-22.04
5646
c_compiler: cl
57-
- os: macOS-latest
47+
- os: macos-latest
5848
c_compiler: cl
59-
- os: macOS-latest
49+
- os: macos-latest
6050
c_compiler: gcc
6151

6252
steps:
@@ -65,69 +55,44 @@ jobs:
6555
submodules: true
6656

6757
- name: Set reusable strings
68-
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
6958
id: strings
7059
shell: bash
71-
run: |
72-
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
60+
run: echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
7361

74-
- name: Install Clang and Libraries
75-
if: matrix.os == 'ubuntu-latest' && matrix.c_compiler == 'clang'
62+
- name: Install Linux Dependencies
63+
if: matrix.os == 'ubuntu-22.04'
7664
run: |
7765
sudo apt-get update
78-
sudo apt-get install -y clang libc++-dev libc++abi-dev
79-
80-
- name: Set Clang 16 as Default
81-
if: matrix.os == 'ubuntu-24.04' && matrix.c_compiler == 'clang'
82-
run: |
83-
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-16 100
84-
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-16 100
85-
sudo update-alternatives --set clang /usr/bin/clang-16
86-
sudo update-alternatives --set clang++ /usr/bin/clang++-16
87-
88-
- name: Check Clang Settings
89-
if: matrix.os == 'ubuntu-latest' && matrix.c_compiler == 'clang'
90-
run: |
91-
clang --version
92-
clang++ --version
93-
echo "Checking clang headers..."
94-
clang++ -v -E -x c++ /dev/null
95-
echo "check lld..."
96-
ldd --version
66+
sudo apt-get install -y build-essential ninja-build cmake pkg-config
67+
sudo apt-get install -y clang lld libc++-dev libc++abi-dev
9768
9869
- name: Configure CMake
99-
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
100-
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
10170
run: >
10271
cmake -B ${{ steps.strings.outputs.build-output-dir }}
103-
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
10472
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
73+
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
10574
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
75+
-DCMAKE_CXX_FLAGS="-fPIC -D_GLIBCXX_USE_CXX11_ABI=1 -D_LIBCPP_DISABLE_AVAILABILITY"
10676
-S ${{ github.workspace }}
10777
10878
- name: Build
109-
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
11079
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --verbose
11180

11281
- name: Test
11382
working-directory: ${{ steps.strings.outputs.build-output-dir }}
114-
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
115-
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
11683
run: ctest --build-config ${{ matrix.build_type }} --verbose --output-on-failure
11784

11885
- name: Package Build Artifacts
11986
if: ${{ inputs.upload_artifacts && success() }}
12087
run: |
12188
mkdir -p ${{ steps.strings.outputs.build-output-dir }}/package
122-
# Adjust the path to your built library files
123-
cp ${{ steps.strings.outputs.build-output-dir }}/${{ matrix.build_type }}/*GameAnalytics.* ${{ steps.strings.outputs.build-output-dir }}/package/
89+
cp ${{ steps.strings.outputs.build-output-dir }}/${{ matrix.build_type }}/*GameAnalytics.* ${{ steps.strings.outputs.build-output-dir }}/package/ || true
12490
cp -r ${{ github.workspace }}/include ${{ steps.strings.outputs.build-output-dir }}/package/
125-
91+
12692
- name: Upload Build Artifact
12793
if: ${{ inputs.upload_artifacts && success() }}
12894
uses: actions/upload-artifact@v4
12995
with:
13096
name: ga-cpp-sdk-${{ matrix.os }}-${{ matrix.c_compiler }}-${{ matrix.build_type }}
13197
path: ${{ steps.strings.outputs.build-output-dir }}/package/
13298
retention-days: 3
133-

0 commit comments

Comments
 (0)