Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,25 @@ on:
pull_request:
branches: ['main'] # Trigger on pull requests to main
workflow_dispatch: # Allow manual triggering of workflow
inputs:
build_type:
description: 'Build type(s)'
required: false
type: choice
options:
- Debug
- Release
- Debug + Release
default: Debug
upload_artifacts:
description: 'Whether to upload build artifacts'
required: false
type: boolean
default: false

jobs:
build:
uses: ./.github/workflows/cmake.yml
with:
build_type: ${{ (github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'main') && '"Debug","Release"' || '"Debug"' }}
upload_artifacts: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'main' }}
build_type: ${{ (github.event_name == 'workflow_dispatch' && (inputs.build_type == 'Debug + Release' && '"Debug","Release"' || format('"{0}"', inputs.build_type))) || ((github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'main') && '"Debug","Release"') || '"Debug"' }}
upload_artifacts: ${{ (github.event_name == 'workflow_dispatch' && inputs.upload_artifacts) || (github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'main') }}
39 changes: 25 additions & 14 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,17 @@ jobs:
# - Multiple platforms (Windows, Linux, macOS)
# - Multiple compilers (cl, gcc, clang)
# - Multiple library types (static, shared)
# windows-latest now floats to Windows Server 2025 / Visual Studio 2026 (MSVC v14.50+).
# Pin to windows-2022 to guarantee MSVC 2022 (toolset v14.38+), which is what Unreal 5.8
# requires at minimum and what "cl" builds here need to stay ABI-compatible with.
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
os: [ubuntu-latest, windows-2022, macOS-latest]
build_type: ${{ fromJSON(format('[{0}]', inputs.build_type || '"Debug","Release"')) }}
c_compiler: [gcc, clang, cl]
lib_type: [static, shared]
dependency_mode: [default, no_deps]
include:
- os: windows-latest
- os: windows-2022
c_compiler: cl
cpp_compiler: cl
- os: ubuntu-latest
Expand All @@ -47,16 +51,18 @@ jobs:
c_compiler: clang
cpp_compiler: clang++
exclude:
- os: windows-latest
- os: windows-2022
c_compiler: gcc
- os: windows-latest
- os: windows-2022
c_compiler: clang
- os: ubuntu-latest
c_compiler: cl
- os: macOS-latest
c_compiler: cl
- os: macOS-latest
c_compiler: gcc
- lib_type: shared
dependency_mode: no_deps

steps:
- uses: actions/checkout@v6
Expand All @@ -70,11 +76,11 @@ jobs:
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
# Map OS to platform
if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then
if [ "${{ runner.os }}" == "Linux" ]; then
echo "platform=linux_x64" >> "$GITHUB_OUTPUT"
elif [ "${{ matrix.os }}" == "windows-latest" ]; then
elif [ "${{ runner.os }}" == "Windows" ]; then
echo "platform=win64" >> "$GITHUB_OUTPUT"
elif [ "${{ matrix.os }}" == "macOS-latest" ]; then
elif [ "${{ runner.os }}" == "macOS" ]; then
echo "platform=osx" >> "$GITHUB_OUTPUT"
fi

Expand All @@ -100,7 +106,7 @@ jobs:
ldd --version

- name: Install vcpkg (Linux/macOS)
if: runner.os != 'Windows'
if: runner.os != 'Windows' && matrix.dependency_mode != 'no_deps'
shell: bash
run: |
git clone https://github.com/microsoft/vcpkg.git "$HOME/vcpkg"
Expand All @@ -109,7 +115,7 @@ jobs:
echo "$HOME/vcpkg" >> "$GITHUB_PATH"

- name: Install vcpkg (Windows)
if: runner.os == 'Windows'
if: runner.os == 'Windows' && matrix.dependency_mode != 'no_deps'
shell: pwsh
run: |
git clone https://github.com/microsoft/vcpkg.git "$env:USERPROFILE\vcpkg"
Expand All @@ -124,18 +130,23 @@ jobs:
if [ "${{ matrix.lib_type }}" == "shared" ]; then
SHARED_FLAG="--shared"
fi


DEPENDENCY_FLAGS=""
if [ "${{ matrix.dependency_mode }}" == "no_deps" ]; then
DEPENDENCY_FLAGS="--no_vcpkg --no_curl"
fi

if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then
python setup.py --platform ${{ steps.strings.outputs.platform }} --compiler ${{ matrix.c_compiler }} --cfg ${{ matrix.build_type }} $SHARED_FLAG --build --test
python setup.py --platform ${{ steps.strings.outputs.platform }} --compiler ${{ matrix.c_compiler }} --cfg ${{ matrix.build_type }} $SHARED_FLAG $DEPENDENCY_FLAGS --build --test
else
python setup.py --platform ${{ steps.strings.outputs.platform }} --cfg ${{ matrix.build_type }} $SHARED_FLAG --build --test
python setup.py --platform ${{ steps.strings.outputs.platform }} --cfg ${{ matrix.build_type }} $SHARED_FLAG $DEPENDENCY_FLAGS --build --test
fi

- name: Upload Build Artifact
if: ${{ inputs.upload_artifacts && success() }}
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: ga-cpp-sdk-${{ matrix.os }}-${{ matrix.c_compiler }}-${{ matrix.build_type }}-${{ matrix.lib_type }}
name: ga-cpp-sdk-${{ matrix.os }}-${{ matrix.c_compiler }}-${{ matrix.build_type }}-${{ matrix.lib_type }}-${{ matrix.dependency_mode }}
path: ${{ steps.strings.outputs.build-output-dir }}/package/
retention-days: 3

42 changes: 33 additions & 9 deletions .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,30 +38,32 @@ jobs:
git push origin ${{ inputs.tag_name }}

- name: Download Artifacts
uses: actions/download-artifact@v4
uses: actions/download-artifact@v8
with:
path: ./release-artifacts

- name: Organize release files
run: |
# Create separate directories for static and shared libraries
# Create separate directories for static, shared and no-deps static libraries
mkdir -p ./static-release/include
mkdir -p ./shared-release/include

mkdir -p ./static-no-deps-release/include

# Copy include directory from any artifact (they're all identical)
FIRST_ARTIFACT=$(find ./release-artifacts -mindepth 1 -maxdepth 1 -type d | head -n 1)
cp -r $FIRST_ARTIFACT/include/* ./static-release/include/
cp -r $FIRST_ARTIFACT/include/* ./shared-release/include/
cp -r $FIRST_ARTIFACT/include/* ./static-no-deps-release/include/

# Copy GameAnalyticsExtern.h for shared library release
cp ./source/gameanalytics/GameAnalyticsExtern.h ./shared-release/include/GameAnalytics/

# Process static library artifacts
for artifact_dir in ./release-artifacts/*-static; do
for artifact_dir in ./release-artifacts/*-static-default; do
artifact_name=$(basename $artifact_dir)
# Extract platform info (remove ga-cpp-sdk- prefix and -static suffix)
# Extract platform info (remove ga-cpp-sdk- prefix and -static-default suffix)
platform_info=${artifact_name#ga-cpp-sdk-}
platform_info=${platform_info%-static}
platform_info=${platform_info%-static-default}

mkdir -p ./static-release/$platform_info

Expand All @@ -74,11 +76,11 @@ jobs:
done

# Process shared library artifacts
for artifact_dir in ./release-artifacts/*-shared; do
for artifact_dir in ./release-artifacts/*-shared-default; do
artifact_name=$(basename $artifact_dir)
# Extract platform info (remove ga-cpp-sdk- prefix and -shared suffix)
# Extract platform info (remove ga-cpp-sdk- prefix and -shared-default suffix)
platform_info=${artifact_name#ga-cpp-sdk-}
platform_info=${platform_info%-shared}
platform_info=${platform_info%-shared-default}

mkdir -p ./shared-release/$platform_info

Expand All @@ -92,9 +94,27 @@ jobs:
fi
done

# Process no-deps static library artifacts (no vcpkg/curl, custom HTTP client required)
for artifact_dir in ./release-artifacts/*-static-no_deps; do
artifact_name=$(basename $artifact_dir)
# Extract platform info (remove ga-cpp-sdk- prefix and -static-no_deps suffix)
platform_info=${artifact_name#ga-cpp-sdk-}
platform_info=${platform_info%-static-no_deps}

mkdir -p ./static-no-deps-release/$platform_info

# Copy static libraries
if [[ $artifact_name == *"windows"* ]]; then
cp $artifact_dir/*.lib ./static-no-deps-release/$platform_info/ 2>/dev/null || true
else
cp $artifact_dir/*.a ./static-no-deps-release/$platform_info/ 2>/dev/null || true
fi
done

# Create zip archives
zip -r ga-sdk-static-${{ inputs.tag_name }}.zip ./static-release
zip -r ga-sdk-shared-${{ inputs.tag_name }}.zip ./shared-release
zip -r ga-sdk-static-no-deps-${{ inputs.tag_name }}.zip ./static-no-deps-release

- name: Show organized release files
run: |
Expand All @@ -103,6 +123,9 @@ jobs:
echo ""
echo "=== Shared Libraries ==="
tree ./shared-release || ls -R ./shared-release
echo ""
echo "=== Static Libraries (no dependencies) ==="
tree ./static-no-deps-release || ls -R ./static-no-deps-release

- name: Create release
uses: softprops/action-gh-release@v2.0.8
Expand All @@ -114,3 +137,4 @@ jobs:
files: |
ga-sdk-static-${{ inputs.tag_name }}.zip
ga-sdk-shared-${{ inputs.tag_name }}.zip
ga-sdk-static-no-deps-${{ inputs.tag_name }}.zip
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

- **Remote configs listener in the C API** — New `gameAnalytics_configureRemoteConfigsListener()` with `GARemoteConfigsListener` callback, making remote configs notifications usable from managed runtimes (e.g. Unity P/Invoke). Single listener; re-registering replaces it, `NULL` unregisters.

### Changed

- **Windows: static builds now use the dynamic MSVC runtime (`/MD`)** — All Windows builds (static and shared) now compile against the DLL runtime instead of `/MT` for static builds, matching what Unreal Engine and most consumers require. **Breaking for consumers linking the static library with `/MT`**: upgrading will produce an LNK2038 RuntimeLibrary mismatch; switch your project to `/MD` (`MultiThreadedDLL`).

## 5.2.0

### Added
Expand Down
6 changes: 1 addition & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,7 @@ endif()

if(WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGUID_WINDOWS")
if(${GA_SHARED_LIB})
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
else()
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")

if(${GA_UWP_BUILD})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGA_UWP_BUILD")
Expand Down
11 changes: 7 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def get_compiler_for_platform(platform, compiler=None):

def main():
parser = argparse.ArgumentParser(description="CMake Build and Test Script")
parser.add_argument('--platform', choices=['linux_x64', 'linux_x86', 'osx', 'win32', 'win64', 'uwp'], help='Platform to build for', required=True)
parser.add_argument('--platform', choices=['linux_x64', 'linux_x86', 'osx', 'win64'], help='Platform to build for', required=True)
parser.add_argument('--cfg', default='Debug', choices=['Release', 'Debug'], help='Configuration Type')
parser.add_argument('--compiler', choices=['gcc', 'clang'], help='Compiler to use (Linux only: gcc or clang, default=clang)')
parser.add_argument('--shared', action='store_true', help='Build shared library instead of static')
Expand Down Expand Up @@ -82,7 +82,11 @@ def main():
if args.no_curl:
cmake_command += ' -DGA_HTTP_USE_CURL=OFF'

if not args.no_vcpkg:
if args.no_vcpkg:
cmake_command += ' -DUSE_VCPKG=OFF'
if args.platform == 'osx':
cmake_command += ' "-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64"'
else:

if args.platform.startswith('linux'):
platform = 'linux'
Expand All @@ -101,9 +105,8 @@ def main():

triplet = f'{arch}-{platform}'

# match CMAKE_MSVC_RUNTIME_LIBRARY: /MD shared, /MT static
if args.platform.startswith('win'):
triplet = f'{arch}-windows-static-md' if args.shared else f'{arch}-windows-static'
triplet = f'{arch}-windows-static-md'

if args.platform == 'osx':
osx_arch = arch if arch == 'arm64' else 'x86_64' # no official universal triplet for osx vcpkg
Expand Down
Loading