Commit 8f0a9602 authored by Henrik Fehlauer's avatar Henrik Fehlauer

Fix build with cfitsio

Summary:
Out-of-source builds would fail, as well as builds with a recent GCC.

However, this is more of an emergency build fix. Including the moc file
instead of fixing the linking error is still a hack and should
be fixed properly (see D7305).

Test Plan:
- Builds on KDE Neon (GCC 5.4) as well as openSUSE Tumbleweed (GCC 7.1).
- Out-of-source and in-source builds succeed.

Reviewers: cfeck, ngraham, ckertesz

Reviewed By: ngraham

Differential Revision: https://phabricator.kde.org/D8001
parent b49569c9
......@@ -3,17 +3,6 @@ include_directories(
${EXIV2_INCLUDE_DIR}
)
# This hack is needed to include the fitsplugin moc file in main.cpp
# Otherwise the linker complains about: undefined reference to `qt_static_plugin_FitsPlugin()'
# This symbol is defined in the moc file, but it is not a visible symbol after libgwenview is linked.
# If Q_IMPORT_PLUGIN(FitsPlugin) is moved to the library, gwenview crashes on the first call to FitsPlugin()
# when the vtable is looked up in the plugin registration.
# The json and include files must be copied here locally otherwise the moc complains about these "missing files".
IF (UNIX AND NOT APPLE)
FILE(COPY ${CMAKE_SOURCE_DIR}/lib/imageformats/fitsplugin.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
FILE(COPY ${CMAKE_SOURCE_DIR}/lib/imageformats/fitsplugin.h DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
ENDIF ()
# For lib/gwenviewconfig.h and config-gwenview.h
include_directories(
${CMAKE_CURRENT_BINARY_DIR}/..
......
......@@ -40,9 +40,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <lib/imageformats/imageformats.h>
#include "mainwindow.h"
#if defined(Q_OS_LINUX)
#include <lib/moc_fitsplugin.cpp>
#endif
// This hack is needed to include the fitsplugin moc file in main.cpp
// Otherwise the linker complains about: undefined reference to `qt_static_plugin_FitsPlugin()'
// This symbol is defined in the moc file, but it is not a visible symbol after libgwenview is linked.
// If Q_IMPORT_PLUGIN(FitsPlugin) is moved to the library, gwenview crashes on the first call to FitsPlugin()
// when the vtable is looked up in the plugin registration.
#include <../lib/imageformats/moc_fitsplugin.cpp>
class StartHelper
{
......
......@@ -56,6 +56,7 @@ include_directories(
${EXIV2_INCLUDE_DIR}
${JPEG_INCLUDE_DIR}
${PNG_INCLUDE_DIRS}
${CFITSIO_INCLUDE_DIR}
)
# For config-gwenview.h
......
......@@ -25,7 +25,7 @@ Gwenview: an image viewer
#include <QApplication>
#include <QImage>
#include <float.h>
#include <math.h>
FITSData::FITSData()
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment