diff --git a/CMakeLists.txt b/CMakeLists.txt index c8e6e7c..a6d5cb7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,12 +48,15 @@ target_include_directories(userdb PUBLIC target_compile_options(userdb PUBLIC ${OPENSSL_CFLAGS_OTHER}) +add_library(webfused-static STATIC + src/webfused/daemon.c) add_executable(webfused - src/daemon/main.c + src/webfused/main.c ) -target_link_libraries(webfused PUBLIC +target_link_libraries(webfused PUBLIC + webfused-static userdb ${LIBCONFIG_LIBRARIES} ${OPENSSL_LIBRARIES} diff --git a/src/daemon/main.c b/src/webfused/daemon.c similarity index 98% rename from src/daemon/main.c rename to src/webfused/daemon.c index 7e899dc..c338b29 100644 --- a/src/daemon/main.c +++ b/src/webfused/daemon.c @@ -1,3 +1,5 @@ +#include "webfused/daemon.h" + #include #include #include @@ -154,7 +156,7 @@ static void on_interrupt(int signal_id) shutdown_requested = true; } -int main(int argc, char * argv[]) +int wfd_daemon_run(int argc, char * argv[]) { struct args args; args.config = wf_server_config_create(); diff --git a/src/webfused/daemon.h b/src/webfused/daemon.h new file mode 100644 index 0000000..edf888c --- /dev/null +++ b/src/webfused/daemon.h @@ -0,0 +1,15 @@ +#ifndef WFD_DAEMON_H +#define WFD_DAEMON_H + +#ifdef __cplusplus +extern "C" +{ +#endif + +extern int wfd_daemon_run(int argc, char * argv[]); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/webfused/main.c b/src/webfused/main.c new file mode 100644 index 0000000..6faf15d --- /dev/null +++ b/src/webfused/main.c @@ -0,0 +1,6 @@ +#include "webfused/daemon.h" + +int main(int argc, char * argv[]) +{ + return wfd_daemon_run(argc, argv); +}