chore: Clean up root directory (#236)
* Clean up root * remove unused REA patches * Remove `cpp/` and create headers per platform * fix `#import` * fix `VISION_CAMERA_DISABLE_FRAME_PROCESSORS`
This commit is contained in:
@@ -1,64 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <jsi/jsi.h>
|
||||
#include <memory>
|
||||
|
||||
#ifdef ON_ANDROID
|
||||
|
||||
// on Android we need to pass FOR_HERMES flag to determine if hermes is used or not since both headers are there.
|
||||
|
||||
#if FOR_HERMES
|
||||
// Hermes
|
||||
#include <hermes/hermes.h>
|
||||
#else
|
||||
// JSC
|
||||
#include <jsi/JSCRuntime.h>
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
// on iOS, we simply check by __has_include. Headers are only available if the sources are there too.
|
||||
|
||||
#if __has_include(<reacthermes/HermesExecutorFactory.h>)
|
||||
// Hermes (https://hermesengine.dev) (RN 0.65+)
|
||||
#include <reacthermes/HermesExecutorFactory.h>
|
||||
#elif __has_include(<hermes/hermes.h>)
|
||||
// Hermes (https://hermesengine.dev)
|
||||
#include <hermes/hermes.h>
|
||||
#elif __has_include(<v8runtime/V8RuntimeFactory.h>)
|
||||
// V8 (https://github.com/Kudo/react-native-v8)
|
||||
#include <v8runtime/V8RuntimeFactory.h>
|
||||
#else
|
||||
// JSC
|
||||
#include <jsi/JSCRuntime.h>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
using namespace facebook;
|
||||
|
||||
namespace vision {
|
||||
|
||||
static std::unique_ptr<jsi::Runtime> makeJSIRuntime() {
|
||||
#ifdef ON_ANDROID
|
||||
|
||||
#if FOR_HERMES
|
||||
return facebook::hermes::makeHermesRuntime();
|
||||
#else
|
||||
return facebook::jsc::makeJSCRuntime();
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#if __has_include(<hermes/hermes.h>) || __has_include(<reacthermes/HermesExecutorFactory.h>)
|
||||
return facebook::hermes::makeHermesRuntime();
|
||||
#elif __has_include(<v8runtime/V8RuntimeFactory.h>)
|
||||
return facebook::createV8Runtime("");
|
||||
#else
|
||||
return facebook::jsc::makeJSCRuntime();
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace vision
|
@@ -1,26 +0,0 @@
|
||||
# cpp
|
||||
|
||||
This folder contains the Shared C++ code for react-native-vision-camera.
|
||||
|
||||
## Prerequesites
|
||||
|
||||
1. For Android, download the [NDK and build tools](https://developer.android.com/studio/projects/add-native-code#download-ndk)
|
||||
2. For iOS, Xcode will be enough.
|
||||
3. Install cpplint
|
||||
```sh
|
||||
brew install cpplint
|
||||
```
|
||||
|
||||
## Getting Started
|
||||
|
||||
It is recommended that you work on the code using the Example project (`example/android/` or `example/ios/VisionCameraExample.xcworkspace`), since that always includes the React Native header files, plus you can easily test changes that way.
|
||||
|
||||
You can however still edit the library project here by opening this folder with any C++ editor.
|
||||
|
||||
## Committing
|
||||
|
||||
Before committing, make sure that you're not violating the cpplint codestyles. To do that, run the following command:
|
||||
|
||||
```bash
|
||||
yarn check-cpp
|
||||
```
|
@@ -1,20 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Logger.h"
|
||||
#include <string>
|
||||
|
||||
namespace vision {
|
||||
|
||||
class SpeedChecker {
|
||||
public:
|
||||
static void checkSpeed(std::string tag, std::function<void()> fun) {
|
||||
auto start = std::chrono::system_clock::now();
|
||||
fun();
|
||||
auto end = std::chrono::system_clock::now();
|
||||
std::chrono::duration<double> elapsed_seconds = end-start;
|
||||
tag += " " + std::to_string(elapsed_seconds.count()) + "s";
|
||||
Logger::log(tag.c_str());
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace vision
|
Reference in New Issue
Block a user