summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
blob: 9263e8e423cc810481a4c2ef2627f47b17859bad (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
112
113
114
115
116
117
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
SET(fw_name "maps-plugin-mapquest")
PROJECT(${fw_name} C CXX)

SET(CMAKE_INSTALL_PREFIX /usr)
SET(PREFIX ${CMAKE_INSTALL_PREFIX})

# Dependencies
SET(dependents "glib-2.0 gmodule-2.0 dlog libcurl capi-network-connection json-glib-1.0 capi-maps-service")

INCLUDE(FindPkgConfig)
pkg_check_modules(pkgs REQUIRED ${dependents})
FOREACH(flag ${pkgs_CFLAGS})
    SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
    SET(EXTRA_CXXFLAGS "${EXTRA_CFLAGS} ${flag}")
ENDFOREACH(flag)


# Build
SET(CMAKE_INSTALL_PREFIX /usr)
SET(PREFIX ${CMAKE_INSTALL_PREFIX})

SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fvisibility=hidden -fPIC -Wall -Werror")
SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpie ${EXTRA_CFLAGS} -Wall -g -fPIC -std=c++0x -fvisibility=hidden")

IF("${ARCH}" STREQUAL "arm")
    ADD_DEFINITIONS("-DTARGET")
ENDIF("${ARCH}" STREQUAL "arm")

ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
ADD_DEFINITIONS("-DEXPORT_API=__attribute__((visibility(\"default\")))")
ADD_DEFINITIONS("-DTIZEN_DEBUG")

SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib")


# Include files
# Maps Service Includes
SET(INC_DIR
	include
)

# Maps Service Implementation
SET(INTERNAL_INC_DIR
	src
)

# Mapquest Engine Implementation
SET(ENGINE_INC_DIR
	src/mapquest
)
INCLUDE_DIRECTORIES(
${INC_DIR} ${INTERNAL_INC_DIR} ${ENGINE_INC_DIR}
)

#This file must be corrected

# Source Lists
SET(SRCS
	# Maps API
	src/mapquest_plugin.c

	# Mapquest Engine
	src/mapquest/mapquest_api.c
	src/mapquest/mapquest_geocode.c
	src/mapquest/mapquest_revgeocode.c
	src/mapquest/mapquest_route.c
	src/mapquest/mapquest_place.c
	src/mapquest/mapquest_restcurl.c
	src/mapquest/mapquest_jsonparser.c
	src/mapquest/mapquest_queue.c
	src/mapquest/mapquest_util.c
)

ADD_LIBRARY(${fw_name} SHARED ${SRCS})

SET_TARGET_PROPERTIES(${fw_name}
	PROPERTIES
    VERSION ${FULLVER}
    SOVERSION ${MAJORVER}
    CLEAN_DIRECT_OUTPUT 1
)

TARGET_LINK_LIBRARIES(${fw_name} ${pkgs_LDFLAGS})

SET(PC_NAME ${fw_name})
SET(PC_DESCRIPTION "Tizen mpaquest plugin Library")
SET(PC_LDFLAGS -l${fw_name})
SET(PC_INCLUDE /usr/include/maps)

CONFIGURE_FILE(
	${fw_name}.pc.in
	${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc
	@ONLY
)

# Install
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION lib/pkgconfig)
INSTALL(TARGETS ${fw_name} DESTINATION lib/maps/plugins)

#INCLUDE(FindPkgConfig)
#pkg_check_modules(lib_pkgs REQUIRED
#		capi-maps-service
#)

SET(LIB_APP_ASSIST capi-maps-service)
INSTALL(
	DIRECTORY ${INC_DIR}/ DESTINATION include/mapquest-plugin
    FILES_MATCHING
    PATTERN "*_internal.h" EXCLUDE
    PATTERN "${INC_DIR}/mapquest_*.h"
)

# Test Suite
#IF("${BINTYPE}" STREQUAL "eng")
#ENDIF("${BINTYPE}" STREQUAL "eng")