From 14abe1a4076c52a30e0391356b8b2bd2938aeb55 Mon Sep 17 00:00:00 2001 From: DrChat Date: Tue, 3 Apr 2018 19:02:49 -0500 Subject: [PATCH] Fixup 360 support --- premake5.lua | 33 +++++++++++-------- src/xenia/app/premake5.lua | 9 +++++ src/xenia/base/platform_linux.h | 1 + .../ppc/testing/ppc_testing_native_main.cc | 2 +- src/xenia/gpu/gl4/premake5.lua | 9 +++++ src/xenia/gpu/vulkan/premake5.lua | 18 ++++++++++ xenia-build | 22 ++++++------- 7 files changed, 68 insertions(+), 26 deletions(-) diff --git a/premake5.lua b/premake5.lua index e28db9335..f68849e99 100644 --- a/premake5.lua +++ b/premake5.lua @@ -28,9 +28,11 @@ defines({ }) -- TODO(DrChat): Find a way to disable this on other architectures. -filter("architecture:x86_64") - vectorextensions("AVX") -filter({}) +if ARCH ~= "ppc64" then + filter("architecture:x86_64") + vectorextensions("AVX") + filter({}) +end characterset("Unicode") flags({ @@ -95,13 +97,6 @@ filter("platforms:Linux") "dl", "lz4", "rt", - "X11", - "xcb", - "X11-xcb", - "GL", - "vulkan", - "c++", - "c++abi" }) linkoptions({ "`pkg-config --libs gtk+-3.0`", @@ -110,19 +105,31 @@ filter("platforms:Linux") filter({"platforms:Linux", "kind:*App"}) linkgroups("On") -filter({"platforms:Linux", "language:C++", "toolset:gcc"}) +filter({"platforms:Linux", "toolset:gcc"}) buildoptions({ - "--std=c++11", + "-std=c++14", }) links({ }) + if ARCH == "ppc64" then + buildoptions({ + "-m32", + "-mpowerpc64" + }) + linkoptions({ + "-m32", + "-mpowerpc64" + }) + end -filter({"platforms:Linux", "language:C++", "toolset:clang"}) +filter({"platforms:Linux", "toolset:clang"}) buildoptions({ "-std=c++14", "-stdlib=libstdc++", }) links({ + "c++", + "c++abi" }) disablewarnings({ "deprecated-register" diff --git a/src/xenia/app/premake5.lua b/src/xenia/app/premake5.lua index a999512c4..4f5498b99 100644 --- a/src/xenia/app/premake5.lua +++ b/src/xenia/app/premake5.lua @@ -60,6 +60,15 @@ project("xenia-app") project_root, }) + filter("platforms:Linux") + links({ + "X11", + "xcb", + "X11-xcb", + "GL", + "vulkan", + }) + filter("platforms:Windows") links({ "xenia-apu-xaudio2", diff --git a/src/xenia/base/platform_linux.h b/src/xenia/base/platform_linux.h index 345be94ab..ac64879e5 100644 --- a/src/xenia/base/platform_linux.h +++ b/src/xenia/base/platform_linux.h @@ -13,6 +13,7 @@ // NOTE: if you're including this file it means you are explicitly depending // on Linux headers. Including this file outside of linux platform specific // source code will break portability +#include #include "xenia/base/platform.h" diff --git a/src/xenia/cpu/ppc/testing/ppc_testing_native_main.cc b/src/xenia/cpu/ppc/testing/ppc_testing_native_main.cc index 28ba3887b..25934f252 100644 --- a/src/xenia/cpu/ppc/testing/ppc_testing_native_main.cc +++ b/src/xenia/cpu/ppc/testing/ppc_testing_native_main.cc @@ -189,7 +189,7 @@ class TestRunner { ~TestRunner() { memory::DeallocFixed(memory_, memory_size_, - memory::DeallocationType::kDecommitRelease); + memory::DeallocationType::kRelease); memory::AlignedFree(context_); } diff --git a/src/xenia/gpu/gl4/premake5.lua b/src/xenia/gpu/gl4/premake5.lua index 6c61b285a..041ef8b2d 100644 --- a/src/xenia/gpu/gl4/premake5.lua +++ b/src/xenia/gpu/gl4/premake5.lua @@ -68,6 +68,15 @@ project("xenia-gpu-gl4-trace-viewer") "../../base/main_"..platform_suffix..".cc", }) + filter("platforms:Linux") + links({ + "X11", + "xcb", + "X11-xcb", + "GL", + "vulkan", + }) + filter("platforms:Windows") links({ "xenia-apu-xaudio2", diff --git a/src/xenia/gpu/vulkan/premake5.lua b/src/xenia/gpu/vulkan/premake5.lua index 3e41ca44d..146ac2bd7 100644 --- a/src/xenia/gpu/vulkan/premake5.lua +++ b/src/xenia/gpu/vulkan/premake5.lua @@ -71,6 +71,15 @@ project("xenia-gpu-vulkan-trace-viewer") "../../base/main_"..platform_suffix..".cc", }) + filter("platforms:Linux") + links({ + "X11", + "xcb", + "X11-xcb", + "GL", + "vulkan", + }) + filter("platforms:Windows") links({ "xenia-apu-xaudio2", @@ -131,6 +140,15 @@ project("xenia-gpu-vulkan-trace-dump") "../../base/main_"..platform_suffix..".cc", }) + filter("platforms:Linux") + links({ + "X11", + "xcb", + "X11-xcb", + "GL", + "vulkan", + }) + 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" diff --git a/xenia-build b/xenia-build index 0882231a0..167259edf 100755 --- a/xenia-build +++ b/xenia-build @@ -310,7 +310,7 @@ def get_clang_format_binary(): sys.exit(1) -def run_premake(target_os, action): +def run_premake(target_os, action, cc=None): """Runs premake on the main project with the given format. Args: @@ -322,7 +322,7 @@ def run_premake(target_os, action): os.path.join('tools', 'build', 'premake'), '--file=premake5.lua', '--os=%s' % target_os, - '--cc=clang', + '--cc=%s' % ('clang' if not cc else cc), '--test-suite-mode=combined', '--verbose', action, @@ -344,7 +344,7 @@ def run_premake_clean(): return run_premake('linux', 'clean') -def run_platform_premake(): +def run_platform_premake(cc=None): """Runs all gyp configurations. """ if sys.platform == 'darwin': @@ -356,7 +356,7 @@ def run_platform_premake(): return run_premake('windows', 'vs' + vs_version) else: - ret = run_premake('linux', 'gmake') + ret = run_premake('linux', 'gmake', cc) ret = ret != 0 and run_premake('linux', 'codelite') or ret return ret @@ -546,12 +546,14 @@ class PremakeCommand(Command): name='premake', help_short='Runs premake to update all projects.', *args, **kwargs) + self.parser.add_argument( + '--cc', default='clang', help='Compiler toolchain passed to premake') def execute(self, args, pass_args, cwd): # Update premake. If no binary found, it will be built from source. print('Running premake...') print('') - if run_platform_premake() == 0: + if run_platform_premake(args['cc']) == 0: print('Success!') return 0 @@ -564,6 +566,8 @@ class BaseBuildCommand(Command): super(BaseBuildCommand, self).__init__( subparsers, *args, **kwargs) + self.parser.add_argument( + '--cc', default='clang', help='Compiler toolchain passed to premake') self.parser.add_argument( '--config', choices=['checked', 'debug', 'release'], default='debug', type=str.lower, help='Chooses the build configuration.') @@ -582,7 +586,7 @@ class BaseBuildCommand(Command): def execute(self, args, pass_args, cwd): if not args['no_premake']: print('- running premake...') - run_platform_premake() + run_platform_premake(args['cc']) print('') threads = args['j'] @@ -613,12 +617,6 @@ class BaseBuildCommand(Command): print('ERROR: don\'t know how to build on this platform.') result = 1 else: - # TODO(benvanik): allow gcc? - if 'CXX' not in os.environ: - os.environ['CXX'] = 'clang++-3.8' - if 'CC' not in os.environ: - os.environ['CC'] = 'clang-3.8' - result = subprocess.call([ 'make', '-j' if threads is 0 else '-j%d' % threads,