Only use pkg-config in macOS builds

This commit is contained in:
刘皓 2025-01-01 14:55:19 -05:00
parent 70959f5368
commit 42cccfd03d
No known key found for this signature in database
GPG key ID: 7901753DB465B711
3 changed files with 16 additions and 7 deletions

View file

@ -352,7 +352,7 @@ jobs:
- uses: msys2/setup-msys2@v2
with:
msystem: mingw64
install: base-devel git mingw-w64-x86_64-pkgconf mingw-w64-x86_64-cmake mingw-w64-x86_64-meson mingw-w64-x86_64-autotools mingw-w64-x86_64-gcc mingw-w64-x86_64-zlib
install: base-devel git mingw-w64-x86_64-cmake mingw-w64-x86_64-meson mingw-w64-x86_64-autotools mingw-w64-x86_64-gcc mingw-w64-x86_64-zlib
- name: Build phase 2
shell: msys2 {0}
@ -429,7 +429,7 @@ jobs:
echo 'Components: main universe' | sudo tee -a /etc/apt/sources.list.d/ubuntu.sources
fi
sudo apt update
sudo apt install git curl build-essential pkgconf automake libtool meson cmake -y
sudo apt install git curl build-essential automake libtool meson cmake -y
if [ '${{ matrix.arch_mkxpz }}' != 'x86_64' ]
then
sudo apt install gcc-${{ matrix.arch_gcc }} g++-${{ matrix.arch_gcc }} zlib1g-dev:${{ matrix.arch_debian }} -y
@ -486,7 +486,7 @@ jobs:
run: |
mkdir ${{ runner.temp }}/retro-phase2
cp retro/core.info ${{ runner.temp }}/retro-phase2/libretro-mkxp-z.info
PKG_CONFIG_PATH=${{ runner.temp }}/deps/share/pkgconfig meson setup build -Dretro=true -Dretro_phase1_path=retro/build/retro-phase1
PKG_CONFIG_PATH=${{ runner.temp }}/deps/share/pkgconfig meson setup build -Dretro=true -Dretro_phase1_path=retro/build/retro-phase1 -Dretro_lookup_method=pkg-config
cd build
ninja
mv libretro-mkxp-z.dylib ${{ runner.temp }}/retro-phase2

View file

@ -31,7 +31,9 @@ global_args += '-DHAVE_NANOSLEEP'
if get_option('retro') == true
retro_phase1 = get_option('retro_phase1_path')
cmake = import('cmake')
libzip_options = cmake.subproject_options()
libzip_options.add_cmake_defines({
'CMAKE_POSITION_INDEPENDENT_CODE': true,
@ -47,12 +49,18 @@ if get_option('retro') == true
'ENABLE_LZMA': false,
'ENABLE_ZSTD': false,
})
retro_deps = []
if get_option('retro_lookup_method') == 'pkg-config'
retro_deps += dependency('zlib', static: true)
else
retro_deps += compilers['cpp'].find_library('z', required: true, static: true)
endif
retro_deps += cmake.subproject('libzip', options: libzip_options).dependency('zip')
library(
'retro-' + meson.project_name(),
dependencies: [
dependency('zlib', static: true),
cmake.subproject('libzip', options: libzip_options).dependency('zip'),
],
dependencies: retro_deps,
c_args: [
'-fno-optimize-sibling-calls',
'-frounding-math',

View file

@ -24,3 +24,4 @@ option('gfx_backend', type: 'combo', value: 'gl', choices: ['gl', 'gles'], descr
option('retro', type: 'boolean', value: false, description: 'Build a libretro core instead of an executable')
option('retro_phase1_path', type: 'string', value: '', description: 'Path to retro-phase1 for libretro builds')
option('retro_lookup_method', type: 'combo', value: 'compiler', choices: ['compiler', 'pkg-config'], description: 'Method to use to locate software libraries for libretro builds')