Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
Config.h
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-3-Clause
2// Copyright 2024-2026, Amlal El Mahrouss (amlal@nekernel.org)
3// Licensed under the Apache License, Version 2.0 (see LICENSE file)
4// Official repository: https://github.com/ne-app-eu/bld
5
6#pragma once
7
11
12#include <rang/rang.h>
13#include <cassert>
14#include <iostream>
15
16#define NEBUILD_VERSION "v1.0.0-buildkit"
17
18#define NEBUILD_VERSION_BCD 0x1000
19
20#define NEBUILD_VERSION_MAJOR 0
21#define NEBUILD_VERSION_MINOR 0
22#define NEBUILD_VERSION_PATCH 9
23
24#define NEBUILD_EXPORT_C extern "C"
25
26#define NEBUILD_UNUSED(X) ((void) X)
27
28#define b_internal private
29
30#ifdef NEBUILD_INTERNAL_SDK
31#undef b_internal
32#define b_internal public
33#endif
34
35namespace BldKit {
36
37struct BuildConfig final {
38 b_internal : bool has_failed_{false};
39 bool dry_run_{false};
40 std::string path_{};
41
42 public:
43 explicit operator bool() { return has_failed_; }
44
45 bool dry_run() { return dry_run_; }
46 void dry_run(const bool& dr) { dry_run_ = dr; }
47
48 bool has_failed() { return has_failed_; }
49 void has_failed(const bool& dr) { has_failed_ = dr; }
50
51 const std::string& path() { return path_; }
52 void path(const std::string& path) { path_ = path; }
53
54 BuildConfig() = default;
55 ~BuildConfig() = default;
56
57 BuildConfig& operator=(const BuildConfig&) = default;
58 BuildConfig(const BuildConfig&) = default;
59
60};
61
62} // namespace BldKit
63
65namespace BldKit::Logger {
66
69inline std::ostream& info() noexcept {
70 auto& out = std::cout;
71 out << rang::fg::red << "nebld: " << rang::style::reset;
72 return out;
73}
74
75} // namespace BldKit::Logger
const int out
#define b_internal
Definition Config.h:28
A TOML path.
Definition path.hpp:209
Logger namespace.
Definition Config.h:65
std::ostream & info() noexcept
replacement for std::cout for NeBuild logging.
Definition Config.h:69
#define bool
Definition stdbool.h:24
const std::string & path()
Definition Config.h:51
void has_failed(const bool &dr)
Definition Config.h:49
BuildConfig(const BuildConfig &)=default
BuildConfig & operator=(const BuildConfig &)=default
void path(const std::string &path)
Definition Config.h:52
std::string path_
Definition Config.h:40
bool has_failed()
Definition Config.h:48
void dry_run(const bool &dr)
Definition Config.h:46
~BuildConfig()=default