diff options
author | Ian Monroe <ian.monroe@collabora.co.uk> | 2009-04-10 16:22:01 -0500 |
---|---|---|
committer | Dario Freddi <dario.freddi@collabora.co.uk> | 2010-09-20 17:03:39 +0200 |
commit | 57658488f07b45d2057a0fa5a78df8f7c85f5fee (patch) | |
tree | 85b6463b3cccedde966464e23910f8ec4371e96b /examples | |
parent | 02882fa8091e78f9a067210ee97e50a00ac94e04 (diff) |
Added the CMake build system files. This allows telepathy-qt4 to be built
on Windows.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/CMakeLists.txt | 4 | ||||
-rw-r--r-- | examples/accounts/CMakeLists.txt | 29 | ||||
-rw-r--r-- | examples/call/CMakeLists.txt | 47 | ||||
-rw-r--r-- | examples/extensions/CMakeLists.txt | 98 | ||||
-rw-r--r-- | examples/roster/CMakeLists.txt | 42 |
5 files changed, 220 insertions, 0 deletions
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt new file mode 100644 index 00000000..6f16d382 --- /dev/null +++ b/examples/CMakeLists.txt @@ -0,0 +1,4 @@ +add_subdirectory(accounts) +add_subdirectory(call) +add_subdirectory(extensions) +add_subdirectory(roster) diff --git a/examples/accounts/CMakeLists.txt b/examples/accounts/CMakeLists.txt new file mode 100644 index 00000000..44016f76 --- /dev/null +++ b/examples/accounts/CMakeLists.txt @@ -0,0 +1,29 @@ +include_directories( + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR} + ${QT_INCLUDES}) + +set(accounts_SRCS + main.cpp + account-item.cpp + account-item.h + accounts-window.cpp + accounts-window.h) + +set(accounts_MOC_SRCS + account-item.h + accounts-window.h) + +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/_gen") +foreach(moc_src ${accounts_MOC_SRCS}) + string(REPLACE ".h" ".moc.hpp" generated_file ${moc_src}) + qt4_generate_moc_i(${CMAKE_CURRENT_SOURCE_DIR}/${moc_src} ${CMAKE_CURRENT_BINARY_DIR}/_gen/${generated_file}) + list(APPEND accounts_SRCS ${CMAKE_CURRENT_BINARY_DIR}/_gen/${generated_file}) +endforeach(moc_src ${accounts_SRCS}) + +add_executable(accounts ${accounts_SRCS}) +target_link_libraries(accounts + ${QT_QTDBUS_LIBRARY} + ${QT_QTGUI_LIBRARY} + ${QT_QTCORE_LIBRARY} + telepathy-qt4) diff --git a/examples/call/CMakeLists.txt b/examples/call/CMakeLists.txt new file mode 100644 index 00000000..c441a7e8 --- /dev/null +++ b/examples/call/CMakeLists.txt @@ -0,0 +1,47 @@ +find_package(PkgConfig) +pkg_check_modules(TP_FARSIGHT telepathy-farsight>=0.0.4 gstreamer-0.10 gstreamer-interfaces-0.10) + +if(TP_FARSIGHT_FOUND) + message(STATUS "telepathy-farsight and gstreamer libraries found, building the call example") + + include_directories( + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR} + ${QT_INCLUDES} + ${TP_FARSIGHT_INCLUDE_DIRS}) + + set(call_SRCS + main.cpp + call-handler.cpp + call-roster-widget.cpp + call-widget.cpp + call-window.cpp + farsight-channel.cpp + video-widget.cpp) + + set(call_MOC_SRCS + call-handler.h + call-roster-widget.h + call-widget.h + call-window.h + farsight-channel.h + video-widget.h) + + file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/_gen) + foreach(moc_src ${call_MOC_SRCS}) + string(REPLACE ".h" ".moc.hpp" generated_file ${moc_src}) + qt4_generate_moc_i(${CMAKE_CURRENT_SOURCE_DIR}/${moc_src} ${CMAKE_CURRENT_BINARY_DIR}/_gen/${generated_file}) + list(APPEND call_SRCS ${CMAKE_CURRENT_BINARY_DIR}/_gen/${generated_file}) + endforeach(moc_src call_MOC_SRCS) + + add_executable(call ${call_SRCS}) + target_link_libraries(call + ${QT_QTCORE_LIBRARIES} + ${QT_QTGUI_LIBRARIES} + ${QT_QTCORE_LIBRARIES} + ${TP_FARSIGHT_LIBRARIES} + telepathy-qt4 + telepathy-qt4-examples-roster) +else(TP_FARSIGHT_FOUND) + message(STATUS "telepathy-farsight or gstreamer libraries not found, not building the call example") +endif(TP_FARSIGHT_FOUND) diff --git a/examples/extensions/CMakeLists.txt b/examples/extensions/CMakeLists.txt new file mode 100644 index 00000000..d452f515 --- /dev/null +++ b/examples/extensions/CMakeLists.txt @@ -0,0 +1,98 @@ +# This directory is an example of how to build extensions to the spec. +# Typically this would be in a top-level extensions/ directory. + +# In this example we build an optional interface for Telepathy Connections, +# so we specify Tp::Client::ConnectionInterface as the main interface for the +# generated proxies with "--mainiface=Tp::Client::ConnectionInterface'. The +# generated proxies will have a convenience constructors for associating the +# proxy with the same remote object an instance of the main interface class +# is associated with. We could instead have made an optional interface for any +# other class, or by leaving that option out entirely we could have made an +# extension that will work on QDBusAbstractInterface or any subclass of it. +# +# For stand-alone interfaces (for which the interface itself should be considered +# the main interface) --mainiface should be specified as fully namespaced name +# of the interface class itself. + +include_directories( + ${CMAKE_SOURCE_DIR} + ${CMAKE_BINARY_DIR} + ${QT_INCLUDES}) + +set(example_extensions_SRCS + cli-connection.cpp + cli-connection.h + types.cpp) + +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/_gen) +set(generated_all_xml ${CMAKE_CURRENT_BINARY_DIR}/_gen/all.xml) +add_custom_command(OUTPUT ${generated_all_xml} + COMMAND ${PYTHON_EXECUTABLE} + ARGS ${CMAKE_SOURCE_DIR}/tools/xincludator.py + ${CMAKE_CURRENT_SOURCE_DIR}/all.xml + > ${generated_all_xml} + DEPENDS all.xml ${CMAKE_SOURCE_DIR}/tools/xincludator.py) + +add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/_gen/constants.h + COMMAND ${PYTHON_EXECUTABLE} + ARGS ${CMAKE_SOURCE_DIR}/tools/qt4-constants-gen.py + --namespace=Example + --str-constant-prefix=EXAMPLE_ + --specxml=${generated_all_xml} + > ${CMAKE_CURRENT_BINARY_DIR}/_gen/constants.h + DEPENDS ${generated_all_xml} ${CMAKE_SOURCE_DIR}/tools/qt4-constants-gen.py) + +if(MSVC) + set(TYPES_INCLUDE ^<TelepathyQt4/Types^>) +else(MSVC) + set(TYPES_INCLUDE '<TelepathyQt4/Types>') +endif(MSVC) + +add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/_gen/types.h ${CMAKE_CURRENT_BINARY_DIR}/_gen/types-body.hpp + COMMAND ${PYTHON_EXECUTABLE} + ARGS ${CMAKE_SOURCE_DIR}/tools/qt4-types-gen.py + --namespace=Example + --declfile=_gen/types.h + --implfile=_gen/types-body.hpp + --realinclude=types.h + --specxml=${generated_all_xml} + --extraincludes=${TYPES_INCLUDE} + DEPENDS ${generated_all_xml} ${CMAKE_SOURCE_DIR}/tools/qt4-types-gen.py) + +set(connection_generated_xml ${CMAKE_CURRENT_BINARY_DIR}/_gen/connection.xml) +add_custom_command(OUTPUT ${connection_generated_xml} + COMMAND ${PYTHON_EXECUTABLE} + ARGS ${CMAKE_SOURCE_DIR}/tools/xincludator.py + ${CMAKE_CURRENT_SOURCE_DIR}/connection.xml + > ${connection_generated_xml}) + +if(MSVC) + set(ESCAPED_QUOTES \"\"\") + set(connection_include ^<TelepathyQt4/Connection^>) +else(MSVC) + set(ESCAPED_QUOTES \\\") + set(connection_include '<TelepathyQt4/Connection>') +endif(MSVC) + +add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/_gen/cli-connection-body.hpp ${CMAKE_CURRENT_BINARY_DIR}/_gen/cli-connection.h + COMMAND ${PYTHON_EXECUTABLE} + ARGS ${CMAKE_SOURCE_DIR}/tools/qt4-client-gen.py + --namespace=Example::Client + --typesnamespace=Example + --headerfile=${CMAKE_CURRENT_BINARY_DIR}/_gen/cli-connection.h + --implfile=${CMAKE_CURRENT_BINARY_DIR}/_gen/cli-connection-body.hpp + --realinclude=${CMAKE_CURRENT_SRC_DIR}/cli-connection.h + --specxml=${generated_all_xml} + --ifacexml=${connection_generated_xml} + --extraincludes=${connection_include},${ESCAPED_QUOTES}types.h${ESCAPED_QUOTES} + --mainiface=Tp::Client::ConnectionInterface + DEPENDS ${generated_all_xml} ${connection_generated_xml} ${CMAKE_SOURCE_DIR}/tools/qt4-client-gen.py ${CMAKE_CURRENT_BINARY_DIR}/_gen/types.h) +list(APPEND example_extensions_SRCS ${CMAKE_CURRENT_BINARY_DIR}/_gen/cli-connection-body.hpp ${CMAKE_CURRENT_BINARY_DIR}/_gen/cli-connection.h) +qt4_generate_moc_i(${CMAKE_CURRENT_BINARY_DIR}/_gen/cli-connection.h ${CMAKE_CURRENT_BINARY_DIR}/_gen/cli-connection.moc.hpp) +list(APPEND example_extensions_SRCS ${CMAKE_CURRENT_BINARY_DIR}/_gen/cli-connection.moc.hpp) + +add_library(example_extensions STATIC ${example_extensions_SRCS}) +target_link_libraries(example_extensions + ${QT_QTDBUS_LIBRARY} + ${QT_QTCORE_LIBRARY} + telepathy-qt4) diff --git a/examples/roster/CMakeLists.txt b/examples/roster/CMakeLists.txt new file mode 100644 index 00000000..39eaf269 --- /dev/null +++ b/examples/roster/CMakeLists.txt @@ -0,0 +1,42 @@ +include_directories( + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR} + ${QT_INCLUDES}) + +set(roster_SRCS + main.cpp + roster-window.cpp + roster-item.cpp + roster-widget.cpp) + +set(roster_MOC_SRCS + roster-window.h + roster-item.h + roster-widget.h) + +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/_gen" ) +foreach(moc_src ${roster_MOC_SRCS}) + string(REPLACE ".h" ".moc.hpp" generated_file ${moc_src}) + qt4_generate_moc_i(${CMAKE_CURRENT_SOURCE_DIR}/${moc_src} ${CMAKE_CURRENT_BINARY_DIR}/_gen/${generated_file}) + list(APPEND roster_SRCS ${CMAKE_CURRENT_BINARY_DIR}/_gen/${generated_file}) +endforeach(moc_src ${roster_MOC_SRCS}) + +add_executable(roster ${roster_SRCS}) +target_link_libraries( roster + ${QT_QTDBUS_LIBRARY} + ${QT_QTGUI_LIBRARY} + ${QT_QTCORE_LIBRARY} + telepathy-qt4) + +set(telepathy-qt4-examples-roster_SRCS + roster-item.cpp + roster-widget.cpp + ${CMAKE_CURRENT_BINARY_DIR}/_gen/roster-item.moc.hpp + ${CMAKE_CURRENT_BINARY_DIR}/_gen/roster-widget.moc.hpp) + +add_library(telepathy-qt4-examples-roster ${telepathy-qt4-examples-roster_SRCS}) +target_link_libraries(telepathy-qt4-examples-roster + ${QT_QTDBUS_LIBRARY} + ${QT_QTGUI_LIBRARY} + ${QT_QTCORE_LIBRARY} + telepathy-qt4) |