summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
blob: 77e1777291b32d0c91b31b38d73680e1a4657c6d (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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
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
	)
SET(HASH_SRCS
	md5/md5.c
	md5/media-thumb-hash.c
	)

SET(THUMB-SERVER
        src/codec/IfegDecodeAGIF.c
        src/codec/img-codec.c
        src/codec/img-codec-osal.c
        src/codec/img-codec-parser.c
        src/util/media-thumb-db.c
	src/media-thumb-internal.c
	server/thumb-server.c
	server/thumb-server-internal.c)
#SET(TEST-THUMB test/test-thumb.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)

IF ( TIZEN_W )
pkg_check_modules(pkgs REQUIRED glib-2.0 gthread-2.0 dlog mm-fileinfo drm-client aul libexif ecore-evas evas mmutil-imgp mmutil-jpeg libmedia-utils vconf dbus-glib-1 deviced)
ELSE ( TIZEN_W )
pkg_check_modules(pkgs REQUIRED glib-2.0 gthread-2.0 dlog mm-fileinfo drm-client aul libexif ecore-evas evas mmutil-imgp mmutil-jpeg libmedia-utils vconf dbus-glib-1 pmapi)
ENDIF ( TIZEN_W )

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")
IF ( TIZEN_W )
ADD_DEFINITIONS("-DTIZEN_W")
ENDIF ( TIZEN_W )

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_EXECUTABLE(media-thumbnail-server ${THUMB-SERVER})
TARGET_LINK_LIBRARIES(media-thumbnail-server ${pkgs_LDFLAGS} ${MEDIATHUMB-LIB} )
INSTALL(TARGETS media-thumbnail-server DESTINATION ${BINDIR})

#ADD_EXECUTABLE(test-thumb ${TEST-THUMB})
#TARGET_LINK_LIBRARIES(test-thumb ${pkgs_LDFLAGS} ${MEDIATHUMB-LIB} )
#INSTALL(TARGETS test-thumb DESTINATION ${LOCALBINDIR})

INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/media-thumbnail.h DESTINATION include/${MEDIATHUMB-LIB})
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/media-thumbnail-private.h DESTINATION include/${MEDIATHUMB-LIB})
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/media-thumb-error.h DESTINATION include/${MEDIATHUMB-LIB})
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/media-thumb-types.h DESTINATION include/${MEDIATHUMB-LIB})
#INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/thumbsvr DESTINATION /etc/init.d)