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爲thirdparty https://blog.csdn.net/billbliss/article/details/88585171
[3] Detecting Cuda Architecture required by CMake using NVCC https://wagonhelm.github.io/articles/2018-03/detecting-cuda-capability-with-cmake
[4] Matching SM architectures (CUDA arch and CUDA gencode) for various NVIDIA cards