diff --git a/.gitignore b/.gitignore index 9d682e8..38fe41b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ DejaVuSansMono.ttf build/ +build-linux/ bin/ *.d *.exe diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a8da0e..b4df3c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,13 @@ cmake_minimum_required(VERSION 3.7) project(NevolutionX) +configure_file(sampleconfig.json config.json COPYONLY) + +foreach(runtime_file IN ITEMS Resources/480.png Resources/720.png Resources/vegur.ttf) + get_filename_component(runtime_name "${runtime_file}" NAME) + configure_file("${runtime_file}" "${runtime_name}" COPYONLY) +endforeach() + INCLUDE(FindPkgConfig) PKG_SEARCH_MODULE(SDL2TTF REQUIRED SDL2_ttf) diff --git a/README.md b/README.md index 7f18947..8dc8da4 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,21 @@ ls bin/ 480.png 720.png default.xbe vegur.ttf ``` +### Optional Nix development shell + +On Linux, the included flake provides the nxdk and native-build prerequisites +without installing them globally. Clone nxdk next to this repository, then +enter the shell and build: + +```sh +git clone --recursive https://github.com/XboxDev/nxdk.git ../nxdk +nix develop +make -j$(nproc) +``` + +The shell sets `NXDK_DIR` to the sibling checkout by default. Set it before +entering the shell if nxdk lives elsewhere. + ### Installation Simply copy `default.xbe` and all the assets onto your xbox. There is no further configuration required. The FTP-server will start automatically with NevolutionX, you'll only need to provide a link and a DHCP-server. The default user credentials are `xbox`/`xbox`. @@ -41,7 +56,14 @@ There is no further configuration required. The FTP-server will start automatica ## Building with CMake (Linux target) TODO: Document what parts of the Linux target are not supported. TODO: Document installation for the Linux target, if applicable. -`cmake -S . -B build && cmake --build build --verbose` + +From the Nix development shell: + +```sh +cmake -S . -B build-linux +cmake --build build-linux --verbose +(cd build-linux && ./NevolutionX) +``` ## Credits This software is built on top of other awesome projects: @@ -51,4 +73,3 @@ This software is built on top of other awesome projects: ## License NevolutionX is published under the MIT License. See [LICENSE](LICENSE) for more information. MIT © 2019 Lucas Eriksson - diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..6379c0f --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1788400875, + "narHash": "sha256-JIHQ6xNAN53cdo6zZ72LRcQ9lpvnABCnNE4hldJ5uZU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "5545adfad2e98de106a5544ca7067e03010410bd", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..b7f8bdf --- /dev/null +++ b/flake.nix @@ -0,0 +1,44 @@ +{ + description = "NevolutionX development environment"; + + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + + outputs = { nixpkgs, ... }: + let + supportedSystems = [ "x86_64-linux" "aarch64-linux" ]; + forAllSystems = function: + nixpkgs.lib.genAttrs supportedSystems (system: function nixpkgs.legacyPackages.${system}); + in + { + devShells = forAllSystems (pkgs: { + default = pkgs.mkShell { + # nxdk cross-compiles for i386-pc-win32; host hardening flags such as + # -fPIC are invalid for that target. + hardeningDisable = [ "all" ]; + + packages = with pkgs; [ + bison + clang + clang-tools + cmake + flex + freetype + gnumake + harfbuzz + lld + libtiff + llvm + pkg-config + SDL2 + SDL2_image + SDL2_ttf + ]; + + shellHook = '' + export NXDK_DIR="''${NXDK_DIR:-$PWD/../nxdk}" + export PATH="$NXDK_DIR/bin:$PATH" + ''; + }; + }); + }; +}