--- /dev/null
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 5536922..b6de403 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -504,25 +504,28 @@ endforeach()
+ # Build tests\r
+ # ############################################################################\r
+ \r
+-enable_testing()\r
+-\r
+-add_executable(loaders tests/loaders.c)\r
+-target_link_libraries(loaders simage)\r
+-target_compile_definitions(loaders PRIVATE _CRT_NONSTDC_NO_DEPRECATE _CRT_SECURE_NO_DEPRECATE _CRT_SECURE_NO_WARNINGS _USE_MATH_DEFINES)\r
+-if(UNIX)\r
+- target_link_libraries(loaders m)\r
+-endif()\r
+-\r
+-add_test(\r
+- loaders\r
+- ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/loaders\r
+- ${CMAKE_CURRENT_SOURCE_DIR}/tests/img.gif\r
+- ${CMAKE_CURRENT_SOURCE_DIR}/tests/img.jpg\r
+- ${CMAKE_CURRENT_SOURCE_DIR}/tests/img.png\r
+- ${CMAKE_CURRENT_SOURCE_DIR}/tests/img.rgb\r
+- ${CMAKE_CURRENT_SOURCE_DIR}/tests/img.tga\r
+- ${CMAKE_CURRENT_SOURCE_DIR}/tests/img.tif\r
+-)\r
++if(TESTS)\r
++ enable_testing()\r
++\r
++ add_executable(loaders tests/loaders.c)\r
++ target_link_libraries(loaders simage)\r
++ target_compile_definitions(loaders PRIVATE _CRT_NONSTDC_NO_DEPRECATE _CRT_SECURE_NO_DEPRECATE _CRT_SECURE_NO_WARNINGS _USE_MATH_DEFINES)\r
++ if(UNIX)\r
++ target_link_libraries(loaders m)\r
++ target_link_libraries(loaders sndfile)\r
++ endif()\r
++\r
++ add_test(\r
++ loaders\r
++ ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/loaders\r
++ ${CMAKE_CURRENT_SOURCE_DIR}/tests/img.gif\r
++ ${CMAKE_CURRENT_SOURCE_DIR}/tests/img.jpg\r
++ ${CMAKE_CURRENT_SOURCE_DIR}/tests/img.png\r
++ ${CMAKE_CURRENT_SOURCE_DIR}/tests/img.rgb\r
++ ${CMAKE_CURRENT_SOURCE_DIR}/tests/img.tga\r
++ ${CMAKE_CURRENT_SOURCE_DIR}/tests/img.tif\r
++ )\r
++endif()\r
+ \r
+ # Add a target to generate API documentation with Doxygen\r
+ if(SIMAGE_BUILD_DOCUMENTATION)\r
LICENSE="public-domain mpeg2enc"
KEYWORDS="~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86"
SLOT="0"
-IUSE="debug gif jpeg png qt5 sndfile tiff vorbis"
+IUSE="debug gif jpeg png qt5 sndfile test tiff vorbis"
+RESTRICT="!test? ( test )"
+BDEPEND="
+ app-arch/unzip
+"
RDEPEND="
gif? ( media-libs/giflib )
jpeg? ( virtual/jpeg:0= )
"
DEPEND="
${RDEPEND}
- app-arch/unzip
+ test? ( media-libs/libsndfile )
"
S="${WORKDIR}/${PN}"
# make the dep unconditional or not build the examples. i chose the latter way.
# btw, examples are not installed anyway, they are just compiled.
"${FILESDIR}/${P}-disable-examples.patch"
+ "${FILESDIR}/${P}-tests-conditional.patch"
"${FILESDIR}/${P}-disable-gif-quantize-buffer.patch"
)
-DSIMAGE_RGB_SUPPORT=ON
-DSIMAGE_TGA_SUPPORT=ON
-DSIMAGE_XWD_SUPPORT=ON
+ -DTESTS=$(usex test)
)
cmake-utils_src_configure