diff --git a/CMakeLists.txt b/CMakeLists.txt index eb84e71..13bb565 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,20 +29,18 @@ find_package(Libzip REQUIRED) # Tests if(BUILD_TESTING) include(CTest) - add_library(gsclib.Lib STATIC) add_executable(gsclib.Tests) find_path(GREATEST_INCLUDE_DIRS "greatest.h") - target_link_libraries(gsclib.Lib PUBLIC gsclib) - target_include_directories(gsclib.Lib PUBLIC gsclib) - target_link_libraries(gsclib.Tests PRIVATE gsclib.Lib) - target_include_directories(gsclib.Tests PRIVATE gsclib.Lib ${GREATEST_INCLUDE_DIRS}) + target_link_libraries(gsclib.Tests PRIVATE gsclib) + target_include_directories(gsclib.Tests PRIVATE ${GREATEST_INCLUDE_DIRS}) add_test(NAME Tests COMMAND gsclib.Tests) endif() # Build add_subdirectory(src) -set_target_properties(gsclib PROPERTIES +set_target_properties(gsclib.Plugin PROPERTIES + OUTPUT_NAME gsclib LIBRARY_OUTPUT_DIRECTORY ../../../../bin RUNTIME_OUTPUT_DIRECTORY ../../../../bin) @@ -58,7 +56,3 @@ target_link_libraries(gsclib PUBLIC cwalk) target_link_directories(gsclib PUBLIC ..) - -# Install -install(TARGETS gsclib LIBRARY DESTINATION lib) -install(DIRECTORY src/ DESTINATION include/gsclib FILES_MATCHING PATTERN "*.h" PATTERN "__test__" EXCLUDE) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index abece7b..ebe82f2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,5 @@ -add_library(gsclib SHARED) +add_library(gsclib OBJECT) +add_library(gsclib.Plugin SHARED) add_subdirectory(__test__) add_subdirectory(data) @@ -8,10 +9,8 @@ add_subdirectory(sys) add_subdirectory(utils) target_include_directories(gsclib PUBLIC .) -target_sources(gsclib PRIVATE plugin.c) +target_sources(gsclib.Plugin PRIVATE plugin.c) +target_link_libraries(gsclib.Plugin PRIVATE gsclib) + get_target_property(SOURCES gsclib SOURCES) source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SOURCES}) - -if(BUILD_TESTING) - target_sources(gsclib.Lib PRIVATE ${SOURCES}) -endif() diff --git a/src/__test__/CMakeLists.txt b/src/__test__/CMakeLists.txt index d0c5cc9..50f60d2 100644 --- a/src/__test__/CMakeLists.txt +++ b/src/__test__/CMakeLists.txt @@ -1,6 +1,5 @@ if(BUILD_TESTING) target_sources(gsclib.Tests PRIVATE main.test.c - mock.c - mock.h) + mock.c) endif() diff --git a/src/__test__/mock.c b/src/__test__/mock.c index 8c56c87..cea5d82 100644 --- a/src/__test__/mock.c +++ b/src/__test__/mock.c @@ -1,6 +1,5 @@ -#include "mock.h" - #include + #include #include #include @@ -19,24 +18,89 @@ void Plugin_Scr_Error(const char* msg) printf("%s\n", msg); } -int Plugin_Scr_GetNumParam() +async_handler* Plugin_AsyncInit() { - return 0; + return NULL; +} + +void Plugin_AsyncShutdown(async_handler* handler) +{ + +} + +async_worker* Plugin_AsyncWorker(async_handler* handler, void* data, uv_work_cb callback, uv_after_work_cb afterCallback) +{ + return NULL; +} + +void Plugin_AsyncWorkerDone(uv_work_t* req, async_status status) +{ + +} + +qboolean Plugin_CGSC_UnsupportedMessage(qboolean versionCondition, char* format, ...) +{ + return qfalse; +} + +float Plugin_CGSC_Version() +{ + return 0.0f; +} + +client_t* Plugin_GetClientForClientNum(int clientnum) +{ + return NULL; } -int Plugin_Scr_GetInt(unsigned int num) +gentity_t* Plugin_GetGentityForEntityNum(int entnum) +{ + return NULL; +} + +int Plugin_Milliseconds() { return 0; } -char* Plugin_Scr_GetString(unsigned int num) +const char* Plugin_NET_AdrToStringShortMT(netadr_t* a, char* buf, int len) +{ + return NULL; +} + +const char* Plugin_SL_ConvertToString(int index) +{ + return NULL; +} + +void Plugin_Scr_AddVariable(VariableValue var) +{ + +} + +void Plugin_Scr_AddVector(vec3_t vec) { - return "string"; + +} + +void Plugin_Scr_AddArray() +{ + +} + +void Plugin_Scr_AddArrayStringIndexed(int strIdx) +{ + } void Plugin_Scr_AddBool(qboolean value) { - + +} + +void Plugin_Scr_AddFloat(float value) +{ + } void Plugin_Scr_AddInt(int value) @@ -49,34 +113,54 @@ void Plugin_Scr_AddString(const char* string) } -void Plugin_Scr_AddArray() +void Plugin_Scr_AddUndefined() { } -void Plugin_Scr_MakeArray() +int Plugin_Scr_AllocString(const char* string) +{ + return 0; +} + +void Plugin_Scr_CallFunction(void (*function)(void), ...) { } -VariableValue* Plugin_Scr_SelectParam(unsigned int paramnum) +void Plugin_Scr_CallMethod(void (*function)(scr_entref_t), scr_entref_t ent, ...) { - return NULL; + } -void Plugin_Scr_AddVariable(VariableValue var) +short Plugin_Scr_ExecThread(int callbackHook, unsigned int numArgs) +{ + return 0; +} + +void Plugin_Scr_FreeThread(short threadId) { } -unsigned int Plugin_Scr_GetObjectType(unsigned int id) +int Plugin_Scr_GetThreadReturn() { return 0; } -const char* Plugin_SL_ConvertToString(int index) +void Plugin_Scr_MakeArray() +{ + +} + +void Plugin_Scr_ObjectError(const char* string) { - return "string"; + +} + +void Plugin_Scr_ParamError(int paramnum, const char* string) +{ + } VariableValueArray Plugin_Scr_CreateArray(int length) @@ -89,5 +173,92 @@ VariableValueArray Plugin_Scr_CreateArray(int length) void Plugin_Scr_FreeArray(VariableValueArray* array) { - free(array->items); + free(array->items); +} + +VariableValueArray Plugin_Scr_GetArray(unsigned int paramnum) +{ + VariableValueArray array = { 0 }; + return array; +} + +uint32_t Plugin_Scr_GetArrayFlags(VariableValueArray array) +{ + return 0; +} + +float Plugin_Scr_GetFloat(unsigned int paramnum) +{ + return 0.0f; +} + +int Plugin_Scr_GetFunction(unsigned int paramnum) +{ + return 0; +} + +int Plugin_Scr_GetInt(unsigned int paramnum) +{ + return 0; +} + +int Plugin_Scr_GetNumParam() +{ + return 0; +} + +unsigned int Plugin_Scr_GetObjectType(unsigned int id) +{ + return 0; +} + +char* Plugin_Scr_GetString(unsigned int paramnum) +{ + return ""; +} + +VariableValue* Plugin_Scr_SelectParamOrDefault(unsigned int paramnum) +{ + return NULL; +} + +VariableValue* Plugin_Scr_SelectParam(unsigned int paramnum) +{ + return NULL; +} + +VariableValue* Plugin_Scr_GetTop(unsigned int paramnum) +{ + return NULL; +} + +VariableValue Plugin_Scr_ReturnResult() +{ + VariableValue value = { 0 }; + return value; +} + +short Plugin_Scr_ExecThreadResult(int callbackHook, unsigned int numArgs) +{ + return 0; +} + +char* Plugin_Cmd_Argv(int arg) +{ + return NULL; +} + +int Plugin_Cmd_Argc() +{ + return 0; +} + +char* Plugin_Cmd_Args(char* buff, int bufsize) +{ + return NULL; +} + +float Sys_GetCommonVersion() +{ + return 0.0f; } diff --git a/src/__test__/mock.h b/src/__test__/mock.h deleted file mode 100644 index 6f70f09..0000000 --- a/src/__test__/mock.h +++ /dev/null @@ -1 +0,0 @@ -#pragma once