nlib
Information About the Package for Windows (Visual Studio)

Required to Use nlib

The build requires Windows 7 or later and Visual Studio 2008 or later (Express Editions are okay), in addition to CMake for Windows.

If you are using ZlibInputStream and ZlibOutputStream, you must compile and install zlib. Also note that you must apply the latest update package to Visual Studio.
You can use Using chocolatey, because it is scripted to partially automate the setup of the environment. Script samples for installing the software needed to use chocolatey are shown, but of course other methods are possible.
Directory Structure
The package for Windows (using Visual Studio) has the following directory structure.
├── lib
│   └── cmake/msvc
│       ├── nx_*-vc120.lib           # static 32bit libraries for Visual Studio 2013
│       ├── nx_*-vc120_d.lib         # static 32bit libraries(debug) for Visual Studio 2013
│       ├── nx_*-vc120amd64.lib      # static 64bit libraries for Visual Studio 2013
│       ├── nx_*-vc120amd64_d.lib    # static 64bit libraries(debug) for Visual Studio 2013
│       ├── nx_*-vc120dllamd64.dll   # 64bit DLLs for Visual Studio 2013
│       ├── nx_*-vc120dllamd64.lib   # 64bit import libraries for Visual Studio 2013
│       ├── nx_*-vc120dllamd64_d.dll # 64bit DLLs(debug) for Visual Studio 2013
│       ├── nx_*-vc120dllamd64_d.lib # 64bit import libraries(debug) for Visual Studio 2013
│       ├── nx_*-vc110.lib           # static 32bit libraries for Visual Studio 2012
│       ├── nx_*-vc110_d.lib         # static 32bit libraries(debug) for Visual Studio 2012
│       ├── nx_*-vc110amd64.lib      # static 64bit libraries for Visual Studio 2012
│       ├── nx_*-vc110amd64_d.lib    # static 64bit libraries(debug) for Visual Studio 2012
│       ├── nx_*-vc110dllamd64.dll   # 64bit DLLs for Visual Studio 2012
│       ├── nx_*-vc110dllamd64.lib   # 64bit import libraries for Visual Studio 2012
│       ├── nx_*-vc110dllamd64_d.dll # 64bit DLLs(debug) for Visual Studio 2012
│       ├── nx_*-vc110dllamd64_d.lib # 64bit import libraries(debug) for Visual Studio 2012
│       ├── nx_*-vc100.lib           # static 32bit libraries for Visual Studio 2010
│       ├── nx_*-vc100_d.lib         # static 32bit libraries(debug) for Visual Studio 2010
│       ├── nx_*-vc90.lib            # static 32bit libraries for Visual Studio 2008
│       └── nx_*-vc90_d.lib          # static 32bit libraries(debug) for Visual Studio 2008
└── samples
     └── cmake/cmake_vc[90|100|110|120|110amd64|120amd64].[sh|ps1]   # Shell script for starting CMake for the sample builds
Example of Installing the Software to Use nlib
This example assumes Windows 7 SP1 and the installation of either Visual Studio 2013 or Visual Studio 2012. You can also use the Express Editions.
# After installing Visual Studio 2013 or Visual Studio 2012, start PowerShell as an administrator and run Set-ExecutionPolicy RemoteSigned.
# Install chocolatey.
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
# Use chocolatey to install the package.
cinst powershell4 # You must restart the system after running this package to enable PowerShell 4 (which is included in the package).
cinst 7zip.commandline
cinst cmake
cinst windows-8-1-sdk
# Download and extract zlib1.2.8.zip.
Invoke-WebRequest http://www.zlib.net/zlib128.zip -Outfile zlib128.zip
7za x .\zlib128.zip
cd zlib-1.2.8
# Compile and install zlib. (Use when you are using Visual Studio 2013.)
cinst VS2013.4 # Install Visual Studio 2013 Update 4. Not necessary if it is already installed.
cmake -G "Visual Studio 12" -H"." -Bvc120
cmake --build vc120 --config Release --target INSTALL # If you are using the Express Edition, you must open the IDE and build.
cmake -G "Visual Studio 12 Win64" -H"." -Bvc120amd64
cmake --build vc120amd64 --config Release --target INSTALL
# Use ./samples/cmake/gen-sln.ps1 vc120 to create the SLN file for the 32-bit sample program.
# Use ./samples/cmake/gen-sln.ps1 vc120amd64 to create the SLN file for the 64-bit sample program.
# Compile and install zlib. (Use when you are using Visual Studio 2012.)
cinst VS2012.4 # Install Visual Studio 2012 Update 4. Not necessary if it is already installed.
cmake -G "Visual Studio 11" -H"." -Bvc110
cmake --build vc110 --config Release --target INSTALL # If you are using the Express Edition, you must open the IDE and build.
cmake -G "Visual Studio 11 Win64" -H"." -Bvc110amd64
cmake --build vc110amd64 --config Release --target INSTALL
# Use ./samples/cmake/gen-sln.ps1 vc110 to create the SLN file for the 32-bit sample program.
# Use ./samples/cmake/gen-sln.ps1 vc110amd64 to create the SLN file for the 64-bit sample program.
Extracting the nlib Package and Compiling the nlib Samples
After you install the required software, you can extract nlib and compile it in Visual Studio.
  1. Extract the PC version of the nlib ZIP file. You do not need to set any environment variable.
  2. Move from the directory where the file was extracted to the ./samples/cmake directory.
  3. Start the script from PowerShell and create the Visual Studio SLN file.
    • If you are using the 32-bit version of Visual Studio 2012, run gen-sln.ps1 vc110.
    • If you are using the 32-bit version of Visual Studio 2013, run gen-sln.ps1 vc120.
    • If you are using the 64-bit version of Visual Studio 2013, run gen-sln.ps1 vc120amd64.
    • In other instances, run the PowerShell script by passing the corresponding arguments.
  4. Directories named Debug and Release are created in the subdirectory (such as vc110, vc120, or vc120amd64), and these directories each contain a file named nx_samples.sln. Double-click this file to start the Visual Studio IDE.
    • Note that the solution (the SLN file) in the Debug directory is specifically for the Debug build, and the solution in the Release directory is specifically for the Release build.
  5. You can build all of the samples by selecting Build > Build Solution from the IDE menu.
Other Platform-Specific Information
  • For a better understanding of the flags that are set, see cmake/common.cmake.win32.
  • The compiler sometimes generates internal errors if you use the SIMD library with Visual C++ 2008.
  • Apply the following patch to Visual Studio 2008 SP1. It fixes the behavior of the _mm_insert_ps function.
  • When the nlib release comes with the Visual Studio 2015 build, it will no longer come with the Visual Studio 2008 and 2010 builds. Note this fact.