211 lines
5.1 KiB
Lua
211 lines
5.1 KiB
Lua
|
local configPath = "../wxConfig/"
|
||
|
local gl = true
|
||
|
local gtk = linux
|
||
|
local windows = win32
|
||
|
local wxGlobals = {"__WX__", "wxUSE_GUI=1", "wxUSE_BASE=1","_FILE_OFFSET_BITS=64"}
|
||
|
local platform_macro = "__WXUNKNOWNPLATFORM_"
|
||
|
--local wxvarsW32 = {}
|
||
|
|
||
|
--if (windows) then
|
||
|
--platform_macro = "__WXMSW__"
|
||
|
local wxvarsW32 = require("wxwidgets-windows-msw")
|
||
|
--elseif (gtk_linux) then
|
||
|
--platform_macro = "__WXGTK__"
|
||
|
local wxvarsLinux = require("wxwidgets-linux-gtk")
|
||
|
--end
|
||
|
|
||
|
local function addPlatformMacro()
|
||
|
auFilter(auFilterOf{platforms = "win32"})
|
||
|
defines "__WXMSW__"
|
||
|
auFilter {}
|
||
|
|
||
|
auFilter(auFilterOf{platforms = "linux"})
|
||
|
defines "__WXGTK__"
|
||
|
auFilter {}
|
||
|
end
|
||
|
|
||
|
local function translateDep(that, dep)
|
||
|
if (that.info.translations) then
|
||
|
local override = that.info.translations[dep]
|
||
|
if (override) then
|
||
|
dep = override
|
||
|
end
|
||
|
end
|
||
|
|
||
|
return dep
|
||
|
end
|
||
|
|
||
|
local function incDep(that, dep, link)
|
||
|
if (link) then
|
||
|
auIncludeProject(that:translateDep(dep))
|
||
|
else
|
||
|
auIncludeProject(that:translateDep(dep))
|
||
|
end
|
||
|
end
|
||
|
|
||
|
local function addSources(name)
|
||
|
auFilter(auFilterOf{platforms = "win32"})
|
||
|
auForEach(wxvarsW32[name], files)
|
||
|
auFilter {}
|
||
|
|
||
|
auFilter(auFilterOf{platforms = "linux"})
|
||
|
auForEach(wxvarsLinux[name], files)
|
||
|
auFilter {}
|
||
|
end
|
||
|
|
||
|
local function includeBaseGtk(that)
|
||
|
incDep(that, "gtk-desktop-bins")
|
||
|
end
|
||
|
|
||
|
local function processRegex(that)
|
||
|
auStartProject({name = "wxregex", projectType = "StaticLib", inc = "include"})
|
||
|
addPlatformMacro()
|
||
|
files
|
||
|
{
|
||
|
"src/regex/regcomp.*",
|
||
|
"src/regex/regexec.*",
|
||
|
"src/regex/regerror.*",
|
||
|
"src/regex/regfree.*"
|
||
|
}
|
||
|
includedirs(configPath)
|
||
|
end
|
||
|
|
||
|
local function processScintilla(that)
|
||
|
auStartProject({name = "wxscintilla", projectType = "StaticLib", src = "src/stc/scintilla/src", inc = "src/stc/scintilla/include"})
|
||
|
defines({"__WX__", "SCI_LEXER", "NO_CXX11_REGEX", "LINK_LEXERS", "_FILE_OFFSET_BITS=64"})
|
||
|
addPlatformMacro()
|
||
|
|
||
|
includedirs("include/")
|
||
|
includedirs(configPath)
|
||
|
includedirs("src/stc/scintilla/src")
|
||
|
includedirs("src/stc/scintilla/lexlib")
|
||
|
includedirs("src/stc/scintilla/lexers")
|
||
|
|
||
|
addSources("STC_SRC")
|
||
|
|
||
|
if (gtk) then
|
||
|
includeBaseGtk(that)
|
||
|
|
||
|
if (_linux) then
|
||
|
includedirs("gdk/include")
|
||
|
includedirs "/usr/include/at-spi-2.0 "
|
||
|
includedirs "/usr/include/at-spi2-atk/2.0"
|
||
|
|
||
|
includedirs "/usr/include/dbus-1.0"
|
||
|
includedirs "/usr/lib/dbus-1.0/include"
|
||
|
|
||
|
includedirs "/usr/include/libmount"
|
||
|
includedirs "/usr/include/libsecret-1"
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
|
||
|
local function processWxWidgets(that)
|
||
|
auStartProject({name = "wxWidgets", projectType = "StaticLib", inc = "include"})
|
||
|
defines(wxGlobals)
|
||
|
|
||
|
defines "WXBUILDING"
|
||
|
|
||
|
incDep(that, "zlib")
|
||
|
|
||
|
--dependson "wxscintilla"
|
||
|
includedirs("src/stc/scintilla/include")
|
||
|
|
||
|
incDep(that, "expat")
|
||
|
defines "XML_STATIC"
|
||
|
|
||
|
includedirs("src/common")
|
||
|
includedirs("src/regex")
|
||
|
includedirs("src/stc/scintilla/include")
|
||
|
|
||
|
includedirs(configPath)
|
||
|
|
||
|
if (gtk) then
|
||
|
includeBaseGtk()
|
||
|
else
|
||
|
incDep(that, "png")
|
||
|
incDep(that, "freetype")
|
||
|
incDep(that, "harfbuzz")
|
||
|
end
|
||
|
|
||
|
addSources("CORE_SRC")
|
||
|
addSources("BASE_SRC")
|
||
|
addSources("BASE_AND_GUI_SRC")
|
||
|
addSources("BASE_PLATFORM_SRC")
|
||
|
|
||
|
addSources("RICHTEXT_SRC")
|
||
|
addSources("XML_SRC")
|
||
|
addSources("HTML_SRC")
|
||
|
|
||
|
if (net) then
|
||
|
addSources("NET_PLATFORM_SRC")
|
||
|
addSources("NET_SRC")
|
||
|
end
|
||
|
|
||
|
if (gl) then
|
||
|
addSources("OPENGL_SRC")
|
||
|
end
|
||
|
|
||
|
end
|
||
|
|
||
|
local function auSetupProjectProject(this)
|
||
|
processRegex(this)
|
||
|
processScintilla(this)
|
||
|
processWxWidgets(this)
|
||
|
end
|
||
|
|
||
|
local function linkProject(this)
|
||
|
links "wxregex"
|
||
|
links "wxscintilla"
|
||
|
links "wxWidgets"
|
||
|
|
||
|
links(translateDep(this, "zlib"))
|
||
|
links(translateDep(this, "expat"))
|
||
|
links(translateDep(this, "png"))
|
||
|
|
||
|
auFilter(auFilterOf{platforms = "linux"})
|
||
|
-- TODO:?
|
||
|
--linkExternalUnixDeps(this)
|
||
|
auFilter {}
|
||
|
|
||
|
if (gtk) then
|
||
|
incDep(this, "gtk-desktop-bins", true)
|
||
|
end
|
||
|
|
||
|
auFilter(auFilterOf{platforms = "win32"})
|
||
|
links "Rpcrt4.lib"
|
||
|
links "Comctl32.lib"
|
||
|
auFilter {}
|
||
|
end
|
||
|
|
||
|
local function includeProject(this)
|
||
|
includedirs(this.info.path .. "/include")
|
||
|
includedirs(this.info.path .. "/src/common")
|
||
|
includedirs(this.info.path .. "/" .. configPath)
|
||
|
|
||
|
defines "XML_STATIC"
|
||
|
|
||
|
defines (wxGlobals)
|
||
|
addPlatformMacro()
|
||
|
end
|
||
|
|
||
|
local function resolveDependencies(this, resolve)
|
||
|
resolve(translateDep(this, "zlib"))
|
||
|
resolve(translateDep(this, "png"))
|
||
|
resolve(translateDep(this, "expat"))
|
||
|
if (gtk) then
|
||
|
resolve(translateDep(this, "gtk-desktop-bins"))
|
||
|
end
|
||
|
end
|
||
|
|
||
|
local function wxWidgetsProcessor(info)
|
||
|
local interface = {}
|
||
|
interface.info = info
|
||
|
interface.process = auSetupProjectProject
|
||
|
interface.handleLink = linkProject
|
||
|
interface.handleReference = includeProject
|
||
|
interface.resolveDependencies = resolveDependencies
|
||
|
return interface
|
||
|
end
|
||
|
|
||
|
return wxWidgetsProcessor
|