Import('env', 'arch')


cpp_path = [
    "#phonelibs/acado/include",
    "#phonelibs/acado/include/acado",
    "#phonelibs/qpoases/INCLUDE",
    "#phonelibs/qpoases/INCLUDE/EXTRAS",
    "#phonelibs/qpoases/SRC/",
    "#phonelibs/qpoases",
    "lib_mpc_export"

]

mpc_files = [
    "longitudinal_mpc.c",
    Glob("lib_mpc_export/*.c"),
    Glob("lib_mpc_export/*.cpp"),
]

interface_dir = Dir('lib_mpc_export')

SConscript(['#phonelibs/qpoases/SConscript'], variant_dir='lib_qp', exports=['interface_dir'])

env.SharedLibrary('mpc', mpc_files, LIBS=['m', 'qpoases'], LIBPATH=['lib_qp'], CPPPATH=cpp_path)

# if arch != "aarch64":
#     acado_libs = [File("#phonelibs/acado/x64/lib/libacado_toolkit.a"),
#                   File("#phonelibs/acado/x64/lib/libacado_casadi.a"),
#                   File("#phonelibs/acado/x64/lib/libacado_csparse.a")]
#     env.Program('generator', 'generator.cpp', LIBS=acado_libs, CPPPATH=cpp_path)
