From: Manuel Nickschas Date: Mon, 31 Mar 2014 19:58:27 +0000 (+0200) Subject: Fix Qt resource handling X-Git-Tag: 0.11.0~43 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=c3c6809d89bd860cb74c7cc1336f190cfe97a3b9 Fix Qt resource handling Turns out we have to explicitly initialize Qt resources that are linked statically, so our last build system change broke things because the files where nowhere to be found. This now initializes the resources in main(); additionally, we use absolute paths for the qrc files now, simply for making things a bit clearer. --- diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index c5e6c9b6..e9f4a066 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -14,7 +14,7 @@ if (BUILD_GUI) endif() if (EMBED_DATA) - set(CLIENT_RCS ${CLIENT_RCS} ../../data/data.qrc PARENT_SCOPE) + set(CLIENT_RCS ${CLIENT_RCS} ${CMAKE_CURRENT_SOURCE_DIR}/data.qrc PARENT_SCOPE) else() install(FILES networks.ini DESTINATION ${DATA_INSTALL_DIR}/quassel) install(DIRECTORY stylesheets DESTINATION ${DATA_INSTALL_DIR}/quassel) diff --git a/icons/CMakeLists.txt b/icons/CMakeLists.txt index fe2273d4..b9cc9a03 100644 --- a/icons/CMakeLists.txt +++ b/icons/CMakeLists.txt @@ -25,9 +25,9 @@ if(WANT_MONO OR WANT_QTCLIENT) endif(INSTALL_OXY) if(EMBED_DATA) - set(ICON_RCS ../../icons/hicolor.qrc ../../icons/oxygen.qrc) + set(ICON_RCS ${CMAKE_CURRENT_SOURCE_DIR}/hicolor.qrc ${CMAKE_CURRENT_SOURCE_DIR}/oxygen.qrc) if(INSTALL_OXY) - set(ICON_RCS ${ICON_RCS} ../../icons/oxygen_kde.qrc) + set(ICON_RCS ${ICON_RCS} ${CMAKE_CURRENT_SOURCE_DIR}/oxygen_kde.qrc) endif(INSTALL_OXY) set(CLIENT_RCS ${CLIENT_RCS} ${ICON_RCS} PARENT_SCOPE) else(EMBED_DATA) diff --git a/pics/CMakeLists.txt b/pics/CMakeLists.txt index 75f44aae..42da3884 100644 --- a/pics/CMakeLists.txt +++ b/pics/CMakeLists.txt @@ -11,16 +11,16 @@ if(WIN32) set(COMMON_DEPS ${COMMON_DEPS} ${CMAKE_CURRENT_BINARY_DIR}/win32.o PARENT_SCOPE) endif(WINDRES_EXECUTABLE) else(MINGW) - set(COMMON_DEPS ${COMMON_DEPS} ../../pics/win32.rc PARENT_SCOPE) + set(COMMON_DEPS ${COMMON_DEPS} ${CMAKE_CURRENT_SOURCE_DIR}/win32.rc PARENT_SCOPE) endif(MINGW) endif(WIN32) if(WANT_MONO OR WANT_QTCLIENT) if(EMBED_DATA) - set(CLIENT_RCS ${CLIENT_RCS} ../../pics/pics.qrc PARENT_SCOPE) + set(CLIENT_RCS ${CLIENT_RCS} ${CMAKE_CURRENT_SOURCE_DIR}/pics.qrc PARENT_SCOPE) else(EMBED_DATA) # We don't find them yet externally, so disable installation - set(CLIENT_RCS ${CLIENT_RCS} ../../pics/pics.qrc PARENT_SCOPE) + set(CLIENT_RCS ${CLIENT_RCS} ${CMAKE_CURRENT_SOURCE_DIR}/pics.qrc PARENT_SCOPE) # install(FILES qt-logo.png # quassel-large.png # DESTINATION ${DATA_INSTALL_DIR}/quassel/pics) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 49052e14..4d431e49 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -22,6 +22,13 @@ endif(BUILD_GUI) include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) # for version.gen +# We need to initialize the appropriate resources, so let's give our main.cpp some hints +if (EMBED_DATA) + add_definitions(-DEMBED_DATA) +endif() +if (WITH_OXYGEN) + add_definitions(-DWITH_OXYGEN) +endif() if(WANT_CORE) add_executable(quasselcore common/main.cpp) diff --git a/src/common/main.cpp b/src/common/main.cpp index d3813816..7884dfa6 100644 --- a/src/common/main.cpp +++ b/src/common/main.cpp @@ -62,6 +62,26 @@ int main(int argc, char **argv) QApplication::setGraphicsSystem("raster"); #endif + // We need to explicitly initialize the required resources when linking statically +#ifndef BUILD_QTUI + Q_INIT_RESOURCE(sql); +#endif +#ifndef BUILD_CORE + Q_INIT_RESOURCE(pics); // always in a resource, for now +#endif + +#ifdef EMBED_DATA + Q_INIT_RESOURCE(i18n); +# ifndef BUILD_CORE + Q_INIT_RESOURCE(data); + Q_INIT_RESOURCE(hicolor); + Q_INIT_RESOURCE(oxygen); +# ifdef WITH_OXYGEN + Q_INIT_RESOURCE(oxygen_kde); +# endif +# endif +#endif + AbstractCliParser *cliParser; #ifdef HAVE_KDE diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index deca4286..6a0611af 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -56,8 +56,7 @@ endif() include_directories(${CMAKE_SOURCE_DIR}/src/common) -set(CORE_RCS ${CORE_RCS} core/sql.qrc PARENT_SCOPE) - +set(CORE_RCS ${CORE_RCS} ${CMAKE_CURRENT_SOURCE_DIR}/sql.qrc) qt_add_resources(SOURCES ${CORE_RCS}) add_library(mod_core STATIC ${SOURCES})