-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
116 lines (96 loc) · 4.11 KB
/
CMakeLists.txt
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
74
75
76
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
115
116
cmake_minimum_required(VERSION 3.5.0)
# scikit-build test
if(SKBUILD)
message(STATUS "The project is built using scikit-build")
endif()
message(STATUS "The generator is: ${CMAKE_GENERATOR}")
message(STATUS "The build type is: ${CMAKE_BUILD_TYPE}")
message(STATUS "The toolchain is: ${CMAKE_TOOLCHAIN_FILE}")
# set the project name
project(videoplayer)
if (POLICY CMP0072)
cmake_policy(SET CMP0072 OLD)
endif(POLICY CMP0072)
# manage dependencies
## set vars
set(USE_WIN_DEP OFF CACHE BOOL "Use dependencies from an external package")
set(USE_VCPKG OFF CACHE BOOL "Use dependencies installed via vcpkg (not dependency package)")
## find python deps
find_package(Python REQUIRED)
find_package(PythonExtensions REQUIRED)
find_package(Cython REQUIRED)
## get deps
if (WIN32 AND USE_WIN_DEP)
message(STATUS "Use downloaded dependencies")
set(DEPENDENCY_FOLDER "${PROJECT_SOURCE_DIR}/win_dep")
# glib
find_path(GLIB2_INCLUDE_DIRS_0 NAMES glib.h PATHS "${DEPENDENCY_FOLDER}/include/glib-2.0")
find_path(GLIB2_INCLUDE_DIRS_1 NAMES glibconfig.h PATHS "${DEPENDENCY_FOLDER}/lib/glib-2.0/include")
list(APPEND GLIB2_INCLUDE_DIRS ${GLIB2_INCLUDE_DIRS_0})
list(APPEND GLIB2_INCLUDE_DIRS ${GLIB2_INCLUDE_DIRS_1})
find_library(GLIB2_LINK_LIBRARIES NAMES glib-2.0 PATHS "${DEPENDENCY_FOLDER}/lib")
# ogg
find_path(OGG_INCLUDE_DIRS NAMES ogg/ogg.h PATHS "${DEPENDENCY_FOLDER}/include/")
find_library(OGG_LINK_LIBRARIES NAMES ogg libogg PATHS "${DEPENDENCY_FOLDER}/lib")
# theora
find_path(THEORADEC_INCLUDE_DIRS NAMES theora/theoradec.h PATHS "${DEPENDENCY_FOLDER}/include")
find_library(THEORADEC_LINK_LIBRARIES NAMES theoradec libtheoradec theora-dec PATHS "${DEPENDENCY_FOLDER}/lib")
# libswscale
find_path(LIBSWSCALE_INCLUDE_DIRS NAMES libswscale/swscale.h PATHS "${DEPENDENCY_FOLDER}/include")
find_library(LIBSWSCALE_LIBRARIES NAMES swscale libswscale PATHS "${DEPENDENCY_FOLDER}/lib")
# opengl
find_package(OpenGL)
# msinttypes
find_path(MSINTTYPES_INCLUDE_DIRS_0 NAMES stdint.h PATHS "${DEPENDENCY_FOLDER}/include/msinttypes")
find_path(MSINTTYPES_INCLUDE_DIRS_1 NAMES inttypes.h PATHS "${DEPENDENCY_FOLDER}/include/msinttypes")
list(APPEND MSINTTYPES_INCLUDE_DIRS ${MSINTTYPES_INCLUDE_DIRS_0})
list(APPEND MSINTTYPES_INCLUDE_DIRS ${MSINTTYPES_INCLUDE_DIRS_1})
elseif(USE_VCPKG)
message(STATUS "[-] Use vcpkg")
# set vcpkg vars
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE dynamic)
# find deps
## glib
find_path(GLIB2_INCLUDE_DIRS NAMES glib.h)
find_library(GLIB2_LINK_LIBRARIES glib-2.0)
## ogg
find_path(OGG_INCLUDE_DIRS NAMES ogg/ogg.h)
find_library(OGG_LINK_LIBRARIES ogg libogg)
## theora
find_path(THEORADEC_INCLUDE_DIRS NAMES theora/theoradec.h)
find_library(THEORADEC_LINK_LIBRARIES NAMES theoradec libtheoradec theora-dec)
## libswscale
find_package(FFMPEG)
set(LIBSWSCALE_FOUND ${FFMPEG_libswscale_FOUND})
set(LIBSWSCALE_INCLUDE_DIRS ${FFMPEG_libswscale_INCLUDE_DIRS})
set(LIBSWSCALE_LIBRARIES ${FFMPEG_libswscale_LIBRARY})
## msinttypes
find_path(MSINTTYPES_INCLUDE_DIRS NAMES msinttypes/stdint.h)
#find_path(MSINTTYPES_INCLUDE_DIRS "msinttypes/inttypes.h")
#find_path(MSINTTYPES_INCLUDE_DIRS NAMES "msinttypes/stdint.h" "msinttypes/inttypes.h")
## opengl
find_package(OpenGL)
else()
message(STATUS "Use pkgconfig")
find_package(PkgConfig REQUIRED)
pkg_search_module(GLIB2 REQUIRED glib-2.0>=2.12 IMPORTED_TARGET)
pkg_search_module(OGG ogg>=1.1.0 IMPORTED_TARGET) # OGG::OGG
pkg_search_module(THEORADEC theoradec IMPORTED_TARGET) # THEORA::DEC
if(APPLE)
find_path(LIBSWSCALE_INCLUDE_DIRS
NAMES libswscale/swscale.h
PATH_SUFFIXES include include/ffmpeg
)
find_library(LIBSWSCALE_LIBRARIES
NAMES swscale
PATH_SUFFIXES bin lib
)
else()
pkg_search_module(LIBSWSCALE libswscale>=1.1.3) # FFMPEG::swscale
endif()
find_package(OpenGL)
#pkg_search_module(OPENGL REQUIRED gl IMPORTED_TARGET)
endif()
# build the project
add_subdirectory(videoplayer)