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
運行後的輸出結果如下:
在這裏插入圖片描述

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