Skip to content
Open
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
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,9 @@ elseif(APPLE)

create_source_groups(MACOS_SOURCES)

elseif(LINUX)
elseif(UNIX AND NOT APPLE)
# Linux (the LINUX variable only exists in CMake >= 3.25; UNIX AND NOT APPLE
# works on all supported versions, so GUID_STDLIB is always defined here).
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGUID_STDLIB -std=c++17")

if (CMAKE_CXX_COMPILER MATCHES "clang")
Expand Down
4 changes: 2 additions & 2 deletions sample/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/Release")

set(CMAKE_CXX_STANDARD 17)

if(LINUX)
if(UNIX AND NOT APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")

if(CLANG)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
endif()

Expand Down
6 changes: 4 additions & 2 deletions sample_shared/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/Release")

set(CMAKE_CXX_STANDARD 17)

if(LINUX)
if(UNIX AND NOT APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")

if(CLANG)
# Match the library's standard-library choice so the sample's ABI lines up
# with libGameAnalytics when built with clang.
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
endif()
endif()
Expand Down
8 changes: 8 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,14 @@ def main():

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

# On Windows, statically link curl/openssl/zlib into the DLL so the Unity
# plugin is a single self-contained GameAnalytics.dll (mirrors macOS, where
# vcpkg's default triplet already produces static deps). The "-static-md"
# variant keeps the dynamic CRT (/MD), matching CMAKE_MSVC_RUNTIME_LIBRARY
# for shared builds; plain "-static" would use /MT and conflict.
if args.platform.startswith('win') and args.shared:
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
cmake_command += f' -DVCPKG_HOST_TRIPLET={triplet}'
Expand Down
6 changes: 5 additions & 1 deletion source/gameanalytics/GAState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,11 @@ namespace gameanalytics
}
catch (json::exception& e)
{
logging::GALogger::e(e.what());
// Cached config is unparseable (e.g. written by the legacy C# SDK
// in binary-base64 instead of JSON). Discard the stale row; a fresh
// config is fetched on init and rewritten as JSON, so this self-heals.
logging::GALogger::d("Discarding incompatible cached sdk config: %s", e.what());
store::GAStore::setState("sdk_config_cached", "");
}
}

Expand Down
12 changes: 11 additions & 1 deletion source/gameanalytics/Platform/GALinux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,19 @@ std::string gameanalytics::GAPlatformLinux::getOSVersion()
std::string version;
int const strSize = strlen(info.release);

int dotCount = 0;
for (size_t i = 0; i < strSize; ++i)
{
if (!isdigit(info.release[i]) && info.release[i] != '.')
if (info.release[i] == '.')
{
++dotCount;
if (dotCount == 3)
{
version = std::string(info.release, info.release + i);
break;
}
}
else if (!isdigit(info.release[i]))
{
version = std::string(info.release, info.release + i);
break;
Expand Down
Loading