Skip to content

Commit 1b37dd7

Browse files
committed
Rename things to try to make the code more readable
1 parent 82f2a11 commit 1b37dd7

File tree

4 files changed

+87
-87
lines changed

4 files changed

+87
-87
lines changed

include/cmake.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include <vector>
99

1010
namespace cmkr {
11-
namespace cmake {
11+
namespace parser {
1212

1313
struct Setting {
1414
std::string name;
@@ -110,7 +110,7 @@ struct Install {
110110
std::string destination;
111111
};
112112

113-
struct CMake {
113+
struct Project {
114114
// This is the CMake version required to use all cmkr versions.
115115
std::string cmake_version = "3.15";
116116
std::string cmkr_include = "cmkr.cmake";
@@ -141,8 +141,8 @@ struct CMake {
141141
std::vector<Install> installs;
142142
tsl::ordered_map<std::string, std::string> conditions;
143143

144-
CMake(const std::string &path, bool build);
144+
Project(const std::string &path, bool build);
145145
};
146146

147-
} // namespace cmake
147+
} // namespace parser
148148
} // namespace cmkr

src/build.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,33 +14,33 @@ namespace cmkr {
1414
namespace build {
1515

1616
int run(int argc, char **argv) {
17-
cmake::CMake cmake(".", true);
17+
parser::Project project(".", true);
1818
if (argc > 2) {
1919
for (int i = 2; i < argc; ++i) {
20-
cmake.build_args.push_back(argv[i]);
20+
project.build_args.push_back(argv[i]);
2121
}
2222
}
2323
std::stringstream ss;
2424

2525
if (gen::generate_cmake(fs::current_path().string().c_str()))
2626
throw std::runtime_error("CMake generation failure!");
2727

28-
ss << "cmake -S. -B" << cmake.build_dir << " ";
28+
ss << "cmake -S. -B" << project.build_dir << " ";
2929

30-
if (!cmake.generator.empty()) {
31-
ss << "-G \"" << cmake.generator << "\" ";
30+
if (!project.generator.empty()) {
31+
ss << "-G \"" << project.generator << "\" ";
3232
}
33-
if (!cmake.config.empty()) {
34-
ss << "-DCMAKE_BUILD_TYPE=" << cmake.config << " ";
33+
if (!project.config.empty()) {
34+
ss << "-DCMAKE_BUILD_TYPE=" << project.config << " ";
3535
}
36-
if (!cmake.gen_args.empty()) {
37-
for (const auto &arg : cmake.gen_args) {
36+
if (!project.gen_args.empty()) {
37+
for (const auto &arg : project.gen_args) {
3838
ss << "-D" << arg << " ";
3939
}
4040
}
41-
ss << "&& cmake --build " << cmake.build_dir << " --parallel";
41+
ss << "&& cmake --build " << project.build_dir << " --parallel";
4242
if (argc > 2) {
43-
for (const auto &arg : cmake.build_args) {
43+
for (const auto &arg : project.build_args) {
4444
ss << " " << arg;
4545
}
4646
}
@@ -50,17 +50,17 @@ int run(int argc, char **argv) {
5050

5151
int clean() {
5252
bool ret = false;
53-
cmake::CMake cmake(".", true);
54-
if (fs::exists(cmake.build_dir)) {
55-
ret = fs::remove_all(cmake.build_dir);
56-
fs::create_directory(cmake.build_dir);
53+
parser::Project project(".", true);
54+
if (fs::exists(project.build_dir)) {
55+
ret = fs::remove_all(project.build_dir);
56+
fs::create_directory(project.build_dir);
5757
}
5858
return !ret;
5959
}
6060

6161
int install() {
62-
cmake::CMake cmake(".", false);
63-
auto cmd = "cmake --install " + cmake.build_dir;
62+
parser::Project project(".", false);
63+
auto cmd = "cmake --install " + project.build_dir;
6464
return ::system(cmd.c_str());
6565
}
6666
} // namespace build

src/cmake.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
#include <tsl/ordered_map.h>
88

99
template <>
10-
const char *enumStrings<cmkr::cmake::TargetType>::data[] = {"executable", "library", "shared", "static", "interface", "custom"};
10+
const char *enumStrings<cmkr::parser::TargetType>::data[] = {"executable", "library", "shared", "static", "interface", "custom"};
1111

1212
namespace cmkr {
13-
namespace cmake {
13+
namespace parser {
1414

1515
using TomlBasicValue = toml::basic_value<toml::preserve_comments, tsl::ordered_map, std::vector>;
1616

@@ -61,7 +61,7 @@ static void get_optional(const TomlBasicValue &v, const toml::key &ky, T &destin
6161
}
6262
}
6363

64-
CMake::CMake(const std::string &path, bool build) {
64+
Project::Project(const std::string &path, bool build) {
6565
if (!fs::exists(fs::path(path) / "cmake.toml")) {
6666
throw std::runtime_error("No cmake.toml was found!");
6767
}
@@ -311,5 +311,5 @@ CMake::CMake(const std::string &path, bool build) {
311311
}
312312
}
313313
}
314-
} // namespace cmake
314+
} // namespace parser
315315
} // namespace cmkr

0 commit comments

Comments
 (0)