diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 28938db9..fce32ecf 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -71,6 +71,30 @@ jobs: run: | echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" + - name: Install Clang and Libraries + if: matrix.os == 'ubuntu-latest' && matrix.c_compiler == 'clang' + run: | + sudo apt-get update + sudo apt-get install -y clang libc++-dev libc++abi-dev + + - name: Set Clang 16 as Default + if: matrix.os == 'ubuntu-24.04' && matrix.c_compiler == 'clang' + run: | + sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-16 100 + sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-16 100 + sudo update-alternatives --set clang /usr/bin/clang-16 + sudo update-alternatives --set clang++ /usr/bin/clang++-16 + + - name: Check Clang Settings + if: matrix.os == 'ubuntu-latest' && matrix.c_compiler == 'clang' + run: | + clang --version + clang++ --version + echo "Checking clang headers..." + clang++ -v -E -x c++ /dev/null + echo "check lld..." + ldd --version + - name: Configure CMake # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type @@ -83,7 +107,7 @@ jobs: - name: Build # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). - run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} + run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --verbose - name: Test working-directory: ${{ steps.strings.outputs.build-output-dir }} diff --git a/CMakeLists.txt b/CMakeLists.txt index 3627bdd8..868c6b1b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -197,7 +197,8 @@ elseif(APPLE) elseif(LINUX) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGUID_STDLIB -std=c++17") - if(CLANG) + if (CMAKE_CXX_COMPILER MATCHES "clang") + message(STATUS "Detected Clang compiler: ${CMAKE_CXX_COMPILER}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") endif() @@ -209,7 +210,9 @@ endif() add_library(GameAnalytics ${LIB_TYPE} ${CPP_SOURCES}) target_link_libraries(GameAnalytics PRIVATE ${LIBS} PUBLIC ${PUBLIC_LIBS}) - +message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}") +message(STATUS "CMAKE_EXE_LINKER_FLAGS: ${CMAKE_EXE_LINKER_FLAGS}") +message(STATUS "CMAKE_SHARED_LINKER_FLAGS: ${CMAKE_SHARED_LINKER_FLAGS}") # --------------------------- Google Test Setup --------------------------- # # Set Project Name diff --git a/include/GameAnalytics/GameAnalytics.h b/include/GameAnalytics/GameAnalytics.h index 87845d61..622d30d0 100644 --- a/include/GameAnalytics/GameAnalytics.h +++ b/include/GameAnalytics/GameAnalytics.h @@ -102,15 +102,16 @@ namespace gameanalytics static void startSession(); static void endSession(); - static std::string getRemoteConfigsValueAsString(std::string const& key); - static std::string getRemoteConfigsValueAsString(std::string const& key, std::string const& defaultValue); + static std::string getRemoteConfigsValueAsString(std::string const& key, std::string const& defaultValue = ""); static bool isRemoteConfigsReady(); static void addRemoteConfigsListener(const std::shared_ptr &listener); static void removeRemoteConfigsListener(const std::shared_ptr &listener); static std::string getRemoteConfigsContentAsString(); - static std::string getRemoteConfigsContentAsJson(); + + static std::string getUserId(); + static std::string getExternalUserId(); static std::string getABTestingId(); static std::string getABTestingVariantId(); diff --git a/sample/Main.cpp b/sample/Main.cpp index 212589c1..3ed96837 100644 --- a/sample/Main.cpp +++ b/sample/Main.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include "GameAnalytics/GameAnalytics.h" diff --git a/source/gameanalytics/GAState.cpp b/source/gameanalytics/GAState.cpp index 515655a4..13fd7a90 100644 --- a/source/gameanalytics/GAState.cpp +++ b/source/gameanalytics/GAState.cpp @@ -61,11 +61,16 @@ namespace gameanalytics getInstance().cacheIdentifier(); } - std::string GAState::getIdentifier() + std::string GAState::getUserId() { return getInstance()._identifier; } + std::string GAState::getExternalUserId() + { + return getInstance()._externalUserId; + } + bool GAState::isInitialized() { return getInstance()._initialized; @@ -402,7 +407,7 @@ namespace gameanalytics out["event_uuid"] = utilities::GAUtilities::generateUUID(); // User identifier - out["user_id"] = getInstance().getIdentifier(); + out["user_id"] = getUserId(); // remote configs configurations if(getInstance()._configurations.is_object() && !getInstance()._configurations.empty()) diff --git a/source/gameanalytics/GAState.h b/source/gameanalytics/GAState.h index 490bd3a1..020438ea 100644 --- a/source/gameanalytics/GAState.h +++ b/source/gameanalytics/GAState.h @@ -141,6 +141,8 @@ namespace gameanalytics static std::string getRemoteConfigsContentAsString(); static std::string getAbId(); static std::string getAbVariantId(); + static std::string getUserId(); + static std::string getExternalUserId(); static json getValidatedCustomFields(); static json getValidatedCustomFields(const json& withEventFields); @@ -164,7 +166,6 @@ namespace gameanalytics addErrorEvent(severity, msg); } - std::string getIdentifier(); void setDefaultUserId(std::string const& id); json& getSdkConfig(); void cacheIdentifier(); diff --git a/source/gameanalytics/GameAnalytics.cpp b/source/gameanalytics/GameAnalytics.cpp index dfa373ca..60ec105b 100644 --- a/source/gameanalytics/GameAnalytics.cpp +++ b/source/gameanalytics/GameAnalytics.cpp @@ -475,7 +475,7 @@ namespace gameanalytics { // Send to events json fieldsJson = utilities::parseFields(fields); - events::GAEvents::addProgressionEvent(progressionStatus, progression01, progression02, progression03, score, false, fieldsJson, mergeFields); + events::GAEvents::addProgressionEvent(progressionStatus, progression01, progression02, progression03, score, true, fieldsJson, mergeFields); } catch(const json::exception& e) { @@ -763,6 +763,16 @@ namespace gameanalytics return state::GAState::getRemoteConfigsContentAsString(); } + std::string GameAnalytics::getUserId() + { + return state::GAState::getUserId(); + } + + std::string GameAnalytics::getExternalUserId() + { + return state::GAState::getExternalUserId(); + } + std::string GameAnalytics::getABTestingId() { return state::GAState::getAbId(); diff --git a/source/gameanalytics/Platform/GALinux.cpp b/source/gameanalytics/Platform/GALinux.cpp index 20154394..d5ec8064 100644 --- a/source/gameanalytics/Platform/GALinux.cpp +++ b/source/gameanalytics/Platform/GALinux.cpp @@ -4,6 +4,7 @@ #include "GAState.h" +#include #include #include #include