Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix toolchain, add missing libs, update readme #2

Open
wants to merge 2 commits into
base: switch-new
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 46 additions & 63 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<p align="center"><img src="https://raw.githubusercontent.com/StapleButter/melonDS/master/icon/melon_128x128.png"></p>
<p align="center"><img src="https://raw.githubusercontent.com/melonDS-emu/melonDS/master/res/icon/melon_128x128.png"></p>
<h2 align="center"><b>melonDS</b></h2>
<p align="center">
<a href="http://melonds.kuribo64.net/" alt="melonDS website"><img src="https://img.shields.io/badge/website-melonds.kuribo64.net-%2331352e.svg"></a>
Expand Down Expand Up @@ -39,68 +39,51 @@ As for the rest, the interface should be pretty straightforward. If you have a q

## How to build

### Linux:

1. Install dependencies: `sudo apt install cmake libcurl4-gnutls-dev libpcap0.8-dev libsdl2-dev qt5-default libslirp-dev libarchive-dev libepoxy-dev`
2. Download the melonDS repository and prepare:
```bash
git clone https://github.com/Arisotura/melonDS
cd melonDS
mkdir build && cd build
```
3. Compile:
```bash
cmake ..
make -j$(nproc --all)
```

### Windows:

1. Install [MSYS2](https://www.msys2.org/)
2. Open the **MSYS2 MinGW 64-bit** terminal
3. Update the packages using `pacman -Syu` and reopen the terminal if it asks you to
4. Download the melonDS repository and prepare:
```bash
git clone https://github.com/Arisotura/melonDS
cd melonDS
mkdir build && cd build
```
#### Dynamic builds (with DLLs)
5. Install dependencies: `pacman -S git make mingw-w64-x86_64-{cmake,mesa,SDL2,toolchain,qt5,libslirp,libarchive,libepoxy}`
6. Compile:
```bash
cmake .. -G "MSYS Makefiles"
make -j$(nproc --all)
../tools/msys-dist.sh
```
If everything went well, melonDS and the libraries it needs should now be in the `dist` folder.

#### Static builds (without DLLs, standalone executable)
5. Install dependencies: `pacman -S git make mingw-w64-x86_64-{cmake,mesa,SDL2,toolchain,qt5-static,libslirp,libarchive,libepoxy}`
6. Compile:
```bash
cmake .. -G 'MSYS Makefiles' -DBUILD_STATIC=ON -DQT5_STATIC_DIR=/mingw64/qt5-static
make -j$(nproc --all)
mkdir dist && cp melonDS.exe dist
```
If everything went well, melonDS should now be in the `dist` folder.

### macOS:
1. Install the [Homebrew Package Manager](https://brew.sh)
2. Install dependencies: `brew install git pkg-config cmake sdl2 qt@6 libslirp libarchive libepoxy`
3. Download the melonDS repository and prepare:
```zsh
git clone https://github.com/Arisotura/melonDS
cd melonDS
mkdir build && cd build
```
4. Compile:
```zsh
cmake .. -DCMAKE_PREFIX_PATH="$(brew --prefix qt@6);$(brew --prefix libarchive)" -DUSE_QT6=ON -DMACOS_BUNDLE_LIBS=ON
make -j$(sysctl -n hw.logicalcpu)
```
If everything went well, melonDS.app should now be in the curent directory.

### Nintendo Switch:

This guide assumes that you already set up your build enviroment for the Nintendo Switch, if not [see DevKitPro's guide](https://devkitpro.org/wiki/Getting_Started)

1. Install dependencies. for example for Debian based distros:
```bash
sudo apt update
sudo apt install cmake ninja meson bison flex
```

2. Compile dekotools:
```bash
cd ~/
git clone https://github.com/fincs/dekotools
cd dekotools
meson setup builddir
cd builddir
ninja
sudo cp ./dekodef /usr/bin/
sudo cp ./dekomme /usr/bin/
```

3. Compile deko3d: (Replace $DEVKITPRO with the path of DevKitPro installation)
```bash
cd ~/
git clone https://github.com/RSDuck/deko3d
cd deko3d
git switch fix-10
make
sudo cp ./lib/libdeko3d.a $DEVKITPRO/libnx/lib/
sudo cp ./lib/libdeko3dd.a $DEVKITPRO/libnx/lib/
```

4. Download this melonDS repository and prepare:
```bash
cd ~/
git clone https://github.com/RSDuck/melonDS
cd melonDS
mkdir build && cd build
```
5. Compile:
```bash
cmake .. -DENABLE_OGLRENDERER=OFF -DBUILD_QT_SDL=OFF -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-cross-Switch.cmake
make -j$(nproc --all)
```

## TODO LIST

Expand Down
2 changes: 1 addition & 1 deletion cmake/Toolchain-cross-Switch.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function(create_devkit DEVKIT)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER CACHE INTERNAL "")
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY CACHE INTERNAL "")
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY CACHE INTERNAL "")
set(PKG_CONFIG_EXECUTABLE "/dev/null" CACHE INTERNAL "" FORCE)
set(PKG_CONFIG_EXECUTABLE "true" CACHE INTERNAL "" FORCE)
endfunction()

if(DEFINED ENV{LIBNX})
Expand Down
1 change: 1 addition & 0 deletions src/frontend/switch/ROMMetaDatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <sys/stat.h>
#include <assert.h>
#include <string.h>
#include <unordered_map>

#include <arm_neon.h>

Expand Down
2 changes: 2 additions & 0 deletions src/frontend/switch/mm_vec/mm_vec.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ LICENSE: (zlib)
extern "C" {
#endif

#include <math.h>

#ifdef MMX_STATIC
#define MMX_API static
#else
Expand Down
1 change: 1 addition & 0 deletions src/teakra/src/interpreter.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "memory_interface.h"
#include "operand.h"
#include "register.h"
#include <utility>

namespace Teakra {

Expand Down