From a7d80f7187e6f8c871cf4189718136932d50f3a1 Mon Sep 17 00:00:00 2001 From: /dev/urandom Date: Fri, 26 Aug 2016 20:51:20 +0200 Subject: [PATCH] Premake: Fix BitMRC build and add shipped sqlite3 as separate project. --- premake/bitmrc.lua | 15 ++++++++------ premake/sqlite3.lua | 50 +++++++++++++++++++++++++++++++++++++++++++++ premake5.lua | 18 +++++++++------- 3 files changed, 70 insertions(+), 13 deletions(-) create mode 100644 premake/sqlite3.lua diff --git a/premake/bitmrc.lua b/premake/bitmrc.lua index 058632cc..758c8457 100644 --- a/premake/bitmrc.lua +++ b/premake/bitmrc.lua @@ -11,6 +11,9 @@ end function bitmrc.import() if not bitmrc.settings then error("Run bitmrc.setup first") end + sqlite3.import() + libcryptopp.import() + bitmrc.includes() end @@ -29,27 +32,27 @@ function bitmrc.project() includedirs { path.join(bitmrc.settings.source, "BitMRC/include"), + path.join(bitmrc.settings.source, "BitMRC/Storage/include"), } files { - path.join(bitmrc.settings.source, "BitMRC/**.cpp"), + path.join(bitmrc.settings.source, "BitMRC/*.cpp"), + path.join(bitmrc.settings.source, "BitMRC/Storage/*.cpp"), } removefiles { -- path.join(bitmrc.settings.source, "src/**/*test.cc"), - path.join(bitmrc.settings.source, "BitMRC/main.cpp"), + path.join(bitmrc.settings.source, "BitMRC/main.*"), + path.join(bitmrc.settings.source, "BitMRC/class.*"), path.join(bitmrc.settings.source, "BitMRC/tests/**"), - path.join(bitmrc.settings.source, "BitMRC/Storage/**"), - path.join(bitmrc.settings.source, "BitMRC/Debug/**"), } -- dependencies + sqlite3.import() libcryptopp.import() - -- not our code, ignore POSIX usage warnings for now defines { "_SCL_SECURE_NO_WARNINGS" } warnings "Off" - -- always build as static lib, as we include our custom classes and therefore can't perform shared linking kind "StaticLib" end diff --git a/premake/sqlite3.lua b/premake/sqlite3.lua new file mode 100644 index 00000000..ad4597e7 --- /dev/null +++ b/premake/sqlite3.lua @@ -0,0 +1,50 @@ +sqlite3 = { + settings = nil, +} + +function sqlite3.setup(settings) + if not settings.source then error("Missing source.") end + + sqlite3.settings = settings +end + +function sqlite3.import() + if not sqlite3.settings then error("Run sqlite3.setup first") end + + links { "sqlite3" } + sqlite3.includes() +end + +function sqlite3.includes() + if not sqlite3.settings then error("Run sqlite3.setup first") end + + includedirs { sqlite3.settings.source } +end + +function sqlite3.project() + if not sqlite3.settings then error("Run sqlite3.setup first") end + + project "sqlite3" + language "C++" + + includedirs + { + sqlite3.settings.source, + } + + files + { + path.join(sqlite3.settings.source, "*.c"), + path.join(sqlite3.settings.source, "*.h"), + } + + -- not our code, ignore POSIX usage warnings for now + warnings "Off" + + kind "SharedLib" + filter "*Static" + kind "StaticLib" + filter "kind:StaticLib" + defines { "_LIB" } + removedefines { "_USRDLL", "_DLL" } +end diff --git a/premake5.lua b/premake5.lua index f582e8ba..30942cab 100644 --- a/premake5.lua +++ b/premake5.lua @@ -125,17 +125,18 @@ newaction { depsBasePath = "./deps" +require "premake/bitmrc" require "premake/fmt" require "premake/json11" +require "premake/libcryptopp" require "premake/libtomcrypt" require "premake/libtommath" require "premake/mongoose" require "premake/pdcurses" require "premake/protobuf" +require "premake/sqlite3" require "premake/winksignals" require "premake/zlib" -require "premake/libcryptopp" -require "premake/bitmrc" bitmrc.setup { @@ -181,6 +182,10 @@ protobuf.setup { source = path.join(depsBasePath, "protobuf"), } +sqlite3.setup +{ + source = path.join(depsBasePath, "bitmrc/windows/sqlite3"), +} winksignals.setup { source = path.join(depsBasePath, "Wink-Signals"), @@ -255,6 +260,7 @@ workspace "iw4x" buildoptions { "/Zm200" } -- Dependency libraries + bitmrc.import() fmt.import() json11.import() libtomcrypt.import() @@ -264,8 +270,6 @@ workspace "iw4x" protobuf.import() winksignals.import() zlib.import() - libcryptopp.import() - bitmrc.import() -- fix vpaths for protobuf sources vpaths @@ -356,17 +360,17 @@ workspace "iw4x" } group "External dependencies" + bitmrc.project() fmt.project() json11.project() + libcryptopp.project() libtomcrypt.project() libtommath.project() mongoose.project() pdcurses.project() + protobuf.project() winksignals.project() zlib.project() - protobuf.project() - libcryptopp.project() - bitmrc.project() rule "ProtobufCompiler" display "Protobuf compiler"