Skip to content

Compilation on Windows System

Royi edited this page May 5, 2020 · 7 revisions

This guide will instruct the user how to compile BLASFEO on Windows using 3 compilers.
It is assumed that BLASFEO is on the folder (Either download / pull the master or download the latest release) <BLASFEOFolder>.

The guide deals with targeting x86 (Actually x64) code path only (Not ARM).

Compilation with (Microsoft Visual Studio) MSVC

This instructions will compile BLASFEO using MSVC compiler.

  1. Open Command Line Terminal (CMD).
  2. Verify CMAKE is on the path (echo %PATH%).
  3. Go to <BLASFEOFolder> and create a folder called Build and enter it.
  4. Run cmake -G"Visual Studio 15 2017 Win64" -DBUILD_SHARED_LIBS=OFF -DTARGET=GENERIC -DBLASFEO_TESTING=OFF -DBLASFEO_BENCHMARKS=OFF -DBLASFEO_EXAMPLES=OFF ... Wait for the build process to finish.
  5. Run cmake --build . --config Release. Wait for the compilation to end. Once ended the BLASFEO library will be available at <BLASFEOFolder>\Build\Release.

The above will create a static library which is compiled against the Threaded Dynamic Library flavor of Microsoft Visual C Run Time Library (Known as \MD in MSVC). In order to use the Static Run Time Library one could use -DCMAKE_C_FLAGS_RELEASE="${CMAKE_C_FLAGS_RELEASE} /MT".

In order to create Dynamic Library one should set -DBUILD_SHARED_LIBS=ON. The above doesn't compile the Examples, Benchmarks and Testing as they require libm which isn't available in MSVC.

The MSVC compiler doesn't support AT&T dialect of the Assembly used in BLASFEO. Hence only the GENERIC target is supported.

Compilation with Clang-CL

The Clang-CL compiler on Windows allows compiling any target of BLASFEO. Hence the output will have much better performance.

This instructions will compile BLASFEO using Clang-CL Compiler with the Ninja Generator.

  1. Open Command Line Terminal (CMD).
  2. Verify that CMAKE, Ninja and Clang-Cl are on the path (echo %PATH%).
  3. Go to <BLASFEOFolder> and create a folder called Build and enter it.
  4. Run cmake -G"Ninja" -DCMAKE_C_COMPILER=clang-cl -DBUILD_SHARED_LIBS=OFF -DTARGET=X64_AUTOMATIC -DBLASFEO_TESTING=OFF -DBLASFEO_BENCHMARKS=OFF -DBLASFEO_EXAMPLES=OFF -DCMAKE_BUILD_TYPE=Release ... Wait for the build process to finish.
  5. Run cmake --build . --config Release. Wait for the compilation to end. Once ended the BLASFEO library will be available at <BLASFEOFolder>\Build.

In case one installed Clang-CL with the Visual Studio Plug In then one could use cmake -G"Visual Studio 15 2017 Win64" -T"<LLVM>" -DBUILD_SHARED_LIBS=OFF -DTARGET=GENERIC -DBLASFEO_TESTING=OFF -DBLASFEO_BENCHMARKS=OFF -DBLASFEO_EXAMPLES=OFF .. where <LLVM> is what's under the Platform Toolset option under MSVC:

MSVC Platform Toolset]

Then it is just as in the section about MSVC.

Compilation with MinGW64

This section shows how to compile using MinGW64. The distribution used by me was MinGW Distro - nuwen.net.

  1. Open Command Line Terminal (CMD).
  2. Verify that CMAKE, and MinGW64 are on the path (echo %PATH%).
  3. Go to <BLASFEOFolder> and create a folder called Build and enter it.
  4. Run cmake -G"MinGW Makefiles" -DCMAKE_C_COMPILER=clang-cl -DBUILD_SHARED_LIBS=OFF -DTARGET=X64_AUTOMATIC -DBLASFEO_TESTING=OFF -DBLASFEO_BENCHMARKS=OFF -DBLASFEO_EXAMPLES=OFF -DCMAKE_BUILD_TYPE=Release ... Wait for the build process to finish.
  5. Run cmake --build . --config Release. Wait for the compilation to end. Once ended the BLASFEO library will be available at <BLASFEOFolder>\Build.

Since MinGW64 has access to glibc one could turn on the tests, benchmarks etc... as needed.