self-hosting
MoAlyousef 4 years ago
parent 23eeaf667c
commit 4db372900d

1
.gitignore vendored

@ -2,3 +2,4 @@ bin
compile_commands.json
.clangd
temp.*
.vs

@ -50,6 +50,7 @@ type = "exe" # required (exe || shared || static)
sources = ["src/main.cpp", "src/args.cpp", "src/gen.cpp"] # required
include_directories = ["vendor"] # optional
compile_features = ["cxx_std_17"] # optional
# definitions = [] # optional
# link_libraries = [] # optional
```
@ -59,13 +60,13 @@ Usage: cmkr [arguments]
arguments:
init [exe|shared|static] Starts a new project in the same directory.
gen Generates CMakeLists.txt file.
build [cmake args...] Run cmake and build.
build [extra cmake args] Run cmake and build.
help Show help.
version Current cmkr version.
```
The build command invokes cmake and the default build-system on your platform, it also accepts extra cmake arguments:
```
cmkr build -DCMAKE_TOOLCHAIN_FILE=/path/to/toolchain -DCMAKE_BUILD_TYPE=Release
cmkr build -GNinja -DCMAKE_TOOLCHAIN_FILE=/path/to/toolchain -DCMAKE_BUILD_TYPE=Release
```
## Roadmap

@ -18,5 +18,6 @@ type = "exe" # required (exe || shared || static)
sources = ["src/main.cpp", "src/args.cpp", "src/gen.cpp"] # required
include_directories = ["vendor"] # optional
compile_features = ["cxx_std_17"] # optional
# definitions = [] # optional
# link_libraries = [] # optional

@ -167,6 +167,7 @@ void generate_cmake() {
}
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";
@ -175,6 +176,7 @@ void generate_cmake() {
}
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";
@ -183,6 +185,15 @@ void generate_cmake() {
}
ss << ")\n\n";
}
if (bin.contains("definitions")) {
const auto defs = toml::find(bin, "definitions").as_array();
ss << "target_add_definitions(" << bin_name << " PUBLIC\n\t";
for (const auto &def : defs) {
ss << def << "\n\t";
}
ss << ")\n\n";
}
}
}

Loading…
Cancel
Save