Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Universal macos binaries #15

Merged
merged 3 commits into from
Jan 31, 2024
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
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
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
Loading