Skip to content

Commit

Permalink
Add convenient shell scripts to build everything
Browse files Browse the repository at this point in the history
- both scripts contain every step necessary to go from a fresh clone to a fully built website
- updates readme with new instructions
- removed unused commands from package.json
  • Loading branch information
jspanchu committed Apr 12, 2024
1 parent 621d830 commit 5699e1e
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 62 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- name: Build
run: |
npm install
npm run build-wasm
npm run build
run: ./build.sh
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ pnpm-debug.log*
*.sln
*.sw?

# When using my own VTK branch for testing/development,
# I clone VTK into dev-vtk/src and build VTK inside dev-vtk/build-vtk-wasm
dev-vtk

# Wasm output
out/
Expand Down
67 changes: 12 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,63 +1,20 @@
# base
# Project setup

## Project setup
## Requirements

```
# yarn
yarn
# npm
npm install
# pnpm
pnpm install
```

### Build C++

```
npm run build-wasm
```

### Compiles and hot-reloads for development

```
# yarn
yarn dev
1. docker
2. npm

# npm
npm run dev
The build process is composed of two steps. You will need to compile C++ components to generate `.wasm` files and then run some `npm` commands to bundle those into a static site. For convenience, the shell scripts provided for Windows and Unix do everything needed to build a website from a fresh clone.

# pnpm
pnpm dev
```

### Compiles and minifies for production

```
# yarn
yarn build
# npm
npm run build
## Build

# pnpm
pnpm build
**Windows**
```sh
.\build.ps1
```

### Lints and fixes files

**Unix**
```sh
./build.sh
```
# yarn
yarn lint
# npm
npm run lint
# pnpm
pnpm lint
```

### Customize configuration

See [Configuration Reference](https://vitejs.dev/config/).
23 changes: 23 additions & 0 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
$erroractionpreference = "stop"

$sdk_version="v9.3.0-2490-g97c85d6930-20240401"
$sdk_image="kitware/vtk-wasm-sdk"
$sdk_config="Release"

$sdk_dir="/VTK-install/$sdk_config/lib/cmake/vtk"

docker run `
--rm `
-v"$pwd":/vtkWasmBenchmarks `
${sdk_image}:${sdk_version} `
emcmake cmake -GNinja -S /vtkWasmBenchmarks -B /vtkWasmBenchmarks/out -DCMAKE_BUILD_TYPE="$sdk_config" -DVTK_DIR="$sdk_dir"

docker run `
--rm `
-v"$pwd":/vtkWasmBenchmarks `
${sdk_image}:${sdk_version} `
cmake --build /vtkWasmBenchmarks/out

npm i

npm run build
33 changes: 33 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/sh

set -e
set -x

sdk_version="v9.3.0-2490-g97c85d6930-20240401"
readonly sdk_version

sdk_image="kitware/vtk-wasm-sdk"
readonly sdk_image

sdk_config="Release"
readonly sdk_config

sdk_dir="/VTK-install/$sdk_config/lib/cmake/vtk"
readonly sdk_dir

docker run \
--rm \
-u "$(id -u):$(id -g)" \
-v"$PWD":/vtkWasmBenchmarks \
$sdk_image:$sdk_version \
emcmake cmake -GNinja -S /vtkWasmBenchmarks -B /vtkWasmBenchmarks/out -DCMAKE_BUILD_TYPE=$sdk_config -DVTK_DIR=$sdk_dir

docker run \
--rm \
-v"$PWD":/vtkWasmBenchmarks \
$sdk_image:$sdk_version \
cmake --build /vtkWasmBenchmarks/out

npm i

npm run build
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
"version": "0.0.0",
"private": true,
"scripts": {
"build-wasm": "npm run build-wasm:release",
"build-wasm:release": "npx itk-wasm -i kitware/vtk-wasm-sdk -b out -s . build -- Release -DDEBUGINFO=NONE -DOPTIMIZE=BEST",
"build-wasm:debug": "npx itk-wasm -i kitware/vtk-wasm-sdk -b out -s . build -- Debug -DDEBUGINFO=DEBUG_NATIVE -DOPTIMIZE=NO_OPTIMIZATION",
"build": "vue-tsc --noEmit && vite build",
"dev": "vite --base /",
"lint": "eslint . --fix --ignore-path .gitignore"
Expand Down

0 comments on commit 5699e1e

Please sign in to comment.