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 --- .../genie/src/actions/xcode/xcode_workspace.lua | 145 +++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 3rdparty/genie/src/actions/xcode/xcode_workspace.lua (limited to '3rdparty/genie/src/actions/xcode/xcode_workspace.lua') diff --git a/3rdparty/genie/src/actions/xcode/xcode_workspace.lua b/3rdparty/genie/src/actions/xcode/xcode_workspace.lua new file mode 100644 index 00000000000..ed0542258e7 --- /dev/null +++ b/3rdparty/genie/src/actions/xcode/xcode_workspace.lua @@ -0,0 +1,145 @@ +local premake = premake +local xcode = premake.xcode + +xcode.allscheme = false + +function xcode.workspace_head() + _p('') + _p('') +end + +function xcode.workspace_tail() + _p('') +end + +function xcode.workspace_file_ref(prj, indent) + local projpath = path.getrelative(prj.solution.location, prj.location) + if projpath == '.' then projpath = '' + else projpath = projpath ..'/' + end + _p(indent, '', projpath .. prj.name .. '.xcodeproj') + _p(indent, '') +end + +function xcode.workspace_group(grp, indent) + _p(indent, '', grp.name) + + local function comparenames(a, b) + return a.name < b.name + end + + local groups = table.join(grp.groups) + local projects = table.join(grp.projects) + table.sort(groups, comparenames) + table.sort(projects, comparenames) + + for _, child in ipairs(groups) do + xcode.workspace_group(child, indent + 1) + end + + for _, prj in ipairs(projects) do + xcode.workspace_file_ref(prj, indent + 1) + end + + _p(indent, '') +end + +function xcode.workspace_generate(sln) + xcode.preparesolution(sln) + xcode.workspace_head() + xcode.reorderProjects(sln) + + for grp in premake.solution.eachgroup(sln) do + if grp.parent == nil then + xcode.workspace_group(grp, 1) + end + end + + for prj in premake.solution.eachproject(sln) do + if prj.group == nil then + xcode.workspace_file_ref(prj, 1) + end + end + + xcode.workspace_tail() +end + + +-- +-- Generate the `-ALL` scheme, building all targets. +-- + +function xcode.workspace_scheme(sln) + if not xcode.allscheme then + return false + end + + local projects = {} + local primary = nil + + for prj in premake.solution.eachproject(sln) do + if not primary or (sln.startproject == prj.name) then + primary = prj + end + table.insert(projects, prj) + end + + xcode.scheme(projects, primary) +end + +-- +-- Generate the workspace settings file, preventing xcode from auto-generating +-- schemes we have manually provided. +-- + +function xcode.workspace_settings(sln) + _p('') + _p('') + _p('') + _p('') + _p(1, 'IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded') + _p(1, '') + _p('') + _p('') +end + +-- +-- If a startup project is specified, move it to the front of the project list. +-- This will make Visual Studio treat it like a startup project. +-- + +function xcode.reorderProjects(sln) + if sln.startproject then + for i, prj in ipairs(sln.projects) do + if sln.startproject == prj.name then + -- Move group tree containing the project to start of group list + local cur = prj.group + while cur ~= nil do + -- Remove group from array + for j, group in ipairs(sln.groups) do + if group == cur then + table.remove(sln.groups, j) + break + end + end + + -- Add back at start + table.insert(sln.groups, 1, cur) + cur = cur.parent + end + -- Move the project itself to start + table.remove(sln.projects, i) + table.insert(sln.projects, 1, prj) + break + end + end + end +end + + + + -- cgit v1.2.3-70-g09d2