Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: building on mac with amd64 architecture #5

Merged
merged 2 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@ env:

jobs:
setup:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Install V
uses: vlang/setup-v@v1.3
with:
check-latest: true
- name: Setup Dependencies
if: runner.os == 'Linux'
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libgtk-3-dev libwebkit2gtk-4.0-dev
Expand All @@ -46,16 +50,20 @@ jobs:

build:
needs: setup
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
compiler: [tcc, gcc, clang]
optimization: ['']
example: ['emoji-picker/main.v', 'v-js-interop/', 'project-structure/']
optimization: ['', '-cstrict']
exclude:
- compiler: clang
optimization: -cstrict
- os: macos-latest
optimization: -cstrict
- os: macos-latest
compiler: tcc
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Restore Cache
uses: actions/cache/restore@v3
Expand All @@ -68,12 +76,16 @@ jobs:
- name: Setup V
uses: vlang/setup-v@v1.3
- name: Setup Dependencies
if: runner.os == 'Linux'
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libgtk-3-dev libwebkit2gtk-4.0-dev
version: 1.0
- name: Build
run: v -cg -cc ${{ matrix.compiler }} ${{ matrix.optimization }} ${{ env.MOD_PATH }}/examples/${{ matrix.example }}
run: |
v -cg -cc ${{ matrix.compiler }} ${{ matrix.optimization }} ${{ env.MOD_PATH }}/examples/emoji-picker/main.v
v -cg -cc ${{ matrix.compiler }} ${{ matrix.optimization }} ${{ env.MOD_PATH }}/examples/v-js-interop/
v -cg -cc ${{ matrix.compiler }} ${{ matrix.optimization }} ${{ env.MOD_PATH }}/examples/project-structure/

build-gcc-sanitized:
needs: build
Expand Down
2 changes: 1 addition & 1 deletion src/bindings/bindings.v
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module bindings

#flag linux -DWEBVIEW_GTK -lstdc++
#flag darwin -DWEBVIEW_COCOA -framework WebKit -lstdc++
#flag darwin -DWEBVIEW_COCOA -framework WebKit -stdlib=libc++ -lstdc++

#flag @VMODROOT/src/bindings/webview.o
#include "@VMODROOT/src/bindings/webview.h"
Expand Down
7 changes: 6 additions & 1 deletion src/bindings/build.vsh
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,15 @@ fn main() {
http.download_file('${lib_url}/webview.h', '${lib_dir}/webview.h') or { panic(err) }
http.download_file('${lib_url}/webview.cc', '${lib_dir}/webview.cc') or { panic(err) }

mut cmd := 'g++ -c ${lib_dir}/webview.cc -std=c++17 -o ${lib_dir}/webview.o'
mut cmd := 'g++ -c ${lib_dir}/webview.cc -o ${lib_dir}/webview.o'
$if linux {
cmd += ' $(pkg-config --cflags gtk+-3.0 webkit2gtk-4.0)'
}
$if darwin && amd64 {
cmd += ' -std=c++11'
} $else {
cmd += ' -std=c++17'
}
comp_res := execute(cmd)
if comp_res.exit_code != 0 {
eprintln(comp_res.output)
Expand Down
Loading