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

Packit Service 7770af
## Building LibSass with Visual Studio
Packit Service 7770af
Packit Service 7770af
### Requirements:
Packit Service 7770af
Packit Service 7770af
The minimum requirement to build LibSass with Visual Studio is "Visual Studio 2013 Express for Desktop".
Packit Service 7770af
Packit Service 7770af
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 Service 7770af
Packit Service 7770af
### Build Steps:
Packit Service 7770af
Packit Service 7770af
#### From Visual Studio:
Packit Service 7770af
Packit Service 7770af
On opening the `win\libsass.sln` solution and build (Ctrl+Shift+B) to build `libsass.dll`.
Packit Service 7770af
Packit Service 7770af
To Build LibSass as a static Library, it is recommended to set an environment variable `LIBSASS_STATIC_LIB` before launching the project:
Packit Service 7770af
Packit Service 7770af
```cmd
Packit Service 7770af
cd path\to\libsass
Packit Service 7770af
SET LIBSASS_STATIC_LIB=1
Packit Service 7770af
::
Packit Service 7770af
:: or in PowerShell:
Packit Service 7770af
:: $env:LIBSASS_STATIC_LIB=1
Packit Service 7770af
::
Packit Service 7770af
win\libsass.sln
Packit Service 7770af
```
Packit Service 7770af
Packit Service 7770af
Visual Studio will form the filtered source tree as shown below:
Packit Service 7770af
Packit Service 7770af
![image](https://cloud.githubusercontent.com/assets/3840695/9298985/aae9e072-44bf-11e5-89eb-e7995c098085.png)
Packit Service 7770af
Packit Service 7770af
`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 Service 7770af
Packit Service 7770af
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 Service 7770af
Packit Service 7770af
#### From Command Prompt:
Packit Service 7770af
Packit Service 7770af
Notice that in the following commands:
Packit Service 7770af
Packit Service 7770af
* If the platform is 32-bit Windows, replace `ProgramFiles(x86)` with `ProgramFiles`.
Packit Service 7770af
* To build with Visual Studio 2015, replace `12.0` with `14.0` in the aforementioned command.
Packit Service 7770af
Packit Service 7770af
Open a command prompt:
Packit Service 7770af
Packit Service 7770af
To build dynamic/shared library (`libsass.dll`):
Packit Service 7770af
Packit Service 7770af
```cmd
Packit Service 7770af
:: debug build:
Packit Service 7770af
"%ProgramFiles(x86)%\MSBuild\12.0\Bin\MSBuild" win\libsass.sln
Packit Service 7770af
Packit Service 7770af
:: release build:
Packit Service 7770af
"%ProgramFiles(x86)%\MSBuild\12.0\Bin\MSBuild" win\libsass.sln ^
Packit Service 7770af
/p:Configuration=Release
Packit Service 7770af
```
Packit Service 7770af
Packit Service 7770af
To build static library (`libsass.lib`):
Packit Service 7770af
Packit Service 7770af
```cmd
Packit Service 7770af
:: debug build:
Packit Service 7770af
"%ProgramFiles(x86)%\MSBuild\12.0\Bin\MSBuild" win\libsass.sln ^
Packit Service 7770af
/p:LIBSASS_STATIC_LIB=1
Packit Service 7770af
Packit Service 7770af
:: release build:
Packit Service 7770af
"%ProgramFiles(x86)%\MSBuild\12.0\Bin\MSBuild" win\libsass.sln ^
Packit Service 7770af
/p:LIBSASS_STATIC_LIB=1 /p:Configuration=Release
Packit Service 7770af
```
Packit Service 7770af
Packit Service 7770af
#### From PowerShell:
Packit Service 7770af
Packit Service 7770af
To build dynamic/shared library (`libsass.dll`):
Packit Service 7770af
Packit Service 7770af
```powershell
Packit Service 7770af
# debug build:
Packit Service 7770af
&"${env:ProgramFiles(x86)}\MSBuild\12.0\Bin\MSBuild" win\libsass.sln
Packit Service 7770af
Packit Service 7770af
# release build:
Packit Service 7770af
&"${env:ProgramFiles(x86)}\MSBuild\12.0\Bin\MSBuild" win\libsass.sln `
Packit Service 7770af
/p:Configuration=Release
Packit Service 7770af
```
Packit Service 7770af
Packit Service 7770af
To build static library (`libsass.lib`):
Packit Service 7770af
Packit Service 7770af
```powershell
Packit Service 7770af
# build:
Packit Service 7770af
&"${env:ProgramFiles(x86)}\MSBuild\12.0\Bin\MSBuild" win\libsass.sln `
Packit Service 7770af
/p:LIBSASS_STATIC_LIB=1
Packit Service 7770af
Packit Service 7770af
# release build:
Packit Service 7770af
&"${env:ProgramFiles(x86)}\MSBuild\12.0\Bin\MSBuild" win\libsass.sln `
Packit Service 7770af
/p:LIBSASS_STATIC_LIB=1 /p:Configuration=Release
Packit Service 7770af
```