Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

编译的时候如何以release的方式编译? #30

Open
Leowolf93 opened this issue Aug 8, 2023 · 3 comments
Open

编译的时候如何以release的方式编译? #30

Leowolf93 opened this issue Aug 8, 2023 · 3 comments
Labels
help wanted Extra attention is needed

Comments

@Leowolf93
Copy link

我尝试修改了Build和install脚本
`function BuildSDK([string]$arg0, [string]$arg1, [string]$arg2) {
Remove-Item sdk_build -Force -Recurse -ErrorAction SilentlyContinue
New-Item sdk_build -ItemType Directory | Out-Null
cmake -G $arg2 -A Win32 -B sdk_build $arg0 $arg1
Write-Host 'Building sdk' -ForegroundColor Yellow
cmake --build sdk_build --config Release
}

function InstallSDK {
if (-Not(Test-Path -Path sdk_build)) {
Write-Host 'Project has not been built, run ".\build.ps1 build" first' -ForegroundColor Yellow
return
}
Write-Host 'Installing sdk, require Administrator privilege' -ForegroundColor Yellow
cmake --build sdk_build --target install --config Release
}
`
但是这样编译出来的添加到程序中,主程序直接不能运行(在vs的release模式可以运行,但是单独把exe拿出来,用windeployqt打包后就不行)。
请大神指点一二,谢谢!

@zqfan
Copy link
Member

zqfan commented Aug 9, 2023

不能运行有报错信息也可以发一下哈。

@zqfan zqfan added the help wanted Extra attention is needed label Aug 9, 2023
@Leowolf93
Copy link
Author

Leowolf93 commented Aug 9, 2023

我重新更新一下哈
首先我确定我按照github上的步骤一步步完成了配置
之后修改build32.ps1的BuildSDK函数部分如下:
function BuildSDK([string]$arg0, [string]$arg1, [string]$arg2) { Remove-Item sdk_build -Force -Recurse -ErrorAction SilentlyContinue New-Item sdk_build -ItemType Directory | Out-Null cmake -G $arg2 -DCMAKE_BUILD_TYPE=Release -A Win32 -B sdk_build $arg0 $arg1 Write-Host 'Building sdk' -ForegroundColor Yellow cmake --build sdk_build }
编译后,理应生成release版本的sdk。InstallSDK后,我使用vs进行引入操作。包括c++附加包含目录,链接器附加库目录,附加依赖项操作。
但是程序编译后却无法运行,提示如下图
image
但是我点击“代码生成”,更改“运行库”里的选项,更改为“多线程调试 (/MTd)”的时候,程序就可以运行了。
这是否是因为我使用的编译后的sdk依旧是debug的问题?

@Leowolf93
Copy link
Author

不能运行有报错信息也可以发一下哈。
已更新,劳烦您看一下。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants