From de1e07daf4dbdb60de61985ba036782eea24ba4e Mon Sep 17 00:00:00 2001 From: Relintai Date: Wed, 6 Jul 2022 18:26:17 +0200 Subject: [PATCH] Work on getting the sqlite module to compile. --- modules/database_sqlite/SCsub | 34 ++++++++++++++++++++++ modules/database_sqlite/config.py | 9 ++++++ modules/database_sqlite/register_types.cpp | 32 ++++++++++++++++++++ modules/database_sqlite/register_types.h | 24 +++++++++++++++ 4 files changed, 99 insertions(+) create mode 100644 modules/database_sqlite/register_types.cpp create mode 100644 modules/database_sqlite/register_types.h diff --git a/modules/database_sqlite/SCsub b/modules/database_sqlite/SCsub index 916157642..f25c5991b 100644 --- a/modules/database_sqlite/SCsub +++ b/modules/database_sqlite/SCsub @@ -10,3 +10,37 @@ # Build it all as a library #lib = env_db.add_library("database_sqlite", env_db.core_sources) #env.Prepend(LIBS=[lib]) + + +import os +import version + +Import('env') + +module_env = env.Clone() + +sources = [ + "register_types.cpp", + + "sqlite/sqlite3.c" + + "sqlite3_database.cpp", + "sqlite3_database_connection.cpp", + "sqlite3_database_manager.cpp", + "sqlite3_query_builder.cpp", + "sqlite3_query_result.cpp", + "sqlite3_table_builder.cpp", +] + +if ARGUMENTS.get('custom_modules_shared', 'no') == 'yes': + # Shared lib compilation + module_env.Append(CCFLAGS=['-fPIC']) + module_env['LIBS'] = [] + shared_lib = module_env.SharedLibrary(target='#bin/database_sqlite', source=sources) + shared_lib_shim = shared_lib[0].name.rsplit('.', 1)[0] + env.Append(LIBS=[shared_lib_shim]) + env.Append(LIBPATH=['#bin']) +else: + # Static compilation + module_env.add_source_files(env.modules_sources, sources) + diff --git a/modules/database_sqlite/config.py b/modules/database_sqlite/config.py index 73ca17780..02d8fcfee 100644 --- a/modules/database_sqlite/config.py +++ b/modules/database_sqlite/config.py @@ -46,3 +46,12 @@ def _configure(env): env.Append(LINKFLAGS=["-ldl"]) +def get_doc_classes(): + return [ + #"", + "Sqlite3Database", + ] + +def get_doc_path(): + return "doc_classes" + diff --git a/modules/database_sqlite/register_types.cpp b/modules/database_sqlite/register_types.cpp new file mode 100644 index 000000000..3833cecd8 --- /dev/null +++ b/modules/database_sqlite/register_types.cpp @@ -0,0 +1,32 @@ +/* +Copyright (c) 2022 Péter Magyar + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +#include "register_types.h" + +#include "sqlite3_database.h" + +void register_database_sqlite_types() { + ClassDB::register_class(); +} + +void unregister_database_sqlite_types() { +} diff --git a/modules/database_sqlite/register_types.h b/modules/database_sqlite/register_types.h new file mode 100644 index 000000000..a481af205 --- /dev/null +++ b/modules/database_sqlite/register_types.h @@ -0,0 +1,24 @@ +/* +Copyright (c) 2022 Péter Magyar + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +void register_database_sqlite_types(); +void unregister_database_sqlite_types();