diff --git a/.github/workflows/autobuild.yml b/.github/workflows/autobuild.yml index 3cc5822f..7a188d3b 100644 --- a/.github/workflows/autobuild.yml +++ b/.github/workflows/autobuild.yml @@ -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 diff --git a/meson.build b/meson.build index 0b3d1185..38a099ab 100644 --- a/meson.build +++ b/meson.build @@ -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', diff --git a/meson_options.txt b/meson_options.txt index e64e1879..bd27894c 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -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')