Module: Ritsu::SrcFiles::AddFragFile

Included in:
Project, Target
Defined in:
lib/ritsu/ext/glsl/src_files/frag_file.rb

Instance Method Summary collapse

Instance Method Details

#add_frag_file(path, options = {}) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/ritsu/ext/glsl/src_files/frag_file.rb', line 41

def add_frag_file(path, options={})
  src_path = compute_src_path(path, options)
  frag_file = FragFile.new(src_path, self)
  
  cpp_src_path = compute_src_path(frag_file.cpp_file_base_name, options)
  cpp_file = CppFile.new(cpp_src_path, self)
  
  self.custom_commands << "ADD_CUSTOM_COMMAND(\n" +
    "    OUTPUT ${CMAKE_SOURCE_DIR}/#{cpp_src_path}\n" +
    "    COMMAND define_cpp_string #{frag_file.code_var_name} < ${CMAKE_SOURCE_DIR}/#{frag_file.src_path} > ${CMAKE_SOURCE_DIR}/#{cpp_file.src_path}\n" +
    "    DEPENDS ${CMAKE_SOURCE_DIR}/#{frag_file.src_path})"
end

#add_frag_files(*paths) ⇒ Object



54
55
56
57
58
# File 'lib/ritsu/ext/glsl/src_files/frag_file.rb', line 54

def add_frag_files(*paths)
  paths.each do |path|
    add_frag_file(path)
  end
end