Skip to content

Commit

Permalink
Unify BUCK and CMake includes for Cxx modules (facebook#43148)
Browse files Browse the repository at this point in the history
Summary:

This diff adds the `react/renderer/components` prefix to the generated `CMakeLists.txt` file for the Cxx modules.
This will allow to import the generated JSI header also like this
```
#include <MyModule/MyModuleJSI.h>
```
and not just like this
```
#include "MyModuleJSI.h"
```
This will make CMake includes consistent with BUCK includes, and we'll reduce the number of awkward ifdefs in the include section.

Changelog: [General][Changed] - Unify BUCK and CMake includes for Cxx modules.

Differential Revision: D54063743
  • Loading branch information
dmytrorykun authored and facebook-github-bot committed Feb 22, 2024
1 parent f45dd4c commit d44f48a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ add_library(
\${react_codegen_SRCS}
)
target_include_directories(react_codegen_${libraryName} PUBLIC . react/renderer/components/${libraryName})
target_include_directories(react_codegen_${libraryName} PUBLIC . react/renderer/components react/renderer/components/${libraryName})
target_link_libraries(
react_codegen_${libraryName}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ add_library(
\${react_codegen_SRCS}
)
target_include_directories(react_codegen_SampleWithUppercaseName PUBLIC . react/renderer/components/SampleWithUppercaseName)
target_include_directories(react_codegen_SampleWithUppercaseName PUBLIC . react/renderer/components react/renderer/components/SampleWithUppercaseName)
target_link_libraries(
react_codegen_SampleWithUppercaseName
Expand Down Expand Up @@ -137,7 +137,7 @@ add_library(
\${react_codegen_SRCS}
)
target_include_directories(react_codegen_complex_objects PUBLIC . react/renderer/components/complex_objects)
target_include_directories(react_codegen_complex_objects PUBLIC . react/renderer/components react/renderer/components/complex_objects)
target_link_libraries(
react_codegen_complex_objects
Expand Down Expand Up @@ -217,7 +217,7 @@ add_library(
\${react_codegen_SRCS}
)
target_include_directories(react_codegen_cxx_only_native_modules PUBLIC . react/renderer/components/cxx_only_native_modules)
target_include_directories(react_codegen_cxx_only_native_modules PUBLIC . react/renderer/components react/renderer/components/cxx_only_native_modules)
target_link_libraries(
react_codegen_cxx_only_native_modules
Expand Down Expand Up @@ -304,7 +304,7 @@ add_library(
\${react_codegen_SRCS}
)
target_include_directories(react_codegen_empty_native_modules PUBLIC . react/renderer/components/empty_native_modules)
target_include_directories(react_codegen_empty_native_modules PUBLIC . react/renderer/components react/renderer/components/empty_native_modules)
target_link_libraries(
react_codegen_empty_native_modules
Expand Down Expand Up @@ -391,7 +391,7 @@ add_library(
\${react_codegen_SRCS}
)
target_include_directories(react_codegen_native_modules_with_type_aliases PUBLIC . react/renderer/components/native_modules_with_type_aliases)
target_include_directories(react_codegen_native_modules_with_type_aliases PUBLIC . react/renderer/components react/renderer/components/native_modules_with_type_aliases)
target_link_libraries(
react_codegen_native_modules_with_type_aliases
Expand Down Expand Up @@ -486,7 +486,7 @@ add_library(
\${react_codegen_SRCS}
)
target_include_directories(react_codegen_real_module_example PUBLIC . react/renderer/components/real_module_example)
target_include_directories(react_codegen_real_module_example PUBLIC . react/renderer/components react/renderer/components/real_module_example)
target_link_libraries(
react_codegen_real_module_example
Expand Down Expand Up @@ -573,7 +573,7 @@ add_library(
\${react_codegen_SRCS}
)
target_include_directories(react_codegen_simple_native_modules PUBLIC . react/renderer/components/simple_native_modules)
target_include_directories(react_codegen_simple_native_modules PUBLIC . react/renderer/components react/renderer/components/simple_native_modules)
target_link_libraries(
react_codegen_simple_native_modules
Expand Down Expand Up @@ -668,7 +668,7 @@ add_library(
\${react_codegen_SRCS}
)
target_include_directories(react_codegen_two_modules_different_files PUBLIC . react/renderer/components/two_modules_different_files)
target_include_directories(react_codegen_two_modules_different_files PUBLIC . react/renderer/components react/renderer/components/two_modules_different_files)
target_link_libraries(
react_codegen_two_modules_different_files
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@

#if __has_include(<ReactCodegen/AppSpecsJSI.h>) // CocoaPod headers on Apple
#include <ReactCodegen/AppSpecsJSI.h>
#elif __has_include("AppSpecsJSI.h") // Cmake headers on Android
#include "AppSpecsJSI.h"
#else // BUCK headers
#else
#include <AppSpecs/AppSpecsJSI.h>
#endif
#include <memory>
Expand Down

0 comments on commit d44f48a

Please sign in to comment.