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