134 lines
4.2 KiB
Lua
134 lines
4.2 KiB
Lua
-- VS DLL Support for PC
|
|
-- This file should be named simply gear4_pc.lua as it describes both static and dll projects
|
|
-- of win32 and win64 configurations
|
|
|
|
require "gear4_ms"
|
|
|
|
MSDLLLibProject = MSLibProject:New{
|
|
ealdllsrc = true
|
|
}
|
|
|
|
function MSDLLLibProject:GenerateDependencies()
|
|
if self.name:find("gear_core") == nil and self.name:find(eal_impl.name) == nil then
|
|
self.dependencies = { "gear_core" }
|
|
end
|
|
LibProject.GenerateDependencies(self)
|
|
end
|
|
|
|
-- Add EAL Dll files, specific links and new DLL configurations
|
|
function MSDLLLibProject:GenerateConfigurations()
|
|
local ealblob = nil
|
|
if self.ealdllsrc then
|
|
assert(eal_api_path)
|
|
ealblob = joinpath(eal_api_path, "ealdll.cpp")
|
|
local ealheaders = joinpath(eal_api_path, "*.h")
|
|
local ealsrcs = matchfiles(joinpath(eal_api_path, "eal*dll.cpp"))
|
|
ealsrcs = collect(difference(ealsrcs, {ealblob}))
|
|
local allfiles = collect(ealsrcs, {ealblob})
|
|
-- passing the headers to the excludefrompch make them compile under VS2009.
|
|
configuration { "*" }
|
|
files(cwdrelative(allfiles))
|
|
files(cwdrelative(ealheaders))
|
|
excludefilefrompch(cwdrelative(allfiles))
|
|
excludefilefrombuild(cwdrelative(ealsrcs))
|
|
end
|
|
|
|
if not self.static_only then
|
|
configuration { "*DLL*" }
|
|
local prefix = self.library.name:upper()
|
|
prefix = prefix:gsub("GEAR_", "G4_")
|
|
defines { prefix .. "_DLL",
|
|
prefix .. "_EXPORT_DLL",
|
|
"EAL_IMPORT_DLL"
|
|
}
|
|
kind ( "SharedLib" )
|
|
links {"Ws2_32", "Version"}
|
|
implibdir( cwdrelative(self.targetdir) )
|
|
end
|
|
|
|
if ealblob then
|
|
configuration { "not *DLL*" }
|
|
excludefilefrombuild(cwdrelative(ealblob))
|
|
end
|
|
|
|
configuration { "*" }
|
|
LibProject.GenerateConfigurations(self)
|
|
end
|
|
|
|
MSDLLTestProject = MSTestProject:New()
|
|
|
|
function MSDLLTestProject:GenerateDependencies()
|
|
MSTestProject.GenerateDependencies(self)
|
|
linkoptions { "/MAP /MAPINFO:EXPORTS /INCREMENTAL:NO" }
|
|
end
|
|
|
|
function MSDLLTestProject:GenerateConfigurations()
|
|
MSTestProject.GenerateConfigurations(self)
|
|
|
|
configuration { "*" }
|
|
links "Ws2_32"
|
|
|
|
configuration { "not *DLL*" }
|
|
links "Version"
|
|
|
|
configuration { "*DLL*" }
|
|
if self.name:find("gear_core") == nil then
|
|
local prefix = self.name:upper()
|
|
prefix = prefix:gsub("GEAR_(%w+).*", "G4_%1")
|
|
defines { prefix .. "_DLL" }
|
|
end
|
|
|
|
postbuildcommands {"xcopy /y $(SolutionDir)..\\..\\..\\lib\\" .. gear4.platform .. "\\vc" .. vsver .. "\\*.dll exe\\"}
|
|
end
|
|
|
|
MSDLLLibrary = MSLibrary:New{
|
|
LibProject = MSDLLLibProject,
|
|
TestProject = MSDLLTestProject
|
|
}
|
|
|
|
MSDLLSolution = MSSolution:New{
|
|
Library = MSDLLLibrary,
|
|
msdllconfigurations = {
|
|
-- TODO: Bad support... proposition is to move the lib inside
|
|
-- its own platform (winXXdll)
|
|
["DebugDLL"] = {
|
|
defines = { "G4_CORE_DLL" },
|
|
targetsuffix = suffixes[ "DebugDLL" ],
|
|
implibsuffix = suffixes[ "DebugDLL" ],
|
|
},
|
|
["Debug*"] = {
|
|
flags = { "Symbols", "VS_RuntimeLibrary_MultiThreadedDebug" },
|
|
},
|
|
["ReleaseDLL"] = {
|
|
defines = { "G4_CORE_DLL" },
|
|
targetsuffix = suffixes[ "ReleaseDLL" ],
|
|
implibsuffix = suffixes[ "ReleaseDLL" ],
|
|
},
|
|
["RetailDLL"] = {
|
|
defines = { "G4_CORE_DLL" },
|
|
targetsuffix = suffixes[ "RetailDLL" ],
|
|
implibsuffix = suffixes[ "RetailDLL" ],
|
|
},
|
|
["Re*"] = {
|
|
flags = { "VS_RuntimeLibrary_MultiThreaded" },
|
|
},
|
|
},
|
|
MSDLLDefaults = {
|
|
defines = { "WIN32",
|
|
"WIN32_LEAN_AND_MEAN",
|
|
"_WIN32_WINNT=0x0501",
|
|
"_HAS_EXCEPTIONS=0",
|
|
iif(vsver == "11", "_VARIADIC_MAX=10"),
|
|
},
|
|
includedirs = { iif(vsver < "11", "$(DXSDK_DIR)/include") },
|
|
}
|
|
}
|
|
|
|
function MSDLLSolution:GenerateConfigurations()
|
|
configurations {"DebugDLL", "ReleaseDLL", "RetailDLL" }
|
|
MSSolution.GenerateConfigurations(self)
|
|
for name, options in pairs(self.msdllconfigurations) do
|
|
self:GenerateConfiguration(name, options)
|
|
end
|
|
self:GenerateConfiguration("*", self.MSDLLDefaults)
|
|
end
|