一个小型C/C++ Builder

bbee的Python项目详细描述


bbee

非常简单的C-C++Builder

我写了这个小脚本来帮助我用C或C++代码。

它基本上对源代码进行爬网,编译对象并将其链接到可执行二进制文件或静态库。(我喜欢静态库)

有时我不想花时间编写makefile脚本

因此,在向ppl发送一些示例代码时,我包括了这个。

这有一个小小的约定,只要你遵守约定,事情就会成功地建立起来。

请注意,我没有为大而复杂的项目写这个小脚本,如果你打算写复杂的东西,请坚持使用cmake或autotools。

除此之外,此脚本还可以为您完成工作;

快速启动

简单地运行下面的命令来创建一个空的c项目。这将创建一个空目录树,其中包含includes、build和source目录以及已经配置的capul.json文件。您可以在源目录中创建main.c,然后从调用bbee命令开始编译和运行。

bbee --create

或运行下面的命令创建一个空C++项目

bbee --create++

参数:

Field NameOptionTypeDescriptionExample
namestrName of the project"sample"
builderstrBuilder command"gcc" or "/usr/bin/gcc-7"
sourceslistList of sources (directory or files)["./source", "main.c"]
includeslistList of includes (dir or files)["./include", "/usr/local/includes"]
librarieslistList of libraries to link["pthread", "GL", "m"]
frameworkslistList of frameworks to link (MacOS)["OpenGL", "GLUT"]
library_search_pathslistList of library directories["./libs", "/usr/local/lib"]
outputlibrary / binarystrOutput format, binary exec. or a lib"binary"
output_dirstrWhere to put the output file(s)"build"
output_namestrOutput file name"hello_world" or "libmylib.a"
cflagsstrgcc extra flags"-std=gnu99 -Wall -Werror -O3 -g"
debugtrue / falseboolBBee Debug Mode on / offfalse
source_extensionstrExtension to crawl for compiling".c"
run_after_buildboolRun the binary output file afterfalse
installlistList of installation directivesSee below at "how to make install"

如何进行安装

创建安装指令非常简单,只需告诉要复制的内容和复制的位置。

如果目标目录名以开头!然后将使用“mkdir-p”命令创建它

# This example will copy build/hello_world to /usr/local/bin
[
    ["build/hello_world", "/usr/local/bin"]
]


# This example will try to copy build/hello_world to first directory it can verify
# if the directory does not exists, it will try the next directory in the list
[
    ["build/hello_world", ["/usr/local/bin", "/usr/bin"]]
]


# This will copy the headers include folder to includes and copy the library to libs
[
    ["./includes", "!/usr/local/includes/mylib"],
    ["build/libmylib.a", ["/usr/local/lib", "/usr/lib"]]
]

下面是capul.json文件示例

{
    "name": "Hello World",
    "builder": "gcc",
    "sources": [
        "./src"
    ],
    "includes": [
        "./include"
    ],
    "libraries": [
        "pthread"
    ],
    "library_search_paths": [
        "/usr/local/lib"
    ],
    "frameworks": [
        "OpenGL",
        "GLUT"
    ],
    "output": "binary",
    "output_dir": "build",
    "output_name": "hello_world",
    "cflags": "",
    "debug": true,
    "source_extension": ".c",
    "run_after_build": False
}

注意:只有“源”、“输出”字段是必需的,其他字段是可选的。

如果您想参与,请将代码保存为单个文件,pep8应无错误或警告地传递 是的。

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

推荐PyPI第三方库


热门话题
如何在JavaEE中隔离用户会话?   java什么是CacheManager的替代方法。集合名(字符串名)   当am通过==运算符比较对象时,java sop命令未打印附加文本为什么?   java如何关闭一个gui的一个窗口,该窗口有两个打开的窗口,而不同时关闭这两个窗口?   java如何在socket回调中使用观察器?   java在自定义soap处理程序中是否有一种获得操作名的保证方法?   正则表达式Java解析字符串   java希望从其他方法检索RGB像素值,但无法检索   java如何在Android RecyclerView中循环浏览项目?   java tomcat 8上的主机中的软件中止了已建立的连接   java Apache CXF3。具有可靠消息传递的0.4 Soap web服务引发异常   Java与Hibernate数据库   使用put存储新的键值对时,现有键的java Hashmap值将被覆盖。如何预防?   并非所有unix shell的java命令都在运行   java根据元素的自然顺序对列表进行排序   基于值的java同步方法评估   java如何使用axis2 java2wsdl创建标头?   铸造如何阻止java舍入   java计数休眠和命名查询