]> git.cworth.org Git - apitrace-tests/blobdiff - CMakeLists.txt
Don't run tests that depend on PIL.
[apitrace-tests] / CMakeLists.txt
index c6a8a59744c458904ba5c5ef5ad629cba50b8183..2dff8574de0d8db7b37d5c3cc18e6d6b8c59d2e1 100644 (file)
@@ -1,26 +1,30 @@
 cmake_minimum_required (VERSION 2.8)
 
+
+# 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)
 
 find_path (APITRACE_SOURCE_DIR NAMES cmake/FindDirectX.cmake PATHS .. ../.. DOC "apitrace source tree" NO_DEFAULT_PATH)
 if (NOT EXISTS ${APITRACE_SOURCE_DIR})
-    message (SEND_ERROR "Please specify path to apitrace source tree via APITRACE_SOURCE_DIR")
+    message (WARNING "Please specify path to apitrace source tree via APITRACE_SOURCE_DIR")
 endif ()
 
 find_program (APITRACE_EXECUTABLE NAMES apitrace PATHS ${APITRACE_SOURCE_DIR} DOC "apitrace executable")
 if (NOT EXISTS ${APITRACE_EXECUTABLE})
-    message (SEND_ERROR "Please specify path to apitrace executable via APITRACE_EXECUTABLE")
+    message (WARNING "Please specify path to apitrace executable via APITRACE_EXECUTABLE")
 endif ()
 
 include (FindPkgConfig)
 
 set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
 
-if (APITRACE_SOURCE_DIR)
-    set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${APITRACE_SOURCE_DIR}/cmake)
-    find_package (DirectX)
-endif ()
-
 # Set default built type
 if (NOT CMAKE_BUILD_TYPE)
    set (CMAKE_BUILD_TYPE Debug
@@ -35,12 +39,27 @@ find_package (OpenGL)
 find_package (GLUT)
 find_package (GLEW)
 
-if (NOT WIN32)
+if (WIN32)
+    find_package (DirectX)
+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} -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)
@@ -84,3 +103,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
+# glretrace 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 ()