diff --git a/packages/react-native/ReactCommon/react/renderer/observers/events/CMakeLists.txt b/packages/react-native/ReactCommon/react/renderer/observers/events/CMakeLists.txt index 02dcd45a190..44127354c96 100644 --- a/packages/react-native/ReactCommon/react/renderer/observers/events/CMakeLists.txt +++ b/packages/react-native/ReactCommon/react/renderer/observers/events/CMakeLists.txt @@ -20,6 +20,7 @@ target_link_libraries(react_renderer_observers_events react_renderer_runtimescheduler react_featureflags react_renderer_uimanager - react_utils) + react_utils + rrc_view) target_compile_reactnative_options(react_renderer_observers_events PRIVATE) target_compile_options(react_renderer_observers_events PRIVATE -Wpedantic) diff --git a/packages/react-native/gradle/libs.versions.toml b/packages/react-native/gradle/libs.versions.toml index 59db5cb8c22..7fd10e6ce94 100644 --- a/packages/react-native/gradle/libs.versions.toml +++ b/packages/react-native/gradle/libs.versions.toml @@ -47,6 +47,7 @@ fmt="11.0.2" folly="2024.11.18.00" glog="0.3.5" gflags="2.2.0" +nlohmannjson="3.11.2" [libraries] androidx-annotation = { module = "androidx.annotation:annotation", version.ref = "androidx-annotation" } diff --git a/private/react-native-fantom/build.gradle.kts b/private/react-native-fantom/build.gradle.kts index 36ca5d6b79a..6b68d755ba0 100644 --- a/private/react-native-fantom/build.gradle.kts +++ b/private/react-native-fantom/build.gradle.kts @@ -15,7 +15,9 @@ plugins { alias(libs.plugins.download) } +val FOLLY_VERSION = libs.versions.folly.get() val GFLAGS_VERSION = libs.versions.gflags.get() +val NLOHMANNJSON_VERSION = libs.versions.nlohmannjson.get() val buildDir = project.layout.buildDirectory.get().asFile val downloadsDir = @@ -27,6 +29,8 @@ val downloadsDir = val thirdParty = File("$buildDir/third-party") val reactNativeRootDir = projectDir.parentFile.parentFile val reactAndroidBuildDir = File("$reactNativeRootDir/packages/react-native/ReactAndroid/build") +val reactAndroidDownloasdDir = + File("$reactNativeRootDir/packages/react-native/ReactAndroid/build/downloads") val createNativeDepsDirectories by tasks.registering { @@ -34,6 +38,19 @@ val createNativeDepsDirectories by thirdParty.mkdirs() } +val downloadFollyDest = File(reactAndroidDownloasdDir, "folly-${FOLLY_VERSION}.tar.gz") + +val prepareFolly by + tasks.registering(Copy::class) { + dependsOn(listOf(":packages:react-native:ReactAndroid:downloadFolly")) + from(tarTree(downloadFollyDest)) + from("tester/third-party/folly/") + include("folly-${FOLLY_VERSION}/folly/**/*", "CMakeLists.txt") + eachFile { path = path.substringAfter("/") } + includeEmptyDirs = false + into("$thirdParty/folly") + } + val downloadGflagsDest = File(downloadsDir, "gflags-${GFLAGS_VERSION}.tar.gz") val downloadGflags by tasks.registering(Download::class) { @@ -55,16 +72,42 @@ val prepareGflags by outputDir.set(File(thirdParty, "gflags")) } -var codegenSrcDir = File("$reactAndroidBuildDir/generated/source/codegen/jni/react") -var codegenOutDir = File("$buildDir/codegen/react") +val downloadNlohmannJsonDest = File(downloadsDir, "nlohmann_json-${NLOHMANNJSON_VERSION}.tar.gz") +val downloadNlohmannJson by + tasks.registering(Download::class) { + dependsOn(createNativeDepsDirectories) + src("https://github.com/nlohmann/json/archive/v${NLOHMANNJSON_VERSION}.tar.gz") + onlyIfModified(true) + overwrite(false) + retries(5) + quiet(true) + dest(downloadNlohmannJsonDest) + } + +val prepareNlohmannJson by + tasks.registering(Copy::class) { + dependsOn(listOf(downloadNlohmannJson)) + from(tarTree(downloadNlohmannJsonDest)) + from("tester/third-party/nlohmann_json/") + include( + "json-${NLOHMANNJSON_VERSION}/src/**/*", + "json-${NLOHMANNJSON_VERSION}/include/**/*", + "CMakeLists.txt") + eachFile { path = path.substringAfter("/") } + includeEmptyDirs = false + into("$thirdParty/nlohmann_json") + } + +var codegenSrcDir = File("$reactAndroidBuildDir/generated/source/codegen/jni") +var codegenOutDir = File("$buildDir/codegen") val prepareRNCodegen by tasks.registering(Copy::class) { dependsOn(":packages:react-native:ReactAndroid:generateCodegenArtifactsFromSchema") from(codegenSrcDir) - from("tester/codegen/react") - include( - "**/FBReactNativeSpecJSI.h", "**/FBReactNativeSpecJSI-generated.cpp", "CMakeLists.txt") + from("tester/codegen") + include("react/**/*.h", "react/**/*.cpp", "CMakeLists.txt") includeEmptyDirs = false + duplicatesStrategy = DuplicatesStrategy.INCLUDE into(codegenOutDir) } @@ -80,7 +123,13 @@ val prepareNative3pDependencies by tasks.registering { dependsOn( prepareGflags, - ":packages:react-native:ReactAndroid:prepareNative3pDependencies", + prepareNlohmannJson, + prepareFolly, + ":packages:react-native:ReactAndroid:prepareBoost", + ":packages:react-native:ReactAndroid:prepareDoubleConversion", + ":packages:react-native:ReactAndroid:prepareFastFloat", + ":packages:react-native:ReactAndroid:prepareFmt", + ":packages:react-native:ReactAndroid:prepareGlog", ) } diff --git a/private/react-native-fantom/tester/CMakeLists.txt b/private/react-native-fantom/tester/CMakeLists.txt index 850d70b400c..477a9ee262f 100644 --- a/private/react-native-fantom/tester/CMakeLists.txt +++ b/private/react-native-fantom/tester/CMakeLists.txt @@ -8,6 +8,7 @@ set(CMAKE_VERBOSE_MAKEFILE on) project(fantom_tester) find_library(LIB_HERMES libhermes + NAMES hermes HINTS ${REACT_ANDROID_DIR}/hermes-engine/build/hermes/API/hermes REQUIRED) # Ensure the library path is correct and the library exists @@ -26,6 +27,8 @@ else() add_library(hermes-engine::libhermes ALIAS ${LIB_HERMES}) endif() +find_package(OpenSSL REQUIRED) + include_directories(${REACT_ANDROID_DIR}/hermes-engine/build/prefab-headers) include(${REACT_COMMON_DIR}/cmake-utils/react-native-flags.cmake) @@ -42,16 +45,20 @@ add_react_third_party_ndk_subdir(glog) add_react_third_party_ndk_subdir(double-conversion) add_react_third_party_ndk_subdir(fast_float) add_react_third_party_ndk_subdir(fmt) -add_react_third_party_ndk_subdir(folly) +add_fantom_third_party_subdir(folly) add_fantom_third_party_subdir(gflags) +add_fantom_third_party_subdir(nlohmann_json) -add_fantom_codegen_subdir(react) +add_subdirectory(${FANTOM_CODEGEN_DIR} codegen) + +add_library(glog_init INTERFACE) -#add_react_common_subdir(hermes/executor) -#add_react_common_subdir(hermes/inspector-modern) -#add_react_common_subdir(react/runtime/hermes) add_react_common_subdir(callinvoker) add_react_common_subdir(cxxreact) +add_react_common_subdir(devtoolsruntimesettings) +add_react_common_subdir(hermes/executor) +add_react_common_subdir(hermes/inspector-modern) +add_react_common_subdir(jserrorhandler) add_react_common_subdir(jsi) add_react_common_subdir(jsiexecutor) add_react_common_subdir(jsinspector-modern) @@ -64,32 +71,102 @@ add_react_common_subdir(oscompat) add_react_common_subdir(react/bridging) add_react_common_subdir(react/debug) add_react_common_subdir(react/featureflags) +add_react_common_subdir(react/nativemodule/core) +add_react_common_subdir(react/nativemodule/cputime) +add_react_common_subdir(react/nativemodule/defaults) +add_react_common_subdir(react/nativemodule/devtoolsruntimesettings) +add_react_common_subdir(react/nativemodule/dom) +add_react_common_subdir(react/nativemodule/fantomtestspecificmethods) +add_react_common_subdir(react/nativemodule/featureflags) +add_react_common_subdir(react/nativemodule/idlecallbacks) +add_react_common_subdir(react/nativemodule/intersectionobserver) +add_react_common_subdir(react/nativemodule/microtasks) +add_react_common_subdir(react/nativemodule/mutationobserver) +add_react_common_subdir(react/nativemodule/webperformance) add_react_common_subdir(react/performance/timeline) +add_react_common_subdir(react/renderer/attributedstring) +add_react_common_subdir(react/renderer/bridging) +add_react_common_subdir(react/renderer/componentregistry) +add_react_common_subdir(react/renderer/componentregistry/native) +add_react_common_subdir(react/renderer/components/image) +add_react_common_subdir(react/renderer/components/legacyviewmanagerinterop) +add_react_common_subdir(react/renderer/components/modal) +add_react_common_subdir(react/renderer/components/root) +add_react_common_subdir(react/renderer/components/scrollview) +add_react_common_subdir(react/renderer/components/text) +add_react_common_subdir(react/renderer/components/view) +add_react_common_subdir(react/renderer/consistency) +add_react_common_subdir(react/renderer/core) +add_react_common_subdir(react/renderer/css) +add_react_common_subdir(react/renderer/debug) +add_react_common_subdir(react/renderer/dom) +add_react_common_subdir(react/renderer/graphics) +add_react_common_subdir(react/renderer/imagemanager) +add_react_common_subdir(react/renderer/leakchecker) +add_react_common_subdir(react/renderer/mapbuffer) +add_react_common_subdir(react/renderer/mounting) +add_react_common_subdir(react/renderer/observers/events) +add_react_common_subdir(react/renderer/observers/intersection) +add_react_common_subdir(react/renderer/observers/mutation) +add_react_common_subdir(react/renderer/runtimescheduler) +add_react_common_subdir(react/renderer/scheduler) +add_react_common_subdir(react/renderer/telemetry) +add_react_common_subdir(react/renderer/textlayoutmanager) +add_react_common_subdir(react/renderer/uimanager) +add_react_common_subdir(react/renderer/uimanager/consistency) +add_react_common_subdir(react/runtime) +add_react_common_subdir(react/runtime/hermes) add_react_common_subdir(react/timing) +add_react_common_subdir(react/utils) add_react_common_subdir(reactperflogger) add_react_common_subdir(runtimeexecutor) add_react_common_subdir(yoga) -add_fantom_react_common_subdir(react/nativemodule/core) -add_fantom_react_common_subdir(react/utils) -add_fantom_react_common_subdir(react/runtime/hermes) -add_fantom_react_common_subdir(hermes/inspector-modern) -add_fantom_react_common_subdir(hermes/executor) +# This is a hack to make sure that libraries that depend on jni yoga are linked +add_library(yoga ALIAS yogacore) -file(GLOB SOURCES "src/*.cpp" "src/*.h") +add_react_cxx_platform_subdir(react/coremodules) +add_react_cxx_platform_subdir(react/devsupport) +add_react_cxx_platform_subdir(react/http) +add_react_cxx_platform_subdir(react/io) +add_react_cxx_platform_subdir(react/logging) +add_react_cxx_platform_subdir(react/nativemodule) +add_react_cxx_platform_subdir(react/profiling) +add_react_cxx_platform_subdir(react/renderer/animated) +add_react_cxx_platform_subdir(react/renderer/scheduler) +add_react_cxx_platform_subdir(react/renderer/uimanager) +add_react_cxx_platform_subdir(react/runtime) +add_react_cxx_platform_subdir(react/threading) +add_react_cxx_platform_subdir(react/utils) + +file(GLOB SOURCES src/*.cpp src/**/*.cpp) add_executable(fantom_tester ${SOURCES}) +target_include_directories(fantom_tester PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src) + target_link_libraries(fantom_tester PRIVATE - ${LIB_HERMES} + # third-party boost - bridgelesshermes - callinvoker + double-conversion + fmt folly_runtime gflags glog + + # hermes + hermes-engine::libhermes + + # codegen + react_codegen_rncore + + # ReactCommon + bridgeless + bridgelesshermes + devtoolsruntimesettings hermes_executor_common hermes_inspector_modern + jserrorhandler jsi jsinspector jsinspector_cdp @@ -100,17 +177,68 @@ target_link_libraries(fantom_tester logger oscompat react_bridging - react_codegen_rncore react_cxxreact react_debug react_featureflags react_nativemodule_core + react_nativemodule_cpu + react_nativemodule_defaults + react_nativemodule_devtoolsruntimesettings + react_nativemodule_dom + react_nativemodule_fantomspecificmethods + react_nativemodule_featureflags + react_nativemodule_idlecallbacks + react_nativemodule_intersectionobserver + react_nativemodule_microtasks + react_nativemodule_mutationobserver + react_nativemodule_webperformance react_performance_timeline - react_timing + react_renderer_attributedstring + react_renderer_componentregistry + react_renderer_consistency + react_renderer_core + react_renderer_css + react_renderer_debug + react_renderer_dom + react_renderer_graphics + react_renderer_imagemanager + react_renderer_leakchecker + react_renderer_mapbuffer + react_renderer_mounting + react_renderer_observers_events + react_renderer_observers_intersection + react_renderer_observers_mutation + react_renderer_runtimescheduler + react_renderer_scheduler + react_renderer_telemetry + react_renderer_textlayoutmanager + react_renderer_uimanager + react_renderer_uimanager_consistency react_utils reactperflogger + rrc_legacyviewmanagerinterop + rrc_image + rrc_modal + rrc_native + rrc_root + rrc_scrollview + rrc_text + rrc_view runtimeexecutor yogacore + + # ReactCxxPlatform + react_cxx_platform_react_coremodules + react_cxx_platform_react_devsupport + react_cxx_platform_react_http + react_cxx_platform_react_io + react_cxx_platform_react_logging + react_cxx_platform_react_profiling + react_cxx_platform_react_renderer_animated + react_cxx_platform_react_renderer_scheduler + react_cxx_platform_react_runtime + react_cxx_platform_react_threading + react_cxx_platform_react_utils ) target_compile_options(fantom_tester diff --git a/private/react-native-fantom/tester/ReactCommon/hermes/executor/CMakeLists.txt b/private/react-native-fantom/tester/ReactCommon/hermes/executor/CMakeLists.txt deleted file mode 100644 index 7b8d1dd59f6..00000000000 --- a/private/react-native-fantom/tester/ReactCommon/hermes/executor/CMakeLists.txt +++ /dev/null @@ -1,38 +0,0 @@ -# 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) - -include(${REACT_COMMON_DIR}/cmake-utils/react-native-flags.cmake) - -file(GLOB_RECURSE hermes_executor_SRC CONFIGURE_DEPENDS ${hermes_executor_DIR}/*.cpp) -add_library( - hermes_executor_common - OBJECT - ${hermes_executor_SRC} -) -target_include_directories(hermes_executor_common PUBLIC ${hermes_executor_DIR}/.) -target_link_libraries(hermes_executor_common - hermes-engine::libhermes - hermes_inspector_modern - jsi - jsireact -) - -target_compile_reactnative_options(hermes_executor_common PRIVATE) -if(${CMAKE_BUILD_TYPE} MATCHES Debug) - target_compile_options( - hermes_executor_common - PRIVATE - -DHERMES_ENABLE_DEBUGGER=1 - ) -else() - target_compile_options( - hermes_executor_common - PRIVATE - -DNDEBUG - ) -endif() diff --git a/private/react-native-fantom/tester/ReactCommon/hermes/inspector-modern/CMakeLists.txt b/private/react-native-fantom/tester/ReactCommon/hermes/inspector-modern/CMakeLists.txt deleted file mode 100644 index 9d5127e0b7e..00000000000 --- a/private/react-native-fantom/tester/ReactCommon/hermes/inspector-modern/CMakeLists.txt +++ /dev/null @@ -1,31 +0,0 @@ -# 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) - -include(${REACT_COMMON_DIR}/cmake-utils/react-native-flags.cmake) - -file(GLOB hermes_inspector_modern_SRC CONFIGURE_DEPENDS ${hermes_inspector_modern_DIR}/chrome/*.cpp) - -add_library(hermes_inspector_modern - OBJECT - ${hermes_inspector_modern_SRC}) - -target_compile_reactnative_options(hermes_inspector_modern PRIVATE) - -if(${CMAKE_BUILD_TYPE} MATCHES Debug) - target_compile_options( - hermes_inspector_modern - PRIVATE - -DHERMES_ENABLE_DEBUGGER=1 - ) -endif() - -target_include_directories(hermes_inspector_modern PUBLIC ${REACT_COMMON_DIR}) -target_link_libraries(hermes_inspector_modern - hermes-engine::libhermes - jsi - jsinspector) diff --git a/private/react-native-fantom/tester/ReactCommon/react/nativemodule/core/CMakeLists.txt b/private/react-native-fantom/tester/ReactCommon/react/nativemodule/core/CMakeLists.txt deleted file mode 100644 index ce8d950d50f..00000000000 --- a/private/react-native-fantom/tester/ReactCommon/react/nativemodule/core/CMakeLists.txt +++ /dev/null @@ -1,33 +0,0 @@ -# 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) - -include(${REACT_COMMON_DIR}/cmake-utils/react-native-flags.cmake) -file(GLOB react_nativemodule_core_SRC CONFIGURE_DEPENDS - ${react_nativemodule_core_DIR}/ReactCommon/*.cpp) - -add_library(react_nativemodule_core - OBJECT - ${react_nativemodule_core_SRC}) - -target_include_directories(react_nativemodule_core - PUBLIC - ${react_nativemodule_core_DIR} - ) - -target_link_libraries(react_nativemodule_core - folly_runtime - glog - jsi - callinvoker - react_bridging - react_debug - react_utils - react_featureflags - reactperflogger) -target_compile_reactnative_options(react_nativemodule_core PRIVATE) -target_compile_options(react_nativemodule_core PRIVATE -Wpedantic) diff --git a/private/react-native-fantom/tester/ReactCommon/react/runtime/hermes/CMakeLists.txt b/private/react-native-fantom/tester/ReactCommon/react/runtime/hermes/CMakeLists.txt deleted file mode 100644 index 770744b5618..00000000000 --- a/private/react-native-fantom/tester/ReactCommon/react/runtime/hermes/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -# 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) - -include(${REACT_COMMON_DIR}/cmake-utils/react-native-flags.cmake) - -file(GLOB_RECURSE bridgelesshermes_SRC CONFIGURE_DEPENDS ${react_runtime_hermes_DIR}/*.cpp) -add_library( - bridgelesshermes - OBJECT - ${bridgelesshermes_SRC} -) -target_include_directories(bridgelesshermes PUBLIC ${react_runtime_hermes_DIR}/.) - -target_link_libraries(bridgelesshermes - hermes-engine::libhermes - hermes_executor_common - hermes_inspector_modern - jsitooling - jsi - jsinspector -) - -target_compile_reactnative_options(bridgelesshermes PRIVATE) -if(${CMAKE_BUILD_TYPE} MATCHES Debug) - target_compile_options( - bridgelesshermes - PRIVATE - -DHERMES_ENABLE_DEBUGGER=1 - ) -endif() diff --git a/private/react-native-fantom/tester/ReactCommon/react/utils/CMakeLists.txt b/private/react-native-fantom/tester/ReactCommon/react/utils/CMakeLists.txt deleted file mode 100644 index a2874202506..00000000000 --- a/private/react-native-fantom/tester/ReactCommon/react/utils/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -# 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) - -include(${REACT_COMMON_DIR}/cmake-utils/react-native-flags.cmake) - -file(GLOB react_utils_SRC CONFIGURE_DEPENDS ${react_utils_DIR}/*.cpp) -add_library(react_utils OBJECT ${react_utils_SRC}) - -target_include_directories(react_utils - PUBLIC - ${REACT_COMMON_DIR} -) - -target_link_libraries(react_utils - glog - jsireact - react_debug) -target_compile_reactnative_options(react_utils PRIVATE) -target_compile_options(react_utils PRIVATE -Wpedantic) diff --git a/private/react-native-fantom/tester/build.sh b/private/react-native-fantom/tester/build.sh index 7a3a0fffe8f..e37c65b6c99 100755 --- a/private/react-native-fantom/tester/build.sh +++ b/private/react-native-fantom/tester/build.sh @@ -7,36 +7,27 @@ set -e SCRIPT_DIR=$(dirname "$(readlink -f "$0")") -BUILD_DIR="$SCRIPT_DIR/build" +BUILD_DIR="$SCRIPT_DIR/build/debug" REACT_NATIVE_ROOT_DIR=$(readlink -f "$SCRIPT_DIR/../../../packages/react-native") +while getopts ":r" opt; do + case $opt in + r) release_build=true ;; + \?) ;; + esac +done + +if [ "$release_build" = true ]; then + BUILD_DIR="$SCRIPT_DIR/build/release" +fi + cmake -S "$SCRIPT_DIR" -B "$BUILD_DIR" \ -DREACT_ANDROID_DIR="${REACT_NATIVE_ROOT_DIR}/ReactAndroid" \ -DFANTOM_THIRD_PARTY_DIR="${SCRIPT_DIR}/../build/third-party" \ -DFANTOM_CODEGEN_DIR="${SCRIPT_DIR}/../build/codegen" \ -DREACT_THIRD_PARTY_NDK_DIR="${REACT_NATIVE_ROOT_DIR}/ReactAndroid/build/third-party-ndk" \ - -DREACT_COMMON_DIR="${REACT_NATIVE_ROOT_DIR}/ReactCommon" + -DREACT_COMMON_DIR="${REACT_NATIVE_ROOT_DIR}/ReactCommon" \ + -DREACT_CXX_PLATFORM_DIR="${REACT_NATIVE_ROOT_DIR}/ReactCxxPlatform" \ + -DCMAKE_BUILD_TYPE="${release_build:+Release}${release_build:-Debug}" cmake --build "$BUILD_DIR" --target fantom_tester - -while getopts ":r" opt; do - case $opt in - r) execute_tester=true ;; - \?) ;; - esac -done - -for arg in "$@"; do - if [ "$arg" = "--featureFlags" ]; then - feature_flags="--featureFlags=${@:$OPTIND:1}" - break - fi -done - -if [ "$execute_tester" = true ]; then - if [ -n "$feature_flags" ]; then - "$BUILD_DIR/fantom_tester" "$feature_flags" - else - "$BUILD_DIR/fantom_tester" - fi -fi diff --git a/private/react-native-fantom/tester/cmake/modules/Deps.cmake b/private/react-native-fantom/tester/cmake/modules/Deps.cmake index 008f7d19267..ec5d155d02c 100644 --- a/private/react-native-fantom/tester/cmake/modules/Deps.cmake +++ b/private/react-native-fantom/tester/cmake/modules/Deps.cmake @@ -6,6 +6,7 @@ # Convert input paths to CMake format (with forward slashes) file(TO_CMAKE_PATH "${REACT_THIRD_PARTY_NDK_DIR}" REACT_THIRD_PARTY_NDK_DIR) file(TO_CMAKE_PATH "${REACT_COMMON_DIR}" REACT_COMMON_DIR) +file(TO_CMAKE_PATH "${REACT_CXX_PLATFORM_DIR}" REACT_CXX_PLATFORM_DIR) file(TO_CMAKE_PATH "${FANTOM_CODEGEN_DIR}" FANTOM_CODEGEN_DIR) file(TO_CMAKE_PATH "${FANTOM_THIRD_PARTY_DIR}" FANTOM_THIRD_PARTY_DIR) @@ -21,15 +22,8 @@ function(add_react_common_subdir relative_path) add_subdirectory(${REACT_COMMON_DIR}/${relative_path} ReactCommon/${relative_path}) endfunction() -function(add_fantom_codegen_subdir relative_path) - add_subdirectory(${FANTOM_CODEGEN_DIR}/${relative_path} ${relative_path}) -endfunction() - -function(add_fantom_react_common_subdir relative_path) - string(REPLACE "/" "_" var_name ${relative_path}) - string(REPLACE "-" "_" var_name ${var_name}) - set(${var_name}_DIR ${REACT_COMMON_DIR}/${relative_path}) - add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/ReactCommon/${relative_path} ReactCommon/${relative_path}) +function(add_react_cxx_platform_subdir relative_path) + add_subdirectory(${REACT_CXX_PLATFORM_DIR}/${relative_path} ReactCxxPlatform/${relative_path}) endfunction() function(add_fantom_third_party_subdir relative_path) diff --git a/private/react-native-fantom/tester/codegen/CMakeLists.txt b/private/react-native-fantom/tester/codegen/CMakeLists.txt new file mode 100644 index 00000000000..368d3301460 --- /dev/null +++ b/private/react-native-fantom/tester/codegen/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) + +file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS react/renderer/components/FBReactNativeSpec/*.cpp) + +add_library( + react_codegen_rncore + OBJECT + ${react_codegen_SRCS} +) + +target_include_directories(react_codegen_rncore + PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR}/. + ${CMAKE_CURRENT_SOURCE_DIR}/react/renderer/components/FBReactNativeSpec + ${CMAKE_CURRENT_SOURCE_DIR}/react/renderer/components) + +target_link_libraries( + react_codegen_rncore + jsi + react_nativemodule_core + rrc_view +) + +target_compile_options( + react_codegen_rncore + PRIVATE + -DLOG_TAG=\"ReactNative\" + -fexceptions + -frtti + -std=c++20 + -Wall +) diff --git a/private/react-native-fantom/tester/third-party/folly/CMakeLists.txt b/private/react-native-fantom/tester/third-party/folly/CMakeLists.txt new file mode 100644 index 00000000000..e2af851f140 --- /dev/null +++ b/private/react-native-fantom/tester/third-party/folly/CMakeLists.txt @@ -0,0 +1,73 @@ +# 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) + +SET(folly_FLAGS + -DFOLLY_NO_CONFIG=1 + -DFOLLY_HAVE_CLOCK_GETTIME=1 + -DFOLLY_USE_LIBCPP=1 + -DFOLLY_CFG_NO_COROUTINES=1 + -DFOLLY_MOBILE=0 + -DFOLLY_HAVE_RECVMMSG=1 + -DFOLLY_HAVE_PTHREAD=1 + # If APP_PLATFORM in Application.mk targets android-23 above, please comment + # the following line. NDK uses GNU style stderror_r() after API 23. + -DFOLLY_HAVE_XSI_STRERROR_R=1 + ) + +################## +### folly_runtime ### +################## + +SET(folly_runtime_SRC + folly/Conv.cpp + folly/Demangle.cpp + folly/FileUtil.cpp + folly/Format.cpp + folly/ScopeGuard.cpp + folly/SharedMutex.cpp + folly/String.cpp + folly/Unicode.cpp + folly/concurrency/CacheLocality.cpp + folly/container/detail/F14Table.cpp + folly/detail/FileUtilDetail.cpp + folly/detail/Futex.cpp + folly/detail/SplitStringSimd.cpp + folly/detail/UniqueInstance.cpp + folly/hash/SpookyHashV2.cpp + folly/io/IOBuf.cpp + folly/json/dynamic.cpp + folly/json/json_pointer.cpp + folly/json/json.cpp + folly/lang/CString.cpp + folly/lang/Exception.cpp + folly/lang/SafeAssert.cpp + folly/lang/ToAscii.cpp + folly/memory/SanitizeAddress.cpp + folly/memory/detail/MallocImpl.cpp + folly/net/NetOps.cpp + folly/portability/SysUio.cpp + folly/synchronization/SanitizeThread.cpp + folly/synchronization/ParkingLot.cpp + folly/system/AtFork.cpp + folly/system/ThreadId.cpp + folly/system/ThreadName.cpp) + +add_library(folly_runtime STATIC ${folly_runtime_SRC}) + +target_compile_options(folly_runtime + PRIVATE + -fexceptions + -fno-omit-frame-pointer + -frtti + -Wno-sign-compare + ${folly_FLAGS}) + +target_compile_options(folly_runtime PUBLIC ${folly_FLAGS}) + +target_include_directories(folly_runtime PUBLIC .) +target_link_libraries(folly_runtime glog double-conversion boost fmt fast_float) diff --git a/private/react-native-fantom/tester/third-party/nlohmann_json/CMakeLists.txt b/private/react-native-fantom/tester/third-party/nlohmann_json/CMakeLists.txt new file mode 100644 index 00000000000..5434507e586 --- /dev/null +++ b/private/react-native-fantom/tester/third-party/nlohmann_json/CMakeLists.txt @@ -0,0 +1,11 @@ +# 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_library(nlohmann_json INTERFACE) + +target_include_directories(nlohmann_json INTERFACE include)