summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
blob: da195901010d9eddd6c9a804c421a6f34559a86f (plain)
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
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(media-thumbnail C)
SET(VERSION_MAJOR 1)
SET(VERSION "${VERSION_MAJOR}.0.0")

SET(MEDIATHUMB-LIB "media-thumbnail")
SET(MEDIAHASH-LIB "media-hash")
SET(SRCS
	src/media-thumbnail.c
	src/util/media-thumb-debug.c
	src/util/media-thumb-util.c
	src/ipc/media-thumb-ipc.c
	src/codec/IfegDecodeAGIF.c
	src/codec/img-codec.c
	src/codec/img-codec-osal.c
	src/codec/img-codec-parser.c
	)
SET(HASH_SRCS
	md5/md5.c
	md5/media-thumb-hash.c
	)

SET(VENDOR "samsung")
SET(PACKAGE ${PROJECT_NAME})
SET(PKGNAME "com.${VENDOR}.${PACKAGE}")
SET(PREFIX ${CMAKE_INSTALL_PREFIX})
SET(BINDIR "${PREFIX}/bin")
SET(LOCALBINDIR "${PREFIX}/local/bin")
SET(DATADIR "${PREFIX}/share")
SET(EXEC_PREFIX "\${prefix}")
SET(LIBDIR "\${prefix}/lib")
SET(INCLUDEDIR "\${prefix}/include")

IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
	SET(CMAKE_BUILD_TYPE "Release")
ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")

INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src/include ${CMAKE_SOURCE_DIR}/src/include/util ${CMAKE_SOURCE_DIR}/src/include/codec ${CMAKE_SOURCE_DIR}/src/include/util ${CMAKE_SOURCE_DIR}/src/include/ipc ${CMAKE_SOURCE_DIR}/server/include ${CMAKE_SOURCE_DIR}/md5)

INCLUDE(FindPkgConfig)
	pkg_check_modules(pkgs REQUIRED glib-2.0 gthread-2.0 dlog sqlite3 mm-fileinfo aul libexif ecore-evas evas mmutil-imgp mmutil-jpeg libmedia-utils vconf dbus-glib-1 deviced)

FOREACH(flag ${pkgs_CFLAGS})
	SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
ENDFOREACH(flag)

SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Werror")
SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
SET(CMAKE_C_FLAGS_RELEASE "-O2 -fPIC")

FIND_PROGRAM(UNAME NAMES uname)
EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH")
IF("${ARCH}" STREQUAL "arm")
	ADD_DEFINITIONS("-DTARGET")
	MESSAGE("add -DTARGET")
ENDIF("${ARCH}" STREQUAL "arm")

ADD_DEFINITIONS("-DVENDOR=\"${VENDOR}\"")
ADD_DEFINITIONS("-DPACKAGE=\"${PACKAGE}\"")
ADD_DEFINITIONS("-DPACKAGE_NAME=\"${PKGNAME}\"")
ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"")
#ADD_DEFINITIONS("-D_PERFORMANCE_CHECK_")
ADD_DEFINITIONS("-D_FILE_OFFSET_BITS=64")

SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--hash-style=both")
CONFIGURE_FILE(media-thumbnail.pc.in media-thumbnail.pc @ONLY)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/media-thumbnail.pc DESTINATION lib/pkgconfig)

LINK_DIRECTORIES(lib)

ADD_LIBRARY(${MEDIAHASH-LIB} SHARED ${HASH_SRCS})
SET_TARGET_PROPERTIES(${MEDIAHASH-LIB} PROPERTIES SOVERSION ${VERSION_MAJOR})
SET_TARGET_PROPERTIES(${MEDIAHASH-LIB} PROPERTIES VERSION ${VERSION})
ADD_LIBRARY(${MEDIATHUMB-LIB} SHARED ${SRCS})
TARGET_LINK_LIBRARIES(${MEDIATHUMB-LIB} ${pkgs_LDFLAGS} ${MEDIAHASH-LIB})
SET_TARGET_PROPERTIES(${MEDIATHUMB-LIB} PROPERTIES SOVERSION ${VERSION_MAJOR})
SET_TARGET_PROPERTIES(${MEDIATHUMB-LIB} PROPERTIES VERSION ${VERSION})

INSTALL(TARGETS ${MEDIATHUMB-LIB} LIBRARY DESTINATION lib)
INSTALL(TARGETS ${MEDIAHASH-LIB} LIBRARY DESTINATION lib)

ADD_SUBDIRECTORY(server)
ADD_SUBDIRECTORY(test)

INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/media-thumbnail.h DESTINATION include/${MEDIATHUMB-LIB})
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/include/codec/img-codec-parser.h DESTINATION include/${MEDIATHUMB-LIB})
#INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/thumbsvr DESTINATION /etc/init.d)