Huge thanks to vmagnin for their help on this. Below is my documented steps on how I finally managed to solve this problem. Posting this in hopes that on the off chance anyone else tries to do this without any prior knowledge of any of these things, this will be helpful to them. (had to modify because of 2 link limit)
Need to have Visual Studio 2019 installed and Intel Fortran Compiler added before doing any of these things, steps not noted here since this is done by our sys admin/IT staff.
Install GIT for Windows
Link: gitforwindows dot org
- Install the executable
- Recommend switching to Notepad++ as the default editor when prompted
- Recommend switching to âCheckout as-is, commit as-isâ on line ending conversions prompt
- Otherwise, just stick with default options unless you know you need something else
Install MSYS2
Link: msys2 dot org
- Install the executable following defaults (C:\msys64)
- Run âMSYS2 MSYSâ from start menu
- Run âpacman âSyuâ, at the end of this process, it will prompt you to close the program/prompt to finish installation, choose Yes
- Run âMSYS2 MSYSâ from start menu again
- Run âpacman âSuâ, wait for it to finish, will take a while
- Run âpacman âS âneeded base-devel mingw-w64-x86_64-toolchainâ
Install Python 3.6.x
Link: python dot org/ftp/python/3.6.2/python-3.6.2-amd64.exe
- Download and run executable from above link
- Choose Custom Installation
- On âOptional Featuresâ page, make sure everything is checked that can be
- On âAdvanced Optionsâ page, make sure everything is checked that can be, change the âCustomize install locationâ path to âC:\Python36â
- Install
- At the end, you will get a âSetup was successfulâ page, make sure to hit the button to âDisable path length limitâ
- Close installer
Building the GTK3 Libraries on Windows 10, Visual Studio 2019
Guide: github dot com/wingtk/gvsbuild
- Create the directories to a path âC:\gtk-build\githubâ
- Open a command prompt window (Winkey+R, type âcmdâ, hit enter; or start typing âcommandâ at start menu)
- Run âcd C:\gtk-build\githubâ
- Run âgit clone https://github.com/wingtk/gvsbuildâ
- Run âcd gvsbuildâ
- Run âpython build.py build âp x64 --vs-ver 16 gtk3â
- This will run a python script, specifying 64-bit build, and Visual Studio version 16 (2019), build the gtk3 library. This took ~15 minutes on a company laptop, so be patient.
Setting up a Static Library project for GTK-Fortran in Visual Studio
Link: github dot com/vmagnin/gtk-fortran/tree/gtk3
- First, get a copy of the GTK-Fortran library from the link above. This can be done from command prompt by making a directory somewhere, cdâing to that directory, then typing âgit clone https://github.com/vmagnin/gtk-fortran/tree/gtk3â, or by going to the website, clicking on the green Code button at the top right, and selecting âDownload ZIPâ.
- Open Visual Studio 2019, select âCreate New Projectâ, use the drop-downs to filter Languages to Fortran and Project Types to Library, then select âStatic Libraryâ and hit next. Name your project and put it in your desired directory, then hit Create. (Take note of where your project is being stored, you will need to add this project to your main solution later)
- In a windows explorer window, navigate to the directory where you downloaded/unzipped the GTK-Fortran library. Look under the âsrcâ folder, sort by file type, and select all of the *.f90 files in this directory. Drag all of these files into the Visual Studio window onto the âSource Filesâ folder. You should now be able to expand the âSource Filesâ folder in the Visual Studio Solution Explorer and see all of the *.f90 files.
- Update the build settings from âDebugâ and âx86â at the top of Visual Studio to âReleaseâ and âx64â
- Build the solution (Ctrl+Shift+B, Build->Build Solution, or Start button)
Setting up your working GUI project in Visual Studio
- Open Visual Studio 2019, select âCreate New Projectâ, use the drop-downs to filter Languages to Fortran, then select âEmpty Projectâ and hit next. Name your project and put it in your desired directory, then hit Create. (Take note of where your project is being stored, you will need to move files there later)
- In the Solution Explorer, right click on your Solution (should be top item), select Add->Existing Project⌠Navigate to the Static Library project file that you created above (*.vfproj) and hit okay
- Your solution should now contain both the project you just created as well as the static library project in the Solution Explorer.
- In the Solution Explorer, right click on your project (not the static library), select Build Dependencies->Project Dependencies⌠In the window that opens, under the list of âDepends On:â, check the checkbox next to the name of your static library project, then hit OK.
- Add or create your source code file, adding it to the current project under Source Files.
- Open a windows explorer window and navigate to âC:\gtk-build\gtk\x64\release\libâ, sort the folder by file type, select all of the *.lib files, drag them into your new project in Visual Studio under Source Files
- Optional, but recommended, create a sub-folder under Source Files and put all of the *.lib files in that folder instead/first
- Ensure that this project is also set to âReleaseâ and âx64â settings at the top
- Build your solution, should in theory get no errors if code is bug free, but still wonât open as executable at this point
- Open a windows explorer window and navigate to the folder containing your solution, then dig down into â<Project Name>\x64\Releaseâ folder.
- Open a separate windows explorer window and navigate to âC:\gtk-build\gtk\x64\release\binâ, sort folder by file type, and copy all of the *.dll files from this folder over into the Release folder of your project (one step up)
- You should now be able to run your .exe program from the Release folder
It cannot be stressed enough:
- Both the static library and the final project both have to be set to âReleaseâ and âx64â
- The version of GTK must match between the C based GTK libraries and the Fortran based GTK-Fortran libraries. At the time of writing, GTK4 is available, but the tools to build it are not updated yet, so this set of instructions is for building GTK3 ONLY .