Ticket #1518: 0ad_premake.diff
File 0ad_premake.diff, 24.4 KB (added by , 12 years ago) |
---|
-
premake4.lua
diff -r fc0374a03b17 premake4.lua
a b 49 49 configuration "vs*" 50 50 defines { "_CRT_SECURE_NO_WARNINGS" } 51 51 52 configuration "bsd" 53 defines { "LUA_USE_POSIX", "LUA_USE_DLOPEN" } 54 links { "m" } 55 52 56 configuration "linux" 53 57 defines { "LUA_USE_POSIX", "LUA_USE_DLOPEN" } 54 links { "m", "dl" } 58 links { "m", "dl" } 55 59 56 60 configuration "macosx" 57 61 defines { "LUA_USE_MACOSX" } -
src/actions/codeblocks/codeblocks_cbp.lua
diff -r fc0374a03b17 src/actions/codeblocks/codeblocks_cbp.lua
a b 34 34 35 35 _p(4,'<Option output="%s" prefix_auto="0" extension_auto="0" />', premake.esc(cfg.buildtarget.fullpath)) 36 36 _p(4,'<Option object_output="%s" />', premake.esc(cfg.objectsdir)) 37 _p(4,'<Option external_deps="%s" />', table.concat(premake.getlinks(cfg, "siblings", "fullpath"),";")) 37 38 38 39 -- identify the type of binary 39 40 local types = { WindowedApp = 0, ConsoleApp = 1, StaticLib = 2, SharedLib = 3 } … … 63 64 64 65 -- begin linker block -- 65 66 _p(4,'<Linker>') 67 _p(5,'<Add option="-Wl,--start-group" />') 68 for _,v in ipairs(premake.getlinks(cfg, "siblings", "fullpath")) do 69 _p(5,'<Add option="%s" />', premake.esc(v)) 70 end 71 _p(5,'<Add option="-Wl,--end-group" />') 66 72 for _,flag in ipairs(table.join(cc.getldflags(cfg), cfg.linkoptions)) do 67 73 _p(5,'<Add option="%s" />', premake.esc(flag)) 68 74 end 69 75 for _,v in ipairs(premake.getlinks(cfg, "all", "directory")) do 70 76 _p(5,'<Add directory="%s" />', premake.esc(v)) 71 77 end 72 for _,v in ipairs(premake.getlinks(cfg, " all", "basename")) do78 for _,v in ipairs(premake.getlinks(cfg, "system", "basename")) do 73 79 _p(5,'<Add library="%s" />', premake.esc(v)) 74 80 end 75 81 _p(4,'</Linker>') -
src/actions/make/make_cpp.lua
diff -r fc0374a03b17 src/actions/make/make_cpp.lua
a b 26 26 -- list intermediate files 27 27 _p('OBJECTS := \\') 28 28 for _, file in ipairs(prj.files) do 29 if path.iscppfile(file) then29 if path.iscppfile(file) or path.getextension(file) == ".asm" then 30 30 _p('\t$(OBJDIR)/%s.o \\', _MAKE.esc(path.getbasename(file))) 31 31 end 32 32 end … … 55 55 _p('') 56 56 57 57 if os.is("MacOSX") and prj.kind == "WindowedApp" then 58 _p('all: $(TARGET DIR) $(OBJDIR) prebuild prelink $(TARGET) $(dir $(TARGETDIR))PkgInfo $(dir $(TARGETDIR))Info.plist')58 _p('all: $(TARGET) $(dir $(TARGETDIR))PkgInfo $(dir $(TARGETDIR))Info.plist') 59 59 else 60 _p('all: $(TARGET DIR) $(OBJDIR) prebuild prelink $(TARGET)')60 _p('all: $(TARGET)') 61 61 end 62 62 _p('\t@:') 63 63 _p('') 64 64 65 65 -- target build rule 66 _p('$(TARGET): $( GCH) $(OBJECTS) $(LDDEPS) $(RESOURCES)')66 _p('$(TARGET): $(OBJECTS) $(LDDEPS) $(RESOURCES) | prelink') 67 67 _p('\t@echo Linking %s', prj.name) 68 68 _p('\t$(SILENT) $(LINKCMD)') 69 69 _p('\t$(POSTBUILDCMDS)') … … 97 97 _p('') 98 98 99 99 -- custom build step targets 100 _p('prebuild: ')100 _p('prebuild: $(TARGETDIR) $(OBJDIR)') 101 101 _p('\t$(PREBUILDCMDS)') 102 102 _p('') 103 103 … … 108 108 -- precompiler header rule 109 109 _.pchrules(prj) 110 110 111 -- per-file rules 112 for _, file in ipairs(prj.files) do 113 if path.iscppfile(file) then 111 -- per-file rules 112 for _, file in ipairs(prj.files) do 113 if path.iscppfile(file) then 114 -- Don't use PCH for Obj-C/C++ files (we could but we'd have to compile them separately 115 -- and there's no advantage to that yet) 116 local gchobj = '$(GCH)' 117 local pchincludes = '$(PCHINCLUDES)' 118 if (path.getextension(file) == ".mm" or path.getextension(file) == ".m") then 119 gchobj = '' 120 pchincludes = '' 121 end 122 123 _p('$(OBJDIR)/%s.o: %s %s | prebuild', _MAKE.esc(path.getbasename(file)), _MAKE.esc(file), gchobj) 124 _p('\t@echo $(notdir $<)') 125 if (path.iscfile(file)) then 126 _p('\t$(SILENT) $(CC) %s $(CFLAGS) -MF $(OBJDIR)/%s.d -MT "$@" -o "$@" -c "$<"', pchincludes, _MAKE.esc(path.getbasename(file))) 127 else 128 _p('\t$(SILENT) $(CXX) %s $(CXXFLAGS) -MF $(OBJDIR)/%s.d -MT "$@" -o "$@" -c "$<"', pchincludes, _MAKE.esc(path.getbasename(file))) 129 end 130 elseif (path.getextension(file) == ".rc") then 131 _p('$(OBJDIR)/%s.res: %s', _MAKE.esc(path.getbasename(file)), _MAKE.esc(file)) 132 _p('\t@echo $(notdir $<)') 133 _p('\t$(SILENT) windres $< -O coff -o "$@" $(RESFLAGS)') 134 elseif (path.getextension(file) == ".asm") then 114 135 _p('$(OBJDIR)/%s.o: %s', _MAKE.esc(path.getbasename(file)), _MAKE.esc(file)) 115 136 _p('\t@echo $(notdir $<)') 116 if (path.iscfile(file)) then 117 _p('\t$(SILENT) $(CC) $(CFLAGS) -o "$@" -c "$<"') 137 138 local opts = '' 139 if os.is('windows') then 140 opts = '' 141 elseif os.is('macosx') then 142 opts = '-D OS_UNIX=1' 118 143 else 119 _p('\t$(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -c "$<"')144 opts = '-D DONT_USE_UNDERLINE=1 -D OS_UNIX=1' 120 145 end 121 elseif (path.getextension(file) == ".rc") then 122 _p('$(OBJDIR)/%s.res: %s', _MAKE.esc(path.getbasename(file)), _MAKE.esc(file)) 146 147 if not (prj.solution.nasmpath) then 148 prj.solution.nasmpath = 'nasm' 149 end 150 151 _p('\t$(SILENT)'.._MAKE.esc(prj.solution.nasmpath)..' '..opts..' -i'.._MAKE.esc(path.getdirectory(file))..'/'..' -f '.. 152 _MAKE.esc(prj.solution.nasmformat)..' -o $@ $<\n\t') 153 154 _p('\t$(SILENT)'.._MAKE.esc(prj.solution.nasmpath)..' '..opts..' -i'.._MAKE.esc(path.getdirectory(file))..'/'.. 155 ' -M -o $@ $< >$(OBJDIR)/$(<F:%%.asm=%%.d)\n') 156 end 157 158 end 159 _p('') 160 161 -- output for test-generation 162 -- test generation only works if all required parameters are set! 163 if(prj.cxxtestpath and prj.cxxtestrootfile and prj.cxxtesthdrfiles and prj.cxxtestsrcfiles) then 164 if not(prj.cxxtestrootoptions) then 165 prj.cxxtestrootoptions = '' 166 end 167 if not(prj.cxxtestoptions) then 168 prj.cxxtestoptions = '' 169 end 170 171 _p(prj.cxxtestrootfile..': ') 172 _p('\t@echo $(notdir $<)') 173 _p('\t$(SILENT)'.._MAKE.esc(prj.cxxtestpath)..' --root '..prj.cxxtestrootoptions..' -o '.._MAKE.esc(prj.cxxtestrootfile)) 174 _p('') 175 176 for i, file in ipairs(prj.cxxtesthdrfiles) do 177 _p('%s: %s', _MAKE.esc(prj.cxxtestsrcfiles[i]), _MAKE.esc(file)) 123 178 _p('\t@echo $(notdir $<)') 124 _p('\t$(SILENT) windres $< -O coff -o "$@" $(RESFLAGS)')179 _p('\t$(SILENT)'.._MAKE.esc(prj.cxxtestpath)..' --part '..prj.cxxtestoptions..' -o ' .._MAKE.esc(prj.cxxtestsrcfiles[i])..' '.._MAKE.esc(file)) 125 180 end 181 _p('') 126 182 end 127 _p('')128 183 129 184 -- include the dependencies, built by GCC (with the -MMD flag) 130 185 _p('-include $(OBJECTS:%%.o=%%.d)') 186 _p('-include $(GCH:%%.h.gch=%%.h.d)') 131 187 end 132 188 133 189 … … 174 230 function premake.gmake_cpp_config(cfg, cc) 175 231 176 232 _p('ifeq ($(config),%s)', _MAKE.esc(cfg.shortname)) 233 177 234 178 235 -- if this platform requires a special compiler or linker, list it now 179 236 local platform = cc.platforms[cfg.platform] … … 186 243 if platform.ar then 187 244 _p(' AR = %s', platform.ar) 188 245 end 246 if not(cfg.gnuexternals) then 247 cfg.gnuexternal = { } 248 end 189 249 190 250 _p(' OBJDIR = %s', _MAKE.esc(cfg.objectsdir)) 191 251 _p(' TARGETDIR = %s', _MAKE.esc(cfg.buildtarget.directory)) … … 197 257 -- set up precompiled headers 198 258 _.pchconfig(cfg) 199 259 200 _p(' CFLAGS += $(CPPFLAGS) $(ARCH)%s', table.concat(table.join(cc.getcflags(cfg), cfg.buildoptions), " "))260 _p(' CFLAGS += $(CPPFLAGS) %s', table.concat(table.join(cc.getcflags(cfg), cfg.buildoptions), " ")) 201 261 _p(' CXXFLAGS += $(CFLAGS) %s', table.concat(cc.getcxxflags(cfg), " ")) 202 262 _p(' LDFLAGS += %s', table.concat(table.join(cc.getldflags(cfg), cfg.linkoptions, cc.getlibdirflags(cfg)), " ")) 203 _p(' LIBS += %s ', table.concat(cc.getlinkflags(cfg), " "))263 _p(' LIBS += %s %s', table.concat(cc.getlinkflags(cfg), " "), table.concat(cfg.gnuexternals, " ")) 204 264 _p(' RESFLAGS += $(DEFINES) $(INCLUDES) %s', table.concat(table.join(cc.getdefines(cfg.resdefines), cc.getincludedirs(cfg.resincludedirs), cfg.resoptions), " ")) 205 _p(' LDDEPS += %s', table.concat(_MAKE.esc(premake.getlinks(cfg, "s iblings", "fullpath")), " "))265 _p(' LDDEPS += %s', table.concat(_MAKE.esc(premake.getlinks(cfg, "static", "fullpath")), " ")) 206 266 207 267 if cfg.kind == "StaticLib" then 208 268 if cfg.platform:startswith("Universal") then … … 213 273 else 214 274 -- this was $(TARGET) $(LDFLAGS) $(OBJECTS) ... but was having trouble linking to certain 215 275 -- static libraries so $(OBJECTS) was moved up 216 _p(' LINKCMD = $(%s) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(ARCH) $(LIBS)', iif(cfg.language == "C", "CC", "CXX")) 276 local lddeps = '' 277 278 -- on osx, --start-group and --end-group aren't supported by ld 279 if os.is('macosx') then 280 lddeps = '$(LDDEPS)' 281 else 282 lddeps = '-Xlinker --start-group $(LDDEPS) -Xlinker --end-group' 283 end 284 _p(' LINKCMD = $(%s) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) %s $(LIBS)', 285 iif(cfg.language == "C", "CC", "CXX"), lddeps) 217 286 end 218 287 219 288 _p(' define PREBUILDCMDS') … … 248 317 249 318 function _.pchconfig(cfg) 250 319 if not cfg.flags.NoPCH and cfg.pchheader then 251 _p(' PCH = %s', _MAKE.esc( path.getrelative(cfg.location, cfg.pchheader)))320 _p(' PCH = %s', _MAKE.esc(cfg.pchheader)) 252 321 _p(' GCH = $(OBJDIR)/%s.gch', _MAKE.esc(path.getname(cfg.pchheader))) 253 _p(' CPPFLAGS += -I$(OBJDIR) -include $(OBJDIR)/%s', _MAKE.esc(path.getname(cfg.pchheader)))322 _p(' PCHINCLUDES = -I$(OBJDIR) -include $(OBJDIR)/%s', _MAKE.esc(path.getname(cfg.pchheader))) 254 323 end 255 324 end 256 325 257 326 function _.pchrules(prj) 258 327 _p('ifneq (,$(PCH))') 259 _p('$(GCH): $(PCH) ')328 _p('$(GCH): $(PCH) | $(OBJDIR)') 260 329 _p('\t@echo $(notdir $<)') 261 330 _p('\t-$(SILENT) cp $< $(OBJDIR)') 262 if prj.language == "C" then 263 _p('\t$(SILENT) $(CC) $(CFLAGS) -o "$@" -c "$<"') 264 else 265 _p('\t$(SILENT) $(CXX) $(CXXFLAGS) - o "$@" -c "$<"')266 end 267 _p('endif') 268 _p('') 331 if prj.language == "C" then 332 _p('\t$(SILENT) $(CC) $(CFLAGS) -o "$@" -c "$<"') 333 else 334 _p('\t$(SILENT) $(CXX) $(CXXFLAGS) -x c++-header -o "$@" -c "$<"') 335 end 336 _p('endif') 337 _p('') 269 338 end -
src/actions/vstudio/_vstudio.lua
diff -r fc0374a03b17 src/actions/vstudio/_vstudio.lua
a b 227 227 end 228 228 end 229 229 end 230 231 if (path.getextension(fname) == ".asm") then 232 for _, cfginfo in ipairs(prj.solution.vstudio_configs) do 233 if cfginfo.isreal then 234 235 -- set defaults if required parameters are not set 236 if not (prj.solution.nasmformat) then 237 prj.solution.nasmformat = 'win32' 238 end 239 if not (prj.solution.nasmpath) then 240 prj.solution.nasmpath = 'nasm' 241 end 242 243 local nasmpath = path.translate(path.getrelative(prj.location, prj.solution.nasmpath), "\\") 244 local command = nasmpath.." -i "..path.translate(path.getdirectory(fname), "\\").."\\ -f "..prj.solution.nasmformat.. 245 " "$(InputPath)" -o "$(IntDir)\\$(InputName).obj"" 246 247 output(indent, "\t<FileConfiguration") 248 attrib(indent, "\tName", cfginfo.name) 249 output(indent, "\t\t>") 250 output(indent, "\t\t<Tool") 251 attrib(indent, "\t\tName", "VCCustomBuildTool") 252 attrib(indent, "\t\tDescription", "Assembling $(InputPath)") 253 attrib(indent, "\t\tCommandLine", command) 254 attrib(indent, "\t\tOutputs", "$(IntDir)\\$(InputName).obj") 255 output(indent, "\t\t/>") 256 output(indent, "\t</FileConfiguration>") 257 end 258 end 259 end 260 230 261 output(indent, "</File>") 231 262 end 232 263 end … … 455 486 oncleansolution = premake.vstudio.cleansolution, 456 487 oncleanproject = premake.vstudio.cleanproject, 457 488 oncleantarget = premake.vstudio.cleantarget 458 } 459 No newline at end of file 489 } -
src/actions/vstudio/vs2010_vcxproxj.lua
diff -r fc0374a03b17 src/actions/vstudio/vs2010_vcxproxj.lua
a b 4 4 5 5 6 6 function vs10_helpers.remove_relative_path(file) 7 file = file:gsub("%.%.\\",'') 8 file = file:gsub("%.\\",'') 7 file = file:gsub("%.%./",'') 8 file = file:gsub("%./",'') 9 file = file:gsub("^source/",'') 9 10 return file 10 11 end 11 12 12 13 function vs10_helpers.file_path(file) 13 14 file = vs10_helpers.remove_relative_path(file) 14 local path = string.find(file,' \\[%w%.%_%-]+$')15 local path = string.find(file,'/[%w%.%_%-]+$') 15 16 if path then 16 17 return string.sub(file,1,path-1) 17 18 else … … 23 24 local list={} 24 25 path = vs10_helpers.remove_relative_path(path) 25 26 if path then 26 for dir in string.gmatch(path,"[%w%-%_%.]+ \\")do27 for dir in string.gmatch(path,"[%w%-%_%.]+/")do 27 28 if #list == 0 then 28 29 list[1] = dir:sub(1,#dir-1) 29 30 else 30 list[#list +1] = list[#list] .." \\" ..dir:sub(1,#dir-1)31 list[#list +1] = list[#list] .."/" ..dir:sub(1,#dir-1) 31 32 end 32 33 end 33 34 end … … 59 60 end 60 61 61 62 62 63 --also translates file paths from '/' to '\\'64 63 function vs10_helpers.sort_input_files(files,sorted_container) 65 64 local types = 66 65 { … … 71 70 cpp = "ClCompile", 72 71 cxx = "ClCompile", 73 72 cc = "ClCompile", 74 rc = "ResourceCompile" 73 rc = "ResourceCompile", 74 asm = "ClASM" 75 75 } 76 76 77 77 for _, current_file in ipairs(files) do 78 local translated_path = path.translate(current_file, '\\') 79 local ext = vs10_helpers.get_file_extension(translated_path) 78 local ext = vs10_helpers.get_file_extension(current_file) 80 79 if ext then 81 80 local type = types[ext] 82 81 if type then 83 table.insert(sorted_container[type], translated_path)82 table.insert(sorted_container[type],current_file) 84 83 else 85 table.insert(sorted_container.None, translated_path)84 table.insert(sorted_container.None,current_file) 86 85 end 87 86 end 88 87 end … … 388 387 end 389 388 390 389 391 local function event_hooks(cfg )390 local function event_hooks(cfg, prj) 392 391 if #cfg.postbuildcommands> 0 then 393 392 _p(2,'<PostBuildEvent>') 394 393 _p(3,'<Command>%s</Command>',premake.esc(table.implode(cfg.postbuildcommands, "", "", "\r\n"))) 395 394 _p(2,'</PostBuildEvent>') 396 395 end 397 396 398 if #cfg.prebuildcommands> 0 then397 if #cfg.prebuildcommands> 0 or prj.cxxtestrootfile then 399 398 _p(2,'<PreBuildEvent>') 400 399 _p(3,'<Command>%s</Command>',premake.esc(table.implode(cfg.prebuildcommands, "", "", "\r\n"))) 400 401 -- test generation only works if all required parameters are set! 402 if(prj.solution.cxxtestpath and prj.cxxtestrootfile and prj.cxxtesthdrfiles and prj.cxxtestsrcfiles) then 403 local cxxtestpath = path.translate(path.getrelative(prj.location, prj.solution.cxxtestpath),"\\") 404 local cxxtestrootfile = path.translate(prj.cxxtestrootfile,"\\") 405 _p(3,'<Command>%s --root %s > %s</Command>', cxxtestpath, prj.cxxtestrootoptions, cxxtestrootfile) 406 end 401 407 _p(2,'</PreBuildEvent>') 402 408 end 403 409 … … 503 509 resource_compile(cfg) 504 510 item_def_lib(cfg) 505 511 item_link(cfg) 506 event_hooks(cfg )512 event_hooks(cfg, prj) 507 513 _p(1,'</ItemDefinitionGroup>') 508 509 510 514 end 511 515 end 512 516 … … 518 522 -- <Project>{8fd826f8-3739-44e6-8cc8-997122e53b8d}</Project> 519 523 -- </ProjectReference> 520 524 -- </ItemGroup> 521 -- 525 526 local function write_cxxtestgen_block(prj) 527 -- test generation only works if all required parameters are set! 528 if(prj.solution.cxxtestpath and prj.cxxtestrootfile and prj.cxxtesthdrfiles and prj.cxxtestsrcfiles) then 529 local cxxtestpath = path.translate(path.getrelative(prj.location, prj.solution.cxxtestpath),"\\") 530 _p(1,'<ItemGroup>') 531 for i, file in ipairs(prj.cxxtesthdrfiles) do 532 local cxxtesthdrfile = path.translate(file,"\\") 533 local cxxtestsrcfile = path.translate(prj.cxxtestsrcfiles[i],"\\") 534 _p(2,'<CustomBuild Include=\"%s\">', cxxtesthdrfile) 535 _p(3,'<Message>Generating %s</Message>', path.getname(prj.cxxtestsrcfiles[i])) 536 _p(3,'<Command>%s --part %s -o \"%s\" \"%s\"</Command>', 537 cxxtestpath, prj.cxxtestoptions, cxxtestsrcfile, cxxtesthdrfile) 538 _p(3,'<Outputs>%s;%%(Outputs)</Outputs>', cxxtestsrcfile) 539 _p(2,'</CustomBuild>') 540 end 541 _p(1,'</ItemGroup>') 542 end 543 end 522 544 523 545 local function write_file_type_block(files,group_type) 524 546 if #files > 0 then 525 547 _p(1,'<ItemGroup>') 526 548 for _, current_file in ipairs(files) do 527 _p(2,'<%s Include=\"%s\" />', group_type, current_file)549 _p(2,'<%s Include=\"%s\" />', group_type,path.translate(current_file,"\\")) 528 550 end 529 551 _p(1,'</ItemGroup>') 530 552 end 531 553 end 532 554 533 555 local function write_file_compile_block(files,prj,configs) 534 535 556 if #files > 0 then 536 537 557 local config_mappings = {} 538 558 for _, cfginfo in ipairs(configs) do 539 559 local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform) 540 560 if cfg.pchheader and cfg.pchsource and not cfg.flags.NoPCH then 541 config_mappings[cfginfo] = path.translate(cfg.pchsource, "\\")561 config_mappings[cfginfo] = cfg.pchsource 542 562 end 543 563 end 544 564 545 565 546 566 _p(1,'<ItemGroup>') 547 567 for _, current_file in ipairs(files) do 548 _p(2,'<ClCompile Include=\"%s\">', current_file)568 _p(2,'<ClCompile Include=\"%s\">', path.translate(current_file, "\\")) 549 569 for _, cfginfo in ipairs(configs) do 550 570 if config_mappings[cfginfo] and current_file == config_mappings[cfginfo] then 551 571 _p(3,'<PrecompiledHeader '.. if_config_and_platform() .. '>Create</PrecompiledHeader>' … … 559 579 _p(1,'</ItemGroup>') 560 580 end 561 581 end 582 583 local function write_nasm_asm_block(files, prj, configs) 584 -- set defaults if required parameters are not set 585 if not (prj.solution.nasmformat) then 586 prj.solution.nasmformat = 'win32' 587 end 588 589 if not (prj.solution.nasmpath) then 590 prj.solution.nasmpath = 'nasm' 591 end 592 593 if #files > 0 then 594 _p(1,'<ItemGroup>') 595 local nasmpath = path.translate(path.getrelative(prj.location, prj.solution.nasmpath),"\\") 596 for _, current_file in ipairs(files) do 597 _p(2,'<CustomBuild Include=\"%s\">', path.translate(current_file,"\\")) 598 _p(3,'<Message>Assembling %%(FullPath)</Message>') 599 _p(3,'<Command>%s -i %s -f %s \"%%(FullPath)\" -o \"$(IntDir)%%(Filename).obj\"</Command>', 600 nasmpath, 601 path.translate(path.getdirectory(current_file),"\\").."\\", 602 prj.solution.nasmformat) 603 _p(3,'<Outputs>$(IntDir)%%(Filename).obj;%%(Outputs)</Outputs>') 604 _p(2,'</CustomBuild>') 605 end 606 _p(1,'</ItemGroup>') 607 end 608 end 562 609 563 610 564 611 local function vcxproj_files(prj) … … 566 613 { 567 614 ClCompile ={}, 568 615 ClInclude ={}, 616 ClASM ={}, 569 617 None ={}, 570 618 ResourceCompile ={} 571 619 } 572 620 573 621 cfg = premake.getconfig(prj) 574 622 vs10_helpers.sort_input_files(cfg.files,sorted) 623 write_cxxtestgen_block(prj) 575 624 write_file_type_block(sorted.ClInclude,"ClInclude") 576 625 write_file_compile_block(sorted.ClCompile,prj,prj.solution.vstudio_configs) 626 write_nasm_asm_block(sorted.ClASM, prj, prj.solution.vstudion_configs) 577 627 write_file_type_block(sorted.None,'None') 578 628 write_file_type_block(sorted.ResourceCompile,'ResourceCompile') 579 629 … … 587 637 if #directories >0 then 588 638 _p(1,'<ItemGroup>') 589 639 for _, dir in pairs(directories) do 590 _p(2,'<Filter Include="%s">', dir)640 _p(2,'<Filter Include="%s">',path.translate(dir,"\\")) 591 641 _p(3,'<UniqueIdentifier>{%s}</UniqueIdentifier>',os.uuid()) 592 642 _p(2,'</Filter>') 593 643 end … … 602 652 local path_to_file = vs10_helpers.file_path(current_file) 603 653 if path_to_file then 604 654 _p(2,'<%s Include=\"%s\">', group_type,path.translate(current_file, "\\")) 605 _p(3,'<Filter>%s</Filter>',path _to_file)655 _p(3,'<Filter>%s</Filter>',path.translate(path_to_file,"\\")) 606 656 _p(2,'</%s>',group_type) 607 657 else 608 658 _p(2,'<%s Include=\"%s\" />', group_type,path.translate(current_file, "\\")) … … 620 670 { 621 671 ClCompile ={}, 622 672 ClInclude ={}, 673 ClASM ={}, 623 674 None ={}, 624 675 ResourceCompile ={} 625 676 } … … 633 684 write_filter_includes(sorted) 634 685 write_file_filter_block(sorted.ClInclude,"ClInclude") 635 686 write_file_filter_block(sorted.ClCompile,"ClCompile") 687 write_file_filter_block(prj.cxxtesthdrfiles,"CustomBuild") 688 write_file_filter_block(sorted.ClASM,"ClASM") 636 689 write_file_filter_block(sorted.None,"None") 637 690 write_file_filter_block(sorted.ResourceCompile,"ResourceCompile") 638 691 _p('</Project>') … … 686 739 end 687 740 688 741 689 690 No newline at end of file 742 -
src/actions/xcode/xcode_common.lua
diff -r fc0374a03b17 src/actions/xcode/xcode_common.lua
a b 32 32 [".nib"] = "Resources", 33 33 [".xib"] = "Resources", 34 34 [".icns"] = "Resources", 35 [".asm"] = "Sources" 35 36 } 36 37 return categories[path.getextension(node.name)] 37 38 end … … 85 86 [".strings"] = "text.plist.strings", 86 87 [".xib"] = "file.xib", 87 88 [".icns"] = "image.icns", 89 [".asm"] = "sourcecode.asm", 88 90 } 89 91 return types[path.getextension(node.path)] or "text" 90 92 end … … 263 265 end 264 266 265 267 268 function xcode.PBXBuildRule(tr) 269 if not (tr.project.solution.nasmpath) then 270 tr.project.solution.nasmpath = 'nasm' 271 end 272 _p('/* Begin PBXBuildRule section */') 273 _p(2,'28AD1E6E1336798800207177 /* PBXBuildRule */ = {') 274 _p(3,'isa = PBXBuildRule;') 275 _p(3,'compilerSpec = com.apple.compilers.proxy.script;') 276 _p(3,'fileType = sourcecode.asm;') 277 _p(3,'isEditable = 1;') 278 _p(3,'outputFiles = (') 279 _p(4,'"$(DERIVED_FILES_DIR)/$(INPUT_FILE_BASE).o",') 280 _p(3,');') 281 _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) 282 _p(2,'};') 283 _p('/* End PBXBuildRule section */') 284 end 285 286 266 287 function xcode.PBXContainerItemProxy(tr) 267 288 if #tr.projects.children > 0 then 268 289 _p('/* Begin PBXContainerItemProxy section */') … … 432 453 end 433 454 _p(3,');') 434 455 _p(3,'buildRules = (') 456 _p(4,'28AD1E6E1336798800207177 /* PBXBuildRule */,') 435 457 _p(3,');') 436 458 437 459 _p(3,'dependencies = (') -
src/actions/xcode/xcode_project.lua
diff -r fc0374a03b17 src/actions/xcode/xcode_project.lua
a b 147 147 local tr = xcode.buildprjtree(prj) 148 148 xcode.Header(tr) 149 149 xcode.PBXBuildFile(tr) 150 xcode.PBXBuildRule(tr) 150 151 xcode.PBXContainerItemProxy(tr) 151 152 xcode.PBXFileReference(tr) 152 153 xcode.PBXFrameworksBuildPhase(tr) -
src/base/api.lua
diff -r fc0374a03b17 src/base/api.lua
a b 41 41 kind = "list", 42 42 scope = "solution", 43 43 }, 44 45 cxxtesthdrfiles = 46 { 47 kind = "filelist", 48 scope = "config", 49 }, 50 51 cxxtestsrcfiles = 52 { 53 kind = "filelist", 54 scope = "config", 55 }, 56 57 cxxtestoptions = 58 { 59 kind = "string", 60 scope = "config", 61 }, 62 63 cxxtestpath = 64 { 65 kind = "path", 66 scope = "solution", 67 }, 68 69 cxxtestrootfile = 70 { 71 kind = "path", 72 scope = "config", 73 }, 74 75 cxxtestrootoptions = 76 { 77 kind = "string", 78 scope = "config", 79 }, 44 80 45 81 defines = 46 82 { … … 116 152 "4.0" 117 153 } 118 154 }, 155 156 gnuexternals = 157 { 158 kind = "list", 159 scope = "config", 160 }, 119 161 120 162 imagepath = 121 163 { … … 219 261 kind = "path", 220 262 scope = "container", 221 263 }, 264 265 nasmformat = 266 { 267 kind = "string", 268 scope = "solution", 269 }, 270 271 nasmpath = 272 { 273 kind = "path", 274 scope = "solution" 275 }, 222 276 223 277 objdir = 224 278 { … … 228 282 229 283 pchheader = 230 284 { 231 kind = " string",285 kind = "path", 232 286 scope = "config", 233 287 }, 234 288 -
src/base/project.lua
diff -r fc0374a03b17 src/base/project.lua
a b 266 266 -- siblings - linkable sibling projects 267 267 -- system - system (non-sibling) libraries 268 268 -- dependencies - all sibling dependencies, including non-linkable 269 -- static - siblings that are static libraries 269 270 -- all - return everything 270 271 -- 271 272 -- Part may be one of: … … 288 289 local namestyle = premake.getnamestyle(cfg) 289 290 290 291 local function canlink(source, target) 291 if (target.kind ~= "SharedLib" and target.kind ~= "StaticLib") then 292 if (kind == "static" and target.kind ~= "StaticLib") then 293 return false 294 elseif (target.kind ~= "SharedLib" and target.kind ~= "StaticLib") then 292 295 return false 293 296 end 294 297 if premake.iscppproject(source) then