From: Manuel Nickschas Date: Fri, 6 Jun 2008 22:51:04 +0000 (+0200) Subject: Say hello (again) to CMake! X-Git-Tag: 0.3.0~371^2~24 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=a45c9e65ddca9748bb29318a7de5cfef03900eb8 Say hello (again) to CMake! After struggling way too long with qmake and its lack of features and documentation, CMake is back in our sources. This is the first sorta working version of our new shiny CMake-based build system. It seems to work for dynamic builds on Linux at least... More stuff is to come to allow selection of Qt sources, and we probably need to add a lot of stuff for Windows and Mac builds. Anyway, this is a start! --- diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..d1a3f124 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,101 @@ +# This is the cmake-based build system for Quassel IRC. + +project(QuasselIRC) + +cmake_minimum_required(VERSION 2.4.5) + +set(QT_MIN_VERSION "4.4.0") +find_package(Qt4 REQUIRED) + +# By default, we build all binaries +if(NOT DEFINED BUILD) + set(BUILD all) +endif(NOT DEFINED BUILD) + +# User might define which binaries to build by invoking cmake -DBUILD=, +# where might contain any combination of "core", "client", "mono" or "all" +if(BUILD MATCHES all) + set(BUILD_CORE true) + set(BUILD_QTCLIENT true) + set(BUILD_MONO true) + message(STATUS "Building Quassel Client, Quassel Core and monolithic Quassel.") +else(BUILD MATCHES all) + if(BUILD MATCHES core) + set(BUILD_CORE true) + message(STATUS "Building Quassel Core") + endif(BUILD MATCHES core) + if(BUILD MATCHES client) + set(BUILD_QTCLIENT true) + message(STATUS "Building Quassel Client") + endif(BUILD MATCHES client) + if(BUILD MATCHES mono) + set(BUILD_MONO true) + message(STATUS "Building monolithic Quassel") + endif(BUILD MATCHES mono) +endif(BUILD MATCHES all) + +# Enable mostly b0rked stuff (new ChatView), do not enable this unless you know what you do... +if(SPUTDEV) + add_definitions(-DSPUTDEV) +endif(SPUTDEV) + +# Add needed subdirs +add_subdirectory(src/common) +include_directories(src/common) +if(BUILD_CORE OR BUILD_MONO) + add_subdirectory(src/core) + include_directories(src/core) +endif(BUILD_CORE OR BUILD_MONO) +if(BUILD_QTCLIENT OR BUILD_MONO) + add_subdirectory(src/client) + add_subdirectory(src/uisupport) + add_subdirectory(src/qtui) + include_directories(src/client) + include_directories(src/uisupport) + include_directories(src/qtui) +endif(BUILD_QTCLIENT OR BUILD_MONO) + +# Add resources +qt4_add_resources(RES_I18N ${CMAKE_SOURCE_DIR}/i18n/i18n.qrc) +qt4_add_resources(RES_ICONS ${CMAKE_SOURCE_DIR}/src/icons/icons.qrc) +qt4_add_resources(RES_SQL ${CMAKE_SOURCE_DIR}/src/core/sql.qrc) + +# Here comes the dirty part. Our targets need different Qt4 modules, i.e. different libs +# and defines. We can't simply include UseQt4 several times, since definitions add up. +# We workaround this by only setting up QtCore first, and adding additional stuff later. +set(QT_DONT_USE_QTGUI 1) +include(${QT_USE_FILE}) +include_directories(${QT_INCLUDES}) + +# This macro sets variables for additional Qt modules. +macro(setup_qt4_variables) + set(QUASSEL_QT_DEFINITIONS ) + set(QUASSEL_QT_LIBRARIES ) + foreach(qtmod ${ARGV}) + # This needs to be a string, not a list, otherwise set_target_properties screws up... + set(QUASSEL_QT_DEFINITIONS "${QUASSEL_QT_DEFINITIONS} -DQT_${qtmod}_LIB") + set(QUASSEL_QT_LIBRARIES ${QUASSEL_QT_LIBRARIES} ${QT_QT${qtmod}_LIBRARY} ${QT_${qtmod}_LIB_DEPENDENCIES}) + endforeach(qtmod ${ARGV}) +endmacro(setup_qt4_variables) + +# Now we have everything, so just glue the right pieces together :) +if(BUILD_CORE) + setup_qt4_variables(NETWORK SCRIPT SQL) + add_executable(quasselcore ${CMAKE_SOURCE_DIR}/src/common/main.cpp ${RES_SQL} ${RES_I18N}) + set_target_properties(quasselcore PROPERTIES COMPILE_FLAGS "${QUASSEL_QT_DEFINITIONS} -DBUILD_CORE") + target_link_libraries(quasselcore mod_core mod_common ${QUASSEL_QT_LIBRARIES}) +endif(BUILD_CORE) + +if(BUILD_QTCLIENT) + setup_qt4_variables(GUI NETWORK) + add_executable(quasselclient ${CMAKE_SOURCE_DIR}/src/common/main.cpp ${RES_ICONS} ${RES_I18N}) + set_target_properties(quasselclient PROPERTIES COMPILE_FLAGS "${QUASSEL_QT_DEFINITIONS} -DBUILD_QTUI") + target_link_libraries(quasselclient mod_qtui mod_uisupport mod_client mod_common ${QUASSEL_QT_LIBRARIES}) +endif(BUILD_QTCLIENT) + +if(BUILD_MONO) + setup_qt4_variables(GUI NETWORK SCRIPT SQL) + add_executable(quassel ${CMAKE_SOURCE_DIR}/src/common/main.cpp ${RES_ICONS} ${RES_SQL} ${RES_I18N}) + set_target_properties(quassel PROPERTIES COMPILE_FLAGS "${QUASSEL_QT_DEFINITIONS} -DBUILD_MONO") + target_link_libraries(quassel mod_qtui mod_uisupport mod_client mod_core mod_common ${QUASSEL_QT_LIBRARIES}) +endif(BUILD_MONO) diff --git a/src/client/CMakeLists.txt b/src/client/CMakeLists.txt new file mode 100644 index 00000000..7503f987 --- /dev/null +++ b/src/client/CMakeLists.txt @@ -0,0 +1,39 @@ +# Builds the client module + +# We still have some minor deps to QtUi: QItemSelectionModel +# set(QT_DONT_USE_QTGUI 1) +set(QT_USE_QTNETWORK 1) +include(${QT_USE_FILE}) + +set(SOURCES + buffer.cpp + buffermodel.cpp + buffersettings.cpp + client.cpp + clientbacklogmanager.cpp + clientsettings.cpp + clientsyncer.cpp + mappedselectionmodel.cpp + networkmodel.cpp + selectionmodelsynchronizer.cpp + treemodel.cpp) + +set(HEADERS + buffer.h + buffermodel.h + client.h + clientbacklogmanager.h + clientsyncer.h + networkmodel.h + mappedselectionmodel.h + quasselui.h + selectionmodelsynchronizer.h + treemodel.h) + +qt4_wrap_cpp(MOC ${HEADERS}) + +include_directories(${CMAKE_SOURCE_DIR}/src/common) + +add_library(mod_client STATIC ${SOURCES} ${MOC}) +add_dependencies(mod_client mod_common) + diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt new file mode 100644 index 00000000..72e4eb1e --- /dev/null +++ b/src/common/CMakeLists.txt @@ -0,0 +1,40 @@ +# Builds the common module + +set(QT_DONT_USE_QTGUI 1) +set(QT_USE_QTNETWORK 1) +include(${QT_USE_FILE}) + +set(SOURCES + backlogmanager.cpp + bufferinfo.cpp + buffersyncer.cpp + bufferviewconfig.cpp + bufferviewmanager.cpp + global.cpp + identity.cpp + logger.cpp + message.cpp + settings.cpp + signalproxy.cpp + syncableobject.cpp + util.cpp + network.cpp + ircuser.cpp + ircchannel.cpp) + +set(HEADERS + backlogmanager.h + buffersyncer.h + bufferviewconfig.h + bufferviewmanager.h + identity.h + ircchannel.h + ircuser.h + logger.h + network.h + signalproxy.h + syncableobject.h) + +qt4_wrap_cpp(MOC ${HEADERS}) + +add_library(mod_common STATIC ${SOURCES} ${MOC}) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt new file mode 100644 index 00000000..fed2b779 --- /dev/null +++ b/src/core/CMakeLists.txt @@ -0,0 +1,53 @@ +# Builds the core module + +set(QT_DONT_USE_QTGUI 1) +set(QT_USE_QTNETWORK 1) +set(QT_USE_QTSQL 1) +set(QT_USE_QTSCRIPT 1) +include(${QT_USE_FILE}) + +set(SOURCES + abstractsqlstorage.cpp + basichandler.cpp + core.cpp + corebacklogmanager.cpp + corebufferviewconfig.cpp + corebufferviewmanager.cpp + coresession.cpp + coresettings.cpp + coreusersettings.cpp + ctcphandler.cpp + ircserverhandler.cpp + networkconnection.cpp + sessionthread.cpp + sqlitestorage.cpp + storage.cpp + userinputhandler.cpp) + +set(HEADERS + abstractsqlstorage.h + basichandler.h + core.h + corebacklogmanager.h + corebufferviewconfig.h + corebufferviewmanager.h + coresession.h + ctcphandler.h + ircserverhandler.h + networkconnection.h + sqlitestorage.h + storage.h + sessionthread.h + userinputhandler.h) + +if(NOT ${QT_DEFINITIONS} MATCHES "-DQT_NO_OPENSSL") + set(SOURCES ${SOURCES} sslserver.cpp) + set(HEADERS ${HEADERS} sslserver.h) +endif(NOT ${QT_DEFINITIONS} MATCHES "-DQT_NO_OPENSSL") + +QT4_WRAP_CPP(MOC ${HEADERS}) + +include_directories(${CMAKE_SOURCE_DIR}/src/common) + +add_library(mod_core STATIC ${SOURCES} ${MOC}) +add_dependencies(mod_core mod_common) diff --git a/src/qtui/CMakeLists.txt b/src/qtui/CMakeLists.txt new file mode 100644 index 00000000..f6187479 --- /dev/null +++ b/src/qtui/CMakeLists.txt @@ -0,0 +1,105 @@ +# Builds the qtui module + +set(QT_USE_QTNETWORK 1) +include(${QT_USE_FILE}) + +set(SOURCES + aboutdlg.cpp + bufferwidget.cpp + coreconfigwizard.cpp + coreconnectdlg.cpp + configwizard.cpp + debugconsole.cpp + inputwidget.cpp + jumpkeyhandler.cpp + mainwin.cpp + nicklistwidget.cpp + qtui.cpp + qtuisettings.cpp + qtuistyle.cpp + settingsdlg.cpp + settingspagedlg.cpp + titlesetter.cpp + topicbutton.cpp + topicwidget.cpp + verticaldock.cpp) + +set(HEADERS + aboutdlg.h + bufferwidget.h + coreconfigwizard.h + coreconnectdlg.h + configwizard.h + debugconsole.h + inputwidget.h + jumpkeyhandler.h + mainwin.h + nicklistwidget.h + qtui.h + settingsdlg.h + settingspagedlg.h + titlesetter.h + topicbutton.h + topicwidget.h + verticaldock.h) + +if(SPUTDEV) + set(SOURCES ${SOURCES} chatitem.cpp chatline.cpp chatlinemodelitem.cpp + chatlinemodel.cpp chatscene.cpp chatview.cpp) + set(HEADERS ${HEADERS} chatlinemodel.h chatscene.h chatview.h) +else(SPUTDEV) + set(SOURCES ${SOURCES} chatline-old.cpp chatwidget.cpp) + set(HEADERS ${HEADERS} chatline-old.h chatwidget.h) +endif(SPUTDEV) + +set(FORMS + aboutdlg.ui + bufferviewwidget.ui + bufferwidget.ui + coreaccounteditdlg.ui + coreconfigwizardintropage.ui + coreconfigwizardadminuserpage.ui + coreconfigwizardstorageselectionpage.ui + coreconfigwizardsyncpage.ui + coreconnectdlg.ui + debugconsole.ui + inputwidget.ui + mainwin.ui + nicklistwidget.ui + settingsdlg.ui + settingspagedlg.ui + topicwidget.ui) + +foreach(FORM ${FORMS}) + set(FORMPATH ${FORMPATH} ui/${FORM}) +endforeach(FORM ${FORMS}) + +# handle settingspages +include(settingspages/settingspages.inc) +foreach(SP ${SETTINGSPAGES}) + set(SPSRC ${SPSRC} settingspages/${SP}settingspage.cpp) + set(SPHDR ${SPHDR} settingspages/${SP}settingspage.h) + set(SPFRM ${SPFRM} settingspages/${SP}settingspage.ui) +endforeach(SP ${SETTINGSPAGES}) +foreach(SRC ${SP_SOURCES}) + set(SPSRC ${SPSRC} settingspages/${SRC}) +endforeach(SRC ${SP_SOURCES}) +foreach(HDR ${SP_HEADERS}) + set(SPHDR ${SPHDR} settingspages/${HDR}) +endforeach(HDR ${SP_HEADERS}) +foreach(FRM ${SP_FORMS}) + set(SPFRM ${SPFRM} settingspages/${FRM}) +endforeach(FRM ${SP_FORMS}) + + +qt4_wrap_cpp(MOC ${HEADERS} ${SPHDR}) +qt4_wrap_ui(UI ${FORMPATH} ${SPFRM}) + +include_directories(${CMAKE_SOURCE_DIR}/src/common + ${CMAKE_SOURCE_DIR}/src/client + ${CMAKE_SOURCE_DIR}/src/qtui + ${CMAKE_SOURCE_DIR}/src/uisupport + ${CMAKE_CURRENT_BINARY_DIR}) + +add_library(mod_qtui STATIC ${SOURCES} ${SPSRC} ${MOC} ${UI}) +add_dependencies(mod_qtui mod_common mod_client mod_uisupport) diff --git a/src/qtui/settingspages/settingspages.inc b/src/qtui/settingspages/settingspages.inc new file mode 100644 index 00000000..b3d93b66 --- /dev/null +++ b/src/qtui/settingspages/settingspages.inc @@ -0,0 +1,8 @@ +# Putting $FOO in SETTINGSPAGES automatically includes +# $FOOsettingspage.cpp, $FOOsettingspage.h and $FOOsettingspage.ui +set(SETTINGSPAGES appearance bufferview color fonts general highlight identities networks) + +# Specify additional files (e.g. for subdialogs) here! +set(SP_SOURCES ) +set(SP_HEADERS ) +set(SP_FORMS buffervieweditdlg.ui createidentitydlg.ui saveidentitiesdlg.ui networkeditdlg.ui nickeditdlg.ui servereditdlg.ui) diff --git a/src/uisupport/CMakeLists.txt b/src/uisupport/CMakeLists.txt new file mode 100644 index 00000000..7e30d1d9 --- /dev/null +++ b/src/uisupport/CMakeLists.txt @@ -0,0 +1,48 @@ +# Builds the uisupport module + +set(QT_USE_QTNETWORK 1) +include(${QT_USE_FILE}) + +set(SOURCES + abstractbuffercontainer.cpp + abstractitemview.cpp + bufferview.cpp + bufferviewfilter.cpp + clearablelineedit.cpp + colorbutton.cpp + nickviewfilter.cpp + inputline.cpp + nickview.cpp + settingspage.cpp + tabcompleter.cpp + uisettings.cpp + uistylesettings.cpp) + +set(HEADERS + abstractbuffercontainer.h + abstractitemview.h + bufferview.h + bufferviewfilter.h + clearablelineedit.h + colorbutton.h + nickviewfilter.h + inputline.h + nickview.h + settingspage.h + tabcompleter.h) + +if(SPUTDEV) + set(SOURCES ${SOURCES} uistyle.cpp) + set(HEADERS ${HEADERS} ) +else(SPUTDEV) + set(SOURCES ${SOURCES} old-uistyle.cpp) + set(HEADERS ${HEADERS} ) +endif(SPUTDEV) + +qt4_wrap_cpp(MOC ${HEADERS}) + +include_directories(${CMAKE_SOURCE_DIR}/src/common + ${CMAKE_SOURCE_DIR}/src/client) + +add_library(mod_uisupport STATIC ${SOURCES} ${MOC}) +add_dependencies(mod_uisupport mod_common mod_client)