Source documentation/ja: Difference between revisions

From FreeCAD Documentation
(Created page with "Doxygenをインストールしてあればドキュメントのビルドは非常に簡単です。FreeCADビルド用のディレクトリに移動してCMakeでソースを...")
(Updating to match new version of source page)
 
(37 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<languages/>
<languages/>


{{Docnav
FreeCADのソースは[http://www.doxygen.org Doxygen]を使って自動でhtmlのドキュメントを生成できるようにコメントがされています。
|[[Extra_python_modules|Extra python modules]]
|[[Contributors|Contributors]]
}}


{{TOCright}}
FreeCADの最新のSVN版を追従したい人、C++部分を読むことに挑戦する人がソースを読んでまず思うのはまるで強固な要塞でも見ているようだ、ということでしょう。どこから始まってどこで終わっているのか見当もつかないし、どこから手をつけたらいいかもわからないでしょう!


<div class="mw-translate-fuzzy">
For those wanting to follow closely the latest development versions of FreeCAD, and who try to have a look at the C++ or Python parts, the first insight in the sources can give the feeling you're looking at an hedgehog: you can't discriminate head from tail and don't really know how to catch it!
FreeCADのソースコードは、[http://www.doxygen.org Doxygen]を使ってHTMLドキュメントを自動生成するようにコメントされています。これは、FreeCADソースコードのC ++部分とPython部分の両方に当てはまります。
</div>


<div class="mw-translate-fuzzy">
In complement to this Wiki, the [http://www.freecadweb.org/api/ Source Documentation] can hopefully alleviate this feeling, providing an entry point, and allowing for easy browsing through the dozens of files and directories.
オンラインのソースドキュメントはhttp://www.freecadweb.org/api/にあります。
</div>


Compiling the API documentation follows the same general steps as compiling the FreeCAD executable, as indicated in the [[Compile_on_Linux|Compile on Linux]] page.

[[File:FreeCAD_documentation_compilation_workflow.svg|800px]]

{{Caption|General workflow to compile FreeCAD's programming documentation. The Doxygen and Graphviz packages must be in the system, as well as the FreeCAD source code itself. CMake configures the system so that with a single make instruction the documentation for the the entire project is compiled into many HTML files with diagrams.}}

<div class="mw-translate-fuzzy">
==== ソースドキュメントのビルド ====
==== ソースドキュメントのビルド ====
</div>

=== Complete documentation ===


<div class="mw-translate-fuzzy">
Doxygenをインストールしてあればドキュメントのビルドは非常に簡単です。FreeCADビルド用のディレクトリに移動してCMakeでソースを設定した上で次のコマンドを実行します:
Doxygenをインストールしてあればドキュメントのビルドは非常に簡単です。FreeCADビルド用のディレクトリに移動してCMakeでソースを設定した上で次のコマンドを実行します:
</div>
{{Code|code=
{{Code|code=
sudo apt install doxygen graphviz
make DevDoc
}}
}}
and consult the resulting html files starting from Doc/SourceDocu/html/index.html .


Then follow the same steps you would do to compile FreeCAD, as described on the [[Compile_on_Linux|compile on Linux]] page, and summarized here for convenience.
The DevDoc make target above will, if graphviz is installed on your system, generate a 2Gb+ volume of data. An alternative, smaller version (~500Mb), that is the version used on http://www.freecadweb.org/api/ can also be generated by issuing instead:
* Get the source code of FreeCAD and place it in its own directory {{incode|freecad-source}}.
* Create another directory {{incode|freecad-build}} in which you will compile FreeCAD and its documentation.
* Configure the sources with {{incode|cmake}}, making sure you indicate the source directory, and specify the required options for your build.
* Trigger the creation of the documentation using {{incode|make}}.
{{Code|code=
{{Code|code=
git clone https://github.com/FreeCAD/FreeCAD.git freecad-source
make WebDoc
mkdir freecad-build
cd freecad-build
cmake -DBUILD_QT5=ON -DPYTHON_EXECUTABLE=/usr/bin/python3 ../freecad-source
}}
}}


While you are inside the build directory issue the following instruction to create only the documentation.
By nature, source doc is, and will ever be, work in progress. Don't hesitate to rebuild as often as needed. If you fall upon blatant inadequacies, feel free to post on the forum (note: It is really fully checked with cMake build process only).
{{Code|code=
make -j$(nproc --ignore=2) DevDoc
}}
<div class="mw-translate-fuzzy">
その後でDoc/SourceDocu/html/index.htmlから始まる結果のhtmlファイルを調べてください。
</div>
{{Code|code=
freecad-build/doc/SourceDocu/html/
}}


The point of entrance to the documentation is the {{incode|index.html}} file, which you can open with a web browser:
As an alternative, the doc is generated from time to time and accessible on sourceforge [http://free-cad.sf.net/SrcDocu/index.html here].
{{Code|code=
xdg-open freecad-build/doc/SourceDocu/html/index.html
}}


<div class="mw-translate-fuzzy">
Here is another FreeCAD Doxygen [http://iesensor.com/FreeCADDoc/0.16-dev/ documentation] generate by [http://forum.freecadweb.org/viewtopic.php?t=12613 qingfeng.xia].
(注意:DevDocターゲットは自動ツールビルドでは有効になっていません)その性質上、ソースドキュメントは常に作業進行中状態にあります。よく起きることですが必要がある時にはためらわずに再ビルドを行なってください。
それはhttp://www.freecadweb.org/api/で使用されているバージョンも代わりに発行することによって生成することができます:
</div>


=== Reduced documentation ===

The complete documentation uses around 3Gb of disk space. An alternative, smaller version of the documentation which takes only around 600 MB can be generated with a different target. This is the version displayed on the [https://freecad.github.io/SourceDoc/ FreeCAD API website].
{{Code|code=
make -j$(nproc --ignore=2) WebDoc
}}

The documentation on the [https://freecad.github.io/SourceDoc/ FreeCAD API website] is produced automatically from https://github.com/FreeCAD/SourceDoc . Anyone can rebuild it and submit a pull request:

* Fork the repo at https://github.com/FreeCAD/SourceDoc
* on your machine: clone the FreeCAD code (if you haven't yet), create a build dir for the doc, and clone the above SourceDoc repo inside. That SourceDoc will be updated when you rebuild the doc, and you'll be able to commit & push the results afterwards:
{{Code|code=
git clone https://github.com/FreeCAD/FreeCAD
cd FreeCAD
mkdir build
cd build
mkdir -p doc/SourceDocu/html
cd doc/SourceDocu/html
git clone your-fork-url
cd ../../..
cmake -DBUILD_QT5=ON -DPYTHON_EXECUTABLE=/usr/bin/python3 ..
make WebDoc
cd doc/SourceDocu/html
git commit
git push
}}
* Go to your fork online, and create a pull request.

<div class="mw-translate-fuzzy">
またこれとは別にこのドキュメントは折を見て生成されては、sourceforgeの[http://free-cad.sf.net/SrcDocu/index.html ここ]でアクセス可能な状態で置かれています。
</div>

<div class="mw-translate-fuzzy">
==== Coin3Dドキュメントの統合 ====
==== Coin3Dドキュメントの統合 ====
</div>


<div class="mw-translate-fuzzy">
UNIX系ではCoin3DのソースドキュメントをFreeCADのものとリンクすることが可能です。
UNIX系ではCoin3DのソースドキュメントをFreeCADのものとリンクすることが可能です。
これを行うと移動が楽になり、またCoin派生クラスの継承ダイアグラムを作成できます。
これを行うと移動が楽になり、またCoin派生クラスの継承ダイアグラムを作成できます。
</div>


<div class="mw-translate-fuzzy">
* Debianとそこから派生したシステムの場合:
* Debianとそこから派生したシステムの場合:
: - パッケージlibcoin60-docをインストール
: - パッケージlibcoin60-docをインストール
Line 38: Line 115:
: - ソースドキュメントを再生成
: - ソースドキュメントを再生成
: オフラインでのブラウジングができます。
: オフラインでのブラウジングができます。
</div>


<div class="mw-translate-fuzzy">
* もしCoinのドキュメントパッケージをインストールしたくない/できない場合、設定時(wget)にDoxygenタグファイルがダウンロード可能であればdoc.coin3D.orgにあるオンラインのCoinドキュメントへのリンクが生成されます。
* もしCoinのドキュメントパッケージをインストールしたくない/できない場合、設定時(wget)にDoxygenタグファイルがダウンロード可能であればdoc.coin3D.orgにあるオンラインのCoinドキュメントへのリンクが生成されます。
</div>


== Using Doxygen ==
== How to integrate doxygen in to the FreeCAD source code ==
{{VeryImportantMessage|This is a Work In Progress. See [[Doxygen]]}}
Example of a complete doxygen page: (from another project)


See the [[Doxygen|Doxygen]] page for an extensive explanation on how to comment C++ and Python source code so that it can be processed by Doxygen to automatically create the documentation.
doxygen: http://www.vtk.org/doc/nightly/html/classvtkArrayCoordinates.html

Essentially, a comment block, starting with {{incode|/**}} or {{incode|///}} for C++, or {{incode|##}} for Python, needs to appear before every class or function definition, so that it is picked up by Doxygen. Many [[Doxygen#Doxygen markup|special commands]], which start with {{incode|\}} or {{incode|@}}, can be used to define parts of the code and format the output. [[Doxygen#Markdown support|Markdown syntax]] is also understood within the comment block, which makes it convenient to emphasize certain parts of the documentation.
{{Code|code=
/**
* Returns the name of the workbench object.
*/
std::string name() const;

/**
* Set the name to the workbench object.
*/
void setName(const std::string&);

/// remove the added TaskWatcher
void removeTaskWatcher(void);
}}


source: https://github.com/Kitware/VTK/blob/master/Common/Core/vtkArrayCoordinates.h


<div class="mw-translate-fuzzy">
{{docnav|Extra python modules|List of Commands}}
{{docnav|Extra python modules|List of Commands}}
</div>


{{Userdocnavi{{#translation:}}}}
[[Category:Developer Documentation]]
[[Category:Developer Documentation{{#translation:}}]]
{{clear}}
{{clear}}

Latest revision as of 21:51, 12 November 2021

FreeCADのソースコードは、Doxygenを使ってHTMLドキュメントを自動生成するようにコメントされています。これは、FreeCADソースコードのC ++部分とPython部分の両方に当てはまります。

オンラインのソースドキュメントはhttp://www.freecadweb.org/api/にあります。

Compiling the API documentation follows the same general steps as compiling the FreeCAD executable, as indicated in the Compile on Linux page.

General workflow to compile FreeCAD's programming documentation. The Doxygen and Graphviz packages must be in the system, as well as the FreeCAD source code itself. CMake configures the system so that with a single make instruction the documentation for the the entire project is compiled into many HTML files with diagrams.

ソースドキュメントのビルド

Complete documentation

Doxygenをインストールしてあればドキュメントのビルドは非常に簡単です。FreeCADビルド用のディレクトリに移動してCMakeでソースを設定した上で次のコマンドを実行します:

sudo apt install doxygen graphviz

Then follow the same steps you would do to compile FreeCAD, as described on the compile on Linux page, and summarized here for convenience.

  • Get the source code of FreeCAD and place it in its own directory freecad-source.
  • Create another directory freecad-build in which you will compile FreeCAD and its documentation.
  • Configure the sources with cmake, making sure you indicate the source directory, and specify the required options for your build.
  • Trigger the creation of the documentation using make.
git clone https://github.com/FreeCAD/FreeCAD.git freecad-source
mkdir freecad-build
cd freecad-build
cmake -DBUILD_QT5=ON -DPYTHON_EXECUTABLE=/usr/bin/python3 ../freecad-source

While you are inside the build directory issue the following instruction to create only the documentation.

make -j$(nproc --ignore=2) DevDoc

その後でDoc/SourceDocu/html/index.htmlから始まる結果のhtmlファイルを調べてください。

freecad-build/doc/SourceDocu/html/

The point of entrance to the documentation is the index.html file, which you can open with a web browser:

xdg-open freecad-build/doc/SourceDocu/html/index.html

(注意:DevDocターゲットは自動ツールビルドでは有効になっていません)その性質上、ソースドキュメントは常に作業進行中状態にあります。よく起きることですが必要がある時にはためらわずに再ビルドを行なってください。 それはhttp://www.freecadweb.org/api/で使用されているバージョンも代わりに発行することによって生成することができます:

Reduced documentation

The complete documentation uses around 3Gb of disk space. An alternative, smaller version of the documentation which takes only around 600 MB can be generated with a different target. This is the version displayed on the FreeCAD API website.

make -j$(nproc --ignore=2) WebDoc

The documentation on the FreeCAD API website is produced automatically from https://github.com/FreeCAD/SourceDoc . Anyone can rebuild it and submit a pull request:

  • Fork the repo at https://github.com/FreeCAD/SourceDoc
  • on your machine: clone the FreeCAD code (if you haven't yet), create a build dir for the doc, and clone the above SourceDoc repo inside. That SourceDoc will be updated when you rebuild the doc, and you'll be able to commit & push the results afterwards:
git clone https://github.com/FreeCAD/FreeCAD
cd FreeCAD
mkdir build
cd build
mkdir -p doc/SourceDocu/html
cd doc/SourceDocu/html
git clone your-fork-url
cd ../../..
cmake -DBUILD_QT5=ON -DPYTHON_EXECUTABLE=/usr/bin/python3 ..
make WebDoc
cd doc/SourceDocu/html
git commit
git push
  • Go to your fork online, and create a pull request.

またこれとは別にこのドキュメントは折を見て生成されては、sourceforgeのここでアクセス可能な状態で置かれています。

Coin3Dドキュメントの統合

UNIX系ではCoin3DのソースドキュメントをFreeCADのものとリンクすることが可能です。 これを行うと移動が楽になり、またCoin派生クラスの継承ダイアグラムを作成できます。

  • Debianとそこから派生したシステムの場合:
- パッケージlibcoin60-docをインストール
- ファイル /usr/share/doc/libcoin60-doc/html/coin.tag.gzを展開
- ソースドキュメントを再生成
オフラインでのブラウジングができます。
  • もしCoinのドキュメントパッケージをインストールしたくない/できない場合、設定時(wget)にDoxygenタグファイルがダウンロード可能であればdoc.coin3D.orgにあるオンラインのCoinドキュメントへのリンクが生成されます。

Using Doxygen

See the Doxygen page for an extensive explanation on how to comment C++ and Python source code so that it can be processed by Doxygen to automatically create the documentation.

Essentially, a comment block, starting with /** or /// for C++, or ## for Python, needs to appear before every class or function definition, so that it is picked up by Doxygen. Many special commands, which start with \ or @, can be used to define parts of the code and format the output. Markdown syntax is also understood within the comment block, which makes it convenient to emphasize certain parts of the documentation.

/**
 * Returns the name of the workbench object.
 */
std::string name() const;

/**
 * Set the name to the workbench object.
 */
void setName(const std::string&);

/// remove the added TaskWatcher
void removeTaskWatcher(void);


Extra python modules
List of Commands