Skip to content

Cleanup custom LOG_TAG in our CMakeLists files. #51622

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,7 @@ target_link_libraries(
}
)

target_compile_options(
react_codegen_${libraryName}
PRIVATE
-DLOG_TAG=\\"ReactNative\\"
-fexceptions
-frtti
-std=c++20
-Wall
)
target_compile_reactnative_options(react_codegen_${libraryName} PRIVATE)
`;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,7 @@ target_link_libraries(
reactnative
)

target_compile_options(
react_codegen_SampleWithUppercaseName
PRIVATE
-DLOG_TAG=\\\\\\"ReactNative\\\\\\"
-fexceptions
-frtti
-std=c++20
-Wall
)
target_compile_reactnative_options(react_codegen_SampleWithUppercaseName PRIVATE)
",
}
`;
Expand Down Expand Up @@ -135,15 +127,7 @@ target_link_libraries(
reactnative
)

target_compile_options(
react_codegen_complex_objects
PRIVATE
-DLOG_TAG=\\\\\\"ReactNative\\\\\\"
-fexceptions
-frtti
-std=c++20
-Wall
)
target_compile_reactnative_options(react_codegen_complex_objects PRIVATE)
",
}
`;
Expand Down Expand Up @@ -202,15 +186,7 @@ target_link_libraries(
reactnative
)

target_compile_options(
react_codegen_cxx_only_native_modules
PRIVATE
-DLOG_TAG=\\\\\\"ReactNative\\\\\\"
-fexceptions
-frtti
-std=c++20
-Wall
)
target_compile_reactnative_options(react_codegen_cxx_only_native_modules PRIVATE)
",
}
`;
Expand Down Expand Up @@ -276,15 +252,7 @@ target_link_libraries(
reactnative
)

target_compile_options(
react_codegen_empty_native_modules
PRIVATE
-DLOG_TAG=\\\\\\"ReactNative\\\\\\"
-fexceptions
-frtti
-std=c++20
-Wall
)
target_compile_reactnative_options(react_codegen_empty_native_modules PRIVATE)
",
}
`;
Expand Down Expand Up @@ -350,15 +318,7 @@ target_link_libraries(
reactnative
)

target_compile_options(
react_codegen_event_emitter_module
PRIVATE
-DLOG_TAG=\\\\\\"ReactNative\\\\\\"
-fexceptions
-frtti
-std=c++20
-Wall
)
target_compile_reactnative_options(react_codegen_event_emitter_module PRIVATE)
",
}
`;
Expand Down Expand Up @@ -424,15 +384,7 @@ target_link_libraries(
reactnative
)

target_compile_options(
react_codegen_native_modules_with_type_aliases
PRIVATE
-DLOG_TAG=\\\\\\"ReactNative\\\\\\"
-fexceptions
-frtti
-std=c++20
-Wall
)
target_compile_reactnative_options(react_codegen_native_modules_with_type_aliases PRIVATE)
",
}
`;
Expand Down Expand Up @@ -506,15 +458,7 @@ target_link_libraries(
reactnative
)

target_compile_options(
react_codegen_real_module_example
PRIVATE
-DLOG_TAG=\\\\\\"ReactNative\\\\\\"
-fexceptions
-frtti
-std=c++20
-Wall
)
target_compile_reactnative_options(react_codegen_real_module_example PRIVATE)
",
}
`;
Expand Down Expand Up @@ -580,15 +524,7 @@ target_link_libraries(
reactnative
)

target_compile_options(
react_codegen_simple_native_modules
PRIVATE
-DLOG_TAG=\\\\\\"ReactNative\\\\\\"
-fexceptions
-frtti
-std=c++20
-Wall
)
target_compile_reactnative_options(react_codegen_simple_native_modules PRIVATE)
",
}
`;
Expand Down Expand Up @@ -654,15 +590,7 @@ target_link_libraries(
reactnative
)

target_compile_options(
react_codegen_string_literals
PRIVATE
-DLOG_TAG=\\\\\\"ReactNative\\\\\\"
-fexceptions
-frtti
-std=c++20
-Wall
)
target_compile_reactnative_options(react_codegen_string_literals PRIVATE)
",
}
`;
Expand Down Expand Up @@ -736,15 +664,7 @@ target_link_libraries(
reactnative
)

target_compile_options(
react_codegen_two_modules_different_files
PRIVATE
-DLOG_TAG=\\\\\\"ReactNative\\\\\\"
-fexceptions
-frtti
-std=c++20
-Wall
)
target_compile_reactnative_options(react_codegen_two_modules_different_files PRIVATE)
",
}
`;
Expand Down Expand Up @@ -810,15 +730,7 @@ target_link_libraries(
reactnative
)

target_compile_options(
react_codegen_union_module
PRIVATE
-DLOG_TAG=\\\\\\"ReactNative\\\\\\"
-fexceptions
-frtti
-std=c++20
-Wall
)
target_compile_reactnative_options(react_codegen_union_module PRIVATE)
",
}
`;
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,4 @@ target_link_libraries(
reactnative
)

target_compile_options(
react_codegen_ReactPopupMenuAndroidSpecs
PRIVATE
-DLOG_TAG=\"ReactNative\"
-fexceptions
-frtti
-std=c++20
-Wall
)
target_compile_reactnative_options(react_codegen_ReactPopupMenuAndroidSpecs PRIVATE)
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,4 @@ target_link_libraries(
reactnative
)

target_compile_options(
react_codegen_OSSLibraryExampleSpec
PRIVATE
-DLOG_TAG=\"ReactNative\"
-fexceptions
-frtti
-std=c++20
-Wall
)
target_compile_reactnative_options(react_codegen_OSSLibraryExampleSpec PRIVATE)
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ target_include_directories(${CMAKE_PROJECT_NAME}
${CMAKE_CURRENT_SOURCE_DIR}
${PROJECT_BUILD_DIR}/generated/autolinking/src/main/jni)

target_compile_reactnative_options(${CMAKE_PROJECT_NAME} PRIVATE "ReactNative")
target_compile_reactnative_options(${CMAKE_PROJECT_NAME} PRIVATE)

# Prefab packages from React Native
find_package(ReactAndroid REQUIRED CONFIG)
Expand Down
75 changes: 0 additions & 75 deletions packages/react-native/ReactAndroid/src/main/jni/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -332,81 +332,6 @@ target_include_directories(reactnative
$<TARGET_PROPERTY:yoga,INTERFACE_INCLUDE_DIRECTORIES>
)

target_compile_definitions(reactnative
PUBLIC
$<TARGET_PROPERTY:bridgeless,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:bridgelessnativeviewconfig,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:callinvokerholder,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:fabricjni,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:glog_init,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:jserrorhandler,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:jsinspector,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:jsinspector_cdp,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:jsinspector_network,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:jsinspector_tracing,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:jsireact,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:mapbufferjni,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:react_bridging,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:react_codegen_rncore,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:react_cxxreact,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:react_debug,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:react_devsupportjni,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:react_featureflags,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:react_featureflagsjni,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:react_nativemodule_core,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:react_nativemodule_defaults,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:react_nativemodule_dom,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:react_nativemodule_featureflags,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:react_nativemodule_idlecallbacks,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:react_nativemodule_microtasks,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:react_newarchdefaults,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:react_performance_timeline,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:react_renderer_animations,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:react_renderer_attributedstring,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:react_renderer_componentregistry,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:react_renderer_componentregistry,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:react_renderer_consistency,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:react_renderer_core,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:react_renderer_css,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:react_renderer_debug,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:react_renderer_dom,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:react_renderer_element,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:react_renderer_graphics,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:react_renderer_imagemanager,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:react_renderer_leakchecker,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:react_renderer_mapbuffer,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:react_renderer_mounting,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:react_renderer_observers_events,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:react_renderer_runtimescheduler,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:react_renderer_scheduler,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:react_renderer_telemetry,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:react_renderer_textlayoutmanager,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:react_renderer_uimanager,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:react_renderer_uimanager_consistency,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:react_utils,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:reactnativeblob,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:reactnativejni,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:reactnativejni_common,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:reactperflogger,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:rninstance,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:rrc_image,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:rrc_legacyviewmanagerinterop,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:rrc_modal,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:rrc_native,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:rrc_progressbar,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:rrc_root,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:rrc_safeareaview,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:rrc_scrollview,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:rrc_switch,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:rrc_text,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:rrc_textinput,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:rrc_view,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:runtimeexecutor,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:turbomodulejsijni,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:uimanagerjni,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:yoga,INTERFACE_COMPILE_DEFINITIONS>
)

# GTest dependencies
add_executable(reactnative_unittest
${REACT_COMMON_DIR}/cxxreact/tests/jsarg_helpers.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ target_link_libraries(react_devsupportjni
fbjni
jsinspector)

target_compile_reactnative_options(react_devsupportjni PRIVATE "ReactNative")
target_compile_reactnative_options(react_devsupportjni PRIVATE)
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ target_link_libraries(
yoga
)

target_compile_reactnative_options(fabricjni PRIVATE "Fabric")
target_compile_reactnative_options(fabricjni PRIVATE)
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ target_link_libraries(
)

target_merge_so(react_featureflagsjni)
target_compile_reactnative_options(react_featureflagsjni PRIVATE "ReactNative")
target_compile_reactnative_options(react_featureflagsjni PRIVATE)
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ target_link_libraries(mapbufferjni
yoga
)

target_compile_reactnative_options(mapbufferjni PRIVATE "Fabric")
target_compile_reactnative_options(mapbufferjni PRIVATE)
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ target_link_libraries(react_newarchdefaults
react_nativemodule_idlecallbacks
jsi)

target_compile_reactnative_options(react_newarchdefaults PRIVATE "ReactNative")
target_compile_reactnative_options(react_newarchdefaults PRIVATE)
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ target_link_libraries(uimanagerjni
yoga
)

target_compile_reactnative_options(uimanagerjni PRIVATE "ReactNative")
target_compile_reactnative_options(uimanagerjni PRIVATE)
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,18 @@ SET(reactnative_FLAGS
-frtti
-std=c++20
-DFOLLY_NO_CONFIG=1
-DLOG_TAG=\"ReactNative\"
)

# This function can be used to configure the reactnative flags for a specific target in
# a conveniente way. The usage is:
#
# target_compile_reactnative_options(target_name scope [tag])
# target_compile_reactnative_options(target_name scope)
#
# scope is either PUBLIC, PRIVATE or INTERFACE
# tag is optional and if set, will be passed to the -DLOG_TAG flag

function(target_compile_reactnative_options target_name scope)
target_compile_options(${target_name} ${scope} ${reactnative_FLAGS})
set (extra_args ${ARGN})
list(LENGTH extra_args extra_count)
set (tag "ReactNative")
if (${extra_count} GREATER 0)
list(GET extra_args 0 user_provided_tag)
target_compile_options(${target_name} ${scope} -DLOG_TAG=\"${user_provided_tag}\")
endif ()
target_compile_definitions(${target_name} ${scope} RN_SERIALIZABLE_STATE)
endfunction()

2 changes: 1 addition & 1 deletion packages/react-native/ReactCommon/cxxreact/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ target_link_libraries(react_cxxreact
runtimeexecutor
react_debug)

target_compile_reactnative_options(react_cxxreact PRIVATE "ReactNative")
target_compile_reactnative_options(react_cxxreact PRIVATE)
target_compile_options(react_cxxreact PRIVATE -Wno-unused-lambda-capture)
Loading
Loading