From 64fe9fcad02bf5cdfc67078cb1e8385295ab413e Mon Sep 17 00:00:00 2001 From: Maurice ONeal Date: Sat, 17 Sep 2022 09:53:52 -0400 Subject: [PATCH] Compile and installation method updates created setup, build and install scripts to make it easier and convenient to compile and install the application from source. no plans distribute pre-compiled binaries because it's just so much easier to guarantee the application will actually work in the target machine when compiled by the target machine. --- .gitignore | 8 ++++++-- CMakeLists.txt | 2 +- README.md | 21 +++++++++++++-------- build.sh | 7 +++++++ install.sh | 3 +++ setup.sh | 13 +++++++++++++ 6 files changed, 43 insertions(+), 11 deletions(-) create mode 100644 build.sh create mode 100644 install.sh create mode 100644 setup.sh diff --git a/.gitignore b/.gitignore index 714f541..7f8a1b3 100644 --- a/.gitignore +++ b/.gitignore @@ -55,5 +55,9 @@ compile_commands.json # VSCode /.vscode -# Build folder -/build +# Build folders +/.build-mow +/.build-opencv + +# Opencv src folder +/src/opencv diff --git a/CMakeLists.txt b/CMakeLists.txt index a6018ee..b95f612 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.8.12) project( MotionWatch ) find_package( OpenCV REQUIRED ) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -pthread") diff --git a/README.md b/README.md index 9167403..cecbd22 100644 --- a/README.md +++ b/README.md @@ -90,17 +90,22 @@ vid_container = mp4 # installation. ``` -### Build Setup ### +### Setup/Build/Install ### This application is currently only compatible with a Linux based operating systems that are capable of building and installing the opencv API from source. -[opencv](https://docs.opencv.org/4.x/df/d65/tutorial_table_of_content_introduction.html). +The following 3 scripts make this convenient by downloading, compiling and then +installing the opencv API for you directly from opencv's git repository. This +also makes sure FFMPEG and all of it's dependencies are installed because this +application needs it to work properly. + +note 1: be sure to run setup.sh and install.sh as root (or use sudo). +note 2: if building from scratch the following scripts will need to + be run in this order - setup.sh -> build.sh -> install.sh. + ``` -cd /path/to/Motion/Watch/source -mkdir ./build -cd ./build -cmake .. -make -sudo cp ./mow /usr/bin/mow +sh ./setup.sh <--- only need to run this once if compiling for the first +sh ./build.sh time or if upgrading from the ground up. +sh ./install.sh ``` diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..08f634f --- /dev/null +++ b/build.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +mkdir -p ./.build-mow +cd ./.build-mow +cmake .. +make -j4 + diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..c42fb7e --- /dev/null +++ b/install.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +cp ./.build-mow/mow /usr/bin/mow diff --git a/setup.sh b/setup.sh new file mode 100644 index 0000000..8e75a2a --- /dev/null +++ b/setup.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +apt update +apt install -y cmake g++ wget unzip git ffmpeg libavcodec-dev libavformat-dev libavutil-dev libswscale-dev +cd ./src +git clone https://github.com/opencv/opencv.git +cd .. +mkdir -p ./.build-opencv +cd ./.build-opencv +cmake ../src/opencv +make -j4 +make install +