-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
chore: add cmake formatting and linting #6811
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
63 changes: 22 additions & 41 deletions
63
packages/react-native-reanimated/android/src/main/cpp/reanimated/CMakeLists.txt
This file contains hidden or 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 |
|---|---|---|
| @@ -1,57 +1,38 @@ | ||
| cmake_minimum_required(VERSION 3.8) | ||
|
|
||
| file(GLOB_RECURSE REANIMATED_COMMON_CPP_SOURCES CONFIGURE_DEPENDS "${COMMON_CPP_DIR}/reanimated/*.cpp") | ||
| file(GLOB_RECURSE REANIMATED_ANDROID_CPP_SOURCES CONFIGURE_DEPENDS "${ANDROID_CPP_DIR}/reanimated/*.cpp") | ||
| file(GLOB_RECURSE REANIMATED_COMMON_CPP_SOURCES CONFIGURE_DEPENDS | ||
| "${COMMON_CPP_DIR}/reanimated/*.cpp") | ||
| file(GLOB_RECURSE REANIMATED_ANDROID_CPP_SOURCES CONFIGURE_DEPENDS | ||
| "${ANDROID_CPP_DIR}/reanimated/*.cpp") | ||
|
|
||
| find_package(ReactAndroid REQUIRED CONFIG) | ||
|
|
||
| add_library( | ||
| reanimated | ||
| SHARED | ||
| ${REANIMATED_COMMON_CPP_SOURCES} | ||
| ${REANIMATED_ANDROID_CPP_SOURCES} | ||
| ) | ||
| add_library(reanimated SHARED ${REANIMATED_COMMON_CPP_SOURCES} | ||
| ${REANIMATED_ANDROID_CPP_SOURCES}) | ||
|
|
||
| target_include_directories( | ||
| reanimated | ||
| PRIVATE | ||
| "${COMMON_CPP_DIR}" | ||
| "${ANDROID_CPP_DIR}" | ||
| "${REACT_NATIVE_DIR}/ReactCommon" | ||
| "${REACT_NATIVE_DIR}/ReactAndroid/src/main/jni/react/turbomodule" | ||
| "${REACT_NATIVE_DIR}/ReactCommon/callinvoker" | ||
| "${REACT_NATIVE_DIR}/ReactCommon/runtimeexecutor" | ||
| ) | ||
| reanimated | ||
| PRIVATE "${COMMON_CPP_DIR}" | ||
| "${ANDROID_CPP_DIR}" | ||
| "${REACT_NATIVE_DIR}/ReactCommon" | ||
| "${REACT_NATIVE_DIR}/ReactAndroid/src/main/jni/react/turbomodule" | ||
| "${REACT_NATIVE_DIR}/ReactCommon/callinvoker" | ||
| "${REACT_NATIVE_DIR}/ReactCommon/runtimeexecutor") | ||
|
|
||
| if(${IS_NEW_ARCHITECTURE_ENABLED}) | ||
| target_include_directories( | ||
| reanimated | ||
| PRIVATE | ||
| "${REACT_NATIVE_DIR}/ReactCommon/yoga" | ||
| "${REACT_NATIVE_DIR}/ReactCommon/react/renderer/graphics/platform/cxx" | ||
| ) | ||
| target_include_directories( | ||
| reanimated | ||
| PRIVATE | ||
| "${REACT_NATIVE_DIR}/ReactCommon/yoga" | ||
| "${REACT_NATIVE_DIR}/ReactCommon/react/renderer/graphics/platform/cxx") | ||
| endif() | ||
|
|
||
| set_target_properties( | ||
| reanimated | ||
| PROPERTIES | ||
| LINKER_LANGUAGE | ||
| CXX | ||
| ) | ||
| set_target_properties(reanimated PROPERTIES LINKER_LANGUAGE CXX) | ||
|
|
||
| target_link_libraries( | ||
| reanimated | ||
| worklets | ||
| ) | ||
| target_link_libraries(reanimated worklets) | ||
|
|
||
| if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76) | ||
| target_link_libraries( | ||
| reanimated | ||
| ReactAndroid::reactnative | ||
| ) | ||
| target_link_libraries(reanimated ReactAndroid::reactnative) | ||
| else() | ||
| target_link_libraries( | ||
| reanimated | ||
| ReactAndroid::react_nativemodule_core | ||
| ) | ||
| target_link_libraries(reanimated ReactAndroid::react_nativemodule_core) | ||
| endif() |
161 changes: 55 additions & 106 deletions
161
packages/react-native-reanimated/android/src/main/cpp/worklets/CMakeLists.txt
This file contains hidden or 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 |
|---|---|---|
| @@ -1,139 +1,88 @@ | ||
| cmake_minimum_required(VERSION 3.8) | ||
|
|
||
| file(GLOB_RECURSE WORKLETS_COMMON_CPP_SOURCES CONFIGURE_DEPENDS "${COMMON_CPP_DIR}/worklets/*.cpp") | ||
| file(GLOB_RECURSE WORKLETS_ANDROID_CPP_SOURCES CONFIGURE_DEPENDS "${ANDROID_CPP_DIR}/worklets/*.cpp") | ||
| file(GLOB_RECURSE WORKLETS_COMMON_CPP_SOURCES CONFIGURE_DEPENDS | ||
| "${COMMON_CPP_DIR}/worklets/*.cpp") | ||
| file(GLOB_RECURSE WORKLETS_ANDROID_CPP_SOURCES CONFIGURE_DEPENDS | ||
| "${ANDROID_CPP_DIR}/worklets/*.cpp") | ||
|
|
||
| # Consume shared libraries and headers from prefabs | ||
| find_package(fbjni REQUIRED CONFIG) | ||
| find_package(ReactAndroid REQUIRED CONFIG) | ||
|
|
||
| if(${JS_RUNTIME} STREQUAL "hermes") | ||
| find_package(hermes-engine REQUIRED CONFIG) | ||
| find_package(hermes-engine REQUIRED CONFIG) | ||
| endif() | ||
|
|
||
| add_library( | ||
| worklets | ||
| SHARED | ||
| ${WORKLETS_COMMON_CPP_SOURCES} | ||
| ${WORKLETS_ANDROID_CPP_SOURCES} | ||
| ) | ||
| add_library(worklets SHARED ${WORKLETS_COMMON_CPP_SOURCES} | ||
| ${WORKLETS_ANDROID_CPP_SOURCES}) | ||
|
|
||
| # includes | ||
| target_include_directories( | ||
| worklets | ||
| PUBLIC | ||
| "${COMMON_CPP_DIR}" | ||
| "${ANDROID_CPP_DIR}" | ||
| ) | ||
| target_include_directories(worklets PUBLIC "${COMMON_CPP_DIR}" | ||
| "${ANDROID_CPP_DIR}") | ||
|
|
||
| target_include_directories( | ||
| worklets | ||
| PRIVATE | ||
| "${REACT_NATIVE_DIR}/ReactCommon" | ||
| "${REACT_NATIVE_DIR}/ReactAndroid/src/main/jni/react/turbomodule" | ||
| "${REACT_NATIVE_DIR}/ReactCommon/react/nativemodule/core/ReactCommon" | ||
| "${REACT_NATIVE_DIR}/ReactCommon/callinvoker" | ||
| "${REACT_NATIVE_DIR}/ReactCommon/runtimeexecutor" | ||
| ) | ||
| worklets | ||
| PRIVATE "${REACT_NATIVE_DIR}/ReactCommon" | ||
| "${REACT_NATIVE_DIR}/ReactAndroid/src/main/jni/react/turbomodule" | ||
| "${REACT_NATIVE_DIR}/ReactCommon/react/nativemodule/core/ReactCommon" | ||
| "${REACT_NATIVE_DIR}/ReactCommon/callinvoker" | ||
| "${REACT_NATIVE_DIR}/ReactCommon/runtimeexecutor") | ||
|
|
||
| if(${IS_NEW_ARCHITECTURE_ENABLED}) | ||
| target_include_directories( | ||
| worklets | ||
| PRIVATE | ||
| "${REACT_NATIVE_DIR}/ReactCommon/yoga" | ||
| "${REACT_NATIVE_DIR}/ReactCommon/react/renderer/graphics/platform/cxx" | ||
| ) | ||
| target_include_directories( | ||
| worklets | ||
| PRIVATE | ||
| "${REACT_NATIVE_DIR}/ReactCommon/yoga" | ||
| "${REACT_NATIVE_DIR}/ReactCommon/react/renderer/graphics/platform/cxx") | ||
|
|
||
| if(ReactAndroid_VERSION_MINOR LESS 76) | ||
| target_link_libraries( | ||
| worklets | ||
| ReactAndroid::fabricjni | ||
| ReactAndroid::react_debug | ||
| ReactAndroid::react_render_core | ||
| ReactAndroid::react_render_componentregistry | ||
| ReactAndroid::rrc_view | ||
| ) | ||
| endif() | ||
| if(ReactAndroid_VERSION_MINOR LESS 76) | ||
| target_link_libraries( | ||
| worklets ReactAndroid::fabricjni ReactAndroid::react_debug | ||
| ReactAndroid::react_render_core | ||
| ReactAndroid::react_render_componentregistry ReactAndroid::rrc_view) | ||
| endif() | ||
| endif() | ||
|
|
||
| # build shared lib | ||
| set_target_properties( | ||
| worklets | ||
| PROPERTIES | ||
| LINKER_LANGUAGE | ||
| CXX | ||
| ) | ||
| set_target_properties(worklets PROPERTIES LINKER_LANGUAGE CXX) | ||
|
|
||
| target_link_libraries( | ||
| worklets | ||
| log | ||
| ReactAndroid::jsi | ||
| fbjni::fbjni | ||
| ) | ||
| target_link_libraries(worklets log ReactAndroid::jsi fbjni::fbjni) | ||
|
|
||
| if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76) | ||
| target_link_libraries( | ||
| worklets | ||
| ReactAndroid::reactnative | ||
| ) | ||
| target_link_libraries(worklets ReactAndroid::reactnative) | ||
| else() | ||
| target_link_libraries( | ||
| worklets | ||
| ReactAndroid::react_nativemodule_core | ||
| ReactAndroid::folly_runtime | ||
| ReactAndroid::glog | ||
| ReactAndroid::reactnativejni | ||
| ) | ||
| target_link_libraries( | ||
| worklets ReactAndroid::react_nativemodule_core ReactAndroid::folly_runtime | ||
| ReactAndroid::glog ReactAndroid::reactnativejni) | ||
| endif() | ||
|
|
||
| if(${JS_RUNTIME} STREQUAL "hermes") | ||
| target_link_libraries( | ||
| worklets | ||
| hermes-engine::libhermes | ||
| ) | ||
| target_link_libraries(worklets hermes-engine::libhermes) | ||
|
|
||
| if(${HERMES_ENABLE_DEBUGGER}) | ||
| if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76) | ||
| target_link_libraries( | ||
| worklets | ||
| ReactAndroid::hermestooling | ||
| ) | ||
| else() | ||
| target_link_libraries( | ||
| worklets | ||
| ReactAndroid::hermes_executor | ||
| ) | ||
| endif() | ||
| endif() | ||
| elseif(${JS_RUNTIME} STREQUAL "jsc") | ||
| if(${HERMES_ENABLE_DEBUGGER}) | ||
| if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76) | ||
| target_link_libraries( | ||
| worklets | ||
| ReactAndroid::jsctooling | ||
| ) | ||
| target_link_libraries(worklets ReactAndroid::hermestooling) | ||
| else() | ||
| target_link_libraries( | ||
| worklets | ||
| ReactAndroid::jscexecutor | ||
| ) | ||
| target_link_libraries(worklets ReactAndroid::hermes_executor) | ||
| endif() | ||
| endif() | ||
| elseif(${JS_RUNTIME} STREQUAL "jsc") | ||
| if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76) | ||
| target_link_libraries(worklets ReactAndroid::jsctooling) | ||
| else() | ||
| target_link_libraries(worklets ReactAndroid::jscexecutor) | ||
| endif() | ||
| elseif(${JS_RUNTIME} STREQUAL "v8") | ||
| # TODO: Refactor this when adding support for newest V8 | ||
| target_include_directories( | ||
| worklets | ||
| PRIVATE | ||
| "${JS_RUNTIME_DIR}/src" | ||
| ) | ||
| file(GLOB V8_SO_DIR "${JS_RUNTIME_DIR}/android/build/intermediates/library_jni/**/jni/${ANDROID_ABI}") | ||
| find_library( | ||
| V8EXECUTOR_LIB | ||
| v8executor | ||
| PATHS ${V8_SO_DIR} | ||
| NO_DEFAULT_PATH | ||
| NO_CMAKE_FIND_ROOT_PATH | ||
| ) | ||
| target_link_libraries( | ||
| worklets | ||
| ${V8EXECUTOR_LIB} | ||
| ) | ||
| # TODO: Refactor this when adding support for newest V8 | ||
| target_include_directories(worklets PRIVATE "${JS_RUNTIME_DIR}/src") | ||
| file( | ||
| GLOB | ||
| V8_SO_DIR | ||
| "${JS_RUNTIME_DIR}/android/build/intermediates/library_jni/**/jni/${ANDROID_ABI}" | ||
| ) | ||
| find_library( | ||
| V8EXECUTOR_LIB v8executor | ||
| PATHS ${V8_SO_DIR} | ||
| NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) | ||
| target_link_libraries(worklets ${V8EXECUTOR_LIB}) | ||
| endif() |
This file contains hidden or 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
This file contains hidden or 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,8 @@ | ||
| #!/bin/bash | ||
|
|
||
| if ! which cmake-format >/dev/null; then | ||
| echo "error: cmake-format is not installed" | ||
| exit 1 | ||
| fi | ||
|
|
||
| cmake-format -i "$@" | ||
This file contains hidden or 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,8 @@ | ||
| #!/bin/bash | ||
|
|
||
| if ! which cmake-lint >/dev/null; then | ||
| echo "error: cmake-lint is not installed" | ||
| exit 1 | ||
| fi | ||
|
|
||
| cmake-lint "$@" | ||
tjzel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.