Skip to content

Commit

Permalink
Add GHA CI
Browse files Browse the repository at this point in the history
Signed-off-by: akarin <i@akarin.info>
  • Loading branch information
AkarinVS committed Jan 20, 2023
1 parent 9de0006 commit 668f71b
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 11 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Build
on:
- push
- release
- pull_request
- workflow_dispatch

jobs:
build:
runs-on: windows-latest
strategy:
matrix:
arch:
- amd64
steps:
- uses: actions/checkout@v3
- name: setup MS dev commands
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.arch }}
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: install meson and ninja
run: pip install meson ninja

- name: Install pkg-config lite and nasm
shell: bash
run: |
# pkg-config
curl -o pcl.zip -L https://github.com/AmusementClub/blobs/releases/download/blob-pkgconfiglite/pkg-config-lite-0.28-1_bin-win32.zip
7z x pcl.zip
echo "$(cygpath --absolute --long-name --windows $(pwd)/pkg-config-lite-0.28-1/bin)" >> $GITHUB_PATH
# nasm
curl -o nasm.zip -L https://www.nasm.us/pub/nasm/releasebuilds/2.16.01/win64/nasm-2.16.01-win64.zip
7z x nasm.zip
echo "$(cygpath --absolute --long-name --windows $(pwd)/nasm-2.16.01)" >> $GITHUB_PATH
cat $GITHUB_PATH
- name: Run vcpkg
uses: lukka/run-vcpkg@v7
with:
vcpkgArguments: 'fftw3[avx2]:x64-windows-static'
vcpkgDirectory: '${{ github.workspace }}/vcpkg'
vcpkgGitCommitId: 5568f110b509a9fd90711978a7cb76bae75bb092 # 2021.05.12 release

- name: download VS headers and patch header location
shell: bash
run: |
git clone https://github.com/AmusementClub/vapoursynth-classic --depth=1 --branch doodle2 vapoursynth
cp vapoursynth/include/*.h src/
sed -i -e '/#include <V/y|<>|""|' src/*.[ch] src/*.cpp
- name: Meson setup
run: meson setup builddir/ -Db_vscrt=mt -Dpkg_config_path=${{ github.workspace }}/vcpkg/installed/x64-windows-static/lib/pkgconfig
- name: Meson compile
run: meson compile -C builddir/ -v
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: release-${{matrix.arch}}
path: |
builddir/mvtools.dll
35 changes: 24 additions & 11 deletions meson.build
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
project('MVTools', 'c', 'cpp',
version: '23',
default_options: ['c_std=c99', 'cpp_std=c++11', 'buildtype=release', 'b_lto=true'],
meson_version: '>=0.46')
meson_version: '>=0.49')

gcc_syntax = meson.get_compiler('cpp').get_argument_syntax() == 'gcc'

warnings = [
'-Wall',
Expand All @@ -11,10 +12,14 @@ warnings = [
]

cflags = [
warnings,
'-fvisibility=hidden',
'-DPACKAGE_VERSION="@0@"'.format(meson.project_version()),
]
if gcc_syntax
cflags += [
warnings,
'-fvisibility=hidden',
]
endif

ldflags = [
]
Expand All @@ -30,7 +35,11 @@ nasm_flags = [
]


vapoursynth_dep = dependency('vapoursynth').partial_dependency(includes: true, compile_args: true)
if gcc_syntax
vapoursynth_dep = [dependency('vapoursynth').partial_dependency(includes: true, compile_args: true)]
else
vapoursynth_dep = []
endif


sources = [
Expand Down Expand Up @@ -82,8 +91,10 @@ host_system = host_machine.system()

if host_system == 'windows' or host_system == 'cygwin'
if host_cpu_family == 'x86'
cflags += '-mstackrealign'
ldflags += '-Wl,--kill-at'
if gcc_syntax
cflags += '-mstackrealign'
ldflags += '-Wl,--kill-at'
endif
nasm_flags += '-DPREFIX'
endif

Expand All @@ -109,7 +120,10 @@ helper_libs = []


if host_cpu_family.startswith('x86')
cflags += ['-mfpmath=sse', '-msse2', '-DMVTOOLS_X86=1']
cflags += [ '-DMVTOOLS_X86=1' ]
if gcc_syntax
cflags += ['-mfpmath=sse', '-msse2' ]
endif


nasm_sources = [
Expand Down Expand Up @@ -156,17 +170,16 @@ if host_cpu_family.startswith('x86')
helper_libs += static_library('avx2',
libavx2_sources,
dependencies: vapoursynth_dep,
cpp_args: [cflags, '-mavx2', '-mtune=haswell'],
cpp_args: cflags + (gcc_syntax ? ['-mavx2', '-mtune=haswell'] : []),
install: false)
endif


cxx = meson.get_compiler('cpp')


deps = [
vapoursynth_dep,
dependency('fftw3f'),
deps = vapoursynth_dep + [
build_machine.system() == 'windows' ? dependency('fftwf') : dependency('fftw3f'),
cxx.find_library('m', required: false),
]

Expand Down

0 comments on commit 668f71b

Please sign in to comment.