Topology optimized building blocks for integrated photonics