How to setup - mhirano/islay GitHub Wiki

islay is designed to be cross-platform but it's currently verified with Ubuntu (18.04LTS, 20.04LTS) and Mac (newer than High-Sierra).
Check below to learn how to setup and be ready to drink :tumbler_glass:

There two ways to setup islay

  1. Setup on local environment
    Install all the dependencies in your local environment.
  2. Setup on Docker (only for ubuntu, experimental)
    Setup build environment for islay in Docker and access to the container using SSH.
    CLion provides a powerful way for remote build via SSH.
    Note it seems almost no overhead for virtualization by Docker on Ubuntu.
    This is not fully verified for now.

1. Setup on local environment

(Note islay is hosted on GitHub as a public template reposity. You can generate a repo using this template instead of git clone)

On Ubuntu

1. Install dependencies

  • OpenCV for image processing
  • Boost for file system
  • Dependencies for Dear ImGui
    • SDL2 for OpenGL library
    • GLFW for OpenGL library
    • GLM for math library for graphics
    • GLEW for OpenGL library
    sudo apt update # Be sure to update repository
    sudo apt install -y libsdl2-dev
    sudo apt install -y libx11-dev xorg-dev libglu1-mesa libglu1-mesa-dev libgl1-mesa-glx libgl1-mesa-dev
    sudo apt install -y libglfw3 libglfw3-dev
    sudo apt install -y libglm-dev
    sudo apt install -y libglew-dev
    

2. Build

git clone https://github.com/mhirano/islay.git --recursive    
mkdir build
cd build
cmake -DOpenCV_DIR=/path_to_your_opencv/
make

On Mac

1. Install dependencies

Homebrew is a package manager for Mac. Visit https://brew.sh/index_ja to install Homebrew.

  • OpenCV for image processing
    Build OpenCV by yourself or via Homebrew.
    brew install opencv
    
  • Boost for file system
    brew install boost
    
  • Dependencies for Dear ImGui
    • SDL2 for OpenGL library
    • GLFW for OpenGL library
    • GLM for math library for graphics
    • GLEW for OpenGL library
    brew install sdl2
    brew install glfw
    brew install glm
    brew install glew
    

2. Build

git clone https://github.com/mhirano/islay.git --recursive    
mkdir build
cd build
cmake -DOpenCV_DIR=/path_to_your_opencv/
make

On Windows 64bit (in preparation)

1. Install dependencies

  • OpenCV with extra module for image processing
  • Boost for file system
  • Dependencies for Dear ImGui
    vcpkg provides an incredibly easy way to install all the dependencies
    • SDL2 for OpenGL library
    • GLFW for OpenGL library
    • GLM for math library for graphics
    • GLEW for OpenGL library
    vcpkg install sdl2:x64-windows
    vcpkg install glfw3:x64-windows
    vcpkg install glm:x64-windows
    vcpkg install glew:x64-windows
    

2. Build

2. Setup on Docker with CLion

0. Prerequisites

  1. Install docker
    https://docs.docker.com/engine/install/
    https://docs.docker.com/engine/install/linux-postinstall/
  2. Install docker-compose
    https://docs.docker.com/compose/install/
  3. (Optional) NVIDIA GPU users need to set up NVIDIA Container Toolkit
    https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#docker

1. Setup build environment on Docker

  1. Install docker-compose Install Docker Compose and make sure you successfully run the command below.
    docker-compose -version
    
  2. Build docker image
    cd docker-env
    chmod 755 build.sh && ./build.sh
    
  3. [For NVIDIA GPU users] Enable GPU in docker_env/docker-compose.yml by removing # as below.
     <--- before --->
     #deploy:
     #  resources:
     #    reservations:
     #      devices:
     #      - driver: nvidia
     #        count: all
     #        capabilities: [gpu, graphics, compute, utility]                                                                    
     <--- after --->
     deploy:
       resources:
         reservations:
           devices:
           - driver: nvidia
             count: all
             capabilities: [gpu, graphics, compute, utility]                                                                    
    
  4. Run container
    chmod 755 create_and_start.sh && ./create_and_start.sh
    

2. Setup Xhost

  1. Allow X server to accept connections from Docker.
    xhost localhost
    
    This has to be executed when you reboot your PC. To automatically do this at boot on Ubuntu, use the following command.
    echo "xhost localhost" >> ~/.bashrc
    
    [TODO] This way is reportedly vulnerable. Fix this.

3. Setup CLion

  1. Install CLion
  2. Connect to the container via SSH.
    Go to [File]->[Setting]->[Build, Execution, Deployment]->[Toolchains].
    Add Remote Host by pressing + and click the gear icon at Credentials: and configure as follows. Note, the password is clion.
    You should change the password or use SSH key when you deploy the container accessible from outside.
    The password is set like clion:clion (username:password) at islay/docker-env/Dockerfile.

  3. Change deployment setting
    Go to [Deployment]->[Mapping] and set Local path to /path/to/your/islay and Deployment path to /work/islay
  4. Add res and result directories to [Excluded Paths]. Note that cmake-build-debug-remote-host will be automatically added.
  5. Setup CMake.
    1. Add a profile by pressing +.
    2. Change Build type: to your desired type
    3. Change Toolchain: to Remote Host
    4. Pass OpenCV's path to CMake
      -DOpenCV_DIR=/opt/opencv-4.5.1/build
      

4. Run islay

  1. Click [File]->[Reload CMake Project]
  2. Click [Run]->[Run 'islay']
  3. Play with islay! First step is to move widgets and find Command Sample and see what happens on click.

5. Configure OpenCV (Optional)

  1. Open islay/docker-env/opencv_build.sh
  2. Configure installation command
    • OpenCV version is specified at OPENCV_VERSION
  3. Re-execute from Step 1 (Setup build environment on Docker).

Trouble shoot

  • If you use a NVIDIA GPU for graphic output, make sure to enable GPU settings in docker-compose.yml as instructed above.