差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン | ||
c_cpp:boost [2020/08/27 03:26] – [Windows 上の Visual C++ 2019 Preview でビルドする場合] ともやん | c_cpp:boost [2021/07/05 02:02] (現在) – ともやん | ||
---|---|---|---|
行 1: | 行 1: | ||
- | < | ||
- | < | ||
- | #result pre, #mincode pre { | ||
- | overflow: hidden; | ||
- | font-size: 10px; | ||
- | } | ||
- | # | ||
- | height: 250px; | ||
- | overflow: scroll; | ||
- | overflow-x: hidden; | ||
- | font-size: 10px; | ||
- | } | ||
- | #mintbl table { | ||
- | font-size: 12px; | ||
- | } | ||
- | .dokuwiki .plugin_wrap table { | ||
- | width: auto; | ||
- | } | ||
- | #logo { | ||
- | background-color: | ||
- | padding: 10px; | ||
- | width: fit-content; | ||
- | } | ||
- | #logo p { | ||
- | margin: 0; | ||
- | } | ||
- | </ | ||
- | </ | ||
====== Boost C++ Libraries ====== | ====== Boost C++ Libraries ====== | ||
{{c_cpp: | {{c_cpp: | ||
- | [[https:// | + | 本家: |
- | [[https:// | + | ソースコード: |
- | \\ | + | |
- | Boost (ブースト)とは、C++の先駆的な開発者のコミュニティ、およびそのコミュニティによって公開されているオープンソースのソフトウェアライブラリのことを指す。コミュニティとしてのBoostはC++標準化委員会の委員により設立されており、現在でもその多くが構成員として留まっている。このような経緯もあり、BoostコミュニティはC++の標準化において大きな影響力を有している。実際に標準化委員会が発表した「TR1」の2/ | + | |
- | \\ | + | |
- | Boostで公開されるライブラリはコミュニティの公開レビューによって精選されている。Boostを使用して作成したプログラムは、商用、非商用を問わず無償のBoost Software Licenseの下でライセンスされる。\\ | + | |
- | \\ | + | |
- | Boostはテンプレートなどを活用して積極的にメタプログラミングやジェネリックプログラミングの技法を取り入れて行く傾向がある。そのためBoostライブラリの利用者にはC++の現代的な記述に慣れていることを要求される。\\ | + | |
\\ | \\ | ||
+ | **Boost** (ブースト) とは、C++ の先駆的な開発者のコミュニティ、およびそのコミュニティによって公開されているオープンソースのソフトウェアライブラリのことを指す。コミュニティとしての Boost は C++ 標準化委員会の委員により設立されており、現在でもその多くが構成員として留まっている。このような経緯もあり、Boost コミュニティは C++ の標準化において大きな影響力を有している。実際に標準化委員会が発表した「TR1」の2/ | ||
+ | |||
+ | Boost で公開されるライブラリはコミュニティの公開レビューによって精選されている。Boost を使用して作成したプログラムは、商用、非商用を問わず無償の Boost Software License の下でライセンスされる。\\ | ||
+ | |||
+ | Boost はテンプレートなどを活用して積極的にメタプログラミングやジェネリックプログラミングの技法を取り入れて行く傾向がある。そのため Boost ライブラリの利用者には C++ の現代的な記述に慣れていることを要求される。\\ | ||
+ | |||
このライブラリは、先鋭的な技術を好むプログラマーが積極的に使用していることで有名である。\\ | このライブラリは、先鋭的な技術を好むプログラマーが積極的に使用していることで有名である。\\ | ||
- | \\ | + | |
[[https:// | [[https:// | ||
行 45: | 行 17: | ||
===== 利用する前にビルドの必要があるライブラリ ===== | ===== 利用する前にビルドの必要があるライブラリ ===== | ||
- | Boostに含まれる以下のライブラリを利用する場合は、事前にビルドを行う必要がある。それ以外は、ヘッダファイルを #include することで、そのまま利用することが可能である。\\ | + | Boost に含まれる以下のライブラリを利用する場合は、事前にビルドを行う必要がある。それ以外は、ヘッダファイルを #include することで、そのまま利用することが可能である。\\ |
\\ | \\ | ||
ビルドが必要なライブラリ | ビルドが必要なライブラリ | ||
行 86: | 行 58: | ||
- Windows の場合は boost_1_74_0.7z を C: | - Windows の場合は boost_1_74_0.7z を C: | ||
- | ===== Visual Studio へのインストール ===== | + | ===== Windows でのインストール ===== |
+ | |||
+ | ==== Visual Studio - Vcpkg 編 ==== | ||
[[windows: | [[windows: | ||
PowerShell で以下のコマンドを実行する。\\ | PowerShell で以下のコマンドを実行する。\\ | ||
行 2111: | 行 2085: | ||
</ | </ | ||
- | ===== Linux でのインストール ===== | + | ==== ソースコードからビルド ==== |
- | Fedora 29\\ | + | 下記の内容は正式対応前に |
- | <WRAP prewrap 100%> | + | **Boost** が正式対応しているコンパイラでは、これほど苦労はしない。\\ |
- | < | + | |
- | $ sudo dnf install boost boost-devel boost-date-time boost-filesystem boost-graph boost-iostreams boost-numpy3 boost-program-options boost-python3 boost-python3-devel boost-regex boost-serialization boost-signals boost-stacktrace boost-static boost-system boost-test boost-thread boost-timer boost-type_erasure boost-wave | + | |
- | </ | + | |
- | </ | + | |
- | + | ||
- | 以下の依存関係がインストールされる。\\ | + | |
- | <WRAP prewrap 100%> | + | |
- | < | + | |
- | libquadmath-devel boost-container boost-context boost-coroutine boost-fiber boost-log boost-math python3-numpy | + | |
- | </ | + | |
- | </ | + | |
- | + | ||
- | [[c_cpp: | + | |
- | + | ||
- | ==== ソースからのビルド ==== | + | |
- | < | + | |
- | $ cd boost | + | |
- | $ ./ | + | |
- | $ PYTHON_ROOT=/ | + | |
- | $ PYTHON_VERSION=3.7 | + | |
- | $ echo "using gcc : 8.3 : / | + | |
- | $ ./bjam --toolset=gcc-8.3 address-model=32 architecture=x86 variant=debug -j 3 --buildid=x32-d | + | |
- | $ ./bjam --toolset=gcc-8.3 address-model=64 architecture=x86 variant=debug -j 3 --buildid=x64-d | + | |
- | $ ./bjam --toolset=gcc-8.3 address-model=32 architecture=x86 variant=release -j 3 --buildid=x32 | + | |
- | $ ./bjam --toolset=gcc-8.3 address-model=64 architecture=x86 variant=release -j 3 --buildid=x64 | + | |
- | </ | + | |
- | ※**Name clash for xxx**エラーが発生する場合は、**address-model=64 architecture=x86**オプションで回避できる。\\ | + | |
- | ※**-j N** は並列コンパイル数 N を指定する。\\ | + | |
- | ※**variant=debug, | + | |
- | ※**--buildid=d**はデバッグ版のライブラリ名に-dを付ける。\\ | + | |
- | + | ||
- | ===== ビルド/ | + | |
- | + | ||
- | ==== Windows 上の Visual C++ 2019 Preview でビルドする場合 ==== | + | |
- タスクバーの「ここに入力して検索」に sysdm.cpl を入力して Enter キーを押す。 | - タスクバーの「ここに入力して検索」に sysdm.cpl を入力して Enter キーを押す。 | ||
- 「システムのプロパティ」の「詳細設定」タブの[環境変数]ボタンを押して「環境変数」画面を開く。 | - 「システムのプロパティ」の「詳細設定」タブの[環境変数]ボタンを押して「環境変数」画面を開く。 | ||
行 2158: | 行 2098: | ||
> cd %BOOST% | > cd %BOOST% | ||
> bootstrap.bat | > bootstrap.bat | ||
- | </ | + | </ |
- | </ | + | |
- | <WRAP prewrap 100% #result> | + | |
- | < | + | |
Building Boost.Build engine | Building Boost.Build engine | ||
行 2186: | 行 2123: | ||
http:// | http:// | ||
</ | </ | ||
- | - 現時点で bjam は Visual Studio 2019 に対応していないので msvc.jam を修正する。< | + | - 現時点で bjam は **Visual Studio 2019 Preview** |
24d23 | 24d23 | ||
< * Visual Studio 2019—14.2 | < * Visual Studio 2019—14.2 | ||
行 2222: | 行 2159: | ||
2012d2001 | 2012d2001 | ||
< .version-14.2-env = VS160COMNTOOLS ProgramFiles ProgramFiles(x86) ; | < .version-14.2-env = VS160COMNTOOLS ProgramFiles ProgramFiles(x86) ; | ||
- | </ | + | </file></ |
- *** Visual Studio 2019—14.2** コメント追加。 | - *** Visual Studio 2019—14.2** コメント追加。 | ||
- **if [ MATCH " | - **if [ MATCH " | ||
- **exact-version = [ MATCH " | - **exact-version = [ MATCH " | ||
- | - **if [ MATCH " | + | - **if [ MATCH " |
if [ MATCH " | if [ MATCH " | ||
{ | { | ||
行 2232: | 行 2169: | ||
} | } | ||
else if [ MATCH " | else if [ MATCH " | ||
- | </ | + | </code></ |
- **if $(version) = 14.1 || $(version) = " | - **if $(version) = 14.1 || $(version) = " | ||
- **.known-versions = 14.1 14.0 12.0 11.0 10.0 10.0express 9.0 9.0express 8.0 8.0express 7.1** を **.known-versions = 14.2 14.1 14.0 12.0 11.0 10.0 10.0express 9.0 9.0express 8.0 8.0express 7.1** に修正。 | - **.known-versions = 14.1 14.0 12.0 11.0 10.0 10.0express 9.0 9.0express 8.0 8.0express 7.1** を **.known-versions = 14.2 14.1 14.0 12.0 11.0 10.0 10.0express 9.0 9.0express 8.0 8.0express 7.1** に修正。 | ||
- **.version-alias-14.2 = 14.2 ;** を追記。 | - **.version-alias-14.2 = 14.2 ;** を追記。 | ||
- | - <code autoconf> | + | - <WRAP prewrap 100% mincode><code autoconf> |
.version-14.2-path = | .version-14.2-path = | ||
" | " | ||
行 2267: | 行 2204: | ||
=== auto_link.hpp の修正 === | === auto_link.hpp の修正 === | ||
現時点で boost は Visual Studio 2019 のオートリンクに対応していないので auto_link.hpp を修正する。 | 現時点で boost は Visual Studio 2019 のオートリンクに対応していないので auto_link.hpp を修正する。 | ||
- | <WRAP prewrap 100% #mincode> | + | <WRAP prewrap 100% mincode> |
<file diff %BOOST%\boost\config\auto_link.hpp.patch> | <file diff %BOOST%\boost\config\auto_link.hpp.patch> | ||
176c176 | 176c176 | ||
行 2280: | 行 2217: | ||
< # define BOOST_LIB_TOOLSET " | < # define BOOST_LIB_TOOLSET " | ||
</ | </ | ||
+ | </ | ||
- **# elif defined(BOOST_MSVC)** を **# elif defined(BOOST_MSVC) && (BOOST_MSVC < 1920)** に修正。 | - **# elif defined(BOOST_MSVC)** を **# elif defined(BOOST_MSVC) && (BOOST_MSVC < 1920)** に修正。 | ||
- | - <code cpp> | + | - <WRAP prewrap 100% mincode><code cpp> |
# elif defined(BOOST_MSVC) | # elif defined(BOOST_MSVC) | ||
行 2289: | 行 2227: | ||
=== 参考 === | === 参考 === | ||
- | <WRAP prewrap 100% #mintbl> | + | <WRAP prewrap 100% mintbl> |
^ 表記 | ^ 表記 | ||
| 2019 | Visual Studio 2019\\ Version 16.1.2 | | 2019 | Visual Studio 2019\\ Version 16.1.2 | ||
行 2297: | 行 2235: | ||
[[windows: | [[windows: | ||
- | ===== 利用方法 | + | ===== Linux でのインストール |
- | [[c_cpp: | + | Fedora 29\\ |
+ | <WRAP prewrap 100%> | ||
+ | < | ||
+ | $ sudo dnf install boost boost-devel boost-date-time boost-filesystem boost-graph boost-iostreams boost-numpy3 boost-program-options boost-python3 boost-python3-devel boost-regex boost-serialization boost-signals boost-stacktrace boost-static boost-system boost-test boost-thread boost-timer boost-type_erasure boost-wave | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | 以下の依存関係がインストールされる。\\ | ||
+ | <WRAP prewrap 100%> | ||
+ | < | ||
+ | libquadmath-devel boost-container boost-context boost-coroutine boost-fiber boost-log boost-math python3-numpy | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | [[c_cpp: | ||
+ | |||
+ | ==== ソースからのビルド ==== | ||
+ | < | ||
+ | $ cd boost | ||
+ | $ ./ | ||
+ | $ PYTHON_ROOT=/ | ||
+ | $ PYTHON_VERSION=3.7 | ||
+ | $ echo "using gcc : 8.3 : /usr/bin/g++ ; " >> tools/ | ||
+ | $ ./bjam --toolset=gcc-8.3 address-model=32 architecture=x86 variant=debug -j 3 --buildid=x32-d | ||
+ | $ ./bjam --toolset=gcc-8.3 address-model=64 architecture=x86 variant=debug -j 3 --buildid=x64-d | ||
+ | $ ./bjam --toolset=gcc-8.3 address-model=32 architecture=x86 variant=release -j 3 --buildid=x32 | ||
+ | $ ./bjam --toolset=gcc-8.3 address-model=64 architecture=x86 variant=release -j 3 --buildid=x64 | ||
+ | </ | ||
+ | ※**Name clash for xxx**エラーが発生する場合は、**address-model=64 architecture=x86**オプションで回避できる。\\ | ||
+ | ※**-j N** は並列コンパイル数 N を指定する。\\ | ||
+ | ※**variant=debug, | ||
+ | ※**--buildid=d**はデバッグ版のライブラリ名に-dを付ける。\\ | ||
+ | |||
+ | |||
+ | ===== ライブラリの利用方法 ===== | ||
+ | [[c_cpp: | ||
===== 参考文献 ===== | ===== 参考文献 ===== | ||
[[https:// | [[https:// | ||
+ | [[git> | ||
+ | ==== 付録 ==== | ||
+ | [[tw> | ||