Skip to content

Commit

Permalink
Merge branch 'simon-main'
Browse files Browse the repository at this point in the history
  • Loading branch information
stoefln committed Oct 14, 2022
2 parents 02f99a4 + 794a2c6 commit ad82c8b
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 16 deletions.
18 changes: 12 additions & 6 deletions .github/workflows/tagged_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ on:
- v*.*.*

jobs:
prebuild-node-macos:
prebuild-macos:
strategy:
matrix:
os: [ macos-11 ]
node: [ 16.13.0 ]
runtime: [ node ]
arch: [ x64, arm64 ]
runs-on: ${{matrix.os}}
steps:
Expand All @@ -21,22 +20,25 @@ jobs:
with:
node-version: ${{matrix.node}}
- name: Install
env:
BUILD_FOR_ARCH: ${{matrix.arch}}
run: npm ci --unsafe-perm
- name: Prebuild macOS
shell: bash
env:
BUILD_FOR_ARCH: ${{matrix.arch}}
run: |
npm run clean-tesseract
npm run build-tesseract
npm run create-prebuild -- -a ${{matrix.arch}} -u ${{ secrets.REPO_TOKEN }}
- name: List prebuilds
shell: bash
run: ls -la ./prebuilds
prebuild-node:
prebuild:
strategy:
matrix:
os: [ ubuntu-20.04, windows-2019 ]
node: [ 16.13.0 ]
runtime: [ node ]
arch: [ x64 ]
runs-on: ${{matrix.os}}
steps:
Expand All @@ -50,9 +52,13 @@ jobs:
if: ${{matrix.os == 'windows-2019'}}
run: npm config set msvs_version 2019
- name: Install
env:
BUILD_FOR_ARCH: ${{matrix.arch}}
run: npm ci --unsafe-perm
- name: Prebuild
shell: bash
env:
BUILD_FOR_ARCH: ${{matrix.arch}}
run: |
npm run clean-tesseract
npm run build-tesseract
Expand All @@ -63,8 +69,8 @@ jobs:

deploy:
needs:
- prebuild-node
- prebuild-node-macos
- prebuild
- prebuild-macos
runs-on: ubuntu-latest
steps:
- name: Set up Git repository
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-native-ocr",
"version": "0.3.1",
"version": "0.3.6",
"description": "Native Node.js bindings for the Tesseract OCR project.",
"gypfile": true,
"main": "lib/index.js",
Expand Down
27 changes: 22 additions & 5 deletions scripts/build-tesseract.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
var fs = require('fs');
const { join } = require('path');
var path = require('path');
var shell = require('shelljs');
const fs = require('fs');
const path = require('path');
const shell = require('shelljs');
const process = require("process");

const requiredCMakeVersion = '3.15';
const cmakeBuildType = 'Release';

shell.config.fatal = true; // thrown an exception on any error

const commonEnvVariables = {
let commonEnvVariables = {
CMAKE_BUILD_TYPE: cmakeBuildType,
CMAKE_INSTALL_PREFIX: '${PWD}/bin',
BUILD_SHARED_LIBS: 'OFF',
Expand All @@ -18,6 +18,23 @@ const commonEnvVariables = {
CMAKE_OSX_DEPLOYMENT_TARGET: '10.9'
}

const buildForArch = process.env["BUILD_FOR_ARCH"] || process.arch;
shell.echo('buildForArch', buildForArch);

if (buildForArch === 'arm64') {
shell.echo('arm64 build');
commonEnvVariables = {
...commonEnvVariables,
CMAKE_OSX_ARCHITECTURES: '\"arm64\"'
}
} else if (buildForArch === 'x64') {
shell.echo('x64 build');
commonEnvVariables = {
...commonEnvVariables,
CMAKE_OSX_ARCHITECTURES: '\"x86_64\"'
}
}

// ------ startup ------
shell.echo('build-tesseract script start.');

Expand Down

0 comments on commit ad82c8b

Please sign in to comment.