Skip to content

Commit

Permalink
[Build] Add Windows ARM64 support
Browse files Browse the repository at this point in the history
Separates the `Windows` platform into `Windows-x86_64` and
`Windows-ARM64`. Adds `--arch` argument to `build`.
  • Loading branch information
Wunkolo committed Apr 27, 2024
1 parent f6b5424 commit 6f8cc82
Show file tree
Hide file tree
Showing 13 changed files with 32 additions and 20 deletions.
19 changes: 14 additions & 5 deletions premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ filter("configurations:Checked")
defines({
"DEBUG",
})
filter({"configurations:Checked", "platforms:Windows"})
filter({"configurations:Checked", "platforms:Windows-*"})
buildoptions({
"/RTCsu", -- Full Run-Time Checks.
})
Expand Down Expand Up @@ -153,7 +153,7 @@ filter("platforms:Android-*")
"log",
})

filter("platforms:Windows")
filter("platforms:Windows-*")
system("windows")
toolset("msc")
buildoptions({
Expand All @@ -179,8 +179,12 @@ filter("platforms:Windows")
"_CRT_SECURE_NO_WARNINGS",
"WIN32",
"_WIN64=1",
"_AMD64=1",
})
filter("architecture:x86_64")
defines({
"_AMD64=1",
})
filter({})
linkoptions({
"/ignore:4006", -- Ignores complaints about empty obj files.
"/ignore:4221",
Expand All @@ -198,7 +202,7 @@ filter("platforms:Windows")
})

-- Embed the manifest for things like dependencies and DPI awareness.
filter({"platforms:Windows", "kind:ConsoleApp or WindowedApp"})
filter({"platforms:Windows-*", "kind:ConsoleApp or WindowedApp"})
files({
"src/xenia/base/app_win32.manifest"
})
Expand Down Expand Up @@ -228,7 +232,12 @@ workspace("xenia")
["ARCHS"] = "x86_64"
})
elseif os.istarget("windows") then
platforms({"Windows"})
platforms({"Windows-ARM64", "Windows-x86_64"})
filter("platforms:Windows-ARM64")
architecture("ARM64")
filter("platforms:Windows-x86_64")
architecture("x86_64")
filter({})
-- 10.0.15063.0: ID3D12GraphicsCommandList1::SetSamplePositions.
-- 10.0.19041.0: D3D12_HEAP_FLAG_CREATE_NOT_ZEROED.
-- 10.0.22000.0: DWMWA_WINDOW_CORNER_PREFERENCE.
Expand Down
8 changes: 4 additions & 4 deletions src/xenia/app/premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ project("xenia-app")
"xenia_main.cc",
})

filter("platforms:Windows")
filter("platforms:Windows-*")
files({
"main_resources.rc",
})
Expand All @@ -104,7 +104,7 @@ project("xenia-app")
"SDL2",
})

filter("platforms:Windows")
filter("platforms:Windows-*")
links({
"xenia-apu-xaudio2",
"xenia-gpu-d3d12",
Expand All @@ -113,13 +113,13 @@ project("xenia-app")
"xenia-ui-d3d12",
})

filter({"platforms:Windows", SINGLE_LIBRARY_FILTER})
filter({"platforms:Windows-*", SINGLE_LIBRARY_FILTER})
links({
"xenia-gpu-d3d12-trace-viewer",
"xenia-ui-window-d3d12-demo",
})

filter("platforms:Windows")
filter("platforms:Windows-*")
-- Only create the .user file if it doesn't already exist.
local user_file = project_root.."/build/xenia-app.vcxproj.user"
if not os.isfile(user_file) then
Expand Down
2 changes: 1 addition & 1 deletion src/xenia/cpu/ppc/testing/premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ project("xenia-cpu-ppc-tests")
links({
"xenia-cpu-backend-x64",
})
filter("platforms:Windows")
filter("platforms:Windows-*")
debugdir(project_root)
debugargs({
"2>&1",
Expand Down
2 changes: 1 addition & 1 deletion src/xenia/gpu/premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ project("xenia-gpu-shader-compiler")
"../base/console_app_main_"..platform_suffix..".cc",
})

filter("platforms:Windows")
filter("platforms:Windows-*")
-- Only create the .user file if it doesn't already exist.
local user_file = project_root.."/build/xenia-gpu-shader-compiler.vcxproj.user"
if not os.isfile(user_file) then
Expand Down
4 changes: 2 additions & 2 deletions src/xenia/gpu/vulkan/premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ project("xenia-gpu-vulkan-trace-viewer")
"X11-xcb",
})

filter("platforms:Windows")
filter("platforms:Windows-*")
-- Only create the .user file if it doesn't already exist.
local user_file = project_root.."/build/xenia-gpu-vulkan-trace-viewer.vcxproj.user"
if not os.isfile(user_file) then
Expand Down Expand Up @@ -138,7 +138,7 @@ project("xenia-gpu-vulkan-trace-dump")
"X11-xcb",
})

filter("platforms:Windows")
filter("platforms:Windows-*")
-- Only create the .user file if it doesn't already exist.
local user_file = project_root.."/build/xenia-gpu-vulkan-trace-dump.vcxproj.user"
if not os.isfile(user_file) then
Expand Down
2 changes: 1 addition & 1 deletion src/xenia/hid/premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ project("xenia-hid-demo")
"X11-xcb",
})

filter("platforms:Windows")
filter("platforms:Windows-*")
links({
"xenia-hid-winkey",
"xenia-hid-xinput",
Expand Down
2 changes: 1 addition & 1 deletion src/xenia/ui/premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ project("xenia-ui")
-- Exports JNI functions.
wholelib("On")

filter("platforms:Windows")
filter("platforms:Windows-*")
links({
"dwmapi",
"dxgi",
Expand Down
2 changes: 1 addition & 1 deletion third_party/SDL2.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ end
-- Call this function in project scope to include the SDL2 headers.
--
function sdl2_include()
filter("platforms:Windows")
filter("platforms:Windows-*")
includedirs({
path.getrelative(".", third_party_path) .. "/SDL2/include",
})
Expand Down
2 changes: 1 addition & 1 deletion third_party/discord-rpc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ project("discord-rpc")
files({
"discord-rpc/src/discord_register_osx.m"
})
filter("platforms:Windows")
filter("platforms:Windows-*")
files({
"discord-rpc/src/connection_win.cpp",
"discord-rpc/src/discord_register_win.cpp"
Expand Down
2 changes: 1 addition & 1 deletion third_party/mspack.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ project("mspack")
"mspack/system.h",
})

filter("platforms:Windows")
filter("platforms:Windows-*")
defines({
})
filter("platforms:Linux")
Expand Down
2 changes: 1 addition & 1 deletion third_party/snappy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ project("snappy")
"snappy/snappy.h",
})

filter("platforms:Windows")
filter("platforms:Windows-*")
warnings("Off") -- Too many warnings.
2 changes: 1 addition & 1 deletion tools/build/scripts/platform_files.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ local function match_platform_files(base_path, base_match)
removefiles({base_path.."/".."**_android.h", base_path.."/".."**_android.cc"})
removefiles({base_path.."/".."**_mac.h", base_path.."/".."**_mac.cc"})
removefiles({base_path.."/".."**_win.h", base_path.."/".."**_win.cc"})
filter("platforms:Windows")
filter("platforms:Windows-*")
files({
base_path.."/"..base_match.."_win.h",
base_path.."/"..base_match.."_win.cc",
Expand Down
3 changes: 3 additions & 0 deletions xenia-build
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,8 @@ class BaseBuildCommand(Command):
self.parser.add_argument(
'--target', action='append', default=[],
help='Builds only the given target(s).')
self.parser.add_argument(
'--arch', default='x86_64', help='Builds only the given architecture')
self.parser.add_argument(
'--force', action='store_true',
help='Forces a full rebuild.')
Expand Down Expand Up @@ -823,6 +825,7 @@ class BaseBuildCommand(Command):
'/m',
'/v:m',
'/p:Configuration=' + args['config'],
'/p:Platform=' + "Windows-" + args['arch'],
] + ([targets] if targets is not None else []) + pass_args,
shell=False)
elif sys.platform == 'darwin':
Expand Down

0 comments on commit 6f8cc82

Please sign in to comment.