27eab50558c3702743d9e7927fa77ff35ea49d5f
[framework/pim/contacts-service.git] / CMakeLists.txt
1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
2 PROJECT(contacts-service C)
3
4 #IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
5 #       SET(CMAKE_BUILD_TYPE "Release")
6 #ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
7 #MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
8
9 SET(DEST_INCLUDE_DIR "include/contacts-svc")
10 SET(SRC_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/include")
11
12 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
13 SET(EXEC_PREFIX "\${prefix}")
14 SET(LIBDIR "\${prefix}/lib")
15 SET(INCLUDEDIR "\${prefix}/${DEST_INCLUDE_DIR}")
16 SET(VERSION_MAJOR 0)
17 SET(VERSION "${VERSION_MAJOR}.6.12")
18
19 EXECUTE_PROCESS(COMMAND build-util/generator.sh)
20
21 #INCLUDE_DIRECTORIES(${SRC_INCLUDE_DIR})
22 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -I${SRC_INCLUDE_DIR}")
23
24 FILE(GLOB SRCS src/*.c)
25
26 INCLUDE(FindPkgConfig)
27 pkg_check_modules(pkgs REQUIRED glib-2.0 sqlite3 vconf dlog db-util)
28
29 FOREACH(flag ${pkgs_CFLAGS})
30         SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
31 ENDFOREACH(flag)
32
33 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden")
34
35 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
36 #SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
37 #SET(CMAKE_C_FLAGS_RELEASE "-mabi=aapcs-linux -march=armv7-a -msoft-float -O2")
38
39 ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"")
40
41 ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
42 SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR})
43 SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION})
44 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} -lpthread)
45
46 CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
47 SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES
48         "${PROJECT_NAME}.pc;include/contacts-svc-sub.h;include/contacts-svc.h;include/contacts-svc-struct.h;helper/schema.h")
49
50 INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib)
51 INSTALL(FILES ${PROJECT_NAME}.pc DESTINATION lib/pkgconfig)
52
53 FILE(GLOB HEADER_FILES ${SRC_INCLUDE_DIR}/contacts-svc*.h)
54 INSTALL(FILES ${HEADER_FILES} DESTINATION ${DEST_INCLUDE_DIR})
55 INSTALL(FILES ${SRC_INCLUDE_DIR}/ContactsService_PG.h DESTINATION ${DEST_INCLUDE_DIR})
56
57 FILE(GLOB NOTI_FILES ${CMAKE_SOURCE_DIR}/res/.CONTACTS_SVC_*)
58 INSTALL(FILES ${NOTI_FILES} DESTINATION /opt/data/contacts-svc
59                 PERMISSIONS OWNER_WRITE OWNER_READ GROUP_WRITE GROUP_READ)
60
61 INSTALL(DIRECTORY DESTINATION /opt/data/contacts-svc/img/vcard)
62 INSTALL(DIRECTORY DESTINATION /opt/data/contacts-svc/img/my)
63 INSTALL(DIRECTORY DESTINATION /opt/data/contacts-svc/img/group)
64
65 ADD_SUBDIRECTORY(helper)
66