From ef374801aaad8b026fcb4941d932571671fc2ea5 Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Sat, 1 Aug 2015 01:30:47 -0700 Subject: [PATCH] Basic linux build. --- .travis.yml | 27 +++++++++++++++++++-------- premake5.lua | 14 ++++++++++---- xenia-build | 13 +++++++++++-- 3 files changed, 40 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index b01ef103d..7ba03172e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,23 +12,34 @@ os: - linux # - osx -addons: - apt: - sources: - - llvm-toolchain-precise - packages: - - clang-3.8 - - clang-format-3.8 +# TODO(benvanik): re-enable when clang-3.8 is whitelisted. +# https://github.com/travis-ci/apt-package-whitelist/issues/474 +#addons: +# apt: +# sources: +# - llvm-toolchain-precise +# packages: +# - clang-3.8 +# - clang-format-3.8 git: # We handle submodules ourselves in xenia-build setup. submodules: false +before_install: + - sudo add-apt-repository "deb http://llvm.org/apt/precise/ llvm-toolchain-precise main" -y + - wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add - + - sudo apt-get update -qq + +install: + - sudo apt-get install clang-3.8 clang-format-3.8 + before_script: + # Dump useful info. + - $CXX --version # Prepare environment (pull dependencies, build tools). - travis_retry ./xenia-build setup -# Run test suites. script: # Run linter. - ./xenia-build lint --all diff --git a/premake5.lua b/premake5.lua index c0b0c2d07..dc19e92d9 100644 --- a/premake5.lua +++ b/premake5.lua @@ -63,12 +63,16 @@ filter("configurations:Release") runtime("Release") linkoptions({"/NODEFAULTLIB:MSVCRTD"}) +filter("platforms:Linux") + system("linux") + toolset("clang") + buildoptions({ + "-std=c++11", + }) + filter("platforms:Windows") system("windows") toolset("msc") - -- Ignores complaints about empty obj files: - linkoptions({"/ignore:4006", "/ignore:4221"}) - -- Enable multiprocessor compiles (requires Minimal Rebuild to be disabled). buildoptions({ "/MP", -- Multiprocessor compilation. "/wd4100", -- Unreferenced parameters are ok. @@ -88,6 +92,8 @@ filter("platforms:Windows") "_WIN64=1", "_AMD64=1", }) + -- Ignores complaints about empty obj files: + linkoptions({"/ignore:4006", "/ignore:4221"}) links({ "ntdll", "wsock32", @@ -133,7 +139,7 @@ solution("xenia") uuid("931ef4b0-6170-4f7a-aaf2-0fece7632747") startproject("xenia-app") configurations({"Checked", "Debug", "Release"}) - platforms({"Windows"}) + platforms({"Windows", "Linux"}) architecture("x86_64") include("src/xenia") diff --git a/xenia-build b/xenia-build index 40e661e25..ffd8a4543 100755 --- a/xenia-build +++ b/xenia-build @@ -492,9 +492,18 @@ class BaseBuildCommand(Command): args['config'], ] + [('/project ', target) for target in args['target']] + pass_args, throw_on_error=False) - else: + elif sys.platform == 'darwin': # TODO(benvanik): other platforms. print('ERROR: don\'t know how to build on this platform.') + else: + # TODO(benvanik): allow gcc? + os.environ['CXX'] = 'clang++-3.8' + os.environ['CC'] = 'clang-3.8' + result = shell_call([ + 'make', + '-Cbuild/', + 'config=%s_linux' % (args['config']), + ] + pass_args, throw_on_error=False) print('') if result != 0: print('ERROR: build failed with one or more errors.') @@ -734,7 +743,7 @@ class NukeCommand(Command): print('- git reset to master...') shell_call([ 'git', - 'checkout', + 'reset', '--hard', 'master', ])