Files
XeniOS/docs/building.md
T

143 lines
4.3 KiB
Markdown
Raw Normal View History

2013-02-24 11:44:10 -08:00
# Building
You must have a 64-bit machine for building and running the project. Always
run your system updater before building and make sure you have the latest
drivers.
2013-02-24 11:44:10 -08:00
## Setup
### Windows
2024-02-15 16:58:38 -08:00
* Windows 10 or later
* [Visual Studio 2022 or 2026](https://www.visualstudio.com/downloads/)
2025-07-25 16:51:10 -07:00
* Windows 11 SDK version 10.0.22000.0 (for Visual Studio 2022, this or any newer version)
* [Python 3.6+ 64-bit](https://www.python.org/downloads/)
* Ensure Python is in PATH.
* CMake 3.10+ (or C++ CMake tools for Windows)
* Can install using python:
```
python -m pip install cmake
```
* wxWidgets is built from a vendored submodule (`third_party/wxWidgets`).
No system install needed.
```
2025-09-21 20:05:17 +09:00
git clone https://github.com/has207/xenia-edge.git
cd xenia-edge
xb setup
# Build on command line (add --config=release for release):
xb build
# Run premake and open Visual Studio (add --config=release for release):
xb devenv
# Format code to the style guide:
xb format
```
2026-04-18 12:12:40 +09:00
#### Cross-compiling (Windows ARM64 ↔ x64)
The build supports cross-compiling between Windows x64 and ARM64 on the same
machine; `xb` configures into `build-<target>/` so it never clobbers the
native-build tree.
2026-04-18 12:12:40 +09:00
* Install Visual Studio components for the target architecture:
* x64 host targeting ARM64: **MSVC v143 - VS 2022 C++ ARM64/ARM64EC build tools**
* ARM64 host targeting x64: **MSVC v143 - VS 2022 C++ x64/x86 build tools**
* From an **x64 host** targeting ARM64:
2026-04-18 12:12:40 +09:00
```
xb build --target-arch arm64 --config=release
```
Output lands in `build-arm64\bin\Windows\Release\`.
* From an **ARM64 host** targeting x64:
2026-04-18 12:12:40 +09:00
```
xb build --target-arch=x64 --config=release
2026-04-18 12:12:40 +09:00
```
Output lands in `build-x64\bin\Windows\Release\`.
#### Testing
```
# Generate tests:
xb gentests
# Run tests:
xb test
```
#### Debugging
2019-10-02 23:34:43 +02:00
VS behaves oddly with the debug paths. Open the 'xenia-app' project properties
and set the 'Command' to `$(SolutionDir)$(TargetPath)` and the
'Working Directory' to `$(SolutionDir)..\..`. You can specify flags and
the file to run in the 'Command Arguments' field (or use `--flagfile=flags.txt`).
By default logs are written to xenia.log. You can
2015-08-29 18:06:30 -07:00
override this with `--log_file=log.txt`.
2013-02-24 11:44:10 -08:00
2015-09-20 21:31:05 -07:00
If running under Visual Studio and you want to look at the JIT'ed code
(available around 0xA0000000) you should pass `--emit_source_annotations` to
get helpful spacers/movs in the disassembly.
2015-08-18 14:18:00 -07:00
### Linux
The build script uses Clang 21.
2015-08-18 14:18:00 -07:00
2025-07-11 03:02:07 -07:00
* Normal building via `xb build` uses CMake+Ninja.
2025-07-18 07:00:57 -07:00
* Environment variables:
Name | Default Value
----- | -------------
`CC` | `clang`
`CXX` | `clang++`
You will also need some development libraries. To get them on an Ubuntu system:
2020-11-05 12:26:04 +01:00
2025-07-11 03:02:07 -07:00
```sh
2026-05-26 21:13:06 +09:00
sudo apt-get install build-essential mesa-vulkan-drivers libc++-dev libc++abi-dev liblz4-dev libvulkan-dev libx11-xcb-dev clang-21 llvm-21 ninja-build libfontconfig1-dev \
libasound2-dev libpulse-dev libudev-dev libdbus-1-dev \
libx11-dev libxext-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxss-dev libxkbcommon-dev libxfixes-dev
2016-05-12 09:06:36 -06:00
```
In addition, you will need up to date Vulkan libraries and drivers for your hardware, which most distributions have in their standard repositories nowadays.
2017-12-20 14:11:23 -06:00
### macOS
* macOS 15 or later (the build sets `CMAKE_OSX_DEPLOYMENT_TARGET` to 15.0)
* Xcode Command Line Tools (provides clang, the macOS SDK, and `python3`)
* Install with:
```sh
xcode-select --install
```
* CMake, Ninja, clang-format
* Can install using python:
```sh
python3 -m pip install cmake ninja clang-format
```
* wxWidgets is built from a vendored submodule (`third_party/wxWidgets`).
No system install needed.
2025-10-08 14:03:09 +09:00
```sh
git clone https://github.com/has207/xenia-edge.git
cd xenia-edge
./xb setup
# Build on command line (add --config=release for release):
./xb build
2025-10-08 14:03:09 +09:00
```
#### Cross-compiling (macOS arm64 ↔ x86_64)
Pass `--target-arch` for the non-host architecture:
```sh
./xb build --target-arch=arm64 --config=release # arm64
./xb build --target-arch=x64 --config=release # x86_64
```
Output lands in `build-arm64/` or `build-x64/` respectively while host native ends up in `build/`.
2015-06-30 19:34:48 -07:00
## Running
2013-02-24 11:44:10 -08:00
To make life easier you can set the program startup arguments in your IDE to something like `--log_file=stdout /path/to/Default.xex` to log to console rather than a file and start up the emulator right away.