From ed2b7e5ef1626c0d6318b6ea71897efbb4356277 Mon Sep 17 00:00:00 2001 From: Julian Sikorski Date: Sun, 29 Sep 2019 15:30:18 +0200 Subject: 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 --- 3rdparty/genie/src/actions/xcode/xcode_scheme.lua | 239 ++++++++++++++++++++++ 1 file changed, 239 insertions(+) create mode 100644 3rdparty/genie/src/actions/xcode/xcode_scheme.lua (limited to '3rdparty/genie/src/actions/xcode/xcode_scheme.lua') diff --git a/3rdparty/genie/src/actions/xcode/xcode_scheme.lua b/3rdparty/genie/src/actions/xcode/xcode_scheme.lua new file mode 100644 index 00000000000..662582e2afb --- /dev/null +++ b/3rdparty/genie/src/actions/xcode/xcode_scheme.lua @@ -0,0 +1,239 @@ +-- +-- xcode_scheme.lua +-- + +local premake = premake +local xcode = premake.xcode + + +-- +-- Print a BuildableReference element. +-- + + local function buildableref(indent, prj, cfg) + cfg = cfg or premake.eachconfig(prj)() + + _p(indent + 0, '', prj.name) + _p(indent + 0, '') + end + + +-- +-- Print a CommandLineArgs element, if needed by the provided config. +-- + + local function cmdlineargs(indent, cfg) + if #cfg.debugargs > 0 then + _p(indent, '') + for _, arg in ipairs(cfg.debugargs) do + _p(indent + 1, '') + _p(indent + 1, '') + end + _p(indent, '') + end + end + + +-- +-- Print an EnvironmentVariables element, if needed by the provided config. + + local function envvars(indent, cfg) + if #cfg.debugenvs > 0 then + _p(indent, '') + for _, arg in ipairs(cfg.debugenvs) do + local eq = arg:find("=") + local k = arg:sub(1, eq) + local v = arg:sub(eq + 1) + _p(indent + 1, '') + _p(indent + 1, '') + end + _p(indent, '') + end + end + + +-- +-- Generate the customWorkingDir path from the given dir. +-- + + local function workingdir(dir) + if not path.isabsolute(dir) then + dir = "$PROJECT_DIR/" .. dir + end + return dir + end + + +-- +-- Determine the best matching configuration. +-- +-- @param fordebug +-- True to find a debug configuration. +-- + + local function bestconfig(prj, fordebug) + local bestcfg = nil + local bestscore = -1 + + for cfg in premake.eachconfig(prj) do + local score = 0 + + if cfg.platform == "Native" then + score = score + 10 + end + + if fordebug and cfg.name == "Debug" then + score = score + 1 + end + + if not fordebug and cfg.name == "Release" then + score = score + 1 + end + + if score > bestscore then + bestcfg = cfg + bestscore = score + end + end + + return bestcfg + end + + +-- +-- Print out an xcscheme file. +-- +-- @param tobuild +-- The list of targets to build. Assumed to be sorted. +-- @param primary +-- The target to set as test/profile/launch target. +-- + + function xcode.scheme(tobuild, primary, schemecfg) + _p('') + _p('') + _p(1, '') + _p(2, '') + + for _, prj in ipairs(tobuild) do + _p(3, '') + buildableref(4, prj) + _p(3, '') + end + + local debugcfg = schemecfg or bestconfig(primary, true) + local releasecfg = schemecfg or bestconfig(primary, false) + local debugname = xcode.getconfigname(debugcfg) + local releasename = xcode.getconfigname(releasecfg) + + _p(2, '') + _p(1, '') + _p(1, '') + _p(2, '') + _p(2, '') + _p(2, '') + buildableref(3, primary, debugcfg) + _p(2, '') + _p(2, '') + _p(2, '') + _p(1, '') + _p(1, '') + if debugcfg.debugcmd then + _p(2, '', debugcfg.debugcmd) + _p(2, '') + else + _p(2, '') + buildableref(3, primary, debugcfg) + _p(2, '') + end + cmdlineargs(2, debugcfg) + envvars(2, debugcfg) + _p(2, '') + _p(2, '') + _p(1, '') + _p(1, '') + _p(2, '') + buildableref(3, primary, releasecfg) + _p(2, '') + cmdlineargs(2, releasecfg) + envvars(2, releasecfg) + _p(1, '') + _p(1, '', debugname) + _p(1, '') + _p(1, '') + _p(1, '') + _p('') + end + +-- +-- Generate XCode schemes for the given project. +-- + + function xcode.generate_schemes(prj, base_path) + if (prj.kind == "ConsoleApp" or prj.kind == "WindowedApp") or (prj.options and prj.options.XcodeLibrarySchemes) then + + if prj.options and prj.options.XcodeSchemeNoConfigs then + premake.generate(prj, path.join(base_path, "%%.xcscheme"), + function(prj) xcode.scheme({prj}, prj) end) + else + for cfg in premake.eachconfig(prj) do + premake.generate(prj, path.join(base_path, "%% " .. cfg.name .. ".xcscheme"), + function(prj) xcode.scheme({prj}, prj, cfg) end) + end + end + end + end -- cgit v1.2.3-70-g09d2