commenting out unused fields

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

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

@ -86,7 +86,7 @@ void generate_cmake() {
if (cmake.contains("cpp_flags")) { if (cmake.contains("cpp_flags")) {
ss << "set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}"; ss << "set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}";
const auto flags = toml::find(cmake, "cpp_flags").as_array(); const auto flags = toml::find(cmake, "cpp_flags").as_array();
for (const auto &flag: flags) { for (const auto &flag : flags) {
ss << " " << flag; ss << " " << flag;
} }
ss << ")\n\n"; ss << ")\n\n";
@ -95,7 +95,7 @@ void generate_cmake() {
if (cmake.contains("c_flags")) { if (cmake.contains("c_flags")) {
ss << "set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS}"; ss << "set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS}";
const auto flags = toml::find(cmake, "c_flags").as_array(); const auto flags = toml::find(cmake, "c_flags").as_array();
for (const auto &flag: flags) { for (const auto &flag : flags) {
ss << " " << flag; ss << " " << flag;
} }
ss << ")\n\n"; ss << ")\n\n";
@ -104,7 +104,7 @@ void generate_cmake() {
if (cmake.contains("linker_flags")) { if (cmake.contains("linker_flags")) {
ss << "set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS}"; ss << "set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS}";
const auto flags = toml::find(cmake, "linker_flags").as_array(); const auto flags = toml::find(cmake, "linker_flags").as_array();
for (const auto &flag: flags) { for (const auto &flag : flags) {
ss << " " << flag; ss << " " << flag;
} }
ss << ")\n\n"; ss << ")\n\n";
@ -128,12 +128,12 @@ void generate_cmake() {
if (toml.contains("app")) { if (toml.contains("app")) {
const auto &bins = toml::find(toml, "app").as_array(); 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 std::string bin_name = toml::find(bin, "name").as_string();
const auto srcs = toml::find(bin, "sources").as_array(); const auto srcs = toml::find(bin, "sources").as_array();
ss << "set(" << detail::to_upper(bin_name) << "_SOURCES\n"; 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" << src << "\n";
} }
ss << "\t)\n\n" ss << "\t)\n\n"
@ -143,7 +143,7 @@ void generate_cmake() {
if (bin.contains("include_directories")) { if (bin.contains("include_directories")) {
const auto includes = toml::find(bin, "include_directories").as_array(); const auto includes = toml::find(bin, "include_directories").as_array();
ss << "target_include_directories(" << bin_name << " PUBLIC\n\t"; ss << "target_include_directories(" << bin_name << " PUBLIC\n\t";
for (const auto &inc: includes) { for (const auto &inc : includes) {
ss << inc << "\n\t"; ss << inc << "\n\t";
} }
ss << ")\n\n"; ss << ")\n\n";
@ -151,7 +151,7 @@ void generate_cmake() {
if (bin.contains("link_libraries")) { if (bin.contains("link_libraries")) {
const auto libraries = toml::find(bin, "link_libraries").as_array(); const auto libraries = toml::find(bin, "link_libraries").as_array();
ss << "target_link_libraries(" << bin_name << " PUBLIC\n\t"; ss << "target_link_libraries(" << bin_name << " PUBLIC\n\t";
for (const auto &l: libraries) { for (const auto &l : libraries) {
ss << l << "\n\t"; ss << l << "\n\t";
} }
ss << ")\n\n"; ss << ")\n\n";
@ -159,7 +159,7 @@ void generate_cmake() {
if (bin.contains("compile_features")) { if (bin.contains("compile_features")) {
const auto feats = toml::find(bin, "compile_features").as_array(); const auto feats = toml::find(bin, "compile_features").as_array();
ss << "target_compile_features(" << bin_name << " PUBLIC\n\t"; ss << "target_compile_features(" << bin_name << " PUBLIC\n\t";
for (const auto &feat: feats) { for (const auto &feat : feats) {
ss << feat << "\n\t"; ss << feat << "\n\t";
} }
ss << ")\n\n"; ss << ")\n\n";
@ -170,13 +170,13 @@ void generate_cmake() {
if (toml.contains("lib")) { if (toml.contains("lib")) {
const auto &libs = toml::find(toml, "lib").as_array(); 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 lib_name = toml::find(lib, "name").as_string();
const std::string type = toml::find(lib, "type").as_string(); const std::string type = toml::find(lib, "type").as_string();
const auto srcs = toml::find(lib, "sources").as_array(); const auto srcs = toml::find(lib, "sources").as_array();
ss << "set(" << detail::to_upper(lib_name) << "_SOURCES\n"; 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" << src << "\n";
} }
ss << "\t)\n\n" ss << "\t)\n\n"
@ -186,7 +186,7 @@ void generate_cmake() {
if (lib.contains("include_directories")) { if (lib.contains("include_directories")) {
const auto includes = toml::find(lib, "include_directories").as_array(); const auto includes = toml::find(lib, "include_directories").as_array();
ss << "target_include_directories(" << lib_name << " PUBLIC\n\t"; ss << "target_include_directories(" << lib_name << " PUBLIC\n\t";
for (const auto &inc: includes) { for (const auto &inc : includes) {
ss << inc << "\n\t"; ss << inc << "\n\t";
} }
ss << ")\n\n"; ss << ")\n\n";
@ -195,7 +195,7 @@ void generate_cmake() {
if (lib.contains("link_libraries")) { if (lib.contains("link_libraries")) {
const auto ls = toml::find(lib, "link_libraries").as_array(); const auto ls = toml::find(lib, "link_libraries").as_array();
ss << "target_link_libraries(" << lib_name << " PUBLIC\n\t"; ss << "target_link_libraries(" << lib_name << " PUBLIC\n\t";
for (const auto& l: ls) { for (const auto &l : ls) {
ss << l << "\n\t"; ss << l << "\n\t";
} }
ss << ")\n\n"; ss << ")\n\n";
@ -204,7 +204,7 @@ void generate_cmake() {
if (lib.contains("compile_features")) { if (lib.contains("compile_features")) {
const auto feats = toml::find(lib, "compile_features").as_array(); const auto feats = toml::find(lib, "compile_features").as_array();
ss << "target_compile_features(" << lib_name << " PUBLIC\n\t"; ss << "target_compile_features(" << lib_name << " PUBLIC\n\t";
for (const auto &feat: feats) { for (const auto &feat : feats) {
ss << feat << "\n\t"; ss << feat << "\n\t";
} }
ss << ")\n\n"; ss << ")\n\n";

Loading…
Cancel
Save