【Cork/FreeBSD】Cork Boolean Libraryのコンパイル

その他

Cork Boolean

Cork は、ブーリアンのライブラリです。以下のように集合演算の和、差などのオペレーションができます。

Windows10+VisualStudioで比較的簡単にコンパイルできます。ここでは、サクラのレンタルサーバ(FreeBSD)でコンパイルする方法を説明します。

パッケージの収集

以下のパッケージを収集します。 cork は3つの異なるライブラリを使用していますので、ダウンロードします。

  • yasm-1.3.0 (https://yasm.tortall.net/Download.html)
  • mpir-3.0.0 (http://www.mpir.org/downloads.html)
  • gmp-6.2.0 (https://gmplib.org/list-archives/gmp-announce/2020-January/000048.html)
  • cork (https://github.com/gilbo/cork)

yasm のコンパイル

パッケージを解凍して、以下のコマンドを打ち込みます。

[~/work/lib/yasm-1.3.0]$ ./configure --prefix=$HOME/local
~ 省略 ~
[~/work/lib/yasm-1.3.0]$ make
~ 省略 ~
[~/work/lib/yasm-1.3.0]$ make install

$HOME/localに必要なものがインストールされます。

mpir のインストール

パッケージを解凍して、以下のコマンドを打ち込みます。

[~/work/lib/mpir-3.0.0]$./configure --prefix=$HOME/local
~ 省略 ~
[~/work/lib/mpir-3.0.0]$ make
~ 省略 ~
[~/work/lib/mpir-3.0.0]$ make install

$HOME/localに必要なものがインストールされます。 yasmに関するエラーが出力されたら、$HOME/local/bin にパスを通します。(yasmを参照しています)

gmpのインストール

パッケージを解凍して、以下のコマンドを打ち込みます。

[ ~/work/lib/gmp-6.2.0] ./configure --prefix=$HOME/local --enable-cxx
[ ~/work/lib/gmp-6.2.0] make
[ ~/work/lib/gmp-6.2.0] make install

–enable-cxxは、C++インターフェイスを含める為のオプションです。$HOME/local に必要なものがインストールされます。

Corkのインストール

パッケージを解凍して、以下のコマンドを打ち込みます。

[ ~/work/lib/cork-master]$ gmake 

以下のようになります。binyやinclude が追加されbinにcorkのバイナリが出来上がります。

[~/work/lib/cork-master]$ ls
COPYRIGHT       bin             include         obj             win
Makefile        debug           lib             samples
README.md       depend          makeConstants   src

corkの-helpを打ち込むと以下のように表示されます。

[ ~/work/lib/cork-master/bin]$ ./cork -help
Welcome to Cork.  Usage:
  > cork [-command arg0 arg1 ... argn]*
for example,
  > cork -union box0.off box1.off result.off
Options:
-help                  show this help message
-solid in              Determine whether the input mesh represents
                       a solid object.  (aka. watertight) (technically
                         solid == closed and non-self-intersecting)
-union in0 in1 out     Compute the Boolean union of in0 and in1,
                       and output the result
-diff in0 in1 out      Compute the Boolean difference of in0 and in1,
                       and output the result
-isct in0 in1 out      Compute the Boolean intersection of in0 and in1,
                       and output the result
-xor in0 in1 out       Compute the Boolean XOR of in0 and in1,
                       and output the result
                       (aka. the symmetric difference)
-resolve in0 in1 out   Intersect the two meshes in0 and in1,
                       and output the connected mesh with those
                       intersections made explicit and connected
スポンサーリンク
その他
Engineerをフォローする
レンサバ