mirror of
https://github.com/QuasarApp/qca.git
synced 2025-04-26 11:34:32 +00:00
Port to Qt5 (when Qt5 is found, otherwise use Qt4)
The unittests are disabled (because of QSKIP) and the plugins currently break compilation (because of Q_EXPORT_PLUGIN2) svn path=/trunk/kdesupport/qca/; revision=1338378
This commit is contained in:
parent
d349189b84
commit
6e0134f3b3
@ -4,17 +4,26 @@ cmake_minimum_required(VERSION 2.4.5)
|
||||
|
||||
option(BUILD_TESTS "Create test" ON)
|
||||
|
||||
set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" )
|
||||
|
||||
set(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" CACHE STRING "Directory where lib will install")
|
||||
|
||||
set(PKGCONFIG_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/pkgconfig/" CACHE STRING "Base directory for pkgconfig files")
|
||||
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" )
|
||||
|
||||
find_package(Qt4 REQUIRED)
|
||||
# properly set up compile flags (QT_DEBUG/QT_NO_DEBUG, ...)
|
||||
include(${QT_USE_FILE})
|
||||
find_package(Qt5Core QUIET)
|
||||
if (Qt5Core_FOUND)
|
||||
message(STATUS "Building with Qt5 support")
|
||||
find_package(ECM 0.0.6 REQUIRED NO_MODULE)
|
||||
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_MODULE_PATH})
|
||||
find_package(Qt5Transitional REQUIRED Core Network)
|
||||
include(GNUInstallDirs)
|
||||
set(LIB_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}")
|
||||
else()
|
||||
set(QT_MIN_VERSION "4.7.0")
|
||||
find_package(Qt4 REQUIRED)
|
||||
# properly set up compile flags (QT_DEBUG/QT_NO_DEBUG, ...)
|
||||
include(${QT_USE_FILE})
|
||||
set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" )
|
||||
set(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" CACHE STRING "Directory where lib will install")
|
||||
endif()
|
||||
|
||||
set(PKGCONFIG_INSTALL_PREFIX "${LIB_INSTALL_DIR}/pkgconfig/" CACHE STRING "Base directory for pkgconfig files")
|
||||
|
||||
set(QCA_LIB_MAJOR_VERSION "2")
|
||||
set(QCA_LIB_MINOR_VERSION "0")
|
||||
@ -148,7 +157,7 @@ add_subdirectory(src)
|
||||
add_subdirectory(tools)
|
||||
add_subdirectory(plugins)
|
||||
|
||||
if(BUILD_TESTS)
|
||||
if(BUILD_TESTS AND NOT Qt5Core_FOUND)
|
||||
enable_testing()
|
||||
add_subdirectory(unittest)
|
||||
add_subdirectory(examples)
|
||||
|
@ -1,4 +1,16 @@
|
||||
|
||||
IF (Qt5Core_FOUND)
|
||||
# FindQt4.cmake wasn't used, so define it here
|
||||
MACRO (QT4_GET_MOC_INC_DIRS _moc_INC_DIRS)
|
||||
SET(${_moc_INC_DIRS})
|
||||
GET_DIRECTORY_PROPERTY(_inc_DIRS INCLUDE_DIRECTORIES)
|
||||
|
||||
FOREACH(_current ${_inc_DIRS})
|
||||
SET(${_moc_INC_DIRS} ${${_moc_INC_DIRS}} "-I" ${_current})
|
||||
ENDFOREACH(_current ${_inc_DIRS})
|
||||
ENDMACRO(QT4_GET_MOC_INC_DIRS)
|
||||
ENDIF()
|
||||
|
||||
MACRO(MY_AUTOMOC _srcsList)
|
||||
QT4_GET_MOC_INC_DIRS(_moc_INCS)
|
||||
FOREACH (_current_FILE ${${_srcsList}})
|
||||
|
@ -258,7 +258,11 @@ private:
|
||||
int id = timers[n].id;
|
||||
for(int i = 0; i < edtimers.count(); ++i)
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
||||
if(edtimers[i].timerId == id)
|
||||
#else
|
||||
if(edtimers[i].first == id)
|
||||
#endif
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
@ -278,7 +282,11 @@ private:
|
||||
// added?
|
||||
for(int n = 0; n < edtimers.count(); ++n)
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
||||
int id = edtimers[n].timerId;
|
||||
#else
|
||||
int id = edtimers[n].first;
|
||||
#endif
|
||||
bool found = false;
|
||||
for(int i = 0; i < timers.count(); ++i)
|
||||
{
|
||||
@ -293,7 +301,11 @@ private:
|
||||
{
|
||||
TimerInfo info;
|
||||
info.id = id;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
||||
info.interval = edtimers[n].interval;
|
||||
#else
|
||||
info.interval = edtimers[n].second;
|
||||
#endif
|
||||
info.time.start();
|
||||
timers += info;
|
||||
#ifdef TIMERFIXER_DEBUG
|
||||
|
@ -32,7 +32,11 @@ QByteArray methodReturnType(const QMetaObject *obj, const QByteArray &method, co
|
||||
for(int n = 0; n < obj->methodCount(); ++n)
|
||||
{
|
||||
QMetaMethod m = obj->method(n);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
||||
QByteArray sig = m.methodSignature();
|
||||
#else
|
||||
QByteArray sig = m.signature();
|
||||
#endif
|
||||
int offset = sig.indexOf('(');
|
||||
if(offset == -1)
|
||||
continue;
|
||||
|
Loading…
x
Reference in New Issue
Block a user