Skip to content

Commit

Permalink
Merge pull request #391 from thp/cv3-fixed
Browse files Browse the repository at this point in the history
OpenCV 3 and build system updates
  • Loading branch information
thp authored Sep 15, 2019
2 parents da0258f + 777aa3a commit 2e06f8f
Show file tree
Hide file tree
Showing 14 changed files with 21 additions and 21 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
matrix:
include:
- os: linux
dist: trusty
dist: bionic
sudo: required
language: cpp
compiler: clang
env: BUILD_TYPE=linux-native-clang
- os: linux
dist: trusty
dist: bionic
sudo: required
language: cpp
compiler: gcc
env: BUILD_TYPE=linux-cross-mingw64
- os: linux
dist: trusty
dist: bionic
sudo: required
language: cpp
compiler: gcc
Expand Down
11 changes: 2 additions & 9 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,8 @@ if(PSMOVE_BUILD_EXAMPLES)
set(GLFW_BUILD_TESTS OFF CACHE BOOL "")
add_subdirectory(${ROOT_DIR}/external/glfw EXCLUDE_FROM_ALL)

# C examples
foreach(EXAMPLE distance_calibration)
add_executable(${EXAMPLE} ${CMAKE_CURRENT_LIST_DIR}/c/${EXAMPLE}.c)
target_link_libraries(${EXAMPLE} psmoveapi psmoveapi_tracker)
set_property(TARGET ${EXAMPLE} PROPERTY FOLDER "Utilities")
endforeach()

# C++ examples
foreach(EXAMPLE tracker_camera_calibration)
foreach(EXAMPLE tracker_camera_calibration distance_calibration)
add_executable(${EXAMPLE} ${CMAKE_CURRENT_LIST_DIR}/c/${EXAMPLE}.cpp)
target_link_libraries(${EXAMPLE} psmoveapi psmoveapi_tracker)
set_property(TARGET ${EXAMPLE} PROPERTY FOLDER "Utilities")
Expand All @@ -49,7 +42,7 @@ endif()
if(PSMOVE_BUILD_TESTS)
if(PSMOVE_BUILD_TRACKER)
foreach(TESTNAME tracker )
add_executable(test_${TESTNAME} ${CMAKE_CURRENT_LIST_DIR}/c/test_${TESTNAME}.c)
add_executable(test_${TESTNAME} ${CMAKE_CURRENT_LIST_DIR}/c/test_${TESTNAME}.cpp)
target_link_libraries(test_${TESTNAME} psmoveapi psmoveapi_tracker)
set_property(TARGET test_${TESTNAME} PROPERTY FOLDER "Utilities")
endforeach(TESTNAME)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <time.h>
#include <assert.h>

#include "opencv2/opencv_modules.hpp"
#include "opencv2/core/core_c.h"
#include "opencv2/highgui/highgui_c.h"

Expand Down
File renamed without changes.
5 changes: 2 additions & 3 deletions scripts/install_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,15 @@ UNAME=$(uname)

case "$UNAME" in
Linux)
sudo add-apt-repository --yes ppa:kubuntu-ppa/backports
sudo add-apt-repository --yes ppa:hlprasu/swig-trusty-backports
sudo apt-get update -qq
sudo apt-get install -q -y mingw-w64 g++-mingw-w64
sudo apt-get install -q -y build-essential cmake \
libudev-dev libbluetooth-dev \
libv4l-dev libopencv-dev \
openjdk-7-jdk ant liblwjgl-java \
openjdk-8-jdk ant liblwjgl-java \
python-dev mono-mcs \
swig3.0 freeglut3-dev \
libxrandr-dev libxinerama-dev libxcursor-dev \
python-sphinx python-pip

# Workaround to get BlueZ 5 on Travis CI (it doesn't yet have Ubuntu 16.04)
Expand Down
2 changes: 1 addition & 1 deletion scripts/macos/build-macos
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ fi
if [ ! -d "$OPENCV_INSTALL_DIR" ]; then
cd external
if [ ! -d opencv ]; then
git clone --depth 1 --branch 2.4 git://github.com/opencv/opencv.git
git clone --depth 1 --branch 3.4 git://github.com/opencv/opencv.git
fi
cd opencv

Expand Down
8 changes: 7 additions & 1 deletion scripts/mingw64/cross-compile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fi
PSMOVEAPI_PLATFORM="$1"
shift

OPENCV_VERSION=2.4
OPENCV_VERSION=3.4.7
PSMOVEAPI_VERSION=$(git describe --tags)

MAKE_ARGS="$@"
Expand All @@ -32,6 +32,12 @@ if [ ! -f $TOOLCHAIN ]; then
exit 1
fi

# Set POSIX Threads for MinGW (https://stackoverflow.com/a/53528371)
sudo update-alternatives --set i686-w64-mingw32-gcc /usr/bin/i686-w64-mingw32-gcc-posix
sudo update-alternatives --set i686-w64-mingw32-g++ /usr/bin/i686-w64-mingw32-g++-posix
sudo update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix
sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix

# Build OpenCV
if [ ! -d external/opencv ]; then
if [ ! -f ${OPENCV_VERSION}.zip ]; then
Expand Down
2 changes: 1 addition & 1 deletion scripts/visualc/build_msvc.bat
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ IF !ERRORLEVEL! NEQ 0 (
REM Clone OpenCV
IF NOT EXIST %OPENCV_DIR% (
cd %PSMOVE_API_EXTERNAL_DIR%
git clone --depth 1 --branch 2.4 git://github.com/opencv/opencv.git
git clone --depth 1 --branch 3.4 git://github.com/opencv/opencv.git
) ELSE (
echo.
echo OpenCV dir already exists; assuming it has been cloned already
Expand Down
4 changes: 2 additions & 2 deletions src/tracker/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ ENDIF()

# 1 - OpenCV
IF(PSMOVE_BUILD_TRACKER)
FIND_PACKAGE(OpenCV 2 QUIET)
FIND_PACKAGE(OpenCV 3 QUIET)
IF(OpenCV_FOUND)
IF ("${OpenCV_LIBS}" STREQUAL "")
message("OpenCV Libs was empty! Manually setting.")
Expand Down Expand Up @@ -71,7 +71,7 @@ IF(PSMOVE_BUILD_TRACKER)
${AVFOUNDATION})
ELSEIF(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
list(APPEND PSMOVEAPI_TRACKER_PLATFORM_SRC
${CMAKE_CURRENT_LIST_DIR}/platform/camera_control_win32.c)
${CMAKE_CURRENT_LIST_DIR}/platform/camera_control_win32.cpp)
list(APPEND PSMOVEAPI_TRACKER_REQUIRED_LIBS vfw32 comctl32)
#OpenCV extra dependencies: comctl32 gdi32 ole32 setupapi ws2_32 vfw32
IF(MINGW)
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/tracker/camera_control.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@
* POSSIBILITY OF SUCH DAMAGE.
**/

#include "opencv2/core/core_c.h"

#ifdef __cplusplus
extern "C" {
#endif

#include "psmove.h"
#include "../psmove_private.h"
#include "opencv2/core/core_c.h"

struct _CameraControl;
typedef struct _CameraControl CameraControl;
Expand Down
1 change: 1 addition & 0 deletions src/tracker/camera_control_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "opencv2/core/core_c.h"
#include "opencv2/highgui/highgui_c.h"
#include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/videoio/videoio_c.h"

#if defined(WIN32)
# include <windows.h>
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 2e06f8f

Please sign in to comment.