Class: Emplace::CMakeBuild
- Inherits:
-
Object
- Object
- Emplace::CMakeBuild
- Defined in:
- lib/emplace.rb
Instance Method Summary collapse
- #build(dir) ⇒ Object
- #cmake(name, module_dir, build_dir, dist_dir) ⇒ Object
- #sh(cmd, dir = '.') ⇒ Object
- #test(dir) ⇒ Object
- #write_file(name, dir, &block) ⇒ Object
Instance Method Details
#build(dir) ⇒ Object
57 58 59 |
# File 'lib/emplace.rb', line 57 def build(dir) sh "cmake --build #{dir} --target install" end |
#cmake(name, module_dir, build_dir, dist_dir) ⇒ Object
54 55 56 |
# File 'lib/emplace.rb', line 54 def cmake(name, module_dir, build_dir, dist_dir) sh "cmake . -B#{build_dir} -DCMAKE_MODULE_PATH=#{module_dir} -DCMAKE_INSTALL_PREFIX=#{dist_dir}/#{name} -G \"#{cmake_generator}\"" end |
#sh(cmd, dir = '.') ⇒ Object
63 64 65 66 67 |
# File 'lib/emplace.rb', line 63 def sh(cmd, dir = '.') Dir.chdir(dir) { raise $? unless system cmd } end |
#test(dir) ⇒ Object
60 61 62 |
# File 'lib/emplace.rb', line 60 def test(dir) sh "ctest --verbose", dir end |
#write_file(name, dir, &block) ⇒ Object
68 69 70 71 |
# File 'lib/emplace.rb', line 68 def write_file(name, dir, &block) FileUtils.mkdir_p(dir) File.open(File.join(dir, name), 'wb', &block) end |