Gamma-ray emission during solar eruptive events is thought to be caused mainly by high-energy (MeV-TeV) protons propagating to the lower layers of the solar atmosphere, i.e. the chromosphere and photosphere, and the subsequent pion production and decay. A potential source of these high-energy particles are coronal mass ejection (CME)-driven shocks, followed by particle back-precipitation to the Sun. Alternatively, a scenario where particles propagate from a compact acceleration site along extended coronal loops towards the emission region is also a possibility. In both cases, the solar magnetic field configuration is a key ingredient to understand the origins of the gamma-ray emission as observed, e.g. by the Fermi Large Area Telescope (LAT). Here, we investigate the propagation of energetic protons and their subsequent gamma-ray production in a comprehensive modeling framework based on the CRPropa code, which is a well-established tool in high-energy astrophysics. The advantage of this approach is that the proton transport and gamma ray production can be studied with a single, unified code by following individual particle trajectories. We present first results of particle dynamics and the resulting gamma-ray distributions based on simplified field structures in a potential field (PFSS) model. We discuss further prospects of our approach that can include outputs from detailed MHD simulations of CME evolution and extensions to other energy regimes.