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