下载编译

创建日期:2024-11-30
更新日期:2024-12-01

需求

  1. MongoDB v3.6.8+
  2. Chrome 81.0+ 或者 ​​Firefox 75.0+

下面的软件仅在从源码编译时才需要。

  1. Golang 1.14.2+
  2. NodeJS 14.1+
  3. gcc 9.3.0+ (Windows上需要安装tdm-gcc、MinGW-w64或MinGW。请保证gcc可以通过命令行访问)
  4. git 2.25.1+

注意 版本号仅供参考。

源码下载

你可以使用git下载源码。

git clone https://github.com/tengge1/ShadowEditor.git

在国内,由于github比较慢,可以使用gitee。

git clone https://gitee.com/tengge1/ShadowEditor.git

源码编译

Web版编译

  1. 如果你在国内, 执行npm run set-proxy设置go语言和nodejs代理。
  2. 执行npm install安装nodejs依赖。
  3. 执行npm run build构建服务端和Web端。
  4. 编辑build/config.toml,修改MongoDB的host和port设置。
  5. 执行npm run start启动服务端。现在你可以访问:http:~/~/localhost:2020。

桌面版编译

  1. 请先编译Web版。
  2. 下载MongoDB,解压到utils/mongodb文件夹中。
  3. 构建Web版。
  4. 执行npm run build-desktop可以在文件夹build/desktop中创建一个桌面版应用。

安装服务

安装为Windows服务

  1. 以管理员身份在build文件夹中打开PowerShell或cmd。
  2. 运行.\ShadowEditor install,将ShadowEditor安装为服务。
  3. 运行.\ShadowEditor start,启动ShadowEditor服务。
  4. 现在你可以访问:http:~/~/localhost:2020。
  5. 你也可以在Windows服务管理器中管理这个服务。

安装为Ubuntu服务

  1. 编辑./scripts/service_linux/shadoweditor.service,设置正确的路径。
  2. 执行sudo cp ./scripts/service_linux/shadoweditor.service /etc/systemd/system/。
  3. 执行sudo systemctl daemon-reload重新加载服务守护程序。
  4. 执行sudo systemctl start shadoweditor启动服务。
  5. 执行sudo systemctl enable shadoweditor设置开机自启动。

命令行使用

PS E:\github\ShadowEditor\build\> .\ShadowEditor
ShadowEditor is a 3D scene editor based on three.js, golang and mongodb.
This application uses mongodb to store data.

Usage:
  ShadowEditor [command]

Available Commands:
  debug       Debug service on Windows  
  help        Help about any command    
  install     Install service on Windows
  serve       Start server
  start       Start service on Windows
  stop        Stop service on Windows
  version     Print the version number

Flags:
      --config string   config file (default "./config.toml")
  -h, --help            help for ShadowEditor

Use "ShadowEditor [command] --help" for more information about a command.