summaryrefslogtreecommitdiff
path: root/src/agent/CMakeLists.txt
blob: 955fa10e67535fac0cc73c28b6c495fba941b632 (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(downloadagent C)

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

SET(PREFIX ${CMAKE_INSTALL_PREFIX})
SET(VERSION "0.0.1")
FIND_PROGRAM(UNAME NAMES uname)
EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH")

#DA Engine Include Directory
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/include)

INCLUDE(FindPkgConfig)
pkg_check_modules(subpkgs REQUIRED
	libsoup-2.4
	xdgmime
	vconf
	capi-network-connection
	glib-2.0
	dlog
)

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

SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Wall")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
SET(CMAKE_C_FLAGS_DEBUG "-O0 -g -Wall")
SET(CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed -Wl,--hash-style=both")

IF("${ARCH}" MATCHES "^arm.*")
	ADD_DEFINITIONS("-D_TARGET")
	SET(CMAKE_C_FLAGS_RELEASE "-mabi=aapcs-linux -msoft-float -O2")
ENDIF("${ARCH}" MATCHES "^arm.*")

ADD_DEFINITIONS("-D_EFL_PLATFORM")
#allow to install widget, deb pkg and apk for testing
ADD_DEFINITIONS("-DDA_DEBUG_USING_DLOG")
#This should be removed when release a target
ADD_DEFINITIONS("-D_SAMSUNG_MIME_POLICY")

#############################################################################
#+++++++++++++++++++++++++DA ENGINE+++++++++++++++++++++++++++++++++++++++++++
#############################################################################

SET(SRCS_PATH ".")
SET(SRCS_DA_ENGINE
        ${SRCS_PATH}/download-agent-debug.c
        ${SRCS_PATH}/download-agent-interface.c
        ${SRCS_PATH}/download-agent-client-mgr.c
        ${SRCS_PATH}/download-agent-dl-mgr.c
        ${SRCS_PATH}/download-agent-dl-info-util.c
        ${SRCS_PATH}/download-agent-http-queue.c
        ${SRCS_PATH}/download-agent-http-misc.c
        ${SRCS_PATH}/download-agent-http-mgr.c
        ${SRCS_PATH}/download-agent-http-msg-handler.c
        ${SRCS_PATH}/download-agent-encoding.c
        ${SRCS_PATH}/download-agent-utils.c
        ${SRCS_PATH}/download-agent-utils-dl-req-id-history.c
        ${SRCS_PATH}/download-agent-basic.c
        ${SRCS_PATH}/download-agent-installation.c
        ${SRCS_PATH}/download-agent-file.c
        ${SRCS_PATH}/download-agent-plugin-libsoup.c
        ${SRCS_PATH}/download-agent-plugin-conf.c
        ${SRCS_PATH}/download-agent-plugin-install.c
        ${SRCS_PATH}/download-agent-mime-util.c
)

SET(HEADERS
	include/download-agent-defs.h
	include/download-agent-interface.h
)

ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS_DA_ENGINE})
#TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${subpkgs_LDFLAGS} "-ldl")
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${subpkgs_LDFLAGS})
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION 0.0.1)

#############################################################################
#+++++++++++++++++++++++++INSTALLATION++++++++++++++++++++++++++++++++++++++++
#############################################################################

INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib COMPONENT RuntimeLibraries)