diff --git a/README.md b/README.md index 93618f7..1324be8 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/build/update.js b/build/update.js new file mode 100644 index 0000000..b6996a3 --- /dev/null +++ b/build/update.js @@ -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(); \ No newline at end of file diff --git a/package.json b/package.json index 54ebd89..abfc482 100644 --- a/package.json +++ b/package.json @@ -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",