X-Git-Url: https://git.cworth.org/git?p=apitrace-tests;a=blobdiff_plain;f=CMakeLists.txt;h=d4f11ad8c96d27d04dec864bfa9c5f821baebe5e;hp=7975877eb5ce776af09d7b3ea87be0cc6ee7448d;hb=78f3329f3481c13886be0189c58b98ee29a4c484;hpb=007d3dd1a9ca4b00cdb81d7b72a608687c024d50 diff --git a/CMakeLists.txt b/CMakeLists.txt index 7975877..d4f11ad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,31 @@ 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) +find_path (APITRACE_SOURCE_DIR NAMES cmake/FindDirectX.cmake PATHS .. ../.. DOC "apitrace source tree" NO_DEFAULT_PATH) +if (NOT EXISTS ${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 (WARNING "Please specify path to apitrace executable via APITRACE_EXECUTABLE") +endif () + +include (FindPythonInterp) +include (FindPkgConfig) + +set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) + # Set default built type if (NOT CMAKE_BUILD_TYPE) set (CMAKE_BUILD_TYPE Debug @@ -10,16 +34,32 @@ if (NOT CMAKE_BUILD_TYPE) FORCE) endif (NOT CMAKE_BUILD_TYPE) -find_package (OpenGL REQUIRED) +include (CMakeParseArguments) + +find_package (OpenGL) find_package (GLUT) +find_package (GLEW) -find_library (GLEW_glew_LIBRARY GLEW - /usr/lib -) +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 () -find_path (GLEW_INCLUDE_DIR GL/glew.h - /usr/include/GL -) +# 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) @@ -59,14 +99,23 @@ if (MSVC) add_definitions (-wd4244) # conversion' conversion from 'type1' to 'type2', possible loss of data endif () -if (NOT APITRACE_BINARY_DIR) - set (APITRACE_BINARY_DIR "${CMAKE_BINARY_DIR}/.." CACHE PATH "apitrace build directory") -endif () -if (NOT EXISTS ${APITRACE_BINARY_DIR}) - message (SEND_ERROR "Invalid APITRACE_BINARY_DIR") -endif () - 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 ()