diff --git a/.github/workflows/autobuild.yml b/.github/workflows/autobuild.yml index 01e5aecc..74b5d0f6 100644 --- a/.github/workflows/autobuild.yml +++ b/.github/workflows/autobuild.yml @@ -863,7 +863,7 @@ jobs: - name: Set up Emscripten SDK uses: mymindstorm/setup-emsdk@v14 with: - version: 3.1.46 + version: 4.0.6 - id: short-sha name: Get Git commit hash @@ -906,33 +906,30 @@ jobs: mkdir ${{ runner.temp }}/dist cd build CLICOLOR_FORCE=1 ninja -v - mv mkxp-z_libretro.bc ${{ runner.temp }} + mv mkxp-z_libretro.a ${{ runner.temp }} - name: Build frontend run: | cd ${{ runner.temp }} tag_name=$(curl -s https://api.github.com/repos/libretro/RetroArch/releases/latest | jq -r '.tag_name') - git clone https://github.com/libretro/RetroArch retroarch --depth 1 -b $tag_name - mv mkxp-z_libretro.bc retroarch/libretro_emscripten.bc + if [ $tag_name = 'v1.20.0' ] + then + # Use nightly instead of 1.20.0 for now + git clone https://github.com/libretro/RetroArch retroarch --depth 1 -b master + else + git clone https://github.com/libretro/RetroArch retroarch --depth 1 -b $tag_name + fi + mv mkxp-z_libretro.a retroarch/libretro_emscripten.a cd retroarch if [ '${{ matrix.threading }}' = 'threaded' ] then - if [ $tag_name = 'v1.20.0' ] - then - threading_flags='PTHREAD=1' - else - threading_flags='HAVE_THREADS=1 HAVE_AUDIOWORKLET=1 PROXY_TO_PTHREAD=1 HAVE_WASMFS=1 HAVE_EXTRA_WASMFS=1' - fi + threading_flags='HAVE_THREADS=1 HAVE_AUDIOWORKLET=1 PROXY_TO_PTHREAD=1 HAVE_WASMFS=1 HAVE_EXTRA_WASMFS=1' else threading_flags= fi CLICOLOR_FORCE=1 emmake make -f Makefile.emscripten LIBRETRO=mkxp-z $threading_flags mv mkxp-z_libretro.wasm ${{ runner.temp }}/dist mv mkxp-z_libretro.js ${{ runner.temp }}/dist - if [ '${{ matrix.threading }}' = 'threaded' ] - then - mv mkxp-z_libretro.worker.js ${{ runner.temp }}/dist - fi - name: Upload artifact uses: actions/upload-artifact@v4 diff --git a/meson.build b/meson.build index 889ec5d7..3893d215 100644 --- a/meson.build +++ b/meson.build @@ -9,6 +9,7 @@ compilers = {'c': meson.get_compiler('c'), 'cpp': meson.get_compiler('cpp')} is_libretro = get_option('libretro') is_emscripten = host_system == 'emscripten' core_is_static = is_libretro and (is_emscripten or host_system == 'bare' or host_system == 'none') +core_is_relocatable_object = is_libretro and is_emscripten and compilers['c'].version().version_compare('<3.1.52') is_vita = core_is_static and host_cpu_family == 'arm' and compilers['c'].has_header_symbol('sys/config.h', '__vita__') is_devkitarm = core_is_static and host_cpu_family == 'arm' and not is_vita is_devkitppc = core_is_static and host_cpu_family == 'ppc' @@ -493,7 +494,7 @@ if is_libretro global_dependencies_processed = global_dependencies endif - if is_emscripten + if core_is_relocatable_object libretro_target_type = 'executable' # Actually a relocatable object; we just pass 'executable' as the target type to get Meson to use the correct commands elif core_is_static libretro_target_type = 'static_library' @@ -504,7 +505,7 @@ if is_libretro libretro = build_target( meson.project_name() + '_libretro', name_prefix: '', - name_suffix: is_emscripten ? 'bc' : [], + name_suffix: core_is_relocatable_object ? 'bc' : [], target_type: libretro_target_type, dependencies: global_dependencies_processed, c_args: global_args, diff --git a/meson_options.txt b/meson_options.txt index b0b50b06..b5e8d3d7 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -25,4 +25,4 @@ option('gfx_backend', type: 'combo', value: 'gl', choices: ['gl', 'gles'], descr option('libretro', type: 'boolean', value: false, description: 'Build a libretro core instead of an executable') option('libretro_stage1_path', type: 'string', value: 'libretro/build/libretro-stage1', description: 'Path to libretro-stage1 for libretro builds') option('ruby_lto', type: 'boolean', value: false, description: 'Enable link-time optimization for libruby in libretro builds, even if link-time optimization is disabled for everything else') -option('emscripten_threaded', type: 'boolean', value: true, description: 'Enable multithreading support in libretro builds') +option('emscripten_threaded', type: 'boolean', value: true, description: 'Enable multithreading support in libretro Emscripten builds')