Direct observations of exoplanets require a stellar coronagraph to suppress the diffracted starlight. An Apodizing Phase Plate (APP) coronagraph consists of a carefully designed phase-only mask in the pupil plane of the telescope. This mask alters the point spread function in such a way that it contains a dark zone at some off-axis region of interest, while still retaining a high Strehl ratio (and therefore high planet throughput). Although many methods for designing such a phase mask exist, none of them provide a guarantee of global optimality. Here we present a method based on generalization of the phase-only mask to a complex amplitude mask. Maximizing the Strehl ratio while simultaneously constraining the stellar intensity in the dark zone turns out to be a quadratically constrained linear algorithm, for which a global optimum can be found using large-scale numerical optimizers. This generalized problem yields phase-only solutions. These solutions are therefore also solutions of the original problem. Using this optimizer we perform parameter studies on the inner and outer working angle, the contrast and the size of the secondary obscuration of the telescope aperture for both one-sided and annular dark zones. We reach Strehl ratios of > 65% for a 10-5 contrast from 1.8 to 10λ/D with a one-sided dark zone for a VLT-like secondary obscuration. This study provides guidelines for designing APPs for more realistic apertures.