From 59ed0276d1024fc6157044e92549bef264a830ef Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Sun, 3 Feb 2019 14:47:15 +0100 Subject: Add premake4 conf, to replace configure.py (in the near future) --- .gitignore | 3 ++ lib/libwrapsdl2 | 1 - premake4.lua | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 90 insertions(+), 1 deletion(-) delete mode 160000 lib/libwrapsdl2 create mode 100644 premake4.lua diff --git a/.gitignore b/.gitignore index 1f24bab..1d9887b 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,9 @@ build .ninja_log build.ninja +# makefiles +Makefile + # ctag files tags diff --git a/lib/libwrapsdl2 b/lib/libwrapsdl2 deleted file mode 160000 index 736ec71..0000000 --- a/lib/libwrapsdl2 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 736ec71fce673d5aa88228b96acfe6c6862a2232 diff --git a/premake4.lua b/premake4.lua new file mode 100644 index 0000000..da82f23 --- /dev/null +++ b/premake4.lua @@ -0,0 +1,87 @@ +--[[ project solution / workspace, global configuration ]]-- +solution "flatland" + configurations { "debug", "release" } + + -- build configurations + flags { "ExtraWarnings" } + buildoptions { "-std=c++17" } + + --- for linux specifically + configuration { "linux", "gmake" } + buildoptions { + "-pedantic", "-Wall", "-Wextra", "-Wcast-qual", "-Wcast-align", + "-Wpointer-arith", "-Winit-self", "-Wshadow", "-Wswitch-enum", + "-Wredundant-decls", "-Wfloat-equal", "-Wundef", "-Wvla", + "-Wconversion", "-Wstrict-aliasing" + } + + +--[[ custom lua code ]]-- +local test = { + add_specific = function(name, src, tested_src) + local sources = {} + table.insert(sources, src) + + io.write("Added specific test " .. src .. " to test { ") + for k, v in pairs(tested_src) do + io.write(v .. " " ) + table.insert(sources, v) + end + print("}") + + project("libflatland-test-" .. name) + language("C++") + kind("ConsoleApp") + location("build/") + + includedirs({ "engine/include", "lib/include" }) + files(sources) + + configuration("debug") + targetdir("build/debug") + + defines({ "DEBUG" }) + flags({ "Symbols" }) + end +} + +local dependency = { + build = function(path, commands) + print("Building dependency under " .. path) + for k, cmd in pairs(commands) do + print(" Running " .. cmd) + os.execute("cd " .. path .. "; " .. cmd) + end + end +} + +--[[ dependencies ]]-- +dependency.build("lib/libwsdl2", { "./configure.py", "ninja" }) +dependency.build("lib/libmm", { "ninja" }) + +--[[ main project ]]-- +project "libflatland" + -- project + language "C++" + kind "SharedLib" + location "build/" + + -- source code + files { "engine/**.cpp" } + includedirs { "lib/include", "engine/include" } + + configuration "debug" + targetdir "build/debug" + + defines { "DEBUG" } + flags { "Symbols" } + + configuration "release" + targetdir "build/release" + + flags { "Optimize" } + +-- add tests +test.add_specific("task", "test/task_test.cpp", { + "engine/task.cpp" +}) -- cgit v1.2.1