Formation of giant planets around stars with various masses