Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ clean:
@rm -rf build
@mkdir -p build

search:
grep -rnw '.' -e '$(PATTERN)'
search-src:
grep -rnw 'src/' -e '$(PATTERN)'

# Fuck it just put it in both bash and zsh rc files
install: install-rel
Expand Down
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ meta meta build system? The idea is to

Gojo is tested on MacOS and Ubuntu, and should work on any Linux distro.
<br>
<br>

# Install
## Pre-compiled Binary
Expand Down Expand Up @@ -74,25 +73,24 @@ $ gojo
"Throughout Heaven and Earth, I alone am the honored one."
```
<br>
<br>

## Build From Source
Alternatively, you can clone this repo and build gojo from source:

```console
$ git clone <insert link here>
$ git clone https://github.com/whuffman36/gojo.git
$ cd gojo
$ make install
```

Gojo requires some other dependencies that need to be installed before you can build and run it. Because each system is different, I will leave it up to you to learn how to get each dependency installed on your system:

- CMake
- Conan
- clang-tidy (optional)
- clang-format (optional)
- cppcheck (optional)
- git (optional)
- [CMake](https://cmake.org/)
- [conan](https://conan.io/)
- [clang-tidy](https://clang.llvm.org/extra/clang-tidy/) (optional)
- [clang-format](https://clang.llvm.org/docs/ClangFormat.html) (optional)
- [cppcheck](https://cppcheck.sourceforge.io/) (optional)
- [git](https://git-scm.com/) (optional)

Many of these will likely already be on your system if you are a developer. If you choose to omit the dependencies marked as optional above, gojo will still build and run but some functionality will be limited, namely the commands `gojo check` and `gojo fmt`.

Expand All @@ -104,7 +102,7 @@ Linux:
$ source ~/.bashrc
```

On MacOS (Or any system that uses zsh as the shell):
MacOS (Or any system that uses zsh as the shell):

```console
$ source ~/.zshrc
Expand Down Expand Up @@ -150,9 +148,8 @@ $ gojo
"Throughout Heaven and Earth, I alone am the honored one."
```
<br>
<br>

# Using Gojo
# Getting Started
Start a new project in your current working directory:

```console
Expand All @@ -177,13 +174,16 @@ as well as seeing all of the subcommands, arguemnts, and options for any command
$ gojo <command> --help
```

Finally, you can read about all of the project settings available in the gojo.toml config file with
If you are new to C or C++, or you just want to learn about the gojo.toml config file, you can use a template to specify every available field:

```console
$ gojo info
$ gojo init <name>
...
$ cd <name>
$ gojo info > gojo.toml
```

<br>
The template contains comments to explain each field along with all possible values, providing useful links to learning resources for the underlying tools that make up gojo.
<br>

# Contributing
Expand Down
4 changes: 4 additions & 0 deletions src/build_systems/cmake.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/// @author William Huffman (whuffman36)
/// @date 2026
/// @copyright MIT License

#include "src/build_systems/cmake.hpp"

#include <chrono>
Expand Down
8 changes: 0 additions & 8 deletions src/build_systems/cmake.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/// @file src/cmake.hpp
/// @brief Functionality for configuring and building a CMake project.
/// @author William Huffman (whuffman36)
/// @date 2026
/// @copyright MIT License
Expand All @@ -19,12 +17,6 @@ void build(const cfg::Config& cfg, std::string_view target, bool verbose);

void test(const cfg::Config& cfg, std::string_view target);

consteval std::string_view get_version() {
// Version 3.31.6 is the default version of cmake on github actions.
// Most recent version (July 2026): 4.3.4
return "3.28...4.3.4";
}

} // namespace cmake

#endif
7 changes: 7 additions & 0 deletions src/cfg/config.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/// @author William Huffman (whuffman36)
/// @date 2026
/// @copyright MIT License

#include "src/cfg/config.hpp"

#include <cstddef>
Expand Down Expand Up @@ -707,6 +711,9 @@ void Config::to_file(const std::filesystem::path& file) const {
// I want the tables to have a specific order in the file so I have to print
// it manually.
// NOLINTBEGIN(cppcoreguidelines-pro-bounds-avoid-unchecked-container-access)
cfg_stream
<< "# Gojo CLI - See https://github.com/whuffman36/gojo for more\n"
<< "# Run 'gojo info' to see a tutorial\n\n";
cfg_stream << '[' << PROJECT << "]\n" << table[PROJECT] << "\n";
if (!table[BUILD].as_table()->empty()) {
cfg_stream << "\n[" << BUILD << "]\n" << table[BUILD] << "\n";
Expand Down
3 changes: 0 additions & 3 deletions src/cfg/config.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/// @file src/config.hpp
/// @brief Functionality for creating, reading, and writing gojo config
/// files and gojo profiles.
/// @author William Huffman (whuffman36)
/// @date 2026
/// @copyright MIT License
Expand Down
4 changes: 4 additions & 0 deletions src/cfg/enums.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/// @author William Huffman (whuffman36)
/// @date 2026
/// @copyright MIT License

#include "src/cfg/enums.hpp"

#include <cstdint>
Expand Down
4 changes: 4 additions & 0 deletions src/cfg/enums.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/// @author William Huffman (whuffman36)
/// @date 2026
/// @copyright MIT License

#ifndef GOJO_SRC_CFG_ENUMS_HPP
#define GOJO_SRC_CFG_ENUMS_HPP

Expand Down
61 changes: 26 additions & 35 deletions src/cmd/build.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/// @author William Huffman (whuffman36)
/// @date 2026
/// @copyright MIT License

#include <cstddef>
#include <filesystem>
#include <format>
Expand All @@ -16,45 +20,32 @@ namespace {

constexpr std::string_view HELP {
R"({1}Command:{0}
gojo {2}build{0} {3}[options]{0}
gojo {2}build{0} [options]

{1}Summary:{0}
Compile the project. By default, all targets are built in debug mode using
the compiler flags set in the .gojo config file located at the root of the
project.
Compile the project using the settings defined in the gojo.toml config
file. Some settings can be set or overridden from the command line, such
as the build type and whether or not tests are compiled. This command
detects if the project needs to be reconfigured before compiling.

{1}Options:{0}
{3}--release{0} Compile the project with all compiler optimizations
enabled, namely -03. If the project is currently set
to debug mode, it will be reconfigured before
compilation. If the project is already in release mode,
this option has no effect. No debug symbol information
is kept when compiled in release mode, unless
overidden with specific compiler flags set in the
.gojo config file of the project.

{3}--debug{0} Compile the project with debug symbols and zero
compiler optimizations enabled. If the project is
currently set to release mode, it will be reconfigured
before compilation. If the project is already in debug
mode, this option has no effect.

{3}--tests{0} Enable testing in the project and compile unit tests
along with the source code. If the project currently
does not have testing enabled, it will be reconfigured
before compilation. If the project already has testing
enabled, this option has no effect.

{3}--no-tests{0} Disable testing in the project and omit unit tests from
the compilation process. If the project currently has
testing enabled, it will be reconfigured before
compilation. If the project currently does not have
testing enabled, this option has no effect.

{3}--clean{0} Clean the build artifacts and caches before compilation.

{3}--target=<target>{0} Compile only a specific target instead of the whole
project.
--release Compile the project and any dependencies with all
compiler optimizations enabled.

--debug Compile the project and anydependencies with debug
symbols and zero compiler optimizations enabled.

--tests Enable testing in the project and compile unit tests
along with the source code.

--no-tests Disable testing in the project and omit unit tests from
the compilation process.

--verbose, -v Allow the output from the build system to be forwarded
to standard output.

--target=<target> Compile only a specific target instead of the whole
project.
)"
};

Expand Down
47 changes: 29 additions & 18 deletions src/cmd/check.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/// @author William Huffman (whuffman36)
/// @date 2026
/// @copyright MIT License

#include <filesystem>
#include <format>
#include <span>
Expand All @@ -14,28 +18,35 @@ namespace {

constexpr std::string_view HELP {
R"({1}Command:{0}
gojo {2}check{0} {3}[options]{0}
gojo {2}check{0} [options]

{1}Summary:{0}
Run static analysis checks on the code without building the project. There
are two programs used to run static analysis checks, clang-tidy and
cppcheck. Both can be enabled or disabled in the .gojo config file located
at the root of the project. If neither program is enabled, this command has
no effect. clang-tidy can be configured with the .clang-tidy file located
at the root of the project, created by 'gojo init' if enabled. Additionally,
command line arguments can be supplied in the .gojo config file at the root
of the project using the 'clang-tidy arguments' field, which will take
precedence over the .clang-tidy file. More information on clang-tidy can be
found here: {3}https://clang.llvm.org/extra/clang-tidy/{0}
cppcheck can be configured in the .gojo config file located in the root of
the project using the 'cppcheck checks enabled' and 'cppcheck arguments'
fields. The former decides which checks will be run and the latter is used
to pass any command line options to cppcheck. More information on cppcheck
can be found here: {3}https://cppcheck.sourceforge.io/manual.html{0}
Check the source code with static analysis tools. The static analysis
tools used are:

- clang-tidy
- cppcheck

These tools can be enabled, disabled, and tuned to custom workflows
with several settings in the gojo.toml config file. For clang-tidy,
the field checks.clang_tidy_enabled decides if the tool is used at all.
Arguments can be passed to clang-tidy with the field
checks.clang_tidy_args, which is an array of strings. More about clang-tidy
can be found here: {3}https://clang.llvm.org/extra/clang-tidy/{0}

cppcheck can be enabled with the field checks.cppcheck_enabled. The field
checks.cppcheck_checks is an array of strings where each entry is a "check"
that is enabled in cppcheck. checks.cppcheck_args is an array where each
entry is passed to cppcheck as an argument. To learn more about cppcheck
checks and arguments, go here:
{3}https://cppcheck.sourceforge.io/manual.html{0}

By default, no static analysis checks are enabled. This comand has no
effect if no checks are enabled.

{1}Options:{0}
{3}--verbose | -v{0} Print all output from the static analyzers enabled
in the project. By default, only errors are printed.
--verbose, -v Allow the output from the static analyzers to be
forwarded to standard output.
)"
};

Expand Down
18 changes: 9 additions & 9 deletions src/cmd/clean.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/// @author William Huffman (whuffman36)
/// @date 2026
/// @copyright MIT License

#include <filesystem>
#include <format>
#include <span>
Expand All @@ -12,19 +16,15 @@ namespace {

constexpr std::string_view HELP {
R"({1}Command:{0}
gojo {2}clean{0} {3}[options]{0}
gojo {2}clean{0} [options]

{1}Summary:{0}
Remove build artifacts and/or caches.
Remove build directory and optionally any built dependencies.

{1}Options:{0}
{3}--deep{0} Remove all build artifacts and caches from the,
project, while keeping dependencies intact.

{3}--all{0} Remove everything from the build directory, including
dependencies. Use this option with caution as it
requires dependencies to be reinstalled and rebuilt,
and the project has to be re-configured.
--deps Remove the built dependencies from the project
from the project directory as well as the build
directory.
)"
};

Expand Down
2 changes: 0 additions & 2 deletions src/cmd/commands.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/// @file src/commands.hpp
/// @brief All the commands available to the user of the gojo CLI API.
/// @author William Huffman (whuffman36)
/// @date 2026
/// @copyright MIT License
Expand Down
Loading
Loading