---
## Usage
---
Idea, Design, Engineering, Architecture on Blogger. Seesaaブログから引っ越した。 洗練されたものを目指します。
Doyub Kim著, 高瀬 紗月 監訳,中本 浩 翻訳の『流体エンジンアーキテクチャ』株式会社ボーンデジタルの付録 (https://github.com/doyubkim/fluid-engine-dev) のビルドについて.
基本的には fluid-engine-dev.git
の INSTALL.md
の通りに:
mkdir build
cd build
cmake ..
make
でいい. だが, そのままではPythonライブラリのバージョンとコンパイラのオプション, ヘッダの構成に起因してエラーとなる.
そこで python3.10環境と, パッケージ setuptools
, pybind11
; C++のソースとして ssize_t
のためのラッパーを用意して, 以下のように cmake
を実行する.
cmake .. -DPYTHON_EXECUTABLE=$(which python3) \
-DCMAKE_CXX_FLAGS="$CMAKE_CXX_FLAGS -Wno-error=unused-but-set-variable \
-Wno-error=alias-template-in-declaration-name \
-include /full/path/to/ssize_t_wrapper.h"
以下, 詳細を説明する.
2022-10-05
Karabiner-Elements (KE) を 14.10.0 にバージョンアップしたところ, だましだまし使っていた自前の親指シフト環境が使えなくなってしまった.
そこで今回, 以前リリースしたものを思い切って全面的に見直し, 新たにOyayubiKE
と称することとした. 一応使えるレベル (完成度は自己評価で51%くらい) にはなったと思うので公開する.
が……後述のように 一定の不具合は存在するので注意すること.
動作確認した環境は以下の通り:
Thor::Group
, Thor::Actions
そしてERBテンプレート群とを組み合わせれば, これをとても簡単に実現できる (訳注: Thorはもともとrakeやsakeの代替えとして開発されていたようだ. ). ここに例を示そう:Thor::Group
,Thor::Actions
and ERB templates makes this very easy. Here is an example:class Newgem < Thor::Group
include Thor::Actions
# もろもろの引数とオプションを定義する
# Define arguments and options
argument :name
class_option :test_framework, :default => :test_unit
def self.source_root
File.dirname(__FILE__)
end
def create_lib_file
template('templates/newgem.tt', "#{name}/lib/#{name}.rb")
end
def create_test_file
test = options[:test_framework] == "rspec" ? :spec : :test
create_file "#{name}/#{test}/#{name}_#{test}.rb"
end
def copy_licence
if yes?("Use MIT license?")
# source rootディレクトリでMITLICENSEファイルをコピーする
# Make a copy of the MITLICENSE file at the source root
copy_file "MITLICENSE", "#{name}/MITLICENSE"
else
say "Shame on you…", :red
end
end
end
thor -T
を実行すると, このジェネレータの使い方を表示する. それは thor newgem NAME
を読むはずだ. これはジェネレータを実行するのに, われわれはNAMEという引数を与えなければならないことを示している.thor -T
will show how to run our generator. It should read:thor newgem NAME
. This shows that we have to supply a NAMEcreate_lib_file
はERBテンプレートのひとつを使っている. これはこのようになる:create_lib_file
uses an ERB template. This is what it looks like:class <%= name.capitalize %>
end
template
が呼び出されたときに, 自動で渡される. その他のオプション詳細は ドキュメント を読んで確認せよ.template
gets called. Be sure to read the documentation for more options.thor newgem devise
で実行すると, ふたつのファイルが作られる: “devise/lib/devise.rb” と “devise/test/devise_test.rb” だ. その次にユーザは, (yes?
メソッドを使ったプロンプトで) MITライセンスのファイルをコピーしたいかどうかたずねられる.thor newgem devise --test-framework=rspec
のように追加できる. これはふたつのファイル: “devise/lib/devise.rb” と “devise/spec/devise_spec.rb” を生成する.thor newgem devise
will create two files: “devise/lib/devise.rb”, and “devise/test/devise_test.rb”. The user will then be asked (via a prompt by the yes?
method) whether or not they would like to copy the MIT License. If you want to change the test framework, you can add the option: thor newgem devise --test-framework=rspec
.