diff --git a/.travis.yml b/.travis.yml index a288e85e..27b05d03 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 5de0566e..00b80fb4 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -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") @@ -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) diff --git a/examples/c/distance_calibration.c b/examples/c/distance_calibration.cpp similarity index 99% rename from examples/c/distance_calibration.c rename to examples/c/distance_calibration.cpp index 14f81897..c65e8133 100644 --- a/examples/c/distance_calibration.c +++ b/examples/c/distance_calibration.cpp @@ -32,6 +32,7 @@ #include #include +#include "opencv2/opencv_modules.hpp" #include "opencv2/core/core_c.h" #include "opencv2/highgui/highgui_c.h" diff --git a/examples/c/test_tracker.c b/examples/c/test_tracker.cpp similarity index 100% rename from examples/c/test_tracker.c rename to examples/c/test_tracker.cpp diff --git a/scripts/install_dependencies.sh b/scripts/install_dependencies.sh index ce6e5027..3f480b66 100644 --- a/scripts/install_dependencies.sh +++ b/scripts/install_dependencies.sh @@ -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) diff --git a/scripts/macos/build-macos b/scripts/macos/build-macos index 549aa2bf..36582e70 100644 --- a/scripts/macos/build-macos +++ b/scripts/macos/build-macos @@ -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 diff --git a/scripts/mingw64/cross-compile b/scripts/mingw64/cross-compile index 28f8bb5b..f20b09f1 100644 --- a/scripts/mingw64/cross-compile +++ b/scripts/mingw64/cross-compile @@ -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="$@" @@ -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 diff --git a/scripts/visualc/build_msvc.bat b/scripts/visualc/build_msvc.bat index 5699b874..335bcc9d 100644 --- a/scripts/visualc/build_msvc.bat +++ b/scripts/visualc/build_msvc.bat @@ -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 diff --git a/src/tracker/CMakeLists.txt b/src/tracker/CMakeLists.txt index 606438aa..dc625853 100644 --- a/src/tracker/CMakeLists.txt +++ b/src/tracker/CMakeLists.txt @@ -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.") @@ -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) diff --git a/src/tracker/camera_control.c b/src/tracker/camera_control.cpp similarity index 100% rename from src/tracker/camera_control.c rename to src/tracker/camera_control.cpp diff --git a/src/tracker/camera_control.h b/src/tracker/camera_control.h index 79003488..aa2aaeee 100644 --- a/src/tracker/camera_control.h +++ b/src/tracker/camera_control.h @@ -27,6 +27,7 @@ * POSSIBILITY OF SUCH DAMAGE. **/ +#include "opencv2/core/core_c.h" #ifdef __cplusplus extern "C" { @@ -34,7 +35,6 @@ extern "C" { #include "psmove.h" #include "../psmove_private.h" -#include "opencv2/core/core_c.h" struct _CameraControl; typedef struct _CameraControl CameraControl; diff --git a/src/tracker/camera_control_private.h b/src/tracker/camera_control_private.h index a4842b13..86aa8b7f 100644 --- a/src/tracker/camera_control_private.h +++ b/src/tracker/camera_control_private.h @@ -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 diff --git a/src/tracker/platform/camera_control_win32.c b/src/tracker/platform/camera_control_win32.cpp similarity index 100% rename from src/tracker/platform/camera_control_win32.c rename to src/tracker/platform/camera_control_win32.cpp diff --git a/src/tracker/tracker_helpers.c b/src/tracker/tracker_helpers.cpp similarity index 100% rename from src/tracker/tracker_helpers.c rename to src/tracker/tracker_helpers.cpp