Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/premake-4.x-stable.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstarkos <none@none>2009-07-13 23:10:27 +0400
committerstarkos <none@none>2009-07-13 23:10:27 +0400
commit020bb4726bfff0572d66d3135e9601a61a8df198 (patch)
tree3e2c761a469a8b9e580ae9ada55dc021840b53bc
parent7f7a7aec0d67da79b4cdffca7063c1f10a3dcafa (diff)
Bug 2819232: Buildoptions not used when creating Makefile for C#
-rw-r--r--CHANGES.txt1
-rw-r--r--samples/project/CsConsoleApp/premake4.lua4
-rw-r--r--samples/project/premake4.lua4
-rw-r--r--src/actions/make/_make.lua1
-rw-r--r--src/actions/make/make_csharp.lua71
-rw-r--r--tests/premake4.lua3
-rw-r--r--tests/test_gmake_cs.lua80
7 files changed, 130 insertions, 34 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index f8b276d..2707ff2 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -11,6 +11,7 @@
- Use libtool instead of ar for Mac OS X Universal static libraries
- Fixed Xbox 360 linker settings in Visual Studio
+- Bug 2819232: Buildoptions not used when creating Makefile for C#
- Bug 2813297: OS X universal config should be "univ" (William Burnson)
- Bug 2814179: Xbox 360 precompiled headers not working
diff --git a/samples/project/CsConsoleApp/premake4.lua b/samples/project/CsConsoleApp/premake4.lua
index edc6271..4b6fe91 100644
--- a/samples/project/CsConsoleApp/premake4.lua
+++ b/samples/project/CsConsoleApp/premake4.lua
@@ -7,6 +7,8 @@ project "CsConsoleApp"
libdirs { "../lib" }
links { "CsSharedLib", "CppSharedLib", "System" }
-
+
+ buildoptions { "/define:TEST" }
+
configuration "*.bmp"
buildaction "Embed"
diff --git a/samples/project/premake4.lua b/samples/project/premake4.lua
index a04e981..e543803 100644
--- a/samples/project/premake4.lua
+++ b/samples/project/premake4.lua
@@ -22,8 +22,8 @@ solution "PremakeTestbox"
include "CppStaticLib"
if _ACTION ~= "codeblocks" and _ACTION ~= "codelite" then
--- include "CsSharedLib"
--- include "CsConsoleApp"
+ include "CsSharedLib"
+ include "CsConsoleApp"
end
diff --git a/src/actions/make/_make.lua b/src/actions/make/_make.lua
index e41674c..29262d8 100644
--- a/src/actions/make/_make.lua
+++ b/src/actions/make/_make.lua
@@ -19,6 +19,7 @@
end
return result
else
+ if not value then print(debug.traceback()) end
local result
result = value:gsub("\\", "\\\\")
result = result:gsub(" ", "\\ ")
diff --git a/src/actions/make/make_csharp.lua b/src/actions/make/make_csharp.lua
index ca177de..6e928b8 100644
--- a/src/actions/make/make_csharp.lua
+++ b/src/actions/make/make_csharp.lua
@@ -114,36 +114,7 @@
-- write the configuration blocks
for cfg in premake.eachconfig(prj) do
- _p('ifneq (,$(findstring %s,$(config)))', _MAKE.esc(cfg.name:lower()))
- _p(' TARGETDIR := %s', _MAKE.esc(cfg.buildtarget.directory))
- _p(' OBJDIR := %s', _MAKE.esc(cfg.objectsdir))
- _p(' DEPENDS := %s', table.concat(_MAKE.esc(premake.getlinks(cfg, "dependencies", "fullpath")), " "))
- _p(' REFERENCES := %s', table.implode(_MAKE.esc(cfglibs[cfg]), "/r:", "", " "))
- _p(' FLAGS += %s %s', table.concat(csc.getflags(cfg), " "), table.implode(cfg.defines, "/d:", "", " "))
-
- _p(' define PREBUILDCMDS')
- if #cfg.prebuildcommands > 0 then
- _p('\t@echo Running pre-build commands')
- _p('\t%s', table.implode(cfg.prebuildcommands, "", "", "\n\t"))
- end
- _p(' endef')
-
- _p(' define PRELINKCMDS')
- if #cfg.prelinkcommands > 0 then
- _p('\t@echo Running pre-link commands')
- _p('\t%s', table.implode(cfg.prelinkcommands, "", "", "\n\t"))
- end
- _p(' endef')
-
- _p(' define POSTBUILDCMDS')
- if #cfg.postbuildcommands > 0 then
- _p('\t@echo Running post-build commands')
- _p('\t%s', table.implode(cfg.postbuildcommands, "", "", "\n\t"))
- end
- _p(' endef')
-
- _p('endif')
- _p('')
+ premake.gmake_cs_config(cfg, csc, cfglibs)
end
-- set project level values
@@ -258,3 +229,43 @@
end
end
+
+
+--
+-- Write a block of configuration settings.
+--
+
+ function premake.gmake_cs_config(cfg, csc, cfglibs)
+
+ _p('ifneq (,$(findstring %s,$(config)))', _MAKE.esc(cfg.name:lower()))
+ _p(' TARGETDIR := %s', _MAKE.esc(cfg.buildtarget.directory))
+ _p(' OBJDIR := %s', _MAKE.esc(cfg.objectsdir))
+ _p(' DEPENDS := %s', table.concat(_MAKE.esc(premake.getlinks(cfg, "dependencies", "fullpath")), " "))
+ _p(' REFERENCES := %s', table.implode(_MAKE.esc(cfglibs[cfg]), "/r:", "", " "))
+ _p(' FLAGS += %s %s', table.implode(cfg.defines, "/d:", "", " "), table.concat(table.join(csc.getflags(cfg), cfg.buildoptions), " "))
+
+ _p(' define PREBUILDCMDS')
+ if #cfg.prebuildcommands > 0 then
+ _p('\t@echo Running pre-build commands')
+ _p('\t%s', table.implode(cfg.prebuildcommands, "", "", "\n\t"))
+ end
+ _p(' endef')
+
+ _p(' define PRELINKCMDS')
+ if #cfg.prelinkcommands > 0 then
+ _p('\t@echo Running pre-link commands')
+ _p('\t%s', table.implode(cfg.prelinkcommands, "", "", "\n\t"))
+ end
+ _p(' endef')
+
+ _p(' define POSTBUILDCMDS')
+ if #cfg.postbuildcommands > 0 then
+ _p('\t@echo Running post-build commands')
+ _p('\t%s', table.implode(cfg.postbuildcommands, "", "", "\n\t"))
+ end
+ _p(' endef')
+
+ _p('endif')
+ _p('')
+
+ end
diff --git a/tests/premake4.lua b/tests/premake4.lua
index a82ccdf..aab750f 100644
--- a/tests/premake4.lua
+++ b/tests/premake4.lua
@@ -1,7 +1,7 @@
--
-- tests/premake4.lua
-- Automated test suite for Premake 4.x
--- Copyright (c) 2008, 2009 Jason Perkins and the Premake project
+-- Copyright (c) 2008-2009 Jason Perkins and the Premake project
--
dofile("testfx.lua")
@@ -24,6 +24,7 @@
dofile("test_vs2008_sln.lua")
dofile("test_vs200x_vcproj.lua")
dofile("test_gmake_cpp.lua")
+ dofile("test_gmake_cs.lua")
--
diff --git a/tests/test_gmake_cs.lua b/tests/test_gmake_cs.lua
new file mode 100644
index 0000000..37683fb
--- /dev/null
+++ b/tests/test_gmake_cs.lua
@@ -0,0 +1,80 @@
+--
+-- tests/test_gmake_cs.lua
+-- Automated test suite for GNU Make C/C++ project generation.
+-- Copyright (c) 2009 Jason Perkins and the Premake project
+--
+
+ T.gmake_cs = { }
+
+--
+-- Configure a solution for testing
+--
+
+ local sln, prj
+ function T.gmake_cs.setup()
+ _ACTION = "gmake"
+ _OPTIONS.os = "linux"
+
+ sln = solution "MySolution"
+ configurations { "Debug", "Release" }
+ platforms { "native" }
+
+ prj = project "MyProject"
+ language "C#"
+ kind "ConsoleApp"
+ end
+
+ local function prepare()
+ io.capture()
+ premake.buildconfigs()
+ end
+
+
+
+--
+-- Test configuration blocks
+--
+
+ function T.gmake_cs.BasicCfgBlock()
+ prepare()
+ local cfg = premake.getconfig(prj, "Debug")
+ premake.gmake_cs_config(cfg, premake.dotnet, {[cfg]={}})
+ test.capture [[
+ifneq (,$(findstring debug,$(config)))
+ TARGETDIR := .
+ OBJDIR := obj/Debug
+ DEPENDS :=
+ REFERENCES :=
+ FLAGS +=
+ define PREBUILDCMDS
+ endef
+ define PRELINKCMDS
+ endef
+ define POSTBUILDCMDS
+ endef
+endif
+ ]]
+ end
+
+
+ function T.gmake_cs.OnBuildOptions()
+ buildoptions { "/define:SYMBOL" }
+ prepare()
+ local cfg = premake.getconfig(prj, "Debug")
+ premake.gmake_cs_config(cfg, premake.dotnet, {[cfg]={}})
+ test.capture [[
+ifneq (,$(findstring debug,$(config)))
+ TARGETDIR := .
+ OBJDIR := obj/Debug
+ DEPENDS :=
+ REFERENCES :=
+ FLAGS += /define:SYMBOL
+ define PREBUILDCMDS
+ endef
+ define PRELINKCMDS
+ endef
+ define POSTBUILDCMDS
+ endef
+endif
+ ]]
+ end