Skip to content
Closed
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
71 changes: 2 additions & 69 deletions .github/workflows/github-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@ on:
pull_request:
workflow_dispatch: #

env:
ass_repo: https://github.com/libass/libass
ass_ver: 0.17.4
avs_repo: https://github.com/AviSynth/AviSynthPlus
avs_ver: 3.7.5
avs_date: 20250420

jobs:
build-linux:
runs-on: ubuntu-latest
Expand All @@ -21,33 +14,11 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get update && sudo apt-get install -y ninja-build nasm libfontconfig1-dev meson

git clone ${{ env.avs_repo }}.git -b v${{ env.avs_ver }} --depth=1 avsplus

cd ./avsplus
cmake -DCMAKE_INSTALL_PREFIX=/usr/local -S . -B avisynth-build
cmake --build avisynth-build --config Release -j 2
sudo cmake --install avisynth-build --config Release
cd ..

git clone ${{ env.ass_repo }}.git -b ${{ env.ass_ver }} --depth=1 libass

cd ./libass
meson wrap update-db
meson wrap install fribidi
meson wrap install freetype2
meson wrap install expat
meson wrap install harfbuzz
meson wrap install libpng
meson wrap install zlib

meson setup build -Ddefault_library=static -Dbuildtype=release -Dasm=enabled -Dc_std=c11 -Dcpp_std=c++17
meson compile -C build
sudo meson install -C build
- name: Build & Save binary
run: |
cmake -B build -S .
cmake --build build --clean-first
meson setup build
meson compile -C build
cmake -E copy "build/src/libassrender.so" "dist/libassrender.so"
- name: Upload artifact
uses: actions/upload-artifact@v4
Expand All @@ -66,23 +37,7 @@ jobs:

python -m pip install --upgrade pip
pip install meson

curl -L "${{ env.avs_repo }}/releases/download/v${{ env.avs_ver }}/AviSynthPlus_${{ env.avs_ver }}_${{ env.avs_date }}-filesonly.7z" `
--create-dirs -o "./avsplus/avisynthplus-latest-filesonly.7z"
7z e "avsplus\*-filesonly.7z" -o"lib\x86-32" "*\x86\c_api\AviSynth.lib"
7z e "avsplus\*-filesonly.7z" -o"lib\x86-64" "*\x64\c_api\AviSynth.lib"

git clone ${{ env.ass_repo }}.git -b ${{ env.ass_ver }} --depth=1 libass

cd ./libass
meson wrap update-db
meson wrap install fribidi
meson wrap install fontconfig
meson wrap install freetype2
meson wrap install expat
meson wrap install harfbuzz
meson wrap install libpng
meson wrap install zlib
- name: Setup MSVC (x64)
uses: ilammy/msvc-dev-cmd@v1
with:
Expand All @@ -91,22 +46,11 @@ jobs:
env:
PKG_CONFIG_PATH: C:/assdeps/x64/lib/pkgconfig
run: |
cd libass
meson setup build_x64 `
--prefix "C:/assdeps/x64" `
--libdir "lib" `
-Ddefault_library=static `
-Dbuildtype=release `
-Dasm=enabled `
-Db_vscrt=static_from_buildtype `
-Dc_std=c11 `
-Dcpp_std=c++17
meson compile -C build_x64
meson install -C build_x64
cd ..

cmake -D CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -A x64 -S . -B build_x64
msbuild /t:Rebuild /m /p:Configuration=Release /p:Platform=x64 ".\build_x64\assrender.sln"
cmake -E copy "build_x64\src\Release\assrender.dll" "dist\Release_x64\assrender.dll"
- name: Setup MSVC (Win32)
uses: ilammy/msvc-dev-cmd@v1
Expand All @@ -116,22 +60,11 @@ jobs:
env:
PKG_CONFIG_PATH: C:/assdeps/x86/lib/pkgconfig
run: |
cd libass
meson setup build_Win32 `
--prefix "C:/assdeps/x86" `
--libdir "lib" `
-Ddefault_library=static `
-Dbuildtype=release `
-Dasm=enabled `
-Db_vscrt=static_from_buildtype `
-Dc_std=c11 `
-Dcpp_std=c++17
meson compile -C build_Win32
meson install -C build_Win32
cd ..

cmake -D CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -A Win32 -S . -B build_Win32
msbuild /t:Rebuild /m /p:Configuration=Release /p:Platform=Win32 ".\build_Win32\assrender.sln"
cmake -E copy "build_Win32\src\Release\assrender.dll" "dist\Release_Win32\assrender.dll"
- name: Upload artifact
uses: actions/upload-artifact@v4
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ build/*
*/build/x64
Test

# Meson
/subprojects/*
!/subprojects/avisynthplus.wrap
!/subprojects/libass.wrap

# Build results
[Dd]ebug/
[Dd]ebugPublic/
Expand Down
37 changes: 37 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
project(
'assrender',
['c', 'cpp'],
default_options: [
'default_library=static',
'buildtype=release',
'c_std=c11',
'cpp_std=c++17',
'warning_level=3',
],
)

# Mirror the MinGW-specific behavior from CMake
cc = meson.get_compiler('c')
is_mingw = host_machine.system() == 'windows' and cc.get_id() == 'gcc'

if is_mingw
add_project_arguments(
'-Wpedantic',
language: 'c',
)

add_project_link_arguments(
'-static-libgcc',
'-Wl,--add-stdcall-alias',
language: 'c',
)

if get_option('buildtype') in ['release', 'minsize']
add_project_link_arguments(
'-s',
language: 'c',
)
endif
endif

subdir('src')
64 changes: 64 additions & 0 deletions src/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
cc = meson.get_compiler('c')

cmake_mod = import('cmake')
win = import('windows')

plugin_name = 'assrender'

sources = files(
'assrender.c',
'render.c',
'sub.c',
'timecodes.c',
)

if host_machine.system() == 'windows'
sources += win.compile_resources('ASSRender.rc')
endif

inc_public = include_directories('include')

libass_dep = dependency(
'libass',
required: true,
version: '>=0.17.4',
)

avisynth_dep = dependency(
'avisynth',
required: false,
version: '>=3.7.3',
)

if not avisynth_dep.found()
opt = cmake_mod.subproject_options()
opt.add_cmake_defines({'HEADERS_ONLY': true})

avisynth_sp = cmake_mod.subproject('avisynthplus', options: opt)
avisynth_dep = avisynth_sp.dependency('AviSynth-Headers')
endif

deps = [avisynth_dep, libass_dep]
is_mingw = (host_machine.system() == 'windows' and cc.get_id() == 'gcc')
need_defs = host_machine.system() == 'windows' and (not is_mingw) and host_machine.cpu_family() == 'x86'

if need_defs
assrender = shared_library(
plugin_name,
sources,
include_directories: [inc_public],
dependencies: deps,
vs_module_defs: files('assrender.def'),
install: true,
install_dir: join_paths(get_option('libdir'), 'avisynth'),
)
else
assrender = shared_library(
plugin_name,
sources,
include_directories: [inc_public],
dependencies: deps,
install: true,
install_dir: join_paths(get_option('libdir'), 'avisynth'),
)
endif
4 changes: 4 additions & 0 deletions subprojects/avisynthplus.wrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[wrap-git]
directory=avisynthplus
url=https://github.com/AviSynth/AviSynthPlus.git
revision=v3.7.5
4 changes: 4 additions & 0 deletions subprojects/libass.wrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[wrap-git]
directory=libass
url=https://github.com/libass/libass.git
revision=0.17.4
Loading