Skip to content

Commit

Permalink
Merge pull request #15 from configcat/universal-macos-binaries
Browse files Browse the repository at this point in the history
Universal macos binaries
  • Loading branch information
pasotee authored Jan 31, 2024
2 parents 29d9bec + f3f5d4e commit 8fd470f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 41 deletions.
36 changes: 6 additions & 30 deletions .github/workflows/plugin-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
./build/vcpkg/installed/*/lib/libconfigcat.a
./build/vcpkg/installed/*/lib/libhash-library.a
build-macos-x64:
build-macos:
runs-on: macos-latest

steps:
Expand All @@ -54,30 +54,11 @@ jobs:
run: |
git clone https://github.com/microsoft/vcpkg build/vcpkg
./build/vcpkg/bootstrap-vcpkg.sh
./build/vcpkg/vcpkg install configcat[core] --triplet x64-osx
./build/vcpkg/vcpkg install configcat[core] --triplet universal-osx-unreal --overlay-triplets "$GITHUB_WORKSPACE/Extras/triplets"
- uses: actions/upload-artifact@v3
with:
name: MacOS-x64
path: |
./build/vcpkg/installed/*/lib/libconfigcat.a
./build/vcpkg/installed/*/lib/libhash-library.a
build-macos-arm64:
runs-on: macos-latest

steps:
- uses: actions/checkout@v2

- name: Install via vcpkg
run: |
git clone https://github.com/microsoft/vcpkg build/vcpkg
./build/vcpkg/bootstrap-vcpkg.sh
./build/vcpkg/vcpkg install configcat[core] --triplet arm64-osx
- uses: actions/upload-artifact@v3
with:
name: MacOS-arm64
name: MacOS
path: |
./build/vcpkg/installed/*/lib/libconfigcat.a
./build/vcpkg/installed/*/lib/libhash-library.a
Expand Down Expand Up @@ -127,7 +108,7 @@ jobs:
publish-engine-plugin:
runs-on: ubuntu-latest
needs: [build-win64, build-android, build-macos-x64, build-macos-arm64, build-ios, build-linux]
needs: [build-win64, build-android, build-macos, build-ios, build-linux]
name: 📦 Package Plugin
steps:
- uses: actions/checkout@v3
Expand All @@ -144,13 +125,8 @@ jobs:

- uses: actions/download-artifact@v3
with:
name: MacOS-x64
path: Source/ThirdParty/ConfigCatCppSDK/Binaries/MacOS/x64-osx

- uses: actions/download-artifact@v3
with:
name: MacOS-arm64
path: Source/ThirdParty/ConfigCatCppSDK/Binaries/MacOS/arm64-osx
name: MacOS
path: Source/ThirdParty/ConfigCatCppSDK/Binaries/MacOS

- uses: actions/download-artifact@v3
with:
Expand Down
6 changes: 6 additions & 0 deletions Extras/triplets/universal-osx-unreal.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
set(VCPKG_TARGET_ARCHITECTURE arm64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)

set(VCPKG_CMAKE_SYSTEM_NAME Darwin)
set(VCPKG_OSX_ARCHITECTURES "arm64;x86_64")
12 changes: 9 additions & 3 deletions Source/ConfigCat/Private/ConfigCatSubsystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,12 +283,18 @@ bool UConfigCatSubsystem::IsOffline() const

void UConfigCatSubsystem::Initialize(FSubsystemCollectionBase& Collection)
{
const FString CppSdkVersion = UTF8_TO_TCHAR(configcat::version);
UE_LOG(LogConfigCat, Display, TEXT("ConfigCat Subsystem initializing cpp-sdk - %s"), *CppSdkVersion);

const UConfigCatSettings* ConfigCatSettings = GetDefault<UConfigCatSettings>();
if(!ConfigCatSettings || ConfigCatSettings->SdkKey.IsEmpty())
{
UE_LOG(LogConfigCat, Warning, TEXT("Empty SdkKey detected. Please set your SdkKey in the Project Settings."));
return;
}

const std::string& SdkKey = TCHAR_TO_UTF8(*ConfigCatSettings->SdkKey);

const FString CppSdkVersion = UTF8_TO_TCHAR(configcat::version);
UE_LOG(LogConfigCat, Display, TEXT("ConfigCat Subsystem initializing cpp-sdk - %s"), *CppSdkVersion);

ConfigCatOptions Options;
Options.baseUrl = TCHAR_TO_UTF8(*ConfigCatSettings->BaseUrl);
Options.dataGovernance = ConfigCatSettings->DataGovernance == EDataGovernance::Global ? Global : EuOnly;
Expand Down
9 changes: 1 addition & 8 deletions Source/ThirdParty/ConfigCatCppSDK/ConfigCatCppSdk.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,7 @@ public ConfigCatCppSdk(ReadOnlyTargetRules Target) : base(Target)
}
else if (Target.Platform == UnrealTargetPlatform.Mac)
{
if (Target.Architecture.ToString().ToLower().Contains("arm64"))
{
AddPrecompiledLibraries(Path.Combine(ModuleDirectory, "Binaries", "MacOS", "arm64-osx"), "*.a");
}
else
{
AddPrecompiledLibraries(Path.Combine(ModuleDirectory, "Binaries", "MacOS", "x64-osx"), "*.a");
}
AddPrecompiledLibraries(Path.Combine(ModuleDirectory, "Binaries", "MacOS", "universal-osx-unreal"), "*.a");
}
else if (Target.Platform == UnrealTargetPlatform.Linux)
{
Expand Down

0 comments on commit 8fd470f

Please sign in to comment.