Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
13c6414
Apply CMake best practices and remove stale references
bmehta001 Apr 29, 2026
7d9bbde
Fix #1416 review follow-ups
bmehta001 Apr 30, 2026
13f66c1
Fix #1416 Apple runtime regressions
bmehta001 May 1, 2026
b47f5c0
Make CurlHttpOperation own CA path
bmehta001 May 1, 2026
028199c
Restore nonfunctional CMake comments
bmehta001 May 1, 2026
5c0ded8
Remove runtime overlap with #1429
bmehta001 May 1, 2026
a262717
Potential fix for pull request finding
bmehta001 May 11, 2026
93502cc
Quote functest configure_file paths
bmehta001 May 11, 2026
704d29b
Drop -ffast-math from Unix REL_FLAGS
bmehta001 May 14, 2026
1cfe326
Restore Clang warning comment clarity
bmehta001 May 22, 2026
e47634e
Merge branch 'main' into bhamehta/code-cleanup
bmehta001 May 28, 2026
1de44ae
tests(cmake): quote module source paths in list(APPEND SRCS) blocks
Copilot May 28, 2026
337028a
Solutions: drop speculative v145 PlatformToolset mapping for VS 18.0+
Copilot May 28, 2026
c4b3c98
cmake: stop overriding CMAKE_CXX_STANDARD with -std=c++11
bmehta001 May 28, 2026
d2e2bd1
Merge branch 'main' into bhamehta/code-cleanup
bmehta001 May 29, 2026
e21c50a
Address CMake review comments
bmehta001 May 29, 2026
624abf6
Harden package version parsing
bmehta001 May 29, 2026
248d53f
Merge remote-tracking branch 'msft/main' into bhamehta/code-cleanup
bmehta001 May 29, 2026
435e730
Remove leftover CMake merge markers
bmehta001 May 29, 2026
be04013
Revert package version alignment
bmehta001 May 29, 2026
b99ff14
Document current Visual Studio build toolsets
bmehta001 May 30, 2026
b721bc5
Revert "Document current Visual Studio build toolsets"
bmehta001 May 30, 2026
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
58 changes: 30 additions & 28 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.1.0)
project(MSTelemetry)
project(MSTelemetry LANGUAGES C CXX)

# Set installation prefix for macOS and Linux
if(UNIX AND NOT DEFINED CMAKE_INSTALL_PREFIX)
Expand All @@ -16,16 +16,17 @@ set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation d
#set(CMAKE_CXX_FLAGS -m32)
# End of i386 build

# We ask for 14, but we may get C++11 on older gcc-4.x and gcc-5.x
# Project's required C++ standard. gcc-5+, clang-3.4+, and MSVC 2015+ all support C++14.
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

if (NOT TARGET_ARCH)
set(TARGET_ARCH ${CMAKE_SYSTEM_PROCESSOR})
endif()

# Enable ARC for obj-c on Apple
if(APPLE)
message("-- BUILD_IOS: ${BUILD_IOS}")
message(STATUS "BUILD_IOS: ${BUILD_IOS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fobjc-arc")

# iOS build options
Expand Down Expand Up @@ -77,9 +78,9 @@ if(APPLE)
OUTPUT_VARIABLE CMAKE_OSX_SYSROOT
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
message("-- CMAKE_OSX_SYSROOT ${CMAKE_OSX_SYSROOT}")
message("-- ARCHITECTURE: ${CMAKE_SYSTEM_PROCESSOR}")
message("-- PLATFORM: ${IOS_PLATFORM}")
message(STATUS "CMAKE_OSX_SYSROOT ${CMAKE_OSX_SYSROOT}")
message(STATUS "ARCHITECTURE: ${CMAKE_SYSTEM_PROCESSOR}")
message(STATUS "PLATFORM: ${IOS_PLATFORM}")
else()
if(${MAC_ARCH} STREQUAL "x86_64")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch x86_64")
Expand All @@ -99,18 +100,18 @@ if(APPLE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch x86_64 -arch arm64")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch x86_64 -arch arm64")
endif()
message("-- MAC_ARCH: ${MAC_ARCH}")
message(STATUS "MAC_ARCH: ${MAC_ARCH}")
endif()
endif()

message("-- CMAKE_SYSTEM_INFO_FILE: ${CMAKE_SYSTEM_INFO_FILE}")
message("-- CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}")
message("-- CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}")
message("-- CMAKE_SYSTEM: ${CMAKE_SYSTEM}")
message("-- CMAKE_SYSTEM_VERSION: ${CMAKE_SYSTEM_VERSION}")
message("-- CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
message("-- TARGET_ARCH: ${TARGET_ARCH}")
message("-- CMAKE_CXX_COMPILER_ID: ${CMAKE_CXX_COMPILER_ID}")
message(STATUS "CMAKE_SYSTEM_INFO_FILE: ${CMAKE_SYSTEM_INFO_FILE}")
message(STATUS "CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}")
message(STATUS "CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}")
message(STATUS "CMAKE_SYSTEM: ${CMAKE_SYSTEM}")
message(STATUS "CMAKE_SYSTEM_VERSION: ${CMAKE_SYSTEM_VERSION}")
message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
message(STATUS "TARGET_ARCH: ${TARGET_ARCH}")
message(STATUS "CMAKE_CXX_COMPILER_ID: ${CMAKE_CXX_COMPILER_ID}")

include(tools/ParseOsRelease.cmake)

Expand All @@ -126,15 +127,15 @@ 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 -fno-finite-math-only")
Comment thread
bmehta001 marked this conversation as resolved.
set(REL_FLAGS "-s -Wl,--gc-sections -Os ${WARN_FLAGS} -ffunction-sections -fdata-sections -fmerge-all-constants")
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 -fno-finite-math-only")
set(REL_FLAGS "-Os ${WARN_FLAGS} -fmerge-all-constants")
else()
# Using clang - strip unsupported GCC options
set(REL_FLAGS "-Os ${WARN_FLAGS} -ffunction-sections -fmerge-all-constants -ffast-math -fno-finite-math-only")
set(REL_FLAGS "-Os ${WARN_FLAGS} -ffunction-sections -fmerge-all-constants")
Comment thread
bmehta001 marked this conversation as resolved.
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 @@ -147,15 +148,16 @@ set(DBG_FLAGS "-ggdb -gdwarf-2 -O0 ${WARN_FLAGS} -fno-builtin-malloc -fno-built

if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
#TODO: -fno-rtti
message("Building Release ...")
message(STATUS "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}")
# C++ standard is set via CMAKE_CXX_STANDARD above; do not override here.
set(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} ${CMAKE_CXX_FLAGS} ${REL_FLAGS}")
else()
set(USE_TCMALLOC 1)
message("Building Debug ...")
message(STATUS "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} ${DBG_FLAGS}")
endif()

#Remove /Zi for Win32 debug compiler issue
Expand Down Expand Up @@ -193,7 +195,7 @@ endif()

set(PAL_IMPLEMENTATION ${DEFAULT_PAL_IMPLEMENTATION})

message(STATUS "-- PAL implementation: ${PAL_IMPLEMENTATION}")
message(STATUS "PAL implementation: ${PAL_IMPLEMENTATION}")
string(TOUPPER ${PAL_IMPLEMENTATION} PAL_IMPLEMENTATION_UPPER)
add_definitions(-DMATSDK_PAL_${PAL_IMPLEMENTATION_UPPER}=1)

Expand Down Expand Up @@ -225,7 +227,7 @@ add_definitions(-DNOMINMAX)
set(SDK_VERSION_PREFIX "EVT")
add_definitions("-DMATSDK_VERSION_PREFIX=\"${SDK_VERSION_PREFIX}\"")

set(MATSDK_API_VERSION "3.4")
set(MATSDK_API_VERSION "3.10")
string(TIMESTAMP DAYNUMBER "%j")
Comment thread
bmehta001 marked this conversation as resolved.
string(REGEX REPLACE "^00" "" DAYNUMBER ${DAYNUMBER})
string(REGEX REPLACE "^0" "" DAYNUMBER ${DAYNUMBER})
Expand All @@ -241,7 +243,7 @@ else()
set(MATSDK_BUILD_VERSION ${MATSDK_API_VERSION}.${DAYNUMBER}.0)
endif()

message(STATUS "-- SDK version: ${SDK_VERSION_PREFIX}-${MATSDK_BUILD_VERSION}")
message(STATUS "SDK version: ${SDK_VERSION_PREFIX}-${MATSDK_BUILD_VERSION}")

################################################################################################
# HTTP stack section
Expand Down Expand Up @@ -289,9 +291,9 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
endif()

if(BUILD_UNIT_TESTS OR BUILD_FUNC_TESTS)
message("Adding gtest")
message(STATUS "Adding gtest")
add_library(gtest STATIC IMPORTED GLOBAL)
message("Adding gmock")
message(STATUS "Adding gmock")
add_library(gmock STATIC IMPORTED GLOBAL)
endif()

Expand Down Expand Up @@ -323,7 +325,7 @@ if(BUILD_LIBRARY)
endif()

if(BUILD_UNIT_TESTS OR BUILD_FUNC_TESTS)
message("Building tests")
message(STATUS "Building tests")
enable_testing()
add_subdirectory(tests)
endif()
Expand Down
10 changes: 5 additions & 5 deletions Solutions/before.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
<CustomIncludePath>$(SolutionDir)\..\third_party\krabsetw\krabs;$(CustomIncludePath)</CustomIncludePath>
</PropertyGroup>
<PropertyGroup Label="Globals">
<PlatformToolset Condition="'$(PlatformToolset)' == '' AND '$(VisualStudioVersion)' == '15.0'">v141</PlatformToolset>
<PlatformToolset Condition="'$(PlatformToolset)' == '' AND '$(VisualStudioVersion)' == '16.0'">v142</PlatformToolset>
<PlatformToolset Condition="'$(PlatformToolset)' == '' AND '$(VisualStudioVersion)' == '17.0'">v143</PlatformToolset>
<!-- Fallback to Visual Studio 2017 (v141) toolset by default -->
<!-- before.targets is imported before Microsoft.Cpp.Default.props, so DefaultPlatformToolset is not reliable here. -->
<!-- Map only known-shipped toolsets explicitly; let the bottom fallback handle unknown/future VS versions. -->
<PlatformToolset Condition="'$(PlatformToolset)' == '' AND $([MSBuild]::VersionGreaterThanOrEquals('$(VisualStudioVersion)', '17.0'))">v143</PlatformToolset>
<PlatformToolset Condition="'$(PlatformToolset)' == '' AND $([MSBuild]::VersionGreaterThanOrEquals('$(VisualStudioVersion)', '16.0'))">v142</PlatformToolset>
<PlatformToolset Condition="'$(PlatformToolset)' == '' AND $([MSBuild]::VersionGreaterThanOrEquals('$(VisualStudioVersion)', '15.0'))">v141</PlatformToolset>
<PlatformToolset Condition="'$(PlatformToolset)' == ''">v141</PlatformToolset>
Comment thread
bmehta001 marked this conversation as resolved.
<PlatformToolset Condition="'$(PlatformToolset)' != ''">$(PlatformToolset)</PlatformToolset>
<!-- Customers may override WindowsTargetPlatformVersion before auto-detection of latest Win 10 SDK -->
<LatestTargetPlatformVersion>$([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0'))</LatestTargetPlatformVersion>
<WindowsTargetPlatformVersion Condition="'$(WindowsTargetPlatformVersion)' == ''">$(LatestTargetPlatformVersion)</WindowsTargetPlatformVersion>
Expand Down
44 changes: 24 additions & 20 deletions Solutions/build.MIP.props
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>%(PreprocessorDefinitions);CONFIG_CUSTOM_H="config-MIP.h";MATSDK_SHARED_LIB=1;</PreprocessorDefinitions>
</ClCompile>
<Link>
<DelayLoadDLLs Condition="'$(Configuration)'=='Debug'">ucrtbased.dll; %(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
</ItemDefinitionGroup>
<PropertyGroup>
<DisableWinRT>true</DisableWinRT>
<PlatformToolset>v141</PlatformToolset>
<VCToolsVersion>14.1</VCToolsVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(RootNamespace)'=='ClientTelemetry'">
<TargetName>mip_ClientTelemetry</TargetName>
</PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)build.spectr.props" />
</Project>
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>%(PreprocessorDefinitions);CONFIG_CUSTOM_H="config-MIP.h";MATSDK_SHARED_LIB=1;</PreprocessorDefinitions>
</ClCompile>
<Link>
<DelayLoadDLLs Condition="'$(Configuration)'=='Debug'">ucrtbased.dll; %(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
</ItemDefinitionGroup>
<PropertyGroup>
<DisableWinRT>true</DisableWinRT>
<PlatformToolset Condition="'$(PlatformToolset)' == '' AND '$(DefaultPlatformToolset)' != ''">$(DefaultPlatformToolset)</PlatformToolset>
<!-- Map only known-shipped toolsets explicitly; unknown/future VS versions fall through to v141 below. -->
<PlatformToolset Condition="'$(PlatformToolset)' == '' AND $([MSBuild]::VersionGreaterThanOrEquals('$(VisualStudioVersion)', '17.0'))">v143</PlatformToolset>
<PlatformToolset Condition="'$(PlatformToolset)' == '' AND $([MSBuild]::VersionGreaterThanOrEquals('$(VisualStudioVersion)', '16.0'))">v142</PlatformToolset>
<PlatformToolset Condition="'$(PlatformToolset)' == '' AND $([MSBuild]::VersionGreaterThanOrEquals('$(VisualStudioVersion)', '15.0'))">v141</PlatformToolset>
<PlatformToolset Condition="'$(PlatformToolset)' == ''">v141</PlatformToolset>
Comment thread
bmehta001 marked this conversation as resolved.
</PropertyGroup>
<PropertyGroup Condition="'$(RootNamespace)'=='ClientTelemetry'">
<TargetName>mip_ClientTelemetry</TargetName>
</PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)build.spectr.props" />
</Project>
1 change: 0 additions & 1 deletion examples/cpp/SampleCpp/SampleCpp.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1080,7 +1080,6 @@
<ClInclude Include="DefaultApiKey.h" />
<ClInclude Include="LogManagerA.hpp" />
<ClInclude Include="LogManagerB.hpp" />
<ClInclude Include="targetver.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="DebugCallback.cpp" />
Expand Down
3 changes: 0 additions & 3 deletions examples/cpp/SampleCpp/SampleCpp.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="targetver.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="LogManagerA.hpp">
<Filter>Source Files</Filter>
</ClInclude>
Expand Down
1 change: 0 additions & 1 deletion examples/cpp/SampleCppMini/SampleCppMini.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1542,7 +1542,6 @@
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="targetver.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="demo.c" />
Expand Down
5 changes: 0 additions & 5 deletions examples/cpp/SampleCppMini/SampleCppMini.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="targetver.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp">
<Filter>Source Files</Filter>
Expand Down
Loading
Loading