diff -r fc0374a03b17 premake4.lua
--- a/premake4.lua	Tue Jan 04 06:23:26 2011 -0500
+++ b/premake4.lua	Mon Jun 11 22:44:58 2012 +0200
@@ -49,9 +49,13 @@
 		configuration "vs*"
 			defines     { "_CRT_SECURE_NO_WARNINGS" }
 
+		configuration "bsd"
+			defines     { "LUA_USE_POSIX", "LUA_USE_DLOPEN" }
+			links       { "m" }
+			
 		configuration "linux"
 			defines     { "LUA_USE_POSIX", "LUA_USE_DLOPEN" }
-			links       { "m", "dl" } 
+			links       { "m", "dl" }
 			
 		configuration "macosx"
 			defines     { "LUA_USE_MACOSX" }
diff -r fc0374a03b17 src/actions/codeblocks/codeblocks_cbp.lua
--- a/src/actions/codeblocks/codeblocks_cbp.lua	Tue Jan 04 06:23:26 2011 -0500
+++ b/src/actions/codeblocks/codeblocks_cbp.lua	Mon Jun 11 22:44:58 2012 +0200
@@ -34,6 +34,7 @@
 				
 				_p(4,'<Option output="%s" prefix_auto="0" extension_auto="0" />', premake.esc(cfg.buildtarget.fullpath))
 				_p(4,'<Option object_output="%s" />', premake.esc(cfg.objectsdir))
+				_p(4,'<Option external_deps="%s" />', table.concat(premake.getlinks(cfg, "siblings", "fullpath"),";"))
 
 				-- identify the type of binary
 				local types = { WindowedApp = 0, ConsoleApp = 1, StaticLib = 2, SharedLib = 3 }
@@ -63,13 +64,18 @@
 				
 				-- begin linker block --
 				_p(4,'<Linker>')
+				_p(5,'<Add option="-Wl,--start-group" />')
+				for _,v in ipairs(premake.getlinks(cfg, "siblings", "fullpath")) do
+					_p(5,'<Add option="%s" />', premake.esc(v))
+				end
+				_p(5,'<Add option="-Wl,--end-group" />')
 				for _,flag in ipairs(table.join(cc.getldflags(cfg), cfg.linkoptions)) do
 					_p(5,'<Add option="%s" />', premake.esc(flag))
 				end
 				for _,v in ipairs(premake.getlinks(cfg, "all", "directory")) do
 					_p(5,'<Add directory="%s" />', premake.esc(v))
 				end
-				for _,v in ipairs(premake.getlinks(cfg, "all", "basename")) do
+				for _,v in ipairs(premake.getlinks(cfg, "system", "basename")) do
 					_p(5,'<Add library="%s" />', premake.esc(v))
 				end
 				_p(4,'</Linker>')
diff -r fc0374a03b17 src/actions/make/make_cpp.lua
--- a/src/actions/make/make_cpp.lua	Tue Jan 04 06:23:26 2011 -0500
+++ b/src/actions/make/make_cpp.lua	Mon Jun 11 22:44:58 2012 +0200
@@ -26,7 +26,7 @@
 		-- list intermediate files
 		_p('OBJECTS := \\')
 		for _, file in ipairs(prj.files) do
-			if path.iscppfile(file) then
+			if path.iscppfile(file) or path.getextension(file) == ".asm" then
 				_p('\t$(OBJDIR)/%s.o \\', _MAKE.esc(path.getbasename(file)))
 			end
 		end
@@ -55,15 +55,15 @@
 		_p('')
 
 		if os.is("MacOSX") and prj.kind == "WindowedApp" then
-			_p('all: $(TARGETDIR) $(OBJDIR) prebuild prelink $(TARGET) $(dir $(TARGETDIR))PkgInfo $(dir $(TARGETDIR))Info.plist')
+			_p('all: $(TARGET) $(dir $(TARGETDIR))PkgInfo $(dir $(TARGETDIR))Info.plist')
 		else
-			_p('all: $(TARGETDIR) $(OBJDIR) prebuild prelink $(TARGET)')
+			_p('all: $(TARGET)')
 		end
 		_p('\t@:')
 		_p('')
 
 		-- target build rule
-		_p('$(TARGET): $(GCH) $(OBJECTS) $(LDDEPS) $(RESOURCES)')
+		_p('$(TARGET): $(OBJECTS) $(LDDEPS) $(RESOURCES) | prelink')
 		_p('\t@echo Linking %s', prj.name)
 		_p('\t$(SILENT) $(LINKCMD)')
 		_p('\t$(POSTBUILDCMDS)')
@@ -97,7 +97,7 @@
 		_p('')
 
 		-- custom build step targets
-		_p('prebuild:')
+		_p('prebuild: $(TARGETDIR) $(OBJDIR)')
 		_p('\t$(PREBUILDCMDS)')
 		_p('')
 		
@@ -108,26 +108,82 @@
 		-- precompiler header rule
 		_.pchrules(prj)
 				
-		-- per-file rules
-		for _, file in ipairs(prj.files) do
-			if path.iscppfile(file) then
+		-- per-file rules
+		for _, file in ipairs(prj.files) do
+			if path.iscppfile(file) then
+				-- Don't use PCH for Obj-C/C++ files (we could but we'd have to compile them separately
+				-- and there's no advantage to that yet)
+				local gchobj = '$(GCH)'
+				local pchincludes = '$(PCHINCLUDES)'
+				if (path.getextension(file) == ".mm" or path.getextension(file) == ".m") then
+					gchobj = ''
+					pchincludes = ''
+				end
+
+				_p('$(OBJDIR)/%s.o: %s %s | prebuild', _MAKE.esc(path.getbasename(file)), _MAKE.esc(file), gchobj)
+				_p('\t@echo $(notdir $<)')
+				if (path.iscfile(file)) then
+					_p('\t$(SILENT) $(CC) %s $(CFLAGS) -MF $(OBJDIR)/%s.d -MT "$@" -o "$@" -c "$<"', pchincludes, _MAKE.esc(path.getbasename(file)))
+				else
+					_p('\t$(SILENT) $(CXX) %s $(CXXFLAGS) -MF $(OBJDIR)/%s.d -MT "$@" -o "$@" -c "$<"', pchincludes, _MAKE.esc(path.getbasename(file)))
+				end
+			elseif (path.getextension(file) == ".rc") then
+				_p('$(OBJDIR)/%s.res: %s', _MAKE.esc(path.getbasename(file)), _MAKE.esc(file))
+				_p('\t@echo $(notdir $<)')
+				_p('\t$(SILENT) windres $< -O coff -o "$@" $(RESFLAGS)')
+			elseif (path.getextension(file) == ".asm") then
 				_p('$(OBJDIR)/%s.o: %s', _MAKE.esc(path.getbasename(file)), _MAKE.esc(file))
 				_p('\t@echo $(notdir $<)')
-				if (path.iscfile(file)) then
-					_p('\t$(SILENT) $(CC) $(CFLAGS) -o "$@" -c "$<"')
+
+				local opts = ''
+				if os.is('windows') then
+					opts = ''
+				elseif os.is('macosx') then
+					opts = '-D OS_UNIX=1'
 				else
-					_p('\t$(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -c "$<"')
+					opts = '-D DONT_USE_UNDERLINE=1 -D OS_UNIX=1'
 				end
-			elseif (path.getextension(file) == ".rc") then
-				_p('$(OBJDIR)/%s.res: %s', _MAKE.esc(path.getbasename(file)), _MAKE.esc(file))
+
+				if not (prj.solution.nasmpath) then
+					prj.solution.nasmpath = 'nasm'				
+				end
+
+				_p('\t$(SILENT)'.._MAKE.esc(prj.solution.nasmpath)..' '..opts..' -i'.._MAKE.esc(path.getdirectory(file))..'/'..' -f '..
+				   _MAKE.esc(prj.solution.nasmformat)..' -o $@ $<\n\t')
+
+				_p('\t$(SILENT)'.._MAKE.esc(prj.solution.nasmpath)..' '..opts..' -i'.._MAKE.esc(path.getdirectory(file))..'/'..
+				   ' -M -o $@ $< >$(OBJDIR)/$(<F:%%.asm=%%.d)\n')
+			end
+			
+		end
+		_p('')		
+
+		-- output for test-generation
+		-- test generation only works if all required parameters are set!
+		if(prj.cxxtestpath and prj.cxxtestrootfile and prj.cxxtesthdrfiles and prj.cxxtestsrcfiles) then
+			if not(prj.cxxtestrootoptions) then
+				prj.cxxtestrootoptions = ''
+			end
+			if not(prj.cxxtestoptions) then 
+				prj.cxxtestoptions = ''
+			end
+
+			_p(prj.cxxtestrootfile..': ')
+			_p('\t@echo $(notdir $<)')
+			_p('\t$(SILENT)'.._MAKE.esc(prj.cxxtestpath)..' --root '..prj.cxxtestrootoptions..' -o '.._MAKE.esc(prj.cxxtestrootfile))	
+			_p('')	
+	
+			for i, file in ipairs(prj.cxxtesthdrfiles) do
+				_p('%s: %s', _MAKE.esc(prj.cxxtestsrcfiles[i]), _MAKE.esc(file))
 				_p('\t@echo $(notdir $<)')
-				_p('\t$(SILENT) windres $< -O coff -o "$@" $(RESFLAGS)')
+				_p('\t$(SILENT)'.._MAKE.esc(prj.cxxtestpath)..' --part '..prj.cxxtestoptions..' -o ' .._MAKE.esc(prj.cxxtestsrcfiles[i])..' '.._MAKE.esc(file))
 			end
+			_p('')
 		end
-		_p('')
 		
 		-- include the dependencies, built by GCC (with the -MMD flag)
 		_p('-include $(OBJECTS:%%.o=%%.d)')
+		_p('-include $(GCH:%%.h.gch=%%.h.d)')
 	end
 
 
@@ -174,6 +230,7 @@
 	function premake.gmake_cpp_config(cfg, cc)
 
 		_p('ifeq ($(config),%s)', _MAKE.esc(cfg.shortname))
+
 		
 		-- if this platform requires a special compiler or linker, list it now
 		local platform = cc.platforms[cfg.platform]
@@ -186,6 +243,9 @@
 		if platform.ar then
 			_p('  AR         = %s', platform.ar)
 		end
+		if not(cfg.gnuexternals) then
+			cfg.gnuexternal = { }		
+		end 
 
 		_p('  OBJDIR     = %s', _MAKE.esc(cfg.objectsdir))		
 		_p('  TARGETDIR  = %s', _MAKE.esc(cfg.buildtarget.directory))
@@ -197,12 +257,12 @@
 		-- set up precompiled headers
 		_.pchconfig(cfg)
 				
-		_p('  CFLAGS    += $(CPPFLAGS) $(ARCH) %s', table.concat(table.join(cc.getcflags(cfg), cfg.buildoptions), " "))
+		_p('  CFLAGS    += $(CPPFLAGS) %s', table.concat(table.join(cc.getcflags(cfg), cfg.buildoptions), " "))
 		_p('  CXXFLAGS  += $(CFLAGS) %s', table.concat(cc.getcxxflags(cfg), " "))
 		_p('  LDFLAGS   += %s', table.concat(table.join(cc.getldflags(cfg), cfg.linkoptions, cc.getlibdirflags(cfg)), " "))
-		_p('  LIBS      += %s', table.concat(cc.getlinkflags(cfg), " "))
+		_p('  LIBS      += %s %s', table.concat(cc.getlinkflags(cfg), " "), table.concat(cfg.gnuexternals, " "))
 		_p('  RESFLAGS  += $(DEFINES) $(INCLUDES) %s', table.concat(table.join(cc.getdefines(cfg.resdefines), cc.getincludedirs(cfg.resincludedirs), cfg.resoptions), " "))
-		_p('  LDDEPS    += %s', table.concat(_MAKE.esc(premake.getlinks(cfg, "siblings", "fullpath")), " "))
+		_p('  LDDEPS    += %s', table.concat(_MAKE.esc(premake.getlinks(cfg, "static", "fullpath")), " "))
 		
 		if cfg.kind == "StaticLib" then
 			if cfg.platform:startswith("Universal") then
@@ -213,7 +273,16 @@
 		else
 			-- this was $(TARGET) $(LDFLAGS) $(OBJECTS) ... but was having trouble linking to certain 
 			-- static libraries so $(OBJECTS) was moved up
-			_p('  LINKCMD    = $(%s) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(ARCH) $(LIBS)', iif(cfg.language == "C", "CC", "CXX"))
+			local lddeps = ''
+
+			-- on osx, --start-group and --end-group aren't supported by ld
+			if os.is('macosx') then
+				lddeps = '$(LDDEPS)'
+			else
+				lddeps = '-Xlinker --start-group $(LDDEPS) -Xlinker --end-group'
+			end
+			_p('  LINKCMD    = $(%s) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) %s $(LIBS)', 
+			iif(cfg.language == "C", "CC", "CXX"), lddeps)
 		end
 		
 		_p('  define PREBUILDCMDS')
@@ -248,22 +317,22 @@
 
 	function _.pchconfig(cfg)			
 		if not cfg.flags.NoPCH and cfg.pchheader then
-			_p('  PCH        = %s', _MAKE.esc(path.getrelative(cfg.location, cfg.pchheader)))
+			_p('  PCH        = %s', _MAKE.esc(cfg.pchheader))
 			_p('  GCH        = $(OBJDIR)/%s.gch', _MAKE.esc(path.getname(cfg.pchheader))) 
-			_p('  CPPFLAGS  += -I$(OBJDIR) -include $(OBJDIR)/%s', _MAKE.esc(path.getname(cfg.pchheader)))
+			_p('  PCHINCLUDES = -I$(OBJDIR) -include $(OBJDIR)/%s', _MAKE.esc(path.getname(cfg.pchheader)))
 		end
 	end
 
 	function _.pchrules(prj)
 		_p('ifneq (,$(PCH))')
-		_p('$(GCH): $(PCH)')
+		_p('$(GCH): $(PCH) | $(OBJDIR)')
 		_p('\t@echo $(notdir $<)')
 		_p('\t-$(SILENT) cp $< $(OBJDIR)')
-		if prj.language == "C" then
-			_p('\t$(SILENT) $(CC) $(CFLAGS) -o "$@" -c "$<"')
-		else
-			_p('\t$(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -c "$<"')
-		end
-		_p('endif')
-		_p('')
+		if prj.language == "C" then
+			_p('\t$(SILENT) $(CC) $(CFLAGS) -o "$@" -c "$<"')
+		else
+			_p('\t$(SILENT) $(CXX) $(CXXFLAGS) -x c++-header -o "$@" -c "$<"')
+		end
+		_p('endif')
+		_p('')
 	end
diff -r fc0374a03b17 src/actions/vstudio/_vstudio.lua
--- a/src/actions/vstudio/_vstudio.lua	Tue Jan 04 06:23:26 2011 -0500
+++ b/src/actions/vstudio/_vstudio.lua	Mon Jun 11 22:44:58 2012 +0200
@@ -227,6 +227,37 @@
 					end
 				end
 			end
+
+			if (path.getextension(fname) == ".asm") then
+				for _, cfginfo in ipairs(prj.solution.vstudio_configs) do
+					if cfginfo.isreal then
+
+						-- set defaults if required parameters are not set
+						if not (prj.solution.nasmformat) then
+							prj.solution.nasmformat = 'win32'
+						end
+						if not (prj.solution.nasmpath) then
+							prj.solution.nasmpath = 'nasm'				
+						end
+
+						local nasmpath = path.translate(path.getrelative(prj.location, prj.solution.nasmpath), "\\")
+						local command = nasmpath.." -i "..path.translate(path.getdirectory(fname), "\\").."\\ -f "..prj.solution.nasmformat..
+							" &quot;$(InputPath)&quot; -o &quot;$(IntDir)\\$(InputName).obj&quot;"
+
+						output(indent, "\t<FileConfiguration")
+						attrib(indent, "\tName", cfginfo.name)
+						output(indent, "\t\t>")
+						output(indent, "\t\t<Tool")
+						attrib(indent, "\t\tName", "VCCustomBuildTool")
+						attrib(indent, "\t\tDescription", "Assembling $(InputPath)")
+						attrib(indent, "\t\tCommandLine", command)
+						attrib(indent, "\t\tOutputs", "$(IntDir)\\$(InputName).obj")
+						output(indent, "\t\t/>")
+						output(indent, "\t</FileConfiguration>")
+					end
+				end
+			end
+
 			output(indent, "</File>")
 		end
 	end
@@ -455,4 +486,4 @@
 		oncleansolution = premake.vstudio.cleansolution,
 		oncleanproject  = premake.vstudio.cleanproject,
 		oncleantarget   = premake.vstudio.cleantarget
-	}
\ No newline at end of file
+	}
diff -r fc0374a03b17 src/actions/vstudio/vs2010_vcxproxj.lua
--- a/src/actions/vstudio/vs2010_vcxproxj.lua	Tue Jan 04 06:23:26 2011 -0500
+++ b/src/actions/vstudio/vs2010_vcxproxj.lua	Mon Jun 11 22:44:58 2012 +0200
@@ -4,14 +4,15 @@
 	
 		
 	function vs10_helpers.remove_relative_path(file)
-		file = file:gsub("%.%.\\",'')
-		file = file:gsub("%.\\",'')
+		file = file:gsub("%.%./",'')
+		file = file:gsub("%./",'')
+		file = file:gsub("^source/",'')
 		return file
 	end
 		
 	function vs10_helpers.file_path(file)
 		file = vs10_helpers.remove_relative_path(file)
-		local path = string.find(file,'\\[%w%.%_%-]+$')
+		local path = string.find(file,'/[%w%.%_%-]+$')
 		if path then
 			return string.sub(file,1,path-1)
 		else
@@ -23,11 +24,11 @@
 		local list={}
 		path = vs10_helpers.remove_relative_path(path)
 		if path then
-			for dir in string.gmatch(path,"[%w%-%_%.]+\\")do
+			for dir in string.gmatch(path,"[%w%-%_%.]+/")do
 				if #list == 0 then
 					list[1] = dir:sub(1,#dir-1)
 				else
-					list[#list +1] = list[#list] .."\\" ..dir:sub(1,#dir-1)				
+					list[#list +1] = list[#list] .."/" ..dir:sub(1,#dir-1)				
 				end
 			end		
 		end
@@ -59,8 +60,6 @@
 	end
 	
 
-	
-	--also translates file paths from '/' to '\\'
 	function vs10_helpers.sort_input_files(files,sorted_container)
 		local types = 
 		{	
@@ -71,18 +70,18 @@
 			cpp	= "ClCompile",
 			cxx	= "ClCompile",
 			cc	= "ClCompile",
-			rc  = "ResourceCompile"
+			rc  	= "ResourceCompile",
+			asm 	= "ClASM"
 		}
 
 		for _, current_file in ipairs(files) do
-			local translated_path = path.translate(current_file, '\\')
-			local ext = vs10_helpers.get_file_extension(translated_path)
+			local ext = vs10_helpers.get_file_extension(current_file)
 			if ext then
 				local type = types[ext]
 				if type then
-					table.insert(sorted_container[type],translated_path)
+					table.insert(sorted_container[type],current_file)
 				else
-					table.insert(sorted_container.None,translated_path)
+					table.insert(sorted_container.None,current_file)
 				end
 			end
 		end
@@ -388,16 +387,23 @@
 	end
 
 
-	local function event_hooks(cfg)	
+	local function event_hooks(cfg, prj)	
 		if #cfg.postbuildcommands> 0 then
 		    _p(2,'<PostBuildEvent>')
 				_p(3,'<Command>%s</Command>',premake.esc(table.implode(cfg.postbuildcommands, "", "", "\r\n")))
 			_p(2,'</PostBuildEvent>')
 		end
 		
-		if #cfg.prebuildcommands> 0 then
+		if #cfg.prebuildcommands> 0 or prj.cxxtestrootfile then
 		    _p(2,'<PreBuildEvent>')
 				_p(3,'<Command>%s</Command>',premake.esc(table.implode(cfg.prebuildcommands, "", "", "\r\n")))
+				
+				-- test generation only works if all required parameters are set!
+				if(prj.solution.cxxtestpath and prj.cxxtestrootfile and prj.cxxtesthdrfiles and prj.cxxtestsrcfiles) then
+					local cxxtestpath = path.translate(path.getrelative(prj.location, prj.solution.cxxtestpath),"\\")
+					local cxxtestrootfile = path.translate(prj.cxxtestrootfile,"\\")
+					_p(3,'<Command>%s --root %s &gt; %s</Command>', cxxtestpath, prj.cxxtestrootoptions, cxxtestrootfile)
+				end	
 			_p(2,'</PreBuildEvent>')
 		end
 		
@@ -503,10 +509,8 @@
 				resource_compile(cfg)
 				item_def_lib(cfg)
 				item_link(cfg)
-				event_hooks(cfg)
+				event_hooks(cfg, prj)
 			_p(1,'</ItemDefinitionGroup>')
-
-			
 		end
 	end
 	
@@ -518,34 +522,50 @@
   --       <Project>{8fd826f8-3739-44e6-8cc8-997122e53b8d}</Project>
   --     </ProjectReference>
   --   </ItemGroup>
-	--
+
+	local function write_cxxtestgen_block(prj)
+		-- test generation only works if all required parameters are set!
+		if(prj.solution.cxxtestpath and prj.cxxtestrootfile and prj.cxxtesthdrfiles and prj.cxxtestsrcfiles) then
+			local cxxtestpath = path.translate(path.getrelative(prj.location, prj.solution.cxxtestpath),"\\")
+			_p(1,'<ItemGroup>')
+			for i, file in ipairs(prj.cxxtesthdrfiles) do
+				local cxxtesthdrfile = path.translate(file,"\\")
+				local cxxtestsrcfile = path.translate(prj.cxxtestsrcfiles[i],"\\")
+				_p(2,'<CustomBuild Include=\"%s\">', cxxtesthdrfile)
+				      _p(3,'<Message>Generating %s</Message>', path.getname(prj.cxxtestsrcfiles[i]))
+				      _p(3,'<Command>%s --part %s -o \"%s\" \"%s\"</Command>', 
+					cxxtestpath, prj.cxxtestoptions, cxxtestsrcfile, cxxtesthdrfile)
+				      _p(3,'<Outputs>%s;%%(Outputs)</Outputs>', cxxtestsrcfile)
+				_p(2,'</CustomBuild>')
+			end
+			_p(1,'</ItemGroup>')
+		end	
+	end
 	
 	local function write_file_type_block(files,group_type)
 		if #files > 0  then
 			_p(1,'<ItemGroup>')
 			for _, current_file in ipairs(files) do
-				_p(2,'<%s Include=\"%s\" />', group_type,current_file)
+				_p(2,'<%s Include=\"%s\" />', group_type,path.translate(current_file,"\\"))
 			end
 			_p(1,'</ItemGroup>')
 		end
 	end
 	
 	local function write_file_compile_block(files,prj,configs)
-	
 		if #files > 0  then	
-		
 			local config_mappings = {}
 			for _, cfginfo in ipairs(configs) do
 				local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)
 				if cfg.pchheader and cfg.pchsource and not cfg.flags.NoPCH then
-					config_mappings[cfginfo] = path.translate(cfg.pchsource, "\\")
+					config_mappings[cfginfo] = cfg.pchsource
 				end
 			end
 
 			
 			_p(1,'<ItemGroup>')
 			for _, current_file in ipairs(files) do
-				_p(2,'<ClCompile Include=\"%s\">', current_file)
+				_p(2,'<ClCompile Include=\"%s\">', path.translate(current_file, "\\"))
 				for _, cfginfo in ipairs(configs) do
 					if config_mappings[cfginfo] and current_file == config_mappings[cfginfo] then 
 							_p(3,'<PrecompiledHeader '.. if_config_and_platform() .. '>Create</PrecompiledHeader>'
@@ -559,6 +579,33 @@
 			_p(1,'</ItemGroup>')
 		end
 	end
+
+	local function write_nasm_asm_block(files, prj, configs)
+		-- set defaults if required parameters are not set
+		if not (prj.solution.nasmformat) then
+			prj.solution.nasmformat = 'win32'
+		end
+
+		if not (prj.solution.nasmpath) then
+			prj.solution.nasmpath = 'nasm'				
+		end
+
+		if #files > 0 then
+			_p(1,'<ItemGroup>')
+			local nasmpath = path.translate(path.getrelative(prj.location, prj.solution.nasmpath),"\\")
+			for _, current_file in ipairs(files) do
+				_p(2,'<CustomBuild Include=\"%s\">', path.translate(current_file,"\\"))
+					_p(3,'<Message>Assembling %%(FullPath)</Message>')
+					_p(3,'<Command>%s -i %s -f %s \"%%(FullPath)\" -o \"$(IntDir)%%(Filename).obj\"</Command>', 
+					nasmpath, 
+					path.translate(path.getdirectory(current_file),"\\").."\\", 
+					prj.solution.nasmformat)
+					_p(3,'<Outputs>$(IntDir)%%(Filename).obj;%%(Outputs)</Outputs>')
+				_p(2,'</CustomBuild>')
+			end
+			_p(1,'</ItemGroup>')
+		end
+	end
 	
 	
 	local function vcxproj_files(prj)
@@ -566,14 +613,17 @@
 		{
 			ClCompile	={},
 			ClInclude	={},
+			ClASM	={},
 			None		={},
 			ResourceCompile ={}
 		}
 		
 		cfg = premake.getconfig(prj)
 		vs10_helpers.sort_input_files(cfg.files,sorted)
+		write_cxxtestgen_block(prj)
 		write_file_type_block(sorted.ClInclude,"ClInclude")
 		write_file_compile_block(sorted.ClCompile,prj,prj.solution.vstudio_configs)
+		write_nasm_asm_block(sorted.ClASM, prj, prj.solution.vstudion_configs)
 		write_file_type_block(sorted.None,'None')
 		write_file_type_block(sorted.ResourceCompile,'ResourceCompile')
 
@@ -587,7 +637,7 @@
 		if #directories >0 then
 			_p(1,'<ItemGroup>')
 			for _, dir in pairs(directories) do
-				_p(2,'<Filter Include="%s">',dir)
+				_p(2,'<Filter Include="%s">',path.translate(dir,"\\"))
 					_p(3,'<UniqueIdentifier>{%s}</UniqueIdentifier>',os.uuid())
 				_p(2,'</Filter>')
 			end
@@ -602,7 +652,7 @@
 				local path_to_file = vs10_helpers.file_path(current_file)
 				if path_to_file then
 					_p(2,'<%s Include=\"%s\">', group_type,path.translate(current_file, "\\"))
-						_p(3,'<Filter>%s</Filter>',path_to_file)
+						_p(3,'<Filter>%s</Filter>',path.translate(path_to_file,"\\"))
 					_p(2,'</%s>',group_type)
 				else
 					_p(2,'<%s Include=\"%s\" />', group_type,path.translate(current_file, "\\"))
@@ -620,6 +670,7 @@
 		{
 			ClCompile	={},
 			ClInclude	={},
+			ClASM	={},
 			None		={},
 			ResourceCompile ={}
 		}
@@ -633,6 +684,8 @@
 			write_filter_includes(sorted)
 			write_file_filter_block(sorted.ClInclude,"ClInclude")
 			write_file_filter_block(sorted.ClCompile,"ClCompile")
+			write_file_filter_block(prj.cxxtesthdrfiles,"CustomBuild")
+			write_file_filter_block(sorted.ClASM,"ClASM")
 			write_file_filter_block(sorted.None,"None")
 			write_file_filter_block(sorted.ResourceCompile,"ResourceCompile")
 		_p('</Project>')
@@ -686,4 +739,4 @@
 	end
 	
 
-		
\ No newline at end of file
+		
diff -r fc0374a03b17 src/actions/xcode/xcode_common.lua
--- a/src/actions/xcode/xcode_common.lua	Tue Jan 04 06:23:26 2011 -0500
+++ b/src/actions/xcode/xcode_common.lua	Mon Jun 11 22:44:58 2012 +0200
@@ -32,6 +32,7 @@
 			[".nib"] = "Resources",
 			[".xib"] = "Resources",
 			[".icns"] = "Resources",
+			[".asm"] = "Sources"
 		}
 		return categories[path.getextension(node.name)]
 	end
@@ -85,6 +86,7 @@
 			[".strings"]   = "text.plist.strings",
 			[".xib"]       = "file.xib",
 			[".icns"]      = "image.icns",
+			[".asm"]       = "sourcecode.asm",
 		}
 		return types[path.getextension(node.path)] or "text"
 	end
@@ -263,6 +265,25 @@
 	end
 
 
+	function xcode.PBXBuildRule(tr)
+		if not (tr.project.solution.nasmpath) then
+			tr.project.solution.nasmpath = 'nasm'				
+		end
+		_p('/* Begin PBXBuildRule section */')
+			_p(2,'28AD1E6E1336798800207177 /* PBXBuildRule */ = {')
+				_p(3,'isa = PBXBuildRule;')
+				_p(3,'compilerSpec = com.apple.compilers.proxy.script;')
+				_p(3,'fileType = sourcecode.asm;')
+				_p(3,'isEditable = 1;')
+				_p(3,'outputFiles = (')
+					_p(4,'"$(DERIVED_FILES_DIR)/$(INPUT_FILE_BASE).o",')
+				_p(3,');')
+				_p(3,'script = "%s -D OS_UNIX=1 -i${INPUT_FILE_DIR}/ -f %s ${INPUT_FILE_PATH} -o ${DERIVED_FILES_DIR}/${INPUT_FILE_BASE}.o";', tr.project.solution.nasmpath, tr.project.solution.nasmformat)
+			_p(2,'};')
+		_p('/* End PBXBuildRule section */')
+	end
+
+
 	function xcode.PBXContainerItemProxy(tr)
 		if #tr.projects.children > 0 then
 			_p('/* Begin PBXContainerItemProxy section */')
@@ -432,6 +453,7 @@
 			end
 			_p(3,');')
 			_p(3,'buildRules = (')
+			_p(4,'28AD1E6E1336798800207177 /* PBXBuildRule */,')
 			_p(3,');')
 			
 			_p(3,'dependencies = (')
diff -r fc0374a03b17 src/actions/xcode/xcode_project.lua
--- a/src/actions/xcode/xcode_project.lua	Tue Jan 04 06:23:26 2011 -0500
+++ b/src/actions/xcode/xcode_project.lua	Mon Jun 11 22:44:58 2012 +0200
@@ -147,6 +147,7 @@
 		local tr = xcode.buildprjtree(prj)
 		xcode.Header(tr)
 		xcode.PBXBuildFile(tr)
+		xcode.PBXBuildRule(tr)
 		xcode.PBXContainerItemProxy(tr)
 		xcode.PBXFileReference(tr)
 		xcode.PBXFrameworksBuildPhase(tr)
diff -r fc0374a03b17 src/base/api.lua
--- a/src/base/api.lua	Tue Jan 04 06:23:26 2011 -0500
+++ b/src/base/api.lua	Mon Jun 11 22:44:58 2012 +0200
@@ -41,6 +41,42 @@
 			kind  = "list",
 			scope = "solution",
 		},
+
+		cxxtesthdrfiles =
+		{
+			kind = "filelist",
+			scope = "config",		
+		},
+
+		cxxtestsrcfiles = 
+		{
+			kind  = "filelist",
+			scope = "config",
+		},
+
+		cxxtestoptions =
+		{
+			kind  = "string",
+			scope = "config",
+		},
+
+		cxxtestpath =
+		{
+			kind  = "path",
+			scope = "solution", 			
+		},
+
+		cxxtestrootfile = 
+		{
+			kind  = "path",
+			scope = "config",
+		},
+
+		cxxtestrootoptions =
+		{
+			kind  = "string",
+			scope = "config",
+		},
 		
 		defines =
 		{
@@ -116,6 +152,12 @@
 				"4.0"
 			}
 		},
+
+		gnuexternals =
+		{
+			kind  = "list",
+			scope = "config",
+		},
 		
 		imagepath = 
 		{
@@ -219,6 +261,18 @@
 			kind  = "path",
 			scope = "container",
 		},
+
+		nasmformat =
+		{
+			kind  = "string",
+			scope = "solution",
+		},
+
+		nasmpath =
+		{
+			kind  = "path",
+			scope = "solution"
+		},
 		
 		objdir =
 		{
@@ -228,7 +282,7 @@
 		
 		pchheader =
 		{
-			kind  = "string",
+			kind  = "path",
 			scope = "config",
 		},
 		
diff -r fc0374a03b17 src/base/project.lua
--- a/src/base/project.lua	Tue Jan 04 06:23:26 2011 -0500
+++ b/src/base/project.lua	Mon Jun 11 22:44:58 2012 +0200
@@ -266,6 +266,7 @@
 --   siblings     - linkable sibling projects
 --   system       - system (non-sibling) libraries
 --   dependencies - all sibling dependencies, including non-linkable
+--   static	  - siblings that are static libraries
 --   all          - return everything
 --
 -- Part may be one of:
@@ -288,7 +289,9 @@
 		local namestyle = premake.getnamestyle(cfg)
 		
 		local function canlink(source, target)
-			if (target.kind ~= "SharedLib" and target.kind ~= "StaticLib") then 
+			if (kind == "static" and target.kind ~= "StaticLib") then
+				return false				
+			elseif (target.kind ~= "SharedLib" and target.kind ~= "StaticLib") then 
 				return false
 			end
 			if premake.iscppproject(source) then
