Skip to content

Commit

Permalink
add update
Browse files Browse the repository at this point in the history
  • Loading branch information
greggman committed May 17, 2024
1 parent 6a745eb commit 12f1276
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 1 deletion.
57 changes: 57 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,60 @@ This is a script to bundle/package tintd and hopefully publish it
tintd is a [language protocol server](https://microsoft.github.io/language-server-protocol/)
for [WGSL](https://gpuweb.github.io/gpuweb/wgsl/), the WebGPU Shading Language.

# Updating

This updates to the latest dawn and depot_tools

```
npm ci
npm run update
```

# Building

This builds for the local OS (win64,macOS-arm,linux)

```
npm ci
npm run build
```

## Prerequisites

### Windows

Before running the build script above you must have
Visual Studio C++ installed and have run the `vcvars64.bat` file.
I've tested with Visual Studio Community Edition 2022

Further you must have [cmake installed](https://cmake.org/download/)
and either in your path or at it's standard place of `C:\Program Files\CMake`

And you must have `node.js` installed, at least version 18.
I recommend using [nvm-windows](https://github.com/coreybutler/nvm-windows) to install it
as it makes it easy to switch version

### MacOS

Before running the build script above you must have
XCode installed and its command line tools

Further you must have [cmake installed](https://cmake.org/download/)
and either in your path or at it's standard place of `/Applications/CMake.app`

And you must have `node.js` installed, at least version 18.
I recommend using [nvm](https://github.com/nvm-sh/nvm) to install it
as it makes it easy to switch versions.

### Linux (Ubuntu)

Before running the build script above you need to install
the following dependencies

```
sudo apt-get install cmake libxi-dev libxrandr-dev libxinerama-dev libxcursor-dev mesa-common-dev libx11-xcb-dev pkg-config
```

And you must have `node.js` installed, at least version 18.
I recommend using [nvm](https://github.com/nvm-sh/nvm) to install it
as it makes it easy to switch versions.
22 changes: 22 additions & 0 deletions build/update.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import path from 'path';
import fs from 'fs';

import {execute} from './execute.js';

const cwd = process.cwd();

async function main() {
try {
process.chdir('third_party/dawn');
await execute('git', ['pull', 'origin', 'main']);
process.chdir(cwd);
process.chdir('third_party/depot_tools');
await execute('git', ['pull', 'origin', 'main']);
} catch (e) {
console.error(e);
console.error(e.stack);
process.exit(1);
}
}

main();
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"main": "index.js",
"type": "module",
"scripts": {
"build": "node build/build.js"
"build": "node build/build.js",
"update": "node build/update.js"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit 12f1276

Please sign in to comment.