我被要求使用msbuild构建基于qt的解决方案文件。我尝试使用以下命令,我最终得到一个错误。我可以使用下面显示的相同命令构建一个wix项目。
C:\Windows\Microsoft.NET\Framework\v4.0.30319>MSBuild "C:\path\to\my solution file\my.sln" /t:Build /p:Configuration=Release /p:Platform=Win32
有了这些,我收到一个错误说,
C:\Program Files\MSBuild\Microsoft.CppCommon.targets(155,5):
error MSB6006: "cmd.exe" exited with code 3. [c:\my\path to\project file\my.vcxproj]
当Moc'ing时,系统无法读取my.vcxproj中各种文件的路径。我收到以下错误
InitializeBuildStatus:
Touching "Win32\Release\my.unsuccessfulbuild".
CustomBuild:
Moc'ing "dialog.h"...
The system cannot find the file path specified
Moc'ing "Centralwidget.h"...
The system cannot find the file path specified
依旧......
我也尝试使用qmake进行构建,但没有成功。请找出使用哪种方法构建基于qt的解决方案文件的好建议。提前谢谢
答案 0 :(得分:2)
使用MSBuild构建Qt解决方案文件,
def buildsolution(self,solutionpath):
if not os.path.isfile(self.msbuild):
raise Exception('MSBuild.exe not found. path=' + self.msbuild)
arg1 = '/t:Rebuild'
arg2 = '/p:Configuration=Release'
arg3 = '/p:Platform=Win32'
proc = subprocess.Popen(([self.msbuild,solutionpath,arg1,arg2,arg3]), shell=True,
stdout=subprocess.PIPE)
while True:
line = proc.stdout.readline()
wx.Yield()
if not line: break
proc.wait()
self.msbuild = r'C:\ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ MSBuild.exe'和 solutionpath = r'路径到\ qt解决方案文件\ my.sln'