Giter Club home page Giter Club logo

mozi's Introduction

Mozi

The Name

Mozi was a renowned Chinese philosopher and craftsman, and his name sounds very good for a programming project.

While it is OK to pronounce “Mozi” in any way you like (the proper Chinese pronunciation is probably too difficult for most of the English-speaking community), my preferred English pronunciation is “MO-tsee” (/ˈməʊtsiː/).

The Project

This project serves as a continuation and successor to my previous C++ utility project, Nvwa, which is showing its age. However, I do not want to make dramatic changes to its code and break backward compatibility, so a new project is more appropriate for new stuff.

In creating Mozi, I am also taking this opportunity to leave behind some bad habits, such as the use of prefix-less macros and reserved identifiers (e.g. _NOTHREADS and _M_line). Overall, Mozi will have a more modern style.

Base C++ Standard

This project primarily uses the C++17 standard. I need string_views, fold expressions, inline variables, and constexpr if statements. They are necessary for code readability and performance.

Where appropriate, support for newer C++ standards is added.

Contents

Mozi is supposed to evolve over time. Initially, manual static reflection for enums and structs is included, as well as macros that are necessary in such code generation usage. More will be coming later.

Test Code

The test code serves the purpose of both verifying and demonstrating the functionalities of Mozi. It is the only thing that requires building.

In order to build the test, you need to have CMake and Catch2 v3.

Prerequisite: CMake

You need to have CMake 3.10 or later. Standard CMake installations should usually do.

Prerequisite: Catch2 v3

You need to have Catch2 v3, while many Linux distros only come with v2. You probably need to follow the standard build and installation procedure on such distros:

cd /path/to/Catch2/source
mkdir build && cd build
cmake ..
cmake --build . -j
sudo make install

I use Homebrew on macOS (brew install catch2) and vcpkg on Windows (vcpkg install catch2). They have the up-to-date Catch2 version.

Tested compilers

I mainly test with the following compilers:

  • GCC 10 and later on Linux
  • Clang 17 and Apple Clang 14 on macOS
  • MSVC as in Visual Studio 2022 on Windows

If you do not use any of these compilers and encounter a problem, you had better report the problem with a patch. I may not be able to verify and fix your problem.

Build and test

The following procedure should normally work:

cd /path/to/mozi/test
mkdir build && cd build
cmake ..
cmake --build . -j && ctest

You should then see the message “100% tests passed”.

Note to Windows users

Keep in mind that when using vcpkg you generally need to specify the path to it in the third step above, like:

cmake "-DCMAKE_TOOLCHAIN_FILE=/path/to/vcpkg/scripts/buildsystems/vcpkg.cmake" ..

mozi's People

Contributors

adah1972 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

lionxu

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.