react-native-macos/ReactCommon/jsi
Ryan Tremblay f5d00e5a29 Fix jsi cmake include dirs (#207)
Summary:
I'm trying to use JSI for a React Native custom module. I saw these existing examples where the JSI API is used in the context of a CMakeLists.txt:
https://github.com/terrysahaidak/host-object-test/blob/master/libs/android-jsi/test-jsi/src/main/cpp/CMakeLists.txt
https://github.com/ericlewis/react-native-hostobject-demo/pull/4/files#diff-834320be1b4e4016bac27c05dcd17fb9
In both cases, they manually grab the include directories and jsi.cpp from node_modules/react-native, but I also saw that node_modules/react-native/ReactCommon/jsi/jsi already has a CMakeLists.txt that appears to be intended to provide a jsi static lib, so I tried to pull this into my own CMakeLists.txt like this:
```
add_subdirectory(${RN_DIR}/ReactCommon/jsi/jsi ${CMAKE_CURRENT_BINARY_DIR}/jsi)
...
target_link_libraries(MyLib jsi)
```
Unfortunately when doing this, the consuming project still doesn't see the correct include directories. The change I'm proposing here is to use `target_include_directories` and declare that `..` is a public (to consumers) include directory for the library named `jsi`. With this change, you can do what I showed above to consume the jsi lib by just pulling in the CMakeLists.txt file into your own CMakeLists.txt file.

Changelog: [General][Fixed] Fix jsi cmake include dirs

Pull Request resolved: https://github.com/facebook/hermes/pull/207

Reviewed By: willholen

Differential Revision: D21074270

Pulled By: tmikov

fbshipit-source-id: 7d9ec3255f57a16c0b2be489dffa4540727738a1
2020-04-16 16:34:41 -07:00
..
jsi Fix jsi cmake include dirs (#207) 2020-04-16 16:34:41 -07:00
.clang-tidy The life-changing magic of clang-tidying up 2020-02-04 11:09:30 -08:00
Android.mk Move JSI source files into a separate directory 2019-04-09 11:44:32 -07:00
BUCK Replace fbsource// with // in xplat/js/ files [1] 2020-03-25 21:55:47 -07:00
JSCRuntime.cpp Codemod: Clang-format for all files in `ReactCommon` directory 2020-02-25 19:52:27 -08:00
JSCRuntime.h Tidy up license headers [3/n] 2019-10-16 10:06:34 -07:00
React-jsi.podspec Updating the URLs to point at new domain name reactnative.dev 2020-02-24 13:09:11 -08:00