1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
2 PROJECT(media-service C)
4 SET(VERSION "${VERSION_MAJOR}.0.0")
6 SET(MEDIASERVICE-LIB "media-service")
7 SET(MEDIASERVICE-HASH-LIB "media-svc-hash")
8 SET(MEDIACONTENT-PLUGIN-LIB "media-content-plugin")
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
28 plugin/media-svc-plugin.c
30 SET(CONTENTPLUGIN_SRCS
31 plugin/media-content-plugin.c
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")
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}")
49 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src/include/common ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/uuid ${CMAKE_SOURCE_DIR}/md5)
51 FIND_PROGRAM(UNAME NAMES uname)
52 EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH")
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)
58 FOREACH(flag ${pkgs_CFLAGS})
59 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
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")
66 IF("${ARCH}" STREQUAL "arm")
67 ADD_DEFINITIONS("-DTARGET")
68 MESSAGE("add -DTARGET")
69 ENDIF("${ARCH}" STREQUAL "arm")
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_")
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)
83 #ADD_SUBDIRECTORY(test)
85 LINK_DIRECTORIES(${LIB_INSTALL_DIR})
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})
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})
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/)