Skip to content

Commit

Permalink
Merge pull request #45 from JuliaGL/sd/06compat
Browse files Browse the repository at this point in the history
add back 0.6 compat
  • Loading branch information
SimonDanisch authored Jul 12, 2018
2 parents 751759f + eea1f5c commit e1eb1b6
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 12 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ os:
- linux
dist: trusty
julia:
- 0.6
- 0.7
- nightly
matrix:
Expand Down
2 changes: 1 addition & 1 deletion REQUIRE
Original file line number Diff line number Diff line change
@@ -1 +1 @@
julia 0.7-alpha
julia 0.6
5 changes: 1 addition & 4 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
environment:
matrix:
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe"
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"

Expand All @@ -14,10 +15,6 @@ notifications:
on_build_failure: false
on_build_status_changed: false

matrix:
allow_failures:
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"

install:
- ps: "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12"
Expand Down
20 changes: 16 additions & 4 deletions src/ModernGL.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
__precompile__(true)
module ModernGL

using Libdl
if VERSION < v"0.7.0-"
const Cvoid = Void
const iswindows = is_windows
const isunix = is_unix
const isapple = is_apple
else
using Libdl
const iswindows = Sys.iswindows
const isunix = Sys.isunix
const isapple = Sys.isapple
end



function glXGetProcAddress(glFuncName)
ccall((:glXGetProcAddress, "libGL.so.1"), Ptr{Cvoid}, (Ptr{UInt8},), glFuncName)
Expand All @@ -20,12 +32,12 @@ function wglGetProcAddress(glFuncName)
ccall((:wglGetProcAddress, "opengl32"), Ptr{Cvoid}, (Ptr{UInt8},), glFuncName)
end

if Sys.isapple()
if isapple()
getprocaddress(glFuncName) = NSGetProcAddress(glFuncName)
elseif Sys.isunix()
elseif isunix()
getprocaddress(glFuncName) = glXGetProcAddress(glFuncName)
end
if Sys.iswindows()
if iswindows()
getprocaddress(glFuncName) = wglGetProcAddress(glFuncName)
end

Expand Down
6 changes: 3 additions & 3 deletions src/functionloading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ macro glfunc(opengl_func)
func_name_str = string(func_name)
ptr_expr = :(getprocaddress_e($func_name_str))

if Sys.iswindows() # windows has some function pointers statically available and some not, this is how we deal with it:
if iswindows() # windows has some function pointers statically available and some not, this is how we deal with it:
ptr = Libdl.dlsym_e(gl_lib, func_name)
if (ptr != C_NULL)
ptr_expr = :(($func_name_sym, "opengl32"))
Expand Down Expand Up @@ -68,10 +68,10 @@ macro glfunc(opengl_func)
return esc(ret)
end

if Sys.iswindows()
if iswindows()
const gl_lib = Libdl.dlopen("opengl32")
end
include("glFunctions.jl")
if Sys.iswindows()
if iswindows()
Libdl.dlclose(gl_lib)
end

0 comments on commit e1eb1b6

Please sign in to comment.