Compare commits

...

3 Commits

Author SHA1 Message Date
Benedek László 4fac1bd6d4 win32 support 2024-05-31 21:45:58 +02:00
Benedek László 58fe69fd5d star plugin 2024-05-31 21:45:42 +02:00
Benedek László 839537af37 cmake options 2024-05-31 21:45:13 +02:00
6 changed files with 52 additions and 5 deletions

View File

@ -16,8 +16,15 @@ endif()
include_directories("${CMAKE_SOURCE_DIR}/inc")
option(ENABLE_PLUGINS "Enable plugins" ON)
option(ENABLE_SERVER "Enable server" ON)
# build plugins
if(ENABLE_PLUGINS)
add_subdirectory("${CMAKE_SOURCE_DIR}/src/graph/plugins")
endif()
# build gui server
if(ENABLE_SERVER)
add_subdirectory("${CMAKE_SOURCE_DIR}/src/graph/server")
endif()

View File

@ -1 +1,9 @@
option(ENABLE_PLUGIN_HTTP "Enable http plugin" ON)
if(ENABLE_PLUGIN_HTTP)
add_subdirectory("./http")
endif()
option(ENABLE_PLUGIN_STAR "Enable star plugin" ON)
if(ENABLE_PLUGIN_STAR)
add_subdirectory("./star")
endif()

View File

@ -2,5 +2,11 @@ find_package(nlohmann_json 3 REQUIRED)
file(GLOB_RECURSE HTTP_SOURCES "./*.cpp")
add_library(http SHARED ${HTTP_SOURCES})
set(LIB_PATH "/usr/local/lib")
target_link_directories(http PUBLIC ${LIB_PATH})
if(WIN32)
target_link_libraries(http ${LIB_PATH}/librum.dll.a ${LIB_PATH}/libflags-cpp.dll.a nlohmann_json::nlohmann_json)
else()
target_link_libraries(http librum.so libflags-cpp.so nlohmann_json::nlohmann_json)
endif()
set_target_properties(http PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/plugins")

View File

@ -0,0 +1,3 @@
file(GLOB_RECURSE STAR_SOURCES "./*.c")
add_library(star SHARED ${STAR_SOURCES})
set_target_properties(star PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/plugins")

View File

@ -0,0 +1,23 @@
#include <graph/plugins/plugin.h>
int run();
int destroy();
plugin_t plugin = {.version=1, .run_method=&run, .destroy_method=&destroy, .update_callback=0, .argc=0, .argv=0};
int run() {
point_t points[6] = {
{2/4.0, 2/2.0},
{3/4.0, 0/2.0},
{0/4.0, 1/2.0},
{4/4.0, 1/2.0},
{1/4.0, 0/2.0},
{2/4.0, 2/2.0}
};
plugin.update_callback(0, "star", points, 6);
return 0;
}
int destroy() { return 0; }

View File

@ -96,7 +96,7 @@ if __name__ == "__main__":
parser.add_argument("-c", action="store", dest="chart", help="chart id", type=int, required=True)
parser.add_argument("-s", action="store", dest="series", help="series name", type=str, required=True)
parser.add_argument("-p", action="store", dest="port", help="server port", type=int, required=False, default=8080)
parser.add_argument("-a", action="store", dest="address", help="server address", type=str, required=False, default="localhost")
parser.add_argument("-a", action="store", dest="address", help="server address", type=str, required=False, default="127.0.0.1")
args = parser.parse_args()
if args.test == "sine":