1. 程式人生 > >Linux中 cmake-3.x 編譯安裝以及man page添加

Linux中 cmake-3.x 編譯安裝以及man page添加

pypi --help edit 互聯 gui 一個 源代碼 beta alt

首先回顧一下 cmake-2.x 的編譯安裝。

================ cmake-2.x編譯安裝說明 ================
編譯安裝的命令:

./bootstrap --prefix=安裝目錄(默認為/usr/local)
make
make install(根據安裝目錄的不同,可能需要root權限)

執行腳本文件bootstrap時加上參數“--qt-gui”,可編譯生成GUI版cmake程序。

編譯、安裝完成後,編輯文件 /etc/profile ,將“安裝目錄/bin”加入環境變量PATH。

安裝好的cmake自帶man文檔,只要將“安裝目錄/bin”加入環境變量PATH,即可使用man查看cmake的使用幫助,無需修改 /etc/man.config 。


================ cmake-3.x編譯安裝說明 ================
安裝步驟基本同cmake-2.x,主要區別在於幫助文檔的構建方式。

cmake-2.x的幫助文檔其實是嵌在源代碼中,並編譯進可執行文件,通過“--help-full、--help-html、--help-man”等參數分別輸出文本格式、html格式、man格式的幫助文檔。

cmake-3.x只保留了“--help-full”用於輸出文本格式的幫助文檔,另外兩種格式需要借助文檔生成工具sphinx(一個Python插件)。

在執行腳本文件bootstrap時,通過如下參數指定要構建的幫助文檔:

--sphinx-man 構建man幫助文檔


--sphinx-html 構建html幫助文檔
--sphinx-qthelp 構建qch幫助文檔
--sphinx-build=/path/to/sphinx-build 設置sphinx-build程序的路徑

執行make前需要安裝sphinx。調用Python提供的pip命令(Python3中為pip3)進行安裝:

詳見:https://github.com/sphinx-doc/sphinx/

README for Sphinx

This is the Sphinx documentation generator, see http:
//www.sphinx-doc.org/. Installing Install from PyPI to use stable version: pip install -U sphinx
Install from PyPI to use beta version: pip
install -U --pre sphinx Install from newest dev version in stable branch: pip install git+https://github.com/sphinx-doc/[email protected] Install from newest dev version in master branch: pip install git+https://github.com/sphinx-doc/sphinx Install from cloned source: pip install . Install from cloned source as editable: pip install -e .

在安裝過程中,pip需要聯網下載安裝一堆別的Python插件。為了在無法聯網的計算機上安裝cmake-3.x,建議先在一臺能訪問互聯網的計算機上安裝sphinx,構建cmake-3.x及其幫助文檔。執行make install後,將安裝好的文件部署到無法聯網的計算機。

最後要將幫助文檔路徑寫到/etc/man_db.conf文件中。

技術分享

技術分享


cmake下載地址 https://cmake.org/files/

sphinx下載地址 https://github.com/sphinx-doc/sphinx/

---------------------------------------------------------------------------------------------

轉自:http://blog.csdn.net/zhawk/article/details/74276175

Linux中 cmake-3.x 編譯安裝以及man page添加