Don't make EventType::KeyEvent depend on HAVE_QCA2
[quassel.git] / src / CMakeLists.txt
1 # Builds the three main targets
2
3 add_subdirectory(common)
4 include_directories(BEFORE common)
5 if(BUILD_CORE)
6   add_subdirectory(core)
7   include_directories(BEFORE core)
8 endif(BUILD_CORE)
9 if(BUILD_GUI)
10   add_subdirectory(client)
11   add_subdirectory(uisupport)
12   add_subdirectory(qtui)
13   include_directories(BEFORE client)
14   include_directories(BEFORE uisupport)
15   include_directories(BEFORE qtui)
16
17   if(STATIC)
18     link_directories(${QT_PLUGINS_DIR}/imageformats)
19     set(CLIENT_LIBRARIES ${CLIENT_LIBRARIES} qjpeg qgif)
20   endif(STATIC)
21 endif(BUILD_GUI)
22
23 include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) # for version.gen
24
25 # Add resources. Can't be done in other subdirs apparently.
26 # Note that these variables need to contain paths relative to src/ (this dir)
27 qt_add_resources(CLIENT_DEPS ${CLIENT_RCS})
28 qt_add_resources(CORE_DEPS ${CORE_RCS})
29 qt_add_resources(COMMON_DEPS ${COMMON_RCS})
30
31 # For Windows, Qt4 needs the QtMain module
32 if (WIN32 AND NOT USE_QT5)
33     set(MAIN Main)
34 endif()
35
36 if(WANT_CORE)
37   add_executable(quasselcore common/main.cpp ${COMMON_DEPS} ${CORE_DEPS})
38   qt_use_modules(quasselcore Core Network ${CORE_QT_MODULES} ${MAIN})
39   add_dependencies(quasselcore po)
40   set_target_properties(quasselcore PROPERTIES
41                                     COMPILE_FLAGS "-DBUILD_CORE"
42                                     OUTPUT_NAME ../quasselcore)
43   target_link_libraries(quasselcore mod_core mod_common ${COMMON_LIBRARIES} ${QUASSEL_SSL_LIBRARIES})
44   install(TARGETS quasselcore RUNTIME DESTINATION ${BIN_INSTALL_DIR})
45 endif(WANT_CORE)
46
47 if(WANT_QTCLIENT)
48   add_executable(quasselclient WIN32 common/main.cpp ${COMMON_DEPS} ${CLIENT_DEPS})
49   qt_use_modules(quasselclient Core Gui Network ${CLIENT_QT_MODULES} ${MAIN})
50   add_dependencies(quasselclient po)
51   set_target_properties(quasselclient PROPERTIES
52                                       COMPILE_FLAGS "-DBUILD_QTUI ${CLIENT_COMPILE_FLAGS}"
53                                       OUTPUT_NAME ../quasselclient)
54   target_link_libraries(quasselclient ${LINK_KDE} mod_qtui mod_uisupport mod_client mod_common ${COMMON_LIBRARIES} ${CLIENT_LIBRARIES} ${QUASSEL_SSL_LIBRARIES})
55   install(TARGETS quasselclient RUNTIME DESTINATION ${BIN_INSTALL_DIR})
56 endif(WANT_QTCLIENT)
57
58 if(WANT_MONO)
59   add_executable(quassel WIN32 common/main.cpp qtui/monoapplication.cpp ${COMMON_DEPS} ${CLIENT_DEPS} ${CORE_DEPS})
60   qt_use_modules(quassel Core Gui Network ${CLIENT_QT_MODULES} ${CORE_QT_MODULES} ${MAIN})
61   add_dependencies(quassel po)
62   set_target_properties(quassel PROPERTIES
63                                 COMPILE_FLAGS "-DBUILD_MONO ${CLIENT_COMPILE_FLAGS}"
64                                 OUTPUT_NAME ../quassel)
65   target_link_libraries(quassel mod_qtui mod_uisupport mod_client mod_core mod_common ${COMMON_LIBRARIES} ${CLIENT_LIBRARIES} ${QUASSEL_SSL_LIBRARIES})
66   install(TARGETS quassel RUNTIME DESTINATION ${BIN_INSTALL_DIR})
67 endif(WANT_MONO)
68
69 # Build bundles for MacOSX
70 if(APPLE)
71   add_custom_command(TARGET quasselclient POST_BUILD
72                      COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makebundle.py
73                              ${CMAKE_SOURCE_DIR} "Quassel Client" ../quasselclient)
74   add_custom_command(TARGET quassel POST_BUILD
75                      COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makebundle.py
76                              ${CMAKE_SOURCE_DIR} "Quassel" ../quassel)
77   if(DEPLOY)
78     add_custom_command(TARGET quasselclient POST_BUILD
79                        COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makePackage.sh Client ..)
80     add_custom_command(TARGET quasselcore POST_BUILD
81                        COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makePackage.sh Core ..)
82   endif(DEPLOY)
83 endif(APPLE)