cereal/SConstruct

87 lines
1.7 KiB
Python
Raw Normal View History

import os
Visionipc v2.0 (#101) * add visionbuf make static ignore that * Needs decleration * add test binary * c++ * create some structure * some impl * socket stuff * Accept socket connection * Alloc some buffers * Create pub sockets and send buffer id * make listener private * Implement receive * use error check macros in cl_helpers * constructors to pass in opencl context * add some convenience values in struct * refactor creating buffers * rgb is not so simple * add fake stride and expose buffers * add comment * add extra data struct * support conflate * init opencl on all buffers * make ion compile * fix qcom2 * correctly setup yuv pointers when importing buffer * also included from c * Remove send print statements * send metadata * reveive metadata * also used in c code * dont start listener automatically * Was started in 2 places * set 100ms timeout on socket * verify server id to detect reconnects * handle reconnect * buffer cleanup * let user handle opencl creation * add default values * Add support for aligned rgb buffers * add align macro * dont use namespace * use poller * apple ifdef in ipc.cc * VisionBuf is C++ class * Install opencl headers * cppcheck c++ * remove c header guard * fix mac build * simplify constructors * Update visionipc/visionipc.h Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> * Update visionipc/visionbuf_ion.cc Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> * add brackets * s/VIPCBufExtra/VisionIpcBufExtra/g * Add unittesting harness * remove vipc demo * very basic tests * add conflate test * Install opencl * suppress msgq warnings * Make it work using zmq * cl in qcom replay * run unittests in zmq mode as well * non blocking connect * always larger frame queues Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2021-01-08 21:54:41 +08:00
import platform
import subprocess
import sysconfig
2021-08-30 13:00:09 +08:00
import numpy as np
Visionipc v2.0 (#101) * add visionbuf make static ignore that * Needs decleration * add test binary * c++ * create some structure * some impl * socket stuff * Accept socket connection * Alloc some buffers * Create pub sockets and send buffer id * make listener private * Implement receive * use error check macros in cl_helpers * constructors to pass in opencl context * add some convenience values in struct * refactor creating buffers * rgb is not so simple * add fake stride and expose buffers * add comment * add extra data struct * support conflate * init opencl on all buffers * make ion compile * fix qcom2 * correctly setup yuv pointers when importing buffer * also included from c * Remove send print statements * send metadata * reveive metadata * also used in c code * dont start listener automatically * Was started in 2 places * set 100ms timeout on socket * verify server id to detect reconnects * handle reconnect * buffer cleanup * let user handle opencl creation * add default values * Add support for aligned rgb buffers * add align macro * dont use namespace * use poller * apple ifdef in ipc.cc * VisionBuf is C++ class * Install opencl headers * cppcheck c++ * remove c header guard * fix mac build * simplify constructors * Update visionipc/visionipc.h Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> * Update visionipc/visionbuf_ion.cc Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> * add brackets * s/VIPCBufExtra/VisionIpcBufExtra/g * Add unittesting harness * remove vipc demo * very basic tests * add conflate test * Install opencl * suppress msgq warnings * Make it work using zmq * cl in qcom replay * run unittests in zmq mode as well * non blocking connect * always larger frame queues Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2021-01-08 21:54:41 +08:00
arch = subprocess.check_output(["uname", "-m"], encoding='utf8').rstrip()
if platform.system() == "Darwin":
arch = "Darwin"
common = ''
cpppath = [
2023-01-01 06:19:29 +08:00
f"#/../",
'/usr/lib/include',
2021-05-03 01:34:00 +08:00
'/opt/homebrew/include',
sysconfig.get_paths()['include'],
]
2021-05-03 01:34:00 +08:00
libpath = [
'/opt/homebrew/lib',
]
AddOption('--test',
action='store_true',
help='build test files')
AddOption('--asan',
action='store_true',
help='turn on ASAN')
AddOption('--ubsan',
action='store_true',
help='turn on UBSan')
ccflags = []
ldflags = []
if GetOption('ubsan'):
flags = [
"-fsanitize=undefined",
"-fno-sanitize-recover=undefined",
]
ccflags += flags
ldflags += flags
elif GetOption('asan'):
ccflags += ["-fsanitize=address", "-fno-omit-frame-pointer"]
ldflags += ["-fsanitize=address"]
env = Environment(
ENV=os.environ,
CC='clang',
CXX='clang++',
CCFLAGS=[
"-g",
"-fPIC",
"-O2",
2020-07-09 07:03:57 +08:00
"-Wunused",
2020-06-28 08:23:19 +08:00
"-Werror",
"-Wshadow",
] + ccflags,
LDFLAGS=ldflags,
LINKFLAGS=ldflags,
CFLAGS="-std=gnu11",
2020-10-18 03:40:42 +08:00
CXXFLAGS="-std=c++1z",
CPPPATH=cpppath,
2021-05-03 01:34:00 +08:00
LIBPATH=libpath,
CYTHONCFILESUFFIX=".cpp",
tools=["default", "cython"]
)
Export('env', 'arch', 'common')
Visionipc v2.0 (#101) * add visionbuf make static ignore that * Needs decleration * add test binary * c++ * create some structure * some impl * socket stuff * Accept socket connection * Alloc some buffers * Create pub sockets and send buffer id * make listener private * Implement receive * use error check macros in cl_helpers * constructors to pass in opencl context * add some convenience values in struct * refactor creating buffers * rgb is not so simple * add fake stride and expose buffers * add comment * add extra data struct * support conflate * init opencl on all buffers * make ion compile * fix qcom2 * correctly setup yuv pointers when importing buffer * also included from c * Remove send print statements * send metadata * reveive metadata * also used in c code * dont start listener automatically * Was started in 2 places * set 100ms timeout on socket * verify server id to detect reconnects * handle reconnect * buffer cleanup * let user handle opencl creation * add default values * Add support for aligned rgb buffers * add align macro * dont use namespace * use poller * apple ifdef in ipc.cc * VisionBuf is C++ class * Install opencl headers * cppcheck c++ * remove c header guard * fix mac build * simplify constructors * Update visionipc/visionipc.h Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> * Update visionipc/visionbuf_ion.cc Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> * add brackets * s/VIPCBufExtra/VisionIpcBufExtra/g * Add unittesting harness * remove vipc demo * very basic tests * add conflate test * Install opencl * suppress msgq warnings * Make it work using zmq * cl in qcom replay * run unittests in zmq mode as well * non blocking connect * always larger frame queues Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2021-01-08 21:54:41 +08:00
envCython = env.Clone(LIBS=[])
2021-08-30 13:00:09 +08:00
envCython["CPPPATH"] += [np.get_include()]
envCython["CCFLAGS"] += ["-Wno-#warnings", "-Wno-shadow", "-Wno-deprecated-declarations"]
envCython["CCFLAGS"].remove('-Werror')
if arch == "Darwin":
envCython["LINKFLAGS"] = ["-bundle", "-undefined", "dynamic_lookup"]
else:
envCython["LINKFLAGS"] = ["-pthread", "-shared"]
Export('envCython')
SConscript(['SConscript'])