From 69e8d3d88398b5a9e15eac668a302eba56f71a11 Mon Sep 17 00:00:00 2001 From: Andrei Shikov Date: Thu, 17 Mar 2022 17:08:24 -0700 Subject: [PATCH] Build Fabric with CMake Summary: More CMake configurations mirroring Android.mk in place. Changelog: [Internal] - Build fabricjni with CMake Reviewed By: cortinico Differential Revision: D34927238 fbshipit-source-id: 929763ec79a7c168e300e065709a49e4b373326a --- .../facebook/react/fabric/jni/CMakeLists.txt | 70 +++++++++++++++++++ .../renderer/components/modal/CMakeLists.txt | 31 ++++++++ .../components/progressbar/CMakeLists.txt | 34 +++++++++ .../renderer/components/slider/CMakeLists.txt | 38 ++++++++++ .../renderer/components/switch/CMakeLists.txt | 44 ++++++++++++ .../components/textinput/CMakeLists.txt | 2 - 6 files changed, 217 insertions(+), 2 deletions(-) create mode 100644 ReactAndroid/src/main/java/com/facebook/react/fabric/jni/CMakeLists.txt create mode 100644 ReactCommon/react/renderer/components/modal/CMakeLists.txt create mode 100644 ReactCommon/react/renderer/components/progressbar/CMakeLists.txt create mode 100644 ReactCommon/react/renderer/components/slider/CMakeLists.txt create mode 100644 ReactCommon/react/renderer/components/switch/CMakeLists.txt diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/CMakeLists.txt b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/CMakeLists.txt new file mode 100644 index 00000000000..7afd884900a --- /dev/null +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/CMakeLists.txt @@ -0,0 +1,70 @@ +# 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.13) + +file(GLOB fabricjni_SRCS CONFIGURE_DEPENDS *.cpp) + +add_library( + fabricjni + SHARED + ${fabricjni_SRCS} +) + +target_include_directories(fabricjni PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) + +target_link_libraries( + fabricjni + butter + fb + fbjni + folly_runtime + glog + glog_init + jsi + mapbufferjni + react_codegen_rncore + react_debug + react_render_animations + react_render_attributedstring + react_render_componentregistry + react_render_core + react_render_debug + react_render_graphics + react_render_imagemanager + react_render_mapbuffer + react_render_mounting + react_render_runtimescheduler + react_render_scheduler + react_render_telemetry + react_render_templateprocessor + react_render_textlayoutmanager + react_render_uimanager + react_utils + react_config + reactnativeutilsjni + rrc_image + rrc_modal + rrc_progressbar + rrc_root + rrc_scrollview + rrc_slider + rrc_switch + rrc_text + rrc_textinput + rrc_unimplementedview + rrc_view + yoga +) + +target_compile_options( + fabricjni + PRIVATE + -DLOG_TAG=\"Fabric\" + -fexceptions + -frtti + -std=c++17 + -Wall +) diff --git a/ReactCommon/react/renderer/components/modal/CMakeLists.txt b/ReactCommon/react/renderer/components/modal/CMakeLists.txt new file mode 100644 index 00000000000..8f596972539 --- /dev/null +++ b/ReactCommon/react/renderer/components/modal/CMakeLists.txt @@ -0,0 +1,31 @@ +# 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.13) +set(CMAKE_VERBOSE_MAKEFILE on) + +add_compile_options(-fexceptions -frtti -std=c++17 -Wall -DLOG_TAG=\"Fabric\") + +file(GLOB rrc_modal_SRC CONFIGURE_DEPENDS *.cpp) +add_library(rrc_modal STATIC ${rrc_modal_SRC}) + +target_include_directories(rrc_modal PUBLIC ${REACT_COMMON_DIR}) + +target_link_libraries(rrc_modal + glog + folly_runtime + glog_init + react_codegen_rncore + react_render_componentregistry + react_render_core + react_render_debug + react_render_graphics + react_render_imagemanager + react_render_mapbuffer + react_render_uimanager + rrc_image + rrc_view + yoga +) diff --git a/ReactCommon/react/renderer/components/progressbar/CMakeLists.txt b/ReactCommon/react/renderer/components/progressbar/CMakeLists.txt new file mode 100644 index 00000000000..c1bc726cf9c --- /dev/null +++ b/ReactCommon/react/renderer/components/progressbar/CMakeLists.txt @@ -0,0 +1,34 @@ +# 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.13) +set(CMAKE_VERBOSE_MAKEFILE on) + +add_compile_options(-fexceptions -frtti -std=c++17 -Wall -DLOG_TAG=\"Fabric\") + +file(GLOB rrc_progressbar_SRC CONFIGURE_DEPENDS android/react/renderer/components/progressbar/*.cpp) +add_library(rrc_progressbar STATIC ${rrc_progressbar_SRC}) + +target_include_directories(rrc_progressbar + PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR}/android/ +) + +target_link_libraries(rrc_progressbar + glog + fbjni + folly_runtime + glog_init + react_codegen_rncore + react_debug + react_render_componentregistry + react_render_core + react_render_debug + react_render_graphics + react_render_uimanager + reactnativeutilsjni + rrc_view + yoga +) diff --git a/ReactCommon/react/renderer/components/slider/CMakeLists.txt b/ReactCommon/react/renderer/components/slider/CMakeLists.txt new file mode 100644 index 00000000000..059ece7dade --- /dev/null +++ b/ReactCommon/react/renderer/components/slider/CMakeLists.txt @@ -0,0 +1,38 @@ +# 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.13) +set(CMAKE_VERBOSE_MAKEFILE on) + +add_compile_options(-fexceptions -frtti -std=c++17 -Wall -DLOG_TAG=\"Fabric\") + +file(GLOB rrc_slider_SRC CONFIGURE_DEPENDS *.cpp platform/android/react/renderer/components/slider/*.cpp) +add_library(rrc_slider STATIC ${rrc_slider_SRC}) + +target_include_directories(rrc_slider + PUBLIC + ${REACT_COMMON_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/platform/android/ +) + +target_link_libraries(rrc_slider + glog + fbjni + folly_runtime + glog_init + react_codegen_rncore + react_debug + react_render_componentregistry + react_render_core + react_render_debug + react_render_graphics + react_render_imagemanager + react_render_mapbuffer + react_render_uimanager + reactnativeutilsjni + rrc_image + rrc_view + yoga +) diff --git a/ReactCommon/react/renderer/components/switch/CMakeLists.txt b/ReactCommon/react/renderer/components/switch/CMakeLists.txt new file mode 100644 index 00000000000..f4a251343f9 --- /dev/null +++ b/ReactCommon/react/renderer/components/switch/CMakeLists.txt @@ -0,0 +1,44 @@ +# 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.13) + +file(GLOB rrc_switch_SRCS CONFIGURE_DEPENDS androidswitch/react/renderer/components/androidswitch/*.cpp) + +add_library( + rrc_switch + STATIC + ${rrc_switch_SRCS} +) + +target_include_directories(rrc_switch PUBLIC androidswitch/) + +target_link_libraries( + rrc_switch + glog + fbjni + folly_runtime + glog_init + react_codegen_rncore + react_debug + react_render_componentregistry + react_render_core + react_render_debug + react_render_graphics + react_render_uimanager + reactnativeutilsjni + rrc_view + yoga +) + +target_compile_options( + rrc_switch + PRIVATE + -DLOG_TAG=\"Fabric\" + -fexceptions + -frtti + -std=c++17 + -Wall +) diff --git a/ReactCommon/react/renderer/components/textinput/CMakeLists.txt b/ReactCommon/react/renderer/components/textinput/CMakeLists.txt index 863494fc417..84826c23d3f 100644 --- a/ReactCommon/react/renderer/components/textinput/CMakeLists.txt +++ b/ReactCommon/react/renderer/components/textinput/CMakeLists.txt @@ -14,8 +14,6 @@ add_library(rrc_textinput SHARED ${rrc_textinput_SRC}) target_include_directories(rrc_textinput PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/androidtextinput/ - PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR}/androidtextinput/react/renderer/components/androidtextinput/ ) target_link_libraries(rrc_textinput