如何通过"cabal build"或"stack build"来构建带有图标的项目 [英] How to build a project with an icon by `cabal build` or `stack build`

查看:53
本文介绍了如何通过"cabal build"或"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 the stack.yaml file
    ghc-options:

        "$targets": Icon.o

  • 对于 cabal 项目,将以下 ghc-options 添加到 .cabal 文件
    • for a cabal project, add the following ghc-options into the .cabal file
    •     ghc-options:
      
              Icon.o
      

      这篇关于如何通过"cabal build"或"stack build"来构建带有图标的项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆