Skip to content

Commit e5bdbc0

Browse files
andrewdacenkofacebook-github-bot
authored andcommitted
Add third-party deps
Summary: Changelog: [Internal] Add third-party deps for fantom_tester build. Differential Revision: D76259630
1 parent fe2bcbf commit e5bdbc0

4 files changed

Lines changed: 51 additions & 7 deletions

File tree

packages/react-native-fantom/tester/CMakeLists.txt

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,47 @@ set(CMAKE_VERBOSE_MAKEFILE on)
88

99
project(fantom_tester)
1010

11+
include(${REACT_COMMON_DIR}/cmake-utils/react-native-flags.cmake)
12+
1113
# Convert input paths to CMake format (with forward slashes)
14+
file(TO_CMAKE_PATH "${REACT_THIRD_PARTY_NDK_DIR}" REACT_THIRD_PARTY_NDK_DIR)
1215
file(TO_CMAKE_PATH "${REACT_COMMON_DIR}" REACT_COMMON_DIR)
1316

14-
# Make sure every shared lib includes a .note.gnu.build-id header
15-
add_link_options(-Wl,--build-id)
17+
function(add_react_third_party_ndk_subdir relative_path)
18+
add_subdirectory(${REACT_THIRD_PARTY_NDK_DIR}/${relative_path} ${relative_path})
19+
endfunction()
20+
21+
function(add_third_party_subdir relative_path)
22+
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/third-party/${relative_path} ${relative_path})
23+
endfunction()
1624

1725
function(add_react_common_subdir relative_path)
1826
add_subdirectory(${REACT_COMMON_DIR}/${relative_path} src/${relative_path})
1927
endfunction()
2028

2129
# Third-party downloaded targets
30+
add_react_third_party_ndk_subdir(glog)
31+
# Boost in NDK is not compatible with desktop build
32+
add_third_party_subdir(boost)
33+
add_react_third_party_ndk_subdir(double-conversion)
34+
add_react_third_party_ndk_subdir(fast_float)
35+
add_react_third_party_ndk_subdir(fmt)
36+
add_react_third_party_ndk_subdir(folly)
2237

2338
# Common targets
2439
add_react_common_subdir(yoga)
2540

2641
file(GLOB SOURCES "src/*.cpp" "src/*.h")
2742
add_executable(fantom_tester ${SOURCES})
2843

29-
target_link_libraries(fantom_tester PUBLIC yogacore)
44+
target_link_libraries(fantom_tester
45+
PRIVATE
46+
glog
47+
boost
48+
double-conversion
49+
fast_float
50+
folly_runtime
51+
yogacore)
3052

3153
target_compile_options(fantom_tester
3254
PRIVATE

packages/react-native-fantom/tester/build.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,8 @@ SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
1010
BUILD_DIR="$SCRIPT_DIR/build"
1111
REACT_NATIVE_ROOT_DIR=$(readlink -f "$SCRIPT_DIR/../../react-native")
1212

13-
cmake -S "$SCRIPT_DIR" -B "$BUILD_DIR" -DREACT_COMMON_DIR="${REACT_NATIVE_ROOT_DIR}/ReactCommon"
13+
cmake -S "$SCRIPT_DIR" -B "$BUILD_DIR" \
14+
-DREACT_THIRD_PARTY_NDK_DIR="${REACT_NATIVE_ROOT_DIR}/ReactAndroid/build/third-party-ndk" \
15+
-DREACT_COMMON_DIR="${REACT_NATIVE_ROOT_DIR}/ReactCommon"
16+
1417
cmake --build "$BUILD_DIR" --target fantom_tester

packages/react-native-fantom/tester/src/main.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,20 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8+
#include <fmt/format.h>
9+
#include <glog/logging.h>
810
#include <yoga/YGEnums.h>
911
#include <yoga/YGValue.h>
1012
#include <iostream>
1113

1214
int main() {
13-
std::cout << "Hello, I am fantom_tester using Yoga!" << std::endl;
15+
google::InitGoogleLogging("fantom_tester");
16+
FLAGS_logtostderr = true;
1417

15-
std::cout << "[Yoga] undefined == zero: " << (YGValueZero == YGValueUndefined)
16-
<< std::endl;
18+
LOG(INFO) << "Hello, I am fantom_tester using glog!";
19+
20+
LOG(INFO) << fmt::format(
21+
"[Yoga] undefined == zero: {}", YGValueZero == YGValueUndefined);
1722

1823
return 0;
1924
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright (c) Meta Platforms, Inc. and affiliates.
2+
#
3+
# This source code is licensed under the MIT license found in the
4+
# LICENSE file in the root directory of this source tree.
5+
6+
cmake_minimum_required(VERSION 3.13)
7+
set(CMAKE_VERBOSE_MAKEFILE on)
8+
9+
add_library(boost INTERFACE)
10+
11+
set_target_properties(boost PROPERTIES LINKER_LANGUAGE CXX)
12+
13+
target_include_directories(boost INTERFACE ${REACT_THIRD_PARTY_NDK_DIR}/boost/boost_1_83_0)
14+
target_compile_options(boost INTERFACE -fexceptions -frtti)

0 commit comments

Comments
 (0)