abuild 命令行工程编译

abuild 命令行工程编译

使用vscode+abuild开发c/c++程序是,我们图形化界面开发比较方便编码、编译、调试,但是在命令行下编译工程时,我们需要使用abuild命令行工具。

abuild命令行工具采用源码提供,git仓库地址:https://github.com/Y2603012723/abuild-command

同步仓库,其本身也是一个abuild创建的c++工程,我们直接使用abuild编译按钮"Build"进行编译即可,编译后我们得到可执行文件。

bash 复制代码
yk@yk-vm:~/GIT/abuild/abuildCommand/abuildCommandDebug$ pwd
/home/yk/GIT/abuild/abuildCommand/abuildCommandDebug
yk@yk-vm:~/GIT/abuild/abuildCommand/abuildCommandDebug$ ls
AbuildCompiler.cpp.d  AbuildCompiler.cpp.o  abuild-yk  doc  include  main.cpp.d  main.cpp.o
yk@yk-vm:~/GIT/abuild/abuildCommand/abuildCommandDebug$

abuild-yk就是我们编译出来的可用于命令行编译工程的可执行文件,我们可以把它放到环境变量中,方便使用。

使用方法就是 "abuild-yk 工程目录",就可以编译工程了,输出目录与图形化的abuild是一致的。

示例:

bash 复制代码
yk@yk-vm:~/GIT/abuild/abuildCommand/abuildCommandDebug$ ./abuild-yk /home/yk/GIT/rcfRepository/code/binitCode
=== Compiler Config ===
C Compiler: arm-linux-gnueabihf-gcc
C++ Compiler: arm-linux-gnueabihf-g++
Build Variant: Debug
Output Type: Executable file
=======================

=== Project Config ===
Project Name: binit
Project Version: 0.0.1
Debug Flags: -g -O0 -fPIC -Wall -Wextra -pedantic
Release Flags: -O3 -fPIC -DNDEBUG
C++ Debug Flags: -g -O0 -fPIC -Wall -Wextra -pedantic -std=c++11
C++ Release Flags: -O3 -fPIC -DNDEBUG -std=c++11
Linker Flags: 
Auto Header Include: true
Include Paths: 
Library Paths: /home/libraryPath1, /home/libraryPath2
Library Names: crypt, pthread
Static Libraries: 
Pack Paths: configs
Ignored Header Files: 
Macro Args: -DMACRO_NAME=1, -DENABLE_XX=1
=================

----------------------------------------------
---------------make build start---------------
----------------------------------------------

省略......

/CoreMechanism/source/AUdpSocket.cpp.o ./binitCodeDebug/CoreMechanism/source/AUTimer.cpp.o ./binitCodeDebug/CoreMechanism/source/spdlogCustom/time_rotating_file_sink_mt.cpp.o ./binitCodeDebug/CoreMechanism/source/generalTools/IdPool.cpp.o  -L/home/libraryPath1 -L/home/libraryPath2 -lcrypt -lpthread -o binitCodeDebug/binit
----------------------------------------------
---------------make build end-----------------
----------------------------------------------
----------------------------------------------
------------------pack start-----------------
----------------------------------------------
out_dir: /home/yk/GIT/rcfRepository/code/binitCode/binitCodeDebug
work_dir: /home/yk/GIT/rcfRepository/code/binitCode
project_name: binit
binit
----------------------------------------------
------------------pack end--------------------
----------------------------------------------

/home/yk/GIT/rcfRepository/code/binitCode是我的abuild-c++工程目录。