forked from oetcxiaoliu/mpp
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
153 lines (125 loc) · 5.53 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
cmake_minimum_required(VERSION 2.6.3)
find_package(PkgConfig)
PROJECT(rockchip_media_process_platform C CXX)
INCLUDE(GNUInstallDirs)
pkg_search_module(PTHREAD pthread)
ADD_DEFINITIONS(-Wmissing-declarations -Wall -Wextra -Wshadow -ffast-math)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -O0 -g3")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -O0 -g3")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Os")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Os")
# putting those into config.h would be better
set(RKPLATFORM "" CACHE BOOL "Enable RK HW CONFIG")
if(RKPLATFORM)
ADD_DEFINITIONS(-DRKPLATFORM)
endif(RKPLATFORM)
# ----------------------------------------------------------------------------
# Create git version information
# ----------------------------------------------------------------------------
if(EXISTS "${PROJECT_SOURCE_DIR}/.git")
find_package(Git)
if(GIT_FOUND)
# get author
execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --format=%an
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE EXEC_OUT
ERROR_VARIABLE EXEC_ERROR
RESULT_VARIABLE EXEC_RET
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_STRIP_TRAILING_WHITESPACE)
if (NOT EXEC_RET)
message(STATUS "author: ${EXEC_OUT}")
set(VERSION_LAST_AUTHOR ${EXEC_OUT})
endif()
# get date
execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --format=%ad
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE EXEC_OUT
ERROR_VARIABLE EXEC_ERROR
RESULT_VARIABLE EXEC_RET
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_STRIP_TRAILING_WHITESPACE)
if (NOT EXEC_RET)
message(STATUS "author: ${EXEC_OUT}")
set(VERSION_LAST_DATA ${EXEC_OUT})
endif()
# get version hash
execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --format=%H
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE EXEC_OUT
ERROR_VARIABLE EXEC_ERROR
RESULT_VARIABLE EXEC_RET
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_STRIP_TRAILING_WHITESPACE)
if (NOT EXEC_RET)
set(VERSION_REVISION ${EXEC_OUT})
endif()
# get one line version information
execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --pretty=format:"%h author: %an %s"
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE EXEC_OUT
ERROR_VARIABLE EXEC_ERROR
RESULT_VARIABLE EXEC_RET
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_STRIP_TRAILING_WHITESPACE)
if (NOT EXEC_RET)
message(STATUS "git version: ${EXEC_OUT}")
set(VERSION_ONE_LINE ${EXEC_OUT})
string(REPLACE "\"" "" VERSION_ONE_LINE ${VERSION_ONE_LINE})
endif()
set(VERSION_VER_NUM -1)
endif()
# add git hooks
if (EXISTS "${PROJECT_SOURCE_DIR}/tools/hooks/")
set(GIT_HOOK_SRC "${PROJECT_SOURCE_DIR}/tools/hooks/")
if(EXISTS "${PROJECT_SOURCE_DIR}/.git/hooks")
set(GIT_HOOK_DST "${PROJECT_SOURCE_DIR}/.git/hooks/")
file(COPY ${GIT_HOOK_SRC} DESTINATION ${GIT_HOOK_DST})
message(STATUS "Install git hooks done")
endif(EXISTS "${PROJECT_SOURCE_DIR}/.git/hooks")
endif(EXISTS "${PROJECT_SOURCE_DIR}/tools/hooks/")
endif(EXISTS "${PROJECT_SOURCE_DIR}/.git")
configure_file(
"${PROJECT_SOURCE_DIR}/build/cmake/version.in"
"${PROJECT_SOURCE_DIR}/mpp/version.h"
)
# ----------------------------------------------------------------------------
# Start module definition
# ----------------------------------------------------------------------------
# project overall include file
include_directories(inc)
# small utile functions for test case
include_directories(utils)
# ----------------------------------------------------------------------------
# osal library
# ----------------------------------------------------------------------------
# Operation System Abstract Layer (OSAL) include
include_directories(osal/inc)
# OSAL is needed on all platform, do not need option
add_subdirectory(osal)
# ----------------------------------------------------------------------------
# utils for test case
# ----------------------------------------------------------------------------
add_subdirectory(utils)
# ----------------------------------------------------------------------------
# Media Process Platform library
# ----------------------------------------------------------------------------
# Media Process Platform include
add_subdirectory(mpp)
# ----------------------------------------------------------------------------
# test / demo
# ----------------------------------------------------------------------------
add_subdirectory(test)
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/inc/config.h.cmake"
"${CMAKE_CURRENT_SOURCE_DIR}/inc/config.h")
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/pkgconfig/rockchip_mpp.pc.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/rockchip_mpp.pc" @ONLY)
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/pkgconfig/rockchip_vpu.pc.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/rockchip_vpu.pc" @ONLY)
INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/rockchip_mpp.pc"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig/")
INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/rockchip_vpu.pc"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig/")
INSTALL(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/inc/"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/rockchip")
# End generate the build configure file