Skip to content

Tutorial for MacOS

Takuya Takeuchi edited this page May 30, 2018 · 7 revisions

Requirements

  • dlib
  • CMake
    • 3.0 or higher
    • If you do not want to add CMake path to environment variable, you must type fullpath of CMake when build library.
  • .NET Core 2.0

How to build dlib

DlibDotNet.Native requires libdlib.a. You can refer official page

How to build DlibDotNet.Native

Preparations

  1. Clone Dlib.Net repository to any directory
  2. Download dlib package from officail site
  3. Extract dlib file to any directory
  4. Install X11

Build

  1. Open DlibDotNet/src/DlibDotNet.Native in console
  2. Type the following code in a console:
mkdir build
cd build
cmake -DDLIB_PATH=/Users/<UserName>/Work/Lib/DLib/19.8 ..
  1. Type the following code in a console:
cmake --build . --config Release

Or

cmake --build . --config Debug
  1. libDlibDotNet.Native.dylib will be in build

How to build DlibDotNet

Preparations

  1. Install .NET Core 2.0 by following the official page

Build

  1. Open DlibDotNet/src/DlibDotNet.Native in console
  2. Type the following code in a console:
dotnet build -c Release

Or

dotnet build -c Debug

How to use DlibDotNet?

For now dotnet command does NOT support specify any executable directory. So please refer the following code in a console:

dotnet restore
dotnet msbuild /p:Configuration=ReleaseMac
mkdir -p bin/Release/netcoreapp2.0
mv bin/ReleaseMac/netcoreapp2.0/* bin/Release/netcoreapp2.0
cp ../../src/DlibDotNet.Native/build/libDlibDotNet.Native.dylib bin/Release/netcoreapp2.0/
dotnet run --configuration Release --no-build