From 13c6414df5e81292f3c6c68040cf56a1933abe0c Mon Sep 17 00:00:00 2001 From: Bhagirath Mehta Date: Wed, 29 Apr 2026 13:59:43 -0700 Subject: [PATCH 01/20] Apply CMake best practices and remove stale references - Modernize CMakeLists.txt: flatten nesting, deduplicate, use consistent quoting and variable patterns - Remove stale header references from vcxproj and vcxitems files - Simplify test CMakeLists.txt files - Fix CMake conventions in packaging scripts Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- CMakeLists.txt | 66 +++++++------------ Solutions/before.targets | 5 +- Solutions/build.MIP.props | 3 +- examples/cpp/SampleCpp/SampleCpp.vcxproj | 1 - .../cpp/SampleCpp/SampleCpp.vcxproj.filters | 3 - .../cpp/SampleCppMini/SampleCppMini.vcxproj | 1 - .../SampleCppMini.vcxproj.filters | 5 -- lib/CMakeLists.txt | 44 ++++++------- lib/shared/Shared.vcxitems | 1 - lib/shared/Shared.vcxitems.filters | 1 - tests/functests/CMakeLists.txt | 40 +++++------ tests/functests/FuncTests.vcxproj | 1 - tests/functests/FuncTests.vcxproj.filters | 3 - tests/unittests/CMakeLists.txt | 33 +++++----- tests/unittests/UnitTests.vcxproj | 1 - tools/MakeDeb.cmake | 2 +- tools/MakeRpm.cmake | 2 +- tools/MakeTgz.cmake | 3 +- tools/ParseOsRelease.cmake | 4 +- 19 files changed, 85 insertions(+), 134 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9851cf4d9..e7306afe8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) @@ -25,7 +25,7 @@ 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 @@ -77,9 +77,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") @@ -99,18 +99,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) @@ -147,12 +147,12 @@ 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}") 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}") @@ -167,17 +167,10 @@ if(MSVC) endif() endif() -if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - # using Clang -elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - # using GCC - # Prefer to generate position-independent code +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + # GCC needs explicit position-independent code set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") -elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") - # using Intel C++ -elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") - # using Visual Studio C++ endif() include(tools/Utils.cmake) @@ -193,7 +186,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) @@ -225,7 +218,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") string(REGEX REPLACE "^00" "" DAYNUMBER ${DAYNUMBER}) string(REGEX REPLACE "^0" "" DAYNUMBER ${DAYNUMBER}) @@ -241,7 +234,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 @@ -289,9 +282,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() @@ -299,17 +292,10 @@ if(BUILD_APPLE_HTTP) add_definitions(-DAPPLE_HTTP=1) endif() -# Bond Lite subdirectories include_directories(bondlite/include) include_directories(lib/pal) -#if(BUILD_UNIT_TESTS) -# message("Adding bondlite tests") -# enable_testing() -# add_subdirectory(bondlite/tests) -#endif() - # Include repo root to allow includes of sqlite, zlib, and nlohmann include_directories(${CMAKE_SOURCE_DIR}) @@ -323,7 +309,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() @@ -334,18 +320,14 @@ endif() if (BUILD_PACKAGE) 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") - # 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") - # 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) endif() endif() diff --git a/Solutions/before.targets b/Solutions/before.targets index 63a526c90..a31ed4e93 100644 --- a/Solutions/before.targets +++ b/Solutions/before.targets @@ -6,8 +6,9 @@ v141 v142 v143 - - v141 + v145 + + $(DefaultPlatformToolset) $(PlatformToolset) $([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0')) diff --git a/Solutions/build.MIP.props b/Solutions/build.MIP.props index 9bd6e6d91..14ed449b9 100644 --- a/Solutions/build.MIP.props +++ b/Solutions/build.MIP.props @@ -10,8 +10,7 @@ true - v141 - 14.1 + $(DefaultPlatformToolset) mip_ClientTelemetry diff --git a/examples/cpp/SampleCpp/SampleCpp.vcxproj b/examples/cpp/SampleCpp/SampleCpp.vcxproj index 9c539f10a..a8548808f 100644 --- a/examples/cpp/SampleCpp/SampleCpp.vcxproj +++ b/examples/cpp/SampleCpp/SampleCpp.vcxproj @@ -1080,7 +1080,6 @@ - diff --git a/examples/cpp/SampleCpp/SampleCpp.vcxproj.filters b/examples/cpp/SampleCpp/SampleCpp.vcxproj.filters index 9a605a027..ae87cc1f8 100644 --- a/examples/cpp/SampleCpp/SampleCpp.vcxproj.filters +++ b/examples/cpp/SampleCpp/SampleCpp.vcxproj.filters @@ -15,9 +15,6 @@ - - Header Files - Source Files diff --git a/examples/cpp/SampleCppMini/SampleCppMini.vcxproj b/examples/cpp/SampleCppMini/SampleCppMini.vcxproj index 88bca8d6d..424394f7e 100644 --- a/examples/cpp/SampleCppMini/SampleCppMini.vcxproj +++ b/examples/cpp/SampleCppMini/SampleCppMini.vcxproj @@ -1542,7 +1542,6 @@ - diff --git a/examples/cpp/SampleCppMini/SampleCppMini.vcxproj.filters b/examples/cpp/SampleCppMini/SampleCppMini.vcxproj.filters index ad3de7523..2df19ab39 100644 --- a/examples/cpp/SampleCppMini/SampleCppMini.vcxproj.filters +++ b/examples/cpp/SampleCppMini/SampleCppMini.vcxproj.filters @@ -14,11 +14,6 @@ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - Header Files - - Source Files diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 4ebe7ddb0..8824427b4 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -1,7 +1,7 @@ # Honor visibility properties for all target types cmake_policy(SET CMP0063 NEW) -include_directories( . ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/include/public ${CMAKE_CURRENT_SOURCE_DIR}/include/public ${CMAKE_CURRENT_SOURCE_DIR}/include/mat ${CMAKE_CURRENT_SOURCE_DIR}/pal ${CMAKE_CURRENT_SOURCE_DIR}/utils ${CMAKE_CURRENT_SOURCE_DIR}/modules/exp ${CMAKE_CURRENT_SOURCE_DIR}/modules/dataviewer ${CMAKE_CURRENT_SOURCE_DIR}/modules/privacyguard ${CMAKE_CURRENT_SOURCE_DIR}/modules/liveeventinspector ${CMAKE_CURRENT_SOURCE_DIR}/../third_party/Reachability ${CMAKE_CURRENT_SOURCE_DIR}/modules/cds ${CMAKE_CURRENT_SOURCE_DIR}/modules/signals ${CMAKE_CURRENT_SOURCE_DIR}/modules/sanitizer /usr/local/include ) +include_directories( . ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/include/public ${CMAKE_CURRENT_SOURCE_DIR}/include/mat ${CMAKE_CURRENT_SOURCE_DIR}/pal ${CMAKE_CURRENT_SOURCE_DIR}/utils ${CMAKE_CURRENT_SOURCE_DIR}/modules/exp ${CMAKE_CURRENT_SOURCE_DIR}/modules/dataviewer ${CMAKE_CURRENT_SOURCE_DIR}/modules/privacyguard ${CMAKE_CURRENT_SOURCE_DIR}/modules/liveeventinspector ${CMAKE_CURRENT_SOURCE_DIR}/../third_party/Reachability ${CMAKE_CURRENT_SOURCE_DIR}/modules/cds ${CMAKE_CURRENT_SOURCE_DIR}/modules/signals ${CMAKE_CURRENT_SOURCE_DIR}/modules/sanitizer /usr/local/include ) set(SRCS decorators/BaseDecorator.cpp packager/BondSplicer.cpp @@ -60,7 +60,7 @@ if(BUILD_AZMON) include(modules/azmon/CMakeLists.txt OPTIONAL) endif() -if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/modules/exp/) +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/exp/") list(APPEND SRCS modules/exp/afd/afdclient/AFDClientUtils.cpp modules/exp/afd/afdclient/AFDClient.cpp @@ -74,14 +74,14 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/modules/exp/) ) endif() -if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/modules/dataviewer/) +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/dataviewer/") list(APPEND SRCS modules/dataviewer/DefaultDataViewer.cpp modules/dataviewer/OnDisableNotificationCollection.cpp ) endif() -if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/modules/privacyguard/ AND BUILD_PRIVACYGUARD) +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/privacyguard/" AND BUILD_PRIVACYGUARD) list(APPEND SRCS modules/privacyguard/PrivacyGuard.cpp modules/privacyguard/RegisteredFileTypes.cpp @@ -89,14 +89,14 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/modules/privacyguard/ AND BUILD_PRIVACYGUA ) endif() -if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/modules/liveeventinspector/ AND BUILD_LIVEEVENTINSPECTOR) +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/liveeventinspector/" AND BUILD_LIVEEVENTINSPECTOR) list(APPEND SRCS modules/liveeventinspector/LiveEventInspector.cpp modules/liveeventinspector/LiveEventInspector.hpp ) endif() -if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/modules/cds/ AND BUILD_CDS) +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/cds/" AND BUILD_CDS) add_definitions(-DHAVE_MAT_CDS) list(APPEND SRCS modules/cds/CdsFactory.hpp @@ -104,14 +104,14 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/modules/cds/ AND BUILD_CDS) ) endif() -if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/modules/signals/ AND BUILD_SIGNALS) +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/signals/" AND BUILD_SIGNALS) list(APPEND SRCS modules/signals/Signals.cpp modules/signals/SignalsEncoder.cpp ) endif() -if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/modules/sanitizer/ AND BUILD_SANITIZER) +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/sanitizer/" AND BUILD_SANITIZER) list(APPEND SRCS modules/sanitizer/detectors/EmailAddressDetector.cpp modules/sanitizer/detectors/JwtDetector.cpp @@ -181,7 +181,7 @@ if(PAL_IMPLEMENTATION STREQUAL "CPP11") ) endif() if(APPLE AND BUILD_OBJC_WRAPPER) - message("Include ObjC Wrappers") + message(STATUS "Include ObjC Wrappers") list(APPEND SRCS ../wrappers/obj-c/ODWLogger.mm ../wrappers/obj-c/ODWLogManager.mm @@ -189,19 +189,19 @@ if(PAL_IMPLEMENTATION STREQUAL "CPP11") ../wrappers/obj-c/ODWLogConfiguration.mm ../wrappers/obj-c/ODWSemanticContext.mm ) - if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/modules/dataviewer/) + if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/dataviewer/") list(APPEND SRCS ../wrappers/obj-c/ODWDiagnosticDataViewer.mm ) endif() - if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/modules/privacyguard/ AND BUILD_PRIVACYGUARD) + if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/privacyguard/" AND BUILD_PRIVACYGUARD) list(APPEND SRCS ../wrappers/obj-c/ODWCommonDataContext.mm ../wrappers/obj-c/ODWPrivacyGuard.mm ../wrappers/obj-c/ODWPrivacyGuardInitConfig.mm ) endif() - if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/modules/sanitizer/ AND BUILD_SANITIZER) + if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/sanitizer/" AND BUILD_SANITIZER) list(APPEND SRCS ../wrappers/obj-c/ODWSanitizerInitConfig.mm ../wrappers/obj-c/ODWSanitizer.mm @@ -210,7 +210,7 @@ if(PAL_IMPLEMENTATION STREQUAL "CPP11") endif() if(APPLE AND BUILD_SWIFT_WRAPPER) - message("Building Swift Wrappers") + message(STATUS "Building Swift Wrappers") # Run swift build for the Swift Wrappers Package string(TOLOWER ${CMAKE_BUILD_TYPE} LOWER_BUILD_TYPE) execute_process( @@ -222,9 +222,9 @@ if(PAL_IMPLEMENTATION STREQUAL "CPP11") ) if(SWIFT_BUILD_RESULT EQUAL 0) - message("Swift Wrappers build succeeded!") + message(STATUS "Swift Wrappers build succeeded!") else() - message(FATAL_ERROR, "Swift build failed with error code: ${SWIFT_BUILD_RESULT}") + message(FATAL_ERROR "Swift build failed with error code: ${SWIFT_BUILD_RESULT}") endif() endif() @@ -247,7 +247,7 @@ remove_definitions(-D_MBCS) ) # UTC module - if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/modules/utc) + if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/utc") list(APPEND SRCS modules/utc/desktop/UtcHelpers.cpp modules/utc/UtcTelemetrySystem.cpp @@ -259,7 +259,7 @@ else() endif() # Filtering module -if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/modules/filter) +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/filter") list(APPEND SRCS modules/filter/CompliantByDefaultEventFilterModule.cpp modules/filter/CompliantByDefaultFilterApi.cpp @@ -278,7 +278,7 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Linux") endif() if(BUILD_SHARED_LIBS STREQUAL "ON") - message("-- Building shared SDK library") + message(STATUS "Building shared SDK library") # include(FindCURL) # find_package(CURL REQUIRED) @@ -313,7 +313,7 @@ if(BUILD_SHARED_LIBS STREQUAL "ON") # target_link_libraries(mat PUBLIC libsqlite3 libcurl.a libz.a libssl.a libcrypto.a "${SQLITE_LIBRARY}" "${CMAKE_THREAD_LIBS_INIT}" "${CMAKE_DL_LIBS}" ) install(TARGETS mat EXPORT mat LIBRARY DESTINATION ${INSTALL_LIB_DIR}) else() - message("-- Building static SDK library") + message(STATUS "Building static SDK library") add_library(mat STATIC ${SRCS}) if(LINK_STATIC_DEPENDS) if(PAL_IMPLEMENTATION STREQUAL "WIN32") @@ -336,10 +336,6 @@ else() install(TARGETS mat EXPORT mat ARCHIVE DESTINATION ${INSTALL_LIB_DIR}) endif() -message("-- Library will be installed to ${INSTALL_LIB_DIR}") +message(STATUS "Library will be installed to ${INSTALL_LIB_DIR}") -#if(PAL_IMPLEMENTATION STREQUAL "CPP11") -# #target_link_libraries(mat PUBLIC libcurl.a libz.a libssl.a libcrypto.a "${SQLITE_LIBRARY}" "${CMAKE_THREAD_LIBS_INIT}" "${CMAKE_DL_LIBS}" ) -# #target_link_libraries(mat PUBLIC libsqlite3.a libz.a ${LIBS} "${CMAKE_THREAD_LIBS_INIT}" "${CMAKE_DL_LIBS}" ) -#endif() diff --git a/lib/shared/Shared.vcxitems b/lib/shared/Shared.vcxitems index bf3d5df64..4b7c095ff 100644 --- a/lib/shared/Shared.vcxitems +++ b/lib/shared/Shared.vcxitems @@ -24,7 +24,6 @@ - diff --git a/lib/shared/Shared.vcxitems.filters b/lib/shared/Shared.vcxitems.filters index c488b869b..1868316bf 100644 --- a/lib/shared/Shared.vcxitems.filters +++ b/lib/shared/Shared.vcxitems.filters @@ -1,7 +1,6 @@  - diff --git a/tests/functests/CMakeLists.txt b/tests/functests/CMakeLists.txt index 656f8f866..afffaf283 100644 --- a/tests/functests/CMakeLists.txt +++ b/tests/functests/CMakeLists.txt @@ -1,4 +1,4 @@ -message("--- functests") +message(STATUS "Building functests") set(SRCS APITest.cpp @@ -8,47 +8,40 @@ set(SRCS MultipleLogManagersTests.cpp ) -if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/modules/privacyguard/ AND BUILD_PRIVACYGUARD) +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/privacyguard/" AND BUILD_PRIVACYGUARD) add_definitions(-DHAVE_MAT_PRIVACYGUARD) list(APPEND SRCS PrivacyGuardFuncTests.cpp ) endif() -if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/modules/sanitizer/ AND BUILD_SANITIZER) +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/sanitizer/" AND BUILD_SANITIZER) list(APPEND SRCS SanitizerFuncTests.cpp ) endif() -if(EXISTS ${CMAKE_SOURCE_DIR}/lib/modules/dataviewer/) +if(EXISTS "${CMAKE_SOURCE_DIR}/lib/modules/dataviewer/") list(APPEND SRCS ${CMAKE_SOURCE_DIR}/lib/modules/dataviewer/tests/functests/DefaultDataViewerFuncTests.cpp ) endif() -if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/modules/liveeventinspector/ AND BUILD_LIVEEVENTINSPECTOR) +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/liveeventinspector/" AND BUILD_LIVEEVENTINSPECTOR) add_definitions(-DHAVE_MAT_LIVEEVENTINSPECTOR) list(APPEND SRCS LiveEventInspectorFuncTests.cpp ) endif() -if (EXISTS ${CMAKE_SOURCE_DIR}/lib/modules/exp/tests) +if (EXISTS "${CMAKE_SOURCE_DIR}/lib/modules/exp/tests") list(APPEND SRCS ${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/functests/ECSClientFuncTests.cpp ${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/functests/ECSClientRealworldFuncTests.cpp ${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/functests/ECSConfigCacheFuncTests.cpp ) - if (EXISTS ${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/functests/test.json) - if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.21") - # Use file(COPY_FILE ...) for CMake 3.21 and later - file(COPY_FILE ${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/functests/test.json ${CMAKE_BINARY_DIR}/test.json) - else() - # Use file(COPY ...) as an alternative for older versions - file(COPY ${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/functests/test.json - DESTINATION ${CMAKE_BINARY_DIR}) - endif() + if (EXISTS "${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/functests/test.json") + configure_file(${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/functests/test.json ${CMAKE_BINARY_DIR}/test.json COPYONLY) endif() endif() @@ -63,11 +56,11 @@ endif() if(PAL_IMPLEMENTATION STREQUAL "WIN32") # Link against prebuilt libraries on Windows - message("--- WIN32: Linking against prebuilt libraries") - message("--- WIN32: ... ${CMAKE_BINARY_DIR}/gtest") - message("--- WIN32: ... ${CMAKE_BINARY_DIR}/gmock") - message("--- WIN32: ... ${CMAKE_BINARY_DIR}/zlib") - message("--- WIN32: ... ${CMAKE_BINARY_DIR}/sqlite") + message(STATUS "WIN32: Linking against prebuilt libraries") + message(STATUS "WIN32: ... ${CMAKE_BINARY_DIR}/gtest") + message(STATUS "WIN32: ... ${CMAKE_BINARY_DIR}/gmock") + message(STATUS "WIN32: ... ${CMAKE_BINARY_DIR}/zlib") + message(STATUS "WIN32: ... ${CMAKE_BINARY_DIR}/sqlite") # link_directories(${CMAKE_BINARY_DIR}/gtest/ ${CMAKE_BINARY_DIR}/gmock/ ${CMAKE_BINARY_DIR}/zlib/ ${CMAKE_BINARY_DIR}/sqlite/) include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/../../zlib ) target_link_libraries(FuncTests @@ -109,10 +102,9 @@ else() set (PLATFORM_LIBS "atomic") endif() - # Find libraries - message("--- Linking libraries! ") - message("Current Dir: ${CMAKE_CURRENT_SOURCE_DIR}") - message("Binary Dir: ${CMAKE_BINARY_DIR}") + message(STATUS "Linking libraries") + message(STATUS "Current Dir: ${CMAKE_CURRENT_SOURCE_DIR}") + message(STATUS "Binary Dir: ${CMAKE_BINARY_DIR}") set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER) diff --git a/tests/functests/FuncTests.vcxproj b/tests/functests/FuncTests.vcxproj index b01ff58e9..f5977c7c7 100644 --- a/tests/functests/FuncTests.vcxproj +++ b/tests/functests/FuncTests.vcxproj @@ -436,7 +436,6 @@ - diff --git a/tests/functests/FuncTests.vcxproj.filters b/tests/functests/FuncTests.vcxproj.filters index 50dd37f27..7e35d8020 100644 --- a/tests/functests/FuncTests.vcxproj.filters +++ b/tests/functests/FuncTests.vcxproj.filters @@ -53,9 +53,6 @@ mocks - - mocks - mocks diff --git a/tests/unittests/CMakeLists.txt b/tests/unittests/CMakeLists.txt index e453df619..388b7024f 100644 --- a/tests/unittests/CMakeLists.txt +++ b/tests/unittests/CMakeLists.txt @@ -1,4 +1,4 @@ -message("--- unittests") +message(STATUS "Building unittests") set(SRCS AIJsonSerializerTests.cpp @@ -54,7 +54,7 @@ set_source_files_properties(${SRCS} PROPERTIES COMPILE_FLAGS -Wno-deprecated-dec # Enable Azure Monitor unit tests when the module is present. # The AIJsonSerializer test sources are guarded by HAVE_MAT_AI. -if (EXISTS ${CMAKE_SOURCE_DIR}/lib/modules/azmon/AIJsonSerializer.hpp) +if (EXISTS "${CMAKE_SOURCE_DIR}/lib/modules/azmon/AIJsonSerializer.hpp") add_definitions(-DHAVE_MAT_AI) endif() @@ -66,7 +66,7 @@ if (APPLE) endif() endif() -if (EXISTS ${CMAKE_SOURCE_DIR}/lib/modules/exp/tests) +if (EXISTS "${CMAKE_SOURCE_DIR}/lib/modules/exp/tests") list(APPEND SRCS ${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/unittests/ECSConfigCacheTests.cpp ${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/unittests/ECSClientUtilsTests.cpp @@ -74,7 +74,7 @@ if (EXISTS ${CMAKE_SOURCE_DIR}/lib/modules/exp/tests) ) endif() -if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/modules/privacyguard/ AND BUILD_PRIVACYGUARD) +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/privacyguard/" AND BUILD_PRIVACYGUARD) add_definitions(-DHAVE_MAT_PRIVACYGUARD) list(APPEND SRCS ${CMAKE_SOURCE_DIR}/lib/modules/privacyguard/tests/unittests/InitializationConfigurationTests.cpp @@ -85,7 +85,7 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/modules/privacyguard/ AND BUILD_PRIVACYGUA ) endif() -if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/modules/sanitizer/ AND BUILD_SANITIZER) +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/sanitizer/" AND BUILD_SANITIZER) list(APPEND SRCS ${CMAKE_SOURCE_DIR}/lib/modules/sanitizer/tests/unittests/SanitizerJwtTests.cpp ${CMAKE_SOURCE_DIR}/lib/modules/sanitizer/tests/unittests/SanitizerProviderTests.cpp @@ -97,7 +97,7 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/modules/sanitizer/ AND BUILD_SANITIZER) ) endif() -if(EXISTS ${CMAKE_SOURCE_DIR}/lib/modules/dataviewer/) +if(EXISTS "${CMAKE_SOURCE_DIR}/lib/modules/dataviewer/") list(APPEND SRCS ${CMAKE_SOURCE_DIR}/lib/modules/dataviewer/tests/unittests/DefaultDataViewerTests.cpp DataViewerCollectionTests.cpp @@ -115,11 +115,11 @@ endif() if(PAL_IMPLEMENTATION STREQUAL "WIN32") # Link against prebuilt libraries on Windows - message("--- WIN32: Linking against prebuilt libraries") - message("--- WIN32: ... ${CMAKE_BINARY_DIR}/gtest") - message("--- WIN32: ... ${CMAKE_BINARY_DIR}/gmock") - message("--- WIN32: ... ${CMAKE_BINARY_DIR}/zlib") - message("--- WIN32: ... ${CMAKE_BINARY_DIR}/sqlite") + message(STATUS "WIN32: Linking against prebuilt libraries") + message(STATUS "WIN32: ... ${CMAKE_BINARY_DIR}/gtest") + message(STATUS "WIN32: ... ${CMAKE_BINARY_DIR}/gmock") + message(STATUS "WIN32: ... ${CMAKE_BINARY_DIR}/zlib") + message(STATUS "WIN32: ... ${CMAKE_BINARY_DIR}/sqlite") # link_directories(${CMAKE_BINARY_DIR}/gtest/ ${CMAKE_BINARY_DIR}/gmock/ ${CMAKE_BINARY_DIR}/zlib/ ${CMAKE_BINARY_DIR}/sqlite/) include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/../../zlib ) target_link_libraries(UnitTests @@ -162,10 +162,9 @@ else() set (PLATFORM_LIBS "atomic") endif() - # Find libraries - message("--- Linking libraries! ") - message("Current Dir: ${CMAKE_CURRENT_SOURCE_DIR}") - message("Binary Dir: ${CMAKE_BINARY_DIR}") + message(STATUS "Linking libraries") + message(STATUS "Current Dir: ${CMAKE_CURRENT_SOURCE_DIR}") + message(STATUS "Binary Dir: ${CMAKE_BINARY_DIR}") include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/../../lib/ ) @@ -183,8 +182,8 @@ else() ${CMAKE_CURRENT_SOURCE_DIR}/../../third_party/googletest/build/lib/ ) - message("GTEST: ${LIBGTEST}") - message("GMOCK: ${LIBGMOCK}") + message(STATUS "GTEST: ${LIBGTEST}") + message(STATUS "GMOCK: ${LIBGMOCK}") target_link_libraries(UnitTests ${LIBGTEST} diff --git a/tests/unittests/UnitTests.vcxproj b/tests/unittests/UnitTests.vcxproj index ea5e080ee..a7412e484 100644 --- a/tests/unittests/UnitTests.vcxproj +++ b/tests/unittests/UnitTests.vcxproj @@ -495,7 +495,6 @@ - diff --git a/tools/MakeDeb.cmake b/tools/MakeDeb.cmake index efec5ad32..4f839ab5b 100644 --- a/tools/MakeDeb.cmake +++ b/tools/MakeDeb.cmake @@ -24,7 +24,7 @@ set(CPACK_PACKAGE_VERSION_PATCH "${PATCH_VERSION}") # FIXME: add architecture name in file name set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}-${CPACK_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}") -message("-- Package name: ${CPACK_PACKAGE_FILE_NAME}.deb") +message(STATUS "Package name: ${CPACK_PACKAGE_FILE_NAME}.deb") #install(TARGETS ${MAT_SDK_LIB_DIR}/libMAT.a ARCHIVE DESTINATION lib/MAT COMPONENT headers) #install(FILES ${MAT_SDK_INC_DIR}/*.* DESTINATION include/MAT COMPONENT libraries) diff --git a/tools/MakeRpm.cmake b/tools/MakeRpm.cmake index c4db45de0..121eba7b6 100644 --- a/tools/MakeRpm.cmake +++ b/tools/MakeRpm.cmake @@ -18,7 +18,7 @@ set(CPACK_PACKAGE_NAME "mat_sdk") set(CPACK_PACKAGE_RELEASE "0") set(CPACK_PACKAGE_VENDOR "Microsoft") set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_PACKAGE_RELEASE}.${CMAKE_SYSTEM_PROCESSOR}") -message("-- Package name: ${CPACK_RPM_PACKAGE_FILE_NAME}.rpm") +message(STATUS "Package name: ${CPACK_RPM_PACKAGE_FILE_NAME}.rpm") #configure_file("${CMAKE_CURRENT_SOURCE_DIR}/mat-sdk.spec.in" "${CMAKE_CURRENT_BINARY_DIR}/arka-sdk.spec" @ONLY IMMEDIATE) #set(CPACK_RPM_USER_BINARY_SPECFILE "${CMAKE_CURRENT_BINARY_DIR}/mat-sdk.spec") diff --git a/tools/MakeTgz.cmake b/tools/MakeTgz.cmake index bf159ab8d..44c308e32 100644 --- a/tools/MakeTgz.cmake +++ b/tools/MakeTgz.cmake @@ -24,8 +24,7 @@ file(GLOB ALL_TARGET_LIBS "${CMAKE_CURRENT_BINARY_DIR}/lib/libmat.*") install(FILES ${ALL_TARGET_LIBS} DESTINATION lib COMPONENT libraries) #install(FILES ${MAT_SDK_INC_DIR}/*.* DESTINATION include/mat COMPONENT libraries) -# FIXME: add architecture name in file name set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}-${CPACK_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}") -message("-- Package name: ${CPACK_PACKAGE_FILE_NAME}.tgz") +message(STATUS "Package name: ${CPACK_PACKAGE_FILE_NAME}.tgz") include(CPack) diff --git a/tools/ParseOsRelease.cmake b/tools/ParseOsRelease.cmake index 48bd0398a..fc3abe9af 100644 --- a/tools/ParseOsRelease.cmake +++ b/tools/ParseOsRelease.cmake @@ -1,6 +1,6 @@ # Parse /etc/os-release to determine Linux distro -if(EXISTS /etc/os-release) +if(EXISTS "/etc/os-release") file(STRINGS /etc/os-release OS_RELEASE) foreach(NameAndValue ${OS_RELEASE}) @@ -13,7 +13,7 @@ foreach(NameAndValue ${OS_RELEASE}) # Strip quotes from value string(REPLACE "\"" "" Value ${Value}) # Set the variable - message("-- /etc/os_release : ${Name}=${Value}") + message(STATUS "/etc/os_release : ${Name}=${Value}") set("OS_RELEASE_${Name}" "${Value}") endforeach() From 7d9bbde0eb7affc21b62c1e02eb536865abb6e1b Mon Sep 17 00:00:00 2001 From: Bhagirath Mehta Date: Thu, 30 Apr 2026 06:57:19 -0700 Subject: [PATCH 02/20] Fix #1416 review follow-ups Keep the before.targets toolset selection deterministic on newer Visual Studio hosts, but only set the MIP props fallback when a consumer has not already chosen a toolset. While addressing the MSBuild review comments, also point the optional module test conditions and source paths at the real lib/modules locations and use CPACK_PACKAGE_FILE_NAME for the RPM status message. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- Solutions/before.targets | 13 +++++----- Solutions/build.MIP.props | 43 +++++++++++++++++++--------------- tests/functests/CMakeLists.txt | 12 +++++----- tests/unittests/CMakeLists.txt | 4 ++-- tools/MakeRpm.cmake | 2 +- 5 files changed, 39 insertions(+), 35 deletions(-) diff --git a/Solutions/before.targets b/Solutions/before.targets index a31ed4e93..052e5d77f 100644 --- a/Solutions/before.targets +++ b/Solutions/before.targets @@ -3,13 +3,12 @@ $(SolutionDir)\..\third_party\krabsetw\krabs;$(CustomIncludePath) - v141 - v142 - v143 - v145 - - $(DefaultPlatformToolset) - $(PlatformToolset) + + v145 + v143 + v142 + v141 + v141 $([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0')) $(LatestTargetPlatformVersion) diff --git a/Solutions/build.MIP.props b/Solutions/build.MIP.props index 14ed449b9..2419c4c36 100644 --- a/Solutions/build.MIP.props +++ b/Solutions/build.MIP.props @@ -1,19 +1,24 @@ - - - - - %(PreprocessorDefinitions);CONFIG_CUSTOM_H="config-MIP.h";MATSDK_SHARED_LIB=1; - - - ucrtbased.dll; %(DelayLoadDLLs) - - - - true - $(DefaultPlatformToolset) - - - mip_ClientTelemetry - - - + + + + + %(PreprocessorDefinitions);CONFIG_CUSTOM_H="config-MIP.h";MATSDK_SHARED_LIB=1; + + + ucrtbased.dll; %(DelayLoadDLLs) + + + + true + $(DefaultPlatformToolset) + v145 + v143 + v142 + v141 + v141 + + + mip_ClientTelemetry + + + diff --git a/tests/functests/CMakeLists.txt b/tests/functests/CMakeLists.txt index afffaf283..cb295e5c8 100644 --- a/tests/functests/CMakeLists.txt +++ b/tests/functests/CMakeLists.txt @@ -8,16 +8,16 @@ set(SRCS MultipleLogManagersTests.cpp ) -if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/privacyguard/" AND BUILD_PRIVACYGUARD) +if(EXISTS "${CMAKE_SOURCE_DIR}/lib/modules/privacyguard/" AND BUILD_PRIVACYGUARD) add_definitions(-DHAVE_MAT_PRIVACYGUARD) list(APPEND SRCS - PrivacyGuardFuncTests.cpp + ${CMAKE_SOURCE_DIR}/lib/modules/privacyguard/tests/functests/PrivacyGuardFuncTests.cpp ) endif() -if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/sanitizer/" AND BUILD_SANITIZER) +if(EXISTS "${CMAKE_SOURCE_DIR}/lib/modules/sanitizer/" AND BUILD_SANITIZER) list(APPEND SRCS - SanitizerFuncTests.cpp + ${CMAKE_SOURCE_DIR}/lib/modules/sanitizer/tests/functests/SanitizerFuncTests.cpp ) endif() @@ -27,10 +27,10 @@ if(EXISTS "${CMAKE_SOURCE_DIR}/lib/modules/dataviewer/") ) endif() -if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/liveeventinspector/" AND BUILD_LIVEEVENTINSPECTOR) +if(EXISTS "${CMAKE_SOURCE_DIR}/lib/modules/liveeventinspector/" AND BUILD_LIVEEVENTINSPECTOR) add_definitions(-DHAVE_MAT_LIVEEVENTINSPECTOR) list(APPEND SRCS - LiveEventInspectorFuncTests.cpp + ${CMAKE_SOURCE_DIR}/lib/modules/liveeventinspector/tests/functests/LiveEventInspectorFuncTests.cpp ) endif() diff --git a/tests/unittests/CMakeLists.txt b/tests/unittests/CMakeLists.txt index 388b7024f..1b29db3bf 100644 --- a/tests/unittests/CMakeLists.txt +++ b/tests/unittests/CMakeLists.txt @@ -74,7 +74,7 @@ if (EXISTS "${CMAKE_SOURCE_DIR}/lib/modules/exp/tests") ) endif() -if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/privacyguard/" AND BUILD_PRIVACYGUARD) +if(EXISTS "${CMAKE_SOURCE_DIR}/lib/modules/privacyguard/" AND BUILD_PRIVACYGUARD) add_definitions(-DHAVE_MAT_PRIVACYGUARD) list(APPEND SRCS ${CMAKE_SOURCE_DIR}/lib/modules/privacyguard/tests/unittests/InitializationConfigurationTests.cpp @@ -85,7 +85,7 @@ if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/privacyguard/" AND BUILD_PRIVACYG ) endif() -if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/sanitizer/" AND BUILD_SANITIZER) +if(EXISTS "${CMAKE_SOURCE_DIR}/lib/modules/sanitizer/" AND BUILD_SANITIZER) list(APPEND SRCS ${CMAKE_SOURCE_DIR}/lib/modules/sanitizer/tests/unittests/SanitizerJwtTests.cpp ${CMAKE_SOURCE_DIR}/lib/modules/sanitizer/tests/unittests/SanitizerProviderTests.cpp diff --git a/tools/MakeRpm.cmake b/tools/MakeRpm.cmake index 121eba7b6..8d9cf0b67 100644 --- a/tools/MakeRpm.cmake +++ b/tools/MakeRpm.cmake @@ -18,7 +18,7 @@ set(CPACK_PACKAGE_NAME "mat_sdk") set(CPACK_PACKAGE_RELEASE "0") set(CPACK_PACKAGE_VENDOR "Microsoft") set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_PACKAGE_RELEASE}.${CMAKE_SYSTEM_PROCESSOR}") -message(STATUS "Package name: ${CPACK_RPM_PACKAGE_FILE_NAME}.rpm") +message(STATUS "Package name: ${CPACK_PACKAGE_FILE_NAME}.rpm") #configure_file("${CMAKE_CURRENT_SOURCE_DIR}/mat-sdk.spec.in" "${CMAKE_CURRENT_BINARY_DIR}/arka-sdk.spec" @ONLY IMMEDIATE) #set(CPACK_RPM_USER_BINARY_SPECFILE "${CMAKE_CURRENT_BINARY_DIR}/mat-sdk.spec") From 13f66c19fef6f7c5fd7f5292ccfbd6bd84bf07bd Mon Sep 17 00:00:00 2001 From: Bhagirath Mehta Date: Fri, 1 May 2026 15:23:36 -0500 Subject: [PATCH 03/20] Fix #1416 Apple runtime regressions Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- CMakeLists.txt | 8 ++++---- lib/api/Logger.cpp | 3 ++- lib/http/HttpClientManager.cpp | 10 ++++++++-- lib/http/HttpClient_Apple.mm | 24 ++++++------------------ lib/http/HttpResponseDecoder.cpp | 6 +++--- 5 files changed, 23 insertions(+), 28 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e7306afe8..cc99131af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,20 +121,20 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") set(WARN_FLAGS "-Wall -Werror -Wextra -Wno-unused-parameter -Wno-unused-but-set-variable") else() # Clang / AppleClang - set(WARN_FLAGS "-Wall -Werror -Wextra -Wno-unused-parameter -Wno-unknown-warning-option -Wno-unused-but-set-variable") + set(WARN_FLAGS "-Wall -Werror -Wextra -Wno-unused-parameter -Wno-unknown-warning-option -Wno-unused-but-set-variable -Wno-nan-infinity-disabled") 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") + set(REL_FLAGS "-s -Wl,--gc-sections -Os ${WARN_FLAGS} -ffunction-sections -fdata-sections -fmerge-all-constants -ffast-math") 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 -ffast-math") 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 -ffast-math") 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 diff --git a/lib/api/Logger.cpp b/lib/api/Logger.cpp index 54d883664..cbe503f8c 100644 --- a/lib/api/Logger.cpp +++ b/lib/api/Logger.cpp @@ -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 after logging teardown. } ISemanticContext* Logger::GetSemanticContext() const diff --git a/lib/http/HttpClientManager.cpp b/lib/http/HttpClientManager.cpp index 58fa5fb4a..eea19fd1b 100644 --- a/lib/http/HttpClientManager.cpp +++ b/lib/http/HttpClientManager.cpp @@ -149,11 +149,17 @@ namespace MAT_NS_BEGIN { void HttpClientManager::cancelAllRequests() { cancelAllRequestsAsync(); - while (!m_httpCallbacks.empty()) + while (true) + { + { + LOCKGUARD(m_httpCallbacksMtx); + if (m_httpCallbacks.empty()) + break; + } std::this_thread::yield(); + } } // start async cancellation } MAT_NS_END - diff --git a/lib/http/HttpClient_Apple.mm b/lib/http/HttpClient_Apple.mm index 05817087a..579b05313 100644 --- a/lib/http/HttpClient_Apple.mm +++ b/lib/http/HttpClient_Apple.mm @@ -132,23 +132,6 @@ void HandleResponse(NSData* data, NSURLResponse* response, NSError* error) void Cancel() { [m_dataTask cancel]; - [session getTasksWithCompletionHandler:^(NSArray* dataTasks, NSArray* uploadTasks, NSArray* downloadTasks) - { - for (NSURLSessionTask* _task in dataTasks) - { - [_task cancel]; - } - - for (NSURLSessionTask* _task in downloadTasks) - { - [_task cancel]; - } - - for (NSURLSessionTask* _task in uploadTasks) - { - [_task cancel]; - } - }]; } private: @@ -214,8 +197,13 @@ void Cancel() for (const auto &id : ids) CancelRequestAsync(id); - while (!m_requests.empty()) + while (true) { + { + std::lock_guard lock(m_requestsMtx); + if (m_requests.empty()) + break; + } PAL::sleep(100); std::this_thread::yield(); } diff --git a/lib/http/HttpResponseDecoder.cpp b/lib/http/HttpResponseDecoder.cpp index 11e9d4096..508e0e205 100644 --- a/lib/http/HttpResponseDecoder.cpp +++ b/lib/http/HttpResponseDecoder.cpp @@ -67,13 +67,11 @@ namespace MAT_NS_BEGIN { break; case HttpResult_Aborted: - ctx->httpResponse = nullptr; outcome = Abort; break; case HttpResult_LocalFailure: case HttpResult_NetworkFailure: - ctx->httpResponse = nullptr; outcome = RetryNetwork; break; } @@ -129,6 +127,7 @@ namespace MAT_NS_BEGIN { evt.param1 = 0; // response.GetStatusCode(); DispatchEvent(evt); } + delete ctx->httpResponse; ctx->httpResponse = nullptr; // eventsRejected(ctx); // FIXME: [MG] - investigate why ctx gets corrupt after eventsRejected requestAborted(ctx); @@ -159,6 +158,8 @@ namespace MAT_NS_BEGIN { evt.param1 = response.GetStatusCode(); DispatchEvent(evt); } + delete ctx->httpResponse; + ctx->httpResponse = nullptr; temporaryNetworkFailure(ctx); break; } @@ -253,4 +254,3 @@ namespace MAT_NS_BEGIN { } } MAT_NS_END - From b47f5c0e4519528ca389a7c91555f48174cb8e8e Mon Sep 17 00:00:00 2001 From: Bhagirath Mehta Date: Fri, 1 May 2026 17:09:41 -0500 Subject: [PATCH 04/20] Make CurlHttpOperation own CA path Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- lib/http/HttpClient_Curl.hpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/http/HttpClient_Curl.hpp b/lib/http/HttpClient_Curl.hpp index 972cc4fec..c7a5bdecb 100644 --- a/lib/http/HttpClient_Curl.hpp +++ b/lib/http/HttpClient_Curl.hpp @@ -109,6 +109,7 @@ class CurlHttpOperation { m_callback(callback), m_method(method), m_url(url), + m_sslCaInfo(sslCaInfo), // Local vars requestHeaders(requestHeaders), @@ -140,8 +141,8 @@ class CurlHttpOperation { curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, sslVerify ? 1L : 0L); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, sslVerify ? 2L : 0L); - if (!sslCaInfo.empty()) { - curl_easy_setopt(curl, CURLOPT_CAINFO, sslCaInfo.c_str()); + if (!m_sslCaInfo.empty()) { + curl_easy_setopt(curl, CURLOPT_CAINFO, m_sslCaInfo.c_str()); } // HTTP/2 please, fallback to HTTP/1.1 if not supported curl_easy_setopt(curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0); @@ -434,6 +435,7 @@ class CurlHttpOperation { // Request values std::string m_method; std::string m_url; + std::string m_sslCaInfo; const std::map& requestHeaders; const std::vector& requestBody; struct curl_slist *m_headersChunk = nullptr; @@ -534,4 +536,3 @@ class CurlHttpOperation { #endif // HAVE_MAT_DEFAULT_HTTP_CLIENT #endif // HTTPCLIENTCURL_HPP - From 028199c075f96e04e90f8c979a18329228934d3f Mon Sep 17 00:00:00 2001 From: Bhagirath Mehta Date: Fri, 1 May 2026 18:01:29 -0500 Subject: [PATCH 05/20] Restore nonfunctional CMake comments Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- CMakeLists.txt | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cc99131af..3117d4b29 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -120,7 +120,7 @@ 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") else() - # Clang / AppleClang + # 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 -Wno-nan-infinity-disabled") endif() @@ -167,10 +167,17 @@ if(MSVC) endif() endif() -if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - # GCC needs explicit position-independent code +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + # using Clang +elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + # using GCC + # Prefer to generate position-independent code set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") +elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") + # using Intel C++ +elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + # using Visual Studio C++ endif() include(tools/Utils.cmake) @@ -292,10 +299,17 @@ if(BUILD_APPLE_HTTP) add_definitions(-DAPPLE_HTTP=1) endif() +# Bond Lite subdirectories include_directories(bondlite/include) include_directories(lib/pal) +#if(BUILD_UNIT_TESTS) +# message("Adding bondlite tests") +# enable_testing() +# add_subdirectory(bondlite/tests) +#endif() + # Include repo root to allow includes of sqlite, zlib, and nlohmann include_directories(${CMAKE_SOURCE_DIR}) @@ -320,14 +334,18 @@ endif() if (BUILD_PACKAGE) 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") + # 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") + # 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) endif() endif() From 5c0ded8aa5a53f0e1ec752b3902e95987b61237a Mon Sep 17 00:00:00 2001 From: Bhagirath Mehta Date: Fri, 1 May 2026 18:41:17 -0500 Subject: [PATCH 06/20] Remove runtime overlap with #1429 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- lib/api/Logger.cpp | 3 +-- lib/http/HttpClientManager.cpp | 10 ++-------- lib/http/HttpClient_Apple.mm | 24 ++++++++++++++++++------ lib/http/HttpResponseDecoder.cpp | 6 +++--- 4 files changed, 24 insertions(+), 19 deletions(-) diff --git a/lib/api/Logger.cpp b/lib/api/Logger.cpp index cbe503f8c..54d883664 100644 --- a/lib/api/Logger.cpp +++ b/lib/api/Logger.cpp @@ -127,8 +127,7 @@ namespace MAT_NS_BEGIN Logger::~Logger() noexcept { - // Intentionally empty — logging here triggers a static-destruction-order - // crash on iOS simulator after logging teardown. + LOG_TRACE("%p: Destroyed", this); } ISemanticContext* Logger::GetSemanticContext() const diff --git a/lib/http/HttpClientManager.cpp b/lib/http/HttpClientManager.cpp index eea19fd1b..58fa5fb4a 100644 --- a/lib/http/HttpClientManager.cpp +++ b/lib/http/HttpClientManager.cpp @@ -149,17 +149,11 @@ namespace MAT_NS_BEGIN { void HttpClientManager::cancelAllRequests() { cancelAllRequestsAsync(); - while (true) - { - { - LOCKGUARD(m_httpCallbacksMtx); - if (m_httpCallbacks.empty()) - break; - } + while (!m_httpCallbacks.empty()) std::this_thread::yield(); - } } // start async cancellation } MAT_NS_END + diff --git a/lib/http/HttpClient_Apple.mm b/lib/http/HttpClient_Apple.mm index 579b05313..05817087a 100644 --- a/lib/http/HttpClient_Apple.mm +++ b/lib/http/HttpClient_Apple.mm @@ -132,6 +132,23 @@ void HandleResponse(NSData* data, NSURLResponse* response, NSError* error) void Cancel() { [m_dataTask cancel]; + [session getTasksWithCompletionHandler:^(NSArray* dataTasks, NSArray* uploadTasks, NSArray* downloadTasks) + { + for (NSURLSessionTask* _task in dataTasks) + { + [_task cancel]; + } + + for (NSURLSessionTask* _task in downloadTasks) + { + [_task cancel]; + } + + for (NSURLSessionTask* _task in uploadTasks) + { + [_task cancel]; + } + }]; } private: @@ -197,13 +214,8 @@ void Cancel() for (const auto &id : ids) CancelRequestAsync(id); - while (true) + while (!m_requests.empty()) { - { - std::lock_guard lock(m_requestsMtx); - if (m_requests.empty()) - break; - } PAL::sleep(100); std::this_thread::yield(); } diff --git a/lib/http/HttpResponseDecoder.cpp b/lib/http/HttpResponseDecoder.cpp index 508e0e205..11e9d4096 100644 --- a/lib/http/HttpResponseDecoder.cpp +++ b/lib/http/HttpResponseDecoder.cpp @@ -67,11 +67,13 @@ namespace MAT_NS_BEGIN { break; case HttpResult_Aborted: + ctx->httpResponse = nullptr; outcome = Abort; break; case HttpResult_LocalFailure: case HttpResult_NetworkFailure: + ctx->httpResponse = nullptr; outcome = RetryNetwork; break; } @@ -127,7 +129,6 @@ namespace MAT_NS_BEGIN { evt.param1 = 0; // response.GetStatusCode(); DispatchEvent(evt); } - delete ctx->httpResponse; ctx->httpResponse = nullptr; // eventsRejected(ctx); // FIXME: [MG] - investigate why ctx gets corrupt after eventsRejected requestAborted(ctx); @@ -158,8 +159,6 @@ namespace MAT_NS_BEGIN { evt.param1 = response.GetStatusCode(); DispatchEvent(evt); } - delete ctx->httpResponse; - ctx->httpResponse = nullptr; temporaryNetworkFailure(ctx); break; } @@ -254,3 +253,4 @@ namespace MAT_NS_BEGIN { } } MAT_NS_END + From a262717e65470fa982881555a952aa7911bea510 Mon Sep 17 00:00:00 2001 From: bmehta001 Date: Mon, 11 May 2026 12:34:45 -0500 Subject: [PATCH 07/20] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- tools/ParseOsRelease.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/ParseOsRelease.cmake b/tools/ParseOsRelease.cmake index fc3abe9af..61952f57f 100644 --- a/tools/ParseOsRelease.cmake +++ b/tools/ParseOsRelease.cmake @@ -13,7 +13,7 @@ foreach(NameAndValue ${OS_RELEASE}) # Strip quotes from value string(REPLACE "\"" "" Value ${Value}) # Set the variable - message(STATUS "/etc/os_release : ${Name}=${Value}") + message(STATUS "/etc/os-release : ${Name}=${Value}") set("OS_RELEASE_${Name}" "${Value}") endforeach() From 93502cc71c03e61e566e1c6211d0b947071229d0 Mon Sep 17 00:00:00 2001 From: Bhagirath Mehta Date: Mon, 11 May 2026 12:40:14 -0500 Subject: [PATCH 08/20] Quote functest configure_file paths Quote the optional ECS test.json configure_file input and output paths so CMake handles source or build directories that contain spaces. Files changed: - tests/functests/CMakeLists.txt Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- tests/functests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/functests/CMakeLists.txt b/tests/functests/CMakeLists.txt index cb295e5c8..0c2074e99 100644 --- a/tests/functests/CMakeLists.txt +++ b/tests/functests/CMakeLists.txt @@ -41,7 +41,7 @@ if (EXISTS "${CMAKE_SOURCE_DIR}/lib/modules/exp/tests") ${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/functests/ECSConfigCacheFuncTests.cpp ) if (EXISTS "${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/functests/test.json") - configure_file(${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/functests/test.json ${CMAKE_BINARY_DIR}/test.json COPYONLY) + configure_file("${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/functests/test.json" "${CMAKE_BINARY_DIR}/test.json" COPYONLY) endif() endif() From 704d29b5f5bdf82109545de13451daef803a24d6 Mon Sep 17 00:00:00 2001 From: Bhagirath Mehta Date: Thu, 14 May 2026 18:59:36 -0500 Subject: [PATCH 09/20] Drop -ffast-math from Unix REL_FLAGS PR #1416 inadvertently regressed PR #1415 by removing -fno-finite-math-only from the three Unix REL_FLAGS branches and adding -Wno-nan-infinity-disabled to silence the Clang diagnostic. That left release builds using -ffast-math without preserving the NaN/Inf semantics needed by nlohmann::json and SQLite paths. Remove -ffast-math entirely from the GCC, AppleClang, and generic Clang release flags rather than relying on -fno-finite-math-only to partially undo it. This SDK is not floating-point compute-bound; its hot paths are string, Bond/JSON serialization, HTTP I/O, and SQLite reads/writes. Avoiding -ffast-math: - preserves std::isnan/std::isinf behavior for JSON and storage code, - avoids compiler/runtime fast-math side effects such as x86 GCC's crtfastmath.o changing MXCSR FTZ/DAZ behavior process-wide, and - aligns with SQLite's guidance to avoid fast-math. This subsumes #1415's partial mitigation and aligns with #1392's intent, extended to GCC because GCC fast-math has the same broad assumptions and runtime side effects. Also remove -Wno-nan-infinity-disabled because the warning should not be suppressed once the cause is gone. Validation: - CMake Release build of UnitTests on macOS arm64 (AppleClang 21). - UnitTests passed on macOS arm64. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3117d4b29..51d09802a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,20 +121,20 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") set(WARN_FLAGS "-Wall -Werror -Wextra -Wno-unused-parameter -Wno-unused-but-set-variable") 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 -Wno-nan-infinity-disabled") + 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") # 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") 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") 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") 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 From 1cfe3260d65c7aa0ac43d811c3fc5adac30cf399 Mon Sep 17 00:00:00 2001 From: Bhagirath Mehta Date: Thu, 21 May 2026 19:52:23 -0500 Subject: [PATCH 10/20] Restore Clang warning comment clarity Avoid carrying a confusing note about warning flags that are not used, and keep CMakeLists.txt focused on active compiler settings. Files changed: - CMakeLists.txt Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 51d09802a..e9d1fdabe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -120,7 +120,7 @@ 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") else() - # No -pedantic -Wno-extra-semi -Wno-gnu-zero-variadic-macro-arguments + # Clang / AppleClang set(WARN_FLAGS "-Wall -Werror -Wextra -Wno-unused-parameter -Wno-unknown-warning-option -Wno-unused-but-set-variable") endif() From 1de44ae2334af354003d7c61f3c631e38fa5c4ea Mon Sep 17 00:00:00 2001 From: Copilot <223556219+Copilot@users.noreply.github.com> Date: Thu, 28 May 2026 12:34:51 -0500 Subject: [PATCH 11/20] tests(cmake): quote module source paths in list(APPEND SRCS) blocks Copilot review on PR #1416 flagged 7 unquoted ${CMAKE_SOURCE_DIR}/... paths inside list(APPEND SRCS ...) calls. CMake splits unquoted arguments on whitespace, so a checkout path containing spaces (very common on Windows: C:\Users\First Last\source\...) would fragment a single source path into multiple list elements and the test wouldn't compile. Quote every ${CMAKE_SOURCE_DIR}/.../*.cpp path inside list(APPEND SRCS ...) in both tests/unittests/CMakeLists.txt and tests/functests/CMakeLists.txt (23 paths total, including the privacyguard + sanitizer blocks Copilot didn't cite but that share the same hazard). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- tests/functests/CMakeLists.txt | 14 +++++++------- tests/unittests/CMakeLists.txt | 32 ++++++++++++++++---------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/tests/functests/CMakeLists.txt b/tests/functests/CMakeLists.txt index 0c2074e99..29198bb96 100644 --- a/tests/functests/CMakeLists.txt +++ b/tests/functests/CMakeLists.txt @@ -11,34 +11,34 @@ set(SRCS if(EXISTS "${CMAKE_SOURCE_DIR}/lib/modules/privacyguard/" AND BUILD_PRIVACYGUARD) add_definitions(-DHAVE_MAT_PRIVACYGUARD) list(APPEND SRCS - ${CMAKE_SOURCE_DIR}/lib/modules/privacyguard/tests/functests/PrivacyGuardFuncTests.cpp + "${CMAKE_SOURCE_DIR}/lib/modules/privacyguard/tests/functests/PrivacyGuardFuncTests.cpp" ) endif() if(EXISTS "${CMAKE_SOURCE_DIR}/lib/modules/sanitizer/" AND BUILD_SANITIZER) list(APPEND SRCS - ${CMAKE_SOURCE_DIR}/lib/modules/sanitizer/tests/functests/SanitizerFuncTests.cpp + "${CMAKE_SOURCE_DIR}/lib/modules/sanitizer/tests/functests/SanitizerFuncTests.cpp" ) endif() if(EXISTS "${CMAKE_SOURCE_DIR}/lib/modules/dataviewer/") list(APPEND SRCS - ${CMAKE_SOURCE_DIR}/lib/modules/dataviewer/tests/functests/DefaultDataViewerFuncTests.cpp + "${CMAKE_SOURCE_DIR}/lib/modules/dataviewer/tests/functests/DefaultDataViewerFuncTests.cpp" ) endif() if(EXISTS "${CMAKE_SOURCE_DIR}/lib/modules/liveeventinspector/" AND BUILD_LIVEEVENTINSPECTOR) add_definitions(-DHAVE_MAT_LIVEEVENTINSPECTOR) list(APPEND SRCS - ${CMAKE_SOURCE_DIR}/lib/modules/liveeventinspector/tests/functests/LiveEventInspectorFuncTests.cpp + "${CMAKE_SOURCE_DIR}/lib/modules/liveeventinspector/tests/functests/LiveEventInspectorFuncTests.cpp" ) endif() if (EXISTS "${CMAKE_SOURCE_DIR}/lib/modules/exp/tests") list(APPEND SRCS - ${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/functests/ECSClientFuncTests.cpp - ${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/functests/ECSClientRealworldFuncTests.cpp - ${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/functests/ECSConfigCacheFuncTests.cpp + "${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/functests/ECSClientFuncTests.cpp" + "${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/functests/ECSClientRealworldFuncTests.cpp" + "${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/functests/ECSConfigCacheFuncTests.cpp" ) if (EXISTS "${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/functests/test.json") configure_file("${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/functests/test.json" "${CMAKE_BINARY_DIR}/test.json" COPYONLY) diff --git a/tests/unittests/CMakeLists.txt b/tests/unittests/CMakeLists.txt index 1b29db3bf..41c734a31 100644 --- a/tests/unittests/CMakeLists.txt +++ b/tests/unittests/CMakeLists.txt @@ -68,38 +68,38 @@ endif() if (EXISTS "${CMAKE_SOURCE_DIR}/lib/modules/exp/tests") list(APPEND SRCS - ${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/unittests/ECSConfigCacheTests.cpp - ${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/unittests/ECSClientUtilsTests.cpp - ${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/unittests/ECSClientTests.cpp + "${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/unittests/ECSConfigCacheTests.cpp" + "${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/unittests/ECSClientUtilsTests.cpp" + "${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/unittests/ECSClientTests.cpp" ) endif() if(EXISTS "${CMAKE_SOURCE_DIR}/lib/modules/privacyguard/" AND BUILD_PRIVACYGUARD) add_definitions(-DHAVE_MAT_PRIVACYGUARD) list(APPEND SRCS - ${CMAKE_SOURCE_DIR}/lib/modules/privacyguard/tests/unittests/InitializationConfigurationTests.cpp - ${CMAKE_SOURCE_DIR}/lib/modules/privacyguard/tests/unittests/PrivacyConcernEventTests.cpp - ${CMAKE_SOURCE_DIR}/lib/modules/privacyguard/tests/unittests/PrivacyConcernMetadataProviderTests.cpp - ${CMAKE_SOURCE_DIR}/lib/modules/privacyguard/tests/unittests/PrivacyGuardTests.cpp - ${CMAKE_SOURCE_DIR}/lib/modules/privacyguard/tests/unittests/SystematicSamplerTests.cpp + "${CMAKE_SOURCE_DIR}/lib/modules/privacyguard/tests/unittests/InitializationConfigurationTests.cpp" + "${CMAKE_SOURCE_DIR}/lib/modules/privacyguard/tests/unittests/PrivacyConcernEventTests.cpp" + "${CMAKE_SOURCE_DIR}/lib/modules/privacyguard/tests/unittests/PrivacyConcernMetadataProviderTests.cpp" + "${CMAKE_SOURCE_DIR}/lib/modules/privacyguard/tests/unittests/PrivacyGuardTests.cpp" + "${CMAKE_SOURCE_DIR}/lib/modules/privacyguard/tests/unittests/SystematicSamplerTests.cpp" ) endif() if(EXISTS "${CMAKE_SOURCE_DIR}/lib/modules/sanitizer/" AND BUILD_SANITIZER) list(APPEND SRCS - ${CMAKE_SOURCE_DIR}/lib/modules/sanitizer/tests/unittests/SanitizerJwtTests.cpp - ${CMAKE_SOURCE_DIR}/lib/modules/sanitizer/tests/unittests/SanitizerProviderTests.cpp - ${CMAKE_SOURCE_DIR}/lib/modules/sanitizer/tests/unittests/SanitizerSitePathTests.cpp - ${CMAKE_SOURCE_DIR}/lib/modules/sanitizer/tests/unittests/SanitizerStringUtilsTests.cpp - ${CMAKE_SOURCE_DIR}/lib/modules/sanitizer/tests/unittests/SanitizerUrlTests.cpp - ${CMAKE_SOURCE_DIR}/lib/modules/sanitizer/tests/unittests/SanitizerTrieTests.cpp - ${CMAKE_SOURCE_DIR}/lib/modules/sanitizer/tests/unittests/SPOPasswordTests.cpp + "${CMAKE_SOURCE_DIR}/lib/modules/sanitizer/tests/unittests/SanitizerJwtTests.cpp" + "${CMAKE_SOURCE_DIR}/lib/modules/sanitizer/tests/unittests/SanitizerProviderTests.cpp" + "${CMAKE_SOURCE_DIR}/lib/modules/sanitizer/tests/unittests/SanitizerSitePathTests.cpp" + "${CMAKE_SOURCE_DIR}/lib/modules/sanitizer/tests/unittests/SanitizerStringUtilsTests.cpp" + "${CMAKE_SOURCE_DIR}/lib/modules/sanitizer/tests/unittests/SanitizerUrlTests.cpp" + "${CMAKE_SOURCE_DIR}/lib/modules/sanitizer/tests/unittests/SanitizerTrieTests.cpp" + "${CMAKE_SOURCE_DIR}/lib/modules/sanitizer/tests/unittests/SPOPasswordTests.cpp" ) endif() if(EXISTS "${CMAKE_SOURCE_DIR}/lib/modules/dataviewer/") list(APPEND SRCS - ${CMAKE_SOURCE_DIR}/lib/modules/dataviewer/tests/unittests/DefaultDataViewerTests.cpp + "${CMAKE_SOURCE_DIR}/lib/modules/dataviewer/tests/unittests/DefaultDataViewerTests.cpp" DataViewerCollectionTests.cpp ) endif() From 337028a7bc33c717552a1bd09d45e8678fc0448d Mon Sep 17 00:00:00 2001 From: Copilot <223556219+Copilot@users.noreply.github.com> Date: Thu, 28 May 2026 12:46:30 -0500 Subject: [PATCH 12/20] Solutions: drop speculative v145 PlatformToolset mapping for VS 18.0+ Copilot review on PR #1416 flagged that mapping VisualStudioVersion >= 18.0 to PlatformToolset v145 is a guess: VS 2025/2026/etc. has not shipped, the toolset moniker for that release may differ, and pinning to a non-existent toolset name causes MSBuild to fail early with "unknown PlatformToolset" on any machine that does pick up that VS version. Drop the v145 mapping from both before.targets and build.MIP.props. Future VS versions fall through to the v141 fallback (same behavior as before PR #1416, just one less wrong-toolset-name failure mode). Add explicit mappings for new toolsets as they actually ship. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- Solutions/before.targets | 2 +- Solutions/build.MIP.props | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Solutions/before.targets b/Solutions/before.targets index 052e5d77f..9145f2d4d 100644 --- a/Solutions/before.targets +++ b/Solutions/before.targets @@ -4,7 +4,7 @@ - v145 + v143 v142 v141 diff --git a/Solutions/build.MIP.props b/Solutions/build.MIP.props index 2419c4c36..a72841ce5 100644 --- a/Solutions/build.MIP.props +++ b/Solutions/build.MIP.props @@ -11,7 +11,7 @@ true $(DefaultPlatformToolset) - v145 + v143 v142 v141 From c4b3c98f1b46393ecc3da2fed4bf7bc25658f87c Mon Sep 17 00:00:00 2001 From: Bhagirath Mehta Date: Thu, 28 May 2026 16:16:58 -0500 Subject: [PATCH 13/20] cmake: stop overriding CMAKE_CXX_STANDARD with -std=c++11 The top-level CMakeLists.txt asks for C++14 (CMAKE_CXX_STANDARD 14, set in 2018) but then re-injects -std=c++11 into CMAKE_CXX_FLAGS for both Release and Debug Unix builds (set in 2019 when gcc-4.x / gcc-5.x C++14 support was still spotty). That explicit flag wins, so the Unix builds have actually been C++11 ever since, contradicting the stated standard. This is a vestige: gcc-5+, clang-3.4+, and MSVC 2015+ all support C++14 fully, and Android (lib/android_build/) already sets CMAKE_CXX_STANDARD 14 explicitly. Removing the override aligns the Unix CMake builds with the intended standard. - Drop the stale gcc-4.x/5.x caveat comment and add CMAKE_CXX_STANDARD_REQUIRED ON so the build fails loudly on toolchains that cannot do C++14, rather than silently falling back. - Drop the -std=c++11 fragment from both REL and DBG CMAKE_CXX_FLAGS lines. C and C11 are left alone (C11 remains the C floor). Not touched in this commit: - examples/**/CMakeLists.txt and wrappers/obj-c/CMakeLists.txt also pin -std=c++11. Those are standalone sample/wrapper build scripts not wired via add_subdirectory and not built by any CI workflow; their pins are intentional statements of each sample's minimum and can stay. - This commit does not bump the project to C++17. Cleanup ideas like cpp_client_telemetry_modules#302 (std::string::data() -> char*) require C++17 and are still out of scope. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- CMakeLists.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e9d1fdabe..6aee84cda 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,8 +16,9 @@ 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}) @@ -149,13 +150,14 @@ if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug") #TODO: -fno-rtti 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(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 From e21c50a38979644d19ca24ec076b24f8089ea357 Mon Sep 17 00:00:00 2001 From: Bhagirath Mehta Date: Fri, 29 May 2026 15:40:28 -0500 Subject: [PATCH 14/20] Address CMake review comments Derive package version components from MATSDK_BUILD_VERSION so CPack packages stay aligned with the SDK version. Use PROJECT_SOURCE_DIR and PROJECT_BINARY_DIR for test CMake paths so the SDK remains subproject-friendly. Files changed: - CMakeLists.txt - tools/MakeDeb.cmake - tools/MakeRpm.cmake - tools/MakeTgz.cmake - tests/functests/CMakeLists.txt - tests/unittests/CMakeLists.txt Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- CMakeLists.txt | 5 +++ tests/functests/CMakeLists.txt | 50 +++++++++++++------------- tests/unittests/CMakeLists.txt | 64 +++++++++++++++++----------------- tools/MakeDeb.cmake | 6 ++-- tools/MakeRpm.cmake | 6 ++-- tools/MakeTgz.cmake | 6 ++-- 6 files changed, 71 insertions(+), 66 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6aee84cda..542052320 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -243,6 +243,11 @@ else() set(MATSDK_BUILD_VERSION ${MATSDK_API_VERSION}.${DAYNUMBER}.0) endif() +string(REPLACE "." ";" MATSDK_BUILD_VERSION_PARTS "${MATSDK_BUILD_VERSION}") +list(GET MATSDK_BUILD_VERSION_PARTS 0 MATSDK_PACKAGE_VERSION_MAJOR) +list(GET MATSDK_BUILD_VERSION_PARTS 1 MATSDK_PACKAGE_VERSION_MINOR) +list(GET MATSDK_BUILD_VERSION_PARTS 2 MATSDK_PACKAGE_VERSION_PATCH) + message(STATUS "SDK version: ${SDK_VERSION_PREFIX}-${MATSDK_BUILD_VERSION}") ################################################################################################ diff --git a/tests/functests/CMakeLists.txt b/tests/functests/CMakeLists.txt index 29198bb96..323a8e2f9 100644 --- a/tests/functests/CMakeLists.txt +++ b/tests/functests/CMakeLists.txt @@ -8,40 +8,40 @@ set(SRCS MultipleLogManagersTests.cpp ) -if(EXISTS "${CMAKE_SOURCE_DIR}/lib/modules/privacyguard/" AND BUILD_PRIVACYGUARD) +if(EXISTS "${PROJECT_SOURCE_DIR}/lib/modules/privacyguard/" AND BUILD_PRIVACYGUARD) add_definitions(-DHAVE_MAT_PRIVACYGUARD) list(APPEND SRCS - "${CMAKE_SOURCE_DIR}/lib/modules/privacyguard/tests/functests/PrivacyGuardFuncTests.cpp" + "${PROJECT_SOURCE_DIR}/lib/modules/privacyguard/tests/functests/PrivacyGuardFuncTests.cpp" ) endif() -if(EXISTS "${CMAKE_SOURCE_DIR}/lib/modules/sanitizer/" AND BUILD_SANITIZER) +if(EXISTS "${PROJECT_SOURCE_DIR}/lib/modules/sanitizer/" AND BUILD_SANITIZER) list(APPEND SRCS - "${CMAKE_SOURCE_DIR}/lib/modules/sanitizer/tests/functests/SanitizerFuncTests.cpp" + "${PROJECT_SOURCE_DIR}/lib/modules/sanitizer/tests/functests/SanitizerFuncTests.cpp" ) endif() -if(EXISTS "${CMAKE_SOURCE_DIR}/lib/modules/dataviewer/") +if(EXISTS "${PROJECT_SOURCE_DIR}/lib/modules/dataviewer/") list(APPEND SRCS - "${CMAKE_SOURCE_DIR}/lib/modules/dataviewer/tests/functests/DefaultDataViewerFuncTests.cpp" + "${PROJECT_SOURCE_DIR}/lib/modules/dataviewer/tests/functests/DefaultDataViewerFuncTests.cpp" ) endif() -if(EXISTS "${CMAKE_SOURCE_DIR}/lib/modules/liveeventinspector/" AND BUILD_LIVEEVENTINSPECTOR) +if(EXISTS "${PROJECT_SOURCE_DIR}/lib/modules/liveeventinspector/" AND BUILD_LIVEEVENTINSPECTOR) add_definitions(-DHAVE_MAT_LIVEEVENTINSPECTOR) list(APPEND SRCS - "${CMAKE_SOURCE_DIR}/lib/modules/liveeventinspector/tests/functests/LiveEventInspectorFuncTests.cpp" + "${PROJECT_SOURCE_DIR}/lib/modules/liveeventinspector/tests/functests/LiveEventInspectorFuncTests.cpp" ) endif() -if (EXISTS "${CMAKE_SOURCE_DIR}/lib/modules/exp/tests") +if (EXISTS "${PROJECT_SOURCE_DIR}/lib/modules/exp/tests") list(APPEND SRCS - "${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/functests/ECSClientFuncTests.cpp" - "${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/functests/ECSClientRealworldFuncTests.cpp" - "${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/functests/ECSConfigCacheFuncTests.cpp" + "${PROJECT_SOURCE_DIR}/lib/modules/exp/tests/functests/ECSClientFuncTests.cpp" + "${PROJECT_SOURCE_DIR}/lib/modules/exp/tests/functests/ECSClientRealworldFuncTests.cpp" + "${PROJECT_SOURCE_DIR}/lib/modules/exp/tests/functests/ECSConfigCacheFuncTests.cpp" ) - if (EXISTS "${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/functests/test.json") - configure_file("${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/functests/test.json" "${CMAKE_BINARY_DIR}/test.json" COPYONLY) + if (EXISTS "${PROJECT_SOURCE_DIR}/lib/modules/exp/tests/functests/test.json") + configure_file("${PROJECT_SOURCE_DIR}/lib/modules/exp/tests/functests/test.json" "${PROJECT_BINARY_DIR}/test.json" COPYONLY) endif() endif() @@ -57,19 +57,19 @@ endif() if(PAL_IMPLEMENTATION STREQUAL "WIN32") # Link against prebuilt libraries on Windows message(STATUS "WIN32: Linking against prebuilt libraries") - message(STATUS "WIN32: ... ${CMAKE_BINARY_DIR}/gtest") - message(STATUS "WIN32: ... ${CMAKE_BINARY_DIR}/gmock") - message(STATUS "WIN32: ... ${CMAKE_BINARY_DIR}/zlib") - message(STATUS "WIN32: ... ${CMAKE_BINARY_DIR}/sqlite") - # link_directories(${CMAKE_BINARY_DIR}/gtest/ ${CMAKE_BINARY_DIR}/gmock/ ${CMAKE_BINARY_DIR}/zlib/ ${CMAKE_BINARY_DIR}/sqlite/) + message(STATUS "WIN32: ... ${PROJECT_BINARY_DIR}/gtest") + message(STATUS "WIN32: ... ${PROJECT_BINARY_DIR}/gmock") + message(STATUS "WIN32: ... ${PROJECT_BINARY_DIR}/zlib") + message(STATUS "WIN32: ... ${PROJECT_BINARY_DIR}/sqlite") + # link_directories(${PROJECT_BINARY_DIR}/gtest/ ${PROJECT_BINARY_DIR}/gmock/ ${PROJECT_BINARY_DIR}/zlib/ ${PROJECT_BINARY_DIR}/sqlite/) include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/../../zlib ) target_link_libraries(FuncTests mat wininet.lib - ${CMAKE_BINARY_DIR}/gtest/gtest.lib - ${CMAKE_BINARY_DIR}/gmock/gmock.lib - ${CMAKE_BINARY_DIR}/zlib/zlib.lib - ${CMAKE_BINARY_DIR}/sqlite/sqlite.lib + ${PROJECT_BINARY_DIR}/gtest/gtest.lib + ${PROJECT_BINARY_DIR}/gmock/gmock.lib + ${PROJECT_BINARY_DIR}/zlib/zlib.lib + ${PROJECT_BINARY_DIR}/sqlite/sqlite.lib ) else() @@ -104,7 +104,7 @@ else() message(STATUS "Linking libraries") message(STATUS "Current Dir: ${CMAKE_CURRENT_SOURCE_DIR}") - message(STATUS "Binary Dir: ${CMAKE_BINARY_DIR}") + message(STATUS "Binary Dir: ${PROJECT_BINARY_DIR}") set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER) @@ -135,4 +135,4 @@ else() endif() -add_test(FuncTests FuncTests "--gtest_output=xml:${CMAKE_BINARY_DIR}/test-reports/FuncTests.xml") +add_test(FuncTests FuncTests "--gtest_output=xml:${PROJECT_BINARY_DIR}/test-reports/FuncTests.xml") diff --git a/tests/unittests/CMakeLists.txt b/tests/unittests/CMakeLists.txt index 41c734a31..8b52a5fb3 100644 --- a/tests/unittests/CMakeLists.txt +++ b/tests/unittests/CMakeLists.txt @@ -54,7 +54,7 @@ set_source_files_properties(${SRCS} PROPERTIES COMPILE_FLAGS -Wno-deprecated-dec # Enable Azure Monitor unit tests when the module is present. # The AIJsonSerializer test sources are guarded by HAVE_MAT_AI. -if (EXISTS "${CMAKE_SOURCE_DIR}/lib/modules/azmon/AIJsonSerializer.hpp") +if (EXISTS "${PROJECT_SOURCE_DIR}/lib/modules/azmon/AIJsonSerializer.hpp") add_definitions(-DHAVE_MAT_AI) endif() @@ -66,40 +66,40 @@ if (APPLE) endif() endif() -if (EXISTS "${CMAKE_SOURCE_DIR}/lib/modules/exp/tests") +if (EXISTS "${PROJECT_SOURCE_DIR}/lib/modules/exp/tests") list(APPEND SRCS - "${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/unittests/ECSConfigCacheTests.cpp" - "${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/unittests/ECSClientUtilsTests.cpp" - "${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/unittests/ECSClientTests.cpp" + "${PROJECT_SOURCE_DIR}/lib/modules/exp/tests/unittests/ECSConfigCacheTests.cpp" + "${PROJECT_SOURCE_DIR}/lib/modules/exp/tests/unittests/ECSClientUtilsTests.cpp" + "${PROJECT_SOURCE_DIR}/lib/modules/exp/tests/unittests/ECSClientTests.cpp" ) endif() -if(EXISTS "${CMAKE_SOURCE_DIR}/lib/modules/privacyguard/" AND BUILD_PRIVACYGUARD) +if(EXISTS "${PROJECT_SOURCE_DIR}/lib/modules/privacyguard/" AND BUILD_PRIVACYGUARD) add_definitions(-DHAVE_MAT_PRIVACYGUARD) list(APPEND SRCS - "${CMAKE_SOURCE_DIR}/lib/modules/privacyguard/tests/unittests/InitializationConfigurationTests.cpp" - "${CMAKE_SOURCE_DIR}/lib/modules/privacyguard/tests/unittests/PrivacyConcernEventTests.cpp" - "${CMAKE_SOURCE_DIR}/lib/modules/privacyguard/tests/unittests/PrivacyConcernMetadataProviderTests.cpp" - "${CMAKE_SOURCE_DIR}/lib/modules/privacyguard/tests/unittests/PrivacyGuardTests.cpp" - "${CMAKE_SOURCE_DIR}/lib/modules/privacyguard/tests/unittests/SystematicSamplerTests.cpp" + "${PROJECT_SOURCE_DIR}/lib/modules/privacyguard/tests/unittests/InitializationConfigurationTests.cpp" + "${PROJECT_SOURCE_DIR}/lib/modules/privacyguard/tests/unittests/PrivacyConcernEventTests.cpp" + "${PROJECT_SOURCE_DIR}/lib/modules/privacyguard/tests/unittests/PrivacyConcernMetadataProviderTests.cpp" + "${PROJECT_SOURCE_DIR}/lib/modules/privacyguard/tests/unittests/PrivacyGuardTests.cpp" + "${PROJECT_SOURCE_DIR}/lib/modules/privacyguard/tests/unittests/SystematicSamplerTests.cpp" ) endif() -if(EXISTS "${CMAKE_SOURCE_DIR}/lib/modules/sanitizer/" AND BUILD_SANITIZER) +if(EXISTS "${PROJECT_SOURCE_DIR}/lib/modules/sanitizer/" AND BUILD_SANITIZER) list(APPEND SRCS - "${CMAKE_SOURCE_DIR}/lib/modules/sanitizer/tests/unittests/SanitizerJwtTests.cpp" - "${CMAKE_SOURCE_DIR}/lib/modules/sanitizer/tests/unittests/SanitizerProviderTests.cpp" - "${CMAKE_SOURCE_DIR}/lib/modules/sanitizer/tests/unittests/SanitizerSitePathTests.cpp" - "${CMAKE_SOURCE_DIR}/lib/modules/sanitizer/tests/unittests/SanitizerStringUtilsTests.cpp" - "${CMAKE_SOURCE_DIR}/lib/modules/sanitizer/tests/unittests/SanitizerUrlTests.cpp" - "${CMAKE_SOURCE_DIR}/lib/modules/sanitizer/tests/unittests/SanitizerTrieTests.cpp" - "${CMAKE_SOURCE_DIR}/lib/modules/sanitizer/tests/unittests/SPOPasswordTests.cpp" + "${PROJECT_SOURCE_DIR}/lib/modules/sanitizer/tests/unittests/SanitizerJwtTests.cpp" + "${PROJECT_SOURCE_DIR}/lib/modules/sanitizer/tests/unittests/SanitizerProviderTests.cpp" + "${PROJECT_SOURCE_DIR}/lib/modules/sanitizer/tests/unittests/SanitizerSitePathTests.cpp" + "${PROJECT_SOURCE_DIR}/lib/modules/sanitizer/tests/unittests/SanitizerStringUtilsTests.cpp" + "${PROJECT_SOURCE_DIR}/lib/modules/sanitizer/tests/unittests/SanitizerUrlTests.cpp" + "${PROJECT_SOURCE_DIR}/lib/modules/sanitizer/tests/unittests/SanitizerTrieTests.cpp" + "${PROJECT_SOURCE_DIR}/lib/modules/sanitizer/tests/unittests/SPOPasswordTests.cpp" ) endif() -if(EXISTS "${CMAKE_SOURCE_DIR}/lib/modules/dataviewer/") +if(EXISTS "${PROJECT_SOURCE_DIR}/lib/modules/dataviewer/") list(APPEND SRCS - "${CMAKE_SOURCE_DIR}/lib/modules/dataviewer/tests/unittests/DefaultDataViewerTests.cpp" + "${PROJECT_SOURCE_DIR}/lib/modules/dataviewer/tests/unittests/DefaultDataViewerTests.cpp" DataViewerCollectionTests.cpp ) endif() @@ -116,19 +116,19 @@ endif() if(PAL_IMPLEMENTATION STREQUAL "WIN32") # Link against prebuilt libraries on Windows message(STATUS "WIN32: Linking against prebuilt libraries") - message(STATUS "WIN32: ... ${CMAKE_BINARY_DIR}/gtest") - message(STATUS "WIN32: ... ${CMAKE_BINARY_DIR}/gmock") - message(STATUS "WIN32: ... ${CMAKE_BINARY_DIR}/zlib") - message(STATUS "WIN32: ... ${CMAKE_BINARY_DIR}/sqlite") - # link_directories(${CMAKE_BINARY_DIR}/gtest/ ${CMAKE_BINARY_DIR}/gmock/ ${CMAKE_BINARY_DIR}/zlib/ ${CMAKE_BINARY_DIR}/sqlite/) + message(STATUS "WIN32: ... ${PROJECT_BINARY_DIR}/gtest") + message(STATUS "WIN32: ... ${PROJECT_BINARY_DIR}/gmock") + message(STATUS "WIN32: ... ${PROJECT_BINARY_DIR}/zlib") + message(STATUS "WIN32: ... ${PROJECT_BINARY_DIR}/sqlite") + # link_directories(${PROJECT_BINARY_DIR}/gtest/ ${PROJECT_BINARY_DIR}/gmock/ ${PROJECT_BINARY_DIR}/zlib/ ${PROJECT_BINARY_DIR}/sqlite/) include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/../../zlib ) target_link_libraries(UnitTests mat wininet.lib - ${CMAKE_BINARY_DIR}/gtest/gtest.lib - ${CMAKE_BINARY_DIR}/gmock/gmock.lib - ${CMAKE_BINARY_DIR}/zlib/zlib.lib - ${CMAKE_BINARY_DIR}/sqlite/sqlite.lib + ${PROJECT_BINARY_DIR}/gtest/gtest.lib + ${PROJECT_BINARY_DIR}/gmock/gmock.lib + ${PROJECT_BINARY_DIR}/zlib/zlib.lib + ${PROJECT_BINARY_DIR}/sqlite/sqlite.lib ) else() @@ -164,7 +164,7 @@ else() message(STATUS "Linking libraries") message(STATUS "Current Dir: ${CMAKE_CURRENT_SOURCE_DIR}") - message(STATUS "Binary Dir: ${CMAKE_BINARY_DIR}") + message(STATUS "Binary Dir: ${PROJECT_BINARY_DIR}") include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/../../lib/ ) @@ -200,4 +200,4 @@ else() endif() -add_test(UnitTests UnitTests "--gtest_output=xml:${CMAKE_BINARY_DIR}/test-reports/UnitTests.xml") +add_test(UnitTests UnitTests "--gtest_output=xml:${PROJECT_BINARY_DIR}/test-reports/UnitTests.xml") diff --git a/tools/MakeDeb.cmake b/tools/MakeDeb.cmake index 4f839ab5b..b63cff1e3 100644 --- a/tools/MakeDeb.cmake +++ b/tools/MakeDeb.cmake @@ -9,10 +9,10 @@ set(CPACK_SYSTEM_NAME "${OS_RELEASE_ID}-${OS_RELEASE_VERSION_ID}") set(CPACK_PACKAGING_INSTALL_PREFIX "/usr/local") set(CPACK_GENERATOR "DEB") -set(MAJOR_VERSION "3") -set(MINOR_VERSION "5") +set(MAJOR_VERSION "${MATSDK_PACKAGE_VERSION_MAJOR}") +set(MINOR_VERSION "${MATSDK_PACKAGE_VERSION_MINOR}") string(TIMESTAMP DAYNUMBER "%j") -set(PATCH_VERSION "${DAYNUMBER}") +set(PATCH_VERSION "${MATSDK_PACKAGE_VERSION_PATCH}") set(CPACK_PACKAGE_DESCRIPTION "Microsoft Applications Telemetry SDK for Linux") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Microsoft Applications Telemetry SDK for events ingestion from Linux hosts") diff --git a/tools/MakeRpm.cmake b/tools/MakeRpm.cmake index 8d9cf0b67..885df8df8 100644 --- a/tools/MakeRpm.cmake +++ b/tools/MakeRpm.cmake @@ -7,10 +7,10 @@ set(CPACK_RPM_PACKAGE_DESCRIPTION "Microsoft Applications Telemetry SDK for Linu set(CPACK_RPM_PACKAGE_DESCRIPTION_SUMMARY "Microsoft Applications Telemetry SDK for events ingestion from Linux hosts") set(CPACK_RPM_PACKAGE_CONTACT "1ds.sdk.cpp@service.microsoft.com") -set(MAJOR_VERSION "3") -set(MINOR_VERSION "5") +set(MAJOR_VERSION "${MATSDK_PACKAGE_VERSION_MAJOR}") +set(MINOR_VERSION "${MATSDK_PACKAGE_VERSION_MINOR}") string(TIMESTAMP DAYNUMBER "%j") -set(PATCH_VERSION "${DAYNUMBER}") +set(PATCH_VERSION "${MATSDK_PACKAGE_VERSION_PATCH}") set(CPACK_PACKAGE_VERSION ${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}) set(CPACK_GENERATOR "RPM") diff --git a/tools/MakeTgz.cmake b/tools/MakeTgz.cmake index 44c308e32..ad8012fba 100644 --- a/tools/MakeTgz.cmake +++ b/tools/MakeTgz.cmake @@ -6,10 +6,10 @@ set(CPACK_SYSTEM_NAME "${OS_RELEASE_ID}-${OS_RELEASE_VERSION_ID}") set(CPACK_PACKAGING_INSTALL_PREFIX "/usr/local") set(CPACK_GENERATOR "TGZ") -set(MAJOR_VERSION "3") -set(MINOR_VERSION "4") +set(MAJOR_VERSION "${MATSDK_PACKAGE_VERSION_MAJOR}") +set(MINOR_VERSION "${MATSDK_PACKAGE_VERSION_MINOR}") string(TIMESTAMP DAYNUMBER "%j") -set(PATCH_VERSION "${DAYNUMBER}") +set(PATCH_VERSION "${MATSDK_PACKAGE_VERSION_PATCH}") set(CPACK_PACKAGE_DESCRIPTION "Microsoft Applications Telemetry C/C++ SDK for Unix") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Microsoft Applications Telemetry SDK for events ingestion from Unix hosts") From 624abf62b43c424fa50efca1b3b9ce2339ae5da6 Mon Sep 17 00:00:00 2001 From: Bhagirath Mehta Date: Fri, 29 May 2026 15:52:06 -0500 Subject: [PATCH 15/20] Harden package version parsing Validate MATSDK_BUILD_VERSION before deriving CPack version components and remove now-dead DAYNUMBER calculations from package scripts. Files changed: - CMakeLists.txt - tools/MakeDeb.cmake - tools/MakeRpm.cmake - tools/MakeTgz.cmake Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- CMakeLists.txt | 11 +++++++---- tools/MakeDeb.cmake | 1 - tools/MakeRpm.cmake | 1 - tools/MakeTgz.cmake | 1 - 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 542052320..fbd6c012e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -243,10 +243,13 @@ else() set(MATSDK_BUILD_VERSION ${MATSDK_API_VERSION}.${DAYNUMBER}.0) endif() -string(REPLACE "." ";" MATSDK_BUILD_VERSION_PARTS "${MATSDK_BUILD_VERSION}") -list(GET MATSDK_BUILD_VERSION_PARTS 0 MATSDK_PACKAGE_VERSION_MAJOR) -list(GET MATSDK_BUILD_VERSION_PARTS 1 MATSDK_PACKAGE_VERSION_MINOR) -list(GET MATSDK_BUILD_VERSION_PARTS 2 MATSDK_PACKAGE_VERSION_PATCH) +if(MATSDK_BUILD_VERSION MATCHES "^([0-9]+)\\.([0-9]+)\\.([0-9]+)") + set(MATSDK_PACKAGE_VERSION_MAJOR "${CMAKE_MATCH_1}") + set(MATSDK_PACKAGE_VERSION_MINOR "${CMAKE_MATCH_2}") + set(MATSDK_PACKAGE_VERSION_PATCH "${CMAKE_MATCH_3}") +else() + message(FATAL_ERROR "MATSDK_BUILD_VERSION (${MATSDK_BUILD_VERSION}) must include at least major.minor.patch components.") +endif() message(STATUS "SDK version: ${SDK_VERSION_PREFIX}-${MATSDK_BUILD_VERSION}") diff --git a/tools/MakeDeb.cmake b/tools/MakeDeb.cmake index b63cff1e3..7c5919ebf 100644 --- a/tools/MakeDeb.cmake +++ b/tools/MakeDeb.cmake @@ -11,7 +11,6 @@ set(CPACK_GENERATOR "DEB") set(MAJOR_VERSION "${MATSDK_PACKAGE_VERSION_MAJOR}") set(MINOR_VERSION "${MATSDK_PACKAGE_VERSION_MINOR}") -string(TIMESTAMP DAYNUMBER "%j") set(PATCH_VERSION "${MATSDK_PACKAGE_VERSION_PATCH}") set(CPACK_PACKAGE_DESCRIPTION "Microsoft Applications Telemetry SDK for Linux") diff --git a/tools/MakeRpm.cmake b/tools/MakeRpm.cmake index 885df8df8..e5e515712 100644 --- a/tools/MakeRpm.cmake +++ b/tools/MakeRpm.cmake @@ -9,7 +9,6 @@ set(CPACK_RPM_PACKAGE_CONTACT "1ds.sdk.cpp@service.microsoft.com") set(MAJOR_VERSION "${MATSDK_PACKAGE_VERSION_MAJOR}") set(MINOR_VERSION "${MATSDK_PACKAGE_VERSION_MINOR}") -string(TIMESTAMP DAYNUMBER "%j") set(PATCH_VERSION "${MATSDK_PACKAGE_VERSION_PATCH}") set(CPACK_PACKAGE_VERSION ${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}) diff --git a/tools/MakeTgz.cmake b/tools/MakeTgz.cmake index ad8012fba..16fa32c64 100644 --- a/tools/MakeTgz.cmake +++ b/tools/MakeTgz.cmake @@ -8,7 +8,6 @@ set(CPACK_GENERATOR "TGZ") set(MAJOR_VERSION "${MATSDK_PACKAGE_VERSION_MAJOR}") set(MINOR_VERSION "${MATSDK_PACKAGE_VERSION_MINOR}") -string(TIMESTAMP DAYNUMBER "%j") set(PATCH_VERSION "${MATSDK_PACKAGE_VERSION_PATCH}") set(CPACK_PACKAGE_DESCRIPTION "Microsoft Applications Telemetry C/C++ SDK for Unix") From 435e73064356d5c0c599d1eff1b649f66d43cfc2 Mon Sep 17 00:00:00 2001 From: Bhagirath Mehta Date: Fri, 29 May 2026 16:35:41 -0500 Subject: [PATCH 16/20] Remove leftover CMake merge markers The previous merge from main left a conflict marker block in lib/CMakeLists.txt's trailing commented-link section. Remove the marker block and keep the cleaned-up file content. Files changed: - lib/CMakeLists.txt Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- lib/CMakeLists.txt | 9 --------- 1 file changed, 9 deletions(-) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index ff772fc75..7321a6de5 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -335,12 +335,3 @@ else() endif() message(STATUS "Library will be installed to ${INSTALL_LIB_DIR}") - -<<<<<<< HEAD - -======= -#if(PAL_IMPLEMENTATION STREQUAL "CPP11") -# #target_link_libraries(mat PUBLIC libcurl.a libz.a libssl.a libcrypto.a "${SQLITE_LIBRARY}" "${CMAKE_THREAD_LIBS_INIT}" "${CMAKE_DL_LIBS}" ) -# #target_link_libraries(mat PUBLIC libsqlite3.a libz.a ${LIBS} "${CMAKE_THREAD_LIBS_INIT}" "${CMAKE_DL_LIBS}" ) -#endif() ->>>>>>> msft/main From be040135a042f7e7ea7e8cde0ff1c4173461822f Mon Sep 17 00:00:00 2001 From: Bhagirath Mehta Date: Fri, 29 May 2026 17:28:30 -0500 Subject: [PATCH 17/20] Revert package version alignment Keep package script version cleanup out of the CMake cleanup PR; package version alignment can be handled separately before the next release. Files changed: - CMakeLists.txt - tools/MakeDeb.cmake - tools/MakeRpm.cmake - tools/MakeTgz.cmake Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- CMakeLists.txt | 8 -------- tools/MakeDeb.cmake | 7 ++++--- tools/MakeRpm.cmake | 7 ++++--- tools/MakeTgz.cmake | 7 ++++--- 4 files changed, 12 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fbd6c012e..6aee84cda 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -243,14 +243,6 @@ else() set(MATSDK_BUILD_VERSION ${MATSDK_API_VERSION}.${DAYNUMBER}.0) endif() -if(MATSDK_BUILD_VERSION MATCHES "^([0-9]+)\\.([0-9]+)\\.([0-9]+)") - set(MATSDK_PACKAGE_VERSION_MAJOR "${CMAKE_MATCH_1}") - set(MATSDK_PACKAGE_VERSION_MINOR "${CMAKE_MATCH_2}") - set(MATSDK_PACKAGE_VERSION_PATCH "${CMAKE_MATCH_3}") -else() - message(FATAL_ERROR "MATSDK_BUILD_VERSION (${MATSDK_BUILD_VERSION}) must include at least major.minor.patch components.") -endif() - message(STATUS "SDK version: ${SDK_VERSION_PREFIX}-${MATSDK_BUILD_VERSION}") ################################################################################################ diff --git a/tools/MakeDeb.cmake b/tools/MakeDeb.cmake index 7c5919ebf..4f839ab5b 100644 --- a/tools/MakeDeb.cmake +++ b/tools/MakeDeb.cmake @@ -9,9 +9,10 @@ set(CPACK_SYSTEM_NAME "${OS_RELEASE_ID}-${OS_RELEASE_VERSION_ID}") set(CPACK_PACKAGING_INSTALL_PREFIX "/usr/local") set(CPACK_GENERATOR "DEB") -set(MAJOR_VERSION "${MATSDK_PACKAGE_VERSION_MAJOR}") -set(MINOR_VERSION "${MATSDK_PACKAGE_VERSION_MINOR}") -set(PATCH_VERSION "${MATSDK_PACKAGE_VERSION_PATCH}") +set(MAJOR_VERSION "3") +set(MINOR_VERSION "5") +string(TIMESTAMP DAYNUMBER "%j") +set(PATCH_VERSION "${DAYNUMBER}") set(CPACK_PACKAGE_DESCRIPTION "Microsoft Applications Telemetry SDK for Linux") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Microsoft Applications Telemetry SDK for events ingestion from Linux hosts") diff --git a/tools/MakeRpm.cmake b/tools/MakeRpm.cmake index e5e515712..8d9cf0b67 100644 --- a/tools/MakeRpm.cmake +++ b/tools/MakeRpm.cmake @@ -7,9 +7,10 @@ set(CPACK_RPM_PACKAGE_DESCRIPTION "Microsoft Applications Telemetry SDK for Linu set(CPACK_RPM_PACKAGE_DESCRIPTION_SUMMARY "Microsoft Applications Telemetry SDK for events ingestion from Linux hosts") set(CPACK_RPM_PACKAGE_CONTACT "1ds.sdk.cpp@service.microsoft.com") -set(MAJOR_VERSION "${MATSDK_PACKAGE_VERSION_MAJOR}") -set(MINOR_VERSION "${MATSDK_PACKAGE_VERSION_MINOR}") -set(PATCH_VERSION "${MATSDK_PACKAGE_VERSION_PATCH}") +set(MAJOR_VERSION "3") +set(MINOR_VERSION "5") +string(TIMESTAMP DAYNUMBER "%j") +set(PATCH_VERSION "${DAYNUMBER}") set(CPACK_PACKAGE_VERSION ${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}) set(CPACK_GENERATOR "RPM") diff --git a/tools/MakeTgz.cmake b/tools/MakeTgz.cmake index 16fa32c64..44c308e32 100644 --- a/tools/MakeTgz.cmake +++ b/tools/MakeTgz.cmake @@ -6,9 +6,10 @@ set(CPACK_SYSTEM_NAME "${OS_RELEASE_ID}-${OS_RELEASE_VERSION_ID}") set(CPACK_PACKAGING_INSTALL_PREFIX "/usr/local") set(CPACK_GENERATOR "TGZ") -set(MAJOR_VERSION "${MATSDK_PACKAGE_VERSION_MAJOR}") -set(MINOR_VERSION "${MATSDK_PACKAGE_VERSION_MINOR}") -set(PATCH_VERSION "${MATSDK_PACKAGE_VERSION_PATCH}") +set(MAJOR_VERSION "3") +set(MINOR_VERSION "4") +string(TIMESTAMP DAYNUMBER "%j") +set(PATCH_VERSION "${DAYNUMBER}") set(CPACK_PACKAGE_DESCRIPTION "Microsoft Applications Telemetry C/C++ SDK for Unix") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Microsoft Applications Telemetry SDK for events ingestion from Unix hosts") From b99ff144ab400fc882b2ac6c87e5faba30a9ed5e Mon Sep 17 00:00:00 2001 From: Bhagirath Mehta Date: Sat, 30 May 2026 12:16:44 -0500 Subject: [PATCH 18/20] Document current Visual Studio build toolsets Add an explicit VS2026/v145 command-line build entry alongside the existing VS2022/v143 script so Windows consumers can choose the right supported toolset without guessing from MSBuild internals. Files changed: - docs/cpp-start-windows.md - build-all-v145.bat - tools/vcvars.cmd - Solutions/before.targets Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- Solutions/before.targets | 1 + build-all-v145.bat | 6 ++++ docs/cpp-start-windows.md | 9 +++-- tools/vcvars.cmd | 69 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 83 insertions(+), 2 deletions(-) create mode 100644 build-all-v145.bat diff --git a/Solutions/before.targets b/Solutions/before.targets index 9145f2d4d..ce4cb42e4 100644 --- a/Solutions/before.targets +++ b/Solutions/before.targets @@ -5,6 +5,7 @@ + v145 v143 v142 v141 diff --git a/build-all-v145.bat b/build-all-v145.bat new file mode 100644 index 000000000..f1b43d658 --- /dev/null +++ b/build-all-v145.bat @@ -0,0 +1,6 @@ +@echo off + +set VSTOOLS_VERSION=vs2026 +set PlatformToolset=v145 +call build-all.bat + diff --git a/docs/cpp-start-windows.md b/docs/cpp-start-windows.md index ef5850d84..e2a6ae3a1 100644 --- a/docs/cpp-start-windows.md +++ b/docs/cpp-start-windows.md @@ -16,13 +16,18 @@ If your project requires the Universal Telemetry Client (a.k.a. UTC) to send tel ## **Windows prerequisites and dependencies for building from source** -* Visual Studio 2019 or 2022 (2022 is recommended). +* Visual Studio 2019, 2022, or 2026 (2022 or newer is recommended). * C++ Dev Tools ## **Option 1: Build the SDK from source using Visual Studio** * Open the *cpp_client_telemetry/Solutions/MSTelemetrySDK.sln* solution in Visual Studio. -* Alternatively you can use *build-all.bat* located in workspace root folder to build from command line +* Alternatively, build from the workspace root with the script that matches your Visual Studio toolset: + * Visual Studio 2019: `build-all-v142.bat` + * Visual Studio 2022: `build-all-v143.bat` + * Visual Studio 2026: `build-all-v145.bat` + +The version-specific scripts set `VSTOOLS_VERSION` and `PlatformToolset` before calling `build-all.bat`. If you already have a developer command prompt configured, you can also call `build-all.bat` directly and override `PlatformToolset` yourself. If your build fails, then you most likely missing the following optional Visual Studio components: diff --git a/tools/vcvars.cmd b/tools/vcvars.cmd index 18ae09e0a..ee8a3a8d1 100644 --- a/tools/vcvars.cmd +++ b/tools/vcvars.cmd @@ -8,6 +8,14 @@ REM 2. Visual Studio 2017 BuildTools REM 3. Visual Studio 2019 Enterprise REM 4. Visual Studio 2019 Community REM 5. Visual Studio 2019 BuildTools +REM 6. Visual Studio 2022 Enterprise +REM 7. Visual Studio 2022 Professional +REM 8. Visual Studio 2022 Community +REM 9. Visual Studio 2022 BuildTools +REM 10. Visual Studio 2026 Enterprise +REM 11. Visual Studio 2026 Professional +REM 12. Visual Studio 2026 Community +REM 13. Visual Studio 2026 BuildTools REM REM 1st parameter - Visual Studio version @@ -84,6 +92,16 @@ if exist "%VSDEVCMD%" ( goto tools_configured ) +:vs2022_professional +SET VSVERSION=2022 +set "VSDEVCMD=%ProgramFiles%\Microsoft Visual Studio\2022\Professional\Common7\Tools\VsDevCmd.bat" +if exist "%VSDEVCMD%" ( + set "VSINSTALLDIR=%ProgramFiles%\Microsoft Visual Studio\2022\Professional" + echo Building with vs2022 Professional... + call "%VSDEVCMD%" + goto tools_configured +) + :vs2022_community SET VSVERSION=2022 set "VSDEVCMD=%ProgramFiles%\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd.bat" @@ -94,6 +112,57 @@ if exist "%VSDEVCMD%" ( goto tools_configured ) +:vs2022_buildtools +SET VSVERSION=2022 +set "VSDEVCMD=%ProgramFiles(x86)%\Microsoft Visual Studio\2022\BuildTools\Common7\Tools\VsDevCmd.bat" +if exist "%VSDEVCMD%" ( + set "VSINSTALLDIR=%ProgramFiles(x86)%\Microsoft Visual Studio\2022\BuildTools" + echo Building with vs2022 BuildTools... + call "%VSDEVCMD%" + goto tools_configured +) + +:vs2026 +:vs2026_enterprise +SET VSVERSION=2026 +set "VSDEVCMD=%ProgramFiles%\Microsoft Visual Studio\18\Enterprise\Common7\Tools\VsDevCmd.bat" +if exist "%VSDEVCMD%" ( + set "VSINSTALLDIR=%ProgramFiles%\Microsoft Visual Studio\18\Enterprise" + echo Building with vs2026 Enterprise... + call "%VSDEVCMD%" + goto tools_configured +) + +:vs2026_professional +SET VSVERSION=2026 +set "VSDEVCMD=%ProgramFiles%\Microsoft Visual Studio\18\Professional\Common7\Tools\VsDevCmd.bat" +if exist "%VSDEVCMD%" ( + set "VSINSTALLDIR=%ProgramFiles%\Microsoft Visual Studio\18\Professional" + echo Building with vs2026 Professional... + call "%VSDEVCMD%" + goto tools_configured +) + +:vs2026_community +SET VSVERSION=2026 +set "VSDEVCMD=%ProgramFiles%\Microsoft Visual Studio\18\Community\Common7\Tools\VsDevCmd.bat" +if exist "%VSDEVCMD%" ( + set "VSINSTALLDIR=%ProgramFiles%\Microsoft Visual Studio\18\Community" + echo Building with vs2026 Community... + call "%VSDEVCMD%" + goto tools_configured +) + +:vs2026_buildtools +SET VSVERSION=2026 +set "VSDEVCMD=%ProgramFiles(x86)%\Microsoft Visual Studio\18\BuildTools\Common7\Tools\VsDevCmd.bat" +if exist "%VSDEVCMD%" ( + set "VSINSTALLDIR=%ProgramFiles(x86)%\Microsoft Visual Studio\18\BuildTools" + echo Building with vs2026 BuildTools... + call "%VSDEVCMD%" + goto tools_configured +) + echo WARNING:********************************************* echo WARNING: cannot auto-detect Visual Studio version !!! echo WARNING:********************************************* From b721bc5d3a8709148e958c99c81ac4f96c751743 Mon Sep 17 00:00:00 2001 From: Bhagirath Mehta Date: Sat, 30 May 2026 12:47:50 -0500 Subject: [PATCH 19/20] Revert "Document current Visual Studio build toolsets" This reverts commit b99ff144ab400fc882b2ac6c87e5faba30a9ed5e. --- Solutions/before.targets | 1 - build-all-v145.bat | 6 ---- docs/cpp-start-windows.md | 9 ++--- tools/vcvars.cmd | 69 --------------------------------------- 4 files changed, 2 insertions(+), 83 deletions(-) delete mode 100644 build-all-v145.bat diff --git a/Solutions/before.targets b/Solutions/before.targets index ce4cb42e4..9145f2d4d 100644 --- a/Solutions/before.targets +++ b/Solutions/before.targets @@ -5,7 +5,6 @@ - v145 v143 v142 v141 diff --git a/build-all-v145.bat b/build-all-v145.bat deleted file mode 100644 index f1b43d658..000000000 --- a/build-all-v145.bat +++ /dev/null @@ -1,6 +0,0 @@ -@echo off - -set VSTOOLS_VERSION=vs2026 -set PlatformToolset=v145 -call build-all.bat - diff --git a/docs/cpp-start-windows.md b/docs/cpp-start-windows.md index e2a6ae3a1..ef5850d84 100644 --- a/docs/cpp-start-windows.md +++ b/docs/cpp-start-windows.md @@ -16,18 +16,13 @@ If your project requires the Universal Telemetry Client (a.k.a. UTC) to send tel ## **Windows prerequisites and dependencies for building from source** -* Visual Studio 2019, 2022, or 2026 (2022 or newer is recommended). +* Visual Studio 2019 or 2022 (2022 is recommended). * C++ Dev Tools ## **Option 1: Build the SDK from source using Visual Studio** * Open the *cpp_client_telemetry/Solutions/MSTelemetrySDK.sln* solution in Visual Studio. -* Alternatively, build from the workspace root with the script that matches your Visual Studio toolset: - * Visual Studio 2019: `build-all-v142.bat` - * Visual Studio 2022: `build-all-v143.bat` - * Visual Studio 2026: `build-all-v145.bat` - -The version-specific scripts set `VSTOOLS_VERSION` and `PlatformToolset` before calling `build-all.bat`. If you already have a developer command prompt configured, you can also call `build-all.bat` directly and override `PlatformToolset` yourself. +* Alternatively you can use *build-all.bat* located in workspace root folder to build from command line If your build fails, then you most likely missing the following optional Visual Studio components: diff --git a/tools/vcvars.cmd b/tools/vcvars.cmd index ee8a3a8d1..18ae09e0a 100644 --- a/tools/vcvars.cmd +++ b/tools/vcvars.cmd @@ -8,14 +8,6 @@ REM 2. Visual Studio 2017 BuildTools REM 3. Visual Studio 2019 Enterprise REM 4. Visual Studio 2019 Community REM 5. Visual Studio 2019 BuildTools -REM 6. Visual Studio 2022 Enterprise -REM 7. Visual Studio 2022 Professional -REM 8. Visual Studio 2022 Community -REM 9. Visual Studio 2022 BuildTools -REM 10. Visual Studio 2026 Enterprise -REM 11. Visual Studio 2026 Professional -REM 12. Visual Studio 2026 Community -REM 13. Visual Studio 2026 BuildTools REM REM 1st parameter - Visual Studio version @@ -92,16 +84,6 @@ if exist "%VSDEVCMD%" ( goto tools_configured ) -:vs2022_professional -SET VSVERSION=2022 -set "VSDEVCMD=%ProgramFiles%\Microsoft Visual Studio\2022\Professional\Common7\Tools\VsDevCmd.bat" -if exist "%VSDEVCMD%" ( - set "VSINSTALLDIR=%ProgramFiles%\Microsoft Visual Studio\2022\Professional" - echo Building with vs2022 Professional... - call "%VSDEVCMD%" - goto tools_configured -) - :vs2022_community SET VSVERSION=2022 set "VSDEVCMD=%ProgramFiles%\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd.bat" @@ -112,57 +94,6 @@ if exist "%VSDEVCMD%" ( goto tools_configured ) -:vs2022_buildtools -SET VSVERSION=2022 -set "VSDEVCMD=%ProgramFiles(x86)%\Microsoft Visual Studio\2022\BuildTools\Common7\Tools\VsDevCmd.bat" -if exist "%VSDEVCMD%" ( - set "VSINSTALLDIR=%ProgramFiles(x86)%\Microsoft Visual Studio\2022\BuildTools" - echo Building with vs2022 BuildTools... - call "%VSDEVCMD%" - goto tools_configured -) - -:vs2026 -:vs2026_enterprise -SET VSVERSION=2026 -set "VSDEVCMD=%ProgramFiles%\Microsoft Visual Studio\18\Enterprise\Common7\Tools\VsDevCmd.bat" -if exist "%VSDEVCMD%" ( - set "VSINSTALLDIR=%ProgramFiles%\Microsoft Visual Studio\18\Enterprise" - echo Building with vs2026 Enterprise... - call "%VSDEVCMD%" - goto tools_configured -) - -:vs2026_professional -SET VSVERSION=2026 -set "VSDEVCMD=%ProgramFiles%\Microsoft Visual Studio\18\Professional\Common7\Tools\VsDevCmd.bat" -if exist "%VSDEVCMD%" ( - set "VSINSTALLDIR=%ProgramFiles%\Microsoft Visual Studio\18\Professional" - echo Building with vs2026 Professional... - call "%VSDEVCMD%" - goto tools_configured -) - -:vs2026_community -SET VSVERSION=2026 -set "VSDEVCMD=%ProgramFiles%\Microsoft Visual Studio\18\Community\Common7\Tools\VsDevCmd.bat" -if exist "%VSDEVCMD%" ( - set "VSINSTALLDIR=%ProgramFiles%\Microsoft Visual Studio\18\Community" - echo Building with vs2026 Community... - call "%VSDEVCMD%" - goto tools_configured -) - -:vs2026_buildtools -SET VSVERSION=2026 -set "VSDEVCMD=%ProgramFiles(x86)%\Microsoft Visual Studio\18\BuildTools\Common7\Tools\VsDevCmd.bat" -if exist "%VSDEVCMD%" ( - set "VSINSTALLDIR=%ProgramFiles(x86)%\Microsoft Visual Studio\18\BuildTools" - echo Building with vs2026 BuildTools... - call "%VSDEVCMD%" - goto tools_configured -) - echo WARNING:********************************************* echo WARNING: cannot auto-detect Visual Studio version !!! echo WARNING:********************************************* From 05bc8955009e1230520437aa76491d7d7abc4396 Mon Sep 17 00:00:00 2001 From: Bhagirath Mehta Date: Wed, 3 Jun 2026 04:44:14 -0500 Subject: [PATCH 20/20] Restore zlib CMake 3.5-compatible definitions zlib/CMakeLists.txt still targets old CMake compatibility, but add_compile_definitions requires newer CMake. Restore add_definitions for the Windows preprocessor definitions so the zlib subproject remains compatible with the branch's stated CMake floor. Validation: - cmake configure with CMAKE_POLICY_VERSION_MINIMUM=3.5 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- zlib/CMakeLists.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/zlib/CMakeLists.txt b/zlib/CMakeLists.txt index a72cf3116..cf4d65e5e 100644 --- a/zlib/CMakeLists.txt +++ b/zlib/CMakeLists.txt @@ -239,12 +239,12 @@ endif() if(WIN32) - add_compile_definitions(WIN32) - add_compile_definitions(_CRT_NONSTDC_NO_DEPRECATE) - add_compile_definitions(_CRT_SECURE_NO_DEPRECATE) - add_compile_definitions(_CRT_NONSTDC_NO_WARNINGS) - add_compile_definitions(ZLIB_WINAPI) + add_definitions(-DWIN32) + add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE) + add_definitions(-D_CRT_SECURE_NO_DEPRECATE) + add_definitions(-D_CRT_NONSTDC_NO_WARNINGS) + add_definitions(-DZLIB_WINAPI) if(CMAKE_SIZEOF_VOID_P EQUAL 8) - add_compile_definitions(WIN64) + add_definitions(-DWIN64) endif() endif()