2018-06-14 12:46:25 +02:00
[![Build Status ](https://travis-ci.org/decaf-emu/wut.svg?branch=rewrite )](https://travis-ci.org/decaf-emu/wut)
2017-06-02 14:32:58 +02:00
2015-12-27 03:15:51 +01:00
# wut
Let's try make a Wii U Toolchain / SDK for creating rpx/rpl.
2015-12-27 03:18:13 +01:00
Licensed under the terms of the GNU General Public License, version 2 or later (GPLv2+).
2018-06-15 11:45:13 +02:00
## Install
2018-06-15 11:45:41 +02:00
Grab the latest [release ](https://github.com/decaf-emu/wut/releases ) extract to a folder, then export that folder as WUT_ROOT.
2018-06-15 11:45:13 +02:00
For example:
```
wget https://github.com/decaf-emu/wut/releases/download/1.0.0-alpha/wut.linux64.7z
mkdir wut & & cd wut
7z x ../wut.linux64.7z
export WUT_ROOT=$PWD
```
2018-06-14 13:26:25 +02:00
## Usage
See [samples ](samples ) for examples of how to use wut.
The [share/wut.cmake ](share/wut.cmake ) file provides several helpers for your build:
- `wut_create_rpx(target.rpx executable)` - Will create an .rpx file from your CMake target generated by `add_executable`
- `wut_enable_newlib(target)` - Links against the wut implementation of newlib, this is useful for using any function from the C standard library
- `wut_enable_stdcpp(target)` - Links against the wut implementation of stdcpp, this is useful for using any function from the C++ standard library. This will call wut_enable_newlib if you have not already done so.
- `wut_default_malloc(target)` - By default newlib will allocate 90% of the default heap for use with sbrk & malloc, if this is unacceptable to you then you should use this as it replaces the newlib malloc functions which ones which redirect to the CafeOS default heap functions such as MEMAllocFromDefaultHeap.
2018-07-19 09:42:12 +02:00
- `wut_enable_devoptab(target)` - This links in wutdevoptab which is useful for using the libc file functions with paths such as `fopen("sd:/file.txt", "r")` to read files from the sd card
2018-06-14 13:26:25 +02:00
A minimal CMakeLists.txt file for a C++ project might look like:
```
cmake_minimum_required(VERSION 3.2)
project(helloworld_cpp CXX)
include("${WUT_ROOT}/share/wut.cmake" REQUIRED)
add_executable(helloworld_cpp
main.cpp)
wut_enable_stdcpp(helloworld_cpp)
wut_create_rpx(helloworld_cpp.rpx helloworld_cpp)
```
2018-06-14 13:36:10 +02:00
Which you would compile with
```
export DEVKITPPC=/opt/devkitpro/devkitPPC
export WUT_ROOT=< path / to / install >
mkdir build & & cd build
cmake -DCMAKE_TOOLCHAIN_FILE=$WUT_ROOT/share/wut.toolchain.cmake ../
make
```
2018-06-14 13:26:25 +02:00
## Building
Requires:
2018-06-14 10:33:23 +02:00
- A modern compiler with C++14/17 support
- CMake
- zlib
- [devkitPPC r31+ ](https://devkitpro.org/wiki/Getting_Started )
2017-03-23 13:19:27 +01:00
2018-06-14 13:26:25 +02:00
### Building on Windows
2019-01-07 13:21:11 +01:00
If you are using devkitPro then you can build wut using the provided msys2 environment:
```
export PATH=$PATH:/opt/devkitpro/devkitPPC/bin
export DEVKITPPC=/opt/devkitpro/devkitPPC
pacman -S gcc cmake zlib-devel
git clone --recursive https://github.com/decaf-emu/wut.git
cd wut
mkdir build & & cd build
cmake -DCMAKE_INSTALL_PREFIX=/opt/wut ../
make install
export WUT_ROOT=/opt/wut
```
Or use [WSL ](https://docs.microsoft.com/en-us/windows/wsl/install-win10 ) and then follow the Linux instructions after preparing your environment.
2018-06-14 10:33:23 +02:00
2018-06-14 13:36:10 +02:00
For example, if you installed Ubuntu 18.04 then you might setup your environment like:
2018-06-14 10:33:23 +02:00
```
2018-11-15 11:15:18 +01:00
sudo apt install cmake zlib1g-dev gcc g++ build-essential
2018-06-14 10:33:23 +02:00
wget https://github.com/devkitPro/pacman/releases/download/devkitpro-pacman-1.0.1/devkitpro-pacman.deb
sudo dpkg -i devkitpro-pacman.deb
2018-06-14 13:57:27 +02:00
sudo ln -s /proc/mounts /etc/mtab
2018-06-14 10:33:23 +02:00
sudo dkp-pacman -S devkitPPC wiiload
```
2017-03-23 13:17:00 +01:00
2018-06-14 13:26:25 +02:00
### Building on Linux / MacOS
2017-03-23 13:17:00 +01:00
```
2018-06-14 10:33:23 +02:00
export DEVKITPPC=/opt/devkitpro/devkitPPC
2017-03-23 13:17:00 +01:00
git clone --recursive https://github.com/decaf-emu/wut.git
cd wut
mkdir build & & cd build
2018-06-14 10:33:23 +02:00
cmake -DCMAKE_INSTALL_PREFIX=< path / to / install > ../
2017-04-08 09:55:08 +02:00
make install
2018-05-27 13:16:44 +02:00
export WUT_ROOT=< path / to / install >
2017-03-23 13:17:00 +01:00
```
2018-05-23 00:08:13 +02:00
Then for any wut project you want to build you must use the wut.toolchain.cmake script:
2017-03-23 13:17:00 +01:00
```
cd ../samples/helloworld
mkdir build & & cd build
2018-06-14 12:46:25 +02:00
cmake -DCMAKE_TOOLCHAIN_FILE=$WUT_ROOT/share/wut.toolchain.cmake ../
2017-03-23 13:17:00 +01:00
make
```