diff --git a/.gitignore b/.gitignore index 898182f..57c9483 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -deps/*.dll -deps/*.zip \ No newline at end of file +deps/* +!deps/build.jl diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..ca5c1f2 --- /dev/null +++ b/.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' diff --git a/deps/build.jl b/deps/build.jl index f9ca53b..7945b5d 100644 --- a/deps/build.jl +++ b/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" @@ -12,4 +29,4 @@ else info("$dll already exists in $(pwd())") end -end \ No newline at end of file +end diff --git a/src/GLFW.jl b/src/GLFW.jl index 8db3a00..95ae21f 100644 --- a/src/GLFW.jl +++ b/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 diff --git a/test/runtests.jl b/test/runtests.jl new file mode 100644 index 0000000..7747dc6 --- /dev/null +++ b/test/runtests.jl @@ -0,0 +1,4 @@ +import GLFW + +GLFW.Init() +GLFW.Terminate()