CMakeLists.txt 3.76 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
project(VideoStitch-apps)

option(BUILD_STUDIO "Build VideoStitch-Studio" ON)
option(BUILD_APPS_TESTS "Build apps tests" ON)

option(BUILD_VAHANA "Build VahanaVR" ON)
option(ENABLE_YOUTUBE_OUTPUT "Build YouTube output and link on YouTube dependencies" OFF)

# safeguard against accidental misuse
if(NOT VIDEOSTITCH_CMAKE)
  message(FATAL_ERROR "Please configure CMake from the root folder!")
endif(NOT VIDEOSTITCH_CMAKE)

# ----------------------------------------------------------------------------
# Find Qt
# ----------------------------------------------------------------------------

file(STRINGS "${PROJECT_SOURCE_DIR}/qt.version" QT_MINI_VERSION)
message(STATUS "Qt minimum supported version: ${QT_MINI_VERSION}")

find_package(Qt5 ${QT_MINI_VERSION} COMPONENTS Core Concurrent Gui Multimedia Network OpenGL Widgets LinguistTools Test REQUIRED)

message(STATUS "Qt FOUND: ${Qt5Core_VERSION}")

# ----------------------------------------------------------------------------

# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)

# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

# Let AUTOMOC and AUTOUIC process GENERATED files.
if (POLICY CMP0071)
  cmake_policy(SET CMP0071 NEW)
endif()

# set(CMAKE_AUTOUIC ON)


include(src/appsversion.cmake)

if(APPLE AND CCACHE_ENABLED AND (Qt5Core_VERSION VERSION_LESS "5.5"))
  # suppress warning in newer clang, don't trigger warning about unknown flag in older clang
  include(CheckCXXCompilerFlag)
  CHECK_CXX_COMPILER_FLAG("-Wno-inconsistent-missing-override" HAVE_WARNING_INCONSISTENT_MISSING_OVERRIDE)
  if(HAVE_WARNING_INCONSISTENT_MISSING_OVERRIDE)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-inconsistent-missing-override")
  endif(HAVE_WARNING_INCONSISTENT_MISSING_OVERRIDE)
endif(APPLE AND CCACHE_ENABLED AND (Qt5Core_VERSION VERSION_LESS "5.5"))


# ----------------------------------------------------------------------------
# Apps compilation flags
# ----------------------------------------------------------------------------
if (COMPILER_CLANG)
  set(CMAKE_CXX_FLAGS
      "${CMAKE_CXX_FLAGS} -Wno-conversion")
endif()

# ----------------------------------------------------------------------------

# FIXME: src/libvideostitch-base/texture.hpp
if(COMPILER_GCC)
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-variable")
endif()

include_directories(src)
if(WINDOWS)
  set(EXTERNAL_DEPS
    src/../../external_deps/)
  include_directories(${EXTERNAL_DEPS}/include)
74 75 76
  include_directories("${OCULUS_PATH}\\Include")
  find_library(OVR NAMES "LibOVR" HINTS "${OCULUS_PATH}\\Lib\\Windows\\x64\\Release\\VS2015")
  find_library(OPENVR NAMES "openvr_api")
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
  add_definitions(-DNOMINMAX)
  add_definitions(-D_USE_MATH_DEFINES)
  add_definitions(-DUNICODE)
endif(WINDOWS)

# ----------------------------------------------------------------------------
# Set common.hpp related variables
# ----------------------------------------------------------------------------
if(MSVC)
  set(COMMON_FLAGS "/FI\"libvideostitch-gui/common.hpp\"")
else()
  set(COMMON_FLAGS "-include libvideostitch-gui/common.hpp")
endif()
# ----------------------------------------------------------------------------

if(WINDOWS)
  set(VS_GUI "libvideostitch-gui")
  set(VS_BASE "libvideostitch-base")
else(WINDOWS)
  set(VS_GUI "videostitch-gui")
  set(VS_BASE "videostitch-base")
endif(WINDOWS)
add_subdirectory(src/libvideostitch-base)

if(BUILD_STUDIO OR BUILD_VAHANA)
  add_subdirectory(src/libvideostitch-gui)
endif()
if(BUILD_APPS_TESTS AND (BUILD_STUDIO OR BUILD_VAHANA))
  add_subdirectory(src/tests)
endif()

if(BUILD_STUDIO)
  add_subdirectory(src/batchstitcher)
  add_subdirectory(src/videostitch-studio-gui)
endif(BUILD_STUDIO)
if(BUILD_VAHANA)
  add_subdirectory(src/videostitch-live-gui)
endif(BUILD_VAHANA)