2023年3月26日 星期日

快速配置vulkan學習環境

安裝C++ Compiler

Microsoft C++ Compiler

安裝scoop、xmake ➡️ 教學

vscode 裝上面2個插件

用xmake生成專案

xmake create -t console hello_world

用xmake安裝glfw、glm ➡️ 教學

xrepo install glfw
xrepo install glad

設定xmake.lua ➡️ 教學

是不是比Visual Studio的設定簡單?

生成compile_commands

xmake project -k compile_commands

複製貼上程式碼 ➡️ main.cpp


編譯和執行exe

xmake build
xmake run
exe跑起來了,只是現在還有毛毛蟲

重開VSCode

現在要不要?


就自動幫你生成c_cpp_properties.json

再執行1次
xmake project -k compile_commands

毛毛蟲消失了
自動完成也能正常運作

編輯時使用c++17

會用到c++17才有的std::optional

載入圖片

image篇載入圖片會用到stb_image.h

安裝庫
xrepo install stb

載入模型

image篇載入圖片會用到tiny_obj_loader.h

安裝庫
xrepo install tinyobjloader

更新xmake.lua

更新compile_commands
xmake project -k compile_commands

毛毛蟲才會不見

沒有留言:

張貼留言