Skip to content
Open
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
3 changes: 3 additions & 0 deletions packages/react-native-nitro-modules/android/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ add_library(NitroModules SHARED
${android_files}
)

include("${REACT_NATIVE_DIR}/ReactCommon/cmake-utils/react-native-flags.cmake")
target_compile_reactnative_options(NitroModules PRIVATE)

set(NITRO_SANITIZER "" CACHE STRING "Native sanitizer")
if(NITRO_SANITIZER STREQUAL "address")
target_compile_options(NitroModules PUBLIC -fsanitize=address -fno-omit-frame-pointer)
Expand Down
11 changes: 10 additions & 1 deletion packages/react-native-nitro-modules/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ def getExtOrIntegerDefault(name) {
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["Nitro_" + name]).toInteger()
}

def reactNativePackageOutput = providers.exec {
workingDir(rootDir)
commandLine("node", "--print", "require.resolve('react-native/package.json')")
}
def reactNativePackagePath = reactNativePackageOutput.standardOutput.asText.get()
reactNativePackagePath = reactNativePackagePath.trim()
def reactNativePackageFile = file(reactNativePackagePath)
def reactNativeDir = reactNativePackageFile.parentFile.absolutePath

logger.warn("[NitroModules] 🔥 Your app is boosted by nitro modules!")

android {
Expand All @@ -52,7 +61,7 @@ android {
externalNativeBuild {
cmake {
cppFlags "-frtti -fexceptions -Wall -Wextra -fstack-protector-all"
arguments "-DANDROID_STL=c++_shared", "-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON", "-DNITRO_SANITIZER=${rootProject.findProperty('nitroSanitizer') ?: ''}"
arguments "-DANDROID_STL=c++_shared", "-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON", "-DNITRO_SANITIZER=${rootProject.findProperty('nitroSanitizer') ?: ''}", "-DREACT_NATIVE_DIR=${reactNativeDir}"
abiFilters (*reactNativeArchitectures())

buildTypes {
Expand Down
Loading