Skip to content

Commit 16e68d7

Browse files
committed
fix C++11 build
1 parent 5dc71f9 commit 16e68d7

File tree

12 files changed

+52
-29
lines changed

12 files changed

+52
-29
lines changed

include/args.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
#pragma once
22

33
#ifdef __cplusplus
4-
namespace cmkr::args {
5-
4+
namespace cmkr {
5+
namespace args {
66
const char *handle_args(int argc, char **argv);
77
}
8+
} // namespace cmkr
89

910
extern "C" {
1011
#endif

include/build.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@
22

33
#ifdef __cplusplus
44

5-
namespace cmkr::build {
5+
namespace cmkr {
6+
namespace build {
67

78
int run(int argc, char **argv);
89

910
int clean();
1011

1112
int install();
1213

13-
} // namespace cmkr::build
14+
} // namespace build
15+
} // namespace cmkr
1416
extern "C" {
1517
#endif
1618

include/error.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#pragma once
22

33
#ifdef __cplusplus
4-
namespace cmkr::error {
4+
namespace cmkr {
5+
namespace error {
56

67
struct Status {
78
enum class Code {
@@ -21,7 +22,8 @@ struct Status {
2122
Code ec_ = Code::Success;
2223
};
2324

24-
} // namespace cmkr::error
25+
} // namespace error
26+
} // namespace cmkr
2527

2628
extern "C" {
2729
#endif

include/gen.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
#pragma once
22

33
#ifdef __cplusplus
4-
namespace cmkr::gen {
4+
namespace cmkr {
5+
namespace gen {
56

67
int generate_project(const char *typ);
78

89
int generate_cmake(const char *path);
910

10-
} // namespace cmkr::gen
11+
} // namespace gen
12+
} // namespace cmkr
1113

1214
extern "C" {
1315
#endif

include/help.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
#pragma once
22

33
#ifdef __cplusplus
4-
namespace cmkr::help {
4+
namespace cmkr {
5+
namespace help {
56

67
const char *version() noexcept;
78

89
const char *message() noexcept;
910

10-
} // namespace cmkr::help
11+
} // namespace help
12+
} // namespace cmkr
1113

1214
extern "C" {
1315
#endif

src/args.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
#include "gen.h"
44
#include "help.h"
55

6-
#include <exception>
76
#include "fs.hpp"
7+
#include <exception>
88
#include <iostream>
99
#include <stdexcept>
1010
#include <string>
1111
#include <vector>
1212

13-
namespace cmkr::args {
13+
namespace cmkr {
14+
namespace args {
1415
const char *handle_args(int argc, char **argv) {
1516
std::vector<std::string> args;
1617
for (int i = 0; i < argc; ++i)
@@ -25,9 +26,10 @@ const char *handle_args(int argc, char **argv) {
2526
cont = true;
2627
auto current_path = fs::current_path();
2728
if (fs::exists(current_path / "CMakeLists.txt") && cont == false) {
28-
std::cout << "A CMakeLists.txt file already exists in the current directory.\nWould you "
29-
"like to overwrite it?[y/n]"
30-
<< std::endl;
29+
std::cout
30+
<< "A CMakeLists.txt file already exists in the current directory.\nWould you "
31+
"like to overwrite it?[y/n]"
32+
<< std::endl;
3133
std::string resp;
3234
std::cin >> resp;
3335
if (resp != "y")
@@ -68,7 +70,8 @@ const char *handle_args(int argc, char **argv) {
6870
return "Unknown argument!";
6971
}
7072
}
71-
} // namespace cmkr::args
73+
} // namespace args
74+
} // namespace cmkr
7275

7376
const char *cmkr_args_handle_args(int argc, char **argv) {
7477
try {

src/build.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
#include <stdlib.h>
1111
#include <system_error>
1212

13-
namespace cmkr::build {
13+
namespace cmkr {
14+
namespace build {
1415

1516
int run(int argc, char **argv) {
1617
cmake::CMake cmake(".", true);
@@ -63,8 +64,8 @@ int install() {
6364
auto cmd = "cmake --install " + cmake.bin_dir;
6465
return ::system(cmd.c_str());
6566
}
66-
67-
} // namespace cmkr::build
67+
} // namespace build
68+
} // namespace cmkr
6869

6970
int cmkr_build_run(int argc, char **argv) {
7071
try {

src/cmake.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
#include <stdexcept>
55
#include <toml.hpp>
66

7-
namespace cmkr::cmake {
7+
namespace cmkr {
8+
namespace cmake {
89

910
namespace detail {
1011
std::vector<std::string> to_string_vec(
@@ -233,4 +234,5 @@ CMake::CMake(const std::string &path, bool build) {
233234
}
234235
}
235236
}
236-
} // namespace cmkr::cmake
237+
} // namespace cmake
238+
} // namespace cmkr

src/cmake.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
#include <string>
66
#include <vector>
77

8-
namespace cmkr::cmake {
8+
namespace cmkr {
9+
namespace cmake {
910

1011
namespace detail {
1112
template <typename T, typename O>
@@ -106,4 +107,5 @@ struct CMake {
106107
CMake(const std::string &path, bool build);
107108
};
108109

109-
} // namespace cmkr::cmake
110+
} // namespace cmake
111+
} // namespace cmkr

src/error.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@
22

33
#include <assert.h>
44

5-
namespace cmkr::error {
5+
namespace cmkr {
6+
namespace error {
67

78
Status::Status(Code ec) noexcept : ec_(ec) {}
89

910
Status::operator int() const noexcept { return static_cast<int>(ec_); }
1011

1112
Status::Code Status::code() const noexcept { return ec_; }
1213

13-
} // namespace cmkr::error
14+
} // namespace error
15+
} // namespace cmkr
1416

1517
const char *err_string[] = {
1618
"Success", "Runtime error", "Initialization error", "CMake generation error", "Build error",

0 commit comments

Comments
 (0)