diff --git a/.github/workflows/plugin-cd.yml b/.github/workflows/plugin-cd.yml index fa3e837..81ebbaf 100644 --- a/.github/workflows/plugin-cd.yml +++ b/.github/workflows/plugin-cd.yml @@ -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: @@ -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 @@ -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 @@ -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: diff --git a/Extras/triplets/universal-osx-unreal.cmake b/Extras/triplets/universal-osx-unreal.cmake new file mode 100644 index 0000000..708fb4e --- /dev/null +++ b/Extras/triplets/universal-osx-unreal.cmake @@ -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") \ No newline at end of file diff --git a/Source/ConfigCat/Private/ConfigCatSubsystem.cpp b/Source/ConfigCat/Private/ConfigCatSubsystem.cpp index 87de149..0d6224b 100644 --- a/Source/ConfigCat/Private/ConfigCatSubsystem.cpp +++ b/Source/ConfigCat/Private/ConfigCatSubsystem.cpp @@ -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(); + 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; diff --git a/Source/ThirdParty/ConfigCatCppSDK/ConfigCatCppSdk.Build.cs b/Source/ThirdParty/ConfigCatCppSDK/ConfigCatCppSdk.Build.cs index e79e613..01e0bda 100644 --- a/Source/ThirdParty/ConfigCatCppSDK/ConfigCatCppSdk.Build.cs +++ b/Source/ThirdParty/ConfigCatCppSDK/ConfigCatCppSdk.Build.cs @@ -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) {