npi-build/include/prj_def.hpp
tobid7 d464128d78 # New Features #
- Installable via cmake
- Dont run makerom and makebanner in 3dsx mode
2024-03-09 13:44:22 +01:00

120 lines
3.5 KiB
C++

#pragma once
#include <string>
#include <vector>
struct NpiProject
{
std::string name;
std::string author;
std::string description;
int vmajor;
int vminor;
int vbuild;
std::vector<std::string> source_dirs;
std::vector<std::string> include_dirs;
std::vector<std::string> libraries;
std::vector<std::string> lib_dirs;
std::string icon_path;
std::string banner_path; // depends ctr_type
std::string banner_a_path; // depends ctr_type
std::string rsf_path; // depends ctr_type
std::string logo_lz11_path; // depends ctr_type
std::string dir_gfx;
std::string dir_gfxbuild;
std::string dir_romfs;
std::string unique_id; // depends ctr_type
std::string prod; // depends ctr_type
std::string platform; // Platforms: 3ds, desktop
bool ctr_type; // depends platform
std::vector<std::string> arch_flags;
std::vector<std::string> c_flags;
std::vector<std::string> cxx_flags;
std::vector<std::string> as_flags;
std::vector<std::string> linker_flags;
std::string cxx_compiler;
std::string c_compiler;
std::string linker;
std::string asm_compiler;
};
inline void Prj_InitDefault(NpiProject &project, bool cia)
{
project.name = "Sample";
project.author = "Sample";
project.description = "Description";
project.vmajor = 1;
project.vminor = 0;
project.vbuild = 0;
project.source_dirs.push_back("source");
project.include_dirs.push_back("include");
project.libraries.push_back("m");
project.libraries.push_back("stdc++");
project.libraries.push_back("citro2d");
project.libraries.push_back("citro3d");
project.libraries.push_back("ctru");
project.arch_flags.push_back("march=armv6k");
project.arch_flags.push_back("mtune=mpcore");
project.arch_flags.push_back("mfloat-abi=hard");
project.arch_flags.push_back("mtp=soft");
project.c_flags.push_back("g");
project.c_flags.push_back("Wall");
project.c_flags.push_back("Wno-psabi");
project.c_flags.push_back("O2");
project.c_flags.push_back("mword-relocations");
project.c_flags.push_back("fomit-frame-pointer");
project.c_flags.push_back("ffunction-sections");
project.c_flags.push_back("[arch_flags]");
project.c_flags.push_back("D__3DS__");
project.c_flags.push_back("D_GNU_SOURCE=1");
project.cxx_flags.push_back("[c_flags]");
project.cxx_flags.push_back("fno-rtti");
project.cxx_flags.push_back("fno-exceptions");
project.cxx_flags.push_back("std=gnu++20");
project.as_flags.push_back("g");
project.as_flags.push_back("[arch_flags]");
project.linker_flags.push_back("specs=3dsx.specs");
project.linker_flags.push_back("g");
project.linker_flags.push_back("[arch_flags]");
project.linker_flags.push_back("Wl,-Map,./build/code.map");
project.lib_dirs.push_back("{DEVKITPRO}/portlibs/3ds/");
project.lib_dirs.push_back("{DEVKITPRO}/libctru/");
project.cxx_compiler = "{DEVKITPRO}/devkitARM/bin/arm-none-eabi-g++";
project.linker = "{DEVKITPRO}/devkitARM/bin/arm-none-eabi-g++";
project.c_compiler = "{DEVKITPRO}/devkitARM/bin/arm-none-eabi-gcc";
project.asm_compiler = "{DEVKITPRO}/devkitARM/bin/arm-none-eabi-gcc";
project.icon_path = "app/icon.png";
if (cia)
{
project.banner_path = "app/banner.png";
project.banner_a_path = "app/banner_audio.wav";
project.rsf_path = "app/build-cia.rsf";
project.logo_lz11_path = "app/logo.lz11";
}
project.dir_gfx = "gfx/";
project.dir_gfxbuild = "romfs/gfx/";
project.dir_romfs = "romfs/";
if (cia)
{
project.unique_id = "0xff3ff";
project.prod = "NPI7";
}
project.platform = "3ds";
project.ctr_type = cia;
}