Git Product home page Git Product logo

poac's Introduction

logo-white logo-black

GitHub Release Version GitHub License FOSSA Status DOI codecov Codacy Badge CodeFactor

Description

Poac (pronounced as /pəʊək/) is a package manager for C++ users.

Poac can download project's dependencies and compile a project. Please visit poac.pm and The Poac Book for more details.

Demo

By using Poac, you can create a C++ project, build sources, and execute an application:

demo

Usage

Start a new project with Poac

Use this command when you start a new poac project.

you:~$ poac create hello_world
     Created binary (application) `hello_world` package

Note: If you want to integrate your existing project with Poac, use the init command:

you:~/your-pj$ poac init
     Created binary (application) `your-pj` package

This command just creates a poac.toml file not to break your project.

Build the project

In most cases, you will want to execute a binary as well as build the project—of course, you can.

you:~/hello_world$ poac run
   Compiling 1/1: hello_world v0.1.0 (/Users/poac/hello_world)
    Finished debug target(s) in 0.90s
     Running `/Users/poac/hello_world/poac_output/debug/hoge`
Hello, world!

Should you just build it, run the build command:

you:~/hello_world$ poac build
    Finished debug target(s) in 0.21s

Poac uses a cache since we executed the command with no changes.

Install dependencies

Like Cargo for Rust does, Poac installs dependencies at build time. However, Poac does not support weired version specifiers, such as ~ and ^. You can specify dependencies like:

poac.toml

[dependencies]
"boost/bind" = ">=1.64.0 and <2.0.0"

We regularly avoid auto updating packages to major versions which bring breaking changes, but minor and patch are acceptable.

Note: If you would use a specific version, you can write the version as following:

[dependencies]
"boost/bind" = "1.66.0"

After editing poac.toml, executing the build command will install the package and its dependencies.

you:~/hello_world$ poac build
   Resolving dependencies ...
 Downloading packages ...
  Downloaded boost/bind v1.66.0
  Downloaded boost/core v1.66.0
  Downloaded boost/assert v1.66.0
  Downloaded boost/config v1.66.0
   Compiling 1/1: hello_world v0.1.0 (/Users/poac/hello_world)
    Finished debug target(s) in 0.70s

To use this dependency, update the main.cpp file.

src/main.cpp

#include <iostream>
#include <boost/bind.hpp>

int f(int a, int b) {
  return a + b;
}

int main(int argc, char** argv) {
  std::cout << boost::bind(f, 5, _1)(10) << std::endl;
}

You can now run this source code:

you:~/hello_world$ poac run
   Compiling 1/1: hello_world v0.1.0 (/Users/poac/hello_world)
    Finished debug target(s) in 0.50s
     Running `/Users/poac/hello_world/poac_output/debug/hello_world`
15

Warning: We currently support building a project with header-only dependencies. Building with build-required dependencies will be soon supported.

Create a dependency graph

You can create a dependency graph by using the graph command:

you:~/hello_world$ poac graph -o out.png
   Generated out.png

Dependency Graph

Or you can export the graph as a .dot file:

you:~/hello_world$ poac graph -o out.dot
   Generated out.dot
digraph G {
0[label="boost/bind: 1.66.0"];
1[label="boost/config: 1.66.0"];
2[label="boost/core: 1.66.0"];
3[label="boost/assert: 1.66.0"];
0->2 ;
0->1 ;
2->3 ;
2->1 ;
3->1 ;
}

Note: When you want to export the graph as a .png file, please ensure graphviz is installed.

If you omit specifying the output path, then Poac emits the graph to standard output:

you:~/hello_world$ poac graph
boost/bind -> boost/core
boost/bind -> boost/config
boost/core -> boost/assert
boost/core -> boost/config
boost/assert -> boost/config

Run linter

Linting source code is essential to protect its quality. Poac supports linting it by a simple command with cpplint:

you:~/hello_world$ poac lint
     Linting poac
src/main.cpp:0:  No copyright message found.  You should have a line: "Copyright [year] <Copyright Owner>"  [legal/copyright] [5]
Done processing src/main.cpp
Total errors found: 1

Error: `cpplint` completed with exit code 1

Note: If you do not have cpplint, install it with the following command:

$ pip install cpplint

The lint command works without configurations, and Poac would automatically opt out of unwanted lints by adjusting to each project. To customize the lint settings, try creating a CPPLINT.cfg file to the repository root.

Run formatter

Poac also supports formatting your source code with clang-format. Ensure having installed clang-format before running this command.

you:~/hello_world$ poac fmt
  Formatting poac

Note: This command automatically detects what files we need to format to avoid bothering commands like:

$ # We need to avoid the `build` dir and such dirs ...
$ clang-format ./src/*.cpp -i
$ clang-format ./include/**/*.hpp -i
$ clang-format ./tests/**/*.cpp -i
$ ...

To customize the format settings, try creating a .clang-format file to the repository root.

Search packages

In case you would find what packages are provided, you can use the search command or visit poac.pm.

$ poac search func
boost/function = "1.66.0"               # Boost.org function module
boost/function_types = "1.66.0"         # Boost.org function_types module
boost/functional = "1.66.0"             # Boost.org functional module

Publish packages

WIP

Roadmap

Poac is still under development and may contain a bunch of bugs.

Feature Status
Install dependencies
Build packages with header-only dependencies
Support dev-dependencies
Build packages separated by headers & implementations
Publish packages WIP
Build packages with build-required dependencies
Build packages with CMake

Supported Operating Systems

Linux macOS
GitHub Actions Linux Build GitHub Actions macOS Build

Installation

Since packages through these providers may not be maintained by Poac owners, install them at your own risk.

Packaging status

Via Homebrew

brew install poac

Via MacPorts

sudo port install poac

Arch Linux

poac, poac-devel-git, and poac-git

pacman -S poac

Build from source

Should your environment is not listed on released packages, you will need to build Poac from source. Poac requires the following compilers, tools, and libraries to build:

compilers

  • Compilers which support C++20
    • GCC: 11 or later
    • Clang: 12 or later
    • Apple Clang: provided by macOS Big Sur (11) or later

tools

libraries

  • boost: 1.70.0 or later
    • algorithm
    • asio
    • beast
    • container_hash
    • dynamic_bitset
    • graph
    • predef
    • preprocessor
    • property_tree
    • range
    • regex
    • scope_exit
    • uuid
  • openssl: 3.0.0 or later
    • some SHA256 functions are marked as deprecated since 3.0.0

Note: The following libraries will be automatically installed when configuring with CMake, so generally, you do not need to care about them. (click here to see additional dependencies)


dependencies

dev-dependencies


After you prepared these requirements, you can build Poac using the following commands:

$ git clone https://github.com/poacpm/poac.git
$ cd poac
$ cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
$ cd build
$ ninja
$ ninja install

If you want to use dependencies installed on local, pass -DCPM_USE_LOCAL_PACKAGES=ON as the cmake command options.

Why Poac?

C++ is often considered to be a complicated language and shunned unconsciously by most people. It is thought that it is hard to construct a C++ environment, no definitive package manager, and the strange syntax of build systems such as CMake make us feel hesitant.

By developing a package manager and build system, which have an intuitively easy-to-use interface like npm and Cargo and make users be able to develop applications and libraries without being aware of CMake, developers will be able to focus on learning C++ without stumbling. I also plan to implement integration with many other build systems and package managers so that you can seamlessly switch a development environment.

Naming Background

Poac is originated from cpp but also designed to emphasize ease of typing and avoiding the burden being placed on only one hand as Poac will be entered many times as a command. The ergonomically optimized name prevents you from leading to tenosynovitis.

ergo

As I mentioned above, C++ is often avoided being selected for product development; however, I would like to disseminate C++ as a fun language through Poac. Amemiya and Mizutani argue that the /p/ sound gives the brightest and softest impression among Japanese consonants (157).1 Accordingly, I believe Poac would likewise provide a bright and soft impression.

Contributing

Source Code Documentation

A source code documentation for Poac is generated by Doxygen every commit to the main branch:

https://dev.poac.pm

Linter

$ cpplint --quiet --recursive .

Note: If you have installed Poac, you can just run the lint command:

$ poac lint

Formatter

$ clang-format ./include/**/*.hpp -i

Note: If you have installed Poac, you can just run the fmt command:

$ poac fmt

These are also done when pre-pushing changes in .githooks/pre-push. In case you would skip these hooks, use the --no-verify option.

Please see CONTRIBUTING.md for more details.


This project exists thanks to all the people who contribute.

License

Poac is licensed under the terms of the Apache License version 2.0.

Please see LICENSE for details.

FOSSA Status

Third-party software

Footnotes

  1. Amemiya, T., & Mizutani, S. (2006). On the Basic Affective Dimensions of Japanese Onomatopoeia and the Basic Level of Japanese Phonesthemes. 関西大学社会学部紀要, 37(2), 139–166. https://hdl.handle.net/10112/12311

poac's People

Contributors

ken-matsui avatar dependabot[bot] avatar wx257osn2 avatar 4ge32 avatar mattn avatar hsjoihs avatar 0xflotus avatar potsbo avatar fossabot avatar takagiy avatar

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.