Removed Boost dependency, changed MySQL library to MariaDB

This commit is contained in:
2024-10-12 08:59:16 +03:00
parent 7cc9550efc
commit d4fa88b7e2
32 changed files with 117 additions and 260 deletions

View File

@ -20,23 +20,19 @@ endif()
# Treat char variables as signed, especially useful for ARM builds
target_compile_options(${PROJECT_NAME} PUBLIC -fsigned-char)
# Find dependencies
# Find and link dependencies
#
# vcpkg dependencies
#
# Boost
find_package(Boost COMPONENTS system REQUIRED)
target_link_libraries (${PROJECT_NAME} PRIVATE Boost::boost Boost::system)
# Libevent
find_package(Libevent CONFIG REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE libevent::core libevent::extra libevent::pthreads)
target_link_libraries(${PROJECT_NAME} libevent::core libevent::extra libevent::pthreads)
# effolkronium/random
find_package(effolkronium_random CONFIG REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE effolkronium_random)
target_link_libraries(${PROJECT_NAME} effolkronium_random)
#
# System-provided dependencies
@ -45,9 +41,9 @@ target_link_libraries(${PROJECT_NAME} PRIVATE effolkronium_random)
# Pthreads
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE Threads::Threads)
target_link_libraries(${PROJECT_NAME} Threads::Threads)
# LibBSD
target_link_libraries(${PROJECT_NAME} PRIVATE bsd)
target_link_libraries(${PROJECT_NAME} bsd)
target_link_libraries(${PROJECT_NAME} PRIVATE libpoly libsql libthecore)
target_link_libraries(${PROJECT_NAME} libpoly libsql libthecore)

View File

@ -20,15 +20,15 @@ endif()
# Treat char variables as signed, especially useful for ARM builds
target_compile_options(${PROJECT_NAME} PUBLIC -fsigned-char)
# Find dependencies
# Find and link dependencies
#
# vcpkg dependencies
#
# MySQL
find_package(unofficial-libmysql REQUIRED)
target_link_libraries(${PROJECT_NAME} unofficial::libmysql::libmysql)
# MariaDB
find_package(unofficial-libmariadb REQUIRED)
target_link_libraries(${PROJECT_NAME} unofficial::libmariadb)
# Argon2
find_package(unofficial-argon2 CONFIG REQUIRED)
@ -36,11 +36,7 @@ target_link_libraries(${PROJECT_NAME} unofficial::argon2::libargon2)
# Crypto++
find_package(cryptopp CONFIG REQUIRED)
target_link_libraries (${PROJECT_NAME} cryptopp::cryptopp)
# Boost
find_package(Boost REQUIRED)
target_link_libraries (${PROJECT_NAME} Boost::boost)
target_link_libraries(${PROJECT_NAME} cryptopp::cryptopp)
# Libevent
find_package(Libevent CONFIG REQUIRED)

View File

@ -9,7 +9,6 @@
#include "dragon_soul_table.h"
#include "log.h"
#include "DragonSoul.h"
#include <boost/lexical_cast.hpp>
typedef std::vector <std::string> TTokenVector;
@ -389,7 +388,7 @@ bool DSManager::ExtractDragonHeart(LPCHARACTER ch, LPITEM pItem, LPITEM pExtract
pDH->SetSocket(ITEM_SOCKET_CHARGING_AMOUNT_IDX, iCharge);
ch->AutoGiveItem(pDH, true);
std::string s = boost::lexical_cast <std::string> (iCharge);
std::string s = std::to_string(iCharge);
s += "%s";
LogManager::instance().ItemLog(ch, pItem, "DS_HEART_EXTRACT_SUCCESS", s.c_str());
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Dragon Stone remaining duration has been extracted."));

View File

@ -1,7 +1,6 @@
#ifndef IFILEMONITOR_INCLUDED
#define IFILEMONITOR_INCLUDED
//#include <boost/function.hpp>
#include <unordered_map>
enum eFileUpdatedOptions

View File

@ -1,31 +1,13 @@
#include "stdafx.h"
#ifndef DEBUG_ALLOC
#include <boost/pool/object_pool.hpp>
#endif
#include "affect.h"
#ifndef DEBUG_ALLOC
boost::object_pool<CAffect> affect_pool;
#endif
CAffect* CAffect::Acquire()
{
#ifndef DEBUG_ALLOC
return affect_pool.malloc();
#else
return M2_NEW CAffect;
#endif
}
void CAffect::Release(CAffect* p)
{
#ifndef DEBUG_ALLOC
affect_pool.free(p);
#else
M2_DELETE(p);
#endif
}

View File

@ -10,7 +10,6 @@
#include "item_manager.h"
#include "log.h"
#include "db.h"
#include <boost/bind.hpp>
#include "item.h"
#include "desc_client.h"
#include <common/tables.h>

View File

@ -4244,7 +4244,7 @@ bool CHARACTER::RequestToParty(LPCHARACTER leader)
void CHARACTER::DenyToParty(LPCHARACTER member)
{
SPDLOG_DEBUG("DenyToParty {} member {} {}", GetName(), member->GetName(), (void*) get_pointer(member->m_pkPartyRequestEvent));
SPDLOG_DEBUG("DenyToParty {} member {} {}", GetName(), member->GetName(), (void*) member->m_pkPartyRequestEvent.get());
if (!member->m_pkPartyRequestEvent)
return;
@ -4270,7 +4270,7 @@ void CHARACTER::DenyToParty(LPCHARACTER member)
void CHARACTER::AcceptToParty(LPCHARACTER member)
{
SPDLOG_DEBUG("AcceptToParty {} member {} {}", GetName(), member->GetName(), (void*) get_pointer(member->m_pkPartyRequestEvent));
SPDLOG_DEBUG("AcceptToParty {} member {} {}", GetName(), member->GetName(), (void*) member->m_pkPartyRequestEvent.get());
if (!member->m_pkPartyRequestEvent)
return;

View File

@ -160,7 +160,7 @@ void CHARACTER::StartAffectEvent()
char_event_info* info = AllocEventInfo<char_event_info>();
info->ch = this;
m_pkAffectEvent = event_create(affect_event, info, passes_per_sec);
SPDLOG_DEBUG("StartAffectEvent {} {} {}", GetName(), (void*) this, (void*) get_pointer(m_pkAffectEvent));
SPDLOG_DEBUG("StartAffectEvent {} {} {}", GetName(), (void*) this, (void*) m_pkAffectEvent.get());
}
void CHARACTER::ClearAffect(bool bSave)

View File

@ -1420,7 +1420,7 @@ void CHARACTER::Dead(LPCHARACTER pkKiller, bool bImmediateDead)
{
if (m_pkDeadEvent)
{
SPDLOG_DEBUG("DEAD_EVENT_CANCEL: {} {} {}", GetName(), (void*) this, (void*) get_pointer(m_pkDeadEvent));
SPDLOG_DEBUG("DEAD_EVENT_CANCEL: {} {} {}", GetName(), (void*) this, (void*) m_pkDeadEvent.get());
event_cancel(&m_pkDeadEvent);
}
@ -1456,7 +1456,7 @@ void CHARACTER::Dead(LPCHARACTER pkKiller, bool bImmediateDead)
}
}
SPDLOG_DEBUG("DEAD_EVENT_CREATE: {} {} {}", GetName(), (void*) this, (void*) get_pointer(m_pkDeadEvent));
SPDLOG_DEBUG("DEAD_EVENT_CREATE: {} {} {}", GetName(), (void*) this, (void*) m_pkDeadEvent.get());
}
if (m_pkExchange != NULL)

View File

@ -16,10 +16,6 @@
#include "questlua.h"
#include "locale_service.h"
#ifndef __GNUC__
#include <boost/bind.hpp>
#endif
CHARACTER_MANAGER::CHARACTER_MANAGER() :
m_iVIDCount(0),
m_pkChrSelectedStone(NULL),
@ -646,9 +642,7 @@ struct FuncUpdateAndResetChatCounter
void CHARACTER_MANAGER::Update(int iPulse)
{
using namespace std;
#ifdef __GNUC__
using namespace __gnu_cxx;
#endif
BeginPendingDestroy();
@ -659,11 +653,7 @@ void CHARACTER_MANAGER::Update(int iPulse)
// 컨테이너 복사
CHARACTER_VECTOR v;
v.reserve(m_map_pkPCChr.size());
#ifdef __GNUC__
transform(m_map_pkPCChr.begin(), m_map_pkPCChr.end(), back_inserter(v), select2nd<NAME_MAP::value_type>());
#else
transform(m_map_pkPCChr.begin(), m_map_pkPCChr.end(), back_inserter(v), boost::bind(&NAME_MAP::value_type::second, _1));
#endif
if (0 == (iPulse % PASSES_PER_SEC(5)))
{
@ -686,11 +676,8 @@ void CHARACTER_MANAGER::Update(int iPulse)
{
CHARACTER_VECTOR v;
v.reserve(m_set_pkChrState.size());
#ifdef __GNUC__
transform(m_set_pkChrState.begin(), m_set_pkChrState.end(), back_inserter(v), identity<CHARACTER_SET::value_type>());
#else
v.insert(v.end(), m_set_pkChrState.begin(), m_set_pkChrState.end());
#endif
for_each(v.begin(), v.end(), bind2nd(mem_fun(&CHARACTER::UpdateStateMachine), iPulse));
}
}
@ -1029,16 +1016,10 @@ void CHARACTER_MANAGER::FlushPendingDestroy()
CharacterVectorInteractor::CharacterVectorInteractor(const CHARACTER_SET & r)
{
using namespace std;
#ifdef __GNUC__
using namespace __gnu_cxx;
#endif
reserve(r.size());
#ifdef __GNUC__
transform(r.begin(), r.end(), back_inserter(*this), identity<CHARACTER_SET::value_type>());
#else
insert(end(), r.begin(), r.end());
#endif
if (CHARACTER_MANAGER::instance().BeginPendingDestroy())
m_bMyBegin = true;

View File

@ -3,7 +3,7 @@
#include "group_text_parse_tree.h"
#include "dragon_soul_table.h"
#include "item_manager.h"
#include <boost/lexical_cast.hpp>
const std::string g_astGradeName[] =
{
"grade_normal",
@ -789,7 +789,7 @@ bool DragonSoulTable::GetRefineStrengthValues(BYTE ds_type, BYTE material_type,
stDragonSoulName.c_str(), g_astMaterialName[material_type].c_str());
return false;
}
std::string stStrengthIdx = boost::lexical_cast <std::string> ((int)strength_idx);
std::string stStrengthIdx = std::to_string((int)strength_idx);
if (!m_pRefineStrengthTableNode->GetGroupValue(stDragonSoulName, g_astMaterialName[material_type], stStrengthIdx, prob))
{

View File

@ -30,7 +30,7 @@ LPEVENT event_create_ex(TEVENTFUNC func, event_info_data* info, int when)
#ifdef M2_USE_POOL
new_event = event_pool.Construct();
#else
new_event = M2_NEW event;
new_event = std::make_shared<event>();
#endif
assert(NULL != new_event);
@ -136,7 +136,7 @@ int event_process(int pulse)
}
else
{
new_time = (the_event->func) (get_pointer(the_event), processing_time);
new_time = (the_event->func) (the_event, processing_time);
if (new_time <= 0 || the_event->is_force_to_end)
{
@ -201,17 +201,3 @@ int event_count()
{
return cxx_q.Size();
}
void intrusive_ptr_add_ref(EVENT* p) {
++(p->ref_count);
}
void intrusive_ptr_release(EVENT* p) {
if ( --(p->ref_count) == 0 ) {
#ifdef M2_USE_POOL
event_pool.Destroy(p);
#else
M2_DELETE(p);
#endif
}
}

View File

@ -4,10 +4,9 @@
*
* Author: 김한주 (aka. 비엽, Cronan), 송영진 (aka. myevan, 빗자루)
*/
#ifndef __INC_LIBTHECORE_EVENT_H__
#define __INC_LIBTHECORE_EVENT_H__
#pragma once
#include <boost/intrusive_ptr.hpp>
#include <memory>
#ifdef M2_USE_POOL
#include "pool.h"
@ -34,7 +33,7 @@ private:
};
typedef struct event EVENT;
typedef boost::intrusive_ptr<EVENT> LPEVENT;
typedef std::shared_ptr<EVENT> LPEVENT;
typedef int (*TEVENTFUNC) (LPEVENT event, int processing_time);
#define EVENTFUNC(name) int (name) (LPEVENT event, int processing_time)
@ -63,9 +62,6 @@ struct event
size_t ref_count;
};
extern void intrusive_ptr_add_ref(EVENT* p);
extern void intrusive_ptr_release(EVENT* p);
template<class T> // T should be a subclass of event_info_data
T* AllocEventInfo() {
#ifdef M2_USE_POOL
@ -89,5 +85,3 @@ extern void event_set_verbose(int level);
extern event_info_data* FindEventInfo(DWORD dwID);
extern event_info_data* event_info(LPEVENT event);
#endif

View File

@ -1,82 +0,0 @@
#ifndef _FIFO_ALLOCATOR_H_
#define _FIFO_ALLOCATOR_H_
#include <deque>
#ifdef __GNUC__
#include <tr1/unordered_map>
#define std std::tr1
#else
#include <unordered_map>
#define std boost
#endif
// Allocator implementation detail with simple FIFO grow-only pool.
// It relies on default CRT malloc/free.
class FifoAllocator {
public:
FifoAllocator() {}
~FifoAllocator() {}
void SetUp() {}
void TearDown() {
CleanUp(); // deallocate pooled blocks
}
void* Alloc(size_t size) {
void* p = NULL;
PoolType& pool = pool_map_[size];
if (pool.size() < kWatermark) {
p = ::malloc(size);
} else {
p = pool.front();
pool.pop_front();
}
if (p != NULL) {
alloc_map_[p] = size;
}
return p;
}
void Free(void* p) {
if (p == NULL) {
return;
}
AllocMapType::iterator it = alloc_map_.find(p);
if (it == alloc_map_.end()) {
return;
}
size_t size = it->second;
alloc_map_.erase(it);
PoolMapType::iterator it2 = pool_map_.find(size);
if (it2 == pool_map_.end()) {
return;
}
PoolType& pool = it2->second;
pool.push_back(p);
}
private:
void CleanUp() {
PoolMapType::iterator it = pool_map_.begin(), end = pool_map_.end();
for ( ; it != end; ++it) {
PoolType& pool = it->second;
PoolType::iterator it2 = pool.begin(), end2 = pool.end();
for ( ; it2 != end2; ++it2) {
::free(*it2);
}
pool.clear();
}
pool_map_.clear();
}
typedef std::deque<void*> PoolType;
typedef std::unordered_map<size_t, PoolType> PoolMapType;
typedef std::unordered_map<void*, size_t> AllocMapType;
static const size_t kWatermark = 4; // FIFO enforcement level
PoolMapType pool_map_;
AllocMapType alloc_map_;
};
#endif // _FIFO_ALLOCATOR_H_

View File

@ -247,7 +247,7 @@ EVENTFUNC(horse_stamina_consume_event)
}
hr->CheckHorseHealthDropTime();
SPDLOG_DEBUG("HORSE STAMINA - {}", (void*) get_pointer(event));
SPDLOG_DEBUG("HORSE STAMINA - {}", (void*) event.get());
return delta;
}
@ -278,7 +278,7 @@ EVENTFUNC(horse_stamina_regen_event)
}
hr->CheckHorseHealthDropTime();
SPDLOG_DEBUG("HORSE STAMINA + {}", (void*) get_pointer(event));
SPDLOG_DEBUG("HORSE STAMINA + {}", (void*) event.get());
return delta;
@ -292,7 +292,7 @@ void CHorseRider::StartStaminaConsumeEvent()
if (GetHorseHealth() <= 0)
return;
SPDLOG_DEBUG("HORSE STAMINA REGEN EVENT CANCEL {}", (void*) get_pointer(m_eventStaminaRegen));
SPDLOG_DEBUG("HORSE STAMINA REGEN EVENT CANCEL {}", (void*) m_eventStaminaRegen.get());
event_cancel(&m_eventStaminaRegen);
if (m_eventStaminaConsume)
@ -302,7 +302,7 @@ void CHorseRider::StartStaminaConsumeEvent()
info->hr = this;
m_eventStaminaConsume = event_create(horse_stamina_consume_event, info, PASSES_PER_SEC(HORSE_STAMINA_CONSUME_INTERVAL));
SPDLOG_DEBUG("HORSE STAMINA CONSUME EVENT CREATE {}", (void*) get_pointer(m_eventStaminaConsume));
SPDLOG_DEBUG("HORSE STAMINA CONSUME EVENT CREATE {}", (void*) m_eventStaminaConsume.get());
}
void CHorseRider::StartStaminaRegenEvent()
@ -313,7 +313,7 @@ void CHorseRider::StartStaminaRegenEvent()
if (GetHorseHealth() <= 0)
return;
SPDLOG_DEBUG("HORSE STAMINA CONSUME EVENT CANCEL {}", (void*) get_pointer(m_eventStaminaConsume));
SPDLOG_DEBUG("HORSE STAMINA CONSUME EVENT CANCEL {}", (void*) m_eventStaminaConsume.get());
event_cancel(&m_eventStaminaConsume);
if (m_eventStaminaRegen)
@ -323,7 +323,7 @@ void CHorseRider::StartStaminaRegenEvent()
info->hr = this;
m_eventStaminaRegen = event_create(horse_stamina_regen_event, info, PASSES_PER_SEC(HORSE_STAMINA_REGEN_INTERVAL));
SPDLOG_DEBUG("HORSE STAMINA REGEN EVENT CREATE {}", (void*) get_pointer(m_eventStaminaRegen));
SPDLOG_DEBUG("HORSE STAMINA REGEN EVENT CREATE {}", (void*) m_eventStaminaRegen.get());
}
// Health
@ -358,7 +358,7 @@ void CHorseRider::UpdateHorseHealth(int iHealth, bool bSend)
void CHorseRider::HorseDie()
{
SPDLOG_DEBUG("HORSE DIE {} {}", (void*) get_pointer(m_eventStaminaRegen), (void*) get_pointer(m_eventStaminaConsume));
SPDLOG_DEBUG("HORSE DIE {} {}", (void*) m_eventStaminaRegen.get(), (void*) m_eventStaminaConsume.get());
UpdateHorseStamina(-m_Horse.sStamina);
event_cancel(&m_eventStaminaRegen);
event_cancel(&m_eventStaminaConsume);

View File

@ -1676,7 +1676,7 @@ namespace quest
void CQuestManager::AddServerTimer(const std::string& name, DWORD arg, LPEVENT event)
{
SPDLOG_DEBUG("XXX AddServerTimer {} {} {}", name, arg, (void*) get_pointer(event));
SPDLOG_DEBUG("XXX AddServerTimer {} {} {}", name, arg, (void*) event.get());
if (m_mapServerTimer.find(make_pair(name, arg)) != m_mapServerTimer.end())
{
SPDLOG_ERROR("already registered server timer name:{} arg:{}", name, arg);

View File

@ -165,7 +165,7 @@ namespace quest
{
RemoveTimer(name);
m_TimerMap.insert(make_pair(name, pEvent));
SPDLOG_DEBUG("QUEST add timer {} {}", (void*) get_pointer(pEvent), m_TimerMap.size());
SPDLOG_DEBUG("QUEST add timer {} {}", (void*) pEvent.get(), m_TimerMap.size());
}
void PC::RemoveTimerNotCancel(const string & name)
@ -174,7 +174,7 @@ namespace quest
if (it != m_TimerMap.end())
{
SPDLOG_DEBUG("QUEST remove with no cancel {}", (void*) get_pointer(it->second));
SPDLOG_DEBUG("QUEST remove with no cancel {}", (void*) it->second.get());
m_TimerMap.erase(it);
}
@ -187,7 +187,7 @@ namespace quest
if (it != m_TimerMap.end())
{
SPDLOG_DEBUG("QUEST remove timer {}", (void*) get_pointer(it->second));
SPDLOG_DEBUG("QUEST remove timer {}", (void*) it->second.get());
CancelTimerEvent(&it->second);
m_TimerMap.erase(it);
}

View File

@ -2,29 +2,23 @@
#include "../../libgame/include/grid.h"
#include "constants.h"
#include "utils.h"
#include "config.h"
#include "shop.h"
#include "desc.h"
#include "desc_manager.h"
#include "char.h"
#include "char_manager.h"
#include "item.h"
#include "item_manager.h"
#include "buffer_manager.h"
#include "packet.h"
#include "log.h"
#include "db.h"
#include "questmanager.h"
#include "monarch.h"
#include "mob_manager.h"
#include "locale_service.h"
#include "desc_client.h"
#include "shop_manager.h"
#include "group_text_parse_tree.h"
#include "shopEx.h"
#include <boost/algorithm/string/predicate.hpp>
#include "shop_manager.h"
#include <cctype>
#include <algorithm>
CShopManager::CShopManager()
{
@ -388,11 +382,11 @@ bool ConvertToShopItemTable(IN CGroupNode* pNode, OUT TShopTableEx& shopTable)
stCoinType = "Gold";
}
if (boost::iequals(stCoinType, "Gold"))
if (iequals(stCoinType, "Gold"))
{
shopTable.coinType = SHOP_COIN_TYPE_GOLD;
}
else if (boost::iequals(stCoinType, "SecondaryCoin"))
else if (iequals(stCoinType, "SecondaryCoin"))
{
shopTable.coinType = SHOP_COIN_TYPE_SECONDARY_COIN;
}
@ -442,11 +436,11 @@ bool ConvertToShopItemTable(IN CGroupNode* pNode, OUT TShopTableEx& shopTable)
stSort = "None";
}
if (boost::iequals(stSort, "Asc"))
if (iequals(stSort, "Asc"))
{
std::sort(shopItems.begin(), shopItems.end(), CompareShopItemName);
}
else if(boost::iequals(stSort, "Desc"))
else if (iequals(stSort, "Desc"))
{
std::sort(shopItems.rbegin(), shopItems.rend(), CompareShopItemName);
}

View File

@ -230,3 +230,12 @@ bool WildCaseCmp(const char *w, const char *s)
return false;
}
bool ichar_equals(char a, char b)
{
return std::tolower(static_cast<unsigned char>(a)) == std::tolower(static_cast<unsigned char>(b));
}
bool iequals(const std::string& a, const std::string& b)
{
return std::equal(a.begin(), a.end(), b.begin(), b.end(), ichar_equals);
}

View File

@ -1,8 +1,6 @@
#pragma once
#ifndef __INC_METIN_II_UTILS_H__
#define __INC_METIN_II_UTILS_H__
#include <math.h>
#include <cmath>
#define IS_SET(flag, bit) ((flag) & (bit))
#define SET_BIT(var, bit) ((var) |= (bit))
@ -64,5 +62,5 @@ extern int parse_time_str(const char* str);
extern bool WildCaseCmp(const char *w, const char *s);
#endif /* __INC_METIN_II_UTILS_H__ */
extern bool ichar_equals(char a, char b);
extern bool iequals(const std::string& a, const std::string& b);

View File

@ -68,7 +68,7 @@ namespace marriage
{
if (m_pEndEvent)
{
SPDLOG_ERROR("WeddingMap::SetEnded - ALREADY EndEvent(m_pEndEvent={})", (void*) get_pointer(m_pEndEvent));
SPDLOG_ERROR("WeddingMap::SetEnded - ALREADY EndEvent(m_pEndEvent={})", (void*) m_pEndEvent.get());
return;
}

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.8)
project(libgame CXX)
@ -11,12 +11,11 @@ file(GLOB SOURCES
# Include header files
include_directories("include")
find_package(Boost REQUIRED)
# Create shared library
add_library(${PROJECT_NAME} STATIC ${SOURCES})
if (Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
target_link_libraries (${PROJECT_NAME} ${Boost_LIBRARIES})
endif (Boost_FOUND)
# Find and link dependencies
# spdlog
find_package(spdlog CONFIG REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE spdlog::spdlog)

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.8)
project(liblua CXX)

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.8)
project(libpoly CXX)

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.8)
project(libsql CXX)
@ -14,10 +14,12 @@ include_directories("include")
# Create shared library
add_library(${PROJECT_NAME} STATIC ${SOURCES})
# Find dependencies
find_package(unofficial-libmysql REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE unofficial::libmysql::libmysql)
# Find and link dependencies
find_package(Boost REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} PRIVATE ${Boost_LIBRARIES})
# MariaDB
find_package(unofficial-libmariadb REQUIRED)
target_link_libraries(${PROJECT_NAME} PUBLIC unofficial::libmariadb)
# spdlog
find_package(spdlog CONFIG REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE spdlog::spdlog)

View File

@ -143,7 +143,7 @@ bool CAsyncSQL::Connect()
if (0 != mysql_options(&m_hDB, MYSQL_OPT_RECONNECT, &reconnect))
SPDLOG_ERROR("Setting MYSQL_OPT_RECONNECT via mysql_options failed: {}", mysql_error(&m_hDB));
SPDLOG_INFO("AsyncSQL: connected to {} (reconnect {})", m_stHost, m_hDB.reconnect);
SPDLOG_INFO("AsyncSQL: connected to {}", m_stHost);
// db cache는 common db의 LOCALE 테이블에서 locale을 알아오고, 이후 character set을 수정한다.
// 따라서 최초 Connection을 맺을 때에는 locale을 모르기 때문에 character set을 정할 수가 없음에도 불구하고,

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.8)
project(libthecore CXX)
@ -14,14 +14,7 @@ include_directories("include")
# Create shared library
add_library(${PROJECT_NAME} STATIC ${SOURCES})
#
# vcpkg dependencies
#
# Boost
find_package(Boost REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} PRIVATE ${Boost_LIBRARIES})
# Find and link dependencies
# fmt
find_package(fmt CONFIG REQUIRED)

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.8)
project(quest CXX)
@ -7,19 +7,13 @@ file(GLOB_RECURSE sources
src/*.c
)
# Add the src directory to the include path
include_directories(src)
# Find dependencies
find_package(Boost REQUIRED)
add_executable(${PROJECT_NAME} ${sources})
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "qc")
# Link dependencies if found
if (Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
target_link_libraries (${PROJECT_NAME} ${Boost_LIBRARIES})
endif (Boost_FOUND)
# Find and link dependencies
# liblua
target_link_libraries(${PROJECT_NAME} liblua)
target_include_directories(${PROJECT_NAME} PUBLIC . ../liblua)

View File

@ -20,18 +20,9 @@ extern "C" {
#include <sstream>
#include <utility>
#include <vector>
#ifndef __WIN32__
#include <unistd.h>
#else
#include <boost/typeof/typeof.hpp>
#define typeof(t) BOOST_TYPEOF(t)
#include <direct.h>
#define mkdir(path, mode) _mkdir(path)
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <cerrno>
#include "crc32.h"