From 2c4567562cc234284cf058e85b3efa57971389ee Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Fri, 11 Oct 2024 03:34:54 -0700 Subject: [PATCH] RNGP - Pass PROJECT_ROOT_DIR to CMake (#46958) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/46958 This will make it easier to link against custom C++ TM which will most likely live inside ./shared or some other paths outside of ./android. CMake will have access to `PROJECT_ROOT_DIR` which points to ./android (the folder where the settings.gradle file exists). Changelog: [Internal] [Changed] - RNGP - Pass PROJECT_ROOT_DIR to CMake Reviewed By: cipolleschi Differential Revision: D64183641 fbshipit-source-id: 347256c04f10e92cf5a13e9c70db16aa29bcb741 --- .../kotlin/com/facebook/react/utils/NdkConfiguratorUtils.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/NdkConfiguratorUtils.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/NdkConfiguratorUtils.kt index 86d40a0ebf03da..0191326aed4d53 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/NdkConfiguratorUtils.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/NdkConfiguratorUtils.kt @@ -43,6 +43,9 @@ internal object NdkConfiguratorUtils { if (cmakeArgs.none { it.startsWith("-DPROJECT_BUILD_DIR") }) { cmakeArgs.add("-DPROJECT_BUILD_DIR=${project.layout.buildDirectory.get().asFile}") } + if (cmakeArgs.none { it.startsWith("-DPROJECT_ROOT_DIR") }) { + cmakeArgs.add("-DPROJECT_ROOT_DIR=${project.rootProject.layout.projectDirectory.asFile}") + } if (cmakeArgs.none { it.startsWith("-DREACT_ANDROID_DIR") }) { cmakeArgs.add( "-DREACT_ANDROID_DIR=${extension.reactNativeDir.file("ReactAndroid").get().asFile}")