mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
Initial commits to build qtests from cmake / ctest. Non functional yet
git-svn-id: http://svn.osgeo.org/qgis/trunk@6949 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
be639d1e47
commit
c90f2c4e43
@ -40,6 +40,9 @@ SET (BINDINGS_GLOBAL_INSTALL FALSE CACHE BOOL "Install bindings to global python
|
||||
# Compile flag. Make it posible to turn it off.
|
||||
SET (PEDANTIC TRUE CACHE BOOL "Determines if we should compile with -Wall -Werror.")
|
||||
|
||||
# whether unit tests should be build
|
||||
SET (ENABLE_TESTS FALSE CACHE BOOL "Build unit tests?")
|
||||
|
||||
# hide this variable because building of python bindings might fail
|
||||
# if set to other directory than expected
|
||||
MARK_AS_ADVANCED(LIBRARY_OUTPUT_PATH)
|
||||
@ -102,6 +105,10 @@ SET( QT_USE_QT3SUPPORT TRUE )
|
||||
SET( QT_USE_QTXML TRUE )
|
||||
SET( QT_USE_QTNETWORK TRUE )
|
||||
SET( QT_USE_QTSVG TRUE )
|
||||
IF (ENABLE_TESTS)
|
||||
SET( QT_USE_QTTESTS TRUE )
|
||||
ENABLE_TESTING()
|
||||
ENDIF (ENABLE_TESTS)
|
||||
# TODO: should not be needed, report it to CMake devs
|
||||
IF (APPLE AND QT_USE_QT3SUPPORT)
|
||||
SET( QT_USE_QTSQL TRUE )
|
||||
@ -222,6 +229,9 @@ IF (HAVE_PYTHON)
|
||||
SUBDIRS (python)
|
||||
ENDIF (HAVE_PYTHON)
|
||||
|
||||
IF (ENABLE_TESTS)
|
||||
SUBDIRS(tests)
|
||||
ENDIF (ENABLE_TESTS)
|
||||
|
||||
#############################################################
|
||||
# install stuff
|
||||
|
3
tests/CMakeLists.txt
Normal file
3
tests/CMakeLists.txt
Normal file
@ -0,0 +1,3 @@
|
||||
IF (ENABLE_TESTS)
|
||||
SUBDIRS(src)
|
||||
ENDIF (ENABLE_TESTS)
|
3
tests/src/CMakeLists.txt
Normal file
3
tests/src/CMakeLists.txt
Normal file
@ -0,0 +1,3 @@
|
||||
IF (ENABLE_TESTS)
|
||||
SUBDIRS(core)
|
||||
ENDIF (ENABLE_TESTS)
|
76
tests/src/core/CMakeLists.txt
Normal file
76
tests/src/core/CMakeLists.txt
Normal file
@ -0,0 +1,76 @@
|
||||
#############################################################
|
||||
# sources
|
||||
|
||||
# application test
|
||||
|
||||
SET(applicationtest_SRCS testqgsapplication.cpp)
|
||||
SET(applicationtest_MOC_CPPS testqgsapplication.cpp)
|
||||
QT4_WRAP_CPP(applicationtest_MOC_SRCS ${applicationtest_MOC_CPPS})
|
||||
ADD_CUSTOM_TARGET(applicationtestmoc ALL DEPENDS ${applicationtest_MOC_SRCS})
|
||||
#QT4_GENERATE_MOC(${CMAKE_CURRENT_SOURCE_DIR}/testqgsapplication.cpp moc_testqgsapplication.cxx)
|
||||
|
||||
#####################################################
|
||||
|
||||
# Don't forget to include output directory, otherwise
|
||||
# the UI file won't be wrapped!
|
||||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/core
|
||||
${QT_INCLUDE_DIR}
|
||||
${GDAL_INCLUDE_DIR}
|
||||
${PROJ_INCLUDE_DIR}
|
||||
${GEOS_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
# expect that classes are being IMPORTED for the exe
|
||||
IF (WIN32)
|
||||
# expect that classes are being imported
|
||||
# Note: MSVC doesn't like when the macros are quotes
|
||||
# and MSYS doesn't like them unqouted (bacause of braces)
|
||||
IF (MSVC)
|
||||
ADD_DEFINITIONS("-DCORE_EXPORT=__declspec(dllimport)")
|
||||
#ADD_DEFINITIONS("-DPLUGIN_EXPORT=__declspec(dllimport)")
|
||||
#next needed for qgis gui includes
|
||||
ADD_DEFINITIONS("-DGUI_EXPORT=__declspec(dllexport)")
|
||||
ELSE (MSVC)
|
||||
ADD_DEFINITIONS("\"-DCORE_EXPORT=__declspec(dllimport)\"")
|
||||
#ADD_DEFINITIONS("\"-DPLUGIN_EXPORT=__declspec(dllimport)\"")
|
||||
#next needed for qgis gui includes
|
||||
ADD_DEFINITIONS("\"-DGUI_EXPORT=__declspec(dllexport)\"")
|
||||
ENDIF (MSVC)
|
||||
ENDIF (WIN32)
|
||||
|
||||
#############################################################
|
||||
# libraries
|
||||
|
||||
# because of htonl
|
||||
IF (WIN32)
|
||||
SET(PLATFORM_LIBRARIES wsock32)
|
||||
ENDIF (WIN32)
|
||||
|
||||
|
||||
#note for tests we should not include the moc of our
|
||||
#qtests as they are directly included in teh sources
|
||||
#and should not be compiled twice. Trying to include
|
||||
#them in below will cause an error at build time
|
||||
|
||||
ADD_EXECUTABLE(applicationtest
|
||||
${applicationtest_SRCS}
|
||||
)
|
||||
TARGET_LINK_LIBRARIES(applicationtest
|
||||
${QT_LIBRARIES}
|
||||
qgis_core
|
||||
)
|
||||
|
||||
# Since the tests are not actually installed, but rather
|
||||
# run directly from the build/src/tests dir we need to
|
||||
# ensure the libs can be found.
|
||||
IF (APPLE)
|
||||
# For Mac OS X, the executable must be at the root of the bundle's executable folder
|
||||
SET (CMAKE_INSTALL_NAME_DIR @executable_path/../lib)
|
||||
INSTALL(TARGETS applicationtest RUNTIME DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
ELSE (APPLE)
|
||||
INSTALL(TARGETS applicationtest RUNTIME DESTINATION ${OMG_BIN_DIR})
|
||||
ENDIF (APPLE)
|
||||
|
||||
ADD_TEST(application ${CMAKE_CURRENT_BINARY_DIR}/applicationtest)
|
Loading…
x
Reference in New Issue
Block a user