Blame docs/build-with-visual-studio.md

Packit bfcc33
## Building LibSass with Visual Studio
Packit bfcc33
Packit bfcc33
### Requirements:
Packit bfcc33
Packit bfcc33
The minimum requirement to build LibSass with Visual Studio is "Visual Studio 2013 Express for Desktop".
Packit bfcc33
Packit bfcc33
Additionally, it is recommended to have `git` installed and available in `PATH`, so to deduce the `libsass` version information. For instance, if GitHub for Windows (https://windows.github.com/) is installed, the `PATH` will have an entry resembling: `X:\Users\<YOUR_NAME>\AppData\Local\GitHub\PortableGit_<SOME_GUID>\cmd\` (where `X` is the drive letter of system drive). If `git` is not available, inquiring the LibSass version will result in `[NA]`.
Packit bfcc33
Packit bfcc33
### Build Steps:
Packit bfcc33
Packit bfcc33
#### From Visual Studio:
Packit bfcc33
Packit bfcc33
On opening the `win\libsass.sln` solution and build (Ctrl+Shift+B) to build `libsass.dll`.
Packit bfcc33
Packit bfcc33
To Build LibSass as a static Library, it is recommended to set an environment variable `LIBSASS_STATIC_LIB` before launching the project:
Packit bfcc33
Packit bfcc33
```cmd
Packit bfcc33
cd path\to\libsass
Packit bfcc33
SET LIBSASS_STATIC_LIB=1
Packit bfcc33
::
Packit bfcc33
:: or in PowerShell:
Packit bfcc33
:: $env:LIBSASS_STATIC_LIB=1
Packit bfcc33
::
Packit bfcc33
win\libsass.sln
Packit bfcc33
```
Packit bfcc33
Packit bfcc33
Visual Studio will form the filtered source tree as shown below:
Packit bfcc33
Packit bfcc33
![image](https://cloud.githubusercontent.com/assets/3840695/9298985/aae9e072-44bf-11e5-89eb-e7995c098085.png)
Packit bfcc33
Packit bfcc33
`Header Files` contains the .h and .hpp files, while `Source Files` covers `.c` and `.cpp`. The other used headers/sources will appear under `External Dependencies`.
Packit bfcc33
Packit bfcc33
If there is a LibSass code file appearing under External Dependencies, it can be changed by altering the `win\libsass.vcxproj.filters` file or dragging in Solution Explorer.
Packit bfcc33
Packit bfcc33
#### From Command Prompt:
Packit bfcc33
Packit bfcc33
Notice that in the following commands:
Packit bfcc33
Packit bfcc33
* If the platform is 32-bit Windows, replace `ProgramFiles(x86)` with `ProgramFiles`.
Packit bfcc33
* To build with Visual Studio 2015, replace `12.0` with `14.0` in the aforementioned command.
Packit bfcc33
Packit bfcc33
Open a command prompt:
Packit bfcc33
Packit bfcc33
To build dynamic/shared library (`libsass.dll`):
Packit bfcc33
Packit bfcc33
```cmd
Packit bfcc33
:: debug build:
Packit bfcc33
"%ProgramFiles(x86)%\MSBuild\12.0\Bin\MSBuild" win\libsass.sln
Packit bfcc33
Packit bfcc33
:: release build:
Packit bfcc33
"%ProgramFiles(x86)%\MSBuild\12.0\Bin\MSBuild" win\libsass.sln ^
Packit bfcc33
/p:Configuration=Release
Packit bfcc33
```
Packit bfcc33
Packit bfcc33
To build static library (`libsass.lib`):
Packit bfcc33
Packit bfcc33
```cmd
Packit bfcc33
:: debug build:
Packit bfcc33
"%ProgramFiles(x86)%\MSBuild\12.0\Bin\MSBuild" win\libsass.sln ^
Packit bfcc33
/p:LIBSASS_STATIC_LIB=1
Packit bfcc33
Packit bfcc33
:: release build:
Packit bfcc33
"%ProgramFiles(x86)%\MSBuild\12.0\Bin\MSBuild" win\libsass.sln ^
Packit bfcc33
/p:LIBSASS_STATIC_LIB=1 /p:Configuration=Release
Packit bfcc33
```
Packit bfcc33
Packit bfcc33
#### From PowerShell:
Packit bfcc33
Packit bfcc33
To build dynamic/shared library (`libsass.dll`):
Packit bfcc33
Packit bfcc33
```powershell
Packit bfcc33
# debug build:
Packit bfcc33
&"${env:ProgramFiles(x86)}\MSBuild\12.0\Bin\MSBuild" win\libsass.sln
Packit bfcc33
Packit bfcc33
# release build:
Packit bfcc33
&"${env:ProgramFiles(x86)}\MSBuild\12.0\Bin\MSBuild" win\libsass.sln `
Packit bfcc33
/p:Configuration=Release
Packit bfcc33
```
Packit bfcc33
Packit bfcc33
To build static library (`libsass.lib`):
Packit bfcc33
Packit bfcc33
```powershell
Packit bfcc33
# build:
Packit bfcc33
&"${env:ProgramFiles(x86)}\MSBuild\12.0\Bin\MSBuild" win\libsass.sln `
Packit bfcc33
/p:LIBSASS_STATIC_LIB=1
Packit bfcc33
Packit bfcc33
# release build:
Packit bfcc33
&"${env:ProgramFiles(x86)}\MSBuild\12.0\Bin\MSBuild" win\libsass.sln `
Packit bfcc33
/p:LIBSASS_STATIC_LIB=1 /p:Configuration=Release
Packit bfcc33
```