Compare commits

..

3 Commits

Author SHA1 Message Date
Brett e991337bee minior fix 2024-02-28 00:09:04 -05:00
Brett 853c58a853 Merge remote-tracking branch 'refs/remotes/origin/main' 2024-02-27 23:58:11 -05:00
Brett 069444a1e0 cmake 2024-02-27 23:58:07 -05:00
4 changed files with 10 additions and 6 deletions

View File

@ -5,8 +5,13 @@ option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF)
option(ENABLE_UBSAN "Enable the ub sanitizer" OFF) option(ENABLE_UBSAN "Enable the ub sanitizer" OFF)
option(ENABLE_TSAN "Enable the thread data race sanitizer" OFF) option(ENABLE_TSAN "Enable the thread data race sanitizer" OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
#set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
#set(BUILD_SHARED_LIBS OFF)
#set(POSITION_INDEPENDENT_CODE ON)
add_compile_options(-march=native) add_compile_options(-march=native)
set(SQLITE_ORM_ENABLE_CXX_17 ON) set(SQLITE_ORM_ENABLE_CXX_17 ON)
@ -14,7 +19,6 @@ set(SQLITE_ORM_ENABLE_CXX_17 ON)
add_subdirectory(libs/blt) add_subdirectory(libs/blt)
add_subdirectory(libs/DPP-10.0.29) add_subdirectory(libs/DPP-10.0.29)
add_subdirectory(libs/sqlite_orm-1.8.2) add_subdirectory(libs/sqlite_orm-1.8.2)
add_subdirectory(libs/SQLiteCpp-3.3.1)
find_package(CURL) find_package(CURL)
@ -26,11 +30,10 @@ add_executable(discord_bot ${PROJECT_BUILD_FILES})
target_compile_options(discord_bot PUBLIC -Wall -Wpedantic -Wno-comment -march=native) target_compile_options(discord_bot PUBLIC -Wall -Wpedantic -Wno-comment -march=native)
target_link_options(discord_bot PUBLIC -Wall -Wpedantic -Wno-comment) target_link_options(discord_bot PUBLIC -Wall -Wpedantic -Wno-comment)
target_link_libraries(discord_bot PUBLIC BLT) target_link_libraries(discord_bot PUBLIC curl)
target_link_libraries(discord_bot PUBLIC dpp) target_link_libraries(discord_bot PUBLIC dpp)
target_link_libraries(discord_bot PUBLIC sqlite_orm) target_link_libraries(discord_bot PUBLIC sqlite_orm)
target_link_libraries(discord_bot PUBLIC curl) target_link_libraries(discord_bot PUBLIC BLT)
target_link_libraries(discord_bot PUBLIC SQLiteCpp sqlite3 pthread dl)
if (${ENABLE_ADDRSAN} MATCHES ON) if (${ENABLE_ADDRSAN} MATCHES ON)
target_compile_options(discord_bot PRIVATE -fsanitize=address) target_compile_options(discord_bot PRIVATE -fsanitize=address)

View File

@ -145,6 +145,7 @@ namespace db
auto make_message_table() auto make_message_table()
{ {
using namespace sqlite_orm;
return make_table("messages", return make_table("messages",
make_column("messageID", &message_t::messageID, primary_key()), make_column("messageID", &message_t::messageID, primary_key()),
make_column("channelID", &message_t::channelID), make_column("channelID", &message_t::channelID),

@ -1 +1 @@
Subproject commit 9b4d0cc9a8493c608ab0075ab2c6a2b66061f3be Subproject commit 9ad652195b0a69f9977d313eff4dd01a7890f1df

View File

@ -27,7 +27,7 @@ struct db_obj
std::queue<blt::u64> user_load_queue; std::queue<blt::u64> user_load_queue;
std::mutex user_load_queue_mutex; std::mutex user_load_queue_mutex;
database_type db; database_type db;
std::thread* thread; std::thread* thread = nullptr;
public: public:
explicit db_obj(blt::u64 guildID, const std::string& path): guildID(guildID), db(make_database(path + "/" + std::to_string(guildID) + "/")) explicit db_obj(blt::u64 guildID, const std::string& path): guildID(guildID), db(make_database(path + "/" + std::to_string(guildID) + "/"))