Skip to content

Commit

Permalink
Merge branch 'main' into gmanivannan/registerReceiverAPISDK34change
Browse files Browse the repository at this point in the history
  • Loading branch information
lalitb authored Jun 3, 2024
2 parents 63136b1 + 06c0679 commit b1f07bc
Show file tree
Hide file tree
Showing 50 changed files with 243 additions and 3,836 deletions.
86 changes: 80 additions & 6 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
runs-on: windows-2019
permissions:
contents: read
actions: read
Expand All @@ -28,7 +28,7 @@ jobs:
matrix:
# Override automatic language detection by changing the below list
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
language: ['cpp']
language: ['cpp', 'csharp', 'javascript', 'python']
# Learn more...
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection

Expand All @@ -39,7 +39,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -49,8 +49,17 @@ jobs:

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# - name: Autobuild
# uses: github/codeql-action/autobuild@v3
- name: Build
env:
SKIP_ARM_BUILD: 1
SKIP_ARM64_BUILD: 1
PlatformToolset: v142
VSTOOLS_VERSION: vs2019
shell: cmd
if: matrix.language == 'cpp' || matrix.language == 'csharp'
run: build-all.bat

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -64,4 +73,69 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3

analyze-java:
name: Analyze Java
runs-on: windows-latest
permissions:
contents: read
actions: read
security-events: write

strategy:
fail-fast: false

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

- name: Update submodules
run: |
git submodule sync
git config --global submodule.lib/modules.update none
git -c protocol.version=2 submodule update --init --force --depth=1
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: java

- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
- name: Remove default github maven configuration
run: rm $Env:USERPROFILE\.m2\settings.xml
- name: Setup Android SDK
uses: android-actions/setup-android@v2
- 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;21.4.7075529" --sdk_root=$Env:ANDROID_SDK_ROOT
working-directory: ${{ env.ANDROID_SDK_ROOT }}\cmdline-tools\7.0\bin
- name: Chocolatey
run: |
choco install --no-progress -y ninja
- name: List CMake
run: |
pwd
echo "=================="
gci -r -i "CMake*" -Name
echo "=================="
gci -r -i "gtest-all*" -Name
echo "=================="
gci third_party/ -Name
echo "=================="
gci third_party/googletest -Name
- name: Gradle Build
run: |
.\gradlew.bat maesdk:assemble app:assemble
working-directory: lib\android_build

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
22 changes: 14 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,21 @@ if(APPLE)
endif()
endif()

if((${IOS_PLAT} STREQUAL "iphoneos") OR (${IOS_PLAT} STREQUAL "iphonesimulator"))
if((${IOS_PLAT} STREQUAL "iphoneos") OR (${IOS_PLAT} STREQUAL "iphonesimulator") OR (${IOS_PLAT} STREQUAL "xros") OR (${IOS_PLAT} STREQUAL "xrsimulator"))
set(IOS_PLATFORM "${IOS_PLAT}")
else()
message(FATAL_ERROR "Unrecognized iOS platform '${IOS_PLAT}'")
endif()

if(${IOS_ARCH} STREQUAL "x86_64")
set(IOS_PLATFORM "iphonesimulator")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch x86_64")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch x86_64")
set(CMAKE_SYSTEM_PROCESSOR x86_64)
elseif(${IOS_ARCH} STREQUAL "arm64")
set(IOS_PLATFORM ${IOS_PLAT})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch arm64")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch arm64")
set(CMAKE_SYSTEM_PROCESSOR arm64)
elseif(${IOS_ARCH} STREQUAL "arm64e")
set(IOS_PLATFORM ${IOS_PLAT})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch arm64e")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch arm64e")
set(CMAKE_SYSTEM_PROCESSOR arm64e)
Expand All @@ -78,11 +77,18 @@ if(APPLE)
message("-- PLATFORM: ${IOS_PLATFORM}")
else()
if(${MAC_ARCH} STREQUAL "x86_64")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch x86_64")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch x86_64")
set(CMAKE_SYSTEM_PROCESSOR x86_64)
set(TARGET_ARCH ${CMAKE_SYSTEM_PROCESSOR})
set(CMAKE_OSX_ARCHITECTURES ${MAC_ARCH})
set(APPLE True)
elseif(${MAC_ARCH} STREQUAL "arm64")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch arm64")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch arm64")
set(CMAKE_SYSTEM_PROCESSOR arm64)
set(TARGET_ARCH ${CMAKE_SYSTEM_PROCESSOR})
set(CMAKE_OSX_ARCHITECTURES ${MAC_ARCH})
set(APPLE True)
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch x86_64 -arch arm64")
Expand All @@ -107,7 +113,7 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set(WARN_FLAGS "/W4 /WX")
else()
# No -pedantic -Wno-extra-semi -Wno-gnu-zero-variadic-macro-arguments
set(WARN_FLAGS "-Wall -Werror -Wextra -Wno-unused-parameter")
set(WARN_FLAGS "-Wall -Werror -Wextra -Wno-unused-parameter -Wno-unknown-warning-option -Wno-unused-but-set-variable")
endif()

if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
Expand Down Expand Up @@ -310,17 +316,17 @@ endif()
################################################################################################

if (BUILD_PACKAGE)
if (${CMAKE_PACKAGE_TYPE} STREQUAL "deb")
if ("${CMAKE_PACKAGE_TYPE}" STREQUAL "deb")
# FIXME: hardcode it for 64-bit Linux for now
set(INSTALL_LIB_DIR ${CMAKE_INSTALL_PREFIX}/lib/${CPACK_DEBIAN_ARCHITECTURE}-linux-gnu)
include(tools/MakeDeb.cmake)
endif()
if (${CMAKE_PACKAGE_TYPE} STREQUAL "rpm")
if ("${CMAKE_PACKAGE_TYPE}" STREQUAL "rpm")
# TODO: [MG] - fix path
set(INSTALL_LIB_DIR ${CMAKE_INSTALL_PREFIX}/lib/${CMAKE_SYSTEM_PROCESSOR}-linux-gnu)
include(tools/MakeRpm.cmake)
endif()
if (${CMAKE_PACKAGE_TYPE} STREQUAL "tgz")
if ("${CMAKE_PACKAGE_TYPE}" STREQUAL "tgz")
# TODO: [MG] - fix path... should we simply use /usr/local/lib without CPU?
# TODO: [MG] - Windows path is not ideal -- C:/Program Files (x86)/MSTelemetry/* - what should we use instead?
include(tools/MakeTgz.cmake)
Expand Down
4 changes: 2 additions & 2 deletions build-all.bat
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ echo %CUSTOM_PROPS%
if NOT DEFINED SKIP_MD_BUILD (
REM DLL and static /MD build
REM Release
call tools\RunMsBuild.bat Win32 Release "sqlite:Rebuild,zlib:Rebuild,sqlite-uwp:Rebuild,win32-dll:Rebuild,win32-lib:Rebuild,net40:Rebuild,win10-cs:Rebuild,win10-dll:Rebuild,win10-lib:Rebuild,Tests\gmock:Rebuild,Tests\gtest:Rebuild,Tests\UnitTests:Rebuild,Tests\FuncTests:Rebuild" %CUSTOM_PROPS%
call tools\RunMsBuild.bat x64 Release "sqlite:Rebuild,zlib:Rebuild,sqlite-uwp:Rebuild,win32-dll:Rebuild,win32-lib:Rebuild,net40:Rebuild,win10-cs:Rebuild,win10-dll:Rebuild,win10-lib:Rebuild,Tests\gmock:Rebuild,Tests\gtest:Rebuild,Tests\UnitTests:Rebuild,Tests\FuncTests:Rebuild" %CUSTOM_PROPS%
call tools\RunMsBuild.bat Win32 Release "sqlite:Rebuild,zlib:Rebuild,sqlite-uwp:Rebuild,win32-dll:Rebuild,win32-lib:Rebuild,net40:Rebuild,win10-cs:Rebuild,win10-dll:Rebuild,win10-lib:Rebuild,Tests\gmock:Rebuild,Tests\gtest:Rebuild,Tests\UnitTests:Rebuild,Tests\FuncTests:Rebuild,Samples\cs\SampleCsNet40:Rebuild" %CUSTOM_PROPS%
call tools\RunMsBuild.bat x64 Release "sqlite:Rebuild,zlib:Rebuild,sqlite-uwp:Rebuild,win32-dll:Rebuild,win32-lib:Rebuild,net40:Rebuild,win10-cs:Rebuild,win10-dll:Rebuild,win10-lib:Rebuild,Tests\gmock:Rebuild,Tests\gtest:Rebuild,Tests\UnitTests:Rebuild,Tests\FuncTests:Rebuild,Samples\cs\SampleCsNet40:Rebuild" %CUSTOM_PROPS%
REM Debug
if NOT DEFINED SKIP_DEBUG_BUILD (
call tools\RunMsBuild.bat Win32 Debug "sqlite:Rebuild,zlib:Rebuild,sqlite-uwp:Rebuild,win32-dll:Rebuild,win32-lib:Rebuild,net40:Rebuild,win10-cs:Rebuild,win10-dll:Rebuild,win10-lib:Rebuild,Tests\gmock:Rebuild,Tests\gtest:Rebuild,Tests\UnitTests:Rebuild,Tests\FuncTests:Rebuild" %CUSTOM_PROPS%
Expand Down
98 changes: 64 additions & 34 deletions build-ios.sh
Original file line number Diff line number Diff line change
@@ -1,69 +1,99 @@
#!/bin/sh

# The expected iOS build invocation is:
# build-ios.sh [clean] [release|debug] ${ARCH} ${PLATFORM}
# where
# ARCH = arm64|arm64e|x86_64
# PLATFORM = iphoneos|iphonesimulator|xros|xrsimulator

if [ "$1" == "clean" ]; then
rm -f CMakeCache.txt *.cmake
rm -rf out
rm -rf .buildtools
# make clean
echo "build-ios.sh: cleaning previous build artifacts"
rm -f CMakeCache.txt *.cmake
rm -rf out
rm -rf .buildtools
# make clean
shift
fi

if [ "$1" == "release" ] || [ "$2" == "release" ]; then
BUILD_TYPE="Release"
else
BUILD_TYPE="Debug"
if [ "$1" == "release" ]; then
BUILD_TYPE="Release"
shift
elif [ "$1" == "debug" ]; then
BUILD_TYPE="Debug"
shift
fi

# Set Architecture: arm64, arm64e or x86_64
if [ "$2" == "arm64" ] || [ "$3" == "arm64" ]; then
IOS_ARCH="arm64"
elif [ "$2" == "arm64e" ] || [ "$3" == "arm64e" ]; then
IOS_ARCH="arm64e"
else
IOS_ARCH="x86_64"
IOS_ARCH=$(/usr/bin/uname -m)
if [ "$1" == "arm64" ]; then
IOS_ARCH="arm64"
shift
elif [ "$1" == "arm64e" ]; then
IOS_ARCH="arm64e"
shift
elif [ "$1" == "x86_64" ]; then
IOS_ARCH="x86_64"
shift
fi

# Set Platform: device or simulator
if [ "$2" == "device" ] || [ "$3" == "device" ] || [ "$4" == "device" ]; then
IOS_PLAT="iphoneos"
else
# the last param is expected to specify the platform name: iphoneos|iphonesimulator|xros|xrsimulator
# so if it is non-empty and it is not "device", we take it as a valid platform name
# otherwise we fall back to old iOS logic which only supported iphoneos|iphonesimulator
IOS_PLAT="iphonesimulator"
if [ -n "$1" ] && [ "$1" != "device" ]; then
IOS_PLAT="$1"
elif [ "$1" == "device" ]; then
IOS_PLAT="iphoneos"
fi

# Set target iOS minver
default_ios_target=10.0
if [ -z $IOS_DEPLOYMENT_TARGET ]; then
export IOS_DEPLOYMENT_TARGET=${default_ios_target}
export FORCE_RESET_DEPLOYMENT_TARGET=YES
else
export FORCE_RESET_DEPLOYMENT_TARGET=NO
echo "IOS_ARCH = $IOS_ARCH, IOS_PLAT = $IOS_PLAT, BUILD_TYPE = $BUILD_TYPE"

FORCE_RESET_DEPLOYMENT_TARGET=NO
DEPLOYMENT_TARGET=""

if [ "$IOS_PLAT" == "iphoneos" ] || [ "$IOS_PLAT" == "iphonesimulator" ]; then
SYS_NAME="iOS"
DEPLOYMENT_TARGET="$IOS_DEPLOYMENT_TARGET"
if [ -z "$DEPLOYMENT_TARGET" ]; then
DEPLOYMENT_TARGET="10.0"
FORCE_RESET_DEPLOYMENT_TARGET=YES
fi
elif [ "$IOS_PLAT" == "xros" ] || [ "$IOS_PLAT" == "xrsimulator" ]; then
SYS_NAME="visionOS"
DEPLOYMENT_TARGET="$XROS_DEPLOYMENT_TARGET"
if [ -z "$DEPLOYMENT_TARGET" ]; then
DEPLOYMENT_TARGET="1.0"
FORCE_RESET_DEPLOYMENT_TARGET=YES
fi
fi
echo "ios deployment target="$IOS_DEPLOYMENT_TARGET
echo "force reset deployment target="$FORCE_RESET_DEPLOYMENT_TARGET

echo "deployment target = $DEPLOYMENT_TARGET"
echo "force reset deployment target = $FORCE_RESET_DEPLOYMENT_TARGET"

# Install build tools and recent sqlite3
FILE=.buildtools
OS_NAME=`uname -a`
FILE=".buildtools"
if [ ! -f $FILE ]; then
tools/setup-buildtools-apple.sh ios
# Assume that the build tools have been successfully installed
echo > $FILE
# Assume that the build tools have been successfully installed
echo > $FILE
fi

if [ -f /usr/bin/gcc ]; then
echo "gcc version: `gcc --version`"
echo "gcc version: `gcc --version`"
fi

if [ -f /usr/bin/clang ]; then
echo "clang version: `clang --version`"
echo "clang version: `clang --version`"
fi

mkdir -p out
cd out

CMAKE_PACKAGE_TYPE=tgz

cmake_cmd="cmake -DCMAKE_OSX_SYSROOT=$IOS_PLAT -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_IOS_ARCH_ABI=$IOS_ARCH -DCMAKE_OSX_DEPLOYMENT_TARGET=$IOS_DEPLOYMENT_TARGET -DBUILD_IOS=YES -DIOS_ARCH=$IOS_ARCH -DIOS_PLAT=$IOS_PLAT -DIOS_DEPLOYMENT_TARGET=$IOS_DEPLOYMENT_TARGET -DBUILD_UNIT_TESTS=YES -DBUILD_FUNC_TESTS=YES -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_PACKAGE_TYPE=$CMAKE_PACKAGE_TYPE -DFORCE_RESET_DEPLOYMENT_TARGET=$FORCE_RESET_DEPLOYMENT_TARGET $CMAKE_OPTS .."
echo $cmake_cmd
cmake_cmd="cmake -DCMAKE_OSX_SYSROOT=$IOS_PLAT -DCMAKE_SYSTEM_NAME=$SYS_NAME -DCMAKE_IOS_ARCH_ABI=$IOS_ARCH -DCMAKE_OSX_DEPLOYMENT_TARGET=$DEPLOYMENT_TARGET -DBUILD_IOS=YES -DIOS_ARCH=$IOS_ARCH -DIOS_PLAT=$IOS_PLAT -DIOS_DEPLOYMENT_TARGET=$DEPLOYMENT_TARGET -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_PACKAGE_TYPE=$CMAKE_PACKAGE_TYPE -DFORCE_RESET_DEPLOYMENT_TARGET=$FORCE_RESET_DEPLOYMENT_TARGET $CMAKE_OPTS .."
echo "${cmake_cmd}"
eval $cmake_cmd

make
Expand Down
Loading

0 comments on commit b1f07bc

Please sign in to comment.