Skip to content

Commit

Permalink
CI: Move Android to meson
Browse files Browse the repository at this point in the history
Also fixup the trial and macOS builds
  • Loading branch information
mfkl committed Sep 5, 2023
1 parent 4c693fd commit 3cb5299
Show file tree
Hide file tree
Showing 8 changed files with 120 additions and 19 deletions.
52 changes: 38 additions & 14 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ variables:
.variables-trial: &variables-trial
ARGS_TRIAL: -t

.variables-trial-opengl: &variables-trial-opengl
ARGS_TRIAL_OPENGL: -Dwatermark=true

.base-template:
tags:
- docker
Expand Down Expand Up @@ -60,23 +63,27 @@ variables:
git apply ../../patches/no-libvlcjni-build.patch
cd ..
ANDROID_HOME=/sdk/android-sdk-linux ./buildsystem/compile.sh -l -b -r -a ${ANDROID_ABI}
after_script:
- mkdir nightlies
- cp vlc-android/libvlcjni/libvlc/jni/libs/${ANDROID_ABI}/libvlc.so nightlies
- cp vlc-android/libvlcjni/libvlc/jni/libs/${ANDROID_ABI}/libc++_shared.so nightlies
- cp vlc-android/libvlcjni/libvlc/build/intermediates/aar_main_jar/release/classes.jar nightlies
artifacts:
paths:
- vlc-android/libvlcjni/libvlc/jni
- vlc-android/libvlcjni/vlc/include
- vlc-android/libvlcjni/libvlc/build/intermediates/aar_main_jar/release/classes.jar

.unity-android-common:
extends: .base-template
image:
name: $VLC_ANDROID_IMAGE
stage: build-unity-plugin
script:
- mkdir -p Assets/VLCUnity/Plugins/Android/libs/${ANDROID_ABI}
- mv nightlies/* Assets/VLCUnity/Plugins/Android/libs/${ANDROID_ABI}
- ./build.sh -p android -a ${ANDROID_ABI} -r ${ARGS_TRIAL}
after_script:
- cp -r Assets/VLCUnity/Plugins/Android/libs/${ANDROID_ABI} nightlies
- export PATH="$HOME/sandbox/bin:$PATH"
- PKG_CONFIG_PATH=./vlc-android/libvlcjni/libvlc/jni/pkgconfig/${ANDROID_ABI} meson setup --cross-file=cross/android-${ANDROID_ABI}-ndk25.txt build_android_${ANDROID_ABI} ${ARGS_TRIAL_OPENGL} --buildtype release
- ninja -C build_android_${ANDROID_ABI}
artifacts:
paths:
- vlc-android/libvlcjni/libvlc/jni/libs/${ANDROID_ABI}/libvlc.so
- vlc-android/libvlcjni/libvlc/jni/libs/${ANDROID_ABI}/libc++_shared.so
- vlc-android/libvlcjni/libvlc/build/intermediates/aar_main_jar/release/classes.jar
- build_android_${ANDROID_ABI}/PluginSource/libVLCUnityPlugin.so

# libvlc android

Expand Down Expand Up @@ -125,14 +132,14 @@ unity-android-x86_64:
unity-android-armv7-trial:
extends: .unity-android-common
variables:
<<: [*variables-android-armv7, *variables-trial]
<<: [*variables-android-armv7, *variables-trial-opengl]
dependencies:
- libvlc-android-armv7

unity-android-armv8-trial:
extends: .unity-android-common
variables:
<<: [*variables-android-armv8, *variables-trial]
<<: [*variables-android-armv8, *variables-trial-opengl]
dependencies:
- libvlc-android-armv8

Expand Down Expand Up @@ -313,7 +320,7 @@ libvlc-macos-aarch64:
- sed -i '' "1s|.*|prefix=$(pwd | sed 's#/#\\\/#g')|" lib/pkgconfig/libvlc.pc
- export PATH="$HOME/sandbox/bin:$PATH"
- cd ../../..
- PKG_CONFIG_PATH=./vlc/build/macos-install/lib/pkgconfig meson setup build_${ARCH}
- PKG_CONFIG_PATH=./vlc/build/macos-install/lib/pkgconfig meson setup build_${ARCH} ${ARGS_TRIAL_OPENGL} --buildtype release
- ninja -C build_${ARCH}
- mv "build_${ARCH}/PluginSource/libVLCUnityPlugin.1.dylib" "build_${ARCH}/PluginSource/libVLCUnityPlugin.dylib"
artifacts:
Expand All @@ -330,6 +337,16 @@ unity-plugin-macos-x86_64:
- monterey
- amd64

unity-plugin-macos-x86_64-trial:
extends: .unity-plugin-macos-common
dependencies:
- libvlc-macos-x86_64
variables:
<<: [*variables-macos-x64, *variables-trial-opengl]
tags:
- monterey
- amd64

unity-plugin-macos-aarch64:
extends: .unity-plugin-macos-common
dependencies:
Expand Down Expand Up @@ -388,7 +405,7 @@ libvlc-ios-arm64:
- sed -i '' "1s|.*|prefix=$(pwd | sed 's#/#\\\/#g')|" lib/pkgconfig/libvlc.pc
- cd ../../..
- export PATH="$HOME/sandbox/bin:$PATH"
- PKG_CONFIG_PATH=./vlc/build/vlc-$SDKNAME-$SHORT_ARCH/lib/pkgconfig meson setup --cross-file=cross/$SDKNAME.txt build_${SHORT_ARCH}
- PKG_CONFIG_PATH=./vlc/build/vlc-$SDKNAME-$SHORT_ARCH/lib/pkgconfig meson setup --cross-file=cross/$SDKNAME.txt build_${SHORT_ARCH} ${ARGS_TRIAL_OPENGL} --buildtype release
- ninja -C build_${SHORT_ARCH}
- ./copy_ios.sh vlc/build/vlc-$SDKNAME-$SHORT_ARCH $SHORT_ARCH
artifacts:
Expand All @@ -402,6 +419,13 @@ unity-plugin-ios-aarch64:
dependencies:
- libvlc-ios-arm64

unity-plugin-ios-aarch64-trial:
extends: .unity-plugin-ios-common
variables:
<<: [*variables-ios-arm64, *variables-trial-opengl]
dependencies:
- libvlc-ios-arm64

unity-plugin-ios-x86_64:
extends: .unity-plugin-ios-common
variables: *variables-ios-x64
Expand Down
15 changes: 11 additions & 4 deletions PluginSource/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,11 @@ vlc_unity_ldflags = []

vlc_unity_deps = [ libvlc_dep ]

corevideo_dep = dependency('CoreVideo', required: host_system == 'darwin')
corefoundation_dep = dependency('CoreFoundation', required: host_system == 'darwin')
foundation_dep = dependency('Foundation', required: host_system == 'darwin')
if host_system == 'darwin'
corevideo_dep = dependency('CoreVideo', required: true)
corefoundation_dep = dependency('CoreFoundation', required: true)
foundation_dep = dependency('Foundation', required: true)
endif

if host_system == 'darwin'
add_project_arguments('-DGL_SILENCE_DEPRECATION=1', language: 'objcpp')
Expand Down Expand Up @@ -85,6 +87,10 @@ elif host_system == 'windows'
endif
elif host_system == 'linux'
plugin_sources += [ egl_sources ]
elif host_system == 'android'
vlc_unity_deps += [ cc.find_library('GLESv2'), cc.find_library('EGL'), cc.find_library('log') ]
vlc_unity_cppflags += [ '-DSUPPORT_OPENGL_ES=1', '-DUNITY_ANDROID=1' ]
plugin_sources += [ android_sources, egl_sources ]
endif

if have_ios or have_tvos
Expand Down Expand Up @@ -113,14 +119,15 @@ if have_osx
endif

if get_option('watermark')
plugin_sources += [ watermark_sources ]
vlc_unity_cppflags += [ '-DSHOW_WATERMARK' ]
endif

vlc_unity_plugin = library(
'VLCUnityPlugin',
plugin_sources,
include_directories: plugin_include_dirs,
version: '1.0.0', # TODO
version: '1.0.0', # TODO,
dependencies: vlc_unity_deps,
install: true
)
17 changes: 17 additions & 0 deletions cross/android-arm64-v8a-ndk25.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Automatically generated by contrib makefile

[binaries]
c = 'aarch64-linux-android21-clang'
cpp = 'aarch64-linux-android21-clang++'
ar = 'llvm-ar'
strip = 'llvm-strip'
pkgconfig = 'pkg-config'

[properties]
needs_exe_wrapper = true

[host_machine]
system = 'android'
cpu_family = 'aarch64'
endian = 'little'
cpu = 'aarch64'
17 changes: 17 additions & 0 deletions cross/android-armeabi-v7a-ndk25.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Automatically generated by contrib makefile

[binaries]
c = 'armv7a-linux-androideabi21-clang'
cpp = 'armv7a-linux-androideabi21-clang++'
ar = 'llvm-ar'
strip = 'llvm-strip'
pkgconfig = 'pkg-config'

[properties]
needs_exe_wrapper = true

[host_machine]
system = 'android'
cpu_family = 'arm'
endian = 'little'
cpu = 'arm'
14 changes: 14 additions & 0 deletions cross/android-x86-ndk25.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Automatically generated by contrib makefile

[binaries]
c = 'i686-linux-android21-clang'
cpp = 'i686-linux-android21-clang++'
ar = 'llvm-ar'
strip = 'llvm-strip'
pkgconfig = 'pkg-config'

[host_machine]
system = 'android'
cpu_family = 'x86'
endian = 'little'
cpu = 'i686'
16 changes: 16 additions & 0 deletions cross/android-x86_64-ndk25.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Automatically generated by contrib makefile

[binaries]
c = 'x86_64-linux-android21-clang'
cpp = 'x86_64-linux-android21-clang++'
ar = 'llvm-ar'
strip = 'llvm-strip'
pkgconfig = 'pkg-config'

[properties]

[host_machine]
system = 'android'
cpu_family = 'x86_64'
endian = 'little'
cpu = 'x86_64'
6 changes: 6 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,13 @@ if have_ios
add_project_arguments('-DUNITY_IPHONE=1', language: ['c', 'cpp', 'objc'])
endif

if host_system == 'android'
add_project_arguments('-DUNITY_ANDROID=1', language: ['c', 'cpp' ])
endif

if have_osx
add_project_arguments('-DUNITY_OSX=1',
language: ['c', 'cpp', 'objc'])
add_project_arguments('-mmacosx-version-min=10.11',
language: ['c', 'cpp', 'objc'])
add_project_link_arguments('-mmacosx-version-min=10.11',
Expand Down
2 changes: 1 addition & 1 deletion meson_options.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
option('watermark',
type: 'boolean',
value: true,
value: false,
description: 'Display the Videolabs watermark')

0 comments on commit 3cb5299

Please sign in to comment.