diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 0000000..5555c02 --- /dev/null +++ b/.github/workflows/CI.yml @@ -0,0 +1,41 @@ +name: CI + +on: + push: + branches: + - master + tags: '*' + pull_request: + +jobs: + test: + name: julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + version: + - '1.3' + - '1' + - 'nightly' + os: + - ubuntu-latest + - windows-latest + arch: + - x64 + include: + - os: ubuntu-latest + prefix: xvfb-run + - os: windows-latest + version: '1' + arch: x86 + steps: + - uses: actions/checkout@v2 + - uses: julia-actions/setup-julia@latest + with: + version: ${{ matrix.version }} + arch: ${{ matrix.arch }} + - uses: julia-actions/julia-buildpkg@latest + - uses: julia-actions/julia-runtest@latest + with: + prefix: ${{ matrix.prefix }} diff --git a/.github/workflows/RegisterAction.yml b/.github/workflows/RegisterAction.yml new file mode 100644 index 0000000..010ce41 --- /dev/null +++ b/.github/workflows/RegisterAction.yml @@ -0,0 +1,14 @@ +name: RegisterAction +on: + workflow_dispatch: + inputs: + version: + description: Version to register or component to bump + required: true +jobs: + register: + runs-on: ubuntu-latest + steps: + - uses: julia-actions/RegisterAction@latest + with: + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 4aaeca8..ba39cc5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ -deps/deps.jl -deps/build.log +Manifest.toml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 3cbc195..0000000 --- a/.travis.yml +++ /dev/null @@ -1,19 +0,0 @@ -language: julia -os: - - linux -dist: trusty -julia: - - 1.3 - - nightly -matrix: - allow_failures: - - julia: nightly - -notifications: - email: false -addons: - apt: - packages: - - xorg-dev -before_script: - - if [ "${TRAVIS_OS_NAME}" = "linux" ]; then export DISPLAY=:99.0; sh -e /etc/init.d/xvfb start; fi diff --git a/LICENSE.md b/LICENSE.md index db1be00..5ef96ec 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,22 +1,21 @@ -The ModernGL.jl package is licensed under the MIT "Expat" License: +The MIT License (MIT) +Copyright (c) 2014: Simon Danisch. -> Copyright (c) 2014: Simon Danisch. -> -> Permission is hereby granted, free of charge, to any person obtaining -> a copy of this software and associated documentation files (the -> "Software"), to deal in the Software without restriction, including -> without limitation the rights to use, copy, modify, merge, publish, -> distribute, sublicense, and/or sell copies of the Software, and to -> permit persons to whom the Software is furnished to do so, subject to -> the following conditions: -> -> The above copyright notice and this permission notice shall be -> included in all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -> IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -> CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -> TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -> SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 5bd04e3..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,28 +0,0 @@ -# Documentation: https://github.com/JuliaCI/Appveyor.jl -environment: - matrix: - - julia_version: 1.2 - - julia_version: nightly -platform: - - x86 - - x64 -matrix: - allow_failures: - - julia_version: nightly -branches: - only: - - master - - /release-.*/ -notifications: - - provider: Email - on_build_success: false - on_build_failure: false - on_build_status_changed: false -install: - - ps: iex ((new-object net.webclient).DownloadString("https://raw.githubusercontent.com/JuliaCI/Appveyor.jl/version-1/bin/install.ps1")) -build_script: - - echo "%JL_BUILD_SCRIPT%" - - C:\julia\bin\julia -e "%JL_BUILD_SCRIPT%" -test_script: - - echo "%JL_TEST_SCRIPT%" - - C:\julia\bin\julia -e "%JL_TEST_SCRIPT%" diff --git a/deps/build.jl b/deps/build.jl deleted file mode 100644 index fc4fb98..0000000 --- a/deps/build.jl +++ /dev/null @@ -1,4 +0,0 @@ -debug_level = get(ENV, "MODERNGL_DEBUGGING", "false") == "true" -open(joinpath(@__DIR__, "deps.jl"), "w") do io - println(io, "const enable_opengl_debugging = $debug_level") -end diff --git a/src/ModernGL.jl b/src/ModernGL.jl index 09009cf..8113c1f 100644 --- a/src/ModernGL.jl +++ b/src/ModernGL.jl @@ -1,9 +1,6 @@ module ModernGL using Libdl -const iswindows = Sys.iswindows -const isunix = Sys.isunix -const isapple = Sys.isapple function glXGetProcAddress(glFuncName) ccall((:glXGetProcAddress, "libGL.so.1"), Ptr{Cvoid}, (Ptr{UInt8},), glFuncName) @@ -23,13 +20,13 @@ function wglGetProcAddress(glFuncName) ccall((:wglGetProcAddress, "opengl32"), Ptr{Cvoid}, (Ptr{UInt8},), glFuncName) end -if isapple() +if Sys.isapple() getprocaddress(glFuncName) = NSGetProcAddress(glFuncName) -elseif isunix() +elseif Sys.isunix() getprocaddress(glFuncName) = glXGetProcAddress(glFuncName) end -if iswindows() +if Sys.iswindows() getprocaddress(glFuncName) = wglGetProcAddress(glFuncName) end @@ -93,8 +90,14 @@ macro GenEnums(list) esc(Expr(:block, enumtype, tmp..., Expr(:export, :($(enumName))))) end +const enable_opengl_debugging = Ref(false) + include("glTypes.jl") include("functionloading.jl") include("glConstants.jl") +function __init__() + enable_opengl_debugging[] = lowercase(get(ENV, "MODERNGL_DEBUGGING", "false")) == "true" +end + end # module diff --git a/src/functionloading.jl b/src/functionloading.jl index 17a54f9..504453d 100644 --- a/src/functionloading.jl +++ b/src/functionloading.jl @@ -1,16 +1,8 @@ -const depsfile = joinpath("..", "deps", "deps.jl") - -if isfile(depsfile) - include(depsfile) -else - const enable_opengl_debugging = get(ENV, "MODERNGL_DEBUGGING", "false") == "true" -end - gl_represent(x::GLenum) = GLENUM(x).name gl_represent(x) = repr(x) function debug_opengl_expr(func_name, args) - if enable_opengl_debugging && func_name != :glGetError + if enable_opengl_debugging[] && func_name != :glGetError quote err = glGetError() if err != GL_NO_ERROR @@ -39,7 +31,7 @@ macro glfunc(opengl_func) func_name_str = string(func_name) ptr_expr = :(getprocaddress_e($func_name_str)) - if iswindows() # windows has some function pointers statically available and some not, this is how we deal with it: + if Sys.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")) @@ -70,12 +62,12 @@ macro glfunc(opengl_func) return esc(ret) end -if iswindows() +if Sys.iswindows() const gl_lib = Libdl.dlopen("opengl32") end include("glFunctions.jl") -if iswindows() +if Sys.iswindows() Libdl.dlclose(gl_lib) end diff --git a/test/runtests.jl b/test/runtests.jl index ba75e66..3369958 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -2,9 +2,7 @@ import GLFW using ModernGL include("util.jl") -function is_ci() - get(ENV, "TRAVIS", "") == "true" || get(ENV, "APPVEYOR", "") == "True" || get(ENV, "CI", "") == "True" -end +is_ci() = get(ENV, "CI", nothing) == "true" if !is_ci() # only do test if not CI... this is for automated testing environments which fail for OpenGL stuff, but I'd like to test if at least including works