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:
-rw-r--r--samples/project/premake4.lua4
-rw-r--r--src/actions/make/make_cpp.lua11
-rw-r--r--src/actions/make/make_solution.lua19
-rw-r--r--src/base/api.lua8
-rw-r--r--src/tools/gcc.lua18
-rw-r--r--src/tools/ow.lua1
-rw-r--r--tests/test_configs.lua25
7 files changed, 48 insertions, 38 deletions
diff --git a/samples/project/premake4.lua b/samples/project/premake4.lua
index 49dff2a..1f39818 100644
--- a/samples/project/premake4.lua
+++ b/samples/project/premake4.lua
@@ -1,6 +1,6 @@
solution "PremakeTestbox"
configurations { "Debug", "Release" }
- platforms { "x32", "xbox360" }
+ platforms { "native", "x64", "xbox360" }
objdir "obj"
@@ -27,7 +27,7 @@ solution "PremakeTestbox"
include "CppSharedLib"
include "CppStaticLib"
- if _ACTION ~= "codeblocks" then
+ if _ACTION ~= "codeblocks" and _ACTION ~= "codelite" then
include "CsSharedLib"
include "CsConsoleApp"
end
diff --git a/src/actions/make/make_cpp.lua b/src/actions/make/make_cpp.lua
index eda93bb..e5a9ac6 100644
--- a/src/actions/make/make_cpp.lua
+++ b/src/actions/make/make_cpp.lua
@@ -8,12 +8,15 @@
-- create a shortcut to the compiler interface
local cc = premake[_OPTIONS.cc]
+ -- build a list of supported target platforms that also includes a generic build
+ local platforms = premake.filterplatforms(prj.solution, cc.platforms)
+
-- write a quick header
_p('# %s project makefile autogenerated by Premake', premake.actions[_ACTION].shortname)
-- set up the environment
_p('ifndef config')
- _p(' config=%s', _MAKE.esc(prj.configurations[1]:lower()))
+ _p(' config=%s%s', _MAKE.esc(prj.configurations[1]:lower()), cc.platforms[platforms[1]].suffix)
_p('endif')
_p('')
@@ -22,14 +25,10 @@
_p('endif')
_p('')
- -- build a list of supported target platforms that also includes a generic build
- local platforms = premake.filterplatforms(prj.solution, cc.platforms)
- table.insert(platforms, 1, "")
-
-- list the configurations
for _, platform in ipairs(platforms) do
for cfg in premake.eachconfig(prj, platform) do
- _p('ifeq ($(config),%s)', table.concat({ _MAKE.esc(cfg.name:lower()), cfg.platform}, ":"))
+ _p('ifeq ($(config),%s%s)', _MAKE.esc(cfg.name:lower()), cc.platforms[platform].suffix)
_p(' TARGETDIR = %s', _MAKE.esc(cfg.buildtarget.directory))
_p(' TARGET = $(TARGETDIR)/%s', _MAKE.esc(cfg.buildtarget.name))
_p(' OBJDIR = %s', _MAKE.esc(cfg.objectsdir))
diff --git a/src/actions/make/make_solution.lua b/src/actions/make/make_solution.lua
index 8c9af4a..56e525e 100644
--- a/src/actions/make/make_solution.lua
+++ b/src/actions/make/make_solution.lua
@@ -8,15 +8,24 @@
-- create a shortcut to the compiler interface
local cc = premake[_OPTIONS.cc]
+ -- build a list of supported target platforms that also includes a generic build
+ local platforms = premake.filterplatforms(sln, cc.platforms)
+
-- write a header showing the build options
+ local cfgpairs = { }
+ for _, platform in ipairs(platforms) do
+ for _, cfg in ipairs(sln.configurations) do
+ table.insert(cfgpairs, cfg .. cc.platforms[platform].suffix)
+ end
+ end
_p('# %s solution makefile autogenerated by Premake', premake.actions[_ACTION].shortname)
_p('# Usage: make [ config=config_name ]')
- _p('# Where {config_name} is one of: %s.', table.implode(sln.configurations, '"', '"', ', '):lower())
+ _p('# Where {config_name} is one of: %s.', table.implode(cfgpairs, '"', '"', ', '):lower())
_p('')
-- set a default configuration
_p('ifndef config')
- _p(' config=%s', _MAKE.esc(sln.configurations[1]:lower()))
+ _p(' config=%s%s', _MAKE.esc(sln.configurations[1]:lower()), cc.platforms[platforms[1]].suffix)
_p('endif')
_p('export config')
_p('')
@@ -29,10 +38,6 @@
_p('all: $(PROJECTS)')
_p('')
- -- build a list of supported target platforms that also includes a generic build
- local platforms = premake.filterplatforms(sln, cc.platforms)
- table.insert(platforms, 1, "")
-
-- write the project build rules
for _, prj in ipairs(sln.projects) do
@@ -40,7 +45,7 @@
-- these dependencies change, the project needs to be rebuilt
for _, platform in ipairs(platforms) do
for cfg in premake.eachconfig(prj, platform) do
- _p('ifeq ($(config),%s)', table.concat({ _MAKE.esc(cfg.name:lower()), cfg.platform}, ":"))
+ _p('ifeq ($(config),%s%s)', _MAKE.esc(cfg.name:lower()), cc.platforms[platform].suffix)
_p(' DEPENDENCIES := %s', table.concat(_MAKE.esc(table.extract(premake.getdependencies(cfg), "name")), " "))
_p('endif')
end
diff --git a/src/base/api.lua b/src/base/api.lua
index 697ff83..14d71a1 100644
--- a/src/base/api.lua
+++ b/src/base/api.lua
@@ -199,11 +199,13 @@
kind = "list",
scope = "solution",
allowed = {
+ "Native",
"x32",
"x64",
- "ppc",
- "ppc64",
- "xbox360"
+ "Universal",
+ "Universal32",
+ "Universal64",
+ "Xbox360"
}
},
diff --git a/src/tools/gcc.lua b/src/tools/gcc.lua
index ad82fb6..25265ee 100644
--- a/src/tools/gcc.lua
+++ b/src/tools/gcc.lua
@@ -32,15 +32,17 @@
--
--- Support platforms, mapped to GCC architectures
+-- Support platforms, mapped to build configuration suffix
--
premake.gcc.platforms =
{
- x32 = "i386",
- x64 = "x64_86",
- ppc = "ppc",
- ppc64 = "ppc64",
+ Native = { suffix="", cflags="" },
+ x32 = { suffix="32", cflags="-m32" },
+ x64 = { suffix="64", cflags="-m64" },
+ Universal = { suffix="univ", cflags="-arch i386 -arch x64_64 -arch ppc -arch ppc64" },
+ Universal32 = { suffix="univ32", cflags="-arch i386 -arch ppc" },
+ Universal64 = { suffix="univ64", cflags="-arch x64_64 -arch ppc64" },
}
@@ -60,6 +62,7 @@
if (cfg.kind == "SharedLib" and not os.is("windows")) then
table.insert(result, "-fPIC")
end
+ table.insert(result, premake.gcc.platforms[cfg.platform].cflags)
return result
end
@@ -93,7 +96,7 @@
if (os.is("windows") and cfg.kind == "WindowedApp") then
table.insert(result, "-mwindows")
end
-
+
-- OS X has a bug, see http://lists.apple.com/archives/Darwin-dev/2006/Sep/msg00084.html
if (not cfg.flags.Symbols) then
if (os.is("macosx")) then
@@ -102,7 +105,8 @@
table.insert(result, "-s")
end
end
-
+
+ table.insert(result, premake.gcc.platforms[cfg.platform].cflags)
return result
end
diff --git a/src/tools/ow.lua b/src/tools/ow.lua
index 279e750..4f1e8f5 100644
--- a/src/tools/ow.lua
+++ b/src/tools/ow.lua
@@ -36,6 +36,7 @@
premake.ow.platforms =
{
+ Native = { suffix="", cflags="" },
}
diff --git a/tests/test_configs.lua b/tests/test_configs.lua
index 0d9406d..70a5e26 100644
--- a/tests/test_configs.lua
+++ b/tests/test_configs.lua
@@ -34,27 +34,26 @@
end
---
--- Make sure that values only get applied to the right configurations.
---
-
function T.configs.RootValues()
- local cfg = premake.getconfig(prj).defines
- test.istrue(#cfg == 1 and cfg[1] == "GLOBAL") -- maybe table.compare instead?
+ local r = premake.getconfig(prj).defines
+ test.isequal("GLOBAL", table.concat(r,":"))
end
+
function T.configs.ConfigValues()
- local cfg = premake.getconfig(prj, "Debug").defines
- test.istrue(#cfg == 2 and cfg[1] == "GLOBAL" and cfg[2] == "DEBUG")
+ local r = premake.getconfig(prj, "Debug").defines
+ test.isequal("GLOBAL:DEBUG", table.concat(r,":"))
end
+
function T.configs.PlatformValues()
- local cfg = premake.getconfig(prj, "Debug", "x32").defines
- test.istrue(#cfg == 3 and cfg[1] == "GLOBAL" and cfg[2] == "DEBUG" and cfg[3] == "X86_32")
+ local r = premake.getconfig(prj, "Debug", "x32").defines
+ test.isequal("GLOBAL:DEBUG:X86_32", table.concat(r,":"))
end
- function T.configs.DefaultPlaformNotInSolution()
- local cfg = premake.getconfig(prj, "Debug", "xbox360").defines
- test.isequal("GLOBAL:DEBUG", table.concat(cfg, ":"))
+
+ function T.configs.PlaformNotInSolution()
+ local r = premake.getconfig(prj, "Debug", "xbox360").defines
+ test.isequal("GLOBAL", table.concat(cfg, ":"))
end