在MacOS上将Vapor编译为独立应用程序 [英] Compiling Vapor as Standalone App on MacOS

查看:118
本文介绍了在MacOS上将Vapor编译为独立应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用MacOS应用程序的代码编译Vapor,以便将其放置在内部服务器上(拖动并单击以启动它).我希望不必在服务器上安装Xcode,swift和其他开发文件.我是新手,敏捷而敏捷.从xCode构建它时,我正在运行某些东西.有人问是否可以将其嵌入到应用程序中,结果是肯定的,没有回应.是的并没有提供有关如何执行此操作的任何指导. 可以将其编译为独立的OSX应用程序吗? 我需要做什么才能使其实现?如果您有任何知识,可将我指向文档.我已经编译了独立的应用程序.只是不知道该怎么做蒸气. 谢谢

I would like to compile Vapor with my code as a MacOS app so I can place it on internal server (drag and click to launch it). I would prefer not to have to install Xcode, swift and other development files on the server. I am new to vapor and swift. I have things running when I build it from xCode. Someone else asked if they could embed it in app, there was yes and no response. The yes did not provide any direction as to how to do it. Can it be compiled to a standalone OSX App? What do I need to do to make it happen? Point me to docs if you know of any. I have compiled apps that are standalone. Just don't know how to do Vapor. Thanks

推荐答案

我认为,至少最初,您必须安装Xcode才能构建蒸气应用程序,而只是为了获取Swift东西.完成此操作后,使用终端进入蒸气项目目录,然后使用以下命令构建并运行该应用程序:

I think, initially at least, you have to install Xcode in order to build a vapor application, just to get the Swift stuff. Having done that, use terminal to change into the vapor project directory and then build and run the application using:

vapor update
vapor build
vapor run

这将导致可执行文件被创建并运行.实际位置取决于您是为调试还是为生产而编译(在Config中设置).假设您仍处于调试阶段,则可以通过键入以下内容直接运行已编译的可执行文件:

This will result in an executable being created and run. The actual location depends whether you are compiling for debug or production (set in Config). Assuming you are still at the debug stage, the compiled executable can be run directly by typing:

.build/debug/Run

从蒸气项目的主目录而不是vapor run.它不会从其他地方运行,因为它使用了Config等的相对路径.

from your vapor project's home directory, instead of vapor run. It won't run from elsewhere because it uses relative paths to Config, etc.

然后您可以将项目树和可执行文件复制到另一台Mac,然后尝试安装Swift运行时库等,以使其在没有Xcode等的情况下运行.

You could then copy the project tree and executable to another Mac and try installing the Swift runtime libraries, etc. to have it running without Xcode, etc.

这篇关于在MacOS上将Vapor编译为独立应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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