Commit 09992c93 authored by Alex Richardson's avatar Alex Richardson

fix build by using CMake generate_export_header()

parent 65c1e581
......@@ -12,10 +12,7 @@ include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings)
find_package(Qt5 REQUIRED NO_MODULE COMPONENTS Core Widgets Script ScriptTools Xml Network Designer PrintSupport)
if (BUILD_TESTING)
find_package(Qt5Test REQUIRED NO_MODULE)
endif()
find_package(Qt5 REQUIRED NO_MODULE COMPONENTS Core Widgets Script ScriptTools Xml Network Designer PrintSupport Test)
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0) #allow deprecated functions for now
find_package(KF5 CONFIG REQUIRED COMPONENTS NewStuff KCMUtils PrintUtils Codecs I18n ConfigWidgets
......@@ -27,7 +24,6 @@ endif()
set( CMAKE_INCLUDE_CURRENT_DIR ON )
set( CMAKE_AUTOMOC TRUE )
include(FeatureSummary)
find_package(QCA2)
......
......@@ -53,7 +53,7 @@ set( oktetacore_LIB_SRCS
)
set( oktetacore_LIB_HDRS
oktetacore_export.h
${CMAKE_CURRENT_BINARY_DIR}/oktetacore_export.h
oktetacore.h
address.h
size.h
......@@ -116,7 +116,7 @@ set( oktetacore_LIB_CCHDRS
#set( oktetacore_LIB_OBJS $<TARGET_OBJECTS:oktetacore_objs>)
# compile flags don't get set for object libraries, since cannot link to target
#TODO: find out how to properly use targets
#TODO: find out how to properly use targets for object libraries
set( oktetacore_LIB_OBJS ${oktetacore_LIB_SRCS} )
......@@ -128,6 +128,9 @@ target_link_libraries( ${oktetacore_LIB} LINK_PRIVATE
KF5::Codecs #needed for codecs
)
generate_export_header( ${oktetacore_LIB} )
target_include_directories( ${oktetacore_LIB} PUBLIC ${CMAKE_CURRENT_BINARY_DIR} )
set_target_properties( ${oktetacore_LIB} PROPERTIES
OUTPUT_NAME ${oktetacore_LIB_NAME}
VERSION ${OKTETALIBS_LIB_VERSION}
......@@ -148,7 +151,9 @@ install( FILES ${oktetacore_LIB_CCHDRS}
if(BUILD_TESTING)
add_library( testoktetacore STATIC ${oktetacore_LIB_OBJS} )
target_link_libraries( testoktetacore Qt5::Core KF5::KDE4Support)
set_target_properties( testoktetacore PROPERTIES COMPILE_FLAGS -DOKTETACORE_STATIC_DEFINE )
target_include_directories( testoktetacore PUBLIC ${CMAKE_CURRENT_BINARY_DIR} )
target_link_libraries( testoktetacore Qt5::Core KF5::KDE4Support )
add_subdirectory( piecetable/tests )
add_subdirectory( tests )
endif()
/*
This file is part of the Okteta Core library, made within the KDE community.
Copyright 2008 Friedrich W. H. Kossebau <kossebau@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) version 3, or any
later version accepted by the membership of KDE e.V. (or its
successor approved by the membership of KDE e.V.), which shall
act as a proxy defined in Section 6 of version 3 of the license.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OKTETACORE_EXPORT_H
#define OKTETACORE_EXPORT_H
// KF5
#include <kdemacros.h>
#ifndef OKTETACORE_EXPORT
// building the library?
# if defined(MAKE_OKTETACORE_LIB)
# define OKTETACORE_EXPORT KDE_EXPORT
// using the library
# else
# define OKTETACORE_EXPORT KDE_IMPORT
# endif
#endif
# ifndef OKTETACORE_EXPORT_DEPRECATED
# define OKTETACORE_EXPORT_DEPRECATED KDE_DEPRECATED OKTETACORE_EXPORT
# endif
#endif
include(ECMAddTests)
set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} )
set( SUTDIR ${CMAKE_CURRENT_SOURCE_DIR}/.. )
include_directories( ${SUTDIR} )
include_directories(
${CMAKE_CURRENT_BINARY_DIR}/.. # for oktetacore_export.h
${CMAKE_CURRENT_SOURCE_DIR}/.. # okteta core includes
)
# make sure to not use KDE_EXPORT or KDE_IMPORT because we link statically
# against a small part of the libs
add_definitions(-DOKTETACORE_EXPORT=)
add_definitions(-DOKTETACORE_STATIC_DEFINE)
# helper
set( oktetacoretestutil_LIB_SRCS
......@@ -19,7 +21,7 @@ target_link_libraries( oktetacoretestutil Qt5::Core )
ecm_add_test(
arraychangemetricstest.cpp
# ${SUTDIR}/arraychangemetrics.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/../arraychangemetrics.cpp
TEST_NAME arraychangemetricstest
NAME_PREFIX libokteta-core-
LINK_LIBRARIES Qt5::Test
......
......@@ -75,7 +75,7 @@ set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/kcursor.cpp PROPERTIES L
set( oktetagui_LIB_HDRS
${libcolumnsview_HDRS}
oktetagui_export.h
${CMAKE_CURRENT_BINARY_DIR}/oktetagui_export.h
oktetagui.h
lineposition.h
line.h
......@@ -127,6 +127,10 @@ target_link_libraries( ${oktetagui_LIB} LINK_PUBLIC
${oktetacore_LIB}
Qt5::Widgets
)
generate_export_header( ${oktetagui_LIB} )
target_include_directories( ${oktetagui_LIB} PUBLIC ${CMAKE_CURRENT_BINARY_DIR} )
target_link_libraries( ${oktetagui_LIB} LINK_PRIVATE
KF5::I18n
KF5::ConfigWidgets
......
......@@ -25,6 +25,9 @@
// lib
#include "oktetagui_export.h"
// Qt
#include <QtGlobal>
class QPalette;
......
......@@ -53,7 +53,7 @@ class OKTETAGUI_EXPORT OffsetColumnRenderer : public AbstractColumnRenderer
public:
void setFormat( OffsetFormat::Format format, const QFontMetrics& fontMetrics );
KDE_DEPRECATED void setFormat( OffsetFormat::Format format );
OKTETAGUI_DEPRECATED void setFormat( OffsetFormat::Format format );
void setFontMetrics( const QFontMetrics& fontMetrics );
public: // read access
......
/*
This file is part of the Okteta Gui library, made within the KDE community.
Copyright 2008 Friedrich W. H. Kossebau <kossebau@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) version 3, or any
later version accepted by the membership of KDE e.V. (or its
successor approved by the membership of KDE e.V.), which shall
act as a proxy defined in Section 6 of version 3 of the license.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OKTETAGUI_EXPORT_H
#define OKTETAGUI_EXPORT_H
// KF5
#include <kdemacros.h>
#ifndef OKTETAGUI_EXPORT
// building the library?
# if defined(MAKE_OKTETAGUI_LIB)
# define OKTETAGUI_EXPORT KDE_EXPORT
// using the library
# else
# define OKTETAGUI_EXPORT KDE_IMPORT
# endif
#endif
# ifndef OKTETAGUI_EXPORT_DEPRECATED
# define OKTETAGUI_EXPORT_DEPRECATED KDE_DEPRECATED OKTETAGUI_EXPORT
# endif
#endif
......@@ -5,14 +5,14 @@ set( SUTDIR ${CMAKE_CURRENT_SOURCE_DIR}/.. )
# make sure to not use KDE_EXPORT or KDE_IMPORT because we link statically
# against a small part of the libs
add_definitions( -DOKTETACORE_EXPORT= )
add_definitions( -DOKTETAGUI_EXPORT= )
add_definitions( -DOKTETACORE_STATIC_DEFINE -DOKTETAGUI_STATIC_DEFINE )
include_directories(
${SUTDIR}
${CMAKE_CURRENT_BINARY_DIR}/..
${CMAKE_CURRENT_BINARY_DIR}/../../core
)
ecm_add_test(
selectiontest.cpp
TEST_NAME selectiontest
......
......@@ -394,6 +394,9 @@ set( VIEWPROFILESMANAGECONTROLLER_SRCS
#create a OBJECT library (http://www.cmake.org/Wiki/CMake/Tutorials/Object_Library)
#to prevent compiling these object files twice with exactly the same compile flags
# compile flags don't get set for object libraries, since cannot link to target
#TODO: find out how to properly use targets for object libraries
if ( FALSE )
add_library( poddecoder_objs OBJECT ${PODDECODERCONTROLLER_SRCS} )
target_include_directories( poddecoder_objs PUBLIC
$<TARGET_PROPERTY:Qt5::Core,INTERFACE_INCLUDE_DIRECTORIES>
......@@ -411,6 +414,10 @@ target_include_directories( structview_objs PUBLIC
set_target_properties(poddecoder_objs structview_objs PROPERTIES POSITION_INDEPENDENT_CODE ON)
set( PODDECODER_OBJS $<TARGET_OBJECTS:poddecoder_objs>)
set( STRUCTVIEW_OBJS $<TARGET_OBJECTS:structview_objs>)
endif()
set( PODDECODER_OBJS ${PODDECODERCONTROLLER_SRCS})
set( STRUCTVIEW_OBJS ${STRUCTVIEW_TESTED_SRCS})
set( OKTETA_KASTEN_CONTROLLERS_SRCS
......@@ -617,6 +624,6 @@ set( okteta_kastencontrollers_templates_SRCS
)
kde4_add_library( oktetakastencontrollertemplates STATIC ${okteta_kastencontrollers_templates_SRCS} )
target_link_libraries( oktetakastencontrollertemplates Qt5::Widgets KF5::KDE4Support)
target_link_libraries( oktetakastencontrollertemplates Qt5::Widgets KF5::KDE4Support ${oktetacore_LIB} )
endif( KASTEN_BUILD_INTERNAL_TEMPLATES )
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