Update the new app template to use CMake instead of Android.mk (#34354)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34354

This change simplifies the setup for New Architecture for users on Android.
Instead of using the Android.mk file, users can now use a CMake file which
encapsulate a lot of the complexities and reduces the maintainance cost.

Android.mk support is kept for backward compatibility.

Changelog:
[Android] [Changed] - Update the new app template to use CMake instead of Android.mk

Reviewed By: cipolleschi

Differential Revision: D38460536

fbshipit-source-id: 9d4c3b15be751921d34023b24c174044537e6f02
This commit is contained in:
Nicola Corti authored and Facebook GitHub Bot committed 2022-08-08 08:10:29 -07:00
1 parent be35c6dafb
commit dfd7f70eff
3 files changed
+21 -79

No files matched your search

@@ -1,53 +0,0 @@
THIS_DIR := $(call my-dir)
include $(REACT_ANDROID_DIR)/Android-prebuilt.mk
# If you wish to add a custom TurboModule or Fabric component in your app you
# will have to include the following autogenerated makefile.
# include $(GENERATED_SRC_DIR)/codegen/jni/Android.mk
# Includes the MK file for autolinked libraries
include $(PROJECT_BUILD_DIR)/generated/rncli/src/main/jni/Android-rncli.mk
include $(CLEAR_VARS)
LOCAL_PATH := $(THIS_DIR)
# You can customize the name of your application .so file here.
LOCAL_MODULE := helloworld_appmodules
# The generated/rncli/src/main/jni folder contains Autolinking support files.
LOCAL_C_INCLUDES := $(LOCAL_PATH) $(PROJECT_BUILD_DIR)/generated/rncli/src/main/jni
LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) $(wildcard $(PROJECT_BUILD_DIR)/generated/rncli/src/main/jni/*.cpp)
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) $(PROJECT_BUILD_DIR)/generated/rncli/src/main/jni
# Here you should add any native library you wish to depend on.
LOCAL_SHARED_LIBRARIES := \
libfabricjni \
libfbjni \
libfolly_runtime \
libglog \
libjsi \
libreact_codegen_rncore \
libreact_debug \
libreact_nativemodule_core \
libreact_render_componentregistry \
libreact_render_core \
libreact_render_debug \
libreact_render_graphics \
librrc_view \
libruntimeexecutor \
libturbomodulejsijni \
libyoga
# Autolinked libraries
LOCAL_SHARED_LIBRARIES += $(call import-codegen-modules)
# If you wish to add a custom TurboModule or Fabric component in your app you
# will have to link against it here:
# LOCAL_SHARED_LIBRARIES += \
# libreact_codegen_<your library name>
LOCAL_CFLAGS := -DLOG_TAG=\"ReactNative\" -fexceptions -frtti -std=c++17 -Wall
include $(BUILD_SHARED_LIBRARY)
@@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 3.13)
# Define the library name here.
project(rntester_appmodules)
# This file includes all the necessary to let you build your application with the New Architecture.
include(${REACT_ANDROID_DIR}/cmake-utils/ReactNative-application.cmake)