本文档翻译自:https://docs.conan.io/en/latest/reference/commands/creator/new.html
$ conan new [-h] [-t] [-i] [-c] [-s] [-b] [-m TEMPLATE] [-cis] [-cilg]
[-cilc] [-cio] [-ciw] [-ciglg] [-ciglc] [-ciccg] [-ciccc]
[-cicco] [-gi] [-ciu CI_UPLOAD_URL]
name
使用“ conanfile.py”和可选的“ test_package”测试文件创建一个新的包装配方模板。
positional arguments:
name Package name, e.g.: "poco/1.9.4" or complete reference
for CI scripts: "poco/1.9.4@user/channel"
optional arguments:
-h, --help show this help message and exit
-t, --test Create test_package skeleton to test package
-i, --header Create a headers only package template
-c, --pure-c Create a C language package only package, deleting
"self.settings.compiler.libcxx" setting in the
configure method
-s, --sources Create a package with embedded sources in "src"
folder, using "exports_sources" instead of retrieving
external code with the "source()" method
-b, --bare Create the minimum package recipe, without build()
method. Useful in combination with "export-pkg"
command
-m TEMPLATE, --template TEMPLATE
Use the given template from the local cache for
conanfile.py
-cis, --ci-shared Package will have a "shared" option to be used in CI
-cilg, --ci-travis-gcc
Generate travis-ci files for linux gcc
-cilc, --ci-travis-clang
Generate travis-ci files for linux clang
-cio, --ci-travis-osx
Generate travis-ci files for OSX apple-clang
-ciw, --ci-appveyor-win
Generate appveyor files for Appveyor Visual Studio
-ciglg, --ci-gitlab-gcc
Generate GitLab files for linux gcc
-ciglc, --ci-gitlab-clang
Generate GitLab files for linux clang
-ciccg, --ci-circleci-gcc
Generate CircleCI files for linux gcc
-ciccc, --ci-circleci-clang
Generate CircleCI files for linux clang
-cicco, --ci-circleci-osx
Generate CircleCI files for OSX apple-clang
-gi, --gitignore Generate a .gitignore with the known patterns to
excluded
-ciu CI_UPLOAD_URL, --ci-upload-url CI_UPLOAD_URL
Define URL of the repository to upload
Examples:
为新软件包mypackage/1.0@myuser/stable创建一个新的conanfile.py
$ conan new mypackage/1.0
还创建一个test_package文件夹框架:
$ conan new mypackage/1.0 -t
为travis(Linux和OSX)和Appveyor持续集成创建文件:
$ conan new mypackage/1.0@myuser/stable -t -cilg -cio -ciw
为gitlab创建文件(linux)持续集成并设置上载柯南服务器:
$ conan new mypackage/1.0@myuser/stable -t -ciglg -ciglc -ciu https://api.bintray.com/conan/myuser/myrepo
从自定义,预定义的用户模板配方或模板目录创建文件:
$ conan new mypackage/1.0 --template=myconanfile.py # Single template file
$ conan new mypackage/1.0 --template=header_only # Template directory
有关这些模板的更多信息,请参阅“ conan new命令的封装脚手架”部分。