Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,21 @@ option(LINK_STATIC_DEPENDS "Link dependencies for static build" YES)
# Enable Azure Monitor / Application Insights end-point support
option(BUILD_AZMON "Build for Azure Monitor" YES)

# Common Schema 4.0 (CS4) protocol support (CS3 by default). HAVE_CS4 toggles
# optional CsProtocol fields whose presence changes the public struct layout, so
# it is applied as a PUBLIC compile definition on the exported target (see
# lib/CMakeLists.txt) to keep the SDK and its consumers in sync. HAVE_CS4_FULL
# adds server/service extensions and implies HAVE_CS4.
option(MATSDK_HAVE_CS4 "Build with Common Schema 4.0 (CS4) support" OFF)
option(MATSDK_HAVE_CS4_FULL "Build with CS4 plus server/service extensions" OFF)
# CS4_FULL requires CS4. Force the options consistent so the cache state and any
# downstream checks of MATSDK_HAVE_CS4 are reliable (rather than relying on a
# downstream OR).
if(MATSDK_HAVE_CS4_FULL AND NOT MATSDK_HAVE_CS4)
message(STATUS "MATSDK_HAVE_CS4_FULL implies MATSDK_HAVE_CS4; enabling MATSDK_HAVE_CS4.")
set(MATSDK_HAVE_CS4 ON CACHE BOOL "Build with Common Schema 4.0 (CS4) support" FORCE)
endif()

if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
option(BUILD_APPLE_HTTP "Build Apple HTTP client" YES)
endif()
Expand Down
4 changes: 2 additions & 2 deletions docs/building-custom-SKU.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ Build recipe must contain the following preprocessor definitions:
| HAVE_MAT_STORAGE | on | Enable SQLite persistent offline storage |
| HAVE_MAT_NETDETECT | on | _Win32 Desktop only_: Use NLM COM object for network cost detection on Windows 8+ |
| HAVE_MAT_SHORT_NS | off | Use short "MAT::" namespace instead of "Microsoft::Applications::Events::" to reduce the .DLL size |
| HAVE_CS4 | off | Build with Common Schema 4.0 support. Current default is `off`, i.e. building with Common Schema 3.0 support |
| HAVE_CS4_FULL | off | Enable additional Common Schema 4.0 protocol features needed by server / services SDK |
| HAVE_CS4 | off | Preprocessor define enabling Common Schema 4.0 (CS3 by default). Any build system can define it (e.g. via a custom config header or compiler flag); CMake builds should prefer `-DMATSDK_HAVE_CS4=ON`, which defines `HAVE_CS4` and propagates it to consumers via the exported `MSTelemetry::mat` target. It changes the public CsProtocol struct layout and must match across the SDK and its consumers. |
| HAVE_CS4_FULL | off | Preprocessor define adding the Common Schema 4.0 server / services extensions (implies `HAVE_CS4`). CMake builds should use `-DMATSDK_HAVE_CS4_FULL=ON`. |
| COMPACT_SDK | off | Built-in build recipe for smallest possible SDK. Turns most features off. Includes_mat/config-compact.h_ |

## Building custom SDK SKU: MSBuild example
Expand Down
13 changes: 13 additions & 0 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,19 @@ target_include_directories(mat
${CMAKE_CURRENT_SOURCE_DIR}/utils
)

# Common Schema 4.0 support. HAVE_CS4 toggles optional CsProtocol fields whose
# presence changes the public struct layout, so it must be defined consistently
# across the SDK and its consumers. Expose it as a PUBLIC (propagating) compile
# definition on the exported target rather than a raw build flag, so consumers
# linking MSTelemetry::mat inherit it automatically. MATSDK_HAVE_CS4_FULL forces
# MATSDK_HAVE_CS4 on in the root CMakeLists, so checking MATSDK_HAVE_CS4 suffices.
if(MATSDK_HAVE_CS4)
target_compile_definitions(mat PUBLIC HAVE_CS4)
endif()
if(MATSDK_HAVE_CS4_FULL)
target_compile_definitions(mat PUBLIC HAVE_CS4_FULL)
endif()

if(APPLE AND BUILD_OBJC_WRAPPER)
if(MATSDK_OBJC_PRIVACYGUARD_AVAILABLE)
target_compile_definitions(mat PRIVATE MATSDK_OBJC_PRIVACYGUARD_AVAILABLE=1)
Expand Down
Loading