Class: RLSL::ShaderBuilder::NativeExtensionCompiler

Inherits:
Object
  • Object
show all
Defined in:
lib/rlsl/shader_builder/native_extension_compiler.rb

Defined Under Namespace

Classes: Artifact

Instance Method Summary collapse

Constructor Details

#initialize(shader_name, cache_dir: RLSL.cache_dir, ruby_bin: RbConfig.ruby, dylib_ext: RbConfig::CONFIG["DLEXT"]) ⇒ NativeExtensionCompiler

Returns a new instance of NativeExtensionCompiler.



10
11
12
13
14
15
# File 'lib/rlsl/shader_builder/native_extension_compiler.rb', line 10

def initialize(shader_name, cache_dir: RLSL.cache_dir, ruby_bin: RbConfig.ruby, dylib_ext: RbConfig::CONFIG["DLEXT"])
  @shader_name = shader_name
  @cache_dir = cache_dir
  @ruby_bin = ruby_bin
  @dylib_ext = dylib_ext
end

Instance Method Details

#build(c_code) ⇒ Object



17
18
19
20
21
# File 'lib/rlsl/shader_builder/native_extension_compiler.rb', line 17

def build(c_code)
  artifact = artifact_for(c_code)
  compile(artifact, c_code) unless File.exist?(artifact.file)
  artifact
end