Setting up the build is somewhat straight forward on windows however I could not find any instructions on setting up a Visual Studio project for editing and debugging. I’m writing down the instructions I was given on IRC for my future benefits and for others. I hope at some point someone will take the initiative to put this information on MDN.
These instructions start from the point where you have a simple build of Firefox completed with the latest windows SDK and VS 10.
- Create a new project using ‘Project from Existing Code’ (See Joe Walker’s comment if you don’t have this).
- Select ‘Visual C++’, enter a project name (ex: mozilla-central), source directory as project file location, select ‘Show all files in Solution Explorer’.
- Make sure you un-select ‘Add Files to the project from these folders’, hit Next.
- Select ‘Use external build system’, hit Finish.
- Project will be empty until you select ‘Show all Files’ from top middle icon in the solution explorer when the project is selected, File -> close the solution, re-open it. Source files should appear (I had to do this step 3 times)
- For autocomplete select Project ->Properties -> NMake.
- Under ‘Preprocessor Definitions’ add XP_WIN (return here later to add any definition your may be compiling with/find missing)
- Under ‘Include Search Path’ type in ‘<objdir>\dist\include’ (I recommend to have built your project from command line for this step)
- For debugging select ‘Debugging’ still under the property page, type in the absolute path to firefox.exe. Recommended command argument ‘-P “Minefield” -no-remote’.
I strongly recommend using ‘Console’ when working from the command line.
Optional: Add a build/clean target (Can otherwise be done outside of Visual Studio using the command line)
- Create a single script, build.sh, that you can invoke that will trigger a build with the configuration you need. It should set all environment variables needed.
- Copy the ‘mozilla-build/start-msvc10.bat’ to ‘mozilla-build/start-msvc10-build.bat’.
- Replace the last line to read something like ‘”%MOZILLABUILD%”\msys\bin\bash –login <path-to-your-build-script>/build.sh’.
- Select Project->Properties->NMake, for Build Command Line type ‘C:\mozilla-build\start-msvc10-build.bat’.
- Advanced: Create multiple project configuration for each mozconfig build configuration you would like to work with then have them invoke specific build scripts and firefox.exe.
You can modify your script to do incremental builds to reduce your turn around time.