From aefc201b3bd4dc7f55d6205747bd5850d03b9e5d Mon Sep 17 00:00:00 2001 From: timbocole Date: Thu, 19 Dec 2024 14:28:14 +0000 Subject: [PATCH 1/2] Prioritise local cpp (use default as fallback) --- .../cmake-utils/ReactNative-application.cmake | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake b/packages/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake index 19dd6d632a131b..2ad57ffe57f650 100644 --- a/packages/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake +++ b/packages/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake @@ -39,9 +39,16 @@ if (PROJECT_ROOT_DIR) # variable is defined if user need to access it. endif () -file(GLOB input_SRC CONFIGURE_DEPENDS - ${REACT_ANDROID_DIR}/cmake-utils/default-app-setup/*.cpp - ${BUILD_DIR}/generated/autolinking/src/main/jni/*.cpp) +file(GLOB override_cpp_SRC CONFIGURE_DEPENDS *.cpp) +if(override_cpp_SRC) + file(GLOB input_SRC CONFIGURE_DEPENDS + *.cpp + ${BUILD_DIR}/generated/autolinking/src/main/jni/*.cpp) +else() + file(GLOB input_SRC CONFIGURE_DEPENDS + ${REACT_ANDROID_DIR}/cmake-utils/default-app-setup/*.cpp + ${BUILD_DIR}/generated/autolinking/src/main/jni/*.cpp) +endif() add_library(${CMAKE_PROJECT_NAME} SHARED ${input_SRC}) From 3048899dd658ced5cbe0e4d2e3c0ce5bc4475a11 Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Tue, 31 Dec 2024 11:55:40 +0000 Subject: [PATCH 2/2] Update packages/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake --- .../ReactAndroid/cmake-utils/ReactNative-application.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake b/packages/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake index 2ad57ffe57f650..c29cfe392abb15 100644 --- a/packages/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake +++ b/packages/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake @@ -40,6 +40,9 @@ if (PROJECT_ROOT_DIR) endif () file(GLOB override_cpp_SRC CONFIGURE_DEPENDS *.cpp) +# We check if the user is providing a custom OnLoad.cpp file. If so, we pick that +# for compilation. Otherwise we fallback to using the `default-app-setup/OnLoad.cpp` +# file instead. if(override_cpp_SRC) file(GLOB input_SRC CONFIGURE_DEPENDS *.cpp