commenting out unused fields

self-hosting
MoAlyousef 4 years ago
parent c03c9a2d0d
commit 497f06b0f3

@ -1,15 +1,15 @@
[cmake] # required
minimum_required = "3.0" # required
cpp_flags = [""] # optional
c_flags = [""] # optional
linker_flags = [""] # optional
# cpp_flags = [""] # optional
# c_flags = [""] # optional
# linker_flags = [""] # optional
[project] # required
name = "cmkr" # required
version = "0.1.0" # required
[dependencies] # optional, runs find_package
# boost = "*"
# [dependencies] # optional, runs find_package
# boost = "1.74.0"
[[app]] # optional
name = "cmkr" # required

@ -86,7 +86,7 @@ void generate_cmake() {
if (cmake.contains("cpp_flags")) {
ss << "set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}";
const auto flags = toml::find(cmake, "cpp_flags").as_array();
for (const auto &flag: flags) {
for (const auto &flag : flags) {
ss << " " << flag;
}
ss << ")\n\n";
@ -95,7 +95,7 @@ void generate_cmake() {
if (cmake.contains("c_flags")) {
ss << "set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS}";
const auto flags = toml::find(cmake, "c_flags").as_array();
for (const auto &flag: flags) {
for (const auto &flag : flags) {
ss << " " << flag;
}
ss << ")\n\n";
@ -104,7 +104,7 @@ void generate_cmake() {
if (cmake.contains("linker_flags")) {
ss << "set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS}";
const auto flags = toml::find(cmake, "linker_flags").as_array();
for (const auto &flag: flags) {
for (const auto &flag : flags) {
ss << " " << flag;
}
ss << ")\n\n";
@ -128,12 +128,12 @@ void generate_cmake() {
if (toml.contains("app")) {
const auto &bins = toml::find(toml, "app").as_array();
for (const auto &bin: bins) {
for (const auto &bin : bins) {
const std::string bin_name = toml::find(bin, "name").as_string();
const auto srcs = toml::find(bin, "sources").as_array();
ss << "set(" << detail::to_upper(bin_name) << "_SOURCES\n";
for (const auto &src: srcs) {
for (const auto &src : srcs) {
ss << "\t" << src << "\n";
}
ss << "\t)\n\n"
@ -142,27 +142,27 @@ void generate_cmake() {
if (bin.contains("include_directories")) {
const auto includes = toml::find(bin, "include_directories").as_array();
ss << "target_include_directories(" << bin_name << " PUBLIC\n\t";
for (const auto &inc: includes) {
ss << inc << "\n\t";
}
ss << ")\n\n";
ss << "target_include_directories(" << bin_name << " PUBLIC\n\t";
for (const auto &inc : includes) {
ss << inc << "\n\t";
}
ss << ")\n\n";
}
if (bin.contains("link_libraries")) {
const auto libraries = toml::find(bin, "link_libraries").as_array();
ss << "target_link_libraries(" << bin_name << " PUBLIC\n\t";
for (const auto &l: libraries) {
ss << l << "\n\t";
}
ss << ")\n\n";
ss << "target_link_libraries(" << bin_name << " PUBLIC\n\t";
for (const auto &l : libraries) {
ss << l << "\n\t";
}
ss << ")\n\n";
}
if (bin.contains("compile_features")) {
const auto feats = toml::find(bin, "compile_features").as_array();
ss << "target_compile_features(" << bin_name << " PUBLIC\n\t";
for (const auto &feat: feats) {
ss << feat << "\n\t";
}
ss << ")\n\n";
ss << "target_compile_features(" << bin_name << " PUBLIC\n\t";
for (const auto &feat : feats) {
ss << feat << "\n\t";
}
ss << ")\n\n";
}
}
}
@ -170,13 +170,13 @@ void generate_cmake() {
if (toml.contains("lib")) {
const auto &libs = toml::find(toml, "lib").as_array();
for (const auto &lib: libs) {
for (const auto &lib : libs) {
const std::string lib_name = toml::find(lib, "name").as_string();
const std::string type = toml::find(lib, "type").as_string();
const auto srcs = toml::find(lib, "sources").as_array();
ss << "set(" << detail::to_upper(lib_name) << "_SOURCES\n";
for (const auto &src: srcs) {
for (const auto &src : srcs) {
ss << "\t" << src << "\n";
}
ss << "\t)\n\n"
@ -185,33 +185,33 @@ void generate_cmake() {
if (lib.contains("include_directories")) {
const auto includes = toml::find(lib, "include_directories").as_array();
ss << "target_include_directories(" << lib_name << " PUBLIC\n\t";
for (const auto &inc: includes) {
ss << inc << "\n\t";
}
ss << ")\n\n";
ss << "target_include_directories(" << lib_name << " PUBLIC\n\t";
for (const auto &inc : includes) {
ss << inc << "\n\t";
}
ss << ")\n\n";
}
if (lib.contains("link_libraries")) {
const auto ls = toml::find(lib, "link_libraries").as_array();
ss << "target_link_libraries(" << lib_name << " PUBLIC\n\t";
for (const auto& l: ls) {
ss << l << "\n\t";
}
ss << ")\n\n";
ss << "target_link_libraries(" << lib_name << " PUBLIC\n\t";
for (const auto &l : ls) {
ss << l << "\n\t";
}
ss << ")\n\n";
}
if (lib.contains("compile_features")) {
const auto feats = toml::find(lib, "compile_features").as_array();
ss << "target_compile_features(" << lib_name << " PUBLIC\n\t";
for (const auto &feat: feats) {
ss << feat << "\n\t";
}
ss << ")\n\n";
ss << "target_compile_features(" << lib_name << " PUBLIC\n\t";
for (const auto &feat : feats) {
ss << feat << "\n\t";
}
ss << ")\n\n";
}
}
}
std::ofstream ofs("CMakeLists.txt");
if (ofs.is_open()) {
ofs << ss.rdbuf();

Loading…
Cancel
Save