Browse Source
Adds an option to build libsodium from source instead of using the system-provided one. This is useful on systems that do not provide libsodium, or for testing changes to libsodium along with devilutionx (by specifying `-DFETCHCONTENT_SOURCE_DIR_LIBSODIUM`). This also allows us to configure sodium to our liking when building it from source, such as `SODIUM_MINIMAL`, which reduces the x64 release binary size from 4.3 MiB to 4.1 MiB.pull/1217/head
2 changed files with 28 additions and 5 deletions
@ -0,0 +1,17 @@ |
|||||||
|
if(NOT DEVILUTIONX_SYSTEM_LIBSODIUM) |
||||||
|
set(SODIUM_MINIMAL ON) |
||||||
|
set(SODIUM_ENABLE_BLOCKING_RANDOM OFF) |
||||||
|
set(SODIUM_DISABLE_TESTS ON) |
||||||
|
|
||||||
|
if(DEVILUTIONX_STATIC_LIBSODIUM) |
||||||
|
set(BUILD_SHARED_LIBS OFF) |
||||||
|
else() |
||||||
|
set(BUILD_SHARED_LIBS ON) |
||||||
|
endif() |
||||||
|
include(FetchContent) |
||||||
|
FetchContent_Declare(sodium |
||||||
|
GIT_REPOSITORY https://github.com/robinlinden/libsodium-cmake.git |
||||||
|
GIT_TAG a8ac4509b22b84d6c2eb7d7448f08678e4a67da6 |
||||||
|
) |
||||||
|
FetchContent_MakeAvailable(sodium) |
||||||
|
endif() |
||||||
Loading…
Reference in new issue