summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
blob: 27eab50558c3702743d9e7927fa77ff35ea49d5f (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
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(contacts-service C)

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

SET(DEST_INCLUDE_DIR "include/contacts-svc")
SET(SRC_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/include")

SET(PREFIX ${CMAKE_INSTALL_PREFIX})
SET(EXEC_PREFIX "\${prefix}")
SET(LIBDIR "\${prefix}/lib")
SET(INCLUDEDIR "\${prefix}/${DEST_INCLUDE_DIR}")
SET(VERSION_MAJOR 0)
SET(VERSION "${VERSION_MAJOR}.6.12")

EXECUTE_PROCESS(COMMAND build-util/generator.sh)

#INCLUDE_DIRECTORIES(${SRC_INCLUDE_DIR})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -I${SRC_INCLUDE_DIR}")

FILE(GLOB SRCS src/*.c)

INCLUDE(FindPkgConfig)
pkg_check_modules(pkgs REQUIRED glib-2.0 sqlite3 vconf dlog db-util)

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

SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden")

SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
#SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
#SET(CMAKE_C_FLAGS_RELEASE "-mabi=aapcs-linux -march=armv7-a -msoft-float -O2")

ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"")

ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR})
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} -lpthread)

CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES
	"${PROJECT_NAME}.pc;include/contacts-svc-sub.h;include/contacts-svc.h;include/contacts-svc-struct.h;helper/schema.h")

INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib)
INSTALL(FILES ${PROJECT_NAME}.pc DESTINATION lib/pkgconfig)

FILE(GLOB HEADER_FILES ${SRC_INCLUDE_DIR}/contacts-svc*.h)
INSTALL(FILES ${HEADER_FILES} DESTINATION ${DEST_INCLUDE_DIR})
INSTALL(FILES ${SRC_INCLUDE_DIR}/ContactsService_PG.h DESTINATION ${DEST_INCLUDE_DIR})

FILE(GLOB NOTI_FILES ${CMAKE_SOURCE_DIR}/res/.CONTACTS_SVC_*)
INSTALL(FILES ${NOTI_FILES} DESTINATION /opt/data/contacts-svc
		PERMISSIONS OWNER_WRITE OWNER_READ GROUP_WRITE GROUP_READ)

INSTALL(DIRECTORY DESTINATION /opt/data/contacts-svc/img/vcard)
INSTALL(DIRECTORY DESTINATION /opt/data/contacts-svc/img/my)
INSTALL(DIRECTORY DESTINATION /opt/data/contacts-svc/img/group)

ADD_SUBDIRECTORY(helper)