Skip to content

Building

TianZerL edited this page May 22, 2020 · 12 revisions

Libs

  • OpenCV4
  • OpenCL (recommend to use the sdk provided by Intel, see #13)
  • Qt5 (for GUI)
  • VapourSynth SDK (for VapourSynth plugin) (64 bit needed)

Building on Windows

Compiler: MSVC (recommend VS2019), Clang (Mingw64 are not fully support C++17 filesystem yet)

step 1:

Use CMake to generate the project, all libs will be auto found by CMake except VapourSynth, you need to specify it manually.

step 2:

  • For MSVC, remember to change generating method form debug to release, and compile it.
  • For clang, just make it.

step 3:

Get your binary file in bin folder.

Building on Linux

Compiler: G++, Clang

step 1:

Use CMake to generate the project, all libs will be auto found by CMake except VapourSynth, You may need to compile VapourSynth lib firstly because VapourSynth only provide the pre-build version of Windows.

step 2:

Just make it.

step 3:

Get your binary files in bin folder.

Building on macOS (from NightMachinary)

We need to install all the aforementioned dependencies via brew (excpet OpenCL which is provided by Apple):

brew install opencv qt ffmpeg openh264 cmake

For brew's qt to work you need to set these (see latest instructions by brew info qt):

If you need to have qt first in your PATH run:
  echo 'export PATH="/usr/local/opt/qt/bin:$PATH"' >> ~/.zshrc

For compilers to find qt you may need to set:
  export LDFLAGS="-L/usr/local/opt/qt/lib"
  export CPPFLAGS="-I/usr/local/opt/qt/include"

For pkg-config to find qt you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/qt/lib/pkgconfig"

Now we need to fix macOS libomp problem (copied from here):

  • Install LLVM with openmp and libomp with brew

     brew update
     brew install llvm libomp
    
  • Run CMake with the new compilers

     # in repo's root
     cmake -DCMAKE_C_COMPILER="/usr/local/opt/llvm/bin/clang" -DCMAKE_CXX_COMPILER="/usr/local/opt/llvm/bin/clang++" .
    

Now we just run make. The binaries should have been installed to ./bin/.

Note that Apple has deprecated OpenCL (to force its own proprietary Metal API), and may remove support for it in later versions.

Build Android Version

  • Create a new project in your Android studio
  • Copy all of the files of Android to your project
  • Copy Anime4KCore folder to app/src/main/cpp/
  • Set your libs (OpenCV OpenCL for Android) path in app/src/main/cpp/CMakeLists.txt
  • Build

NOTICE: You must build the OpenCV with FFmpeg for Android by yourself, otherwise the video processing will be faulted.

Clone this wiki locally