16c5531ad00f381c34f0b0d72dba75b3bc8b85d9
[platform/core/multimedia/libmedia-service.git] / CMakeLists.txt
1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
2 PROJECT(media-service C)
3 SET(VERSION_MAJOR 1)
4 SET(VERSION "${VERSION_MAJOR}.0.0")
5
6 SET(MEDIASERVICE-LIB "media-service")
7 SET(MEDIASERVICE-HASH-LIB "media-svc-hash")
8 SET(MEDIACONTENT-PLUGIN-LIB "media-content-plugin")
9 SET(SRCS 
10         src/common/media-svc.c
11         src/common/media-svc-media.c
12         src/common/media-svc-album.c
13         src/common/media-svc-media-folder.c
14         src/common/media-svc-db-utils.c
15         src/common/media-svc-util.c
16         src/common/media-svc-debug.c
17         src/common/media-svc-noti.c
18         src/common/media-svc-localize-utils.c
19         src/common/media-svc-localize_ch.c
20         )
21
22 SET(HASH_SRCS
23         md5/md5.c
24         md5/media-svc-hash.c
25         )
26
27 SET(PLUGIN_SRCS
28         plugin/media-svc-plugin.c
29         )
30 SET(CONTENTPLUGIN_SRCS
31         plugin/media-content-plugin.c
32         )
33
34 SET(VENDOR "samsung")
35 SET(PACKAGE ${PROJECT_NAME})
36 SET(PKGNAME "com.${VENDOR}.${PACKAGE}")
37 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
38 SET(BINDIR "${PREFIX}/bin")
39 SET(DATADIR "${PREFIX}/share")
40 SET(EXEC_PREFIX "\${prefix}")
41 SET(LIBDIR "\${prefix}/lib")
42 SET(INCLUDEDIR "\${prefix}/include")
43
44 IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
45         SET(CMAKE_BUILD_TYPE "Release")
46 ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
47 MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
48
49 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src/include/common ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/uuid ${CMAKE_SOURCE_DIR}/md5)
50
51 FIND_PROGRAM(UNAME NAMES uname)
52 EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH")
53
54
55 INCLUDE(FindPkgConfig)
56 pkg_check_modules(pkgs REQUIRED glib-2.0 dlog sqlite3 db-util libexif mm-common mm-fileinfo media-thumbnail libmedia-utils aul uuid vconf drm-client)
57
58 FOREACH(flag ${pkgs_CFLAGS})
59         SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
60 ENDFOREACH(flag)
61
62 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC")
63 SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
64 SET(CMAKE_C_FLAGS_RELEASE "-O2 -fPIC")
65
66 IF("${ARCH}" STREQUAL "arm")
67         ADD_DEFINITIONS("-DTARGET")
68         MESSAGE("add -DTARGET")
69 ENDIF("${ARCH}" STREQUAL "arm")
70
71 ADD_DEFINITIONS("-DVENDOR=\"${VENDOR}\"")
72 ADD_DEFINITIONS("-DPACKAGE=\"${PACKAGE}\"")
73 ADD_DEFINITIONS("-DPACKAGE_NAME=\"${PKGNAME}\"")
74 ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"")
75 ADD_DEFINITIONS("-D_FILE_OFFSET_BITS=64")
76 #ADD_DEFINITIONS("-D_PERFORMANCE_CHECK_")
77 #ADD_DEFINITIONS("-D_USE_LOG_FILE_")
78
79 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--hash-style=both")
80 CONFIGURE_FILE(libmedia-service.pc.in libmedia-service.pc @ONLY)
81 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libmedia-service.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
82
83 #ADD_SUBDIRECTORY(test)
84
85 LINK_DIRECTORIES(${LIB_INSTALL_DIR})
86
87 ADD_LIBRARY(${MEDIASERVICE-HASH-LIB} SHARED ${HASH_SRCS})
88 SET_TARGET_PROPERTIES(${MEDIASERVICE-HASH-LIB} PROPERTIES SOVERSION ${VERSION_MAJOR})
89 SET_TARGET_PROPERTIES(${MEDIASERVICE-HASH-LIB} PROPERTIES VERSION ${VERSION})
90 ADD_LIBRARY(${MEDIASERVICE-LIB} SHARED ${SRCS}) 
91 TARGET_LINK_LIBRARIES(${MEDIASERVICE-LIB} ${pkgs_LDFLAGS} ${MEDIASERVICE-HASH-LIB})
92 SET_TARGET_PROPERTIES(${MEDIASERVICE-LIB} PROPERTIES SOVERSION ${VERSION_MAJOR})
93 SET_TARGET_PROPERTIES(${MEDIASERVICE-LIB} PROPERTIES VERSION ${VERSION})
94 ADD_LIBRARY(${MEDIACONTENT-PLUGIN-LIB} SHARED ${CONTENTPLUGIN_SRCS})
95 TARGET_LINK_LIBRARIES(${MEDIACONTENT-PLUGIN-LIB} ${MEDIASERVICE-LIB})
96 SET_TARGET_PROPERTIES(${MEDIACONTENT-PLUGIN-LIB} PROPERTIES SOVERSION ${VERSION_MAJOR})
97 SET_TARGET_PROPERTIES(${MEDIACONTENT-PLUGIN-LIB} PROPERTIES VERSION ${VERSION})
98
99 INSTALL(TARGETS ${MEDIASERVICE-LIB} LIBRARY DESTINATION ${LIB_INSTALL_DIR})
100 INSTALL(TARGETS ${MEDIASERVICE-HASH-LIB} LIBRARY DESTINATION ${LIB_INSTALL_DIR})
101 INSTALL(TARGETS ${MEDIACONTENT-PLUGIN-LIB} LIBRARY DESTINATION ${LIB_INSTALL_DIR})
102
103 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/media-svc.h DESTINATION include/media-service/)
104 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/media-svc-types.h DESTINATION include/media-service/)