We study the topological sector of $N$ = 2 sigma-models with $H$-flux. It has been known for a long time that the target-space geometry of these theories is not Kähler and can be described in terms of a pair of complex structures, which do not commute, in general, and are parallel with respect to two different connections with torsion. Recently an alternative description of this geometry was found, which involves a pair of commuting twisted generalized complex structures on the target space. In this paper, we define and study the analogs of A and B-models for $N$ = 2 sigma-models with $H$-flux and show that the results are naturally expressed in the language of twisted generalized complex geometry. For example, the space of topological observables is given by the cohomology of a Lie algebroid associated to one of the two twisted generalized complex structures. We determine the topological scalar product, which endows the algebra of observables with the structure of a Frobenius algebra. We also discuss mirror symmetry for twisted generalized Calabi-Yau manifolds.