]> git.cworth.org Git - apitrace-tests/blobdiff - CMakeLists.txt
Rework testing of trimming of operations with no side effects
[apitrace-tests] / CMakeLists.txt
index 9dee9dee82ae65888ff615c5fd15dca4e608e3f6..d4f11ad8c96d27d04dec864bfa9c5f821baebe5e 100644 (file)
@@ -1,4 +1,13 @@
 cmake_minimum_required (VERSION 2.8)
+INCLUDE (FindPythonInterp)
+
+# Use clang on MacOSX. gcc doesn't support __thread key, and Apple has
+# abandoned it for clang.  This must be done before the project is defined.
+if (APPLE)
+    set (CMAKE_C_COMPILER "clang")
+    set (CMAKE_CXX_COMPILER "clang++")
+endif ()
+
 
 project (apitrace-tests)
 
@@ -12,6 +21,7 @@ if (NOT EXISTS ${APITRACE_EXECUTABLE})
     message (WARNING "Please specify path to apitrace executable via APITRACE_EXECUTABLE")
 endif ()
 
+include (FindPythonInterp)
 include (FindPkgConfig)
 
 set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
@@ -32,12 +42,25 @@ find_package (GLEW)
 
 if (WIN32)
     find_package (DirectX)
-else ()
+elseif (PKG_CONFIG_FOUND)
        pkg_check_modules (EGL egl)
        pkg_check_modules (GLESV1 glesv1_cm)
        pkg_check_modules (GLESV2 glesv2)
 endif ()
 
+# Check for the presence of several python packages, which are needed to build
+# generated tests.
+execute_process(
+    COMMAND ${PYTHON_EXECUTABLE} -c "import PIL"
+    OUTPUT_QUIET
+    ERROR_QUIET
+    RESULT_VARIABLE IMPORT_PIL_RESULT)
+if (IMPORT_PIL_RESULT EQUAL 0)
+    set (PIL_FOUND 1)
+else ()
+    message (STATUS "python PIL module not found")
+endif ()
+
 if (UNIX)
        link_libraries(m)
 endif (UNIX)
@@ -81,3 +104,18 @@ enable_testing()
 add_subdirectory (apps)
 add_subdirectory (traces)
 
+# FIXME: The tests in the cli directory are intended to be high-level
+# tests of the apitrace command-line interface which would ideally be
+# portable across all platforms. However, these tests all rely on
+# doing image comparisons and the current implementation of the
+# "apitrace dump-images" command relies on direct invocation of the
+# glreplay command.
+#
+# Someday, we should have more unified commands for replaying traces,
+# dumping images, etc. At that point these cli tests should be usable
+# with all targets so that we can drop the "if (OPENGL_FOUND)"
+# condition here.
+if (OPENGL_FOUND AND PIL_FOUND)
+    add_subdirectory (cli)
+    add_subdirectory (trim_stress)
+endif ()