Heat the oven to 175 C (350 F) and line two 20 cm round pans or one rectangular pan with butter and parchment paper.
Whisk flour, baking soda, baking powder, salt, cinnamon, ginger, and nutmeg in a large bowl.
Whisk white sugar, brown sugar, eggs, oil, and vanilla in a second bowl until smooth.
Pour the wet mixture into the dry mixture and stir gently until just combined.
Fold in grated carrots, walnuts, and raisins if using.
Divide batter between pans, smooth tops, and bake 30 to 35 minutes for round layers until a toothpick comes out with a few moist crumbs.
Cool in pans 10 minutes, turn out onto a rack, and cool fully.
Beat cream cheese and butter until smooth, add powdered sugar in two parts on low speed, add vanilla and salt, and beat until spreadable. Frost between layers and over top and sides, chill briefly if warm, then slice and serve.