Skip to content

Commit

Permalink
Enable OSX Builds in travis
Browse files Browse the repository at this point in the history
Still not building correctly though
  • Loading branch information
IceDragon200 committed Apr 10, 2016
1 parent bcda5a9 commit 705f358
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 30 deletions.
33 changes: 22 additions & 11 deletions .travis.yml
Expand Up @@ -5,29 +5,41 @@ addons:
sources:
- george-edison55-precise-backports
packages:
- libopenal-dev
- cmake
- cmake-data
- freeglut3-dev
- freetype
- libdevil-dev
- libglew-dev
- libgles2-mesa-dev
- freeglut3-dev
- libglew-dev
- libglu1-mesa-dev
- libopenal-dev
- libx11-dev
- libxmu-dev
- libxi-dev
- libxmu-dev
- libyaml-dev
- xorg-dev
- libglu1-mesa-dev
- cmake
- cmake-data
matrix:
include:
- compiler: gcc
- os: linux
compiler: gcc
env: MOON_MRUBY_TOOLCHAIN=gcc

- compiler: clang
- os: linux
compiler: clang
env:
- MOON_MRUBY_TOOLCHAIN=clang
- LD_LIBRARY_PATH: "${TRAVIS_BUILD_DIR}/build/vendor/glfw/src"

- os: osx
compiler: clang
env:
- MOON_MRUBY_TOOLCHAIN=clang
- LD_LIBRARY_PATH: "${TRAVIS_BUILD_DIR}/build/vendor/glfw/src"

allow_failures:
- os: osx

branches:
only:
- master
Expand All @@ -37,8 +49,7 @@ before_install:
- git submodule update --init --recursive --depth=1

install:
- gem install bundler
- bundle install --without development --deployment --jobs=3 --retry=3
- ./.travis/install.sh

before_script:
- ruby --version
Expand Down
13 changes: 13 additions & 0 deletions .travis/install.sh
@@ -0,0 +1,13 @@
#!/bin/bash
if [[ $TRAVIS_OS_NAME == 'osx' ]]; then
brew update || exit
for package in libyaml freetype glfw3 cmake ; do
brew outdated "${package}" || brew upgrade "${package}" || exit
done

whereis libfreetype
fi

gem update --system
gem install bundler
bundle install
34 changes: 21 additions & 13 deletions lib/platform.rb
@@ -1,29 +1,37 @@
module Platform
def self.cygwin?
RUBY_PLATFORM.include?('cygwin')
class Platform
def initialize(platform = RUBY_PLATFORM)
@platform_name = platform
end

def self.mingw?
RUBY_PLATFORM.include?('mingw')
def include?(str)
@platform_name.include?(str)
end

def self.msvcr?
RUBY_PLATFORM.include?('msvcr')
def cygwin?
include?('cygwin')
end

def self.windows?
def mingw?
include?('mingw')
end

def msvcr?
include?('msvcr')
end

def windows?
cygwin? || mingw? || msvcr?
end

def self.linux?
RUBY_PLATFORM.include?('linux')
def linux?
include?('linux')
end

def self.darwin?
RUBY_PLATFORM.include?('darwin')
def darwin?
include?('darwin')
end

def self.unix?
def unix?
linux? || darwin?
end
end
12 changes: 6 additions & 6 deletions mrb_config.rb
Expand Up @@ -2,6 +2,7 @@
require_relative 'lib/platform'

toolchain_name = (ENV['MOON_MRUBY_TOOLCHAIN'] || :gcc).to_sym
platform = Platform.new

rootdir = File.dirname(__FILE__)
MRuby::Build.new 'host', File.expand_path("build", rootdir) do |conf|
Expand Down Expand Up @@ -71,7 +72,7 @@

c.defines << 'ENABLE_DEBUG'

if Platform.darwin?
if platform.darwin?
# GLFW
c.defines << 'MOON_GL_GLFW'
else
Expand Down Expand Up @@ -120,23 +121,22 @@
l.libraries << 'SOIL'
l.libraries << 'SIL'


if Platform.linux?
if platform.linux?
l.libraries << 'GLEW'
l.libraries << 'GL'
l.libraries << 'openal'
elsif Platform.windows?
elsif platform.windows?
l.libraries << 'glew32'
l.libraries << 'opengl32'
l.libraries << 'OpenAL32'
elsif Platform.darwin?
elsif platform.darwin?
l.libraries << 'GLEW'
l.flags_after_libraries << '-framework OpenGL'
l.flags_after_libraries << '-framework OpenAL'
l.flags_after_libraries << '-framework CoreFoundation'
end

if Platform.unix?
if platform.unix?
l.libraries << 'pthread'
end

Expand Down

0 comments on commit 705f358

Please sign in to comment.