1
0
mirror of https://github.com/CPunch/Laika.git synced 2024-11-21 20:40:05 +00:00

Vendored LibSodium to make compilation easier

This commit is contained in:
CPunch 2022-03-13 21:48:09 -05:00
parent e1ce053aa8
commit 76c5899ed5
4 changed files with 12 additions and 4 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "cmake-modules/libsodium"]
path = cmake-modules/libsodium
url = https://github.com/robinlinden/libsodium-cmake.git

View File

@ -32,6 +32,12 @@ if(RAWCMAKEBUILDTYPE STREQUAL "debug")
add_link_options(-fsanitize=address) add_link_options(-fsanitize=address)
endif () 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 # compile laikalib, tools, cnc & bot
add_subdirectory(lib) add_subdirectory(lib)
add_subdirectory(tools) add_subdirectory(tools)

@ -0,0 +1 @@
Subproject commit a606dc79ed346b7c9db6df9ceedd1c3361afcf95

View File

@ -14,6 +14,7 @@ endif ()
# version details # version details
set(LAIKA_VERSION_MAJOR 0) set(LAIKA_VERSION_MAJOR 0)
set(LAIKA_VERSION_MINOR 1) set(LAIKA_VERSION_MINOR 1)
set(SODIUM_DISABLE_TESTS ON)
project(LaikaLib VERSION ${LAIKA_VERSION_MAJOR}.${LAIKA_VERSION_MINOR}) 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 # Put CMake targets (ALL_BUILD/ZERO_CHECK) into a folder
set_property(GLOBAL PROPERTY USE_FOLDERS ON) set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(sodium_USE_STATIC_LIBS ON)
find_package(Sodium)
# compile LaikaLib library # compile LaikaLib library
file(GLOB_RECURSE LIBSOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src/**.c ${CMAKE_CURRENT_SOURCE_DIR}/vendor/**.c) file(GLOB_RECURSE LIBSOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src/**.c ${CMAKE_CURRENT_SOURCE_DIR}/vendor/**.c)
add_library(LaikaLib STATIC ${LIBSOURCE}) 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 # add the version definitions and the 'DEBUG' preprocessor definition if we're compiling as Debug
target_compile_definitions(LaikaLib PUBLIC "$<$<CONFIG:Debug>:DEBUG>") target_compile_definitions(LaikaLib PUBLIC "$<$<CONFIG:Debug>:DEBUG>")