diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..fa607a9 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "cmake-modules/libsodium"] + path = cmake-modules/libsodium + url = https://github.com/robinlinden/libsodium-cmake.git diff --git a/CMakeLists.txt b/CMakeLists.txt index cb67650..7b07b7f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,6 +32,12 @@ if(RAWCMAKEBUILDTYPE STREQUAL "debug") add_link_options(-fsanitize=address) endif () +# include libsodium +set(SODIUM_DISABLE_TESTS ON) +set(SODIUM_MINIMAL ON) +set(SODIUM_STATIC ON) +add_subdirectory(cmake-modules/libsodium) + # compile laikalib, tools, cnc & bot add_subdirectory(lib) add_subdirectory(tools) diff --git a/cmake-modules/libsodium b/cmake-modules/libsodium new file mode 160000 index 0000000..a606dc7 --- /dev/null +++ b/cmake-modules/libsodium @@ -0,0 +1 @@ +Subproject commit a606dc79ed346b7c9db6df9ceedd1c3361afcf95 diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index f609f40..e0bb0aa 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -14,6 +14,7 @@ endif () # version details set(LAIKA_VERSION_MAJOR 0) set(LAIKA_VERSION_MINOR 1) +set(SODIUM_DISABLE_TESTS ON) project(LaikaLib VERSION ${LAIKA_VERSION_MAJOR}.${LAIKA_VERSION_MINOR}) @@ -23,13 +24,10 @@ configure_file(${LIB_INCLUDEDIR}/lconfig.h.in ${LIB_INCLUDEDIR}/lconfig.h) # Put CMake targets (ALL_BUILD/ZERO_CHECK) into a folder set_property(GLOBAL PROPERTY USE_FOLDERS ON) -set(sodium_USE_STATIC_LIBS ON) -find_package(Sodium) - # compile LaikaLib library file(GLOB_RECURSE LIBSOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src/**.c ${CMAKE_CURRENT_SOURCE_DIR}/vendor/**.c) add_library(LaikaLib STATIC ${LIBSOURCE}) -target_link_libraries(LaikaLib PRIVATE ${sodium_LIBRARY_RELEASE}) +target_link_libraries(LaikaLib PRIVATE sodium) # add the version definitions and the 'DEBUG' preprocessor definition if we're compiling as Debug target_compile_definitions(LaikaLib PUBLIC "$<$:DEBUG>")