Skip to content

Commit

Permalink
Prepare AppleSilicon build
Browse files Browse the repository at this point in the history
Doesn't work yet because of electron-userland/electron-builder#5552
  • Loading branch information
milot-mirdita committed Apr 15, 2021
1 parent eeebc5f commit 0aec245
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 37 deletions.
29 changes: 12 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,22 @@
all: resources/icons/icon.icns resources/icons/icon.ico win mac linux

win: resources/win/mmseqs.bat resources/win/mmseqs-web-backend.exe resources/win/cpu-check.exe
mac: resources/mac/mmseqs-sse41 resources/mac/mmseqs-avx2 resources/mac/mmseqs-web-backend resources/mac/cpu-check
mac: resources/mac/mmseqs resources/mac/arm64/mmseqs-web-backend resources/mac/x64/mmseqs-web-backend
linux: resources/linux/mmseqs-sse41 resources/linux/mmseqs-avx2 resources/linux/mmseqs-web-backend resources/linux/cpu-check

mmseqshash := d1607bc8acee560772c1b0863e14c475398aa32c
mmseqshash := 19064f27c8d86fcdcd3daad60f6db70f6360f30b

resources/icons/icon.icns resources/icons/icon.ico: frontend/assets/marv1-square.svg
mkdir -p resources/icons
./node_modules/.bin/icon-gen -i frontend/assets/marv1-square.svg -o resources/icons/ --icns name=icon --ico name=icon

resources/mac/mmseqs-web-backend: backend/*.go backend/go.*
mkdir -p resources/mac
cd backend/ && GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -o ../resources/mac/mmseqs-web-backend
resources/mac/x64/mmseqs-web-backend: backend/*.go backend/go.*
mkdir -p resources/mac/x64
cd backend/ && GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -o ../resources/mac/x64/mmseqs-web-backend

resources/mac/arm64/mmseqs-web-backend: backend/*.go backend/go.*
mkdir -p resources/mac/arm64
cd backend/ && GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 go build -o ../resources/mac/arm64/mmseqs-web-backend

resources/linux/mmseqs-web-backend: backend/*.go backend/go.*
mkdir -p resources/linux
Expand All @@ -24,10 +28,6 @@ resources/win/mmseqs-web-backend.exe: backend/*.go backend/go.*
mkdir -p resources/win
cd backend/ && GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -o ../resources/win/mmseqs-web-backend.exe

resources/mac/cpu-check: cpu-check/*.go cpu-check/go.*
mkdir -p resources/mac
cd cpu-check/ && GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-s -w" -o ../resources/mac/cpu-check

resources/linux/cpu-check: cpu-check/*.go cpu-check/go.*
mkdir -p resources/linux
cd cpu-check/ && GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-s -w" -o ../resources/linux/cpu-check
Expand All @@ -36,15 +36,10 @@ resources/win/cpu-check.exe: cpu-check/*.go cpu-check/go.*
mkdir -p resources/win
cd cpu-check/ && GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-s -w" -o ../resources/win/cpu-check.exe

resources/mac/mmseqs-sse41:
resources/mac/mmseqs:
mkdir -p resources/mac
cd resources/mac && wget -nv -O mmseqs.tar.gz https://mmseqs.com/archive/$(mmseqshash)/mmseqs-osx-sse41.tar.gz \
&& tar --strip-components=2 -xf mmseqs.tar.gz mmseqs/bin/mmseqs && mv mmseqs mmseqs-sse41 && rm mmseqs.tar.gz

resources/mac/mmseqs-avx2:
mkdir -p resources/mac
cd resources/mac && wget -nv -O mmseqs.tar.gz https://mmseqs.com/archive/$(mmseqshash)/mmseqs-osx-avx2.tar.gz \
&& tar --strip-components=2 -xf mmseqs.tar.gz mmseqs/bin/mmseqs && mv mmseqs mmseqs-avx2 && rm mmseqs.tar.gz
cd resources/mac && wget -nv -O mmseqs.tar.gz https://mmseqs.com/archive/$(mmseqshash)/mmseqs-osx-universal.tar.gz \
&& tar --strip-components=2 -xf mmseqs.tar.gz mmseqs/bin/mmseqs && rm mmseqs.tar.gz

resources/linux/mmseqs-sse41:
mkdir -p resources/linux
Expand Down
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ trigger:
- master

pool:
vmImage: 'macOS-10.14'
vmImage: 'macOS-10.15'
steps:
- task: NodeTool@0
inputs:
versionSpec: '12.x'
versionSpec: '14.x'
- script: |
npm install
make all -j $(nproc --all)
Expand Down
9 changes: 7 additions & 2 deletions electron/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,18 @@ const binPath = (process.env.NODE_ENV === 'production') ?
join(process.resourcesPath, 'bin') :
join(appRootDir.get(), 'resources', mapPlatform(platform));


var simd = "universal";
if (platform !== 'darwin') {
simd = String(execFileSync(join(binPath, "cpu-check" + (platform == "win32" ? ".exe" : "")))).trim()
}
app.os = {
arch: os.arch(),
platform: platform,
simd: String(execFileSync(join(binPath, "cpu-check" + (platform == "win32" ? ".exe" : "")))).trim()
simd: simd
}

const mmseqsBinary = join(binPath, "mmseqs" + (platform == "win32" ? "" : ("-" + app.os.simd)) + (platform == "win32" ? ".bat" : ""));
const mmseqsBinary = join(binPath, "mmseqs" + (platform == "win32" || platform == "darwin" ? "" : ("-" + app.os.simd)) + (platform == "win32" ? ".bat" : ""));
const backendBinary = join(binPath, "mmseqs-web-backend" + (platform == "win32" ? ".exe" : ""));

app.mmseqsVersion = String(execFileSync(mmseqsBinary, ["version"])).trim()
Expand Down
30 changes: 15 additions & 15 deletions package-lock.json

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

6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
{
"from": "resources/${os}",
"to": "resources/bin"
},
{
"from": "resources/${os}/${arch}",
"to": "resources/bin"
}
],
"dmg": {
Expand Down Expand Up @@ -81,7 +85,7 @@
"css-loader": "^5.2.1",
"del": "^6.0.0",
"devtron": "^1.4.0",
"electron": "^11.4.3",
"electron": "^12.0.4",
"electron-builder": "^22.10.5",
"electron-debug": "^3.2.0",
"electron-devtools-installer": "^3.1.1",
Expand Down

0 comments on commit 0aec245

Please sign in to comment.