Skip to content

Commit

Permalink
Merge pull request #766 from thewtex/default-wasi-build
Browse files Browse the repository at this point in the history
build(cli): Use wasi-build/ as default build dir for wasi images
  • Loading branch information
thewtex authored Feb 15, 2023
2 parents 69bc8f2 + cad0972 commit 3eb2320
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions src/itk-wasm-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,6 @@ const defaultImageTag = '20230214-4d22c050'
function processCommonOptions() {
const options = program.opts()

let sourceDir = '.'
if (options.sourceDir) {
sourceDir = options.sourceDir
}

// Check that the source directory exists and chdir to it.
if (!fs.existsSync(sourceDir)) {
console.error('The source directory: ' + sourceDir + ' does not exist!')
process.exit(1)
}
process.chdir(sourceDir)

let buildDir = 'emscripten-build'
if (options.buildDir) {
buildDir = options.buildDir
}

// Make the build directory to hold the dockcross script and the CMake
// build.
try {
fs.mkdirSync(buildDir)
} catch (err) {
if (err.code !== 'EEXIST') throw err
}

// Check that we have docker and can run it.
const dockerVersion = spawnSync('docker', ['--version'], {
env: process.env,
Expand Down Expand Up @@ -82,6 +57,31 @@ function processCommonOptions() {
}
}

let sourceDir = '.'
if (options.sourceDir) {
sourceDir = options.sourceDir
}

// Check that the source directory exists and chdir to it.
if (!fs.existsSync(sourceDir)) {
console.error('The source directory: ' + sourceDir + ' does not exist!')
process.exit(1)
}
process.chdir(sourceDir)

let buildDir = dockerImage.includes('wasi') ? 'wasi-build' : 'emscripten-build'
if (options.buildDir) {
buildDir = options.buildDir
}

// Make the build directory to hold the dockcross script and the CMake
// build.
try {
fs.mkdirSync(buildDir)
} catch (err) {
if (err.code !== 'EEXIST') throw err
}

// Ensure we have the 'dockcross' Docker build environment driver script
const dockcrossScript = path.join(buildDir, 'itk-wasm-build-env')
try {
Expand Down

0 comments on commit 3eb2320

Please sign in to comment.