Introduction
How many times did you imagine to handle that opensource, makefile project with your favourite IDE, but due the project size started to translate it by hand resulting in a boring and time consuming activity? Well, I imagined it too. Actually, I have on my development PC lots of such projects, and some are really complicated to handle (like a complete new network stack in the linux kernel).
After some time searching on the internet, I did not find anything which was comfortable or free to use, and I decided to write my own utility to handle this particular problem.
Visual Studio IDE comes with a particular project, called Makefile project, which allows to use the IDE functionalities while building your source with an external build system. What I did was just some basic reverse engineering on the Makefile project Visual Studio index files to realize how it was handled by the IDE. Once I got the general vision on how the sources and filters were organized, I just wrote this very basic tool which does all the dirty work for you.
This tool is a beta script, so maybe that it does not cover all the possible makefile project types. Luckily source code is included, so feel free to modify them to better adapt to your wishes.
How the Tool Works
The tool is a simple script which uses Windows Script Host to perform its action. It will collect information from the selected folder(and all sub folders) and organize them in a Visual Studio Makefile compatible format.
At the beginning of the file, there are just 2 variables to fill in order to make it work:
root
: The root folder under which the tool will scan for known/interesting file. name
: The project name. This name will be used to name the project files and the project itself.
Note that the project file will be created under the root folder and the file references will be local to root location. If you move the projects file, then the editor will not be able to open them in Solution Explorer.
The script will maintain the root folder structure format for both headers and sources files. The script has be embedded with enough comments to make you able to modify it (just using Notepad, for example). Feel free to personalize it in order to include other files you wish to use in your Visual Studio IDE.
Using the Tool
The tool, as it is, only needs to start a shell (Powershell or Command Prompt) and invoke it as follows:
cscript.exe vscreate.vbs
History
- 01/28/2015 - Initial commit of the tool (C# language)
- 02/25/2015 - Tool translated in VBScript scripting language; compiling with .NET is no longer required
- 02/27/2015 - Resolved bug which caused empties folders to not be evaluated as filters