build: move some code to libunet
authorFelix Fietkau <nbd@nbd.name>
Wed, 29 Jun 2022 18:35:29 +0000 (20:35 +0200)
committerFelix Fietkau <nbd@nbd.name>
Wed, 29 Jun 2022 19:18:09 +0000 (21:18 +0200)
Signed-off-by: Felix Fietkau <nbd@nbd.name>
CMakeLists.txt

index 4ac58f1c82babf49e44e61f6bc41c17fd6f276d0..b51fc4481a56d1dbd482c2a5bc783164c91525f2 100644 (file)
@@ -5,7 +5,6 @@ PROJECT(unetd C)
 
 SET(SOURCES
        main.c network.c host.c service.c pex.c utils.c
-       curve25519.c siphash.c
        wg.c wg-dummy.c wg-user.c
 )
 
@@ -31,10 +30,13 @@ ELSE()
   SET(ubus "")
 ENDIF()
 
+ADD_LIBRARY(unet SHARED curve25519.c siphash.c)
+TARGET_LINK_LIBRARIES(unet ubox)
+
 ADD_EXECUTABLE(unetd ${SOURCES})
-TARGET_LINK_LIBRARIES(unetd ubox ${ubus} blobmsg_json ${libjson} ${nl} ${bpf})
+TARGET_LINK_LIBRARIES(unetd unet ubox ${ubus} blobmsg_json ${libjson} ${nl} ${bpf})
 
-INSTALL(TARGETS unetd
+INSTALL(TARGETS unetd unet
        RUNTIME DESTINATION sbin
        LIBRARY DESTINATION lib
 )