-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Bump to 0.9.0, neater build script, update workflows (#190)
- Loading branch information
1 parent
999191a
commit ae15fa2
Showing
7 changed files
with
58 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,54 @@ | ||
import { $ } from "jsr:@david/[email protected]"; | ||
|
||
const { os } = Deno.build; | ||
async function findClangFormat() { | ||
let WEBVIEW_CLANG_FORMAT_EXE = Deno.env.get("WEBVIEW_CLANG_FORMAT_EXE"); | ||
if (WEBVIEW_CLANG_FORMAT_EXE) { | ||
return WEBVIEW_CLANG_FORMAT_EXE; | ||
} | ||
|
||
WEBVIEW_CLANG_FORMAT_EXE = await $.which("clang-format"); | ||
if (WEBVIEW_CLANG_FORMAT_EXE) { | ||
return WEBVIEW_CLANG_FORMAT_EXE; | ||
} | ||
|
||
if (await $.commandExists("brew")) { | ||
const llvm = await $`brew --prefix llvm`.text(); | ||
return `${llvm}/bin/clang-format"`; | ||
} | ||
|
||
$.logError( | ||
"error", | ||
"clang-format not found. Please install clang-format using brew or set the WEBVIEW_CLANG_FORMAT_EXE environment variable.", | ||
); | ||
Deno.exit(1); | ||
} | ||
|
||
$.setPrintCommand(true); | ||
|
||
await $.path("./build").ensureDir(); | ||
switch (os) { | ||
case "windows": | ||
switch (Deno.build.os) { | ||
case "windows": { | ||
await $`script/build.bat`; | ||
await $`cp webview/build/core/Release/webview.dll build/webview.dll`; | ||
break; | ||
case "linux": | ||
} | ||
case "linux": { | ||
$.cd("webview"); | ||
await $`export PATH=/usr/lib/llvm14/bin/:/usr/lib/llvm-14/bin/:/usr/lib64/llvm15/bin/:$PATH`; | ||
await $`cmake -G Ninja -B build -S . -D CMAKE_BUILD_TYPE=Release -D WEBVIEW_WEBKITGTK_API=6.0 -DWEBVIEW_ENABLE_CHECKS=false -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/host-llvm.cmake -DWEBVIEW_USE_CLANG_TIDY=OFF -DWEBVIEW_BUILD_DOCS=OFF -DWEBVIEW_USE_CLANG_FORMAT=OFF`; | ||
await $`cmake -G Ninja -B build -S . \ | ||
-D CMAKE_BUILD_TYPE=Release \ | ||
-D WEBVIEW_WEBKITGTK_API=6.0 \ | ||
-DWEBVIEW_ENABLE_CHECKS=false \ | ||
-DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/host-llvm.cmake \ | ||
-DWEBVIEW_USE_CLANG_TIDY=OFF \ | ||
-DWEBVIEW_BUILD_DOCS=OFF \ | ||
-DWEBVIEW_USE_CLANG_FORMAT=OFF`; | ||
await $`cmake --build build`; | ||
await $`cp build/core/libwebview.so ../build/libwebview.${Deno.build.arch}.so`; | ||
await $`strip ../build/libwebview.${Deno.build.arch}.so`; | ||
break; | ||
case "darwin": | ||
} | ||
case "darwin": { | ||
$.cd("webview"); | ||
await $`cmake -G "Ninja Multi-Config" -B build -S . \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
|
@@ -28,11 +59,10 @@ switch (os) { | |
-DWEBVIEW_USE_CLANG_TIDY=OFF \ | ||
-DWEBVIEW_BUILD_DOCS=OFF \ | ||
-DWEBVIEW_USE_CLANG_FORMAT=OFF \ | ||
-DWEBVIEW_CLANG_FORMAT_EXE=${Deno.env.get( | ||
"WEBVIEW_CLANG_FORMAT_EXE", | ||
)!}`; | ||
-DWEBVIEW_CLANG_FORMAT_EXE=${await findClangFormat()}`; | ||
await $`cmake --build build --config Release`; | ||
await $`cp build/core/Release/libwebview.dylib ../build/libwebview.${Deno.build.arch}.dylib`; | ||
await $`strip -x -S ../build/libwebview.${Deno.build.arch}.dylib`; | ||
break; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"imports": { | ||
"@webview/webview": "./mod.ts", | ||
"@denosaurs/plug": "jsr:@denosaurs/plug@^1.0.5" | ||
"@denosaurs/plug": "jsr:@denosaurs/plug@^1.0" | ||
} | ||
} |