---
- name: Install dependencies
  apk:
    name: cmake, opencv-dev, opencl-dev
    state: present
  tags: system
  become: yes

- name: Clone Anime4KCPP repository
  git:
    depth: 1
    repo: https://github.com/TianZerL/Anime4KCPP.git
    dest: '{{ anime4kcpp_dir }}'

- name: Make build directory
  file:
    path: '{{ anime4kcpp_dir }}/build'
    state: directory

- name: Generate cmake build files
  command:
    chdir: '{{ anime4kcpp_dir }}/build'
    cmd: cmake ..

- name: Build Anime4KCPP CLI
  community.general.make:
    chdir: '{{ anime4kcpp_dir }}/build'

- name: Symlink Anime4KCPP_CLI executable
  file:
    src: '{{ anime4kcpp_dir }}/build/bin/Anime4KCPP_CLI'
    dest: ~/.local/bin/Anime4KCPP_CLI
    state: link
