First Round of CMake files for React Android

Summary:
This is the first round of CMake files to support the React Native build on Android.
They're supposed to eventually replace the various Android.mk files we have around in the codebase.

So far we're not actively using them. This is the first step towards migrating our
setup to use CMake

Changelog:
[Internal] [Changed] - First Round of CMake files for React Android

Reviewed By: ShikaSD

Differential Revision: D34762524

fbshipit-source-id: 6671e203a2c83b8874cefe796aa55aa987902a3b
This commit is contained in:
Nicola Corti
2022-03-11 11:39:23 -08:00
committed by Facebook GitHub Bot
parent 28291461a8
commit b676ca560d
64 changed files with 1708 additions and 1 deletions
@@ -0,0 +1,37 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
cmake_minimum_required(VERSION 3.4.1)
set(CMAKE_VERBOSE_MAKEFILE on)
add_compile_options(-fexceptions -frtti -std=c++17 -Wall -DLOG_TAG=\"Fabric\")
add_library(
mapbufferjni
SHARED
react/common/mapbuffer/OnLoad.cpp
react/common/mapbuffer/ReadableMapBuffer.cpp
)
target_include_directories(mapbufferjni
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/react/common/mapbuffer/
)
target_link_libraries(mapbufferjni
fb
fbjni
folly_futures
folly_json
glog
glog_init
react_debug
react_render_mapbuffer
react_utils
react_config
yoga
)
@@ -0,0 +1,22 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
cmake_minimum_required(VERSION 3.4.1)
set(CMAKE_VERBOSE_MAKEFILE on)
add_compile_options(-fvisibility=hidden -fexceptions -frtti)
add_library(jscexecutor SHARED OnLoad.cpp)
target_include_directories(jscexecutor PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(jscexecutor
jsireact
jscruntime
fb
fbjni
folly_json
jsi
reactnativejni)
@@ -0,0 +1,23 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
cmake_minimum_required(VERSION 3.4.1)
set(CMAKE_VERBOSE_MAKEFILE on)
add_compile_options(-fvisibility=hidden -fexceptions -frtti)
add_library(reactnativeblob SHARED
BlobCollector.cpp
OnLoad.cpp)
target_include_directories(reactnativeblob PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(reactnativeblob
jsireact
fb
fbjni
folly_json
jsi
reactnativejni)
@@ -0,0 +1,24 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
cmake_minimum_required(VERSION 3.4.1)
set(CMAKE_VERBOSE_MAKEFILE on)
add_compile_options(-fexceptions -frtti -std=c++17 -Wall)
add_library(reactperfloggerjni SHARED reactperflogger/OnLoad.cpp)
target_include_directories(reactperfloggerjni
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/reactperflogger
)
target_link_libraries(reactperfloggerjni
fb
fbjni
android
reactperflogger)
@@ -0,0 +1,62 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
cmake_minimum_required(VERSION 3.4.1)
set(CMAKE_VERBOSE_MAKEFILE on)
add_compile_options(
-fexceptions
-frtti
-Wno-unused-lambda-capture
-std=c++17)
#########################
### callinvokerholder ###
#########################
# TODO This should be exported to its own folder hierarchy
add_library(
callinvokerholder
STATIC
ReactCommon/CallInvokerHolder.cpp
)
target_include_directories(callinvokerholder
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
)
target_link_libraries(callinvokerholder
fb
fbjni
runtimeexecutor
callinvoker
reactperfloggerjni)
##################################
### react_nativemodule_manager ###
##################################
# TODO: rename to react_nativemodule_manager
add_library(
turbomodulejsijni
SHARED
ReactCommon/TurboModuleManager.cpp
ReactCommon/OnLoad.cpp
)
target_include_directories(
turbomodulejsijni
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
)
target_link_libraries(turbomodulejsijni
fb
fbjni
jsi
react_nativemodule_core
callinvokerholder
reactperfloggerjni)
@@ -0,0 +1,28 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
cmake_minimum_required(VERSION 3.4.1)
set(CMAKE_VERBOSE_MAKEFILE on)
add_compile_options(-fexceptions -frtti -std=c++17 -Wall -DLOG_TAG=\"ReactNative\")
add_library(uimanagerjni SHARED
OnLoad.cpp
ComponentNameResolverManager.cpp)
target_include_directories(uimanagerjni PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(uimanagerjni
fb
fbjni
folly_futures
folly_json
glog
glog_init
rrc_native
yoga
callinvokerholder
reactnativejni
react_render_componentregistry)