Ticket #1518: 0ad_premake.diff

File 0ad_premake.diff, 24.4 KB (added by leper, 12 years ago)
  • premake4.lua

    diff -r fc0374a03b17 premake4.lua
    a b  
    4949        configuration "vs*"
    5050            defines     { "_CRT_SECURE_NO_WARNINGS" }
    5151
     52        configuration "bsd"
     53            defines     { "LUA_USE_POSIX", "LUA_USE_DLOPEN" }
     54            links       { "m" }
     55           
    5256        configuration "linux"
    5357            defines     { "LUA_USE_POSIX", "LUA_USE_DLOPEN" }
    54             links       { "m", "dl" } 
     58            links       { "m", "dl" }
    5559           
    5660        configuration "macosx"
    5761            defines     { "LUA_USE_MACOSX" }
  • src/actions/codeblocks/codeblocks_cbp.lua

    diff -r fc0374a03b17 src/actions/codeblocks/codeblocks_cbp.lua
    a b  
    3434               
    3535                _p(4,'<Option output="%s" prefix_auto="0" extension_auto="0" />', premake.esc(cfg.buildtarget.fullpath))
    3636                _p(4,'<Option object_output="%s" />', premake.esc(cfg.objectsdir))
     37                _p(4,'<Option external_deps="%s" />', table.concat(premake.getlinks(cfg, "siblings", "fullpath"),";"))
    3738
    3839                -- identify the type of binary
    3940                local types = { WindowedApp = 0, ConsoleApp = 1, StaticLib = 2, SharedLib = 3 }
     
    6364               
    6465                -- begin linker block --
    6566                _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" />')
    6672                for _,flag in ipairs(table.join(cc.getldflags(cfg), cfg.linkoptions)) do
    6773                    _p(5,'<Add option="%s" />', premake.esc(flag))
    6874                end
    6975                for _,v in ipairs(premake.getlinks(cfg, "all", "directory")) do
    7076                    _p(5,'<Add directory="%s" />', premake.esc(v))
    7177                end
    72                 for _,v in ipairs(premake.getlinks(cfg, "all", "basename")) do
     78                for _,v in ipairs(premake.getlinks(cfg, "system", "basename")) do
    7379                    _p(5,'<Add library="%s" />', premake.esc(v))
    7480                end
    7581                _p(4,'</Linker>')
  • src/actions/make/make_cpp.lua

    diff -r fc0374a03b17 src/actions/make/make_cpp.lua
    a b  
    2626        -- list intermediate files
    2727        _p('OBJECTS := \\')
    2828        for _, file in ipairs(prj.files) do
    29             if path.iscppfile(file) then
     29            if path.iscppfile(file) or path.getextension(file) == ".asm" then
    3030                _p('\t$(OBJDIR)/%s.o \\', _MAKE.esc(path.getbasename(file)))
    3131            end
    3232        end
     
    5555        _p('')
    5656
    5757        if os.is("MacOSX") and prj.kind == "WindowedApp" then
    58             _p('all: $(TARGETDIR) $(OBJDIR) prebuild prelink $(TARGET) $(dir $(TARGETDIR))PkgInfo $(dir $(TARGETDIR))Info.plist')
     58            _p('all: $(TARGET) $(dir $(TARGETDIR))PkgInfo $(dir $(TARGETDIR))Info.plist')
    5959        else
    60             _p('all: $(TARGETDIR) $(OBJDIR) prebuild prelink $(TARGET)')
     60            _p('all: $(TARGET)')
    6161        end
    6262        _p('\t@:')
    6363        _p('')
    6464
    6565        -- target build rule
    66         _p('$(TARGET): $(GCH) $(OBJECTS) $(LDDEPS) $(RESOURCES)')
     66        _p('$(TARGET): $(OBJECTS) $(LDDEPS) $(RESOURCES) | prelink')
    6767        _p('\t@echo Linking %s', prj.name)
    6868        _p('\t$(SILENT) $(LINKCMD)')
    6969        _p('\t$(POSTBUILDCMDS)')
     
    9797        _p('')
    9898
    9999        -- custom build step targets
    100         _p('prebuild:')
     100        _p('prebuild: $(TARGETDIR) $(OBJDIR)')
    101101        _p('\t$(PREBUILDCMDS)')
    102102        _p('')
    103103       
     
    108108        -- precompiler header rule
    109109        _.pchrules(prj)
    110110               
    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
    114135                _p('$(OBJDIR)/%s.o: %s', _MAKE.esc(path.getbasename(file)), _MAKE.esc(file))
    115136                _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'
    118143                else
    119                     _p('\t$(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -c "$<"')
     144                    opts = '-D DONT_USE_UNDERLINE=1 -D OS_UNIX=1'
    120145                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))
    123178                _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))
    125180            end
     181            _p('')
    126182        end
    127         _p('')
    128183       
    129184        -- include the dependencies, built by GCC (with the -MMD flag)
    130185        _p('-include $(OBJECTS:%%.o=%%.d)')
     186        _p('-include $(GCH:%%.h.gch=%%.h.d)')
    131187    end
    132188
    133189
     
    174230    function premake.gmake_cpp_config(cfg, cc)
    175231
    176232        _p('ifeq ($(config),%s)', _MAKE.esc(cfg.shortname))
     233
    177234       
    178235        -- if this platform requires a special compiler or linker, list it now
    179236        local platform = cc.platforms[cfg.platform]
     
    186243        if platform.ar then
    187244            _p('  AR         = %s', platform.ar)
    188245        end
     246        if not(cfg.gnuexternals) then
     247            cfg.gnuexternal = { }       
     248        end
    189249
    190250        _p('  OBJDIR     = %s', _MAKE.esc(cfg.objectsdir))     
    191251        _p('  TARGETDIR  = %s', _MAKE.esc(cfg.buildtarget.directory))
     
    197257        -- set up precompiled headers
    198258        _.pchconfig(cfg)
    199259               
    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), " "))
    201261        _p('  CXXFLAGS  += $(CFLAGS) %s', table.concat(cc.getcxxflags(cfg), " "))
    202262        _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, " "))
    204264        _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, "siblings", "fullpath")), " "))
     265        _p('  LDDEPS    += %s', table.concat(_MAKE.esc(premake.getlinks(cfg, "static", "fullpath")), " "))
    206266       
    207267        if cfg.kind == "StaticLib" then
    208268            if cfg.platform:startswith("Universal") then
     
    213273        else
    214274            -- this was $(TARGET) $(LDFLAGS) $(OBJECTS) ... but was having trouble linking to certain
    215275            -- 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)
    217286        end
    218287       
    219288        _p('  define PREBUILDCMDS')
     
    248317
    249318    function _.pchconfig(cfg)           
    250319        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))
    252321            _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)))
    254323        end
    255324    end
    256325
    257326    function _.pchrules(prj)
    258327        _p('ifneq (,$(PCH))')
    259         _p('$(GCH): $(PCH)')
     328        _p('$(GCH): $(PCH) | $(OBJDIR)')
    260329        _p('\t@echo $(notdir $<)')
    261330        _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('')
    269338    end
  • src/actions/vstudio/_vstudio.lua

    diff -r fc0374a03b17 src/actions/vstudio/_vstudio.lua
    a b  
    227227                    end
    228228                end
    229229            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                            " &quot;$(InputPath)&quot; -o &quot;$(IntDir)\\$(InputName).obj&quot;"
     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
    230261            output(indent, "</File>")
    231262        end
    232263    end
     
    455486        oncleansolution = premake.vstudio.cleansolution,
    456487        oncleanproject  = premake.vstudio.cleanproject,
    457488        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  
    44   
    55       
    66    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/",'')
    910        return file
    1011    end
    1112       
    1213    function vs10_helpers.file_path(file)
    1314        file = vs10_helpers.remove_relative_path(file)
    14         local path = string.find(file,'\\[%w%.%_%-]+$')
     15        local path = string.find(file,'/[%w%.%_%-]+$')
    1516        if path then
    1617            return string.sub(file,1,path-1)
    1718        else
     
    2324        local list={}
    2425        path = vs10_helpers.remove_relative_path(path)
    2526        if path then
    26             for dir in string.gmatch(path,"[%w%-%_%.]+\\")do
     27            for dir in string.gmatch(path,"[%w%-%_%.]+/")do
    2728                if #list == 0 then
    2829                    list[1] = dir:sub(1,#dir-1)
    2930                else
    30                     list[#list +1] = list[#list] .."\\" ..dir:sub(1,#dir-1)             
     31                    list[#list +1] = list[#list] .."/" ..dir:sub(1,#dir-1)             
    3132                end
    3233            end     
    3334        end
     
    5960    end
    6061   
    6162
    62    
    63     --also translates file paths from '/' to '\\'
    6463    function vs10_helpers.sort_input_files(files,sorted_container)
    6564        local types =
    6665        {   
     
    7170            cpp = "ClCompile",
    7271            cxx = "ClCompile",
    7372            cc  = "ClCompile",
    74             rc  = "ResourceCompile"
     73            rc      = "ResourceCompile",
     74            asm     = "ClASM"
    7575        }
    7676
    7777        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)
    8079            if ext then
    8180                local type = types[ext]
    8281                if type then
    83                     table.insert(sorted_container[type],translated_path)
     82                    table.insert(sorted_container[type],current_file)
    8483                else
    85                     table.insert(sorted_container.None,translated_path)
     84                    table.insert(sorted_container.None,current_file)
    8685                end
    8786            end
    8887        end
     
    388387    end
    389388
    390389
    391     local function event_hooks(cfg)
     390    local function event_hooks(cfg, prj)   
    392391        if #cfg.postbuildcommands> 0 then
    393392            _p(2,'<PostBuildEvent>')
    394393                _p(3,'<Command>%s</Command>',premake.esc(table.implode(cfg.postbuildcommands, "", "", "\r\n")))
    395394            _p(2,'</PostBuildEvent>')
    396395        end
    397396       
    398         if #cfg.prebuildcommands> 0 then
     397        if #cfg.prebuildcommands> 0 or prj.cxxtestrootfile then
    399398            _p(2,'<PreBuildEvent>')
    400399                _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 &gt; %s</Command>', cxxtestpath, prj.cxxtestrootoptions, cxxtestrootfile)
     406                end
    401407            _p(2,'</PreBuildEvent>')
    402408        end
    403409       
     
    503509                resource_compile(cfg)
    504510                item_def_lib(cfg)
    505511                item_link(cfg)
    506                 event_hooks(cfg)
     512                event_hooks(cfg, prj)
    507513            _p(1,'</ItemDefinitionGroup>')
    508 
    509            
    510514        end
    511515    end
    512516   
     
    518522  --       <Project>{8fd826f8-3739-44e6-8cc8-997122e53b8d}</Project>
    519523  --     </ProjectReference>
    520524  --   </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
    522544   
    523545    local function write_file_type_block(files,group_type)
    524546        if #files > 0  then
    525547            _p(1,'<ItemGroup>')
    526548            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,"\\"))
    528550            end
    529551            _p(1,'</ItemGroup>')
    530552        end
    531553    end
    532554   
    533555    local function write_file_compile_block(files,prj,configs)
    534    
    535556        if #files > 0  then
    536        
    537557            local config_mappings = {}
    538558            for _, cfginfo in ipairs(configs) do
    539559                local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)
    540560                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
    542562                end
    543563            end
    544564
    545565           
    546566            _p(1,'<ItemGroup>')
    547567            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, "\\"))
    549569                for _, cfginfo in ipairs(configs) do
    550570                    if config_mappings[cfginfo] and current_file == config_mappings[cfginfo] then
    551571                            _p(3,'<PrecompiledHeader '.. if_config_and_platform() .. '>Create</PrecompiledHeader>'
     
    559579            _p(1,'</ItemGroup>')
    560580        end
    561581    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
    562609   
    563610   
    564611    local function vcxproj_files(prj)
     
    566613        {
    567614            ClCompile   ={},
    568615            ClInclude   ={},
     616            ClASM   ={},
    569617            None        ={},
    570618            ResourceCompile ={}
    571619        }
    572620       
    573621        cfg = premake.getconfig(prj)
    574622        vs10_helpers.sort_input_files(cfg.files,sorted)
     623        write_cxxtestgen_block(prj)
    575624        write_file_type_block(sorted.ClInclude,"ClInclude")
    576625        write_file_compile_block(sorted.ClCompile,prj,prj.solution.vstudio_configs)
     626        write_nasm_asm_block(sorted.ClASM, prj, prj.solution.vstudion_configs)
    577627        write_file_type_block(sorted.None,'None')
    578628        write_file_type_block(sorted.ResourceCompile,'ResourceCompile')
    579629
     
    587637        if #directories >0 then
    588638            _p(1,'<ItemGroup>')
    589639            for _, dir in pairs(directories) do
    590                 _p(2,'<Filter Include="%s">',dir)
     640                _p(2,'<Filter Include="%s">',path.translate(dir,"\\"))
    591641                    _p(3,'<UniqueIdentifier>{%s}</UniqueIdentifier>',os.uuid())
    592642                _p(2,'</Filter>')
    593643            end
     
    602652                local path_to_file = vs10_helpers.file_path(current_file)
    603653                if path_to_file then
    604654                    _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,"\\"))
    606656                    _p(2,'</%s>',group_type)
    607657                else
    608658                    _p(2,'<%s Include=\"%s\" />', group_type,path.translate(current_file, "\\"))
     
    620670        {
    621671            ClCompile   ={},
    622672            ClInclude   ={},
     673            ClASM   ={},
    623674            None        ={},
    624675            ResourceCompile ={}
    625676        }
     
    633684            write_filter_includes(sorted)
    634685            write_file_filter_block(sorted.ClInclude,"ClInclude")
    635686            write_file_filter_block(sorted.ClCompile,"ClCompile")
     687            write_file_filter_block(prj.cxxtesthdrfiles,"CustomBuild")
     688            write_file_filter_block(sorted.ClASM,"ClASM")
    636689            write_file_filter_block(sorted.None,"None")
    637690            write_file_filter_block(sorted.ResourceCompile,"ResourceCompile")
    638691        _p('</Project>')
     
    686739    end
    687740   
    688741
    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  
    3232            [".nib"] = "Resources",
    3333            [".xib"] = "Resources",
    3434            [".icns"] = "Resources",
     35            [".asm"] = "Sources"
    3536        }
    3637        return categories[path.getextension(node.name)]
    3738    end
     
    8586            [".strings"]   = "text.plist.strings",
    8687            [".xib"]       = "file.xib",
    8788            [".icns"]      = "image.icns",
     89            [".asm"]       = "sourcecode.asm",
    8890        }
    8991        return types[path.getextension(node.path)] or "text"
    9092    end
     
    263265    end
    264266
    265267
     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
    266287    function xcode.PBXContainerItemProxy(tr)
    267288        if #tr.projects.children > 0 then
    268289            _p('/* Begin PBXContainerItemProxy section */')
     
    432453            end
    433454            _p(3,');')
    434455            _p(3,'buildRules = (')
     456            _p(4,'28AD1E6E1336798800207177 /* PBXBuildRule */,')
    435457            _p(3,');')
    436458           
    437459            _p(3,'dependencies = (')
  • src/actions/xcode/xcode_project.lua

    diff -r fc0374a03b17 src/actions/xcode/xcode_project.lua
    a b  
    147147        local tr = xcode.buildprjtree(prj)
    148148        xcode.Header(tr)
    149149        xcode.PBXBuildFile(tr)
     150        xcode.PBXBuildRule(tr)
    150151        xcode.PBXContainerItemProxy(tr)
    151152        xcode.PBXFileReference(tr)
    152153        xcode.PBXFrameworksBuildPhase(tr)
  • src/base/api.lua

    diff -r fc0374a03b17 src/base/api.lua
    a b  
    4141            kind  = "list",
    4242            scope = "solution",
    4343        },
     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        },
    4480       
    4581        defines =
    4682        {
     
    116152                "4.0"
    117153            }
    118154        },
     155
     156        gnuexternals =
     157        {
     158            kind  = "list",
     159            scope = "config",
     160        },
    119161       
    120162        imagepath =
    121163        {
     
    219261            kind  = "path",
    220262            scope = "container",
    221263        },
     264
     265        nasmformat =
     266        {
     267            kind  = "string",
     268            scope = "solution",
     269        },
     270
     271        nasmpath =
     272        {
     273            kind  = "path",
     274            scope = "solution"
     275        },
    222276       
    223277        objdir =
    224278        {
     
    228282       
    229283        pchheader =
    230284        {
    231             kind  = "string",
     285            kind  = "path",
    232286            scope = "config",
    233287        },
    234288       
  • src/base/project.lua

    diff -r fc0374a03b17 src/base/project.lua
    a b  
    266266--   siblings     - linkable sibling projects
    267267--   system       - system (non-sibling) libraries
    268268--   dependencies - all sibling dependencies, including non-linkable
     269--   static   - siblings that are static libraries
    269270--   all          - return everything
    270271--
    271272-- Part may be one of:
     
    288289        local namestyle = premake.getnamestyle(cfg)
    289290       
    290291        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
    292295                return false
    293296            end
    294297            if premake.iscppproject(source) then