9af8c50aec1cd2f37204cdb620d8e6a09b0d4502
[quassel.git] / CMakeLists.txt
1 # Builds the three main targets
2
3 add_subdirectory(common)
4 include_directories(BEFORE common)
5 if(WANT_CORE OR WANT_MONO)
6   add_subdirectory(core)
7   include_directories(BEFORE core)
8 endif(WANT_CORE OR WANT_MONO)
9 if(WANT_QTCLIENT OR WANT_MONO)
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 #  if(HAVE_KDE)
17 #    add_subdirectory(kdeui)
18 #    include_directories(kdeui)
19 #    set(LINK_KDE mod_kdeui)
20 #  endif(HAVE_KDE)
21 endif(WANT_QTCLIENT OR WANT_MONO)
22
23 include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) # for version.gen
24
25 # We always add stuff in :/pics
26 qt4_add_resources(CLIENT_DEPS ../pics/pics.qrc)
27
28 if(QUASSEL_ICONS MATCHES "Builtin")
29   set(CLIENT_DEPS ${CLIENT_DEPS} ../icons/qrc_hicolor.cxx)
30   set_source_files_properties(../icons/qrc_hicolor.cxx PROPERTIES GENERATED true)
31 endif(QUASSEL_ICONS MATCHES "Builtin")
32
33 if(OXYGEN_ICONS MATCHES "Builtin")
34   set(CLIENT_DEPS ${CLIENT_DEPS} ../icons/qrc_oxygen.cxx)
35   set_source_files_properties(../icons/qrc_oxygen.cxx PROPERTIES GENERATED true)
36 endif(OXYGEN_ICONS MATCHES "Builtin")
37
38 if(WANT_CORE)
39   setup_qt4_variables(NETWORK SCRIPT SQL)
40   add_executable(quasselcore common/main.cpp ${COMMON_DEPS} ${CORE_DEPS})
41   add_dependencies(quasselcore genversion_run)
42   set_target_properties(quasselcore PROPERTIES
43                                     COMPILE_FLAGS "-DQT_NETWORK_LIB -DQT_SCRIPT_LIB -DQT_SQL_LIB -DBUILD_CORE"
44                                     OUTPUT_NAME ../quasselcore)
45   target_link_libraries(quasselcore mod_core mod_common
46                                     ${QUASSEL_QT_LIBRARIES} ${QUASSEL_SSL_LIBRARIES})
47   install(TARGETS quasselcore RUNTIME DESTINATION ${BIN_INSTALL_DIR})
48 endif(WANT_CORE)
49
50 if(WANT_QTCLIENT)
51   setup_qt4_variables(${LINK_DBUS} GUI NETWORK ${LINK_WEBKIT})
52   add_executable(quasselclient WIN32 common/main.cpp ${COMMON_DEPS} ${CLIENT_DEPS})
53   add_dependencies(quasselclient icons genversion_run)
54   set_target_properties(quasselclient PROPERTIES
55                                       COMPILE_FLAGS "-DQT_GUI_LIB -DQT_NETWORK_LIB -DBUILD_QTUI"
56                                       OUTPUT_NAME ../quasselclient)
57   target_link_libraries(quasselclient ${LINK_KDE} mod_qtui mod_uisupport mod_client mod_common
58                                       ${QUASSEL_QT_LIBRARIES} ${QUASSEL_KDE_LIBRARIES} ${QUASSEL_SSL_LIBRARIES} ${PHONON_LIBS})
59   install(TARGETS quasselclient RUNTIME DESTINATION ${BIN_INSTALL_DIR})
60 endif(WANT_QTCLIENT)
61
62 if(WANT_MONO)
63   setup_qt4_variables(${LINK_DBUS} GUI NETWORK SCRIPT SQL ${LINK_WEBKIT})
64   qt4_wrap_cpp(MOC qtui/monoapplication.h)
65   add_executable(quassel WIN32 common/main.cpp qtui/monoapplication.cpp ${MOC} ${COMMON_DEPS} ${CLIENT_DEPS} ${CORE_DEPS})
66   add_dependencies(quassel icons genversion_run)
67   set_target_properties(quassel PROPERTIES
68                                 COMPILE_FLAGS "-DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_SCRIPT_LIB -DQT_SQL_LIB -DBUILD_MONO"
69                                 OUTPUT_NAME ../quassel)
70   target_link_libraries(quassel mod_qtui mod_uisupport mod_client mod_core mod_common
71                                 ${QUASSEL_QT_LIBRARIES} ${QUASSEL_KDE_LIBRARIES} ${QUASSEL_SSL_LIBRARIES} ${PHONON_LIBS})
72   install(TARGETS quassel RUNTIME DESTINATION ${BIN_INSTALL_DIR})
73 endif(WANT_MONO)
74
75 # Build bundles for MacOSX
76 if(APPLE)
77   add_custom_command(TARGET quasselclient POST_BUILD
78                      COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makebundle.py
79                              ${CMAKE_SOURCE_DIR} "Quassel Client" ../quasselclient)
80   add_custom_command(TARGET quassel POST_BUILD
81                      COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makebundle.py
82                              ${CMAKE_SOURCE_DIR} "Quassel" ../quassel)
83   if(DEPLOY)
84     add_custom_command(TARGET quasselclient POST_BUILD
85                        COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makePackage.sh Client ..)
86     add_custom_command(TARGET quasselcore POST_BUILD
87                        COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makePackage.sh Core ..)
88   endif(DEPLOY)
89 endif(APPLE)