7ff05580c9
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.
53 lines
1.0 KiB
Lua
53 lines
1.0 KiB
Lua
zlib = {
|
|
settings = nil
|
|
}
|
|
|
|
function zlib.setup(settings)
|
|
if not settings.source then error("Missing source.") end
|
|
|
|
zlib.settings = settings
|
|
|
|
if not zlib.settings.defines then zlib.settings.defines = {} end
|
|
end
|
|
|
|
function zlib.import()
|
|
if not zlib.settings then error("You need to call zlib.setup first") end
|
|
|
|
links { "zlib" }
|
|
zlib.includes()
|
|
end
|
|
|
|
function zlib.includes()
|
|
if not zlib.settings then error("You need to call zlib.setup first") end
|
|
|
|
includedirs { zlib.settings.source }
|
|
defines(zlib.settings.defines)
|
|
end
|
|
|
|
function zlib.project()
|
|
if not zlib.settings then error("You need to call zlib.setup first") end
|
|
|
|
project "zlib"
|
|
language "C"
|
|
|
|
zlib.includes()
|
|
files
|
|
{
|
|
path.join(zlib.settings.source, "*.h"),
|
|
path.join(zlib.settings.source, "*.c"),
|
|
}
|
|
defines
|
|
{
|
|
"ZLIB_DLL",
|
|
"_CRT_SECURE_NO_DEPRECATE",
|
|
}
|
|
|
|
-- not our code, ignore POSIX usage warnings for now
|
|
warnings "Off"
|
|
|
|
kind "SharedLib"
|
|
configuration "*Static"
|
|
defines { "_LIB" }
|
|
removedefines { "_USRDLL", "_DLL", "ZLIB_DLL" }
|
|
kind "StaticLib"
|
|
end |