From a969a5ccc6e1a57840def65ba709e2b937256859 Mon Sep 17 00:00:00 2001 From: Bhagirath Mehta Date: Wed, 10 Jun 2026 23:07:52 -0500 Subject: [PATCH 1/2] Add -PHAVE_CS4 Gradle property for Android CS4 builds Map the -PHAVE_CS4 / -PHAVE_CS4_FULL Gradle properties (and the HAVE_CS4 / HAVE_CS4_FULL environment variables) to the MATSDK_HAVE_CS4 / MATSDK_HAVE_CS4_FULL CMake options, mirroring the existing USE_ROOM dedicated parameter. This is the discoverable, propagating way to enable Common Schema 4.0 on Android instead of stuffing a raw -DHAVE_CS4=1 into CXXFLAGS. Depends on #1476 (adds the MATSDK_HAVE_CS4 option); inert until that lands. - maesdk/build.gradle: -PHAVE_CS4[_FULL] -> -DMATSDK_HAVE_CS4[_FULL]=ON - gradle.properties: document the dedicated property Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- lib/android_build/gradle.properties | 4 +++- lib/android_build/maesdk/build.gradle | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/android_build/gradle.properties b/lib/android_build/gradle.properties index 4cce3a271..56af61498 100644 --- a/lib/android_build/gradle.properties +++ b/lib/android_build/gradle.properties @@ -17,6 +17,8 @@ org.gradle.jvmargs=-Xmx1536m android.useAndroidX=true # Automatically convert third-party libraries to use AndroidX android.enableJetifier=true -# Uncomment CXXFLAGS to set CXX flags +# Enable Common Schema 4.0 via the dedicated property (preferred): +# ./gradlew -PHAVE_CS4=1 (or -PHAVE_CS4_FULL=1) +# Or pass arbitrary CXX flags via CXXFLAGS (uncomment): # CXXFLAGS=-DHAVE_CS4=1 diff --git a/lib/android_build/maesdk/build.gradle b/lib/android_build/maesdk/build.gradle index 714dac0df..62371a0c2 100644 --- a/lib/android_build/maesdk/build.gradle +++ b/lib/android_build/maesdk/build.gradle @@ -27,6 +27,18 @@ android { if (!cxxFlag.isEmpty()) { args.add("-DCMAKE_CXX_FLAGS=\"" + cxxFlag + "\"") } + // Common Schema 4.0: -PHAVE_CS4=1 (or HAVE_CS4 env) maps to the + // MATSDK_HAVE_CS4 CMake option (preferred over a raw CXX flag, and + // propagated to consumers via the exported target). HAVE_CS4_FULL + // adds the server/service extensions. + String haveCs4 = project.findProperty("HAVE_CS4") ?: System.getenv("HAVE_CS4") ?: "" + if (haveCs4.equalsIgnoreCase("1") || haveCs4.equalsIgnoreCase("true") || haveCs4.equalsIgnoreCase("on")) { + args.add("-DMATSDK_HAVE_CS4=ON") + } + String haveCs4Full = project.findProperty("HAVE_CS4_FULL") ?: System.getenv("HAVE_CS4_FULL") ?: "" + if (haveCs4Full.equalsIgnoreCase("1") || haveCs4Full.equalsIgnoreCase("true") || haveCs4Full.equalsIgnoreCase("on")) { + args.add("-DMATSDK_HAVE_CS4_FULL=ON") + } // Passes optional arguments to CMake. arguments args.toArray(new String[args.size()]) println "cmake flag: " + arguments From b4fd4fe87e189ed55237808996c0589dfbf9203e Mon Sep 17 00:00:00 2001 From: Bhagirath Mehta Date: Wed, 10 Jun 2026 23:28:06 -0500 Subject: [PATCH 2/2] android: address Copilot round-1 - CS4_FULL also enables base CS4 build.gradle: when -PHAVE_CS4_FULL (or env) is set, also add -DMATSDK_HAVE_CS4=ON so the Gradle mapping does not rely on the CMake-side implication (cs4 = cs4Full || cs4). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- lib/android_build/maesdk/build.gradle | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/android_build/maesdk/build.gradle b/lib/android_build/maesdk/build.gradle index 62371a0c2..77a3a484a 100644 --- a/lib/android_build/maesdk/build.gradle +++ b/lib/android_build/maesdk/build.gradle @@ -32,11 +32,15 @@ android { // propagated to consumers via the exported target). HAVE_CS4_FULL // adds the server/service extensions. String haveCs4 = project.findProperty("HAVE_CS4") ?: System.getenv("HAVE_CS4") ?: "" - if (haveCs4.equalsIgnoreCase("1") || haveCs4.equalsIgnoreCase("true") || haveCs4.equalsIgnoreCase("on")) { + String haveCs4Full = project.findProperty("HAVE_CS4_FULL") ?: System.getenv("HAVE_CS4_FULL") ?: "" + boolean cs4Full = haveCs4Full.equalsIgnoreCase("1") || haveCs4Full.equalsIgnoreCase("true") || haveCs4Full.equalsIgnoreCase("on") + // CS4_FULL implies CS4, so enable the base option too rather than + // relying on the CMake-side implication. + boolean cs4 = cs4Full || haveCs4.equalsIgnoreCase("1") || haveCs4.equalsIgnoreCase("true") || haveCs4.equalsIgnoreCase("on") + if (cs4) { args.add("-DMATSDK_HAVE_CS4=ON") } - String haveCs4Full = project.findProperty("HAVE_CS4_FULL") ?: System.getenv("HAVE_CS4_FULL") ?: "" - if (haveCs4Full.equalsIgnoreCase("1") || haveCs4Full.equalsIgnoreCase("true") || haveCs4Full.equalsIgnoreCase("on")) { + if (cs4Full) { args.add("-DMATSDK_HAVE_CS4_FULL=ON") } // Passes optional arguments to CMake.