SET(SOURCES
- main.c network.c host.c service.c pex.c utils.c
+ main.c network.c host.c service.c pex.c
wg.c wg-user.c
)
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
FIND_LIBRARY(nl nl-tiny)
find_library(bpf NAMES bpf)
+ find_library(elf NAMES elf)
+ find_library(zlib NAMES z)
SET(SOURCES ${SOURCES} wg-linux.c vxlan.c bpf.c rtnl.c)
ELSE()
SET(nl "")
SET(bpf "")
+ SET(elf "")
+ SET(zlib "")
ENDIF()
IF(UBUS_SUPPORT)
SET(SOURCES ${SOURCES} ubus.c)
SET(ubus "")
ENDIF()
-ADD_LIBRARY(unet SHARED curve25519.c siphash.c)
+ADD_LIBRARY(unet SHARED curve25519.c siphash.c sha512.c fprime.c f25519.c ed25519.c edsign.c auth-data.c chacha20.c pex-msg.c utils.c)
TARGET_LINK_LIBRARIES(unet ubox)
ADD_EXECUTABLE(unetd ${SOURCES})
-TARGET_LINK_LIBRARIES(unetd unet ubox ${ubus} blobmsg_json ${libjson} ${nl} ${bpf})
+TARGET_LINK_LIBRARIES(unetd unet ubox ${ubus} blobmsg_json ${libjson} ${nl} ${bpf} ${elf} ${zlib})
-INSTALL(TARGETS unetd unet
+ADD_EXECUTABLE(unet-tool cli.c)
+TARGET_LINK_LIBRARIES(unet-tool unet blobmsg_json ${libjson} ubox)
+
+INSTALL(TARGETS unetd unet unet-tool
RUNTIME DESTINATION sbin
LIBRARY DESTINATION lib
)