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
16 changes: 10 additions & 6 deletions .github/workflows/build-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,18 @@ on:
- main
- dev


concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: windows-latest
name: Build for Android
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: false
- name: Update submodules
Expand All @@ -32,22 +37,21 @@ jobs:
git config --global submodule.lib/modules.update none
git -c protocol.version=2 submodule update --init --force --depth=1
- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v5
with:
distribution: 'adopt'
java-version: '17'
- name: Remove default github maven configuration
# Workaround for: 'Unable to decrypt local Maven settings credentials'
run: rm $Env:USERPROFILE\.m2\settings.xml
- name: Setup Android SDK
uses: android-actions/setup-android@v2
uses: android-actions/setup-android@v3
- name: Install NDK
run: |
java -version
gci env:* | sort-object name
new-item "C:\Users\runneradmin\.android\repositories.cfg" -ItemType "file"
echo yes | .\sdkmanager.bat "ndk-bundle" "cmake;3.10.2.4988404" "ndk;27.0.12077973" --sdk_root=$Env:ANDROID_SDK_ROOT
working-directory: ${{ env.ANDROID_SDK_ROOT }}\cmdline-tools\7.0\bin
new-item "$Env:USERPROFILE\.android\repositories.cfg" -ItemType "file"
echo yes | sdkmanager "ndk-bundle" "cmake;3.10.2.4988404" "ndk;27.0.12077973" --sdk_root=$Env:ANDROID_SDK_ROOT
- name: Chocolatey
run: |
choco install --no-progress -y ninja
Expand Down
17 changes: 11 additions & 6 deletions .github/workflows/build-ios-mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,22 @@ on:
schedule:
- cron: 0 2 * * 1-5


concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
strategy:
matrix:
os: [macos-13, macos-15]
os: [macos-14, macos-15]
config: [release, debug]
simulator: ["'iPhone 15'", "'iPad Pro (11-inch) (4th generation)'", "'iPhone 16'", "'iPad Air 11-inch (M2)'"]
exclude:
- os: macos-13
- os: macos-14
simulator: "'iPhone 16'"
- os: macos-13
- os: macos-14
simulator: "'iPad Air 11-inch (M2)'"
- os: macos-15
simulator: "'iPhone 15'"
Expand All @@ -42,14 +47,14 @@ jobs:
- name: Grant write permissions to /usr/local
run: |
sudo chown -R $USER:staff /usr/local
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: 'true'
continue-on-error: true
- name: build
run: |
if [[ "${{ matrix.os }}" == "macos-13" ]]; then
export IOS_DEPLOYMENT_TARGET=13.0;
if [[ "${{ matrix.os }}" == "macos-14" ]]; then
export IOS_DEPLOYMENT_TARGET=14.0;
elif [[ "${{ matrix.os }}" == "macos-15" ]]; then
export IOS_DEPLOYMENT_TARGET=15.0;
fi
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/build-posix-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ on:
schedule:
- cron: 0 2 * * 1-5


concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:

Expand All @@ -32,7 +37,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v4
continue-on-error: true
- name: Test ${{ matrix.os }} ${{ matrix.config }}
run: ./build-tests.sh ${{ matrix.config }}
7 changes: 6 additions & 1 deletion .github/workflows/build-ubuntu-2204.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ on:
schedule:
- cron: 0 2 * * 1-5


concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:

Expand All @@ -32,7 +37,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v4
continue-on-error: true
- name: Test ${{ matrix.os }} ${{ matrix.config }}
run: ./build-tests.sh ${{ matrix.config }}
2 changes: 1 addition & 1 deletion .github/workflows/build-windows-clang.yaml.off
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
steps:

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
continue-on-error: true

- name: Setup Tools
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-windows-vs2017.yaml.off
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
steps:

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
continue-on-error: true

- name: Setup Tools
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-windows-vs2022.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
steps:

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
continue-on-error: true

- name: Build
Expand Down
18 changes: 11 additions & 7 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ on:
schedule:
- cron: '0 8 * * 1'


concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
analyze:
name: Analyze
Expand All @@ -34,7 +39,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
continue-on-error: true

# Initializes the CodeQL tools for scanning.
Expand Down Expand Up @@ -87,7 +92,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
continue-on-error: true

- name: Update submodules
Expand All @@ -102,21 +107,20 @@ jobs:
languages: java

- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v5
with:
distribution: 'adopt'
java-version: '17'
- name: Remove default github maven configuration
run: rm $Env:USERPROFILE\.m2\settings.xml
- name: Setup Android SDK
uses: android-actions/setup-android@v2
uses: android-actions/setup-android@v3
- name: Install NDK
run: |
java -version
gci env:* | sort-object name
new-item "C:\Users\runneradmin\.android\repositories.cfg" -ItemType "file"
echo yes | .\sdkmanager.bat "ndk-bundle" "cmake;3.10.2.4988404" "ndk;27.0.12077973" --sdk_root=$Env:ANDROID_SDK_ROOT
working-directory: ${{ env.ANDROID_SDK_ROOT }}\cmdline-tools\7.0\bin
new-item "$Env:USERPROFILE\.android\repositories.cfg" -ItemType "file"
echo yes | sdkmanager "ndk-bundle" "cmake;3.10.2.4988404" "ndk;27.0.12077973" --sdk_root=$Env:ANDROID_SDK_ROOT
- name: Chocolatey
run: |
choco install --no-progress -y ninja
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/spellcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,19 @@ on:
pull_request:
branches: [ master, main ]


concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest

steps:

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
continue-on-error: true

- name: install misspell
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-android-mac.yml.off
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
steps:

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: true
depth: 1
Expand All @@ -42,7 +42,7 @@ jobs:
script: ./testandlog
- name: Upload
if: ${{ always() }}
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: logcat
path: ./lib/android_build/logcat.txt
11 changes: 8 additions & 3 deletions .github/workflows/test-win-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ on:
schedule:
- cron: 0 2 * * 1-5


concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
name: Test on Windows ${{ matrix.arch }}-${{ matrix.build }}
Expand All @@ -32,13 +37,13 @@ jobs:
steps:

- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v4
continue-on-error: true

- name: setup-msbuild
uses: microsoft/setup-msbuild@v1.1
uses: microsoft/setup-msbuild@v2
with:
vs-version: '[16,)'
vs-version: '[17,)'

- name: Test ${{ matrix.arch }} ${{ matrix.build }}
shell: cmd
Expand Down
23 changes: 15 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,23 +115,30 @@ message("-- CMAKE_CXX_COMPILER_ID: ${CMAKE_CXX_COMPILER_ID}")
include(tools/ParseOsRelease.cmake)

if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set(WARN_FLAGS "/W4 /WX")
set(WARN_FLAGS "/W4 /WX")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
# -Wno-unknown-warning-option is Clang-only, omitted here
set(WARN_FLAGS "-Wall -Werror -Wextra -Wno-unused-parameter -Wno-unused-but-set-variable")
# -Wno-reorder is C++-only; added to CXX_FLAGS below (suppresses member-init-order warnings in submodule code)
set(CXX_EXTRA_WARN_FLAGS "-Wno-reorder")
else()
# No -pedantic -Wno-extra-semi -Wno-gnu-zero-variadic-macro-arguments
set(WARN_FLAGS "-Wall -Werror -Wextra -Wno-unused-parameter -Wno-unknown-warning-option -Wno-unused-but-set-variable")
# Clang / AppleClang
set(WARN_FLAGS "-Wall -Werror -Wextra -Wno-unused-parameter -Wno-unknown-warning-option -Wno-unused-but-set-variable")
# -Wno-reorder is C++-only; added to CXX_FLAGS below (suppresses member-init-order warnings in submodule code)
set(CXX_EXTRA_WARN_FLAGS "-Wno-reorder")
endif()

if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
# Using GCC with -s and -Wl linker flags
set(REL_FLAGS "-s -Wl,--gc-sections -Os ${WARN_FLAGS} -ffunction-sections -fdata-sections -fmerge-all-constants -ffast-math")
set(REL_FLAGS "-s -Wl,--gc-sections -Os ${WARN_FLAGS} -ffunction-sections -fdata-sections -fmerge-all-constants -ffast-math -fno-finite-math-only")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set(REL_FLAGS "${WARN_FLAGS}")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
# AppleClang does not support -ffunction-sections and -fdata-sections with the -fembed-bitcode and -fembed-bitcode-marker
set(REL_FLAGS "-Os ${WARN_FLAGS} -fmerge-all-constants -ffast-math")
set(REL_FLAGS "-Os ${WARN_FLAGS} -fmerge-all-constants -ffast-math -fno-finite-math-only")
else()
# Using clang - strip unsupported GCC options
set(REL_FLAGS "-Os ${WARN_FLAGS} -ffunction-sections -fmerge-all-constants -ffast-math")
set(REL_FLAGS "-Os ${WARN_FLAGS} -ffunction-sections -fmerge-all-constants -ffast-math -fno-finite-math-only")
endif()

## Uncomment this to reduce the volume of note warnings on RPi4 w/gcc-8 Ref. https://gcc.gnu.org/ml/gcc/2017-05/msg00073.html
Expand All @@ -146,13 +153,13 @@ if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
#TODO: -fno-rtti
message("Building Release ...")
set(CMAKE_C_FLAGS "$ENV{CFLAGS} ${CMAKE_C_FLAGS} -std=c11 ${REL_FLAGS}")
set(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} ${CMAKE_CXX_FLAGS} -std=c++11 ${REL_FLAGS}")
set(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} ${CMAKE_CXX_FLAGS} -std=c++11 ${REL_FLAGS} ${CXX_EXTRA_WARN_FLAGS}")
else()
set(USE_TCMALLOC 1)
message("Building Debug ...")
include(tools/FindTcmalloc.cmake)
set(CMAKE_C_FLAGS "$ENV{CFLAGS} ${CMAKE_C_FLAGS} -std=c11 ${DBG_FLAGS}")
set(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} ${CMAKE_CXX_FLAGS} -std=c++11 ${DBG_FLAGS}")
set(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} ${CMAKE_CXX_FLAGS} -std=c++11 ${DBG_FLAGS} ${CXX_EXTRA_WARN_FLAGS}")
endif()

#Remove /Zi for Win32 debug compiler issue
Expand Down
17 changes: 13 additions & 4 deletions build-tests-ios.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,23 @@ set -e

./build-ios.sh ${SKU}

# dyld_info /Users/runner/work/cpp_client_telemetry/cpp_client_telemetry/out/lib/libmat.a

cd tests/unittests

xcrun simctl list devices available
echo 'End of xcrun simctl list devices available'

xcodebuild test -scheme iOSUnitTests -destination "platform=iOS Simulator,name=$SIMULATOR"
# Resolve simulator UUID to avoid ambiguous destination matching.
# Grab the last (newest OS) available device matching the requested name.
SIM_ID=$(xcrun simctl list devices available | grep "$SIMULATOR" | grep -oE '[A-F0-9-]{36}' | tail -1)

if [ -z "$SIM_ID" ]; then
echo "ERROR: No available simulator found for '$SIMULATOR'"
exit 1
fi

echo "Using simulator: $SIMULATOR (id=$SIM_ID)"

xcodebuild test -scheme iOSUnitTests -destination "id=$SIM_ID"

cd ../functests
xcodebuild test -scheme iOSFuncTests -destination "platform=iOS Simulator,name=$SIMULATOR"
xcodebuild test -scheme iOSFuncTests -destination "id=$SIM_ID"
3 changes: 2 additions & 1 deletion lib/api/Logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ namespace MAT_NS_BEGIN

Logger::~Logger() noexcept
{
LOG_TRACE("%p: Destroyed", this);
// Intentionally empty — logging here triggers a static-destruction-order
// crash on iOS simulator (recursive_mutex used after teardown).
}

ISemanticContext* Logger::GetSemanticContext() const
Expand Down
6 changes: 3 additions & 3 deletions lib/http/HttpClientFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
#elif defined(MATSDK_PAL_CPP11)
#if TARGET_OS_IPHONE || (defined(__APPLE__) && defined(APPLE_HTTP))
#include "http/HttpClient_Apple.hpp"
#elif defined(HAVE_MAT_CURL_HTTP_CLIENT) || !defined(ANDROID)
#elif defined(HAVE_MAT_CURL_HTTP_CLIENT) || !defined(__ANDROID__)
#include "http/HttpClient_Curl.hpp"
#elif defined(ANDROID)
#elif defined(__ANDROID__)
#include "http/HttpClient_Android.hpp"
#endif
#else
Expand Down Expand Up @@ -61,7 +61,7 @@ namespace MAT_NS_BEGIN {
LOG_TRACE("Creating HttpClient_Apple");
return std::make_shared<HttpClient_Apple>();
}
#elif defined(ANDROID)
#elif defined(__ANDROID__)
std::shared_ptr<IHttpClient> HttpClientFactory::Create() {
LOG_TRACE("Creating HttpClient_Android");
return HttpClient_Android::GetClientInstance();
Expand Down
Loading
Loading