mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-08-02 22:29:25 +00:00
Fix build mechanics and handle meson error
This commit is contained in:
parent
07c8abec02
commit
5dde4d9534
2 changed files with 34 additions and 21 deletions
|
@ -29,25 +29,34 @@ cc = meson.get_compiler('c')
|
||||||
|
|
||||||
if not get_option('crossbuild_windows')
|
if not get_option('crossbuild_windows')
|
||||||
|
|
||||||
libdir = get_option('local_libav')
|
avdir = get_option('local_libav')
|
||||||
if libdir != ''
|
if avdir != ''
|
||||||
lib_avformat = cc.find_library('avformat', dirs : libdir)
|
message('Using local libav at ' + avdir)
|
||||||
lib_avcodec = cc.find_library('avcodec', dirs : libdir)
|
libdir = meson.current_source_dir() + '/../' + avdir + '/lib'
|
||||||
lib_avutil = cc.find_library('avutil', dirs : libdir)
|
incdir = '../' + avdir + '/include'
|
||||||
lib_swscale = cc.find_library('swscale', dirs : libdir)
|
ffmpeg = declare_dependency(
|
||||||
|
dependencies: [
|
||||||
|
cc.find_library('avformat', dirs : libdir),
|
||||||
|
cc.find_library('avcodec', dirs : libdir),
|
||||||
|
cc.find_library('avutil', dirs : libdir),
|
||||||
|
cc.find_library('swscale', dirs : libdir)
|
||||||
|
],
|
||||||
|
include_directories: include_directories(incdir)
|
||||||
|
)
|
||||||
else
|
else
|
||||||
lib_avformat = dependency('avformat')
|
ffmpeg = declare_dependency(
|
||||||
lib_avcodec = dependency('avcodec')
|
dependencies: [
|
||||||
lib_avutil = dependency('avutil')
|
dependency('avformat'),
|
||||||
lib_swscale = dependency('swscale')
|
dependency('avcodec'),
|
||||||
|
dependency('avutil'),
|
||||||
|
dependency('swscale')
|
||||||
|
]
|
||||||
|
)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# native build
|
# native build
|
||||||
dependencies = [
|
dependencies = [
|
||||||
lib_avformat,
|
ffmpeg,
|
||||||
lib_avcodec,
|
|
||||||
lib_avutil,
|
|
||||||
lib_swscale,
|
|
||||||
dependency('libpng'),
|
dependency('libpng'),
|
||||||
dependency('sdl2'),
|
dependency('sdl2'),
|
||||||
]
|
]
|
||||||
|
|
18
mobot.mk
18
mobot.mk
|
@ -4,17 +4,19 @@
|
||||||
|
|
||||||
.DEFAULT_GOAL := scrcpy
|
.DEFAULT_GOAL := scrcpy
|
||||||
|
|
||||||
|
AVDIR:=build-libav
|
||||||
|
AVLIBDIR:=$(AVDIR)/lib
|
||||||
|
AVLIBS:=$(AVLIBDIR)/libavformat.a $(AVLIBDIR)/libavcodec.a $(AVLIBDIR)/libavutil.a $(AVLIBDIR)/libswscale.a
|
||||||
|
|
||||||
build-ffmpeg:
|
build-ffmpeg:
|
||||||
git clone https://github.com/team-mobot/FFmpeg.git build-ffmpeg
|
git clone https://github.com/team-mobot/FFmpeg.git build-ffmpeg
|
||||||
|
|
||||||
AVLIBS:=build-libav/lib/libavformat.a build-libav/lib/libavcodec.a build-libav/lib/libavutil.a build-libav/lib/libswscale.a
|
|
||||||
$(AVLIBS): build-ffmpeg
|
$(AVLIBS): build-ffmpeg
|
||||||
# Build Mobot version of FFmpeg and install in subdir libav
|
# Build Mobot version of FFmpeg and install in subdir libav
|
||||||
cd build-ffmpeg && \
|
cd build-ffmpeg && \
|
||||||
git checkout encode-png-metadata && \
|
git checkout encode-png-metadata && \
|
||||||
./configure --prefix="../build-libav" \
|
./configure --prefix="../build-libav" \
|
||||||
--pkg-config-flags="--static" \
|
--pkg-config-flags="--static" \
|
||||||
--extra-libs="-lpthread -lm" \
|
|
||||||
--enable-gpl --enable-nonfree \
|
--enable-gpl --enable-nonfree \
|
||||||
--disable-bsfs --disable-filters \
|
--disable-bsfs --disable-filters \
|
||||||
--disable-encoders --enable-encoder=png \
|
--disable-encoders --enable-encoder=png \
|
||||||
|
@ -22,11 +24,13 @@ $(AVLIBS): build-ffmpeg
|
||||||
--enable-libx264 && \
|
--enable-libx264 && \
|
||||||
make install-libs install-headers
|
make install-libs install-headers
|
||||||
|
|
||||||
build-app:
|
build-app: $(AVLIBS)
|
||||||
meson build-app --buildtype release --strip -Db_lto=true \
|
LDFLAGS="-Wl,-lm -Wl,-lpthread" \
|
||||||
-Dlocal_libav=${PWD}/build-libav/lib \
|
meson build-app --buildtype release --strip -Db_lto=true \
|
||||||
-Dprebuilt_server=/usr/local/share/scrcpy/scrcpy-server
|
-Dlocal_libav=$(AVDIR) \
|
||||||
|
-Dprebuilt_server=/usr/local/share/scrcpy/scrcpy-server \
|
||||||
|
|| (ret=$$?; rm -rf $@ && exit $$ret)
|
||||||
|
|
||||||
scrcpy: build-app $(AVLIBS)
|
scrcpy: build-app
|
||||||
ninja -Cbuild-app
|
ninja -Cbuild-app
|
||||||
cp build-app/app/scrcpy .
|
cp build-app/app/scrcpy .
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue