Sync with 2.4 (Updated test application to validate h264 and AAC format with mediacodec)
[platform/core/api/mediademuxer.git] / CMakeLists.txt
1
2 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
3 SET(fw_name "capi-mediademuxer")
4
5 PROJECT(${fw_name})
6
7 SET(CMAKE_INSTALL_PREFIX /usr)
8 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
9
10 SET(INC_DIR include)
11 SET(INC_PORT_GST_DIR include/port_gst)
12 SET(INC_PORT_CUSTOM_DIR include/port_custom)
13 SET(INC_PORT_FFMPEG_DIR include/port_ffmpeg)
14 INCLUDE_DIRECTORIES(${INC_DIR} ${INC_PORT_GST_DIR} ${INC_PORT_CUSTOM_DIR} ${INC_PORT_FFMPEG_DIR})
15
16 SET(dependents "dlog glib-2.0 mm-common capi-media-tool iniparser gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-app-1.0 capi-media-codec")
17 SET(pc_dependents "capi-base-common capi-media-tool")
18
19 INCLUDE(FindPkgConfig)
20 pkg_check_modules(${fw_name} REQUIRED ${dependents})
21 FOREACH(flag ${${fw_name}_CFLAGS})
22     SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
23 ENDFOREACH(flag)
24
25 SET(CMAKE_C_FLAGS "-I./include -I./include/headers ${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -Werror")
26 SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
27
28 IF("${ARCH}" STREQUAL "arm")
29     ADD_DEFINITIONS("-DTARGET")
30 ENDIF("${ARCH}" STREQUAL "arm")
31
32 ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
33 ADD_DEFINITIONS("-DTIZEN_DEBUG")
34
35 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIB_INSTALL_DIR}")
36
37 AUX_SOURCE_DIRECTORY (src MAIN_SRC)
38 AUX_SOURCE_DIRECTORY (src/port_gst PORT_GST_SRC)
39 AUX_SOURCE_DIRECTORY (src/port_custom PORT_CUST_SRC)
40 AUX_SOURCE_DIRECTORY (src/port_ffmpeg PORT_FFMPEG_SRC)
41
42 LIST (APPEND SOURCES
43      ${MAIN_SRC}
44      ${PORT_FFMPEG_SRC}
45      ${PORT_CUST_SRC}
46      ${PORT_GST_SRC}
47      )
48
49 ADD_LIBRARY(${fw_name} SHARED ${SOURCES})
50
51 TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS})
52
53 SET_TARGET_PROPERTIES(${fw_name}
54      PROPERTIES
55      VERSION ${FULLVER}
56      SOVERSION ${MAJORVER}
57      CLEAN_DIRECT_OUTPUT 1
58 )
59
60 INSTALL(TARGETS ${fw_name} DESTINATION ${LIB_INSTALL_DIR})
61 INSTALL(
62         DIRECTORY ${INC_DIR}/ DESTINATION include/media
63         FILES_MATCHING
64         PATTERN "mediademuxer_*.h" EXCLUDE
65         PATTERN "${INC_DIR}/*.h"
66         )
67
68 SET(PC_NAME ${fw_name})
69 SET(PC_REQUIRED ${pc_dependents})
70 SET(PC_LDFLAGS -l${fw_name})
71 SET(PC_CFLAGS -I\${includedir}/media)
72
73 CONFIGURE_FILE(
74     ${fw_name}.pc.in
75     ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc
76     @ONLY
77 )
78 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
79
80 ADD_SUBDIRECTORY(test)
81
82 IF(UNIX)
83
84 ADD_CUSTOM_TARGET (distclean @echo cleaning for source distribution)
85 ADD_CUSTOM_COMMAND(
86         DEPENDS clean
87         COMMENT "distribution clean"
88         COMMAND find
89         ARGS    .
90         -not -name config.cmake -and \(
91         -name tester.c -or
92         -name Testing -or
93         -name CMakeFiles -or
94         -name cmake.depends -or
95         -name cmake.check_depends -or
96         -name CMakeCache.txt -or
97         -name cmake.check_cache -or
98         -name *.cmake -or
99         -name Makefile -or
100         -name core -or
101         -name core.* -or
102         -name gmon.out -or
103         -name install_manifest.txt -or
104         -name *.pc -or
105         -name *~ \)
106         | grep -v TC | xargs rm -rf
107         TARGET  distclean
108         VERBATIM
109 )
110
111 ENDIF(UNIX)
112