|
|
@@ -11,38 +11,41 @@ local function extern_path(local_path)
|
|
|
end
|
|
|
|
|
|
--- Common function I use to structure projects according to the three-stage
|
|
|
--- project pattern I usually see : Debug, optimized Debug and Release.
|
|
|
+-- configuration pattern I usually see : Debug, optimized Debug and Release.
|
|
|
-- Sometimes I see also a Final version, but it almost is a copy of the Release
|
|
|
-- stage.
|
|
|
-local function base_project_settings()
|
|
|
- -- I commonly use modern C++ nowadays.
|
|
|
+local function base_workspace_settings()
|
|
|
language "C++"
|
|
|
+ configurations {"Debug", "DebugOpt", "Release"}
|
|
|
+ location "build"
|
|
|
+ architecture "x86_64"
|
|
|
|
|
|
- configuration "Debug"
|
|
|
+ filter "configurations:Debug"
|
|
|
defines {"DEBUG"}
|
|
|
symbols "On"
|
|
|
warnings "Extra"
|
|
|
|
|
|
- configuration "DebugOpt"
|
|
|
+ filter "configurations:DebugOpt"
|
|
|
defines {"DEBUG"}
|
|
|
symbols "On"
|
|
|
optimize "Debug"
|
|
|
warnings "Extra"
|
|
|
|
|
|
- configuration "Release"
|
|
|
+ filter "configurations:Release"
|
|
|
defines {"NDEBUG"}
|
|
|
optimize "On"
|
|
|
warnings "Extra"
|
|
|
+
|
|
|
+ filter {}
|
|
|
end
|
|
|
|
|
|
local function link_against_modules(modules)
|
|
|
- for _, mod in pairs(modules) do
|
|
|
- links(mod.name)
|
|
|
- end
|
|
|
- for _, mod in pairs(modules) do
|
|
|
- includedirs(mod.public_includes)
|
|
|
- end
|
|
|
- -- TODO system filters
|
|
|
+ for _, mod in pairs(modules) do
|
|
|
+ links(mod.name)
|
|
|
+ end
|
|
|
+ for _, mod in pairs(modules) do
|
|
|
+ includedirs(mod.public_includes)
|
|
|
+ end
|
|
|
end
|
|
|
|
|
|
--- An attempt at making a common ground for multiple libraries I'd use
|
|
|
@@ -53,8 +56,8 @@ local function library_module(lib_name, folder)
|
|
|
folder = folder or lib_name,
|
|
|
|
|
|
links = {},
|
|
|
- win_links = {},
|
|
|
- linux_links = {},
|
|
|
+ win_links = {},
|
|
|
+ linux_links = {},
|
|
|
|
|
|
files = {},
|
|
|
win_files = {},
|
|
|
@@ -156,27 +159,28 @@ local function library_module(lib_name, folder)
|
|
|
--- Calls premake's code to add the module's project to the current
|
|
|
-- workspace.
|
|
|
function mod:use(use_kind)
|
|
|
+ -- TODO: handle dependencies
|
|
|
project(self.name)
|
|
|
kind(use_kind)
|
|
|
- -- TODO : kind
|
|
|
defines(self.defines)
|
|
|
files(self.files)
|
|
|
includedirs(self.public_includes)
|
|
|
includedirs(self.private_includes)
|
|
|
links(self.links)
|
|
|
|
|
|
- base_project_settings()
|
|
|
filter "system:windows"
|
|
|
defines(self.win_defines)
|
|
|
files(self.win_files)
|
|
|
includedirs(self.win_private_includes)
|
|
|
- links(self.win_links)
|
|
|
+ links(self.win_links)
|
|
|
|
|
|
filter "system:linux"
|
|
|
defines(self.linux_defines)
|
|
|
files(self.linux_files)
|
|
|
includedirs(self.linux_private_includes)
|
|
|
- links(self.linux_links)
|
|
|
+ links(self.linux_links)
|
|
|
+
|
|
|
+ filter {}
|
|
|
|
|
|
end
|
|
|
|
|
|
@@ -185,7 +189,7 @@ end
|
|
|
|
|
|
return {
|
|
|
_VERSION = "0.0.1",
|
|
|
- base_project_settings = base_project_settings,
|
|
|
+ base_workspace_settings = base_workspace_settings,
|
|
|
library_module = library_module,
|
|
|
- link_against_modules = link_against_modules
|
|
|
+ link_against_modules = link_against_modules
|
|
|
}
|