Compare commits

...

4 Commits

Author SHA1 Message Date
Colin Kinloch
ec4e826976 Set icon and server env paths for meson devenv
This allows users to compile and run the project in a dev environment.

    meson setup x
    meson compile -C x
    meson devenv -C x
    scrcpy

This is an alternative to `./run x`.

PR #5658 <https://github.com/Genymobile/scrcpy/pull/5658>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2024-12-12 18:15:26 +01:00
Romain Vimont
17e205e54f Replace meson join_paths() by '/'
A new '/' operator was introduced in Meson 0.49 to replace join_paths():
 - <https://mesonbuild.com/Reference-manual_functions.html#join_paths>
 - <https://mesonbuild.com/Syntax.html#string-path-building>

Refs #5658 <https://github.com/Genymobile/scrcpy/pull/5658>
2024-12-12 18:15:26 +01:00
Romain Vimont
f751274b17 Define both pkg-config and pkgconfig for meson
In Meson cross-files, "pkgconfig" was deprecated in favor of
"pkg-config" in meson 1.3.0.

The new name is used since 85a94dd4b563e961304b2d9082932c5c1cc2e582 to
avoid a warning, but then it fails with older versions of meson.

To avoid the problem, define both pkg-config and pkgconfig.

> For backward compatibility it is still allowed to define both with the
> same value, in that case no deprecation warning is printed.

<https://mesonbuild.com/Release-notes-for-1-3-0.html#machine-files-pkgconfig-field-deprecated-and-replaced-by-pkgconfig>
2024-12-12 18:09:31 +01:00
Romain Vimont
6469054b15 Revert "Remove apt update on GitHub Actions"
This reverts commit 678025b31672c230575fe2dbc4a0d487d5010bb1.

This avoids spurious errors on the CI:

    E: Unable to fetch some archives, maybe run apt-get update or try
    with --fix-missing?
2024-12-12 18:09:31 +01:00
6 changed files with 26 additions and 12 deletions

View File

@ -74,6 +74,7 @@ jobs:
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y meson ninja-build nasm ffmpeg libsdl2-2.0-0 \
libsdl2-dev libavcodec-dev libavdevice-dev libavformat-dev \
libavutil-dev libswresample-dev libusb-1.0-0 libusb-1.0-0-dev \
@ -99,6 +100,7 @@ jobs:
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y meson ninja-build nasm ffmpeg libsdl2-2.0-0 \
libsdl2-dev libavcodec-dev libavdevice-dev libavformat-dev \
libavutil-dev libswresample-dev libusb-1.0-0 libusb-1.0-0-dev \
@ -129,14 +131,12 @@ jobs:
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y meson ninja-build nasm ffmpeg libsdl2-2.0-0 \
libsdl2-dev libavcodec-dev libavdevice-dev libavformat-dev \
libavutil-dev libswresample-dev libusb-1.0-0 libusb-1.0-0-dev \
mingw-w64 mingw-w64-tools libz-mingw-w64-dev
- name: Workaround for old meson version run by Github Actions
run: sed -i 's/^pkg-config/pkgconfig/' cross_win32.txt
- name: Build
run: release/build_windows.sh 32
@ -162,14 +162,12 @@ jobs:
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y meson ninja-build nasm ffmpeg libsdl2-2.0-0 \
libsdl2-dev libavcodec-dev libavdevice-dev libavformat-dev \
libavutil-dev libswresample-dev libusb-1.0-0 libusb-1.0-0-dev \
mingw-w64 mingw-w64-tools libz-mingw-w64-dev
- name: Workaround for old meson version run by Github Actions
run: sed -i 's/^pkg-config/pkgconfig/' cross_win64.txt
- name: Build
run: release/build_windows.sh 64

View File

@ -192,19 +192,19 @@ datadir = get_option('datadir') # by default 'share'
install_man('scrcpy.1')
install_data('data/icon.png',
rename: 'scrcpy.png',
install_dir: join_paths(datadir, 'icons/hicolor/256x256/apps'))
install_dir: datadir / 'icons/hicolor/256x256/apps')
install_data('data/zsh-completion/_scrcpy',
install_dir: join_paths(datadir, 'zsh/site-functions'))
install_dir: datadir / 'zsh/site-functions')
install_data('data/bash-completion/scrcpy',
install_dir: join_paths(datadir, 'bash-completion/completions'))
install_dir: datadir / 'bash-completion/completions')
# Desktop entry file for application launchers
if host_machine.system() == 'linux'
# Install a launcher (ex: /usr/local/share/applications/scrcpy.desktop)
install_data('data/scrcpy.desktop',
install_dir: join_paths(datadir, 'applications'))
install_dir: datadir / 'applications')
install_data('data/scrcpy-console.desktop',
install_dir: join_paths(datadir, 'applications'))
install_dir: datadir / 'applications')
endif
@ -279,3 +279,9 @@ if get_option('buildtype') == 'debug'
test(t[0], exe)
endforeach
endif
if meson.version().version_compare('>= 0.58.0')
devenv = environment()
devenv.set('SCRCPY_ICON_PATH', meson.current_source_dir() / 'data/icon.png')
meson.add_devenv(devenv)
endif

View File

@ -7,6 +7,8 @@ cpp = 'i686-w64-mingw32-g++'
ar = 'i686-w64-mingw32-ar'
strip = 'i686-w64-mingw32-strip'
pkg-config = 'i686-w64-mingw32-pkg-config'
# backward compatibility
pkgconfig = 'i686-w64-mingw32-pkg-config'
windres = 'i686-w64-mingw32-windres'
[host_machine]

View File

@ -7,6 +7,8 @@ cpp = 'x86_64-w64-mingw32-g++'
ar = 'x86_64-w64-mingw32-ar'
strip = 'x86_64-w64-mingw32-strip'
pkg-config = 'x86_64-w64-mingw32-pkg-config'
# backward compatibility
pkgconfig = 'x86_64-w64-mingw32-pkg-config'
windres = 'x86_64-w64-mingw32-windres'
[host_machine]

View File

@ -1,6 +1,6 @@
project('scrcpy', 'c',
version: '3.1',
meson_version: '>= 0.48',
meson_version: '>= 0.49',
default_options: [
'c_std=c11',
'warning_level=2',

View File

@ -23,3 +23,9 @@ else
install: true,
install_dir: 'share/scrcpy')
endif
if meson.version().version_compare('>= 0.58.0')
devenv = environment()
devenv.set('SCRCPY_SERVER_PATH', meson.current_build_dir() / 'scrcpy-server')
meson.add_devenv(devenv)
endif