diff options
author | 2019-09-29 15:30:18 +0200 | |
---|---|---|
committer | 2019-09-29 09:30:18 -0400 | |
commit | ed2b7e5ef1626c0d6318b6ea71897efbb4356277 (patch) | |
tree | 62a84a4a2c804922839dbfa60ec664b84beaaee0 /3rdparty/genie/src/actions/make/make_csharp.lua | |
parent | 1bd1288c9e17bdba9544d1e56be7618106fece7e (diff) |
Synced with GENie upstream revision e78d6c1 (#5631)
* Synced with GENie upstream revision e78d6c1
* Add Visual Studio 2019 support
* Fix hardcoded -m64
* Switch appveyor to Visual Studio 2019
* Fix genie being built as 32-bit
* MSVC build is known to be broken currently. Let it fail until all the known issues are fixed.
* Update the packages before building
* Build with 3 threads
Appveyor VMs have only 2 cores and 8 GB RAM.
* Enable caching of pacman cache
Diffstat (limited to '3rdparty/genie/src/actions/make/make_csharp.lua')
-rw-r--r-- | 3rdparty/genie/src/actions/make/make_csharp.lua | 56 |
1 files changed, 29 insertions, 27 deletions
diff --git a/3rdparty/genie/src/actions/make/make_csharp.lua b/3rdparty/genie/src/actions/make/make_csharp.lua index e241e11dc42..ea6a0fcf410 100644 --- a/3rdparty/genie/src/actions/make/make_csharp.lua +++ b/3rdparty/genie/src/actions/make/make_csharp.lua @@ -8,12 +8,12 @@ -- Given a .resx resource file, builds the path to corresponding .resource -- file, matching the behavior and naming of Visual Studio. -- - + local function getresourcefilename(cfg, fname) if path.getextension(fname) == ".resx" then - local name = cfg.buildtarget.basename .. "." - local dir = path.getdirectory(fname) - if dir ~= "." then + local name = cfg.buildtarget.basename .. "." + local dir = path.getdirectory(fname) + if dir ~= "." then name = name .. path.translate(dir, ".") .. "." end return "$(OBJDIR)/" .. _MAKE.esc(name .. path.getbasename(fname)) .. ".resources" @@ -27,7 +27,7 @@ -- -- Main function -- - + function premake.make_csharp(prj) local csc = premake.dotnet @@ -47,12 +47,12 @@ end end end - + -- sort the files into categories, based on their build action local sources = {} local embedded = { } local copypairs = { } - + for fcfg in premake.project.eachfile(prj) do local action = csc.getbuildaction(fcfg) if action == "Compile" then @@ -78,19 +78,19 @@ copypairs[target] = _MAKE.esc(source) end end - + -- end of preprocessing -- -- set up the environment _p('# %s project makefile autogenerated by GENie', premake.action.current().shortname) _p('') - + _p('ifndef config') _p(' config=%s', _MAKE.esc(prj.configurations[1]:lower())) _p('endif') _p('') - + _p('ifndef verbose') _p(' SILENT = @') _p('endif') @@ -122,7 +122,7 @@ _p(' CSC=%s', csc.getcompilervar(prj)) _p('endif') _p('') - + _p('ifndef RESGEN') _p(' RESGEN=resgen') _p('endif') @@ -145,14 +145,14 @@ _p('FLAGS += /t:%s %s', csc.getkind(prj):lower(), table.implode(_MAKE.esc(prj.libdirs), "/lib:", "", " ")) _p('REFERENCES += %s', table.implode(_MAKE.esc(premake.getlinks(prj, "system", "basename")), "/r:", ".dll", " ")) _p('') - + -- list source files _p('SOURCES := \\') for _, fname in ipairs(sources) do _p('\t%s \\', _MAKE.esc(path.translate(fname))) end _p('') - + _p('EMBEDFILES := \\') for _, fname in ipairs(embedded) do _p('\t%s \\', getresourcefilename(prj, fname)) @@ -184,10 +184,10 @@ -- main build rule(s) _p('.PHONY: clean prebuild prelink') _p('') - + _p('all: $(TARGETDIR) $(OBJDIR) prebuild $(EMBEDFILES) $(COPYFILES) prelink $(TARGET)') _p('') - + _p('$(TARGET): $(SOURCES) $(EMBEDFILES) $(DEPENDS)') _p('\t$(SILENT) $(CSC) /nologo /out:$@ $(FLAGS) $(REFERENCES) $(SOURCES) $(patsubst %%,/resource:%%,$(EMBEDFILES))') _p('\t$(POSTBUILDCMDS)') @@ -197,7 +197,7 @@ -- escaping, causing issues with spaces and parenthesis _p('$(TARGETDIR):') premake.make_mkdirrule("$(TARGETDIR)") - + _p('$(OBJDIR):') premake.make_mkdirrule("$(OBJDIR)") @@ -205,7 +205,7 @@ _p('clean:') _p('\t@echo Cleaning %s', prj.name) _p('ifeq (posix,$(SHELLTYPE))') - _p('\t$(SILENT) rm -f $(TARGETDIR)/%s.* $(COPYFILES)', prj.buildtarget.basename) + _p('\t$(SILENT) rm -f $(TARGET) $(COPYFILES)') _p('\t$(SILENT) rm -rf $(OBJDIR)') _p('else') _p('\t$(SILENT) if exist $(subst /,\\\\,$(TARGETDIR)/%s.*) del $(subst /,\\\\,$(TARGETDIR)/%s.*)', prj.buildtarget.basename, prj.buildtarget.basename) @@ -223,7 +223,7 @@ _p('prebuild:') _p('\t$(PREBUILDCMDS)') _p('') - + _p('prelink:') _p('\t$(PRELINKCMDS)') _p('') @@ -238,21 +238,21 @@ _p('endif') _p('') end - + _p('# Copied file rules') for target, source in pairs(copypairs) do premake.make_copyrule(source, target) end _p('# Embedded file rules') - for _, fname in ipairs(embedded) do + for _, fname in ipairs(embedded) do if path.getextension(fname) == ".resx" then _p('%s: %s', getresourcefilename(prj, fname), _MAKE.esc(fname)) _p('\t$(SILENT) $(RESGEN) $^ $@') end _p('') end - + end @@ -261,35 +261,37 @@ -- function premake.gmake_cs_config(cfg, csc, cfglibs) - + + local targetDir = _MAKE.esc(cfg.buildtarget.directory) + _p('ifneq (,$(findstring %s,$(config)))', _MAKE.esc(cfg.name:lower())) - _p(' TARGETDIR := %s', _MAKE.esc(cfg.buildtarget.directory)) + _p(' TARGETDIR := %s', iif(targetDir == "", ".", targetDir)) _p(' OBJDIR := %s', _MAKE.esc(cfg.objectsdir)) _p(' DEPENDS := %s', table.concat(_MAKE.esc(premake.getlinks(cfg, "dependencies", "fullpath")), " ")) _p(' REFERENCES := %s', table.implode(_MAKE.esc(cfglibs[cfg]), "/r:", "", " ")) _p(' FLAGS += %s %s', table.implode(cfg.defines, "/d:", "", " "), table.concat(table.join(csc.getflags(cfg), cfg.buildoptions), " ")) - + _p(' define PREBUILDCMDS') if #cfg.prebuildcommands > 0 then _p('\t@echo Running pre-build commands') _p('\t%s', table.implode(cfg.prebuildcommands, "", "", "\n\t")) end _p(' endef') - + _p(' define PRELINKCMDS') if #cfg.prelinkcommands > 0 then _p('\t@echo Running pre-link commands') _p('\t%s', table.implode(cfg.prelinkcommands, "", "", "\n\t")) end _p(' endef') - + _p(' define POSTBUILDCMDS') if #cfg.postbuildcommands > 0 then _p('\t@echo Running post-build commands') _p('\t%s', table.implode(cfg.postbuildcommands, "", "", "\n\t")) end _p(' endef') - + _p('endif') _p('') |