commented bits cleanup
[platform/upstream/dbus.git] / cmake / bus / CMakeLists.txt
1 project(bus)
2
3 add_definitions(-DDBUS_COMPILATION)
4
5 SET(EFENCE "")
6 SET(BUS_DIR ${CMAKE_SOURCE_DIR}/../bus)
7
8 set (config_DATA
9         session.conf                            
10         system.conf
11 )
12
13 # config files for installation 
14 FOREACH(file ${config_DATA})
15         CONFIGURE_FILE( "${CMAKE_CURRENT_SOURCE_DIR}/${file}.cmake" "${CMAKE_CURRENT_BINARY_DIR}/${file}" IMMEDIATE @ONLY)
16 ENDFOREACH(file)
17
18 # copy services for local daemon start to local service dir data/dbus-1/services
19 SET (SERVICE_FILES test/data/valid-service-files)
20 FILE(GLOB FILES "${CMAKE_SOURCE_DIR}/../${SERVICE_FILES}/*.service.in" )
21 FOREACH(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} )
28 ENDFOREACH(FILE)
29
30 if(DBUS_USE_EXPAT)
31     SET (XML_SOURCES ${BUS_DIR}/config-loader-expat.c)
32 else(DBUS_USE_EXPAT)
33     SET (XML_SOURCES ${BUS_DIR}/config-loader-libxml.c)
34 endif (DBUS_USE_EXPAT)
35
36 # after next cvs update
37 #set (DIR_WATCH_SOURCE ${BUS_DIR}/dir-watch-default.c)
38 set (DIR_WATCH_SOURCE )
39
40 set (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
78 include_directories(${XML_INCLUDE_DIR})
79
80 set(DBUS_LIBRARIES dbus-1 dbus-internal)
81
82 add_executable(dbus-daemon ${BUS_SOURCES} ${BUS_DIR}/main.c)
83 target_link_libraries(dbus-daemon ${DBUS_LIBRARIES} ${XML_LIBRARY})
84 if(WIN32 AND NOT DBUS_DISABLE_EXECUTABLE_DEBUG_POSTFIX)
85     set_target_properties(dbus-daemon PROPERTIES DEBUG_POSTFIX "d")
86 endif(WIN32 AND NOT DBUS_DISABLE_EXECUTABLE_DEBUG_POSTFIX)
87
88 install_targets(/bin dbus-daemon)
89 install_files(/etc FILES ${config_DATA})
90
91 if (DBUS_SERVICE)
92         set (dbus_service_SOURCES 
93                 ${BUS_DIR}/bus-service-win.c
94         # TODO: add additional files
95         #       ${BUS_DIR}/service-main.c
96         #       ${BUS_SOURCES} 
97         )
98
99         add_executable(dbus-service ${dbus_service_SOURCES} )
100         target_link_libraries(dbus-service ${DBUS_LIBRARIES} ${XML_LIBRARY})
101         install_targets(/bin dbus-service )
102         if(WIN32)
103            set_target_properties(dbus-service PROPERTIES DEBUG_POSTFIX d)
104     endif(WIN32)
105 endif (DBUS_SERVICE)
106
107 if (DBUS_BUILD_TESTS)   
108         add_executable(bus-test ${BUS_SOURCES} ${BUS_DIR}/test-main.c)
109         target_link_libraries(bus-test ${DBUS_LIBRARIES} ${XML_LIBRARY})
110         add_test(bus-test ${EXECUTABLE_OUTPUT_PATH}/bus-test ${CMAKE_BINARY_DIR}/test/data)
111 endif (DBUS_BUILD_TESTS)
112
113 if(MSVC)
114         project_source_group(${GROUP_CODE} bus_test_SOURCES dummy)
115 endif(MSVC)
116
117 ## mop up the gcov files
118 #clean-local:
119 #       /bin/rm *.bb *.bbg *.da *.gcov || true
120
121 #install-data-hook:
122 #       $(mkinstalldirs) $(DESTDIR)/$(localstatedir)/run/dbus
123 #       $(mkinstalldirs) $(DESTDIR)/$(configdir)/system.d
124 #       $(mkinstalldirs) $(DESTDIR)/$(datadir)/dbus-1/services
125
126 ##install_file(${configdir}/system.d FILE
127
128
129 set(LAUNCH_HELPER_SOURCES ${XML_SOURCES}
130     ${BUS_DIR}/config-parser-common.c
131     ${BUS_DIR}/config-parser-trivial.c
132     ${BUS_DIR}/desktop-file.c
133     ${BUS_DIR}/utils.c
134     ${BUS_DIR}/activation-helper.c
135
136 )
137
138 if(NOT WIN32)
139 # TODO PENDING(kdab) fix build on windows (activation-helper.c)
140    add_executable(dbus-daemon-launch-helper ${LAUNCH_HELPER_SOURCES} ${BUS_DIR}/activation-helper-bin.c )
141    target_link_libraries(dbus-daemon-launch-helper ${DBUS_LIBRARIES} ${XML_LIBRARY} )
142    
143    add_executable(dbus-daemon-launch-helper-test ${LAUNCH_HELPER_SOURCES}     ${BUS_DIR}/activation-helper-bin.c)
144    set_target_properties(dbus-daemon-launch-helper-test PROPERTIES COMPILE_FLAGS "-DACTIVATION_LAUNCHER_TEST")
145    target_link_libraries(dbus-daemon-launch-helper-test ${DBUS_LIBRARIES} ${XML_LIBRARY} )
146    
147    add_executable(bus-test-launch-helper ${LAUNCH_HELPER_SOURCES}  ${BUS_DIR}/test-launch-helper.c)
148    set_target_properties(bus-test-launch-helper PROPERTIES COMPILE_FLAGS "-DACTIVATION_LAUNCHER_TEST -DACTIVATION_LAUNCHER_DO_OOM")
149    target_link_libraries(bus-test-launch-helper ${DBUS_LIBRARIES} ${XML_LIBRARY} )
150    add_test(bus-test-launch-helper ${EXECUTABLE_OUTPUT_PATH}/bus-test-launch-helper )
151
152 endif(NOT WIN32)
153
154 #### Init scripts fun
155 #SCRIPT_IN_FILES=messagebus.in
156 #               rc.messagebus.in
157
158 ## Red Hat start
159 #if DBUS_INIT_SCRIPTS_RED_HAT
160
161 #initddir=$(sysconfdir)/rc.d/init.d
162
163 #initd_SCRIPTS=         
164 #       messagebus
165
166 #endif
167 # ## Red Hat end
168
169 ## Slackware start
170 #if DBUS_INIT_SCRIPTS_SLACKWARE
171
172 #initddir=$(sysconfdir)/rc.d/
173
174 #initd_SCRIPTS=         
175 #       rc.messagebus
176
177 #endif
178 ## Slackware end
179
180 #MAN_IN_FILES=dbus-daemon.1.in
181 #man_MANS = dbus-daemon.1
182
183 #### Extra dist 
184
185 #EXTRA_DIST=$(CONFIG_IN_FILES) $(SCRIPT_IN_FILES) $(man_MANS) $(MAN_IN_FILES)