2023-06-13 09:40:54 -04:00
|
|
|
-------------------------------------------------
|
|
|
|
-- DEPENDENCIES
|
|
|
|
-------------------------------------------------
|
2020-05-21 07:32:38 -04:00
|
|
|
dependencies = { base = path.getrelative(os.getcwd(), path.getabsolute("deps")) }
|
|
|
|
|
|
|
|
function dependencies.load()
|
|
|
|
dir = path.join(dependencies.base, "*.lua")
|
|
|
|
deps = os.matchfiles(dir)
|
|
|
|
|
|
|
|
for i, dep in pairs(deps) do
|
|
|
|
dep = dep:gsub(".lua", "")
|
|
|
|
require(dep)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
dependencies.load()
|
2023-06-13 09:40:54 -04:00
|
|
|
|
|
|
|
-------------------------------------------------
|
|
|
|
-- VERSIONING
|
|
|
|
-------------------------------------------------
|
|
|
|
function version_split(version, revision)
|
|
|
|
array = {}
|
|
|
|
|
|
|
|
for num in string.gmatch(version or "", "%d+") do
|
|
|
|
if #array < 3 then
|
|
|
|
table.insert(array, tonumber(num))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
while #array < 3 do
|
|
|
|
table.insert(array, 0)
|
|
|
|
end
|
|
|
|
|
|
|
|
table.insert(array, tonumber(revision))
|
|
|
|
|
|
|
|
return array
|
|
|
|
end
|
|
|
|
|
|
|
|
function generate_version()
|
|
|
|
-- get current version
|
|
|
|
local proc1 = assert(io.popen("git describe --tags --abbrev=0", "r"))
|
|
|
|
local version = assert(proc1:read('*a')):gsub("%s+", "")
|
|
|
|
proc1:close()
|
|
|
|
|
|
|
|
-- get current branch
|
|
|
|
local proc2 = assert(io.popen("git symbolic-ref -q --short HEAD", "r"))
|
|
|
|
local branch = assert(proc2:read('*a')):gsub("%s+", "")
|
|
|
|
proc2:close()
|
|
|
|
|
|
|
|
-- get revision number
|
|
|
|
local proc3 = assert(io.popen("git rev-list --count HEAD", "r"))
|
|
|
|
local revision = assert(proc3:read("*a")):gsub("%s+", "")
|
|
|
|
proc3:close()
|
|
|
|
|
|
|
|
local split = version_split(version, revision)
|
|
|
|
local verstr = split[1] .. "." .. split[2] .. "." .. split[3] .. "." .. split[4] .. "-" .. branch
|
|
|
|
|
|
|
|
local file = assert(io.open("include/xsk/version.hpp", "w"))
|
|
|
|
file:write("// Generated by premake - do not edit\n\n")
|
|
|
|
file:write("#define XSK_VERSION_MAJOR " .. split[1] .. "\n")
|
|
|
|
file:write("#define XSK_VERSION_MINOR " .. split[2] .. "\n")
|
|
|
|
file:write("#define XSK_VERSION_PATCH " .. split[3] .. "\n")
|
|
|
|
file:write("#define XSK_VERSION_BUILD " .. split[4] .. "\n")
|
|
|
|
file:write("#define XSK_VERSION_BRANCH \"" .. branch .. "\"\n")
|
|
|
|
file:write("#define XSK_VERSION_STR \"" .. verstr .. "\"\n")
|
|
|
|
file:close()
|
|
|
|
end
|
|
|
|
|
|
|
|
generate_version()
|
|
|
|
|
|
|
|
-------------------------------------------------
|
|
|
|
-- PROJECTS
|
2020-05-21 07:32:38 -04:00
|
|
|
-------------------------------------------------
|
|
|
|
workspace "gsc-tool"
|
2023-01-23 17:31:08 -05:00
|
|
|
startproject "xsk-tool"
|
2020-05-21 07:32:38 -04:00
|
|
|
location "./build"
|
|
|
|
objdir "%{wks.location}/obj/%{cfg.buildcfg}/%{prj.name}"
|
2023-01-10 06:49:05 -05:00
|
|
|
targetdir "%{wks.location}/bin/%{cfg.platform}/%{cfg.buildcfg}"
|
2020-05-21 07:32:38 -04:00
|
|
|
targetname "%{prj.name}"
|
|
|
|
|
2023-01-10 06:49:05 -05:00
|
|
|
configurations { "debug", "release" }
|
|
|
|
|
|
|
|
if os.istarget("darwin") then
|
|
|
|
platforms { "x64", "arm64" }
|
|
|
|
else
|
|
|
|
platforms { "x86", "x64" }
|
|
|
|
end
|
|
|
|
|
|
|
|
filter "platforms:x86"
|
|
|
|
architecture "x86"
|
|
|
|
filter {}
|
|
|
|
|
|
|
|
filter "platforms:x64"
|
|
|
|
architecture "x86_64"
|
|
|
|
filter {}
|
|
|
|
|
|
|
|
filter "platforms:arm64"
|
|
|
|
architecture "ARM64"
|
|
|
|
filter {}
|
|
|
|
|
|
|
|
filter { "language:C++", "toolset:not msc*" }
|
2023-06-13 09:40:54 -04:00
|
|
|
buildoptions "-std=c++20"
|
2023-01-10 06:49:05 -05:00
|
|
|
filter {}
|
|
|
|
|
|
|
|
filter "toolset:msc*"
|
2020-05-21 07:32:38 -04:00
|
|
|
buildoptions "/bigobj"
|
|
|
|
buildoptions "/Zc:__cplusplus"
|
2023-01-10 06:49:05 -05:00
|
|
|
buildoptions "/std:c++20"
|
2021-12-25 14:10:30 -05:00
|
|
|
filter {}
|
2020-05-21 07:32:38 -04:00
|
|
|
|
2023-01-10 06:49:05 -05:00
|
|
|
filter { "system:windows" }
|
2023-06-13 09:40:54 -04:00
|
|
|
systemversion "latest"
|
2023-01-10 06:49:05 -05:00
|
|
|
filter {}
|
|
|
|
|
|
|
|
filter { "system:macosx" }
|
2023-06-13 09:40:54 -04:00
|
|
|
systemversion "12.0"
|
2023-01-10 06:49:05 -05:00
|
|
|
filter {}
|
2020-05-21 07:32:38 -04:00
|
|
|
|
|
|
|
symbols "On"
|
2023-01-10 06:49:05 -05:00
|
|
|
staticruntime "On"
|
2022-03-16 11:13:33 -04:00
|
|
|
warnings "Extra"
|
2020-05-21 07:32:38 -04:00
|
|
|
|
2023-01-10 06:49:05 -05:00
|
|
|
if os.istarget("linux") or os.istarget("darwin") then
|
|
|
|
buildoptions "-pthread"
|
|
|
|
linkoptions "-pthread"
|
|
|
|
end
|
|
|
|
|
|
|
|
filter "configurations:release"
|
2020-05-21 07:32:38 -04:00
|
|
|
optimize "Full"
|
2022-03-15 12:01:13 -04:00
|
|
|
defines { "NDEBUG" }
|
2022-03-16 11:13:33 -04:00
|
|
|
flags { "FatalCompileWarnings" }
|
2021-12-25 14:10:30 -05:00
|
|
|
filter {}
|
2020-05-21 07:32:38 -04:00
|
|
|
|
2023-01-10 06:49:05 -05:00
|
|
|
filter "configurations:debug"
|
2020-05-21 07:32:38 -04:00
|
|
|
optimize "Debug"
|
2022-03-15 12:01:13 -04:00
|
|
|
defines { "DEBUG", "_DEBUG" }
|
2021-12-25 14:10:30 -05:00
|
|
|
filter {}
|
2020-05-21 07:32:38 -04:00
|
|
|
|
2023-01-23 17:31:08 -05:00
|
|
|
project "xsk-tool"
|
2020-05-21 07:32:38 -04:00
|
|
|
kind "ConsoleApp"
|
|
|
|
language "C++"
|
|
|
|
targetname "gsc-tool"
|
|
|
|
|
2023-01-23 17:31:08 -05:00
|
|
|
dependson "xsk-utils"
|
2023-05-13 13:24:57 -04:00
|
|
|
dependson "xsk-arc"
|
2023-01-23 17:31:08 -05:00
|
|
|
dependson "xsk-gsc"
|
2020-05-21 07:32:38 -04:00
|
|
|
|
|
|
|
files {
|
|
|
|
"./src/tool/**.h",
|
|
|
|
"./src/tool/**.hpp",
|
|
|
|
"./src/tool/**.cpp"
|
|
|
|
}
|
|
|
|
|
|
|
|
links {
|
2023-01-23 17:31:08 -05:00
|
|
|
"xsk-utils",
|
2023-05-13 13:24:57 -04:00
|
|
|
"xsk-arc",
|
2023-01-23 17:31:08 -05:00
|
|
|
"xsk-gsc",
|
2020-05-21 07:32:38 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
includedirs {
|
2023-03-02 10:41:32 -05:00
|
|
|
"./include",
|
2020-05-21 07:32:38 -04:00
|
|
|
}
|
|
|
|
|
2023-01-23 17:31:08 -05:00
|
|
|
fmt:link()
|
2020-05-21 07:32:38 -04:00
|
|
|
zlib:link()
|
|
|
|
|
2023-01-23 17:31:08 -05:00
|
|
|
project "xsk-utils"
|
2020-05-21 07:32:38 -04:00
|
|
|
kind "StaticLib"
|
|
|
|
language "C++"
|
|
|
|
|
|
|
|
files {
|
|
|
|
"./src/utils/**.h",
|
|
|
|
"./src/utils/**.hpp",
|
|
|
|
"./src/utils/**.cpp"
|
|
|
|
}
|
|
|
|
|
|
|
|
includedirs {
|
2023-03-02 10:41:32 -05:00
|
|
|
"./include",
|
2020-05-21 07:32:38 -04:00
|
|
|
}
|
|
|
|
|
2023-01-23 17:31:08 -05:00
|
|
|
fmt:include()
|
2020-05-21 07:32:38 -04:00
|
|
|
zlib:include()
|
|
|
|
|
2023-05-13 13:24:57 -04:00
|
|
|
project "xsk-arc"
|
2022-09-22 06:57:11 -04:00
|
|
|
kind "StaticLib"
|
|
|
|
language "C++"
|
|
|
|
|
2023-01-23 17:31:08 -05:00
|
|
|
files {
|
2023-05-13 13:24:57 -04:00
|
|
|
"./src/arc/**.h",
|
|
|
|
"./src/arc/**.hpp",
|
|
|
|
"./src/arc/**.cpp"
|
2023-01-23 17:31:08 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
includedirs {
|
2023-03-02 10:41:32 -05:00
|
|
|
"./include",
|
2023-01-23 17:31:08 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fmt:include()
|
|
|
|
|
2023-05-13 13:24:57 -04:00
|
|
|
project "xsk-gsc"
|
2023-01-23 17:31:08 -05:00
|
|
|
kind "StaticLib"
|
|
|
|
language "C++"
|
2022-09-22 06:57:11 -04:00
|
|
|
|
|
|
|
files {
|
2023-05-13 13:24:57 -04:00
|
|
|
"./src/gsc/**.h",
|
|
|
|
"./src/gsc/**.hpp",
|
|
|
|
"./src/gsc/**.cpp"
|
2022-09-22 06:57:11 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
includedirs {
|
2023-03-02 10:41:32 -05:00
|
|
|
"./include",
|
2022-09-22 06:57:11 -04:00
|
|
|
}
|
|
|
|
|
2023-01-23 17:31:08 -05:00
|
|
|
fmt:include()
|
|
|
|
|
2020-05-21 07:32:38 -04:00
|
|
|
group "Dependencies"
|
|
|
|
zlib:project()
|
2023-05-13 13:24:57 -04:00
|
|
|
fmt:project()
|