Auto find qt version (qt5 has priority)
This commit is contained in:
parent
5c21a76653
commit
52ce5076db
@ -37,12 +37,11 @@ ADD_DEFINITIONS(-DPROJECT_NAME="${PROJECT_NAME}")
|
||||
####### DEPENDENCIES #######
|
||||
FIND_PACKAGE(OpenCV REQUIRED) # tested on 2.3.1
|
||||
|
||||
SET(FINDOBJECT_QT_VERSION 4 CACHE STRING "Which QT version to use")
|
||||
IF("${FINDOBJECT_QT_VERSION}" STREQUAL "4")
|
||||
# look for Qt5 before Qt4
|
||||
FIND_PACKAGE(Qt5 COMPONENTS Widgets Core Gui Network QUIET)
|
||||
IF(NOT Qt5_FOUND)
|
||||
FIND_PACKAGE(Qt4 COMPONENTS QtCore QtGui QtNetwork REQUIRED)
|
||||
ELSE()
|
||||
FIND_PACKAGE(Qt5 COMPONENTS Widgets Core Gui Network REQUIRED)
|
||||
ENDIF()
|
||||
ENDIF(NOT Qt5_FOUND)
|
||||
ADD_DEFINITIONS(-DQT_NO_KEYWORDS) # To avoid conflicts with boost signals used in ROS
|
||||
|
||||
SET(NONFREE 0)
|
||||
@ -243,11 +242,11 @@ IF(NOT CATKIN_BUILD)
|
||||
ENDIF()
|
||||
|
||||
IF(QT4_FOUND)
|
||||
MESSAGE(STATUS " With Qt = YES (version 4, \"-DFINDOBJECT_QT_VERSION=4\")")
|
||||
MESSAGE(STATUS " With Qt4 = YES")
|
||||
ELSEIF(Qt5_FOUND)
|
||||
MESSAGE(STATUS " With Qt = YES (version 5, \"-DFINDOBJECT_QT_VERSION=5\")")
|
||||
MESSAGE(STATUS " With Qt5 = YES")
|
||||
ELSE()
|
||||
MESSAGE(STATUS " With Qt = NO (Qt not found, to use Qt5 you should set -DFINDOBJECT_QT_VERSION=5)")
|
||||
MESSAGE(STATUS " With Qt = NO (Qt not found)")
|
||||
ENDIF()
|
||||
|
||||
IF(APPLE)
|
||||
|
||||
@ -3,7 +3,7 @@ SET(headers_ui
|
||||
TcpServerPool.h
|
||||
)
|
||||
|
||||
IF("${FINDOBJECT_QT_VERSION}" STREQUAL "4")
|
||||
IF(QT4_FOUND)
|
||||
QT4_WRAP_CPP(moc_srcs ${headers_ui})
|
||||
ELSE()
|
||||
QT5_WRAP_CPP(moc_srcs ${headers_ui})
|
||||
@ -15,9 +15,9 @@ SET(INCLUDE_DIRS
|
||||
${OpenCV_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
IF("${FINDOBJECT_QT_VERSION}" STREQUAL "4")
|
||||
IF(QT4_FOUND)
|
||||
INCLUDE(${QT_USE_FILE})
|
||||
ENDIF()
|
||||
ENDIF(QT4_FOUND)
|
||||
|
||||
SET(LIBRARIES
|
||||
${QT_LIBRARIES}
|
||||
@ -62,9 +62,9 @@ ELSE()
|
||||
ENDIF()
|
||||
# Linking with Qt libraries
|
||||
TARGET_LINK_LIBRARIES(find_object_app find_object ${LIBRARIES})
|
||||
IF("${FINDOBJECT_QT_VERSION}" STREQUAL "5")
|
||||
IF(Qt5_FOUND)
|
||||
QT5_USE_MODULES(find_object_app Widgets Core Gui Network PrintSupport)
|
||||
ENDIF()
|
||||
ENDIF(Qt5_FOUND)
|
||||
|
||||
IF(APPLE AND BUILD_AS_BUNDLE)
|
||||
SET_TARGET_PROPERTIES(find_object_app PROPERTIES
|
||||
|
||||
@ -9,9 +9,9 @@ SET(INCLUDE_DIRS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../include
|
||||
)
|
||||
|
||||
IF("${FINDOBJECT_QT_VERSION}" STREQUAL "4")
|
||||
IF(QT4_FOUND)
|
||||
INCLUDE(${QT_USE_FILE})
|
||||
ENDIF()
|
||||
ENDIF(QT4_FOUND)
|
||||
|
||||
SET(LIBRARIES
|
||||
${OpenCV_LIBS}
|
||||
@ -25,9 +25,9 @@ INCLUDE_DIRECTORIES(${INCLUDE_DIRS})
|
||||
# The extension is automatically found.
|
||||
ADD_EXECUTABLE(example ${SRC_FILES})
|
||||
TARGET_LINK_LIBRARIES(example find_object ${LIBRARIES})
|
||||
IF("${FINDOBJECT_QT_VERSION}" STREQUAL "5")
|
||||
IF(Qt5_FOUND)
|
||||
QT5_USE_MODULES(example Widgets Core Gui Network PrintSupport)
|
||||
ENDIF()
|
||||
ENDIF(Qt5_FOUND)
|
||||
|
||||
SET_TARGET_PROPERTIES( example
|
||||
PROPERTIES OUTPUT_NAME ${PROJECT_PREFIX}-example)
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<description>The find_object_2d package</description>
|
||||
|
||||
<maintainer email="matlabbe@gmail.com">Mathieu Labbe</maintainer>
|
||||
<license>LGPLv3</license>
|
||||
<license>BSD</license>
|
||||
<url type="website">http://find-object.googlecode.com</url>
|
||||
<author email="matlabbe@gmail.com">Mathieu Labbe</author>
|
||||
|
||||
|
||||
@ -34,7 +34,7 @@ SET(qrc
|
||||
./resources.qrc
|
||||
)
|
||||
|
||||
IF("${FINDOBJECT_QT_VERSION}" STREQUAL "4")
|
||||
IF(QT4_FOUND)
|
||||
# generate rules for building source files from the resources
|
||||
QT4_ADD_RESOURCES(srcs_qrc ${qrc})
|
||||
|
||||
@ -101,9 +101,9 @@ IF(CATKIN_BUILD)
|
||||
)
|
||||
ENDIF(CATKIN_BUILD)
|
||||
|
||||
IF("${FINDOBJECT_QT_VERSION}" STREQUAL "4")
|
||||
IF(QT4_FOUND)
|
||||
INCLUDE(${QT_USE_FILE})
|
||||
ENDIF()
|
||||
ENDIF(QT4_FOUND)
|
||||
|
||||
SET(LIBRARIES
|
||||
${QT_LIBRARIES}
|
||||
@ -123,9 +123,9 @@ INCLUDE_DIRECTORIES(${INCLUDE_DIRS})
|
||||
ADD_LIBRARY(find_object ${SRC_FILES})
|
||||
# Linking with Qt libraries
|
||||
TARGET_LINK_LIBRARIES(find_object ${LIBRARIES})
|
||||
IF("${FINDOBJECT_QT_VERSION}" STREQUAL "5")
|
||||
IF(Qt5_FOUND)
|
||||
QT5_USE_MODULES(find_object Widgets Core Gui Network PrintSupport)
|
||||
ENDIF()
|
||||
ENDIF(Qt5_FOUND)
|
||||
IF(CATKIN_BUILD)
|
||||
set_target_properties(find_object PROPERTIES OUTPUT_NAME find_object_2d)
|
||||
ENDIF(CATKIN_BUILD)
|
||||
@ -149,6 +149,12 @@ ELSE()
|
||||
add_executable(tf_example ros/tf_example_node.cpp)
|
||||
target_link_libraries(tf_example ${LIBRARIES})
|
||||
add_dependencies(tf_example ${${PROJECT_NAME}_EXPORTED_TARGETS})
|
||||
|
||||
IF(Qt5_FOUND)
|
||||
QT5_USE_MODULES(find_object_2d Widgets Core Gui Network PrintSupport)
|
||||
QT5_USE_MODULES(print_objects_detected Widgets Core Gui Network PrintSupport)
|
||||
QT5_USE_MODULES(tf_example Widgets Core Gui Network PrintSupport)
|
||||
ENDIF(Qt5_FOUND)
|
||||
|
||||
## Mark executables and/or libraries for installation
|
||||
install(TARGETS
|
||||
|
||||
@ -30,6 +30,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "find_object/utilite/ULogger.h"
|
||||
#include "Vocabulary.h"
|
||||
#include <QtCore/QVector>
|
||||
#include <QDataStream>
|
||||
#include <stdio.h>
|
||||
#if CV_MAJOR_VERSION < 3
|
||||
#include <opencv2/gpu/gpu.hpp>
|
||||
|
||||
@ -3,7 +3,7 @@ SET(headers_ui
|
||||
TcpClient.h
|
||||
)
|
||||
|
||||
IF("${FINDOBJECT_QT_VERSION}" STREQUAL "4")
|
||||
IF(QT4_FOUND)
|
||||
QT4_WRAP_CPP(moc_srcs ${headers_ui})
|
||||
ELSE()
|
||||
QT5_WRAP_CPP(moc_srcs ${headers_ui})
|
||||
@ -21,9 +21,9 @@ SET(INCLUDE_DIRS
|
||||
${OpenCV_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
IF("${FINDOBJECT_QT_VERSION}" STREQUAL "4")
|
||||
IF(QT4_FOUND)
|
||||
INCLUDE(${QT_USE_FILE})
|
||||
ENDIF()
|
||||
ENDIF(QT4_FOUND)
|
||||
|
||||
SET(LIBRARIES
|
||||
${OpenCV_LIBS}
|
||||
@ -37,9 +37,9 @@ INCLUDE_DIRECTORIES(${INCLUDE_DIRS})
|
||||
# The extension is automatically found.
|
||||
ADD_EXECUTABLE(tcpClient ${SRC_FILES})
|
||||
TARGET_LINK_LIBRARIES(tcpClient ${LIBRARIES})
|
||||
IF("${FINDOBJECT_QT_VERSION}" STREQUAL "5")
|
||||
IF(Qt5_FOUND)
|
||||
QT5_USE_MODULES(tcpClient Widgets Core Gui Network PrintSupport)
|
||||
ENDIF()
|
||||
ENDIF(Qt5_FOUND)
|
||||
|
||||
SET_TARGET_PROPERTIES( tcpClient
|
||||
PROPERTIES OUTPUT_NAME ${PROJECT_PREFIX}-tcpClient)
|
||||
|
||||
@ -3,7 +3,7 @@ SET(headers_ui
|
||||
ImagesTcpServer.h
|
||||
)
|
||||
|
||||
IF("${FINDOBJECT_QT_VERSION}" STREQUAL "4")
|
||||
IF(QT4_FOUND)
|
||||
QT4_WRAP_CPP(moc_srcs ${headers_ui})
|
||||
ELSE()
|
||||
QT5_WRAP_CPP(moc_srcs ${headers_ui})
|
||||
@ -21,9 +21,9 @@ SET(INCLUDE_DIRS
|
||||
${OpenCV_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
IF("${FINDOBJECT_QT_VERSION}" STREQUAL "4")
|
||||
IF(QT4_FOUND)
|
||||
INCLUDE(${QT_USE_FILE})
|
||||
ENDIF()
|
||||
ENDIF(QT4_FOUND)
|
||||
|
||||
SET(LIBRARIES
|
||||
${OpenCV_LIBS}
|
||||
@ -37,9 +37,9 @@ INCLUDE_DIRECTORIES(${INCLUDE_DIRS})
|
||||
# The extension is automatically found.
|
||||
ADD_EXECUTABLE(tcpImagesServer ${SRC_FILES})
|
||||
TARGET_LINK_LIBRARIES(tcpImagesServer find_object ${LIBRARIES})
|
||||
IF("${FINDOBJECT_QT_VERSION}" STREQUAL "5")
|
||||
IF(Qt5_FOUND)
|
||||
QT5_USE_MODULES(tcpImagesServer Widgets Core Gui Network PrintSupport)
|
||||
ENDIF()
|
||||
ENDIF(Qt5_FOUND)
|
||||
|
||||
SET_TARGET_PROPERTIES( tcpImagesServer
|
||||
PROPERTIES OUTPUT_NAME ${PROJECT_PREFIX}-tcpImagesServer)
|
||||
|
||||
@ -3,7 +3,7 @@ SET(headers_ui
|
||||
TcpResponse.h
|
||||
)
|
||||
|
||||
IF("${FINDOBJECT_QT_VERSION}" STREQUAL "4")
|
||||
IF(QT4_FOUND)
|
||||
QT4_WRAP_CPP(moc_srcs ${headers_ui})
|
||||
ELSE()
|
||||
QT5_WRAP_CPP(moc_srcs ${headers_ui})
|
||||
@ -21,9 +21,9 @@ SET(INCLUDE_DIRS
|
||||
${OpenCV_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
IF("${FINDOBJECT_QT_VERSION}" STREQUAL "4")
|
||||
IF(QT4_FOUND)
|
||||
INCLUDE(${QT_USE_FILE})
|
||||
ENDIF()
|
||||
ENDIF(QT4_FOUND)
|
||||
|
||||
|
||||
SET(LIBRARIES
|
||||
@ -38,9 +38,9 @@ INCLUDE_DIRECTORIES(${INCLUDE_DIRS})
|
||||
# The extension is automatically found.
|
||||
ADD_EXECUTABLE(tcpRequest ${SRC_FILES})
|
||||
TARGET_LINK_LIBRARIES(tcpRequest find_object ${LIBRARIES})
|
||||
IF("${FINDOBJECT_QT_VERSION}" STREQUAL "5")
|
||||
IF(Qt5_FOUND)
|
||||
QT5_USE_MODULES(tcpRequest Widgets Core Gui Network PrintSupport)
|
||||
ENDIF()
|
||||
ENDIF(Qt5_FOUND)
|
||||
|
||||
SET_TARGET_PROPERTIES( tcpRequest
|
||||
PROPERTIES OUTPUT_NAME ${PROJECT_PREFIX}-tcpRequest)
|
||||
|
||||
@ -9,9 +9,9 @@ SET(INCLUDE_DIRS
|
||||
${OpenCV_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
IF("${FINDOBJECT_QT_VERSION}" STREQUAL "4")
|
||||
IF(QT4_FOUND)
|
||||
INCLUDE(${QT_USE_FILE})
|
||||
ENDIF()
|
||||
ENDIF(QT4_FOUND)
|
||||
|
||||
SET(LIBRARIES
|
||||
${OpenCV_LIBS}
|
||||
@ -25,9 +25,9 @@ INCLUDE_DIRECTORIES(${INCLUDE_DIRS})
|
||||
# The extension is automatically found.
|
||||
ADD_EXECUTABLE(tcpService ${SRC_FILES})
|
||||
TARGET_LINK_LIBRARIES(tcpService find_object ${LIBRARIES})
|
||||
IF("${FINDOBJECT_QT_VERSION}" STREQUAL "5")
|
||||
IF(Qt5_FOUND)
|
||||
QT5_USE_MODULES(tcpService Widgets Core Gui Network PrintSupport)
|
||||
ENDIF()
|
||||
ENDIF(Qt5_FOUND)
|
||||
|
||||
SET_TARGET_PROPERTIES( tcpService
|
||||
PROPERTIES OUTPUT_NAME ${PROJECT_PREFIX}-tcpService)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user