Skip to content
holishing edited this page May 23, 2020 · 19 revisions

PCMan程式專案建置和執行:逐步解說

前置作業:工具安裝與環境設定

  1. 建立一個本機資料夾可以放你的原始碼,這邊名字舉 %USERPROFILE%\source\repo\ 為例,請自行代換成你喜歡的資料夾路徑

    • 此資料夾建議都放在 C:\ 底下任一子目錄,尤其是 vcpkg,若 vcpkg 裝在其他磁碟分割區可能踩到相關 bug [註]
    • 請確保 C:\ 有預留足夠剩餘空間,至少留 30~50 GiB 空間,100 GiB 更保險
    • 若刻意把使用者目錄(放桌面/文件/下載等資料夾)的位置改到 D:\ 或其他磁碟分割區者,請自己想辦法,本篇文章不提供解決方案
  2. 安裝 Visual Studio 2017/2019 (Community 即可)

    • 請至官方網站下載: https://visualstudio.microsoft.com
    • 安裝過程詢問到要安裝那些模組時,將C++有關的套件選項都勾起來安裝,依照安裝程式導引安裝完成
    • 安裝 Visual Studio 2019 者可參考 此頁 匯入組態檔,節省套件找尋時間
  3. 安裝 Git for Windows (https://gitforwindows.org) 以利直接使用 git 指令方便之後操作

  4. 安裝 vcpkg 原始碼套件管理員

    • 打開命令提示字元(cmd),執行以下指令抓取 vcpkg 原始碼
      • git clone https://github.com/microsoft/vcpkg.git %USERPROFILE%\source\repo\vcpkg
    • 執行 cd %USERPROFILE%\source\repo\vcpkg 切換到該目錄下
    • 執行 bootstrap-vcpkg.bat 執行安裝指令,完成後會出現 vcpkg.exe
    • 同目錄下再執行 vcpkg integrate install,讓 Visual Studio 環境可以直接使用藉由 vcpkg 安裝好的套件
      • 正確會印出訊息 Applied user-wide integration for this vcpkg root.
    • 於同目錄下再執行 vcpkg install cpprestsdk[default-features,websockets]:x86-windows 以安裝相關套件

專案抓取與建置

  1. 打開命令提示字元,執行以下指令抓取 PCMan 原始碼

    • git clone https://github.com/pcman-bbs/pcman-windows.git %USERPROFILE%\source\repo\pcman-windows
  2. 建置執行 PCMan 專案

    • 用 Visual Studio 開啟 %USERPROFILE%\source\repo\pcman-windows\PCMan.sln,並等待載入結束
    • 在 Combo 專案 > 右鍵 > Build(建置) ,等待建置成功
    • 在 Lite 專案 > 右鍵 > Build(建置) ,等待建置成功
    • 在 Lite 或 Combo 專案 > 右鍵 > Set as StartUp Project(設定為起始專案) > 按下 F5 , 即可執行出現 PCMan 的程式畫面

附註

[註] : https://github.com/Microsoft/vcpkg/issues/5956 提到 I have reinstalled vcpkg directly to the c-drive and now it is working, even if I don't know why. Thank you for the support.

本頁面維護者

Clone this wiki locally