SCons 工程文件编译

安装:

sudo apt install scons

文件目录结构:(具体文件见 https://github.com/mhsszm/test_libfacedetection )

├── facedetection
│   ├── build_install
│   ├── example
│   ├── models
│   └── src
├── images
│   ├── keliamoniz1.jpg
│   └── keliamoniz2.jpg
└── SConstruct

6 directories, 3 files

说明:build_install 里存放opencv的头文件与库
example 为示例cpp
models 为模型文件
src 为原文件
对应的SConstruct文件内容如下,

env = Environment()
env.Append(CCFLAGS = ['-march=native', '-O3'])
CPPS = [Glob('facedetection/src/*.cpp'),Glob('facedetection/example/*.cpp')]  
LIBS = ['opencv_core', 'opencv_highgui'] 
LIBPATH = ['facedetection/build-install/lib']
HEADFILEPATH = ['facedetection/src/','facedetection/build-install/include']
env.Program(target = 'test',source = CPPS, CPPPATH = HEADFILEPATH,LIBS=LIBS, LIBPATH=LIBPATH)

运行:scons
会成为可执行文件test以及中间文件.o
运行后的输出结果如下:
在这里插入图片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章