Switch开发环境搭建

本文版权归作者所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

转载自夜明的孤行灯

本文链接地址: https://www.huangyunkun.com/2020/03/13/switch-development-env-setup/



如果由于各种原因需要在Switch上做开发,那么第一个需要的就是环境配置。目前主要需要的是devkitA64和libnx。

devKitA64是在devkitPro下的,另外还有ARM、3ds等,如果只是Switch开发安装A64即可。这里注意下devkitPro没有版本号管理一说。

Mac

我这里以mac为例,首先下载devkitPro_pacman,按照说明安装。然后确认下xcode情况

xcode-select --install

修改环境配置为

export DEVKITPRO=/opt/devkitpro
export DEVKITARM=${DEVKITPRO}/devkitARM
export DEVKITPPC=${DEVKITPRO}/devkitPPC
export PATH=${DEVKITPRO}/tools/bin:$PATH

libnx在上面安装完成后会自带,不需要额外处理。

Ubuntu

如果是ubuntu系统,安装步骤基本一致,首先确保依赖

apt-get git wget install libxml2 libstdc++6 gpg xz-utils make -y

安装pacman并设置环境变量

wget https://github.com/devkitPro/pacman/releases/download/devkitpro-pacman-1.0.1/devkitpro-pacman.deb
RUN dpkg -i devkitpro-pacman.deb && dkp-pacman -S switch-dev --noconfirm
RUN source /etc/profile.d/devkit-env.sh

Docker

如果用vs code并启用了remote development,可以用我打好的预设镜像

docker pull registry.cn-shanghai.aliyuncs.com/htynkn/switch-devenv

或者使用官方的镜像

docker pull devkitpro/devkita64

vs code配置如下

{
	"name": "devkita64",
	"dockerFile": "Dockerfile",
	
	// Set *default* container specific settings.json values on container create. 
	"settings": {
		"terminal.integrated.shell.linux": "/bin/sh"
	},

	// Add the IDs of extensions you want installed when the container is created.
	// Note that some extensions may not work in Alpine Linux. See https://aka.ms/vscode-remote/linux.
	"extensions": []

	// Use 'forwardPorts' to make a list of ports inside the container available locally.
	// "forwardPorts": [],

	// Use 'postCreateCommand' to run commands after the container is created.
	// "postCreateCommand": "uname -a",

	// Uncomment when using a ptrace-based debugger like C++, Go, and Rust
	// "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],

	// Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root.
	// "remoteUser": "vscode"
}

运行效果如下:

开发语言需要掌握ASM/C/C++,示例项目可以参考:https://github.com/switchbrew/switch-examples

另外还有几个比较典型的可以参考:

UI库:

https://github.com/rock88/libnx-SDL2

https://github.com/XorTroll/Plutonium

参考项目:

https://github.com/AtlasNX/Swurl/tree/master

https://github.com/AtlasNX/Kosmos-Updater



本文版权归作者所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

转载自夜明的孤行灯

本文链接地址: https://www.huangyunkun.com/2020/03/13/switch-development-env-setup/

《Switch开发环境搭建》有2条评论

  1. devkitA64和libnx都安装了,请问xcode有类似template么,想在xcode中编译开发,请问如何设置呢

    回复

回复 jayden 取消回复