CMAKE基礎指令記錄
1. CMake中條件判斷語句
if(<constant>) ... else() ... endif()
當 constant 為 1/ON/YES/TRUE/Y/Non-zero時判別為真,
當 constant 為 0/OFF/NO/FALSE/N/IGNORE/NOTFOUND 或者為空字串 或字尾為 -NOTFOUND 時判斷為假。
大小寫敏感,當不是上述列舉出來的這些常量時,作為變數對待。
2. 如果想要將專案編譯成動態連結庫的形式,可以在命令列通過引數控制
cmake -DBUILD_SHARED_LIBS=ON ..
3.下載並安裝eigen、ceres-solver等數學運算庫
可以參考openMVS build wiki
4. 設定編譯選項
CMake中可以通過 CMAKE_BUILD_TYPE來對編譯方式進行控制,使產生 Debug 型別的可執行程式或者 Release 型別的可執行程式,方便我們進行除錯或者優化。
SET(CMAKE_BUILD_TYPE "Release")
可以選擇的型別有:空, Debug, Release, RelWithDebInfo, MinSizeRel。
TODO
- Improve compile time using forward declaration of options
- 借鑑並學習COLMAP 提升編譯速度的技巧!
附:各種不同的GPU架構對應的 sm 標誌
參考資料
[1] Cmake中查詢並使用其他程式庫https://blog.csdn.net/laolu1573/article/details/60573511
[2]配置eigen3和ceres為thirdpartyhttps://blog.csdn.net/billbliss/article/details/88585171
[3]Detecting Cuda Architecture required by CMake using NVCChttps://wagonhelm.github.io/articles/2018-03/detecting-cuda-capability-with-cmake
[4]Matching SM architectures (CUDA arch and CUDA gencode) for various NVIDIA cards