Skip to content

Commit

Permalink
fixes for agnostic build
Browse files Browse the repository at this point in the history
  • Loading branch information
ltn-chriskennedy committed Apr 23, 2024
1 parent 719487f commit 5ffad58
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions scripts/install_opencv.sh
Original file line number Diff line number Diff line change
@@ -1,33 +1,31 @@
#!/bin/bash

set -e
#set -v

OS="$(uname -s)"

O0PENCV_VERSION=4.5.5
CMAKE=cmake

brew install cmake

run_with_scl() {
OS="$(uname -s)"
if [ "$OS" = "Linux" ]; then
scl enable devtoolset-11 llvm-toolset-7.0 -- "$@"
else
"$@"
fi
}

if [ "$OS" == "Linux" ]; then
CMAKE=cmake3
if [ "$1" == "build" ]; then
echo "Building OpenCV"
else
CMAKE=cmake
fi
if [ ! -d "build" ]; then
mkdir -p build
fi

if [ ! -d "build" ]; then
mkdir -p build
cd build
fi

cd build

## Install OpenCV with perceptual image hashing
if [ ! -d "opencv" ]; then
git clone https://github.com/opencv/opencv.git
Expand All @@ -45,6 +43,13 @@ else
mkdir opencv/build
fi

if [ "$OS" == "Linux" ]; then
export CMAKE=cmake3
else
brew install cmake
export CMAKE=cmake
fi

export PREFIX=/opt/rsprobe
export GST_PLUGIN_PATH=$PREFIX/lib64/gstreamer-1.0
export LD_LIBRARY_PATH=$PREFIX/lib64:$PREFIX/lib:$LD_LIBRARY_PATH
Expand All @@ -70,7 +75,9 @@ run_with_scl $CMAKE -D CMAKE_BUILD_TYPE=RELEASE \
-DBUILD_opencv_imgproc=ON \
-DBUILD_opencv_img_hash=ON \
-DBUILD_opencv_imgcodecs=ON \
-DBUILD_opencv_highgui=ON $CMAKE_C_COMPILER_VAR $CMAKE_CXX_COMPILER_VAR \
-DBUILD_opencv_highgui=ON \
$CMAKE_C_COMPILER_VAR \
$CMAKE_CXX_COMPILER_VAR \
-D WITH_TBB=ON \
-D WITH_V4L=OFF \
-D WITH_QT=OFF \
Expand All @@ -84,5 +91,3 @@ run_with_scl $CMAKE -D CMAKE_BUILD_TYPE=RELEASE \

run_with_scl make
run_with_scl make install

cd ..

0 comments on commit 5ffad58

Please sign in to comment.