Skip to content

Commit

Permalink
Add ENABLE_MODELTEST cmake variable/define, default to false
Browse files Browse the repository at this point in the history
  • Loading branch information
Sandro Santilli committed Dec 19, 2014
1 parent 4b4726c commit 98e8f03
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Expand Up @@ -294,6 +294,9 @@ ENDIF (WITH_TOUCH)
# search for QScintilla2 (C++ lib)
FIND_PACKAGE(QScintilla REQUIRED)

# ModelTest
SET(ENABLE_MODELTEST FALSE CACHE BOOL "Enable QT ModelTest (not for production)")

This comment has been minimized.

Copy link
@m-kuhn

m-kuhn Jan 6, 2015

Member

Wouldn't it be better to link this option to CMAKE_BUILD_TYPE=Debug
or use it in test instead of core
or enable it in .travis.yml?

This comment has been minimized.

Copy link
@strk

strk Jan 7, 2015

Contributor

Enabling it in .travis.yml seems a good idea to me.
Linking to =Debug would work for me, but then does travis already builds with Debug on, and should it ?

I dunno what it means to use it in test. I think (but should be checked) that the model tester runs tests as the model is used, at different states that may not be reached during the run of the (finite) testsuite, while could be reached during arbitrary user interaction. Restricting use of the model tester during run of the testsuite could in this case reduce its effectiveness.

This comment has been minimized.

Copy link
@m-kuhn

m-kuhn Jan 7, 2015

Member

Here it looks like one has to add it to every model individually.
https://qt-project.org/wiki/Model_Test
Is that something else?
Or did you also do that part?

I think we could link it to Debug
And enable it for travis on the command line (building with Debug took too long and triggered test timeouts once in a while, that's why it's disabled)
It could then be removed from the GUI options

This comment has been minimized.

Copy link
@strk

strk Jan 7, 2015

Contributor

Somebody else did the individual enabling for some models, I only did the one for LayerTree and ported the pre-existing code to use the new macro.

Travis part is in testing here: #1756

I hadn't noticed the new macro was in the GUI options, and still don't see it. You mean cmake GUI ?

This comment has been minimized.

Copy link
@m-kuhn

m-kuhn Jan 12, 2015

Member

Thanks for the travis part.
I see it with ccmake To hide it type needs to be changed from BOOL to INTERNAL.
I think that makes most sense combined with CMAKE_BUILD_TYPE=Debug linking.


IF (ENABLE_TESTS)
SET( QT_USE_QTTEST TRUE )
ENABLE_TESTING()
Expand Down
2 changes: 2 additions & 0 deletions cmake_templates/qgsconfig.h.in
Expand Up @@ -58,5 +58,7 @@

#cmakedefine HAVE_SERVER_PYTHON_PLUGINS

#cmakedefine ENABLE_MODELTEST

#endif

4 changes: 4 additions & 0 deletions src/app/CMakeLists.txt
Expand Up @@ -450,6 +450,10 @@ INCLUDE_DIRECTORIES(
openstreetmap
)

IF(ENABLE_MODELTEST)
INCLUDE_DIRECTORIES(../../tests/qt_modeltest)
ENDIF(ENABLE_MODELTEST)

IF (ANDROID)
INCLUDE_DIRECTORIES(${ANDROID_NDK_TOOLCHAIN_ROOT}/sysroot/usr/include)
ENDIF (ANDROID)
Expand Down
19 changes: 19 additions & 0 deletions src/core/CMakeLists.txt
Expand Up @@ -270,6 +270,21 @@ SET(QGIS_CORE_SRCS
raster/qgshuesaturationfilter.cpp
)

IF(ENABLE_MODELTEST)
SET(MODELTEST_SRCS
../../tests/qt_modeltest/modeltest.cpp
../../tests/qt_modeltest/dynamictreemodel.cpp
)
SET(MODELTEST_MOC_HDRS
../../tests/qt_modeltest/modeltest.h
../../tests/qt_modeltest/dynamictreemodel.h
)
QT4_WRAP_CPP(MODELTEST_MOC_SRCS ${MODELTEST_MOC_HDRS})
SET(QGIS_CORE_SRCS ${QGIS_CORE_SRCS}
${MODELTEST_SRCS} ${MODELTEST_MOC_SRCS}
)
ENDIF(ENABLE_MODELTEST)

IF (NOT QT5_BUILD)
SET(QGIS_CORE_SRCS ${QGIS_CORE_SRCS}
qgshttptransaction.cpp
Expand Down Expand Up @@ -733,6 +748,10 @@ ADD_DEFINITIONS(-DTEST_DATA_DIR="\\"${TEST_DATA_DIR}\\"")

ADD_LIBRARY(qgis_core SHARED ${QGIS_CORE_SRCS} ${QGIS_CORE_MOC_SRCS} ${QGIS_CORE_HDRS} ${QGIS_CORE_MOC_HDRS})

IF(ENABLE_MODELTEST)
TARGET_LINK_LIBRARIES(qgis_core ${QT_QTTEST_LIBRARY})
ENDIF(ENABLE_MODELTEST)

IF(NOT APPLE)
INSTALL(FILES ${QGIS_CORE_HDRS} ${QGIS_CORE_MOC_HDRS} DESTINATION ${QGIS_INCLUDE_DIR})
ELSE(NOT APPLE)
Expand Down

0 comments on commit 98e8f03

Please sign in to comment.