git clone https://github.com/cy20lin/cpac
./cpac/install.sh /install/prefix
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 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
cpac {--repo} <package(s)>
For example,
cpac --repo fmt dlib
Shows,
https://github.com/fmtlib/fmt
https://github.com/davisking/dlib
cpac {--packages}
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
,
cpac
is licensed under the MIT License.