jmjoy 发表于 2024-8-9 11:49:50

编译并运行mgba

mgba是一个开源gba模拟器,可以跑gba和gbc游戏。

前提是安装龙芯的旧世界gcc工具链,并且编译buildroot源码,开启sdl1.2,这里就不描述步骤了。


编译buildroot完成后,设置环境变量:

export PATH=你的buildroot目录/output/host/bin:$PATH

下载mgba:https://github.com/mgba-emu/mgba

交叉编译:

cmake \
-DCMAKE_SYSTEM_NAME=Linux \
-DCMAKE_SYSTEM_PROCESSOR=loongarch64 \
-DCMAKE_C_COMPILER=/opt/loongson-gnu-toolchain-x86_64-loongarch64-linux-gnu/bin/loongarch64-linux-gnu-gcc \
-DCMAKE_CXX_COMPILER=/opt/loongson-gnu-toolchain-x86_64-loongarch64-linux-gnu/bin/loongarch64-linux-gnu-g++ \
-DCMAKE_SYSROOT=你的buildroot目录/output/host/loongarch64-buildroot-linux-gnu/sysroot \
-DCMAKE_FIND_ROOT_PATH=你的buildroot目录/output/host/loongarch64-buildroot-linux-gnu/sysroot \
-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \
-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY \
-DBUILD_QT=OFF -DBUILD_GL=OFF -DBUILD_GLES2=OFF -DBUILD_GLES3=OFF -DSDL_VERSION=1.2 \
-B build-2k300-sdl1

cmake --build build-2k300-sdl1 -j

cmake --install build-2k300-sdl1 /tmp/mgba


然后将/tmp/mgba复制到开发板上,再运行mgba -f 你的游戏.gba就可以了。

我编译好了一份,应该可以直接使用。


页: [1]
查看完整版本: 编译并运行mgba