如何通过"cabal build"或"stack build"来构建带有图标的项目 [英] How to build a project with an icon by `cabal build` or `stack build`
问题描述
我想构建一个带有图标的可执行文件.通过谷歌搜索,我发现此处的说明,但是它只能通过使用 ghc
.
I want to build an executable with an icon. By googling it, I find the instruction here, but it only works by compiling a source file with ghc
.
如果我想通过 cabal build
或 stack build
构建具有可执行文件的项目,应如何配置 .cabal
或 .yaml
文件,这样 cabal build
或 stack build
可以直接创建带有图标的可执行文件?
If I want to build a project with an executable by cabal build
or stack build
, how should I configure the .cabal
or .yaml
files such that cabal build
or stack build
can directly create an executable with an icon?
我已经用谷歌搜索了一段时间,但没什么用.
I've googled it for a while, but nothing useful.
如果有任何提示,我将不胜感激.
I appreciate it if any tips are given.
推荐答案
根据@Willem Van Onsem的建议,以下是解决方法:
According to @Willem Van Onsem's suggestion, the following is the solution:
- 对于
stack
项目,将以下配置添加到stack.yaml
文件
- for a
stack
project, add the following configure into thestack.yaml
file
ghc-options:
"$targets": Icon.o
- 对于
cabal
项目,将以下ghc-options
添加到.cabal
文件 中
- for a
cabal
project, add the followingghc-options
into the.cabal
file
ghc-options:
Icon.o
这篇关于如何通过"cabal build"或"stack build"来构建带有图标的项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!