Skip to content

cy20lin/cpac

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cpac – C/C++ package retrieval

Setup

download

git clone https://github.com/cy20lin/cpac

install

./cpac/install.sh /install/prefix

Quick start

Sync packages

With -S option, cpac will auto download, configure, build, test and install those packages specified.

cpac {-S --sync} <package(s)> [-- <cmake_configure_option(s)>]

Where,

<package> :=
    <package_name>[,<package_repo>][@[git_branch]] |
    <package_repo>[@[git_branch]]

For example,

# install 'fmt' and 'dlib'
cpac -S fmt dlib

# install package with custom cmake_configure_option(s)
cpac -S fmt -- -GNinja -DCMAKE_INSTALL_PREFIX=/usr/local

# install package using repo url
cpac -S https://github.com/fmtlib/fmt -- -GNinja -DCMAKE_INSTALL_PREFIX=/usr/local

# install package with tag specified
cpac -S fmt@3.0.0 -- -GNinja -DCMAKE_INSTALL_PREFIX=/usr/local

Download a package

Download specific package to (optional) path

cpac {--download} <package> [path]

For example,

cpac --download fmt
# works the same as
cpac --download https://github.com/fmtlib/fmt
git clone https://github.com/fmtlib/fmt

Get list of repos corresponding to packages

cpac {--repo} <package(s)>

For example,

cpac --repo fmt dlib

Shows,

https://github.com/fmtlib/fmt
https://github.com/davisking/dlib

Get list of supported packages

cpac {--packages}

Customize

You can customize cpac by providing a custom ~/.cpac.d/init.sh. For example,

# loading predefined default init procedure
cpac_load_default_init

# loading custom package metadata
cpac_load_package_metadata ~/.cpac.d/packages.yml

# use Ninja if exists
generator="$(which ninja 2>/dev/null)"
test "${generator}" && generator_flag="-GNinja"

# specify default install prefix
install_prefix_flag="-DCMAKE_INSTALL_PREFIX=/where/to/install"

# set custom arguments
CPAC_CUSTOM_CONFIGURE_ARGS="${generator_flag} ${install_prefix_flag}"
CPAC_CUSTOM_BUILD_ARGS=
CPAC_CUSTOM_TEST_ARGS=
CPAC_CUSTOM_INSTALL_ARGS=

Where ~/.cpac.d/package.yml may look like this,

dlib:
  repo: https://github.com/davisking/dlib
mylib:
  repo: https://url.to/mylib

Note that, there MUST be EXACTLY 2 space before the key repo:, due to implementation restriction, cpac can only recognize a subset of YAML,

License

cpac is licensed under the MIT License.

Releases

No releases published

Packages

No packages published

Languages