|
|
@ -3,7 +3,12 @@ |
|
|
|
(import "CHelpers.cake" "BuildTools.cake" "Dependencies.cake") |
|
|
|
|
|
|
|
(export-and-evaluate |
|
|
|
(add-c-search-directory-module "cakelisp_cache/LibSodiumInstallDir/include") |
|
|
|
(comptime-cond |
|
|
|
('Unix |
|
|
|
(add-c-search-directory-module "cakelisp_cache/LibSodiumInstallDir/include")) |
|
|
|
('Windows |
|
|
|
(c-preprocessor-define SODIUM_STATIC) |
|
|
|
(add-c-search-directory-module "Dependencies/libsodium/src/libsodium/include"))) |
|
|
|
(c-import "sodium.h")) |
|
|
|
|
|
|
|
(defun cryptography-initialize (&return bool) |
|
|
@ -51,7 +56,7 @@ |
|
|
|
|
|
|
|
(defun-comptime build-libsodium (manager (& ModuleManager) module (* Module) &return bool) |
|
|
|
(var libsodium-archive (* (const char)) |
|
|
|
(comptime-cond ('Windows "Dependencies/libsodium/libsodium.lib") |
|
|
|
(comptime-cond ('Windows "Dependencies/libsodium/bin/x64/Release/v141/static/libsodium.lib") |
|
|
|
('Unix "cakelisp_cache/LibSodiumInstallDir/lib/libsodium.a"))) |
|
|
|
;; Already built? |
|
|
|
;; We could enhance this by checking for modifications, but that's pretty rare |
|
|
@ -103,7 +108,15 @@ |
|
|
|
"failed at LibSodium make install. Was there a configuration issue with --prefix?") |
|
|
|
(return false))) |
|
|
|
('Windows |
|
|
|
(comptime-error "Need windows support for libsodium building"))) |
|
|
|
(run-process-sequential-or |
|
|
|
("MSBuild.exe" "libsodium.sln" "-verbosity:minimal" |
|
|
|
"/p:Configuration=StaticRelease" "/p:Platform=x64" |
|
|
|
:in-directory "Dependencies/libsodium/builds/msvc/vs2017") |
|
|
|
(Log "failed to build libsodium via MSBuild. The vs2017 version was used. Edit |
|
|
|
gamelib/src/Cryptography.cake if you want to use a different version. You may also need to change |
|
|
|
the libsodium solution in order to use your desired platform SDK.\n") |
|
|
|
(return false)) |
|
|
|
(return false))) |
|
|
|
|
|
|
|
;; One final to check to ensure everything's good to go |
|
|
|
(unless (fileExists libsodium-archive) |
|
|
@ -114,7 +127,11 @@ |
|
|
|
(return true)) |
|
|
|
(add-compile-time-hook-module pre-build build-libsodium) |
|
|
|
|
|
|
|
(add-static-link-objects "cakelisp_cache/LibSodiumInstallDir/lib/libsodium.a") |
|
|
|
(comptime-cond |
|
|
|
('Unix |
|
|
|
(add-static-link-objects "cakelisp_cache/LibSodiumInstallDir/lib/libsodium.a")) |
|
|
|
('Windows |
|
|
|
(add-static-link-objects "Dependencies/libsodium/bin/x64/Release/v141/static/libsodium.lib"))) |
|
|
|
|
|
|
|
(add-dependency-git-submodule |
|
|
|
clone-libsodium |
|
|
|