Skip to content

Conversation

cortinico
Copy link
Member

Summary:

Autolinking for New Architecture, on Android, with CMake, with more than 1 library is currently broken. The reason is that the library list is separated by \ (as it was supposed to be for Android.mk) that are not a valid char for CMake (see https://cmake.org/cmake/help/latest/manual/cmake-language.7.html#cmake-language-lists for reference).

Test Plan:

I've tested this against https://github.com/react-native-community/RNNewArchitectureApp.

Before:

# This code was generated by [React Native CLI](https://www.npmjs.com/package/@react-native-community/cli)

cmake_minimum_required(VERSION 3.13)
set(CMAKE_VERBOSE_MAKEFILE on)

add_subdirectory(/Users/ncor/pg/RNNewArchitectureApp/AwesomeApp/node_modules/calculator/android/build/generated/source/codegen/jni/ calculator_autolinked_build)
add_subdirectory(/Users/ncor/pg/RNNewArchitectureApp/AwesomeApp/node_modules/centered-text/android/build/generated/source/codegen/jni/ centeredtext_autolinked_build)

set(AUTOLINKED_LIBRARIES
  react_codegen_calculator \
  react_codegen_centeredtext
)

After:

# This code was generated by [React Native CLI](https://www.npmjs.com/package/@react-native-community/cli)

cmake_minimum_required(VERSION 3.13)
set(CMAKE_VERBOSE_MAKEFILE on)

add_subdirectory(/Users/ncor/pg/RNNewArchitectureApp/AwesomeApp/node_modules/calculator/android/build/generated/source/codegen/jni/ calculator_autolinked_build)
add_subdirectory(/Users/ncor/pg/RNNewArchitectureApp/AwesomeApp/node_modules/centered-text/android/build/generated/source/codegen/jni/ centeredtext_autolinked_build)

set(AUTOLINKED_LIBRARIES
  react_codegen_calculator
  react_codegen_centeredtext
)

Copy link
Member

@thymikee thymikee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@thymikee thymikee merged commit aa8299b into react-native-community:main Jul 28, 2022
@cortinico cortinico deleted the nc/autolinking-cmake-slash branch July 28, 2022 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants