-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
1 parent
2829146
commit b676ca5
Showing
64 changed files
with
1,708 additions
and
1 deletion.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer/jni/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
) |
22 changes: 22 additions & 0 deletions
22
ReactAndroid/src/main/java/com/facebook/react/jscexecutor/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
23 changes: 23 additions & 0 deletions
23
ReactAndroid/src/main/java/com/facebook/react/modules/blob/jni/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
24 changes: 24 additions & 0 deletions
24
ReactAndroid/src/main/java/com/facebook/react/reactperflogger/jni/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
62 changes: 62 additions & 0 deletions
62
ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
28 changes: 28 additions & 0 deletions
28
ReactAndroid/src/main/java/com/facebook/react/uimanager/jni/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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_library(fb | ||
SHARED | ||
assert.cpp | ||
log.cpp) | ||
|
||
add_compile_options( | ||
-DLOG_TAG=\"libfb\" | ||
-DDISABLE_CPUCAP | ||
-DDISABLE_XPLAT | ||
-fexceptions | ||
-frtti | ||
-Wno-unused-parameter | ||
-Wno-error=unused-but-set-variable | ||
-DHAVE_POSIX_CLOCKS | ||
) | ||
|
||
# Yogacore needs to link towards android and log from the NDK libs | ||
target_link_libraries(fb dl android log) | ||
|
||
target_include_directories(fb PUBLIC include) |
15 changes: 15 additions & 0 deletions
15
ReactAndroid/src/main/jni/first-party/fbgloginit/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# 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 -fno-omit-frame-pointer) | ||
|
||
add_library(glog_init SHARED glog_init.cpp) | ||
|
||
target_include_directories(yoga PUBLIC .) | ||
|
||
target_link_libraries(glog_init log glog) |
15 changes: 15 additions & 0 deletions
15
ReactAndroid/src/main/jni/first-party/fbjni/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# 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_library(fbjni SHARED IMPORTED GLOBAL) | ||
set_target_properties(fbjni | ||
PROPERTIES | ||
IMPORTED_LOCATION | ||
${CMAKE_CURRENT_SOURCE_DIR}/jni/${ANDROID_ABI}/libfbjni.so) | ||
|
||
target_include_directories(fbjni INTERFACE headers) |
13 changes: 13 additions & 0 deletions
13
ReactAndroid/src/main/jni/first-party/hermes/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# 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_library(hermes SHARED IMPORTED GLOBAL) | ||
set_target_properties(hermes | ||
PROPERTIES | ||
IMPORTED_LOCATION | ||
${CMAKE_CURRENT_SOURCE_DIR}/jni/${ANDROID_ABI}/libhermes.so) |
20 changes: 20 additions & 0 deletions
20
ReactAndroid/src/main/jni/first-party/yogajni/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# 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 | ||
-O3) | ||
|
||
file(GLOB_RECURSE yoga_SRC jni/*.cpp) | ||
add_library(yoga SHARED ${yoga_SRC}) | ||
|
||
target_include_directories(yoga PUBLIC jni) | ||
|
||
target_link_libraries(yoga yogacore fb fbjni log android) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# 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) | ||
|
||
# TODO Those two libraries are building against the same sources | ||
# and should probably be merged | ||
file(GLOB reactnativejni_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) | ||
|
||
add_compile_options( | ||
-fexceptions | ||
-frtti | ||
-Wno-unused-lambda-capture | ||
-std=c++17) | ||
|
||
########################## | ||
### React Native Utils ### | ||
########################## | ||
|
||
add_library( | ||
reactnativeutilsjni | ||
SHARED | ||
${reactnativejni_SRC} | ||
) | ||
|
||
# TODO This should not be ../../ | ||
target_include_directories(reactnativeutilsjni PUBLIC ../../) | ||
|
||
target_link_libraries(reactnativeutilsjni | ||
android | ||
callinvokerholder | ||
fb | ||
fbjni | ||
folly_json | ||
glog_init | ||
react_render_runtimescheduler | ||
reactnative | ||
runtimeexecutor | ||
yoga | ||
) | ||
|
||
###################### | ||
### reactnativejni ### | ||
###################### | ||
|
||
|
||
add_library( | ||
reactnativejni | ||
SHARED | ||
${reactnativejni_SRC} | ||
) | ||
|
||
# TODO This should not be ../../ | ||
target_include_directories(reactnativejni PUBLIC ../../) | ||
|
||
target_link_libraries(reactnativejni | ||
android | ||
callinvokerholder | ||
fb | ||
fbjni | ||
folly_json | ||
glog_init | ||
logger | ||
react_render_runtimescheduler | ||
reactnative | ||
reactnativeutilsjni | ||
runtimeexecutor | ||
yoga | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.