## VisualStudio build Notes

Last Update: Sep 26 2014
Author: Blas Rodriguez Somoza blas@puertareal.com
Updated by: Popa Adrian Marius (mapopa at gmail.com)

### 0.-Introduction

> There are three VisualStudio builds, msvc8, msvc9 and msvc10. The msvc8 build is used for the official build of Firebird in Windows.

> Under the directory where you put Firebird sources you will see the following directories

> - builds
> - mac_os_x (Mac os X build scripts)
> - posix (Posix build scripts)
> - win32 (Msvc build scripts)
> - .....
> - doc
> - sql.extensions
> - src
> - ....
> - lang_helpers
> - ....
> - examples
> - ....

> After you build Firebird you also will see the following temporary directories

> - gen (cpp files generated from epp, exe and fdb's.)
> - temp (compiler temporary)
> - output_Win32 (build output)

### 1.-TODO

### 2.-Prerrequisites

> To prepare the standard msvc build of FB you need:

> - Microsoft VisualStudio 8 (2005) or greater
> - sed unix utility

> If you intend to prepare an installable build, you will need innosetup 5

> To download the utilities use the following links

> - Innosetup (Note: This is the classic version, not the new unicode version.) http://www.jrsoftware.org/download.php/is.exe
> - Innosetup pack http://files.jrsoftware.org/ispack/ispack-5.3.10.exe
> - Sed http://gnuwin32.sourceforge.net/packages/sed.htm

### 2.-Installing the utilities

> #### 2.1.-Visual Studio

> 1. Install VisualStudio 20xx
> 2. You can compile it with Visual C++ 20xx Studio Express but it will not be able to build the control panel applet but for the Firebird server and the rest of utilities building is ok

> #### 2.2.-Sed

> 1. Download Sed setup from GnuWin32 project I had to run the setup and i extract into c:\gnuwin32
> 2. Add sed c:\gnuwin32\bin to the PATH environment variable , test it from a new console if it works by typing sed it should show you something abut gnu sed help

> #### 2.3.-Inno setup

> 1. Run the Installer for Innosetup 5 that you downloaded from above setup-5.3.xx.exe
> 2. Run the Innosetup pack Installer ispack-5.3.10.exe with the default options (next, next, next)

### 4.- Building

> #### 4.1.-Standard build

> 1. Eliminate the fb2control from firebird3 solution if you are using Visual Studio Express (doesn't support MFC) and it's only the control pannel applet and try to build it, it should give you no errors when you build the solution.
> 2. Open a command line window.
> 3. Go to the builds\win32 directory.
> 4. Run the following batches in order (your version of VisualStudio is detected automatically)
> 1. make_icu.bat [DEBUG] [CLEAN]
> 2. make_boot.bat [DEBUG] [CLEAN]
> 3. make_all.bat [DEBUG] [CLEAN]

> After the build finish, an output directory with the binaries is created below your firebird3 directory.

> - To make a clean build from scratch after making changes to the code use the clean_all.bat script

> #### 4.2.-Parser rebuild

> If you change parser.y you will need to rebuild parser.cpp, to do so use parse.bat

> #### 4.3.-Examples build

> The examples build prepare two databases that will be needed to compile the examples in a distribution. If you intend to prepare a distribution then run the examples batch before:

> 1. make_examples.bat

> #### 4.4.-Installer build

> Remember, you need sed and innosetup in the path to build the installer

> - Open a command line window.
> - Go to the builds\install\arch-specific\win32 directory.
> - The batch to build the installer is
>   BuildExecutableInstall.bat [DEBUG] [CS]
>   Where DEBUG means if the build is a debug one or not and CS means classic server installer.
> - After you start the batch, you will get a InnoSetup window. To build the install exe select the option compile, and a new exe will appear in builds/win32/install_image

> #### 4.5.-Building samples

> After the standard build is finished, an output directory with the same structure as the installed FB directory is created.

> If you want to build the examples just cd to firebird3\output\examples\build_win32 and run run_all.bat

> Run_all.bat calls four other bats to make the example sets. Any example set can be build independently with its make_XXX script.

> The example sets are:

> - api (API Interface)
> - dyn (embedded dynamic SQL)
> - stat (embedded static SQL)
> - udf (User defined functions)