在認識modmesh的過程中,包括modmesh本身以及延伸的小實作,幾乎處處可見make及CMake的身影;雖然對它們的認識甚少,但操作的過程中可以隱約感受到make與cmake似乎存在某種相依性,擁有類似的機制。同樣仰賴導演(make, cmake)與腳本(Makefile, CMakeList.txt),但卻做著不太一樣的事情,好像不只是差了一個C這麼簡單。 ~/git-repo/importation$ ls build CMakeLists.txt pybind11 test.cpp ~/git-repo/importation/build$ cmake .. ~/git-repo/importation/build$ ls CMakeCache.txt CMakeFiles cmake_install.cmake Makefile pybind11 ~/git-repo/importation/build$ make CMake vs make? 這裡 對於make做了些許的整理,make可以用來自動化shell script。CMake之於Make,與make之於shell script,存在了一些相似性。 「CMake 用來產生跨平台的專案建置文件,在 windows 下它會生成 visual studio 的專案檔 (.sln) codeblock eclipse,在 linux 下它會生成 Makefile。」在cmake之前的環境如下: ~/git-repo/importation$ ls CMakeLists.txt pybind11 test.cpp ~/git-repo/importation$ ls build/ (empty) 然後創建build這個directory,這能夠幫助我們將原始文件以及CMake過程的中間產物做做區分,再進行CMake: ~/git-repo/importation$ mkdir build ~/git-repo/importation$ cd build/ ~/git-repo/importation/build$ cmake .. 執行完成後,build底下就會有Makefile: ~/git-repo/importation/build$ ls CMakeCac...