c4f652aff5467a8e0d11971eea11b0a865ab1053
[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 # We always add stuff in :/pics
19 qt4_add_resources(CLIENT_DEPS ../pics/pics.qrc)
20
21 if(QUASSEL_ICONS MATCHES "Builtin")
22   set(CLIENT_DEPS ${CLIENT_DEPS} ../icons/qrc_hicolor.cxx)
23   set_source_files_properties(../icons/qrc_hicolor.cxx PROPERTIES GENERATED true)
24 endif(QUASSEL_ICONS MATCHES "Builtin")
25
26 if(OXYGEN_ICONS MATCHES "Builtin")
27   set(CLIENT_DEPS ${CLIENT_DEPS} ../icons/qrc_oxygen.cxx)
28   set_source_files_properties(../icons/qrc_oxygen.cxx PROPERTIES GENERATED true)
29 endif(OXYGEN_ICONS MATCHES "Builtin")
30
31 if(WANT_CORE)
32   setup_qt4_variables(NETWORK SCRIPT SQL)
33   add_executable(quasselcore common/main.cpp ${COMMON_DEPS} ${CORE_DEPS})
34   set_target_properties(quasselcore PROPERTIES
35                                     COMPILE_FLAGS "-DQT_NETWORK_LIB -DQT_SCRIPT_LIB -DQT_SQL_LIB -DBUILD_CORE")
36   target_link_libraries(quasselcore mod_core mod_common
37                                     ${QUASSEL_QT_LIBRARIES} ${QUASSEL_SSL_LIBRARIES})
38   install(TARGETS quasselcore RUNTIME DESTINATION ${BIN_INSTALL_DIR})
39 endif(WANT_CORE)
40
41 if(WANT_QTCLIENT)
42   setup_qt4_variables(${LINK_DBUS} GUI NETWORK WEBKIT)
43   add_executable(quasselclient WIN32 common/main.cpp ${COMMON_DEPS} ${CLIENT_DEPS})
44   add_dependencies(quasselclient icons)
45   set_target_properties(quasselclient PROPERTIES
46                                       COMPILE_FLAGS "-DQT_GUI_LIB -DQT_NETWORK_LIB -DBUILD_QTUI")
47   target_link_libraries(quasselclient mod_qtui mod_uisupport mod_client mod_common
48                                       ${QUASSEL_QT_LIBRARIES} ${QUASSEL_SSL_LIBRARIES})
49   install(TARGETS quasselclient RUNTIME DESTINATION ${BIN_INSTALL_DIR})
50 endif(WANT_QTCLIENT)
51
52 if(WANT_MONO)
53   setup_qt4_variables(${LINK_DBUS} GUI NETWORK SCRIPT SQL WEBKIT)
54   add_executable(quassel WIN32 common/main.cpp qtui/monoapplication.cpp ${COMMON_DEPS} ${CLIENT_DEPS} ${CORE_DEPS})
55   add_dependencies(quassel icons)
56   set_target_properties(quassel PROPERTIES
57                                 COMPILE_FLAGS "-DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_SCRIPT_LIB -DQT_SQL_LIB -DBUILD_MONO")
58   target_link_libraries(quassel mod_qtui mod_uisupport mod_client mod_core mod_common
59                                 ${QUASSEL_QT_LIBRARIES} ${QUASSEL_SSL_LIBRARIES})
60   install(TARGETS quassel RUNTIME DESTINATION ${BIN_INSTALL_DIR})
61 endif(WANT_MONO)
62
63 # Build bundles for MacOSX
64 if(APPLE)
65   add_custom_command(TARGET quasselclient POST_BUILD
66                      COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makebundle.py
67                              ${CMAKE_SOURCE_DIR} "Quassel Client" quasselclient)
68   add_custom_command(TARGET quassel POST_BUILD
69                      COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makebundle.py
70                              ${CMAKE_SOURCE_DIR} "Quassel" quassel)
71   if(DEPLOY)
72     add_custom_command(TARGET quasselclient POST_BUILD
73                        COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makePackage.sh Client)
74     add_custom_command(TARGET quasselcore POST_BUILD
75                        COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makePackage.sh Core)
76   endif(DEPLOY)
77 endif(APPLE)