forked from LizardByte/build-deps
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathx265.cmake
More file actions
53 lines (41 loc) · 1.89 KB
/
Copy pathx265.cmake
File metadata and controls
53 lines (41 loc) · 1.89 KB
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
# x265.pc will not be installed if their cmake cannot detect the latest tag
GIT_FETCH_TAGS("third-party/FFmpeg/x265_git")
set(X265_GENERATED_SRC_PATH ${CMAKE_CURRENT_BINARY_DIR}/FFmpeg/x265_git)
file(GLOB X265_GIT_FILES ${CMAKE_CURRENT_SOURCE_DIR}/patches/FFmpeg/x265_git/*.patch)
foreach(patch_file ${X265_GIT_FILES})
APPLY_GIT_PATCH(${X265_GENERATED_SRC_PATH} ${patch_file})
endforeach()
if(BUILD_FFMPEG_ALL_PATCHES OR BUILD_FFMPEG_X265_PATCHES)
file(GLOB FFMPEG_X265_FILES ${CMAKE_CURRENT_SOURCE_DIR}/patches/FFmpeg/FFmpeg/x265/*.patch)
foreach(patch_file ${FFMPEG_X265_FILES})
APPLY_GIT_PATCH(${FFMPEG_GENERATED_SRC_PATH} ${patch_file})
endforeach()
endif()
# options for x265
set(ENABLE_CLI OFF CACHE BOOL "Enable CLI")
set(ENABLE_SHARED OFF CACHE BOOL "Enable shared libraries")
set(STATIC_LINK_CRT ON CACHE BOOL "Static link CRT")
# not currently supported for aarch64
if(${arch} STREQUAL "amd64" OR ${arch} STREQUAL "x86_64")
set(ENABLE_HDR10_PLUS ON CACHE BOOL "Enable HDR10+ support")
endif()
# ensure x265 installs into the ffmpeg prefix
set(_original_cmake_install_prefix ${CMAKE_INSTALL_PREFIX})
set(CMAKE_INSTALL_PREFIX ${FFMPEG_INSTALL_PREFIX})
# build x265
add_subdirectory(${X265_GENERATED_SRC_PATH}/source x265 SYSTEM)
add_dependencies(${CMAKE_PROJECT_NAME} x265-static)
# install x265 as a build target, this must be installed before building FFmpeg
add_custom_target(x265
COMMAND ${CMAKE_COMMAND} -P cmake_install.cmake
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/x265
COMMENT "Installing x265"
)
add_dependencies(x265 x265-static)
add_dependencies(${CMAKE_PROJECT_NAME} x265)
if(ENABLE_HDR10_PLUS)
add_dependencies(${CMAKE_PROJECT_NAME} hdr10plus-static)
add_dependencies(x265 hdr10plus-static)
endif()
# PKG_CONFIG_PATH already set since this is installed directly to the prefix
set(CMAKE_INSTALL_PREFIX ${_original_cmake_install_prefix})