mirror of
https://github.com/InoriRus/Kyty.git
synced 2026-08-28 05:06:40 +00:00
update 3rdparty libs
This commit is contained in:
@@ -6,35 +6,32 @@ if (MSVC AND CLANG)
|
||||
set_source_files_properties(${core_src} PROPERTIES COMPILE_FLAGS "-Wno-pragma-pack")
|
||||
endif()
|
||||
|
||||
add_library(core_obj OBJECT ${core_src})
|
||||
#add_library(core STATIC ${core_src})
|
||||
add_library(core STATIC $<TARGET_OBJECTS:core_obj>)
|
||||
|
||||
target_link_libraries(core sys)
|
||||
target_link_libraries(core math)
|
||||
target_link_libraries(core sdl2)
|
||||
target_link_libraries(core sqlite)
|
||||
target_link_libraries(core lzma)
|
||||
target_link_libraries(core zstd)
|
||||
#add_library(core_obj OBJECT ${core_src})
|
||||
add_library(core STATIC ${core_src})
|
||||
#add_library(core STATIC $<TARGET_OBJECTS:core_obj>)
|
||||
|
||||
target_link_libraries(core sys math SDL2-static sqlite lzma zstd miniz)
|
||||
|
||||
get_property(inc_headers TARGET core PROPERTY INCLUDE_DIRECTORIES)
|
||||
list(APPEND inc_headers
|
||||
${CMAKE_SOURCE_DIR}/3rdparty/sdl2/include
|
||||
${CMAKE_SOURCE_DIR}/3rdparty/sdl2/sdl2/include
|
||||
${CMAKE_SOURCE_DIR}/3rdparty/sqlite/include
|
||||
${CMAKE_SOURCE_DIR}/3rdparty/lzma/include
|
||||
${CMAKE_SOURCE_DIR}/3rdparty/zstd/lib
|
||||
${CMAKE_SOURCE_DIR}/3rdparty/miniz/src
|
||||
)
|
||||
|
||||
target_include_directories(core PRIVATE ${inc_headers})
|
||||
target_include_directories(core_obj PRIVATE ${inc_headers})
|
||||
#target_include_directories(core_obj PRIVATE ${inc_headers})
|
||||
|
||||
list(APPEND check_headers
|
||||
${CMAKE_SOURCE_DIR}/include
|
||||
)
|
||||
|
||||
clang_tidy_check(core_obj "" "${check_headers}" "${inc_headers}")
|
||||
#clang_tidy_check(core_obj "" "${check_headers}" "${inc_headers}")
|
||||
clang_tidy_check(core "" "${check_headers}" "${inc_headers}")
|
||||
|
||||
include_what_you_use(core_obj "${inc_headers}")
|
||||
#include_what_you_use(core_obj "${inc_headers}")
|
||||
include_what_you_use(core "${inc_headers}")
|
||||
|
||||
|
||||
|
||||
@@ -14,27 +14,29 @@ extern "C" {
|
||||
|
||||
// IWYU pragma: no_include "7zTypes.h"
|
||||
|
||||
#if KYTY_COMPILER == KYTY_COMPILER_MSVC
|
||||
#define MINIZ_NO_STDIO
|
||||
#define MINIZ_NO_MALLOC
|
||||
#define MZ_ASSERT(x) ASSERT(x)
|
||||
#include "miniz.h"
|
||||
|
||||
//#if KYTY_COMPILER == KYTY_COMPILER_MSVC
|
||||
//#define MINIZ_NO_STDIO
|
||||
//#define MINIZ_NO_MALLOC
|
||||
//#define MZ_ASSERT(x) ASSERT(x)
|
||||
////#pragma GCC diagnostic push
|
||||
////#pragma GCC diagnostic ignored "-Wunused-value"
|
||||
//#include "miniz.c.h"
|
||||
////#pragma GCC diagnostic pop
|
||||
//#else
|
||||
//#define MINIZ_NO_STDIO
|
||||
//#define MINIZ_NO_MALLOC
|
||||
//#define MZ_ASSERT(x) ASSERT(x)
|
||||
//#pragma GCC diagnostic push
|
||||
//#pragma GCC diagnostic ignored "-Wunused-value"
|
||||
#include "miniz.c.h"
|
||||
//#if KYTY_COMPILER == KYTY_COMPILER_MINGW
|
||||
//#pragma GCC diagnostic ignored "-Wmisleading-indentation"
|
||||
//#endif
|
||||
////#pragma GCC diagnostic ignored "-Wenum-compare"
|
||||
//#include "miniz.c.h"
|
||||
//#pragma GCC diagnostic pop
|
||||
#else
|
||||
#define MINIZ_NO_STDIO
|
||||
#define MINIZ_NO_MALLOC
|
||||
#define MZ_ASSERT(x) ASSERT(x)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-value"
|
||||
#if KYTY_COMPILER == KYTY_COMPILER_MINGW
|
||||
#pragma GCC diagnostic ignored "-Wmisleading-indentation"
|
||||
#endif
|
||||
//#pragma GCC diagnostic ignored "-Wenum-compare"
|
||||
#include "miniz.c.h"
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
#include "zstd.h"
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ KYTY_SUBSYSTEM_INIT(Core)
|
||||
core_file_init();
|
||||
core_debug_init(parent->GetArgv()[0]);
|
||||
Language::Init();
|
||||
|
||||
Database::Init();
|
||||
}
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ void DebugMap::LoadMap()
|
||||
#ifdef DEBUG_MAP_ENABLED
|
||||
printf("exe_name = %s\n", g_exe_name->utf8_str().GetData());
|
||||
|
||||
#if KYTY_PLATFORM == KYTY_PLATFORM_WINDOWS
|
||||
#if KYTY_PLATFORM == KYTY_PLATFORM_WINDOWS || KYTY_PLATFORM == KYTY_PLATFORM_LINUX
|
||||
String linker = Debug::GetLinker();
|
||||
String map_file =
|
||||
g_exe_name->FilenameWithoutExtension() + U"_" + Debug::GetCompiler() + U"_" + linker + U"_" + Debug::GetBitness() + U".map";
|
||||
@@ -167,7 +167,7 @@ void DebugMap::LoadCsv()
|
||||
|
||||
printf("exe_name = %s\n", g_exe_name->utf8_str().GetData());
|
||||
|
||||
#if KYTY_PLATFORM == KYTY_PLATFORM_WINDOWS
|
||||
#if KYTY_PLATFORM == KYTY_PLATFORM_WINDOWS || KYTY_PLATFORM == KYTY_PLATFORM_LINUX
|
||||
String linker = Debug::GetLinker();
|
||||
String map_file =
|
||||
g_exe_name->FilenameWithoutExtension() + U"_" + Debug::GetCompiler() + U"_" + linker + U"_" + Debug::GetBitness() + U".csv";
|
||||
@@ -843,9 +843,9 @@ const DebugFunctionInfo* DebugMapPrivate::FindFunc(DebugMap* map, uintptr_t addr
|
||||
}
|
||||
|
||||
#if KYTY_PLATFORM != KYTY_PLATFORM_WINDOWS
|
||||
static char* strtok_s(char* _Str, const char* _Delim, char** /*_Context*/)
|
||||
static char* strtok_s(char* s_str, const char* s_delim, char** /*_Context*/)
|
||||
{
|
||||
return strtok(_Str, _Delim);
|
||||
return strtok(s_str, s_delim);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -434,7 +434,7 @@ static bool MSpaceInternalInit(MSpaceContext& ctx, const char* name, void* base,
|
||||
}
|
||||
|
||||
ctx.base = static_cast<MSpaceBlock*>(base);
|
||||
ctx.capacity = (capacity / sizeof(MSpaceBlock)) - 2;
|
||||
ctx.capacity = static_cast<uint32_t>((capacity / sizeof(MSpaceBlock)) - 2);
|
||||
|
||||
ctx.size_of_key_chunk = ctx.capacity;
|
||||
ctx.index_of_key_chunk = 1;
|
||||
@@ -523,7 +523,7 @@ void* MSpaceMalloc(mspace_t msp, size_t size)
|
||||
|
||||
auto* ctx = static_cast<MSpaceContext*>(msp);
|
||||
|
||||
return MSpaceInternalMalloc_align(*ctx, size, 32);
|
||||
return MSpaceInternalMalloc_align(*ctx, static_cast<uint32_t>(size), 32);
|
||||
}
|
||||
|
||||
bool MSpaceFree(mspace_t msp, void* ptr)
|
||||
@@ -554,7 +554,7 @@ void* MSpaceRealloc(mspace_t msp, void* ptr, size_t size)
|
||||
|
||||
auto* ctx = static_cast<MSpaceContext*>(msp);
|
||||
|
||||
return MSpaceInternalRealloc_align(*ctx, ptr, size, 32);
|
||||
return MSpaceInternalRealloc_align(*ctx, ptr, static_cast<uint32_t>(size), 32);
|
||||
}
|
||||
|
||||
} // namespace Kyty::Core
|
||||
|
||||
@@ -82,6 +82,8 @@ public:
|
||||
|
||||
const char* name = s->Id();
|
||||
|
||||
EXIT_IF(FindByName(name) != nullptr);
|
||||
|
||||
auto* nl = new SubsListStruct;
|
||||
|
||||
nl->s = s;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include <string>
|
||||
#include <thread>
|
||||
|
||||
#if KYTY_PLATFORM == KYTY_PLATFORM_WINDOWS
|
||||
#if KYTY_PLATFORM == KYTY_PLATFORM_WINDOWS && KYTY_COMPILER == KYTY_COMPILER_CLANG
|
||||
#define KYTY_WIN_CS
|
||||
#endif
|
||||
|
||||
|
||||
@@ -2,24 +2,29 @@ file(GLOB scripts_src
|
||||
"src/*.cpp"
|
||||
)
|
||||
|
||||
add_library(scripts_obj OBJECT ${scripts_src})
|
||||
add_library(scripts STATIC $<TARGET_OBJECTS:scripts_obj>)
|
||||
#add_library(scripts_obj OBJECT ${scripts_src})
|
||||
#add_library(scripts STATIC $<TARGET_OBJECTS:scripts_obj>)
|
||||
add_library(scripts OBJECT ${scripts_src})
|
||||
|
||||
target_link_libraries(scripts core)
|
||||
target_link_libraries(scripts core lua)
|
||||
|
||||
#target_include_directories(scripts PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||
|
||||
get_property(inc_headers TARGET scripts PROPERTY INCLUDE_DIRECTORIES)
|
||||
|
||||
target_include_directories(scripts_obj PRIVATE ${inc_headers})
|
||||
list(APPEND inc_headers
|
||||
${CMAKE_SOURCE_DIR}/3rdparty/lua/src
|
||||
)
|
||||
|
||||
target_include_directories(scripts PRIVATE ${inc_headers})
|
||||
|
||||
list(APPEND check_headers
|
||||
${CMAKE_SOURCE_DIR}/include
|
||||
)
|
||||
|
||||
clang_tidy_check(scripts_obj "" "${check_headers}" "${inc_headers}")
|
||||
clang_tidy_check(scripts "" "${check_headers}" "${inc_headers}")
|
||||
|
||||
include_what_you_use(scripts_obj "${inc_headers}")
|
||||
include_what_you_use(scripts "${inc_headers}")
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -89,9 +89,9 @@ void move_help()
|
||||
|
||||
KYTY_SCRIPT_FUNC(sync_func)
|
||||
{
|
||||
String src;
|
||||
String dst;
|
||||
int del = 1;
|
||||
String src;
|
||||
String dst;
|
||||
int64_t del = 1;
|
||||
|
||||
if (Scripts::ArgGetVarCount() == 2)
|
||||
{
|
||||
@@ -281,9 +281,9 @@ KYTY_SCRIPT_FUNC(db_key_func)
|
||||
EXIT("invalid args\n");
|
||||
}
|
||||
|
||||
String database = Scripts::ArgGetVar(0).ToString();
|
||||
String password = Scripts::ArgGetVar(1).ToString();
|
||||
int legacy = Scripts::ArgGetVar(2).ToInteger();
|
||||
String database = Scripts::ArgGetVar(0).ToString();
|
||||
String password = Scripts::ArgGetVar(1).ToString();
|
||||
int64_t legacy = Scripts::ArgGetVar(2).ToInteger();
|
||||
|
||||
Core::Database::Connection db;
|
||||
db.Open(database, Core::Database::Connection::Mode::ReadOnly);
|
||||
@@ -293,7 +293,7 @@ KYTY_SCRIPT_FUNC(db_key_func)
|
||||
EXIT("Can't open file: %s\n", database.C_Str());
|
||||
}
|
||||
|
||||
db.SetPassword(password, legacy);
|
||||
db.SetPassword(password, static_cast<int>(legacy));
|
||||
auto key = db.GetKey();
|
||||
|
||||
FOR (i, key)
|
||||
|
||||
@@ -35,9 +35,10 @@ static const luaL_Reg g_loadedlibs[] = {{"_G", luaopen_base},
|
||||
{LUA_IOLIBNAME, luaopen_io},
|
||||
{LUA_OSLIBNAME, luaopen_os},
|
||||
{LUA_STRLIBNAME, luaopen_string},
|
||||
{LUA_BITLIBNAME, luaopen_bit32},
|
||||
//{LUA_BITLIBNAME, luaopen_bit32},
|
||||
{LUA_MATHLIBNAME, luaopen_math},
|
||||
{LUA_DBLIBNAME, luaopen_debug},
|
||||
{LUA_UTF8LIBNAME, luaopen_utf8},
|
||||
{nullptr, nullptr}};
|
||||
|
||||
static void lua_my_openlibs(lua_State* l)
|
||||
@@ -358,7 +359,7 @@ void ScriptVar::DbgPrint(int depth) const
|
||||
} else
|
||||
{
|
||||
#if KYTY_LUA_VER == KYTY_LUA_5_3
|
||||
printf("d: %g, i: %" PRIi64 " s: %s\n", val_double, val_integer, val_string.C_Str());
|
||||
printf("d: %g, i: %" PRIi64 " s: %s\n", m_p->val_double, m_p->val_integer, m_p->val_string.C_Str());
|
||||
#else
|
||||
printf("d: %g, s: %s\n", m_p->val_double, m_p->val_string.C_Str());
|
||||
#endif
|
||||
@@ -443,7 +444,7 @@ ScriptVar ScriptVar::ReadVar(int index, bool with_metatable_index)
|
||||
r.m_p->val_double = lua_tonumber(g_lua_state, -1);
|
||||
r.m_p->val_bool = (lua_toboolean(g_lua_state, -1) != 0);
|
||||
#if KYTY_LUA_VER == KYTY_LUA_5_3
|
||||
Read.m_p->val_integer = lua_tointeger(g_lua_state, -1);
|
||||
r.m_p->val_integer = lua_tointeger(g_lua_state, -1);
|
||||
#endif
|
||||
r.m_p->val_string = String::FromUtf8(lua_tostring(g_lua_state, -1));
|
||||
r.m_p->val_userdata = lua_touserdata(g_lua_state, -1);
|
||||
@@ -452,10 +453,10 @@ ScriptVar ScriptVar::ReadVar(int index, bool with_metatable_index)
|
||||
r.m_p->is_double = (lua_isnumber(g_lua_state, -1) != 0);
|
||||
r.m_p->is_function = lua_isfunction(g_lua_state, -1);
|
||||
#if KYTY_LUA_VER == KYTY_LUA_5_3
|
||||
Read.is_integer = lua_isinteger(g_lua_state, -1);
|
||||
if (!Read.is_integer)
|
||||
r.m_p->is_integer = lua_isinteger(g_lua_state, -1) != 0;
|
||||
if (!r.m_p->is_integer)
|
||||
{
|
||||
Read.is_integer = lua_tointeger(g_lua_state, -1) != 0 || lua_tostring(g_lua_state, -1) == String("0");
|
||||
r.m_p->is_integer = lua_tointeger(g_lua_state, -1) != 0 || lua_tostring(g_lua_state, -1) == String(U"0");
|
||||
}
|
||||
#endif
|
||||
r.m_p->is_nil = lua_isnil(g_lua_state, -1);
|
||||
@@ -524,6 +525,7 @@ ScriptVar ScriptVar::ReadVar(int index, bool with_metatable_index)
|
||||
}
|
||||
}
|
||||
|
||||
// NOLINTNEXTLINE(clang-analyzer-cplusplus.NewDeleteLeaks)
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -570,7 +572,7 @@ bool ScriptVar::IsUserdata() const
|
||||
#if KYTY_LUA_VER == KYTY_LUA_5_3
|
||||
int64_t ScriptVar::ToInteger() const
|
||||
{
|
||||
return val_integer;
|
||||
return m_p->val_integer;
|
||||
}
|
||||
#else
|
||||
int32_t ScriptVar::ToInteger() const
|
||||
@@ -756,15 +758,16 @@ ScriptVar ScriptTable::At(int64_t m_key) const
|
||||
{
|
||||
lua_init();
|
||||
|
||||
FOR (i, keys)
|
||||
// FOR (i, keys)
|
||||
for (const auto& p: m_pairs)
|
||||
{
|
||||
const ScriptVar& v = keys.At(i);
|
||||
const ScriptVar& v = p.GetKey();
|
||||
if (v.IsInteger() && v.ToInteger() == m_key)
|
||||
{
|
||||
return values.At(i);
|
||||
return p.GetValue();
|
||||
}
|
||||
}
|
||||
return ScriptVar();
|
||||
return {};
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user