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

github.com/windirstat/premake-4.x.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Perkins <starkos@industriousone.com>2011-03-24 00:05:19 +0300
committerJason Perkins <starkos@industriousone.com>2011-03-24 00:05:19 +0300
commitccb5d34c957d8a5d147e89220c596110d25c524e (patch)
treeb5dfc584603bfb1b3ffc683b09381bc5b5c3aec5
parent48fdd10f4d66372e9b01b2c34ba5ccd953201f7d (diff)
parent7b0636f9999f4a4f79fec42b53a6b70db503c6de (diff)
Merged with premake-stable
-rw-r--r--CHANGES.txt3
-rw-r--r--src/actions/vstudio/vs2010_vcxproxj.lua9
-rw-r--r--src/actions/xcode/xcode_common.lua11
-rw-r--r--src/base/configs.lua46
-rw-r--r--src/base/path.lua10
-rw-r--r--tests/actions/vstudio/test_vs2010_flags.lua65
-rw-r--r--tests/actions/xcode/test_xcode_project.lua26
-rw-r--r--tests/base/test_config_bug.lua145
-rw-r--r--tests/base/test_path.lua13
-rw-r--r--tests/premake4.lua3
10 files changed, 306 insertions, 25 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index faddece..176dd04 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -20,6 +20,9 @@
* Bug 3133743: Sets ONLY_ACTIVE_ARCH = YES in Xcode debug builds (James Wynn)
* Properly pass return codes back to shell in release builds
* Bug 3135734: Remove WholeProgramOptimization setting in vs10 (doug)
+* Bug 3138377: Link dependencies ignored within "SharedLib" configuration
+* Bug 3163703: pdb file being set in the wrong section. (hodsondd)
+* Bug 3157645: Full path for xcode frameworks
-------
4.3
diff --git a/src/actions/vstudio/vs2010_vcxproxj.lua b/src/actions/vstudio/vs2010_vcxproxj.lua
index d9e26f5..1c9d0b3 100644
--- a/src/actions/vstudio/vs2010_vcxproxj.lua
+++ b/src/actions/vstudio/vs2010_vcxproxj.lua
@@ -379,6 +379,10 @@
floating_point(cfg)
debug_info(cfg)
+ if cfg.flags.Symbols then
+ _p(3,'<ProgramDataBaseFileName>$(OutDir)%s.pdb</ProgramDataBaseFileName>'
+ , path.getbasename(cfg.buildtarget.name))
+ end
if cfg.flags.NoFramePointer then
_p(3,'<OmitFramePointers>true</OmitFramePointers>')
@@ -457,11 +461,6 @@
_p(3,'<OptimizeReferences>true</OptimizeReferences>')
_p(3,'<EnableCOMDATFolding>true</EnableCOMDATFolding>')
end
-
- if cfg.flags.Symbols then
- _p(3,'<ProgramDataBaseFileName>$(OutDir)%s.pdb</ProgramDataBaseFileName>'
- , path.getbasename(cfg.buildtarget.name))
- end
end
local function item_link(cfg)
diff --git a/src/actions/xcode/xcode_common.lua b/src/actions/xcode/xcode_common.lua
index a569299..5d823a1 100644
--- a/src/actions/xcode/xcode_common.lua
+++ b/src/actions/xcode/xcode_common.lua
@@ -313,8 +313,15 @@
else
local pth, src
if xcode.isframework(node.path) then
- -- I need to figure out how to locate frameworks; this is just to get something working
- pth = "/System/Library/Frameworks/" .. node.path
+ --respect user supplied paths
+ if string.find(node.path,'/') then
+ if string.find(node.path,'^%.')then
+ error('relative paths are not currently supported for frameworks')
+ end
+ pth = node.path
+ else
+ pth = "/System/Library/Frameworks/" .. node.path
+ end
src = "absolute"
else
-- something else; probably a source code file
diff --git a/src/base/configs.lua b/src/base/configs.lua
index 700e54e..60cdf1b 100644
--- a/src/base/configs.lua
+++ b/src/base/configs.lua
@@ -79,7 +79,7 @@
--
function premake.getactiveterms()
- local terms = { _ACTION:lower(), os.get() }
+ local terms = { _action = _ACTION:lower(), os = os.get() }
-- add option keys or values
for key, value in pairs(_OPTIONS) do
@@ -188,10 +188,17 @@
if type(value) == "table" then
-- merge two lists, removing any duplicates along the way
local tbl = dest[field] or { }
- for _, item in ipairs(value) do
- if not tbl[item] then
- table.insert(tbl, item)
- tbl[item] = item
+
+ if field == 'terms' then
+ for term_key,term_value in pairs(value)do
+ tbl[term_key]=term_value
+ end
+ else
+ for _, item in ipairs(value) do
+ if not tbl[item] then
+ table.insert(tbl, item)
+ tbl[item] = item
+ end
end
end
dest[field] = tbl
@@ -242,17 +249,28 @@
adjustpaths(obj.location, cfg)
mergeobject(cfg, obj)
+ -- add `kind` to the filter terms
+ if (cfg.kind) then
+ terms[kind]=cfg.kind:lower()
+ end
+
-- now add in any blocks that match the filter terms
for _, blk in ipairs(obj.blocks) do
- if (premake.iskeywordsmatch(blk.keywords, terms)) then
+ if (premake.iskeywordsmatch(blk.keywords, terms))then
mergeobject(cfg, blk)
+ if (cfg.kind and not cfg.terms.kind) then
+ cfg.terms[kind] = cfg.kind:lower()
+ terms[kind] = cfg.kind:lower()
+ end
end
end
-- package it all up and add it to the result set
cfg.name = cfgname
cfg.platform = pltname
- cfg.terms = terms
+ for k,v in pairs(terms) do
+ cfg.terms[k] =v
+ end
dest[key] = cfg
end
@@ -283,19 +301,17 @@
-- with a matching set of keywords will be included in the merged results
local terms = premake.getactiveterms()
- -- build a project-level configuration. If a target kind is set at this level
- -- then include it into the filter terms
- merge(result, obj, basis, terms)
- if result[""].kind then
- terms.kind = result[""].kind:lower()
- end
+ -- build a project-level configuration.
+ merge(result, obj, basis, terms)--this adjusts terms
-- now build configurations for each build config/platform pair
for _, cfgname in ipairs(sln.configurations) do
- merge(result, obj, basis, terms, cfgname, "Native")
+ local terms_local = {}
+ for k,v in pairs(terms)do terms_local[k]=v end
+ merge(result, obj, basis, terms_local, cfgname, "Native")--terms cam also be adjusted here
for _, pltname in ipairs(sln.platforms or {}) do
if pltname ~= "Native" then
- merge(result, obj, basis, terms, cfgname, pltname)
+ merge(result, obj, basis,terms_local, cfgname, pltname)--terms also here
end
end
end
diff --git a/src/base/path.lua b/src/base/path.lua
index 58e3e3e..aa943e6 100644
--- a/src/base/path.lua
+++ b/src/base/path.lua
@@ -17,7 +17,7 @@
-- if the directory is already absolute I don't need to do anything
local result = iif (path.isabsolute(p), nil, os.getcwd())
-
+
-- split up the supplied relative path and tackle it bit by bit
for n, part in ipairs(p:explode("/", true)) do
if (part == "" and n == 1) then
@@ -25,7 +25,13 @@
elseif (part == "..") then
result = path.getdirectory(result)
elseif (part ~= ".") then
- result = path.join(result, part)
+ -- Environment variables embedded in the path need to be treated
+ -- as relative paths; path.join() makes them absolute
+ if (part:startswith("$") and n > 1) then
+ result = result .. "/" .. part
+ else
+ result = path.join(result, part)
+ end
end
end
diff --git a/tests/actions/vstudio/test_vs2010_flags.lua b/tests/actions/vstudio/test_vs2010_flags.lua
index 0bba6cc..254b7cc 100644
--- a/tests/actions/vstudio/test_vs2010_flags.lua
+++ b/tests/actions/vstudio/test_vs2010_flags.lua
@@ -190,12 +190,77 @@ function vs10_flags.debugYetNotMinimalRebuild_minimalRebuild_setToTrue()
local buffer = get_buffer()
test.string_contains(buffer,'<MinimalRebuild>true</MinimalRebuild>')
end
+<<<<<<< local
function vs10_flags.release_minimalRebuild_setToFalse()
flags {release_string}
local buffer = get_buffer()
test.string_contains(buffer,'<MinimalRebuild>false</MinimalRebuild>')
+=======
+
+function vs10_flags.release_minimalRebuild_setToFalse()
+ flags {release_string}
+
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<MinimalRebuild>false</MinimalRebuild>')
+end
+
+function vs10_flags.mfc_useOfMfc_setToStatic()
+ flags{"MFC"}
+
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<UseOfMfc>Dynamic</UseOfMfc>')
+end
+
+function vs10_flags.Symbols_DebugInformationFormat_setToEditAndContinue()
+ flags{"Symbols"}
+
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<DebugInformationFormat>EditAndContinue</DebugInformationFormat>')
+end
+
+function vs10_flags.symbolsAndNoEditAndContinue_DebugInformationFormat_setToProgramDatabase()
+ flags{"Symbols","NoEditAndContinue"}
+
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>')
+end
+
+function vs10_flags.symbolsAndRelease_DebugInformationFormat_setToProgramDatabase()
+ flags{"Symbols",release_string}
+
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>')
+end
+function vs10_flags.noSymbols_DebugInformationFormat_blockIsEmpty()
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<DebugInformationFormat></DebugInformationFormat>')
+end
+
+function vs10_flags.symbols_64BitBuild_DebugInformationFormat_setToOldStyle()
+ flags{"Symbols"}
+ platforms{"x64"}
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<DebugInformationFormat>OldStyle</DebugInformationFormat>')
+end
+
+function vs10_flags.noManifest_GenerateManifest_setToFalse()
+ flags{"NoManifest"}
+
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<GenerateManifest Condition="\'%$%(Configuration%)|%$%(Platform%)\'==\'Debug|Win32\'">false</GenerateManifest>')
+end
+
+function vs10_flags.noSymbols_bufferDoesNotContainprogramDataBaseFile()
+ local buffer = get_buffer()
+ test.string_does_not_contain(buffer,'<Link>.*<ProgramDataBaseFileName>.*</Link>')
+end
+function vs10_flags.symbols_bufferContainsprogramDataBaseFile()
+ flags{"Symbols"}
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<ClCompile>.*<ProgramDataBaseFileName>%$%(OutDir%)MyProject%.pdb</ProgramDataBaseFileName>.*</ClCompile>')
+>>>>>>> other
end
function vs10_flags.mfc_useOfMfc_setToStatic()
diff --git a/tests/actions/xcode/test_xcode_project.lua b/tests/actions/xcode/test_xcode_project.lua
index 9037ee2..392e699 100644
--- a/tests/actions/xcode/test_xcode_project.lua
+++ b/tests/actions/xcode/test_xcode_project.lua
@@ -176,6 +176,32 @@
[Cocoa.framework] /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "Cocoa.framework"; path = "/System/Library/Frameworks/Cocoa.framework"; sourceTree = "<absolute>"; };
]]
end
+
+
+ function suite.PBXFileReference_leavesFrameWorkLocationsAsIsWhenSupplied_pathIsSetToInput()
+ local inputFrameWork = 'somedir/Foo.framework'
+ links(inputFrameWork)
+ prepare()
+
+ io.capture()
+ xcode.PBXFileReference(tr)
+ local buffer = io.endcapture()
+
+ test.string_contains(buffer,'path = "'..inputFrameWork..'"')
+ end
+
+
+ function suite.PBXFileReference_relativeFrameworkPathSupplied_callsError()
+ local inputFrameWork = '../somedir/Foo.framework'
+ links(inputFrameWork)
+ prepare()
+ local error_called = false
+ local old_error = error
+ error = function( ... )error_called = true end
+ xcode.PBXFileReference(tr)
+ error = old_error
+ test.istrue(error_called)
+ end
function suite.PBXFileReference_ListsIconFiles()
files { "Icon.icns" }
diff --git a/tests/base/test_config_bug.lua b/tests/base/test_config_bug.lua
new file mode 100644
index 0000000..5ef79e1
--- /dev/null
+++ b/tests/base/test_config_bug.lua
@@ -0,0 +1,145 @@
+ T.config_bug_report = { }
+ local config_bug = T.config_bug_report
+ local vs10_helpers = premake.vstudio.vs10_helpers
+
+ local sln, prjA,prjB,prjC,prjD
+ function config_bug.teardown()
+ sln = nil
+ prjA = nil
+ prjB = nil
+ prjC = nil
+ prjD = nil
+ end
+
+ function config_bug.setup()
+ end
+
+
+
+ local config_bug_updated = function ()
+
+ local setCommonLibraryConfig = function()
+ configuration "Debug or Release"
+ kind "StaticLib"
+
+ configuration "DebugDLL or ReleaseDLL"
+ kind "SharedLib"
+ end
+
+ sln = solution "Test"
+ configurations { "Debug", "Release", "DebugDLL", "ReleaseDLL" }
+ language "C++"
+
+ prjA = project "A"
+ files { "a.cpp" }
+ setCommonLibraryConfig()
+ prjB = project "B"
+ files { "b.cpp" }
+ setCommonLibraryConfig()
+ configuration "SharedLib"
+ links { "A" }
+ prjC = project "C"
+ files { "c.cpp" }
+ setCommonLibraryConfig()
+ configuration "SharedLib"
+ links { "A", "B" }
+ prjD = project "Executable"
+ kind "WindowedApp"
+ links { "A", "B", "C" }
+
+ end
+
+ local kindSetOnConfiguration_and_linkSetOnSharedLibProjB = function (config_kind)
+ sln = solution "DontCare"
+ configurations { "DebugDLL"}
+
+ configuration "DebugDLL"
+ kind(config_kind)
+ prjA = project "A"
+ prjB = project "B"
+ configuration { config_kind }
+ links { "A" }
+ end
+
+ local sharedLibKindSetOnProject_and_linkSetOnSharedLibProjB = function ()
+ sln = solution "DontCare"
+ configurations { "DebugDLL" }
+ project "A"
+ prjB = project "B"
+ configuration "DebugDLL"
+ kind "SharedLib"
+ configuration "SharedLib"
+ links { "A" }
+ defines {"defineSet"}
+
+ end
+
+
+ function kind_set_on_project_config_block()
+ sln = solution "DontCare"
+ configurations { "DebugDLL" }
+ local A = project "A"
+ configuration "DebugDLL"
+ kind "SharedLib"
+ defines {"defineSet"}
+ return A
+ end
+
+
+ function config_bug.bugUpdated_prjBLinksContainsA()
+ config_bug_updated()
+ premake.buildconfigs()
+ local conf = premake.getconfig(prjB,"DebugDLL","Native")
+ test.isnotnil(conf.links.A)
+ end
+
+
+ function config_bug.kindSetOnProjectConfigBlock_projKindEqualsSharedLib()
+ local proj = kind_set_on_project_config_block()
+ premake.buildconfigs()
+ local conf = premake.getconfig(proj,"DebugDLL","Native")
+ test.isequal("SharedLib",conf.kind)
+ end
+
+ function config_bug.defineSetOnProjectConfigBlock_projDefineSetIsNotNil()
+ local proj = kind_set_on_project_config_block()
+ premake.buildconfigs()
+ local conf = premake.getconfig(proj,"DebugDLL","Native")
+ test.isnotnil(conf.defines.defineSet)
+ end
+
+ function config_bug.defineSetInBlockInsideProject ()
+ sharedLibKindSetOnProject_and_linkSetOnSharedLibProjB()
+ premake.buildconfigs()
+ local conf = premake.getconfig(prjB,"DebugDLL","Native")
+ test.isnotnil(conf.defines.defineSet)
+ end
+
+
+ function config_bug.whenKindSetOnProject_PrjBLinksContainsA()
+ sharedLibKindSetOnProject_and_linkSetOnSharedLibProjB()
+ premake.buildconfigs()
+ local conf = premake.getconfig(prjB,"DebugDLL","Native")
+ test.isnotnil(conf.links.A)
+ end
+
+
+
+
+
+ function config_bug.whenKindSetOnConfiguration_prjBLinksContainsA_StaticLib()
+-- sharedLibKindSetOnConfiguration_and_linkSetOnSharedLibProjB()
+ kindSetOnConfiguration_and_linkSetOnSharedLibProjB("StaticLib")
+ premake.buildconfigs()
+ local config = premake.getconfig(prjB,"DebugDLL","Native")
+ test.isnotnil(config.links.A)
+ end
+
+ function config_bug.whenKindSetOnConfiguration_prjBLinksContainsA()
+-- sharedLibKindSetOnConfiguration_and_linkSetOnSharedLibProjB()
+ kindSetOnConfiguration_and_linkSetOnSharedLibProjB("SharedLib")
+ premake.buildconfigs()
+ local config = premake.getconfig(prjB,"DebugDLL","Native")
+ test.isnotnil(config.links.A)
+ end
+ \ No newline at end of file
diff --git a/tests/base/test_path.lua b/tests/base/test_path.lua
index 50126d5..19b212c 100644
--- a/tests/base/test_path.lua
+++ b/tests/base/test_path.lua
@@ -30,6 +30,19 @@
test.isequal(expected, path.getabsolute("a/b/c/"))
end
+ function suite.getabsolute_OnLeadingEnvVar()
+ test.isequal("$(HOME)/user", path.getabsolute("$(HOME)/user"))
+ end
+
+ function suite.getabsolute_OnMultipleEnvVar()
+ test.isequal("$(HOME)/$(USER)", path.getabsolute("$(HOME)/$(USER)"))
+ end
+
+ function suite.getabsolute_OnTrailingEnvVar()
+ local expected = path.translate(os.getcwd(), "/") .. "/home/$(USER)"
+ test.isequal(expected, path.getabsolute("home/$(USER)"))
+ end
+
--
-- path.getbasename() tests
diff --git a/tests/premake4.lua b/tests/premake4.lua
index 13c060a..09c7b65 100644
--- a/tests/premake4.lua
+++ b/tests/premake4.lua
@@ -55,7 +55,8 @@
dofile("base/test_table.lua")
dofile("base/test_tree.lua")
dofile("tools/test_gcc.lua")
-
+ dofile("base/test_config_bug.lua")
+
-- Clean tests
dofile("actions/test_clean.lua")