Using Arduino as a standalone compiler

First of all: The Arduino IDE brings its own GCC compiler. It is a version, that can compile for the AVR platform (don't know, if the standard version is capable of that).

When you activate verbose output for compilation in the preferences of your Arduino IDE, you can actually see, what calls to GCC the IDE is doing. You could use that to replicate it.

If you only want to use the sublime text editor for programming and not rebuilding the compilation environment of Arduino for fun (which I wouldn't able to help with), you might wanna have a look at the Arduino-cli. It gives you a tool to invoke important function, that normally the IDE does, via commandline (like installing cores and libraries, compiling and uploading). Thats what I'm currently using with sublime for programming in Arduino. It allows me to invoke building an uploading from sublime without having the Arduino IDE open.

If you want to go that way, here are the sublime-build files, that I use for my Arduino Nanos and ATtiny84s. Maybe you can adapt them for your needs. (Note: I omitted multiple variants, that I use to upload on different com ports, because the com port is the only thing, that changes there. Also I'm on Ubuntu, so on Windows or Mac it might look a bit different)

For the Nano:

{
    "cmd" : ["arduino-cli compile --fqbn arduino:avr:nano"],
    "working_dir": "$file_path",
    "shell":true,
    "file_patterns":["*.ino"],
    "variants": [
        {
            "cmd" : ["arduino-cli compile --fqbn arduino:avr:nano && arduino-cli upload -v --fqbn arduino:avr:nano:cpu=atmega328old --port /dev/ttyUSB0"],
            "working_dir": "$file_path",
            "shell":true,
            "name": "Compile & Upload ttyUSB0"
        }
    ]
}

For the ATtiny84:

{
    "cmd" : ["arduino-cli compile --fqbn ATTinyCore:avr:attinyx4:chip=84"],
    "working_dir": "$file_path",
    "shell":true,
    "file_patterns":["*.ino"],
    "variants": [
        {
            "cmd" : ["arduino-cli compile --fqbn ATTinyCore:avr:attinyx4:chip=84 && arduino-cli upload -v --fqbn ATTinyCore:avr:attinyx4:chip=84 --programmer arduinoasisp --port /dev/ttyUSB0"],
            "working_dir": "$file_path",
            "shell":true,
            "name": "ATtiny84: Compile & Upload ttyUSB0"
        }
    ]
}

This is not an answer that fully meets what you ask, but it is too big for a comment, and it helps you somewhat, at least using your Sublime editor.

What annoys me most in the Arduino IDE is the lack of supporting multiple files (having horizontal tabs make the number of files to see max 6 or 7, and using .h/.cpp files easily goes most beyond that number).

My preference is using Visual Studio as editor and I do. In your case you can use Sublime editor. Make sure that the .ino file doesn't change (i.e. only make a forward to your C++ classes or code in other classes). This is to prevent synchronization problems between the Arduino IDE and Visual Studio.

Simultaneously start up the Arduino IDE, and do the compilation from here. Only read the .ino file, while the other files are in the same directory (structure), and can be edited by Sublime editor.

So it doesn't use GCC, but the Arduino IDE is only used for compiling/running, and all editing work is done on your editor.

Besides that, in Visual Studio I created (at least for one project) stubs so I can run it on the PC as well as 'test' project. For this you can use your gcc compiler.