Finalize the build code.

Still compilation error about: "kernel launch from __device__ or __global__ functions requires separate compilation mode".