===================== 開發 librecad ===================== librecad是opensource並且是GPLv2授權,所以你可以用git下載,再下載QT來開發librecad. .. note:: 想要開發自己的CAD難度頗高的,但是只要有心並沒有做不到的事,對於程式不了解的人先不用浪費時間看這篇,先打基礎打穩才是首要的. 建置專案開發環境是很重要的,筆者盡可能的把每個步驟都呈現,希望開發門檻降低,不要因為一個步驟就放棄了. 有人為了喝一杯牛奶而養一頭牛,我想寫程式就是這樣,本來想說會一種就可以了,結果什麼都得學.但是樂趣就是在養牛,喝牛奶只是一種成果.希望大家都能喝到香淳的牛奶. 基本上你需要一些C++的基礎,QT是開發環境,熟悉一陣子基本就能上手,不習慣只是一開始. - 下載git主要是從網路取得libreCAD的源始碼. - 下載QT的作用,libreCAD專案是用QT開發的 - boost是libreCAD所需的一個函式庫 下載及安裝git ================ git是分散式版本控制軟體,目前廣為opensouce社群所使用,我們在windows使用git來下載libreCAD的源始碼. `請至git下載首頁 . `_ ,按下載 .. rubric:: 下載 .. figure:: ../img/develop_001.png :scale: 20% .. rubric:: 安裝 .. note:: 安裝git時會有一些選項選擇,例如ssh丶使用終端機...等等,建議初學者要多學習linux系統的指令及相關工具. - 請一定要參考圖片的選擇,不同的選擇有不同的操作方式,但是結果是相同的. - 依筆者選項,安裝完成後執行 |Git Bash| ,輸入的是linux指令,而不是windows指令. .. figure:: ../img/develop_002.png :scale: 30% .. figure:: ../img/develop_003.png :scale: 30% .. figure:: ../img/develop_004.png :scale: 30% .. figure:: ../img/develop_005.png :scale: 30% .. figure:: ../img/develop_006.png :scale: 30% .. figure:: ../img/develop_007.png :scale: 30% .. figure:: ../img/develop_008.png :scale: 30% .. figure:: ../img/develop_009.png :scale: 30% .. figure:: ../img/develop_010.png :scale: 30% .. figure:: ../img/develop_011.png :scale: 30% .. figure:: ../img/develop_012.png :scale: 30% .. figure:: ../img/develop_013.png :scale: 30% .. figure:: ../img/develop_014.png :scale: 25% .. |Git Bash| image:: ../img/Git_Bash.png :scale: 20% .. rubric:: 下載libreCAD 先建立下載的目錄,以範例顯示在d:/liberCAD/src,然後進入src目錄再使用git clone下載源始碼. 如下所示: .. code-block:: sh :linenos: tiger@XXX ~ $ cd d: tiger@XXX /d $ mkdir libreCAD tiger@XXX /d $ cd libreCAD/ tiger@XXX /d/libreCAD $ mkdir src tiger@XXX /d/libreCAD $ cd src tiger@XXX /d/libreCAD/src $ git clone https://github.com/LibreCAD/LibreCAD.git 下載及安裝QT ================ libreCAD是使用QT來開發的,所以我們需要安裝QT,目前libreCAD2.1.x版本需要 Qt-5.4.1 Windows 32位元 (MinGW 4.9.1),請至 `下載QT5.4.1版本 `_ .. figure:: ../img/develop_023.png :scale: 25% 點擊 |qt-opensource-windows-x86-msvc2013-5.4.1| 安裝QT5.4.1 .. figure:: ../img/develop_024.png :scale: 50% .. figure:: ../img/develop_025.png :scale: 50% .. figure:: ../img/develop_026.png :scale: 50% .. figure:: ../img/develop_027.png :scale: 50% .. figure:: ../img/develop_028.png :scale: 50% .. figure:: ../img/develop_029.png :scale: 50% .. figure:: ../img/develop_030.png :scale: 50% 點擊 |qt-opensource-windows-x86-mingw491_opengl-5.4.1| 安裝mingw491 下載及安裝boost ================ libreCAD使用boost函式庫,所以需要下載boost並指專案中指定路徑. `下載boost `_ ,並點選boost_xxx.zip下載 .. figure:: ../img/develop_018.png :scale: 25% .. rubric::解壓縮 將boost_xxx.zip解壓縮至c:\boost,如下圖所示: .. figure:: ../img/develop_019.png :scale: 25% .. figure:: ../img/develop_020.png :scale: 25% 在git下載的libreCAS目錄下打開記事本新增custom.pro檔案. .. figure:: ../img/develop_035.png :scale: 25% 編輯custom.pro,增加boost路徑,如下圖所示: .. figure:: ../img/develop_021.png :scale: 25% 執行QT ================ 啟動QT Creator: ---------------- .. figure:: ../img/develop_034.png :scale: 25% 配置libreCAD專案: ------------------- .. figure:: ../img/develop_031.png :scale: 25% .. figure:: ../img/develop_032.png :scale: 25% .. figure:: ../img/develop_033.png :scale: 25% 建置設定 ---------------- .. figure:: ../img/develop_036.png :scale: 25% 建置專案 ---------------- .. figure:: ../img/develop_037.png :scale: 25% 執行libreCAD ---------------- .. figure:: ../img/develop_038.png :scale: 25% 大功告成 ----------------- 終於從source code 順利編譯及執行了libreCAD,接下來你可以增加你想要的功能 .. figure:: ../img/develop_039.png :scale: 25% .. figure:: ../img/develop_040.png :scale: 25% D:\libreCAD\qm;D:\libreCAD\qm\librecad_zh_tw.qm .. |qt-opensource-windows-x86-msvc2013-5.4.1| image:: ../img/qt-opensource-windows-x86-msvc2013-5.4.1.png :scale: 50% .. |qt-opensource-windows-x86-mingw491_opengl-5.4.1| image:: ../img/qt-opensource-windows-x86-mingw491_opengl-5.4.1.png :scale: 50%