You need a smart trainer: one that connects over Bluetooth, over Wi-Fi or Ethernet with Wahoo Direct Connect, or with ANT+ through a USB stick on Windows.
TourKit on Garmin Edge
Your routes on your Edge as native Garmin courses, and workouts from the TourKit library as Garmin workouts. Free.