Browse Source

Revert "Generate code from tests where libraries appear"

This reverts commit fa47194dae.

# Conflicts:
#	build/Tests.lua

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/1508/head
Dimitar Dobrev 5 years ago
parent
commit
7d2d8f291e
  1. 2
      build/Helpers.lua
  2. 71
      build/Tests.lua
  3. 2
      src/Generator.Tests/GeneratorTest.cs
  4. 2
      tests/NamespacesBase/premake4.lua

2
build/Helpers.lua

@ -111,7 +111,7 @@ else @@ -111,7 +111,7 @@ else
libdir = path.join(builddir, "lib", "%{cfg.buildcfg}");
end
gendir = libdir;
gendir = path.join(builddir, "gen");
msvc_buildflags = { "/MP", "/wd4267" }

71
build/Tests.lua

@ -1,8 +1,7 @@ @@ -1,8 +1,7 @@
-- Tests/examples helpers
require('vstudio')
require('gmake2')
function disableFastUpToDateCheck(prj, cfg)
premake.vstudio.vc2010.element("DisableFastUpToDateCheck", nil, "true")
end
@ -30,62 +29,6 @@ premake.override(premake.vstudio.vc2010.elements, "globals", @@ -30,62 +29,6 @@ premake.override(premake.vstudio.vc2010.elements, "globals",
return elements
end)
-- HACK: work around gmake(2) ignoring tokens such as %{cfg.buildcfg}
-- https://github.com/premake/premake-core/issues/1557
if not os.istarget("windows") then
premake.override(premake.modules.gmake2, "csSources",
function(_, prj)
for cfg in premake.project.eachconfig(prj) do
_x('ifeq ($(config),%s)', cfg.shortname)
_p('SOURCES += \\')
premake.modules.gmake2.cs.listsources(prj, function(node)
local fcfg = premake.fileconfig.getconfig(node, cfg)
local info = premake.tools.dotnet.fileinfo(fcfg)
if info.action == "Compile" then
return node.relpath
end
end)
_p('')
_p('endif')
_p('')
end
end)
premake.override(premake.modules.gmake2, "csResponseRules",
function(_, prj)
local toolset = premake.tools.dotnet
local ext = premake.modules.gmake2.getmakefilename(prj, true)
local makefile = path.getname(premake.filename(prj, ext))
local response = premake.modules.gmake2.cs.getresponsefilename(prj)
_p('$(RESPONSE): %s', makefile)
_p('\t@echo Generating response file', prj.name)
_p('ifeq (posix,$(SHELLTYPE))')
_x('\t$(SILENT) rm -f $(RESPONSE)')
_p('else')
_x('\t$(SILENT) if exist $(RESPONSE) del %s', path.translate(response, '\\'))
_p('endif')
_p('')
local sep = os.istarget("windows") and "\\" or "/"
for cfg in premake.project.eachconfig(prj) do
_x('ifeq ($(config),%s)', cfg.shortname)
premake.modules.gmake2.cs.listsources(prj, function(node)
local fcfg = premake.fileconfig.getconfig(node, cfg)
local info = premake.tools.dotnet.fileinfo(fcfg)
if info.action == "Compile" then
_x('\t@echo %s >> $(RESPONSE)', path.translate(node.relpath, sep))
end
end)
_p('endif')
_p('')
end
end)
end
function SetupExampleProject()
kind "ConsoleApp"
language "C#"
@ -264,8 +207,8 @@ function SetupTestProjectsCSharp(name, depends, extraFiles, suffix) @@ -264,8 +207,8 @@ function SetupTestProjectsCSharp(name, depends, extraFiles, suffix)
files
{
path.join(gendir, nm .. ".cs"),
path.join(gendir, str .. ".cs")
path.join(gendir, name, nm .. ".cs"),
path.join(gendir, name, str .. ".cs")
}
vpaths { ["*"] = "*" }
@ -315,16 +258,16 @@ function SetupTestProjectsCLI(name, extraFiles, suffix) @@ -315,16 +258,16 @@ function SetupTestProjectsCLI(name, extraFiles, suffix)
files
{
path.join(gendir, nm .. ".cpp"),
path.join(gendir, nm .. ".h")
path.join(gendir, name, nm .. ".cpp"),
path.join(gendir, name, nm .. ".h")
}
if extraFiles ~= nil then
for _, file in pairs(extraFiles) do
if suffix ~= nil then
file = file .. suffix
end
files { path.join(gendir, file .. ".cpp") }
files { path.join(gendir, file .. ".h") }
files { path.join(gendir, name, file .. ".cpp") }
files { path.join(gendir, name, file .. ".h") }
end
end
vpaths { ["*"] = "*" }

2
src/Generator.Tests/GeneratorTest.cs

@ -26,7 +26,7 @@ namespace CppSharp.Utils @@ -26,7 +26,7 @@ namespace CppSharp.Utils
{
var options = driver.Options;
options.GeneratorKind = kind;
options.OutputDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
options.OutputDir = Path.Combine(GetOutputDirectory(), "gen", name);
options.Quiet = true;
options.GenerateDebugOutput = true;
options.GenerateSequentialLayout = true;

2
tests/NamespacesBase/premake4.lua

@ -8,7 +8,7 @@ function SetupWrapper(name) @@ -8,7 +8,7 @@ function SetupWrapper(name)
files
{
path.join(gendir, name .. ".cs"),
path.join(gendir, "NamespacesDerived", name .. ".cs"),
}
linktable = { "CppSharp.Runtime" }

Loading…
Cancel
Save