基于Python的C++构建元生成系统。

SBuildr的Python项目详细描述


sbuilder-愚蠢的构建器

一个愚蠢的、简单的基于Python的C++构建元生成系统。

安装

先决条件

  1. RBuild
    • 安装Cargo
    • 运行cargo install rbuild

从pypi安装

pip install sbuildr

从源安装

  1. 克隆sbuildersource repository
  2. 使用python setup.py install
  3. 在本地安装

一个小例子

对于本例,我们将假定以下目录结构:

minimal_project
├── build.py
├── include
│   └── math.hpp
├── src
│   ├── factorial.cpp
│   ├── factorial.hpp
│   ├── fibonacci.cpp
│   ├── fibonacci.hpp
│   └── utils.hpp
└── tests
    └── test.cpp

相应的build.py文件可能如下所示:

#!/usr/bin/env pythonimportsbuildrimportosproject=sbuildr.Project()# Build a library using two source files. Note that headers do not have to be specified manually.# Full file paths are only required in cases where a partial path would be ambiguous.libmath=project.library("math",sources=["factorial.cpp","fibonacci.cpp"],libs=["stdc++"])# Specify that math.hpp is part of the public API for this library.project.interfaces(["math.hpp"])# Specify a test for the project using the test.cpp source file. The resulting executable will# be linked against the library created above.test=project.test("test",sources=["test.cpp"],libs=["stdc++",libmath])# Enable this script to be used interactively on the command-linesbuildr.cli(project)

cli()函数的调用允许我们使用脚本在shell中交互构建。 例如,要运行为此项目注册的所有测试,可以运行:./build.py test。这将配置项目,构建所有依赖项,并最终运行测试。

要查看所有可用的命令,可以运行./build.py --help

API文档

有关详细信息,请参见API Documentation

已知限制

  • sbuilder的头扫描功能不考虑预处理器#ifdefs。这意味着在生成期间,false分支中的#include仍将用作依赖项。对于包含转义字符的路径,头扫描也将不起作用。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java Maven无法识别安装在Ubuntu外壳上的$java_HOME jdk   java如何防止可运行程序在其中一个抛出异常时执行   java Listview在按下项时不触发   如何在WindowsPhone8中使用JavaRESTWebService?   java在spring引导下使用多个dispatcher servlet/web上下文   java为什么在删除容器的绝对大小时不绘制GEF子项?   java在hibernate实体中保留DB约束是好的   JavaSpring选择最高优先级bean   ArrayList<Class>java字符串[]   有向加权边图的Java邻接表实现   字母数字字符串的java Tesseract配置:混合2、Z、6和G   如果输入为空,则带有EditText的java警报对话框将关闭   jsp上的java Struts 2动作响应   java获取IndexOutOfBundException Android   scala AWSJAVASDK:解压缩大小必须小于262144000字节