-
Notifications
You must be signed in to change notification settings - Fork 37
-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for SQLite Compile-Time Options? #37
Comments
That's an interesting use case, but no, I have never tried modifying the compilation behavior of the embedded SQLite source. Indeed you can try setting flags on the CMakeLists and for iOS I would assume you need to set them somewhere on the XCode build settings. |
Arent those flags global though? You can try first setting them globally in your environment to see if that works. Then try to figure out how to enable them in a specific project only. |
Thanks for the quick reply, and happy to hear that you think it's a possibility at least. I didn't know that these flags could be set globally, so I'll give that a shot to see if I can add any extensions at all. Global flags might be good enough for me for now, but I'll leave a comment here if I can get the flags working for the build scripts. |
Ah, no they are not global variables. https://www.sqlite.org/geopoly.html In any case, no idea tbh. You will have to play around and see what works, try it on the CMakeLists cxx flags, maybe that will work. |
That's a shame (it would almost be too convenient..!). No worries, and thanks for the guidance - I'll close this issue for now whilst I look into it further, and I'll note it here if I have any success. |
Enabling the various sqlite extensions seems like a common enough feature and part of what makes sqlite great to use. Would it be worth reopening this and figuring out how to make it easy? |
Have you tried changing the xcode settings I posted? |
Thanks, I am planning to try it in the next few days. What about Android? For me, "making it easy" means that this is documented somewhere, which then also implies long term support. |
As the author of the issue posted, cmakelists is the place where you pass c++ compilation flags. I think doesn't get any easier than that, C++ compilation is somewhat of a de-attached process from the build systems (gradle/xcode). If it works for you feel free to submit a PR documenting it in the README. I created and maintain this library in my free time, there are no long-term guarantees unless you are willing to pay for me to dedicate further time to it. |
Hi Oscar, understood, I didn't mean to suggest that you need to work on it with any urgency (nor that it has to be you) - I was merely stating that we should keep this issue open because it's a useful one, as well as what I meant. Regarding cmakelists, it's not obvious to me how to inject options there without forking the library and setting them inside of the forked version. |
I'm open to ideas on how to pass these flags without patch package to CMakeLists and Xcode. I didn't figure out a nice way to do it so far. |
managed to change the build config via Podfile of the RN project by using a post_install do |installer|
react_native_post_install(installer)
installer.pods_project.targets.each do |target|
if target.name == "react-native-quick-sqlite" then
target.build_configurations.each do |config|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', 'SQLITE_ENABLE_FTS5=1']
end
end
end
end Next up is CMakeLists |
ok, adding the following lines to the CMakeLists.txt works! add_definitions(
-DSQLITE_ENABLE_FTS5
) well, how can this be specified from the parent project🤔 Yes, looks like it works: In android {
defaultConfig {
externalNativeBuild {
cmake {
arguments '-DANDROID_STL=c++_shared',
"-DREACT_NATIVE_VERSION=${REACT_NATIVE_VERSION}",
"-DNODE_MODULES_DIR=${nodeModules}",
"-DSQLITE_FLAGS='-DSQLITE_ENABLE_FTS5'"
}
}
} In add_definitions(
${SQLITE_FLAGS}
) |
It lets you enable compile-time options like FTS5 fix ospfranco#37
Looking at this library as a replacement for react-native-sqlite-storage in a project I'm working on and first impressions are great.
I've got requirements for enabling FTS5 and Geopoly extensions. This seems possible with this library as opposed to RNSS since the SQLite source is compiled from /cpp for both iOS and Android, instead of using the phone's SQLite. Is there any method of setting compile-time options for enabling specific extensions (e.g. SQLITE_ENABLE_GEOPOLY) ?
The closest I have reached is presuming that you can set options somewhere in 'CMakeLists.txt' for Android and the podspec for iOS, but I've not been having any luck.
Thanks.
The text was updated successfully, but these errors were encountered: