Skip to content

Commit

Permalink
Setup Travis CI and build lib from source on Unix
Browse files Browse the repository at this point in the history
  • Loading branch information
jayschwa committed May 18, 2014
1 parent 3f00f47 commit 4ef3e90
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .gitignore
@@ -1,2 +1,2 @@
deps/*.dll
deps/*.zip
deps/*
!deps/build.jl
16 changes: 16 additions & 0 deletions .travis.yml
@@ -0,0 +1,16 @@
language: c
env:
matrix:
- JULIAVERSION="juliareleases"
- JULIAVERSION="julianightlies"
before_install:
- sudo add-apt-repository ppa:staticfloat/julia-deps -y
- sudo add-apt-repository ppa:staticfloat/${JULIAVERSION} -y
- sudo apt-get update -qq -y
- sudo apt-get install libpcre3-dev julia -y
- sudo apt-get install libXxf86vm-dev # GLFW dependencies
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
script:
- julia -e 'Pkg.init(); Pkg.clone(pwd()); Pkg.build("GLFW")'
- julia -e 'if isdefined(Pkg, :test) Pkg.test("GLFW") else include(Pkg.dir("GLFW/test/runtests.jl")) end'
21 changes: 19 additions & 2 deletions deps/build.jl
@@ -1,6 +1,23 @@
const version = VersionNumber(3, 0, 4)

map(mkpath, ("downloads", "src", "builds", "usr"))

@unix_only begin
const glfw = "glfw-$version"
tarball = "downloads/$glfw.tar.gz"
if !isfile(tarball)
download("https://github.com/glfw/glfw/archive/$version.tar.gz", tarball)
end
run(`tar xzf $tarball -C src`)
mkpath("builds/$glfw")
cd("builds/$glfw") do
run(`cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=../../usr -DGLFW_BUILD_DOCS=OFF -DGLFW_BUILD_EXAMPLES=OFF -DGLFW_BUILD_TESTS=OFF ../../src/$glfw`)
run(`make install`)
end
end

# Automagically download and install a GLFW DLL for the poor souls using Windows
@windows_only begin
const version = "3.0.4"
const dll = "glfw3.dll"
const archive = "glfw-$version.bin.WIN$WORD_SIZE.zip"

Expand All @@ -12,4 +29,4 @@
else
info("$dll already exists in $(pwd())")
end
end
end
2 changes: 1 addition & 1 deletion src/GLFW.jl
@@ -1,6 +1,6 @@
module GLFW

const lib = find_library(["glfw3", "libglfw3", "glfw", "libglfw"], [Pkg.dir("GLFW/deps")])
const lib = find_library(["glfw3", "libglfw3", "glfw", "libglfw"], [Pkg.dir("GLFW/deps"), Pkg.dir("GLFW/deps/usr/lib")])
if isempty(lib)
error("could not find GLFW library")
end
Expand Down
4 changes: 4 additions & 0 deletions test/runtests.jl
@@ -0,0 +1,4 @@
import GLFW

GLFW.Init()
GLFW.Terminate()

0 comments on commit 4ef3e90

Please sign in to comment.