[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kimageformats] /: Only perform tests for plugins that are built
From: Alex Merry <kde () randomguy3 ! me ! uk>
Date: 2014-02-23 11:54:59
Message-ID: E1WHXe7-0006dh-Dm () scm ! kde ! org
[Download RAW message or body]
Git commit 6272954cc53fa39e73524cbd2a42a90018544ee5 by Alex Merry.
Committed on 05/02/2014 at 17:38.
Pushed by alexmerry into branch 'master'.
Only perform tests for plugins that are built
This both excludes the autotests and tests subdirs if the user sets
BUILD_TESTING off, and makes sure we do not run tests for formats that
were not built due to dependencies not being found.
REVIEW: 115504
M +38 -2 CMakeLists.txt
M +31 -17 autotests/CMakeLists.txt
M +2 -30 src/imageformats/CMakeLists.txt
http://commits.kde.org/kimageformats/6272954cc53fa39e73524cbd2a42a90018544ee5
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8a24fd3..4b8495d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,8 +16,44 @@ include(CheckIncludeFiles)
set(REQUIRED_QT_VERSION 5.2.0)
find_package(Qt5Gui ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE)
+# EPS support depends on the gs utility; non-UNIX systems are unlikely to have
+# this available in PATH
+set(BUILD_EPS_PLUGIN FALSE)
+if (UNIX)
+ find_package(Qt5PrintSupport 5.2.0 NO_MODULE)
+ set_package_properties(Qt5PrintSupport PROPERTIES
+ PURPOSE "Required for the QImage plugin for EPS images"
+ TYPE OPTIONAL
+ )
+ if (Qt5PrintSupport_FOUND)
+ set(BUILD_EPS_PLUGIN TRUE)
+ endif()
+endif()
+
+find_package(Jasper)
+set_package_properties(Jasper PROPERTIES
+ DESCRIPTION "A library for handling JPEG-2000 images"
+ PURPOSE "Required for the QImage plugin for JPEG-2000 images"
+ URL "http://www.ece.uvic.ca/~mdadams/jasper"
+ TYPE OPTIONAL
+)
+
+find_package(OpenEXR)
+set_package_properties(OpenEXR PROPERTIES
+ TYPE OPTIONAL
+ PURPOSE "Required for the QImage plugin for OpenEXR images"
+)
+
+find_package(WebP COMPONENTS WebP)
+set_package_properties(WebP PROPERTIES
+ TYPE OPTIONAL
+ PURPOSE "Required for the QImage plugin for WebP images"
+)
+
add_subdirectory(src)
-add_subdirectory(autotests)
-add_subdirectory(tests)
+if (BUILD_TESTING)
+ add_subdirectory(autotests)
+ add_subdirectory(tests)
+endif()
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
diff --git a/autotests/CMakeLists.txt b/autotests/CMakeLists.txt
index 14db235..3e30e60 100644
--- a/autotests/CMakeLists.txt
+++ b/autotests/CMakeLists.txt
@@ -6,11 +6,13 @@ add_definitions(-DPLUGIN_DIR="${CMAKE_CURRENT_BINARY_DIR}/../src")
remove_definitions(-DQT_NO_CAST_FROM_ASCII)
macro(kimageformats_read_tests)
- add_executable(readtest readtest.cpp)
- target_link_libraries(readtest Qt5::Gui)
- target_compile_definitions(readtest
- PRIVATE IMAGEDIR="${CMAKE_CURRENT_SOURCE_DIR}/read")
- ecm_mark_as_test(readtest)
+ if (NOT TARGET readtest)
+ add_executable(readtest readtest.cpp)
+ target_link_libraries(readtest Qt5::Gui)
+ target_compile_definitions(readtest
+ PRIVATE IMAGEDIR="${CMAKE_CURRENT_SOURCE_DIR}/read")
+ ecm_mark_as_test(readtest)
+ endif()
foreach(_testname ${ARGN})
add_test(
NAME kimageformats-read-${_testname}
@@ -20,11 +22,13 @@ macro(kimageformats_read_tests)
endmacro()
macro(kimageformats_write_tests)
- add_executable(writetest writetest.cpp)
- target_link_libraries(writetest Qt5::Gui)
- target_compile_definitions(writetest
- PRIVATE IMAGEDIR="${CMAKE_CURRENT_SOURCE_DIR}/write")
- ecm_mark_as_test(writetest)
+ if (NOT TARGET writetest)
+ add_executable(writetest writetest.cpp)
+ target_link_libraries(writetest Qt5::Gui)
+ target_compile_definitions(writetest
+ PRIVATE IMAGEDIR="${CMAKE_CURRENT_SOURCE_DIR}/write")
+ ecm_mark_as_test(writetest)
+ endif()
foreach(_testname ${ARGN})
string(REGEX MATCH "-lossless$" _is_lossless "${_testname}")
unset(lossless_arg)
@@ -43,9 +47,6 @@ endmacro()
# Loads each <format> image in read/<format>/, and compares the
# result against the data read from the corresponding png file
kimageformats_read_tests(
- #eps # EPS read tests depend on the vagaries of GhostScript
- # which we cannot even guarantee to find
- jp2
pcx
pic
psd
@@ -53,7 +54,6 @@ kimageformats_read_tests(
rgb
tga
xcf
- webp
)
# Basic write tests
@@ -63,11 +63,25 @@ kimageformats_read_tests(
# You can append -lossless to the format to indicate that
# reading back the image data will result in an identical image.
kimageformats_write_tests(
- #eps # EPS writing depends on a choice of tools, and so needs
- # a cleverer test
- jp2
pcx-lossless
pic-lossless
rgb-lossless
tga # fixme: the alpha images appear not to be written properly
)
+
+# EPS read tests depend on the vagaries of GhostScript
+# which we cannot even guarantee to find, so disable them for now
+#if (BUILD_EPS_PLUGIN)
+# kimageformats_read_tests(eps)
+# kimageformats_write_tests(eps)
+#endif()
+if (JASPER_FOUND)
+ kimageformats_read_tests(jp2)
+ kimageformats_write_tests(jp2)
+endif()
+if (OpenEXR_FOUND)
+ # FIXME: OpenEXR tests
+endif()
+if (WebP_FOUND)
+ kimageformats_read_tests(webp)
+endif()
diff --git a/src/imageformats/CMakeLists.txt b/src/imageformats/CMakeLists.txt
index e2242a6..e028deb 100644
--- a/src/imageformats/CMakeLists.txt
+++ b/src/imageformats/CMakeLists.txt
@@ -10,15 +10,7 @@ install(FILES dds.desktop DESTINATION ${SERVICES_INSTALL_DIR}/qimageioplugins/)
##################################
-# EPS support depends on the gs utility; non-UNIX systems are unlikely to have
-# this available in PATH
-if (UNIX)
- find_package(Qt5PrintSupport 5.2.0 NO_MODULE)
- set_package_properties(Qt5PrintSupport PROPERTIES
- PURPOSE "Required for the QImage plugin for EPS images"
- TYPE OPTIONAL
- )
-
+if (BUILD_EPS_PLUGIN)
if (Qt5PrintSupport_FOUND)
add_library(kimg_eps MODULE eps.cpp)
target_link_libraries(kimg_eps Qt5::Gui Qt5::PrintSupport)
@@ -30,14 +22,6 @@ endif()
##################################
-find_package(Jasper)
-set_package_properties(Jasper PROPERTIES
- DESCRIPTION "A library for handling JPEG-2000 images"
- PURPOSE "Required for the QImage plugin for JPEG-2000 images"
- URL "http://www.ece.uvic.ca/~mdadams/jasper"
- TYPE OPTIONAL
-)
-
check_include_files(sys/types.h HAVE_SYS_TYPES_H)
check_include_files(stdint.h HAVE_STDINT_H)
configure_file(config-jp2.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-jp2.h)
@@ -54,12 +38,6 @@ endif()
##################################
-find_package(OpenEXR)
-set_package_properties(OpenEXR PROPERTIES
- TYPE OPTIONAL
- PURPOSE "Required for the QImage plugin for OpenEXR images"
-)
-
if(OpenEXR_FOUND)
add_library(kimg_exr MODULE exr.cpp)
target_link_libraries(kimg_exr Qt5::Gui OpenEXR::IlmImf)
@@ -119,13 +97,7 @@ install(FILES tga.desktop DESTINATION ${SERVICES_INSTALL_DIR}/qimageioplugins/)
##################################
-find_package(WebP COMPONENTS WebP)
-set_package_properties(WebP PROPERTIES
- TYPE OPTIONAL
- PURPOSE "Required for the QImage plugin for WebP images"
-)
-
-if(WebP_FOUND)
+if (WebP_FOUND)
add_library(kimg_webp MODULE webp.cpp)
target_link_libraries(kimg_webp Qt5::Gui WebP::WebP)
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic