2e24ea400ea51ef52228c6ce1d4b280639108a4f
[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 # We need to initialize the appropriate resources, so let's give our main.cpp some hints
26 if (EMBED_DATA)
27     add_definitions(-DEMBED_DATA)
28 endif()
29 if (WITH_OXYGEN)
30     add_definitions(-DWITH_OXYGEN)
31 endif()
32
33 # Needed for showing the cli option if appropriate
34 if (HAVE_SYSLOG)
35     add_definitions(-DHAVE_SYSLOG)
36 endif()
37
38 if(WANT_CORE)
39   add_executable(quasselcore common/main.cpp ${CORE_DEPS} ${COMMON_DEPS})
40   qt_use_modules(quasselcore Core Network ${CORE_QT_MODULES})
41   add_dependencies(quasselcore po)
42   set_target_properties(quasselcore PROPERTIES
43                                     COMPILE_FLAGS "-DBUILD_CORE"
44                                     OUTPUT_NAME ../quasselcore)
45   target_link_libraries(quasselcore mod_core mod_common ${COMMON_LIBRARIES} ${QUASSEL_SSL_LIBRARIES} ${QT_QTMAIN_LIBRARY})
46   install(TARGETS quasselcore RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
47 endif(WANT_CORE)
48
49 if (KDE4_FOUND)
50     include_directories(${KDE4_INCLUDES})
51 endif()
52
53 if(WANT_QTCLIENT)
54   add_executable(quasselclient WIN32 common/main.cpp ${CLIENT_DEPS} ${COMMON_DEPS})
55   qt_use_modules(quasselclient Core Gui Network ${CLIENT_QT_MODULES})
56   add_dependencies(quasselclient po)
57   set_target_properties(quasselclient PROPERTIES
58                                       COMPILE_FLAGS "-DBUILD_QTUI"
59                                       OUTPUT_NAME ../quasselclient)
60   target_link_libraries(quasselclient mod_qtui mod_uisupport mod_client mod_common ${COMMON_LIBRARIES} ${CLIENT_LIBRARIES} ${QUASSEL_SSL_LIBRARIES} ${QT_QTMAIN_LIBRARY})
61   install(TARGETS quasselclient RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
62 endif(WANT_QTCLIENT)
63
64 if(WANT_MONO)
65   add_executable(quassel WIN32 common/main.cpp qtui/monoapplication.cpp ${CLIENT_DEPS} ${CORE_DEPS} ${COMMON_DEPS})
66   qt_use_modules(quassel Core Gui Network ${CLIENT_QT_MODULES} ${CORE_QT_MODULES})
67   add_dependencies(quassel po)
68   set_target_properties(quassel PROPERTIES
69                                 COMPILE_FLAGS "-DBUILD_MONO"
70                                 OUTPUT_NAME ../quassel)
71   target_link_libraries(quassel mod_qtui mod_uisupport mod_client mod_core mod_common ${COMMON_LIBRARIES} ${CLIENT_LIBRARIES} ${QUASSEL_SSL_LIBRARIES} ${QT_QTMAIN_LIBRARY})
72   install(TARGETS quassel RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
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     add_custom_command(TARGET quasselcore POST_BUILD
89                        COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makePackage.sh Mono ..)
90   endif(DEPLOY)
91 endif(APPLE)