Skip to content

Commit

Permalink
Improved build environment
Browse files Browse the repository at this point in the history
- Now able to create Windows installers
  • Loading branch information
marciot committed Jul 15, 2020
1 parent d0fd0eb commit f3a7d84
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 64 deletions.
3 changes: 1 addition & 2 deletions build-web-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#

USE_BABEL=0
SRC_DIR=src-app
OUT_DIR=release-web
OUT_DIR=dist/web

getFiles() {
awk -F "'" '
Expand Down
32 changes: 0 additions & 32 deletions docs/run-using-electron.md

This file was deleted.

67 changes: 67 additions & 0 deletions docs/symple-slicer-development.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
Building Symple Slicer Desktop
------------------------------

To build the Electron desktop app, install node.js on your machine then:

```
git clone [email protected]:SynDaverCO/symple-slicer.git
cd symple-slicer
git submodule update --init
npm install
```

To run:

```
npm start
```

To build all distributibles:

```
npm run package-win
npm run package-mac
npm run package-linux
npm run installer-win
```

Distributables will be stored in the `dist` directory.


Building Symple Slicer Web
--------------------------

Building the web version of Symple Slicer relies on UNIX shell
scripts. Under Windows, you may want to use WSL version 1.

There is a bug in Chromium where WebGL will fail to start
if the files are hosted in a network drive, as is the case
for the native WSL Linux file system. Because of this, it is
necessary to checkout the files into a Windows native drive
using the regular windows command prompt (see steps above),
then from within WSL create a symlink to that location:

```
ln -s /mnt/c/Users/USERNAME/Documents/symple-slicer
cd symple-slicer
```

To run a web server on localhost serving the app:

```
./run-local-host.sh
```

To rebuild the Cura Engine from source:

```
./build-cura-engine.sh
```

To create a web release of Symple Slicer:

```
./build-web-release.sh
```


13 changes: 9 additions & 4 deletions estimate-size.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,17 @@
# Estimates the size of the entire slicer package if it were minimized and
# stored in a zip file.

SRC_DIR=src-app

getFiles() {
awk -F "'" '
/^const filesToCache/ {PRINT=1}
/];/ {PRINT=0}
{sub(/\?.*$/, "", $2); if(PRINT) print $2}
' service-worker.js | sed '/^\.$/ c index.html'
' $SRC_DIR/service-worker.js | sed '/^\.$/ c index.html'
echo service-worker.js
echo change_log.md
echo images/screenshot.png
}

minify() {
Expand All @@ -40,19 +45,19 @@ minify() {
do
mkdir -p build/`dirname $file`
if [[ $file == *.js ]]; then
uglifyjs $file > build/$file
uglifyjs $SRC_DIR/$file > build/$file
else
false
fi
if [ $? -ne 0 ]; then
cp $file build/$file
cp $SRC_DIR/$file build/$file
fi
done
}

FILES=`getFiles`

minify $FILES
minify

zip -r -9 packed.zip build
du -sh packed.zip
Expand Down
28 changes: 24 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
{
"name": "SympleSlicer",
"version": "1.0.0",
"description": "A desktop version of SynDaver Symple Slicer built with Electron",
"author": "SynDaver Labs, Inc.",
"license": "AGPL-3.0-or-later",
"homepage": "https://github.com/SynDaverCO/symple-slicer",
"bugs": {
"url": "https://github.com/SynDaverCO/symple-slicer/issues"
},
"scripts": {
"package-mac": "electron-packager src-app --platform=darwin --arch=x64 --overwrite --icon=src-app/images/icon.icns --prune=true --out=release-desktop",
"package-win": "electron-packager src-app --platform=win32 --arch=x64 --overwrite --icon=src-app/images/favicon.ico --prune=true --out=release-desktop",
"package-linux": "electron-packager src-app --platform=linux --arch=x64 --overwrite --icon=src-app/images/icon_512px.png --prune=true --out=release-desktop"
"start": "electron src-app",
"start-debug": "electron --enable-logging src-app",
"package-mac": "electron-packager src-app --platform=darwin --arch=x64 --overwrite --icon=app/images/icon.icns --prune=true --out=dist",
"package-win": "electron-packager src-app --platform=win32 --arch=x64 --overwrite --icon=app/images/favicon.ico --prune=true --out=dist",
"package-linux": "electron-packager src-app --platform=linux --arch=x64 --overwrite --icon=app/images/icon_512px.png --prune=true --out=dist",
"installer-win": "electron-builder --prepackaged dist/SympleSlicer-win32-x64",
"postinstall": "electron-builder install-app-deps"
},
"build": {
"directories": {
"app": "src-app"
}
},
"devDependencies": {
"electron-packager": "^14.2.1"
"electron-packager": "^14.2.1",
"electron-builder": "^22.4.1",
"electron": "^9.0.3"
}
}
2 changes: 0 additions & 2 deletions run-electron-app.bat

This file was deleted.

20 changes: 0 additions & 20 deletions src-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,7 @@
"version": "1.0.0",
"description": "A desktop version of SynDaver Symple Slicer built with Electron",
"main": "js/ElectronMain.js",
"scripts": {
"start": "electron .",
"start-debug": "electron --enable-logging .",
"install-wsl": "npm install && npm uninstall electron serialport && export npm_config_platform=win32 && npm install electron serialport && unset npm_config_platform",
"test": "echo No test command available"
},
"repository": {
"type": "git",
"url": "git+https://github.com/SynDaverCO/symple-slicer.git"
},
"author": "SynDaver Labs, Inc.",
"license": "AGPL-3.0-or-later",
"bugs": {
"url": "https://github.com/SynDaverCO/symple-slicer/issues"
},
"homepage": "https://github.com/SynDaverCO/symple-slicer#readme",
"dependencies": {
"serialport": "^9.0.0"
},
"devDependencies": {
"electron": "^9.0.3",
"electron-rebuild": "^1.11.0"
}
}

0 comments on commit f3a7d84

Please sign in to comment.