Skip to content

Commit 2a15548

Browse files
committed
initial docs
1 parent 8790e00 commit 2a15548

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

docs/docs/cpp_usage.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
sidebar_position: 10
3+
---
4+
5+
# C++ Usage
6+
7+
In certain scenarios, you may prefer direct access to SQLite C++ code, allowing efficient database operations directly from C++ in a React Native environment, independent of JavaScript.
8+
9+
## Android CMake Integration
10+
11+
The package supports prefab publishing for Android, which allows you to access it from within your CMakeLists.txt file.
12+
13+
Add the following to your `CMakeLists.txt`:
14+
15+
```cmake
16+
find_package(op-engineering_op-sqlite REQUIRED CONFIG)
17+
18+
# Link all libraries together
19+
target_link_libraries(
20+
${PACKAGE_NAME}
21+
${LOG_LIB}
22+
android
23+
op-engineering_op-sqlite::op-sqlite
24+
)
25+
```
26+
27+
## Header File Inclusion
28+
29+
Due to platform differences, you need to include the SQLite header differently for Android and iOS:
30+
31+
### Example on how to include the headers in C++
32+
33+
```cpp
34+
#ifdef __ANDROID__
35+
#include <op-engineering_op-sqlite/sqlite3.h>
36+
#include <op-engineering_op-sqlite/bridge.h>
37+
#else
38+
#include <op-sqlite/sqlite3.h>
39+
#include <op-sqlite/bridge.h>
40+
#endif
41+
```

0 commit comments

Comments
 (0)