2 # Communication modules for pkg-mgr client lib and server process
3 # By Youmin Ha <youmin.ha@samsung.com>
5 cmake_minimum_required(VERSION 2.6)
6 #set(CMAKE_SKIP_BUILD_RPATH true)
7 set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
12 if(DEFINED ${VERSION})
13 message("VERSION: ${VERSION}")
15 message("VERSION is not defined. set it as 0.1.0")
18 if(DEFINED ${VERSION_MAJOR})
19 message("VERSION_MAJOR: ${VERSION_MAJOR}")
21 message( "VERSION_MAJOR is not defined. set it as 0")
24 message(STATUS "version/major : ${VERSION} / ${VERSION_MAJOR}")
26 ### Define tizen version for db version
27 if(DEFINED TIZEN_MAJOR_VER)
28 ADD_DEFINITIONS("-DTIZEN_MAJOR_VER=\"${TIZEN_MAJOR_VER}\"")
30 message("TIZEN_MAJOR_VER is not defined. set it to 0")
31 ADD_DEFINITIONS("-DTIZEN_MAJOR_VER=\"0\"")
34 if(DEFINED TIZEN_MINOR_VER)
35 ADD_DEFINITIONS("-DTIZEN_MINOR_VER=\"${TIZEN_MINOR_VER}\"")
37 message("TIZEN_MINOR_VER is not defined. set it to 0")
38 ADD_DEFINITIONS("-DTIZEN_MINOR_VER=\"0\"")
41 if(DEFINED TIZEN_PATCH_VER)
42 ADD_DEFINITIONS("-DTIZEN_PATCH_VER=\"${TIZEN_PATCH_VER}\"")
44 message("TIZEN_PATCH_VER is not defined. set it to 0")
45 ADD_DEFINITIONS("-DTIZEN_PATCH_VER=\"${TIZEN_PATCH_VER}\"")
48 ### Get required CFLAGS, LDFLAGS from pkg-config
50 include(FindPkgConfig)
51 pkg_check_modules(parser_pkgs REQUIRED dlog libxml-2.0 glib-2.0 sqlite3 db-util vconf bundle capi-system-info libsmack)
53 foreach(flag ${parser_pkgs_CFLAGS})
54 set(parser_pkgs_CFLAGS_str "${parser_pkgs_CFLAGS_str} ${flag}")
56 ADD_DEFINITIONS("-DLIB_PATH=\"${LIB_INSTALL_DIR}\"")
58 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden")
59 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g -Wall -Wno-deprecated-declarations")
60 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
62 add_definitions("-DSYSCONFDIR=\"${SYSCONFDIR}\"")
63 ### Set current binary dir to be included (for generated *.h files)
64 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
68 # This library is for installer backend
69 AUX_SOURCE_DIRECTORY(src SRCS)
70 add_library(pkgmgr_parser SHARED ${SRCS})
71 set_target_properties(pkgmgr_parser PROPERTIES SOVERSION ${VERSION_MAJOR})
72 set_target_properties(pkgmgr_parser PROPERTIES VERSION ${VERSION})
73 set_target_properties(pkgmgr_parser PROPERTIES COMPILE_FLAGS "${parser_pkgs_CFLAGS_str}")
74 target_link_libraries(pkgmgr_parser ${parser_pkgs_LDFLAGS})
77 configure_file(pkgmgr-parser.pc.in ${CMAKE_CURRENT_BINARY_DIR}/pkgmgr-parser.pc @ONLY)
78 configure_file(manifest.xsd.in manifest.xsd @ONLY)
79 configure_file(xml.xsd.in xml.xsd @ONLY)
82 INSTALL(TARGETS pkgmgr_parser DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
83 INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION include/pkgmgr
84 PATTERN "*_internal.h" EXCLUDE)
85 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/pkgmgr-parser.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
86 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/manifest.xsd DESTINATION ${SYSCONFDIR}/package-manager/preload/)
87 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/xml.xsd DESTINATION ${SYSCONFDIR}/package-manager/preload/)