add library support and subproject building