$ git clone --recursive https://github.com/SaschaWillems/Vulkan.git $ cd Vulkan $ export PATH="/user/local/bin:$PATH" $ python3 download_assets.py $ cd xcode # 编译 MoltenVK $ git clone https://github.com/KhronosGroup/MoltenVK.git MoltenVKSrc $ cd MoltenVKSrc $ brew install cmake $ brew install python $ brew install ninja $ bash fetchDependencies $ make $ make macos # 拷贝出来,否则链接的时候找不到文件错误 $ cp ./Package/Release/MoltenVK/macOS/dynamic/* ./Package/Release/MoltenVK/macOS/ $ cd .. $ rm -rf MoltenVK $ ln -s -f ./MoltenVKSrc/Package/Release/MoltenVK MoltenVK # 编译 assimp $ cd assimp $ git clone https://github.com/assimp/assimp.git -b v3.3.1 assimp-mac $ cd assimp-mac # 编译单元测试的时候,链接的时候会失败,我们关闭即可。 $ cmake CMakeLists.txt -G 'Unix Makefiles' -DASSIMP_BUILD_TESTS=OFF $ make $ cd .. $ ln -s -f assimp-mac assimp-macos $ cd .. $ xcodebuild -project "examples.xcodeproj" -scheme "examples-macos" build
编译 assimp
的时候出现如下错误:
~/Vulkan/xcode/assimp/assimp-mac/code/D3MFImporter.cpp:230:29: error: invalid operands to binary expression ('float (*)(const char *, const char *)' and 'nullptr_t') vertex.z = ai_strtof>(xmlReader->getAttributeValue(D3MF::XmlTag::z.c_str()), nullptr);
这个原因是由于代码的BUG
导致的,修改~/Vulkan/xcode/assimp/assimp-mac/code/D3MFImporter.cpp
的230
代码即可。
其他编译错误无视即可,只要能编译出 libassimp.3.3.1.dylib
即可。
其他编译错误,懒得搞了。