• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1project(bus)
2
3add_definitions(-DDBUS_COMPILATION)
4
5SET(EFENCE "")
6SET(BUS_DIR ${CMAKE_SOURCE_DIR}/../bus)
7
8set (config_DATA
9	session.conf
10	system.conf
11)
12
13# config files for installation
14FOREACH(file ${config_DATA})
15	CONFIGURE_FILE( "${CMAKE_CURRENT_SOURCE_DIR}/${file}.cmake" "${CMAKE_CURRENT_BINARY_DIR}/${file}" IMMEDIATE @ONLY)
16ENDFOREACH(file)
17
18# copy services for local daemon start to local service dir data/dbus-1/services
19SET (SERVICE_FILES test/data/valid-service-files)
20FILE(GLOB FILES "${CMAKE_SOURCE_DIR}/../${SERVICE_FILES}/*.service.in" )
21FOREACH(FILE ${FILES})
22	GET_FILENAME_COMPONENT(FILENAME ${FILE} NAME_WE)
23	SET (TARGET ${CMAKE_BINARY_DIR}/data/dbus-1/services/${FILENAME}.service)
24	IF (CONFIG_VERBOSE)
25		MESSAGE("FROM: ${FILE}\nTO: ${TARGET}\n")
26	ENDIF (CONFIG_VERBOSE)
27	configure_file(${FILE} ${TARGET} )
28ENDFOREACH(FILE)
29
30if(DBUS_USE_EXPAT)
31    SET (XML_SOURCES ${BUS_DIR}/config-loader-expat.c)
32else(DBUS_USE_EXPAT)
33    SET (XML_SOURCES ${BUS_DIR}/config-loader-libxml.c)
34endif (DBUS_USE_EXPAT)
35
36# after next cvs update
37#set (DIR_WATCH_SOURCE ${BUS_DIR}/dir-watch-default.c)
38set (DIR_WATCH_SOURCE )
39
40set (BUS_SOURCES
41	${BUS_DIR}/activation.c
42	${BUS_DIR}/activation.h
43	${BUS_DIR}/bus.c
44	${BUS_DIR}/bus.h
45	${BUS_DIR}/config-parser.c
46	${BUS_DIR}/config-parser.h
47    ${BUS_DIR}/config-parser-common.c
48    ${BUS_DIR}/config-parser-common.h
49#    ${BUS_DIR}/config-parser-trivial.c
50	${BUS_DIR}/connection.c
51	${BUS_DIR}/connection.h
52	${BUS_DIR}/desktop-file.c
53	${BUS_DIR}/desktop-file.h
54	${BUS_DIR}/dir-watch-default.c
55	${BUS_DIR}/dir-watch.h
56	${BUS_DIR}/dispatch.c
57	${BUS_DIR}/dispatch.h
58	${BUS_DIR}/driver.c
59	${BUS_DIR}/driver.h
60	${BUS_DIR}/expirelist.c
61	${BUS_DIR}/expirelist.h
62	${BUS_DIR}/policy.c
63	${BUS_DIR}/policy.h
64	${BUS_DIR}/selinux.h
65	${BUS_DIR}/selinux.c
66	${BUS_DIR}/services.c
67	${BUS_DIR}/services.h
68	${BUS_DIR}/signals.c
69	${BUS_DIR}/signals.h
70	${BUS_DIR}/test.c
71	${BUS_DIR}/test.h
72	${BUS_DIR}/utils.c
73	${BUS_DIR}/utils.h
74	${XML_SOURCES}
75	${DIR_WATCH_SOURCE}
76)
77
78include_directories(${XML_INCLUDE_DIR})
79
80add_executable(dbus-daemon ${BUS_SOURCES} ${BUS_DIR}/main.c)
81target_link_libraries(dbus-daemon ${DBUS_INTERNAL_LIBRARIES} ${XML_LIBRARY})
82set_target_properties(dbus-daemon PROPERTIES OUTPUT_NAME ${DBUS_DAEMON_NAME})
83set_target_properties(dbus-daemon PROPERTIES COMPILE_FLAGS ${DBUS_INTERNAL_CLIENT_DEFINITIONS})
84
85install_targets(/bin dbus-daemon)
86install_files(/etc/dbus-1 FILES ${config_DATA})
87
88if (DBUS_SERVICE)
89	set (dbus_service_SOURCES
90		${BUS_DIR}/bus-service-win.c
91	# TODO: add additional files
92	#	${BUS_DIR}/service-main.c
93	#	${BUS_SOURCES}
94	)
95
96	add_executable(dbus-service ${dbus_service_SOURCES} )
97	target_link_libraries(dbus-service ${DBUS_INTERNAL_LIBRARIES} ${XML_LIBRARY})
98	set_target_properties(dbus-service PROPERTIES COMPILE_FLAGS ${DBUS_INTERNAL_CLIENT_DEFINITIONS})
99	install_targets(/bin dbus-service )
100endif (DBUS_SERVICE)
101
102if (DBUS_BUILD_TESTS)
103	add_executable(bus-test ${BUS_SOURCES} ${BUS_DIR}/test-main.c)
104	target_link_libraries(bus-test ${DBUS_INTERNAL_LIBRARIES} ${XML_LIBRARY})
105	set_target_properties(bus-test PROPERTIES COMPILE_FLAGS ${DBUS_INTERNAL_CLIENT_DEFINITIONS})
106	add_test(bus-test ${EXECUTABLE_OUTPUT_PATH}/bus-test ${CMAKE_BINARY_DIR}/test/data)
107endif (DBUS_BUILD_TESTS)
108
109if(MSVC)
110	project_source_group(${GROUP_CODE} bus_test_SOURCES dummy)
111endif(MSVC)
112
113## mop up the gcov files
114#clean-local:
115#	/bin/rm *.bb *.bbg *.da *.gcov || true
116
117#install-data-hook:
118#	$(mkinstalldirs) $(DESTDIR)/$(localstatedir)/run/dbus
119#	$(mkinstalldirs) $(DESTDIR)/$(configdir)/system.d
120#	$(mkinstalldirs) $(DESTDIR)/$(datadir)/dbus-1/services
121
122##install_file(${configdir}/system.d FILE
123
124
125set(LAUNCH_HELPER_SOURCES ${XML_SOURCES}
126    ${BUS_DIR}/config-parser-common.c
127    ${BUS_DIR}/config-parser-trivial.c
128    ${BUS_DIR}/desktop-file.c
129    ${BUS_DIR}/utils.c
130    ${BUS_DIR}/activation-helper.c
131
132)
133
134if(NOT WIN32)
135# TODO PENDING(kdab) fix build on windows (activation-helper.c)
136   add_executable(dbus-daemon-launch-helper ${LAUNCH_HELPER_SOURCES} ${BUS_DIR}/activation-helper-bin.c )
137   target_link_libraries(dbus-daemon-launch-helper ${DBUS_INTERNAL_LIBRARIES} ${XML_LIBRARY} )
138
139   add_executable(dbus-daemon-launch-helper-test ${LAUNCH_HELPER_SOURCES}     ${BUS_DIR}/activation-helper-bin.c)
140   set_target_properties(dbus-daemon-launch-helper-test PROPERTIES COMPILE_FLAGS "-DACTIVATION_LAUNCHER_TEST")
141   target_link_libraries(dbus-daemon-launch-helper-test ${DBUS_INTERNAL_LIBRARIES} ${XML_LIBRARY} )
142
143   add_executable(bus-test-launch-helper ${LAUNCH_HELPER_SOURCES}  ${BUS_DIR}/test-launch-helper.c)
144   set_target_properties(bus-test-launch-helper PROPERTIES COMPILE_FLAGS "-DACTIVATION_LAUNCHER_TEST -DACTIVATION_LAUNCHER_DO_OOM")
145   target_link_libraries(bus-test-launch-helper ${DBUS_INTERNAL_LIBRARIES} ${XML_LIBRARY} )
146   add_test(bus-test-launch-helper ${EXECUTABLE_OUTPUT_PATH}/bus-test-launch-helper )
147
148endif(NOT WIN32)
149
150#### Init scripts fun
151#SCRIPT_IN_FILES=messagebus.in
152#		rc.messagebus.in
153
154## Red Hat start
155#if DBUS_INIT_SCRIPTS_RED_HAT
156
157#initddir=$(sysconfdir)/rc.d/init.d
158
159#initd_SCRIPTS=
160#	messagebus
161
162#endif
163# ## Red Hat end
164
165## Slackware start
166#if DBUS_INIT_SCRIPTS_SLACKWARE
167
168#initddir=$(sysconfdir)/rc.d/
169
170#initd_SCRIPTS=
171#	rc.messagebus
172
173#endif
174## Slackware end
175
176#MAN_IN_FILES=dbus-daemon.1.in
177#man_MANS = dbus-daemon.1
178
179#### Extra dist
180
181#EXTRA_DIST=$(CONFIG_IN_FILES) $(SCRIPT_IN_FILES) $(man_MANS) $(MAN_IN_FILES)
182