build script
use weak_ptr to solve cycle reference