| 1 |
# Cross Compiling configuration for the Nintendo Switch, it requires Nintendo SDK |
| 2 |
# Tested on windows |
| 3 |
MRuby::CrossBuild.new('nintendo_switch_32bit') do |conf| |
| 4 |
conf.toolchain :clang |
| 5 |
NINTENDO_SDK_PATH = ENV['NINTENDO_SDK_ROOT'] |
| 6 |
|
| 7 |
include_paths = [ |
| 8 |
"#{NINTENDO_SDK_PATH}/Include", |
| 9 |
"#{NINTENDO_SDK_PATH}/Common/Configs/Targets/NX-NXFP2-a32/Include" |
| 10 |
] |
| 11 |
|
| 12 |
conf.cc do |cc| |
| 13 |
cc.command = "#{NINTENDO_SDK_PATH}/Compilers/NX/bin/nx-clang++" |
| 14 |
cc.include_paths += include_paths |
| 15 |
cc.flags += ['-fpic -fno-short-enums -ffunction-sections -fdata-sections -fno-common -fno-strict-aliasing -fomit-frame-pointer -fno-vectorize -funsigned-char -O2 -g -mno-implicit-float'] |
| 16 |
cc.defines += 'NN_SDK_BUILD_RELEASE' |
| 17 |
end |
| 18 |
|
| 19 |
conf.cxx do |cxx| |
| 20 |
cxx.command = "#{NINTENDO_SDK_PATH}/Compilers/NX/bin/nx-clang++" |
| 21 |
cxx.include_paths += include_paths |
| 22 |
cxx.flags += ['-fpic -fno-short-enums -ffunction-sections -fdata-sections -fno-common -fno-strict-aliasing -fomit-frame-pointer -fno-vectorize -funsigned-char -O2 -g -mno-implicit-float'] |
| 23 |
cxx.defines += 'NN_SDK_BUILD_RELEASE' |
| 24 |
end |
| 25 |
|
| 26 |
conf.archiver do |archiver| |
| 27 |
archiver.command = "#{NINTENDO_SDK_PATH}/Compilers/NX/nx/armv7l/bin/llvm-ar" |
| 28 |
end |
| 29 |
|
| 30 |
conf.linker do |linker| |
| 31 |
linker.command = "#{NINTENDO_SDK_PATH}/Compilers/NX/nx/armv7l/bin/clang++" |
| 32 |
linker.libraries = [] |
| 33 |
end |
| 34 |
|
| 35 |
# Add your mrbgems |
| 36 |
end |
| 37 |
|
| 38 |
MRuby::CrossBuild.new('nintendo_switch_64bit') do |conf| |
| 39 |
conf.toolchain :clang |
| 40 |
NINTENDO_SDK_PATH = ENV['NINTENDO_SDK_ROOT'] |
| 41 |
|
| 42 |
include_paths = [ |
| 43 |
"#{NINTENDO_SDK_PATH}/Include", |
| 44 |
"#{NINTENDO_SDK_PATH}/Common/Configs/Targets/NX-NXFP2-a64/Include" |
| 45 |
] |
| 46 |
|
| 47 |
conf.cc do |cc| |
| 48 |
cc.command = "#{NINTENDO_SDK_PATH}/Compilers/NX/bin/nx-clang++" |
| 49 |
cc.include_paths += include_paths |
| 50 |
cc.flags += ['-fpic -fno-short-enums -ffunction-sections -fdata-sections -fno-common -fno-strict-aliasing -fomit-frame-pointer -fno-vectorize -funsigned-char -O2 -g -mno-implicit-float'] |
| 51 |
cc.flags << '--target=aarch64-nintendo-nx-elf' |
| 52 |
cc.defines += 'NN_SDK_BUILD_RELEASE' |
| 53 |
end |
| 54 |
|
| 55 |
conf.cxx do |cxx| |
| 56 |
cxx.command = "#{NINTENDO_SDK_PATH}/Compilers/NX/bin/nx-clang++" |
| 57 |
cxx.include_paths += include_paths |
| 58 |
cxx.flags += ['-fpic -fno-short-enums -ffunction-sections -fdata-sections -fno-common -fno-strict-aliasing -fomit-frame-pointer -fno-vectorize -funsigned-char -O2 -g -mno-implicit-float'] |
| 59 |
cxx.flags << '--target=aarch64-nintendo-nx-elf' |
| 60 |
cxx.defines += 'NN_SDK_BUILD_RELEASE' |
| 61 |
end |
| 62 |
|
| 63 |
conf.archiver do |archiver| |
| 64 |
archiver.command = "#{NINTENDO_SDK_PATH}/Compilers/NX/nx/aarch64/bin/llvm-ar" |
| 65 |
end |
| 66 |
|
| 67 |
conf.linker do |linker| |
| 68 |
linker.command = "#{NINTENDO_SDK_PATH}/Compilers/NX/nx/aarch64/bin/clang++" |
| 69 |
linker.libraries = [] |
| 70 |
end |
| 71 |
|
| 72 |
# Add your mrbgems |
| 73 |
end |