Bridging scales from molecular simulations to classical thermodynamics: density functional theory of capillary condensation in nanopores