Sha256: 69f5eb77df62a7d50c58d77b37c3548b05a65c4e9b46f25806d2f0ff9a3c8ef5

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

Contents

require 'mittsu/renderers/generic_lib'

module Mittsu
  module GLFWLib
    extend GenericLib

    class Linux < GenericLib::Linux
      def initialize(loader = Linux)
        @loader = loader
      end

      class << self
        def libgl_paths
          Dir.glob('/usr/lib*/**/libglfw*.so*')
        rescue
          []
        end

        def ldconfig
          `ldconfig -p | grep 'libglfw3\\?\\.so'`.lines
        rescue
          []
        end
      end
    end

    class Windows < GenericLib::Base
      def file
        'glfw3.dll'
      end
    end

    class MacOS < GenericLib::Base
      SEARCH_GLOBS = ['/usr/local/lib/**',
                      '/usr/lib/**',
                      '/opt/homebrew/**']

      def path
        File.dirname(match)
      end

      def file
        File.basename(match)
      end

      private

        def match
          @match ||= find_match
        end

        def find_match
          SEARCH_GLOBS.each do |glob|
            matches = Dir.glob("#{glob}/libglfw*.dylib")
            next if matches.empty?

            return matches.find { |m| m.end_with?('libglfw3.dylib') || m.end_with?('libglfw.3.dylib') } || matches.first
          end
        end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mittsu-0.4.0 lib/mittsu/renderers/glfw_lib.rb