More build system tweaking, plus making icons work
[quassel.git] / src / CMakeLists.txt
1 # Builds the three main targets
2
3 add_subdirectory(common)
4 include_directories(common)
5 if(WANT_CORE OR WANT_MONO)
6   add_subdirectory(core)
7   include_directories(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(client)
14   include_directories(uisupport)
15   include_directories(qtui)
16 endif(WANT_QTCLIENT OR WANT_MONO)
17
18 if(QUASSEL_ICONS MATCHES "Builtin")
19   qt4_add_resources(RC_ICONS ../icons/hicolor.qrc)
20 endif(QUASSEL_ICONS MATCHES "Builtin")
21
22 if(OXYGEN_ICONS MATCHES "Builtin")
23   qt4_add_resources(RC_ICONS ../icons/oxygen.qrc)
24 endif(OXYGEN_ICONS MATCHES "Builtin")
25
26 set(CLIENT_DEPS ${CLIENT_DEPS} ${RC_ICONS})
27
28 if(WANT_CORE)
29   setup_qt4_variables(NETWORK SCRIPT SQL)
30   add_executable(quasselcore common/main.cpp ${COMMON_DEPS} ${CORE_DEPS})
31   set_target_properties(quasselcore PROPERTIES
32                                     COMPILE_FLAGS "-DQT_NETWORK_LIB -DQT_SCRIPT_LIB -DQT_SQL_LIB -DBUILD_CORE")
33   target_link_libraries(quasselcore mod_core mod_common
34                                     ${QUASSEL_QT_LIBRARIES} ${QUASSEL_SSL_LIBRARIES})
35   install(TARGETS quasselcore RUNTIME DESTINATION ${BIN_INSTALL_DIR})
36 endif(WANT_CORE)
37
38 if(WANT_QTCLIENT)
39   setup_qt4_variables(${LINK_DBUS} GUI NETWORK)
40   add_executable(quasselclient WIN32 common/main.cpp ${COMMON_DEPS} ${CLIENT_DEPS})
41   set_target_properties(quasselclient PROPERTIES
42                                       COMPILE_FLAGS "-DQT_GUI_LIB -DQT_NETWORK_LIB -DBUILD_QTUI")
43   target_link_libraries(quasselclient mod_qtui mod_uisupport mod_client mod_common
44                                       ${QUASSEL_QT_LIBRARIES} ${QUASSEL_SSL_LIBRARIES})
45   install(TARGETS quasselclient RUNTIME DESTINATION ${BIN_INSTALL_DIR})
46 endif(WANT_QTCLIENT)
47
48 if(WANT_MONO)
49   setup_qt4_variables(${LINK_DBUS} GUI NETWORK SCRIPT SQL)
50   add_executable(quassel WIN32 common/main.cpp qtui/monoapplication.cpp ${COMMON_DEPS} ${CLIENT_DEPS} ${CORE_DEPS})
51   set_target_properties(quassel PROPERTIES
52                                 COMPILE_FLAGS "-DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_SCRIPT_LIB -DQT_SQL_LIB -DBUILD_MONO")
53   target_link_libraries(quassel mod_qtui mod_uisupport mod_client mod_core mod_common
54                                 ${QUASSEL_QT_LIBRARIES} ${QUASSEL_SSL_LIBRARIES})
55   install(TARGETS quassel RUNTIME DESTINATION ${BIN_INSTALL_DIR})
56 endif(WANT_MONO)
57
58 # Build bundles for MacOSX
59 if(APPLE)
60   add_custom_command(TARGET quasselclient POST_BUILD
61                      COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makebundle.py
62                              ${CMAKE_SOURCE_DIR} "Quassel Client" quasselclient)
63   add_custom_command(TARGET quassel POST_BUILD
64                      COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makebundle.py
65                              ${CMAKE_SOURCE_DIR} "Quassel" quassel)
66   if(DEPLOY)
67     add_custom_command(TARGET quasselclient POST_BUILD
68                        COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makePackage.sh Client)
69     add_custom_command(TARGET quasselcore POST_BUILD
70                        COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makePackage.sh Core)
71   endif(DEPLOY)
72 endif(APPLE)