2016-08-30 17:55:11 -04:00
|
|
|
gitVersioningCommand = "git describe --tags --dirty --always"
|
|
|
|
|
2016-08-16 23:00:12 -04:00
|
|
|
-- Quote the given string input as a C string
|
|
|
|
function cstrquote(value)
|
|
|
|
result = value:gsub("\\", "\\\\")
|
|
|
|
result = result:gsub("\"", "\\\"")
|
|
|
|
result = result:gsub("\n", "\\n")
|
|
|
|
result = result:gsub("\t", "\\t")
|
|
|
|
result = result:gsub("\r", "\\r")
|
|
|
|
result = result:gsub("\a", "\\a")
|
|
|
|
result = result:gsub("\b", "\\b")
|
|
|
|
result = "\"" .. result .. "\""
|
|
|
|
return result
|
|
|
|
end
|
|
|
|
|
2016-09-16 15:18:38 -04:00
|
|
|
-- Converts tags in "vX.X.X" format to an array of numbers {X,X,X}.
|
|
|
|
-- In the case where the format does not work fall back to old {4,2,REVISION}.
|
|
|
|
function vertonumarr(value, vernumber)
|
2016-08-30 17:55:11 -04:00
|
|
|
vernum = {}
|
|
|
|
for num in string.gmatch(value, "%d+") do
|
2016-09-16 15:18:38 -04:00
|
|
|
table.insert(vernum, tonumber(num))
|
2016-08-30 17:55:11 -04:00
|
|
|
end
|
|
|
|
if #vernum < 3 then
|
2016-09-16 15:18:38 -04:00
|
|
|
return {4,2,tonumber(vernumber)}
|
2016-08-30 17:55:11 -04:00
|
|
|
end
|
2016-09-16 15:18:38 -04:00
|
|
|
return vernum
|
2016-08-30 17:55:11 -04:00
|
|
|
end
|
|
|
|
|
2016-07-11 11:14:58 -04:00
|
|
|
-- Option to allow copying the DLL file to a custom folder after build
|
|
|
|
newoption {
|
|
|
|
trigger = "copy-to",
|
|
|
|
description = "Optional, copy the DLL to a custom folder after build, define the path here if wanted.",
|
|
|
|
value = "PATH"
|
|
|
|
}
|
|
|
|
|
|
|
|
newoption {
|
|
|
|
trigger = "no-new-structure",
|
|
|
|
description = "Do not use new virtual path structure (separating headers and source files)."
|
|
|
|
}
|
|
|
|
|
2016-08-10 11:09:19 -04:00
|
|
|
newoption {
|
|
|
|
trigger = "copy-pdb",
|
|
|
|
description = "Copy debug information for binaries as well to the path given via --copy-to."
|
|
|
|
}
|
|
|
|
|
2016-08-13 13:20:27 -04:00
|
|
|
newoption {
|
2016-08-14 09:17:30 -04:00
|
|
|
trigger = "ac-debug-detections",
|
2016-08-13 13:20:27 -04:00
|
|
|
description = "Log anticheat detections."
|
|
|
|
}
|
|
|
|
|
|
|
|
newoption {
|
2016-08-14 09:17:30 -04:00
|
|
|
trigger = "ac-debug-load-library",
|
2016-08-13 13:20:27 -04:00
|
|
|
description = "Log libraries that get loaded."
|
|
|
|
}
|
|
|
|
|
|
|
|
newoption {
|
|
|
|
trigger = "force-unit-tests",
|
|
|
|
description = "Always compile unit tests."
|
|
|
|
}
|
|
|
|
|
2016-08-28 13:38:16 -04:00
|
|
|
newoption {
|
|
|
|
trigger = "force-exception-handler",
|
|
|
|
description = "Install custom unhandled exception handler even for Debug builds."
|
|
|
|
}
|
|
|
|
|
|
|
|
newoption {
|
|
|
|
trigger = "force-minidump-upload",
|
|
|
|
description = "Upload minidumps even for Debug builds."
|
|
|
|
}
|
|
|
|
|
|
|
|
newoption {
|
|
|
|
trigger = "disable-bitmessage",
|
|
|
|
description = "Disable use of BitMessage completely."
|
|
|
|
}
|
2016-08-30 17:55:11 -04:00
|
|
|
|
2016-08-29 01:37:13 -04:00
|
|
|
newoption {
|
|
|
|
trigger = "disable-node-log",
|
|
|
|
description = "Disable debugging messages for Nodes in Debug builds."
|
|
|
|
}
|
2016-08-30 17:55:11 -04:00
|
|
|
|
2016-08-29 01:36:41 -04:00
|
|
|
newoption {
|
|
|
|
trigger = "disable-base128",
|
2016-09-16 05:04:28 -04:00
|
|
|
description = "Disable base128 encoding for minidumps."
|
2016-08-29 01:36:41 -04:00
|
|
|
}
|
2016-08-28 13:38:16 -04:00
|
|
|
|
2016-07-11 11:14:58 -04:00
|
|
|
newaction {
|
|
|
|
trigger = "version",
|
|
|
|
description = "Returns the version string for the current commit of the source code.",
|
|
|
|
onWorkspace = function(wks)
|
2016-08-30 17:55:11 -04:00
|
|
|
-- get current version via git
|
|
|
|
local proc = assert(io.popen(gitVersioningCommand, "r"))
|
|
|
|
local gitDescribeOutput = assert(proc:read('*a')):gsub("%s+", "")
|
2016-07-11 11:14:58 -04:00
|
|
|
proc:close()
|
|
|
|
|
2016-08-30 17:55:11 -04:00
|
|
|
print(gitDescribeOutput)
|
2016-07-11 11:14:58 -04:00
|
|
|
os.exit(0)
|
|
|
|
end
|
|
|
|
}
|
|
|
|
|
|
|
|
newaction {
|
|
|
|
trigger = "generate-buildinfo",
|
|
|
|
description = "Sets up build information file like version.h.",
|
|
|
|
onWorkspace = function(wks)
|
|
|
|
-- get revision number via git
|
|
|
|
local proc = assert(io.popen("git rev-list --count HEAD", "r"))
|
|
|
|
local revNumber = assert(proc:read('*a')):gsub("%s+", "")
|
2016-08-30 17:55:11 -04:00
|
|
|
|
|
|
|
-- get current version via git
|
|
|
|
local proc = assert(io.popen(gitVersioningCommand, "r"))
|
|
|
|
local gitDescribeOutput = assert(proc:read('*a')):gsub("%s+", "")
|
2016-07-11 11:14:58 -04:00
|
|
|
proc:close()
|
|
|
|
|
|
|
|
-- get whether this is a clean revision (no uncommitted changes)
|
2016-08-16 23:00:12 -04:00
|
|
|
proc = assert(io.popen("git status --porcelain", "r"))
|
2016-08-30 17:55:11 -04:00
|
|
|
local revDirty = (assert(proc:read('*a')) ~= "")
|
|
|
|
if revDirty then revDirty = 1 else revDirty = 0 end
|
2016-07-11 11:14:58 -04:00
|
|
|
proc:close()
|
|
|
|
|
2016-09-16 15:18:38 -04:00
|
|
|
-- get current tag name
|
2016-08-30 17:55:11 -04:00
|
|
|
proc = assert(io.popen("git describe --tags --abbrev=0"))
|
2016-08-16 23:00:12 -04:00
|
|
|
local tagName = assert(proc:read('*l'))
|
|
|
|
|
2016-07-11 11:14:58 -04:00
|
|
|
-- get old version number from version.hpp if any
|
2016-08-30 17:55:11 -04:00
|
|
|
local oldVersion = "(none)"
|
|
|
|
local oldVersionHeader = io.open(wks.location .. "/src/version.h", "r")
|
|
|
|
if oldVersionHeader ~= nil then
|
|
|
|
local oldVersionHeaderContent = assert(oldVersionHeader:read('*l'))
|
|
|
|
while oldVersionHeaderContent do
|
|
|
|
m = string.match(oldVersionHeaderContent, "#define GIT_DESCRIBE (.+)%s*$")
|
|
|
|
if m ~= nil then
|
|
|
|
oldVersion = m
|
|
|
|
end
|
|
|
|
|
|
|
|
oldVersionHeaderContent = oldVersionHeader:read('*l')
|
2016-07-11 11:14:58 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
-- generate version.hpp with a revision number if not equal
|
2016-08-30 17:55:11 -04:00
|
|
|
gitDescribeOutputQuoted = cstrquote(gitDescribeOutput)
|
|
|
|
if oldVersion ~= gitDescribeOutputQuoted then
|
|
|
|
print ("Update " .. oldVersion .. " -> " .. gitDescribeOutputQuoted)
|
|
|
|
local versionHeader = assert(io.open(wks.location .. "/src/version.h", "w"))
|
2016-07-11 11:14:58 -04:00
|
|
|
versionHeader:write("/*\n")
|
|
|
|
versionHeader:write(" * Automatically generated by premake5.\n")
|
|
|
|
versionHeader:write(" * Do not touch, you fucking moron!\n")
|
|
|
|
versionHeader:write(" */\n")
|
|
|
|
versionHeader:write("\n")
|
2016-08-30 17:55:11 -04:00
|
|
|
versionHeader:write("#define GIT_DESCRIBE " .. gitDescribeOutputQuoted .. "\n")
|
|
|
|
versionHeader:write("#define GIT_DIRTY " .. revDirty .. "\n")
|
|
|
|
versionHeader:write("#define GIT_TAG " .. cstrquote(tagName) .. "\n")
|
|
|
|
versionHeader:write("\n")
|
|
|
|
versionHeader:write("// Legacy definitions (needed for update check)\n")
|
2016-07-11 11:14:58 -04:00
|
|
|
versionHeader:write("#define REVISION " .. revNumber .. "\n")
|
2016-08-30 17:55:11 -04:00
|
|
|
versionHeader:write("\n")
|
|
|
|
versionHeader:write("// Version transformed for RC files\n")
|
2016-09-16 15:18:38 -04:00
|
|
|
versionHeader:write("#define VERSION_RC " .. table.concat(vertonumarr(tagName, revNumber), ",") .. "\n")
|
2016-08-30 17:55:11 -04:00
|
|
|
versionHeader:write("\n")
|
|
|
|
versionHeader:write("// Alias definitions\n")
|
|
|
|
versionHeader:write("#define VERSION GIT_DESCRIBE\n")
|
2016-09-16 15:18:38 -04:00
|
|
|
versionHeader:write("#define SHORTVERSION " .. cstrquote(table.concat(vertonumarr(tagName, revNumber), ".")) .. "\n")
|
2016-08-30 17:55:11 -04:00
|
|
|
versionHeader:close()
|
|
|
|
local versionHeader = assert(io.open(wks.location .. "/src/version.hpp", "w"))
|
|
|
|
versionHeader:write("/*\n")
|
|
|
|
versionHeader:write(" * Automatically generated by premake5.\n")
|
|
|
|
versionHeader:write(" * Do not touch, you fucking moron!\n")
|
|
|
|
versionHeader:write(" *\n")
|
|
|
|
versionHeader:write(" * This file exists for reasons of complying with our coding standards.\n")
|
|
|
|
versionHeader:write(" *\n")
|
|
|
|
versionHeader:write(" * The Resource Compiler will ignore any content from C++ header files if they're not from STDInclude.hpp.\n")
|
|
|
|
versionHeader:write(" * That's the reason why we now place all version info in version.h instead.\n")
|
|
|
|
versionHeader:write(" */\n")
|
|
|
|
versionHeader:write("\n")
|
|
|
|
versionHeader:write("#include \".\\version.h\"\n")
|
2016-07-11 11:14:58 -04:00
|
|
|
versionHeader:close()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
}
|
|
|
|
|
2016-08-13 13:24:02 -04:00
|
|
|
depsBasePath = "./deps"
|
|
|
|
|
2016-08-28 16:46:23 -04:00
|
|
|
require "premake/base128"
|
2016-08-26 14:51:20 -04:00
|
|
|
require "premake/bitmrc"
|
2016-08-13 13:24:02 -04:00
|
|
|
require "premake/fmt"
|
|
|
|
require "premake/json11"
|
2016-08-26 14:51:20 -04:00
|
|
|
require "premake/libcryptopp"
|
2016-08-13 13:24:02 -04:00
|
|
|
require "premake/libtomcrypt"
|
|
|
|
require "premake/libtommath"
|
|
|
|
require "premake/mongoose"
|
|
|
|
require "premake/pdcurses"
|
|
|
|
require "premake/protobuf"
|
2016-08-26 14:51:20 -04:00
|
|
|
require "premake/sqlite3"
|
2016-08-13 13:24:02 -04:00
|
|
|
require "premake/winksignals"
|
|
|
|
require "premake/zlib"
|
|
|
|
|
2016-08-28 16:46:23 -04:00
|
|
|
base128.setup
|
|
|
|
{
|
|
|
|
source = path.join(depsBasePath, "base128"),
|
|
|
|
}
|
2016-08-26 14:44:36 -04:00
|
|
|
bitmrc.setup
|
|
|
|
{
|
|
|
|
source = path.join(depsBasePath, "bitmrc"),
|
|
|
|
}
|
2016-08-13 13:24:02 -04:00
|
|
|
fmt.setup
|
|
|
|
{
|
|
|
|
source = path.join(depsBasePath, "fmt"),
|
|
|
|
}
|
|
|
|
json11.setup
|
|
|
|
{
|
|
|
|
source = path.join(depsBasePath, "json11"),
|
|
|
|
}
|
2016-08-26 14:44:36 -04:00
|
|
|
libcryptopp.setup
|
|
|
|
{
|
|
|
|
source = path.join(depsBasePath, "bitmrc/libcryptopp"),
|
|
|
|
}
|
2016-08-13 13:24:02 -04:00
|
|
|
libtomcrypt.setup
|
|
|
|
{
|
|
|
|
defines = {
|
|
|
|
"LTC_NO_FAST",
|
|
|
|
"LTC_NO_PROTOTYPES",
|
|
|
|
"LTC_NO_RSA_BLINDING",
|
|
|
|
},
|
|
|
|
source = path.join(depsBasePath, "libtomcrypt"),
|
|
|
|
}
|
|
|
|
libtommath.setup
|
|
|
|
{
|
|
|
|
defines = {
|
|
|
|
"LTM_DESC",
|
|
|
|
},
|
|
|
|
source = path.join(depsBasePath, "libtommath"),
|
|
|
|
}
|
|
|
|
mongoose.setup
|
|
|
|
{
|
|
|
|
source = path.join(depsBasePath, "mongoose"),
|
|
|
|
}
|
|
|
|
pdcurses.setup
|
|
|
|
{
|
|
|
|
source = path.join(depsBasePath, "pdcurses"),
|
|
|
|
}
|
|
|
|
protobuf.setup
|
|
|
|
{
|
|
|
|
source = path.join(depsBasePath, "protobuf"),
|
|
|
|
}
|
2016-08-26 14:51:20 -04:00
|
|
|
sqlite3.setup
|
|
|
|
{
|
|
|
|
source = path.join(depsBasePath, "bitmrc/windows/sqlite3"),
|
|
|
|
}
|
2016-08-13 13:24:02 -04:00
|
|
|
winksignals.setup
|
|
|
|
{
|
|
|
|
source = path.join(depsBasePath, "Wink-Signals"),
|
|
|
|
}
|
|
|
|
zlib.setup
|
|
|
|
{
|
|
|
|
defines = {
|
|
|
|
"ZLIB_CONST",
|
|
|
|
},
|
|
|
|
source = path.join(depsBasePath, "zlib"),
|
|
|
|
}
|
|
|
|
|
2016-07-11 11:14:58 -04:00
|
|
|
workspace "iw4x"
|
|
|
|
location "./build"
|
|
|
|
objdir "%{wks.location}/obj"
|
|
|
|
targetdir "%{wks.location}/bin/%{cfg.buildcfg}"
|
2016-09-17 08:03:59 -04:00
|
|
|
configurations { "Debug", "Release" }
|
2016-07-11 11:14:58 -04:00
|
|
|
architecture "x32"
|
|
|
|
platforms "x86"
|
|
|
|
|
|
|
|
-- VS 2015 toolset only
|
|
|
|
toolset "msc-140"
|
|
|
|
|
2016-09-25 18:55:48 -04:00
|
|
|
flags { "StaticRuntime" }
|
|
|
|
|
2016-07-11 11:14:58 -04:00
|
|
|
configuration "windows"
|
|
|
|
defines { "_WINDOWS", "WIN32" }
|
|
|
|
|
|
|
|
configuration "Release*"
|
|
|
|
defines { "NDEBUG" }
|
2016-09-25 18:57:46 -04:00
|
|
|
flags { "MultiProcessorCompile", "LinkTimeOptimization", "No64BitChecks" }
|
2016-07-11 11:14:58 -04:00
|
|
|
optimize "Full"
|
|
|
|
|
|
|
|
configuration "Debug*"
|
|
|
|
defines { "DEBUG", "_DEBUG" }
|
2016-09-25 18:57:46 -04:00
|
|
|
flags { "MultiProcessorCompile", "No64BitChecks" }
|
2016-07-11 11:14:58 -04:00
|
|
|
optimize "Debug"
|
2016-09-25 18:55:48 -04:00
|
|
|
symbols "On"
|
2016-07-11 11:14:58 -04:00
|
|
|
|
|
|
|
project "iw4x"
|
|
|
|
kind "SharedLib"
|
|
|
|
language "C++"
|
2016-08-13 14:11:06 -04:00
|
|
|
flags { "C++14" }
|
2016-07-11 11:14:58 -04:00
|
|
|
files {
|
|
|
|
"./src/**.rc",
|
|
|
|
"./src/**.hpp",
|
|
|
|
"./src/**.cpp",
|
|
|
|
"./src/**.proto",
|
|
|
|
}
|
|
|
|
includedirs {
|
|
|
|
"%{prj.location}/src",
|
|
|
|
"./src"
|
|
|
|
}
|
|
|
|
resincludedirs {
|
|
|
|
"$(ProjectDir)src" -- fix for VS IDE
|
|
|
|
}
|
|
|
|
|
2016-08-13 13:20:27 -04:00
|
|
|
-- Debug flags
|
2016-08-14 09:17:30 -04:00
|
|
|
if _OPTIONS["ac-debug-detections"] then
|
2016-08-13 13:20:27 -04:00
|
|
|
defines { "DEBUG_DETECTIONS" }
|
|
|
|
end
|
2016-08-14 09:17:30 -04:00
|
|
|
if _OPTIONS["ac-debug-load-library"] then
|
2016-08-13 13:20:27 -04:00
|
|
|
defines { "DEBUG_LOAD_LIBRARY" }
|
|
|
|
end
|
|
|
|
if _OPTIONS["force-unit-tests"] then
|
|
|
|
defines { "FORCE_UNIT_TESTS" }
|
|
|
|
end
|
2016-08-28 13:38:16 -04:00
|
|
|
if _OPTIONS["force-minidump-upload"] then
|
|
|
|
defines { "FORCE_MINIDUMP_UPLOAD" }
|
|
|
|
end
|
|
|
|
if _OPTIONS["force-exception-handler"] then
|
|
|
|
defines { "FORCE_EXCEPTION_HANDLER" }
|
|
|
|
end
|
|
|
|
if _OPTIONS["disable-bitmessage"] then
|
|
|
|
defines { "DISABLE_BITMESSAGE" }
|
|
|
|
removefiles {
|
|
|
|
"./src/Components/Modules/BitMessage.*",
|
|
|
|
}
|
|
|
|
end
|
2016-08-29 01:37:13 -04:00
|
|
|
if _OPTIONS["disable-node-log"] then
|
|
|
|
defines { "DISABLE_NODE_LOG"}
|
|
|
|
end
|
2016-08-29 01:36:41 -04:00
|
|
|
if _OPTIONS["disable-base128"] then
|
|
|
|
defines { "DISABLE_BASE128" }
|
|
|
|
end
|
2016-08-13 13:20:27 -04:00
|
|
|
|
2016-07-11 11:14:58 -04:00
|
|
|
-- Pre-compiled header
|
|
|
|
pchheader "STDInclude.hpp" -- must be exactly same as used in #include directives
|
|
|
|
pchsource "src/STDInclude.cpp" -- real path
|
|
|
|
buildoptions { "/Zm200" }
|
|
|
|
|
|
|
|
-- Dependency libraries
|
2016-08-28 13:38:16 -04:00
|
|
|
if not _OPTIONS["disable-bitmessage"] then
|
|
|
|
bitmrc.import()
|
|
|
|
end
|
2016-08-29 01:36:41 -04:00
|
|
|
if not _OPTIONS["disable-base128"] then
|
|
|
|
base128.import()
|
|
|
|
end
|
2016-08-13 13:24:02 -04:00
|
|
|
fmt.import()
|
|
|
|
json11.import()
|
|
|
|
libtomcrypt.import()
|
|
|
|
libtommath.import()
|
|
|
|
mongoose.import()
|
|
|
|
pdcurses.import()
|
|
|
|
protobuf.import()
|
|
|
|
winksignals.import()
|
|
|
|
zlib.import()
|
|
|
|
|
2016-07-11 11:14:58 -04:00
|
|
|
-- fix vpaths for protobuf sources
|
2016-08-13 13:24:02 -04:00
|
|
|
vpaths
|
2016-07-11 11:14:58 -04:00
|
|
|
{
|
|
|
|
["*"] = { "./src/**" },
|
|
|
|
["Proto/Generated"] = { "**.pb.*" }, -- meh.
|
|
|
|
}
|
|
|
|
|
|
|
|
-- Virtual paths
|
|
|
|
if not _OPTIONS["no-new-structure"] then
|
2016-08-13 13:24:02 -04:00
|
|
|
vpaths
|
2016-07-11 11:14:58 -04:00
|
|
|
{
|
|
|
|
["Headers/*"] = { "./src/**.hpp" },
|
|
|
|
["Sources/*"] = { "./src/**.cpp" },
|
|
|
|
["Resource/*"] = { "./src/**.rc" },
|
|
|
|
["Proto/Definitions/*"] = { "./src/Proto/**.proto" },
|
|
|
|
["Proto/Generated/*"] = { "**.pb.*" }, -- meh.
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2016-08-13 13:24:02 -04:00
|
|
|
vpaths
|
|
|
|
{
|
2016-07-11 11:14:58 -04:00
|
|
|
["Docs/*"] = { "**.txt","**.md" },
|
|
|
|
}
|
2016-08-13 13:24:02 -04:00
|
|
|
|
2016-07-11 11:14:58 -04:00
|
|
|
-- Pre-build
|
2016-08-13 13:24:02 -04:00
|
|
|
prebuildcommands
|
2016-07-11 11:14:58 -04:00
|
|
|
{
|
|
|
|
"cd %{_MAIN_SCRIPT_DIR}",
|
2016-08-13 13:24:02 -04:00
|
|
|
"tools\\premake5 generate-buildinfo",
|
2016-07-11 11:14:58 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
-- Post-build
|
|
|
|
if _OPTIONS["copy-to"] then
|
|
|
|
saneCopyToPath = string.gsub(_OPTIONS["copy-to"] .. "\\", "\\\\", "\\")
|
|
|
|
postbuildcommands {
|
2016-08-10 11:08:27 -04:00
|
|
|
"if not exist \"" .. saneCopyToPath .. "\" mkdir \"" .. saneCopyToPath .. "\"",
|
2016-07-11 11:14:58 -04:00
|
|
|
}
|
2016-08-10 11:09:19 -04:00
|
|
|
|
|
|
|
if _OPTIONS["copy-pdb"] then
|
|
|
|
postbuildcommands {
|
|
|
|
"copy /y \"$(TargetDir)*.pdb\" \"" .. saneCopyToPath .. "\"",
|
|
|
|
}
|
|
|
|
end
|
2016-09-25 18:55:48 -04:00
|
|
|
|
2016-08-26 06:14:59 -04:00
|
|
|
-- This has to be the last one, as otherwise VisualStudio will succeed building even if copying fails
|
|
|
|
postbuildcommands {
|
|
|
|
"copy /y \"$(TargetDir)*.dll\" \"" .. saneCopyToPath .. "\"",
|
|
|
|
}
|
2016-07-11 11:14:58 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
-- Specific configurations
|
|
|
|
flags { "UndefinedIdentifiers", "ExtraWarnings" }
|
|
|
|
|
2016-09-25 18:57:46 -04:00
|
|
|
symbols "On"
|
|
|
|
|
2016-07-11 11:14:58 -04:00
|
|
|
configuration "Release*"
|
2016-08-13 14:11:37 -04:00
|
|
|
flags {
|
|
|
|
"FatalCompileWarnings",
|
|
|
|
"FatalLinkWarnings",
|
|
|
|
}
|
2016-07-11 11:14:58 -04:00
|
|
|
configuration {}
|
|
|
|
|
|
|
|
-- Generate source code from protobuf definitions
|
2016-08-13 13:24:02 -04:00
|
|
|
filter "files:**.pb.*"
|
|
|
|
flags {
|
|
|
|
"NoPCH",
|
|
|
|
}
|
|
|
|
buildoptions {
|
|
|
|
"/wd4100", -- "Unused formal parameter"
|
|
|
|
"/wd4389", -- "Signed/Unsigned mismatch"
|
|
|
|
"/wd6011", -- "Dereferencing NULL pointer"
|
|
|
|
"/wd4125", -- "Decimal digit terminates octal escape sequence"
|
|
|
|
}
|
|
|
|
defines {
|
|
|
|
"_SCL_SECURE_NO_WARNINGS",
|
|
|
|
}
|
|
|
|
filter {}
|
2016-07-11 11:14:58 -04:00
|
|
|
rules { "ProtobufCompiler" }
|
|
|
|
|
|
|
|
-- Workaround: Consume protobuf generated source files
|
|
|
|
matches = os.matchfiles(path.join("src/Proto/**.proto"))
|
|
|
|
for i, srcPath in ipairs(matches) do
|
|
|
|
basename = path.getbasename(srcPath)
|
2016-08-13 13:24:02 -04:00
|
|
|
files
|
2016-07-11 11:14:58 -04:00
|
|
|
{
|
|
|
|
string.format("%%{prj.location}/src/proto/%s.pb.h", basename),
|
|
|
|
string.format("%%{prj.location}/src/proto/%s.pb.cc", basename),
|
|
|
|
}
|
|
|
|
end
|
2016-08-13 13:24:02 -04:00
|
|
|
includedirs
|
|
|
|
{
|
|
|
|
"%{prj.location}/src/proto",
|
2016-07-11 11:14:58 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
group "External dependencies"
|
2016-08-28 13:38:16 -04:00
|
|
|
if not _OPTIONS["disable-bitmessage"] then
|
|
|
|
bitmrc.project()
|
|
|
|
libcryptopp.project()
|
|
|
|
sqlite3.project()
|
|
|
|
end
|
2016-08-29 01:36:41 -04:00
|
|
|
if not _OPTIONS["disable-base128"] then
|
|
|
|
base128.project()
|
|
|
|
end
|
2016-08-13 13:24:02 -04:00
|
|
|
fmt.project()
|
|
|
|
json11.project()
|
|
|
|
libtomcrypt.project()
|
|
|
|
libtommath.project()
|
|
|
|
mongoose.project()
|
|
|
|
pdcurses.project()
|
2016-08-26 14:51:20 -04:00
|
|
|
protobuf.project()
|
2016-08-13 13:24:02 -04:00
|
|
|
winksignals.project()
|
|
|
|
zlib.project()
|
2016-07-11 11:14:58 -04:00
|
|
|
|
|
|
|
rule "ProtobufCompiler"
|
|
|
|
display "Protobuf compiler"
|
|
|
|
location "./build"
|
|
|
|
fileExtension ".proto"
|
|
|
|
buildmessage "Compiling %(Identity) with protoc..."
|
|
|
|
buildcommands {
|
|
|
|
'@echo off',
|
|
|
|
'path "$(SolutionDir)\\..\\tools"',
|
|
|
|
'if not exist "$(ProjectDir)\\src\\proto" mkdir "$(ProjectDir)\\src\\proto"',
|
|
|
|
'protoc --error_format=msvs -I=%(RelativeDir) --cpp_out=src\\proto %(Identity)',
|
|
|
|
}
|
|
|
|
buildoutputs {
|
|
|
|
'$(ProjectDir)\\src\\proto\\%(Filename).pb.cc',
|
|
|
|
'$(ProjectDir)\\src\\proto\\%(Filename).pb.h',
|
|
|
|
}
|