summaryrefslogtreecommitdiff
path: root/src/addressbook/libebook-contacts/CMakeLists.txt
blob: c4fdd87cd3979842e0a407cb51baf8d5d228b59a (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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
glib_mkenums(e-book-contacts-enumtypes e-book-contacts-enums.h E_BOOK_CONTACTS_ENUMTYPES_H)

add_pkgconfig_file(libebook-contacts.pc.in libebook-contacts-${API_VERSION}.pc)

add_executable(gen-western-table
	gen-western-table.c
)

target_compile_definitions(gen-western-table PRIVATE
	-DG_LOG_DOMAIN=\"gen-western-table\"
)

target_compile_options(gen-western-table PUBLIC
	${GNOME_PLATFORM_CFLAGS}
)

target_include_directories(gen-western-table PUBLIC
	${CMAKE_BINARY_DIR}
	${GNOME_PLATFORM_INCLUDE_DIRS}
)

target_link_libraries(gen-western-table
	${GNOME_PLATFORM_LDFLAGS}
)

add_custom_command(
	OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/e-name-western-tables.h
	COMMAND ${CMAKE_CURRENT_BINARY_DIR}/gen-western-table "${CMAKE_CURRENT_SOURCE_DIR}/e-name-western-tables.h.in" >${CMAKE_CURRENT_BINARY_DIR}/e-name-western-tables.h
	DEPENDS gen-western-table e-name-western-tables.h.in
)

set(DEPENDENCIES
	camel
	edataserver
)

set(SOURCES
	e-address-western.c
	e-book-contacts-utils.c
	e-book-query.c
	e-contact.c
	e-name-western.c
	e-phone-number.c
	e-phone-number-private.h
	e-source-backend-summary-setup.c
	e-vcard.c
	${CMAKE_CURRENT_BINARY_DIR}/e-book-contacts-enumtypes.c
	${CMAKE_CURRENT_BINARY_DIR}/e-name-western-tables.h
)

set(HEADERS
	libebook-contacts.h
	e-address-western.h
	e-book-contacts-enums.h
	e-book-contacts-utils.h
	e-book-query.h
	e-contact.h
	e-name-western.h
	e-phone-number.h
	e-source-backend-summary-setup.h
	e-vcard.h
	${CMAKE_CURRENT_BINARY_DIR}/e-book-contacts-enumtypes.h
)

if(ENABLE_PHONENUMBER)
	# We put the C++ code into a separate static library, so that we can use
	# the C linker for libebook-contacts. This avoids that libebook-contacts
	# depends on the C++ Standard Library, even if phone number support is
	# disabled.

	add_library(ephonenumber-private STATIC
		e-phone-number-private.cpp
	)

	target_compile_definitions(ephonenumber-private PRIVATE
		-DG_LOG_DOMAIN=\"e-phone-number\"
		-DLIBEBOOK_CONTACTS_COMPILATION
		${PHONENUMBER_DEFINITIONS}
	)

	target_compile_options(ephonenumber-private PUBLIC
		${ADDRESSBOOK_CFLAGS}
	)

	target_include_directories(ephonenumber-private PUBLIC
		${CMAKE_BINARY_DIR}
		${CMAKE_BINARY_DIR}/src
		${CMAKE_CURRENT_BINARY_DIR}
		${ADDRESSBOOK_INCLUDE_DIRS}
		${PHONENUMBER_INCLUDE_DIRS}
	)

	target_link_libraries(ephonenumber-private
		${ADDRESSBOOK_LDFLAGS}
		${PHONENUMBER_LDFLAGS}
	)

	list(APPEND DEPENDENCIES
		ephonenumber-private
	)
endif(ENABLE_PHONENUMBER)

add_library(ebook-contacts SHARED
	${SOURCES}
	${HEADERS}
)

add_dependencies(ebook-contacts
	${DEPENDENCIES}
)

set_target_properties(ebook-contacts PROPERTIES
	VERSION "${LIBEBOOK_CONTACTS_CURRENT}.${LIBEBOOK_CONTACTS_REVISION}.${LIBEBOOK_CONTACTS_AGE}"
	SOVERSION ${LIBEBOOK_CONTACTS_CURRENT}
	OUTPUT_NAME ebook-contacts-${API_VERSION}
)

target_compile_definitions(ebook-contacts PRIVATE
	-DG_LOG_DOMAIN=\"libebook-contacts\"
	-DLOCALEDIR=\"${LOCALE_INSTALL_DIR}\"
	-DLIBEBOOK_CONTACTS_COMPILATION
)

target_compile_options(ebook-contacts PUBLIC
	${ADDRESSBOOK_CFLAGS}
)

target_include_directories(ebook-contacts PUBLIC
	${CMAKE_BINARY_DIR}
	${CMAKE_BINARY_DIR}/src
	${CMAKE_BINARY_DIR}/src/addressbook
	${CMAKE_BINARY_DIR}/src/private
	${CMAKE_SOURCE_DIR}/src
	${CMAKE_SOURCE_DIR}/src/private
	${CMAKE_SOURCE_DIR}/src/addressbook
	${CMAKE_CURRENT_BINARY_DIR}
	${CMAKE_CURRENT_SOURCE_DIR}
	${ADDRESSBOOK_INCLUDE_DIRS}
)

target_link_libraries(ebook-contacts
	${DEPENDENCIES}
	${ADDRESSBOOK_LDFLAGS}
)

install(TARGETS ebook-contacts
	DESTINATION ${LIB_INSTALL_DIR}
)

install(FILES ${HEADERS}
	DESTINATION ${privincludedir}/libebook-contacts
)

set(gir_sources ${SOURCES} ${HEADERS})
set(gir_identifies_prefixes E)
set(gir_includes GObject-2.0 GLib-2.0 Gio-2.0 libxml2-2.0)
set(gir_cflags
	-DLIBEBOOK_CONTACTS_COMPILATION
	-I${CMAKE_BINARY_DIR}/src/addressbook
	-I${CMAKE_BINARY_DIR}/src/addressbook/libebook-contacts
	-I${CMAKE_SOURCE_DIR}/src/addressbook
	-I${CMAKE_SOURCE_DIR}/src/addressbook/libebook-contacts
)
set(gir_libdirs
	${CMAKE_BINARY_DIR}/src/private
	${CMAKE_BINARY_DIR}/src/camel
	${CMAKE_BINARY_DIR}/src/libedataserver
	${PHONENUMBER_LIB_DIRS}
)
set(gir_libs
	ebook-contacts
	edataserver
)
set(gir_deps
	${CMAKE_BINARY_DIR}/src/camel/Camel-${API_VERSION}.gir
	${CMAKE_BINARY_DIR}/src/libedataserver/EDataServer-${API_VERSION}.gir
)

gir_add_introspection_simple(
	EBookContacts
	libebook-contacts
	${API_VERSION}
	"libebook-contacts/libebook-contacts.h"
	gir_identifies_prefixes
	gir_includes
	gir_cflags
	gir_libdirs
	gir_libs
	gir_deps
	gir_sources
)