2020-05-14 04:43:32 +08:00
|
|
|
import os
|
|
|
|
import subprocess
|
2021-04-08 19:08:58 +08:00
|
|
|
import sysconfig
|
|
|
|
import numpy as np
|
2020-05-14 04:43:32 +08:00
|
|
|
|
|
|
|
arch = subprocess.check_output(["uname", "-m"], encoding='utf8').rstrip()
|
|
|
|
|
2021-10-07 06:42:48 +08:00
|
|
|
common = ''
|
|
|
|
|
2021-04-08 19:08:58 +08:00
|
|
|
python_path = sysconfig.get_paths()['include']
|
|
|
|
cpppath = [
|
|
|
|
'#',
|
|
|
|
'#rednose',
|
|
|
|
'#rednose/examples/generated',
|
|
|
|
'/usr/lib/include',
|
|
|
|
python_path,
|
|
|
|
np.get_include(),
|
|
|
|
]
|
|
|
|
|
2020-05-14 04:43:32 +08:00
|
|
|
env = Environment(
|
|
|
|
ENV=os.environ,
|
|
|
|
CC='clang',
|
|
|
|
CXX='clang++',
|
|
|
|
CCFLAGS=[
|
|
|
|
"-g",
|
|
|
|
"-fPIC",
|
|
|
|
"-O2",
|
|
|
|
"-Werror=implicit-function-declaration",
|
|
|
|
"-Werror=incompatible-pointer-types",
|
|
|
|
"-Werror=int-conversion",
|
|
|
|
"-Werror=return-type",
|
|
|
|
"-Werror=format-extra-args",
|
2021-11-02 22:18:20 +08:00
|
|
|
"-Wshadow",
|
2020-05-14 04:43:32 +08:00
|
|
|
],
|
2021-04-08 19:08:58 +08:00
|
|
|
LIBPATH=["#rednose/examples/generated"],
|
2020-05-14 04:43:32 +08:00
|
|
|
CFLAGS="-std=gnu11",
|
2020-10-18 03:45:29 +08:00
|
|
|
CXXFLAGS="-std=c++1z",
|
2021-04-08 19:08:58 +08:00
|
|
|
CPPPATH=cpppath,
|
|
|
|
tools=["default", "cython"],
|
2020-05-14 04:43:32 +08:00
|
|
|
)
|
|
|
|
|
2021-04-08 19:08:58 +08:00
|
|
|
# Cython build enviroment
|
|
|
|
envCython = env.Clone()
|
2021-11-02 22:18:20 +08:00
|
|
|
envCython["CCFLAGS"] += ["-Wno-#warnings", "-Wno-shadow", "-Wno-deprecated-declarations"]
|
2021-04-08 19:08:58 +08:00
|
|
|
|
|
|
|
envCython["LIBS"] = []
|
|
|
|
if arch == "Darwin":
|
|
|
|
envCython["LINKFLAGS"] = ["-bundle", "-undefined", "dynamic_lookup"]
|
|
|
|
elif arch == "aarch64":
|
|
|
|
envCython["LINKFLAGS"] = ["-shared"]
|
|
|
|
envCython["LIBS"] = [os.path.basename(python_path)]
|
|
|
|
else:
|
|
|
|
envCython["LINKFLAGS"] = ["-pthread", "-shared"]
|
|
|
|
|
|
|
|
rednose_config = {
|
|
|
|
'generated_folder': '#examples/generated',
|
|
|
|
'to_build': {
|
2022-06-28 23:19:40 +08:00
|
|
|
'live': ('#examples/live_kf.py', True, [], []),
|
|
|
|
'kinematic': ('#examples/kinematic_kf.py', True, [], []),
|
|
|
|
'compare': ('#examples/test_compare.py', True, [], []),
|
|
|
|
'pos_computer_4': ('#rednose/helpers/lst_sq_computer.py', False, [], []),
|
|
|
|
'pos_computer_5': ('#rednose/helpers/lst_sq_computer.py', False, [], []),
|
|
|
|
'feature_handler_5': ('#rednose/helpers/feature_handler.py', False, [], []),
|
2021-04-08 19:08:58 +08:00
|
|
|
},
|
|
|
|
}
|
2020-05-14 04:43:32 +08:00
|
|
|
|
2021-10-07 06:42:48 +08:00
|
|
|
Export('env', 'envCython', 'arch', 'rednose_config', 'common')
|
2021-04-08 19:08:58 +08:00
|
|
|
SConscript(['#rednose/SConscript'])
|