我在C ++中有一个单文件项目,只是想尝试如何使用GYP构建它。
我无法使用Homebrew或PIP来安装GYP,因此我只是将GYP源回购作为子模块克隆到了我的存储库中,因此看起来像这样:
helloworld.gyp
src/
/main.cc
gyp/
/gyp
/gyp_main.py
/...
到目前为止,我只想与Ninja建立我的资源。在项目的根目录下,我执行以下操作:
$ gyp/gyp --depth=. --format=ninja helloworld.gyp
xcodebuild: error: SDK "/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk" cannot be located.
xcrun: error: unable to lookup item 'PlatformPath' in SDK '/'
但是,已经安装了Xcode本身,并且还提供了其他命令行工具:
$ ls -la /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/
Entitlements.plist SDKSettings.plist System usr
在Windows计算机上,它同样会失败:
$ gyp --depth=. --format=ninja helloworld.gyp
Traceback (most recent call last):
File "C:\Python27\Scripts\gyp-script.py", line 11, in <module>
load_entry_point('gyp==0.1', 'console_scripts', 'gyp')()
File "C:\Python27\lib\site-packages\gyp-0.1-py2.7.egg\gyp\__init__.py", line 545, in script_main
return main(sys.argv[1:])
--- 8< ---
File "C:\Python27\lib\site-packages\gyp-0.1-py2.7.egg\gyp\MSVSVersion.py", line 485, in SelectVisualStudioVersion
raise ValueError('Could not locate Visual Studio installation.')
ValueError: Could not locate Visual Studio installation.
我认为我滥用了该工具。如何仅生成Ninja构建文件,以及通常如何响应此类错误消息?