create include dir by default

self-hosting
Mohammed Alyousef 4 years ago
parent 221003f199
commit b8fbdb2bed

@ -85,8 +85,8 @@ APP_OTHER_STUFF = { comment = "does other stuff", value = false } # optional
name = "app" # required name = "app" # required
type = "exe" # required (exe || shared || static) type = "exe" # required (exe || shared || static)
sources = ["src/*.cpp"] # required, supports globbing sources = ["src/*.cpp"] # required, supports globbing
include-dirs = ["include"] # optional
alias = "" # optional alias = "" # optional
include-dirs = [] # optional
features = [] # optional features = [] # optional
defines = [] # optional defines = [] # optional
link-libs = [] # optional link-libs = [] # optional

@ -34,8 +34,8 @@ version = "0.1.0"
name = "%s" name = "%s"
type = "%s" type = "%s"
sources = ["src/*.cpp"] sources = ["src/*.cpp"]
include-dirs = ["include"]
# alias = "" # alias = ""
# include-dirs = []
# features = [] # features = []
# defines = [] # defines = []
# link-libs = [] # link-libs = []

@ -43,16 +43,16 @@ std::string format(const char *fmt, Args... args) {
int generate_project(const char *str) { int generate_project(const char *str) {
fs::create_directory("src"); fs::create_directory("src");
fs::create_directory("include");
const auto dir_name = fs::current_path().stem().string(); const auto dir_name = fs::current_path().stem().string();
std::string mainbuf; std::string mainbuf;
const auto tomlbuf = detail::format(cmake_toml, dir_name.c_str(), dir_name.c_str(), str); const auto tomlbuf = detail::format(cmake_toml, dir_name.c_str(), dir_name.c_str(), str);
if (!strcmp(str, "exe")) { if (!strcmp(str, "exe")) {
mainbuf = detail::format(hello_world, "main"); mainbuf = detail::format(hello_world, "main");
} else if (!strcmp(str, "static") || !strcmp(str, "shared") !strcmp(str, "lib")) { } else if (!strcmp(str, "static") || !strcmp(str, "shared") !strcmp(str, "lib")) {
fs::create_directory("include");
mainbuf = detail::format(hello_world, "test"); mainbuf = detail::format(hello_world, "test");
} else if (!strcmp(str, "interface")) { } else if (!strcmp(str, "interface")) {
fs::create_directory("include"); // Nothing special!
} else { } else {
throw std::runtime_error( throw std::runtime_error(
"Unknown project type. Types are exe, lib, shared, static, interface!"); "Unknown project type. Types are exe, lib, shared, static, interface!");

Loading…
Cancel
Save