24a6aa7accbe9efa089bfec6f2334ba51f1e2846
[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()
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 endif()
17
18 include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) # for version.gen
19
20 # We need to initialize the appropriate resources, so let's give our main.cpp some hints
21 if (EMBED_DATA)
22     add_definitions(-DEMBED_DATA)
23 endif()
24
25 # For KAboutData
26 if (WITH_KF5)
27     set(CLIENT_LIBRARIES ${CLIENT_LIBRARIES} KF5::CoreAddons)
28 endif()
29
30 # Needed for showing the cli option if appropriate
31 if (HAVE_SYSLOG)
32     add_definitions(-DHAVE_SYSLOG)
33 endif()
34
35 if(WANT_CORE)
36   add_executable(quasselcore common/main.cpp ${CORE_DEPS} ${COMMON_DEPS})
37   qt5_use_modules(quasselcore Core Network ${CORE_QT_MODULES})
38   add_dependencies(quasselcore po)
39   set_target_properties(quasselcore PROPERTIES
40                                     COMPILE_FLAGS "-DBUILD_CORE"
41                                     RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
42   target_link_libraries(quasselcore mod_core mod_common ${COMMON_LIBRARIES} ${QUASSEL_SSL_LIBRARIES} ${QT_QTMAIN_LIBRARY})
43   install(TARGETS quasselcore RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
44 endif()
45
46 if(WANT_QTCLIENT)
47   add_executable(quasselclient WIN32 common/main.cpp ${CLIENT_DEPS} ${COMMON_DEPS})
48   qt5_use_modules(quasselclient Core Gui Network ${CLIENT_QT_MODULES})
49   add_dependencies(quasselclient po)
50   set_target_properties(quasselclient PROPERTIES
51                                       COMPILE_FLAGS "-DBUILD_QTUI"
52                                       RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
53   target_link_libraries(quasselclient mod_qtui mod_uisupport mod_client mod_common ${COMMON_LIBRARIES} ${CLIENT_LIBRARIES} ${QUASSEL_SSL_LIBRARIES} ${QT_QTMAIN_LIBRARY})
54   install(TARGETS quasselclient RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
55 endif()
56
57 if(WANT_MONO)
58   add_executable(quassel WIN32 common/main.cpp qtui/monoapplication.cpp ${CLIENT_DEPS} ${CORE_DEPS} ${COMMON_DEPS})
59   qt5_use_modules(quassel Core Gui Network ${CLIENT_QT_MODULES} ${CORE_QT_MODULES})
60   add_dependencies(quassel po)
61   set_target_properties(quassel PROPERTIES
62                                 COMPILE_FLAGS "-DBUILD_MONO"
63                                 RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
64   target_link_libraries(quassel mod_qtui mod_uisupport mod_client mod_core mod_common ${COMMON_LIBRARIES} ${CLIENT_LIBRARIES} ${QUASSEL_SSL_LIBRARIES} ${QT_QTMAIN_LIBRARY})
65   install(TARGETS quassel RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
66 endif()
67
68 # Build bundles for MacOSX
69 if(APPLE)
70   add_custom_command(TARGET quasselclient POST_BUILD
71                      COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makebundle.py
72                              ${CMAKE_SOURCE_DIR} "Quassel Client" ../quasselclient)
73   add_custom_command(TARGET quassel POST_BUILD
74                      COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makebundle.py
75                              ${CMAKE_SOURCE_DIR} "Quassel" ../quassel)
76   if(DEPLOY)
77     add_custom_command(TARGET quasselclient POST_BUILD
78                        COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makePackage.sh Client .. qsvgicon)
79     add_custom_command(TARGET quasselcore POST_BUILD
80                        COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makePackage.sh Core ..)
81     add_custom_command(TARGET quassel POST_BUILD
82                        COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makePackage.sh Mono .. qsvgicon)
83   endif()
84 endif()