forked from romixlab/qmsgpack
Patches to get it working with Qt6
This commit is contained in:
@@ -1,12 +1,12 @@
|
|||||||
#set(Qt5Core_DIR "/opt/Qt5.6.0/5.6/gcc_64/lib/cmake/Qt5Core")
|
#set(Qt6Core_DIR "/opt/Qt6.6.0/5.6/gcc_64/lib/cmake/Qt6Core")
|
||||||
#set(Qt5Test_DIR "/opt/Qt5.6.0/5.6/gcc_64/lib/cmake/Qt5Test")
|
#set(Qt6Test_DIR "/opt/Qt6.6.0/5.6/gcc_64/lib/cmake/Qt6Test")
|
||||||
#set(Qt5_DIR "/opt/Qt5.6.0/5.6/gcc_64/lib/cmake/Qt5Core")
|
#set(Qt6_DIR "/opt/Qt6.6.0/5.6/gcc_64/lib/cmake/Qt6Core")
|
||||||
#set(QT_QMAKE_EXECUTABLE "/opt/Qt5.6.0/5.6/gcc_64/bin/qmake")
|
#set(QT_QMAKE_EXECUTABLE "/opt/Qt6.6.0/5.6/gcc_64/bin/qmake")
|
||||||
|
|
||||||
project(qmsgpack)
|
project(qmsgpack)
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.1.0)
|
cmake_minimum_required(VERSION 3.1.0)
|
||||||
set (CMAKE_CXX_STANDARD 11)
|
set (CMAKE_CXX_STANDARD 20)
|
||||||
|
|
||||||
set(CMAKE_INSTALL_NAME_DIR ${LIB_INSTALL_DIR})
|
set(CMAKE_INSTALL_NAME_DIR ${LIB_INSTALL_DIR})
|
||||||
|
|
||||||
@@ -22,49 +22,49 @@ endif (WIN32)
|
|||||||
|
|
||||||
option (QT4_BUILD "BUild with Qt4")
|
option (QT4_BUILD "BUild with Qt4")
|
||||||
if (NOT QT4_BUILD)
|
if (NOT QT4_BUILD)
|
||||||
find_package(Qt5Core QUIET)
|
find_package(Qt6Core QUIET)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (Qt5Core_FOUND)
|
if (Qt6Core_FOUND)
|
||||||
message("Qt5 found")
|
message("Qt6 found")
|
||||||
include_directories(${Qt5Core_INCLUDE_DIRS})
|
include_directories(${Qt6Core_INCLUDE_DIRS})
|
||||||
add_definitions(${Qt5Core_DEFINITIONS})
|
add_definitions(${Qt6Core_DEFINITIONS})
|
||||||
# Find includes in corresponding build directories
|
# Find includes in corresponding build directories
|
||||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||||
# Instruct CMake to run moc automatically when needed.
|
# Instruct CMake to run moc automatically when needed.
|
||||||
set(CMAKE_AUTOMOC ON)
|
set(CMAKE_AUTOMOC ON)
|
||||||
set(PC_Requires "Qt5Core")
|
set(PC_Requires "Qt6Core")
|
||||||
else ()
|
else ()
|
||||||
message("Qt5 not found, searching for Qt4")
|
message("Qt6 not found, searching for Qt4")
|
||||||
find_package(Qt4 REQUIRED)
|
find_package(Qt4 REQUIRED)
|
||||||
include(${QT_USE_FILE})
|
include(${QT_USE_FILE})
|
||||||
# Find includes in corresponding build directories
|
# Find includes in corresponding build directories
|
||||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||||
# Instruct CMake to run moc automatically when needed.
|
# Instruct CMake to run moc automatically when needed.
|
||||||
set(CMAKE_AUTOMOC ON)
|
set(CMAKE_AUTOMOC ON)
|
||||||
set(PC_Requires "QtCore")
|
set(PC_Requires "QtCore")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
option (WITH_GUI_TYPES "Build with support for QtGui types")
|
option (WITH_GUI_TYPES "Build with support for QtGui types")
|
||||||
if (WITH_GUI_TYPES)
|
if (WITH_GUI_TYPES)
|
||||||
if (QT4_BUILD)
|
if (QT4_BUILD)
|
||||||
find_package(Qt4 QTGUI)
|
find_package(Qt4 QTGUI)
|
||||||
else ()
|
else ()
|
||||||
find_package(Qt5Gui QUIET)
|
find_package(Qt6Gui QUIET)
|
||||||
endif ()
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
option (WITH_LOCATION_TYPES "Build with support for QtLocation types")
|
option (WITH_LOCATION_TYPES "Build with support for QtLocation types")
|
||||||
if (WITH_LOCATION_TYPES)
|
if (WITH_LOCATION_TYPES)
|
||||||
find_package(Qt5Location QUIET)
|
find_package(Qt6Location QUIET)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (Qt5Location_FOUND)
|
if (Qt6Location_FOUND)
|
||||||
message("Qt5Location found")
|
message("Qt6Location found")
|
||||||
include_directories(${Qt5Location_INCLUDE_DIRS})
|
include_directories(${Qt6Location_INCLUDE_DIRS})
|
||||||
add_definitions(${Qt5Location_DEFINITIONS})
|
add_definitions(${Qt6Location_DEFINITIONS})
|
||||||
else ()
|
else ()
|
||||||
message("Qt5Location not found")
|
message("Qt6Location not found")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (NOT WIN32)
|
if (NOT WIN32)
|
||||||
|
@@ -8,14 +8,14 @@ endif(NOT DEFINED COMPILE_TYPE)
|
|||||||
|
|
||||||
add_library(qmsgpack ${COMPILE_TYPE} ${qmsgpack_srcs} ${qmsgpack_headers})
|
add_library(qmsgpack ${COMPILE_TYPE} ${qmsgpack_srcs} ${qmsgpack_headers})
|
||||||
|
|
||||||
if (Qt5Core_FOUND)
|
if (Qt6Core_FOUND)
|
||||||
target_link_libraries(qmsgpack Qt5::Core)
|
target_link_libraries(qmsgpack Qt6::Core)
|
||||||
else ()
|
else ()
|
||||||
target_link_libraries(qmsgpack ${QT_LIBRARIES})
|
target_link_libraries(qmsgpack ${QT_LIBRARIES})
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (Qt5Gui_FOUND)
|
if (Qt6Gui_FOUND)
|
||||||
target_link_libraries(qmsgpack Qt5::Gui)
|
target_link_libraries(qmsgpack Qt6::Gui)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
configure_file(
|
configure_file(
|
||||||
|
@@ -1,34 +0,0 @@
|
|||||||
set(qmsgpack_srcs msgpack.cpp msgpack_common.cpp stream.cpp private/pack_p.cpp private/unpack_p.cpp private/qt_types_p.cpp)
|
|
||||||
set(qmsgpack_headers msgpack.h stream.h msgpack_common.h msgpack_export.h endianhelper.h)
|
|
||||||
|
|
||||||
add_library(qmsgpack SHARED ${qmsgpack_srcs} ${qmsgpack_headers})
|
|
||||||
|
|
||||||
if (Qt5Core_FOUND)
|
|
||||||
target_link_libraries(qmsgpack Qt5::Core)
|
|
||||||
else ()
|
|
||||||
target_link_libraries(qmsgpack ${QT_LIBRARIES})
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
if (Qt5Gui_FOUND)
|
|
||||||
target_link_libraries(qmsgpack Qt5::Gui)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
configure_file(
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/msgpack_common.h.in"
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/msgpack_common.h"
|
|
||||||
IMMEDIATE @ONLY)
|
|
||||||
|
|
||||||
if (NOT android)
|
|
||||||
set_target_properties(qmsgpack PROPERTIES
|
|
||||||
VERSION ${QMSGPACK_MAJOR}.${QMSGPACK_MINOR}.${QMSGPACK_VERSION}
|
|
||||||
SOVERSION ${QMSGPACK_MAJOR})
|
|
||||||
endif ()
|
|
||||||
set_target_properties(qmsgpack PROPERTIES
|
|
||||||
DEFINE_SYMBOL MSGPACK_MAKE_LIB
|
|
||||||
PUBLIC_HEADER "${qmsgpack_headers}")
|
|
||||||
|
|
||||||
install(TARGETS qmsgpack EXPORT qmsgpack-export
|
|
||||||
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
|
|
||||||
RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
|
|
||||||
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
|
|
||||||
PUBLIC_HEADER DESTINATION ${INCLUDE_INSTALL_DIR}/qmsgpack)
|
|
Reference in New Issue
Block a user