Hi,
may you can help me, cause I’m quite new to linux, qmake and cmake and therefore absolutely do not know why I get the following results.
I intend to use a c++ library in my Qt project. You will find this library here [cvlibs.net], including a readme.txt.
This is the CMakeLists.txt from the downloaded library:
# project
cmake_minimum_required (VERSION 2.6)
project (libviso2)
# directories
set (LIBVISO2_SRC_DIR src)
# include directory
include_directories("${LIBVISO2_SRC_DIR}")
# use sse3 instruction set
SET(CMAKE_CXX_FLAGS "-msse3")
# sources
FILE(GLOB LIBVISO2_SRC_FILES "src/*.cpp")
# make release version
set(CMAKE_BUILD_TYPE Release)
# demo program
add_executable(viso2 ${LIBVISO2_SRC_FILES})
target_link_libraries (viso2 png)
First I created a new Qt project, inserted the the c++ files and adapted the .pro file slightly.
the .pro file:
#-------------------------------------------------
#
# Project created by QtCreator 2013-11-27T22:47:00
#
#-------------------------------------------------
QT += core
QT -= gui
TARGET = VisoOdo
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp \
viso.cpp \
viso_stereo.cpp \
viso_mono.cpp \
triangle.cpp \
reconstruction.cpp \
matrix.cpp \
matcher.cpp \
filter.cpp
HEADERS += \
viso.h \
viso_stereo.h \
viso_mono.h \
triangle.h \
timer.h \
reconstruction.h \
matrix.h \
matcher.h \
filter.h
OTHER_FILES += \
VisoOdo.pro.user
# added
QMAKE_CXXFLAGS += -msse3
# https://wiki.gentoo.org/wiki/GCC_optimization
#QMAKE_CXXFLAGS += -march=native
# added
unix:!macx: LIBS += -lpng
#unix:!macx: LIBS += -lpng12
When I compile this program with Qt and execute it the program takes ~1620ms.
But when I build this library with cmake [1] and execute it, the same program takes only ~420ms!
*My problem is I have to use Qt, but it’s far to slow.
Is there a way to get with Qt the same performance as with Cmake?*
May has it something to do with the msse3? I also tried “QMAKE_CXXFLAGS += -march=native”, but the result is the same.
Please tell me if I should send you the Qt and Cmake project files.
Thanks a lot for your help!
—————————-
My system:
Dell Workstation M6700
Intel® Core™ i7-3740QM CPU @ 2.70GHz
Linux Ubuntu 12.04 LTS
64 bit
QtCreator 2.8.1, Based on Qt 5.1.1 (GCC 4.6.1, 64 bit)
[1]
I do not use any additional flags at compiling with cmake:
2) Type ‘cmake .’
3) Type ‘make’
4) Run ‘./viso2 2010_03_09_drive_0019’
↧