We study AKSZ‐type BV constructions for the topological A‐ and B‐models within a double field theory formulation that incorporates backgrounds with geometric and non‐geometric fluxes. We relate them to a Courant sigma‐model, on an open membrane, corresponding to a generalized complex structure, which reduces to the A‐ or B‐models on the boundary. We introduce S‐duality at the level of the membrane sigma‐model based on the generalized complex structure, which exchanges the related AKSZ field theories, and interpret it as topological S‐duality of the A‐ and B‐models. Our approach leads to new classes of Courant algebroids associated to (generalized) complex geometry.