iw4x-client/premake/libtomcrypt.lua
/dev/urandom 7ff05580c9
Premake: Split up dependencies, make them easily configurable and provide easy-to-use imports.
All dependency projects are now separated into their own Premake scripts and are designed to provide easy "import", "includes" and "setup" functions.

First, you use project.setup { ... } to provide the library with its respective configuration, this MAY include defines and MUST include the source path of that specific library. Then you can use project.includes() or project.import() in your target application or library project to let the script configure your project. This will configure all necessary include directories and links.
2016-08-13 19:45:11 +02:00

62 lines
1.5 KiB
Lua

libtomcrypt = {
settings = nil
}
function libtomcrypt.setup(settings)
if not settings.source then error("Missing source") end
libtomcrypt.settings = settings
if not libtomcrypt.settings.defines then libtomcrypt.settings.defines = {} end
end
function libtomcrypt.import()
if not libtomcrypt.settings then error("Run libtomcrypt.setup first") end
links { "libtomcrypt" }
libtomcrypt.includes()
end
function libtomcrypt.includes()
if not libtomcrypt.settings then error("Run libtomcrypt.setup first") end
defines(libtomcrypt.settings.defines)
includedirs { path.join(libtomcrypt.settings.source, "src/headers") }
end
function libtomcrypt.project()
if not libtomcrypt.settings then error("Run libtomcrypt.setup first") end
project "libtomcrypt"
language "C"
libtomcrypt.includes()
files
{
path.join(libtomcrypt.settings.source, "src/**.c"),
}
removefiles
{
path.join(libtomcrypt.settings.source, "src/**/*tab.c"), -- included by files as necessary already afaik
path.join(libtomcrypt.settings.source, "src/encauth/ocb3/**.c"), -- fails in Visual Studio with invalid syntax
}
defines
{
"_CRT_SECURE_NO_WARNINGS",
"LTC_SOURCE", -- we are compiling from source code
}
-- dependencies
if libtommath and libtommath.settings then
defines { "USE_LTM" }
libtommath.import()
end
-- not our code, ignore POSIX usage warnings for now
warnings "Off"
defines { "_LIB" }
removedefines { "_DLL", "_USRDLL" }
kind "StaticLib"
end