mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-25 08:19:02 +00:00
Initial open source release of OpenCL 2.0 CTS.
This commit is contained in:
151
CMakeLists.txt
Normal file
151
CMakeLists.txt
Normal file
@@ -0,0 +1,151 @@
|
||||
set( CONFORMANCE_SUFFIX "" )
|
||||
|
||||
set(CLConform_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
project(CLConform${CONFORMANCE_SUFFIX})
|
||||
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "release")
|
||||
set (BUILD_FLAVOR "release")
|
||||
else(CMAKE_BUILD_TYPE STREQUAL "release")
|
||||
set (BUILD_FLAVOR "debug")
|
||||
endif(CMAKE_BUILD_TYPE STREQUAL "release")
|
||||
|
||||
set(CLConform_VERSION_MAJOR "2")
|
||||
set(CLConform_VERSION_MINOR "0")
|
||||
set(CLConform_VERSION_MICRO "0")
|
||||
set(CLConform_VERSION_EXTRA "")
|
||||
set(CLConform_VERSION "${CLConform_VERSION_MAJOR}.${CLConform_VERSION_MINOR}")
|
||||
set(CLConform_VERSION_FULL
|
||||
"${CLConform_VERSION}.${CLConform_VERSION_MICRO}${CLConform_VERSION_EXTRA}")
|
||||
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
add_definitions(-DCL_USE_DEPRECATED_OPENCL_2_0_APIS=1)
|
||||
add_definitions(-DCL_USE_DEPRECATED_OPENCL_1_1_APIS=1)
|
||||
|
||||
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
|
||||
|
||||
|
||||
# Support both VS2008 and VS2012.
|
||||
set(BUILD_DIR "$ENV{ADRENO_DRIVER}/build")
|
||||
if(MSVC90)
|
||||
set(VS_BUILD_DIR "${BUILD_DIR}/vs2008")
|
||||
else(MSVC110)
|
||||
set(VS_BUILD_DIR "${BUILD_DIR}/vs2012")
|
||||
endif(MSVC90)
|
||||
|
||||
#-----------------------------------------------------------
|
||||
# Default Configurable Test Set
|
||||
#-----------------------------------------------------------
|
||||
set(D3D10_IS_SUPPORTED)
|
||||
set(D3D11_IS_SUPPORTED)
|
||||
set(GL_IS_SUPPORTED)
|
||||
|
||||
#-----------------------------------------------------------
|
||||
# Vendor Customization
|
||||
#-----------------------------------------------------------
|
||||
#Vendor Customization File can be included here to provide a way to automatically
|
||||
#build driver as a depencency of the conformance tests, or other such CMake customization
|
||||
include(CMakeVendor.txt OPTIONAL)
|
||||
|
||||
if(CL_INCLUDE_DIR AND CL_LIB_DIR)
|
||||
set(OPENCL_INCLUDE_DIR ${CL_INCLUDE_DIR})
|
||||
link_directories(${CL_LIB_DIR})
|
||||
else(CL_INCLUDE_DIR AND CL_LIB_DIR)
|
||||
message(STATUS "OpenCL hasn't been found!")
|
||||
message(FATAL_ERROR "Either install OpenCL or pass -DCL_INCLUDE_DIR and -DCL_LIB_DIR")
|
||||
endif(CL_INCLUDE_DIR AND CL_LIB_DIR)
|
||||
|
||||
include(CheckFunctionExists)
|
||||
include(CheckIncludeFiles)
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
# -msse -mfpmath=sse to force gcc to use sse for float math,
|
||||
# avoiding excess precision problems that cause tests like int2float
|
||||
# to falsely fail. -ffloat-store also works, but WG suggested
|
||||
# that sse would be better.
|
||||
if(CMAKE_ARM_COMPILER OR ANDROID)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -std=gnu99")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
|
||||
else(CMAKE_ARM_COMPILER OR ANDROID)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -std=gnu99 -msse -mfpmath=sse")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -msse -mfpmath=sse")
|
||||
endif(CMAKE_ARM_COMPILER OR ANDROID)
|
||||
else()
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /D__SSE__")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D__SSE__")
|
||||
endif()
|
||||
|
||||
list(APPEND CLConform_LIBRARIES ${OPENCL_LIBRARIES})
|
||||
if(ANDROID)
|
||||
list(APPEND CLConform_LIBRARIES m)
|
||||
endif(ANDROID)
|
||||
|
||||
if(APPLE)
|
||||
find_library(corefoundation CoreFoundation)
|
||||
find_library(iokit IOKit)
|
||||
list(APPEND CLConform_LIBRARIES ${corefoundation})
|
||||
list(APPEND CLConform_LIBRARIES ${iokit})
|
||||
endif(APPLE)
|
||||
|
||||
list(APPEND CLConform_INCLUDE_DIR ${OPENCL_INCLUDE_DIR})
|
||||
|
||||
include_directories (${CLConform_SOURCE_DIR}/test_common/harness
|
||||
${CLConform_SOURCE_DIR}/test_common/gles
|
||||
${CLConform_SOURCE_DIR}/test_common/gl
|
||||
${CLConform_INCLUDE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_common/harness
|
||||
)
|
||||
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "release")
|
||||
set (BUILD_FLAVOR "release")
|
||||
elseif (CMAKE_BUILD_TYPE STREQUAL "debug")
|
||||
set (BUILD_FLAVOR "debug")
|
||||
endif(CMAKE_BUILD_TYPE STREQUAL "release")
|
||||
|
||||
|
||||
add_subdirectory(test_conformance)
|
||||
|
||||
set (PY_PATH "${CLConform_SOURCE_DIR}/test_conformance/*.py")
|
||||
set (CSV_PATH "${CLConform_SOURCE_DIR}/test_conformance/*.csv")
|
||||
# Support both VS2008 and VS2012.
|
||||
set (DLL_FILES "${VS_BUILD_DIR}/Debug/*.dll")
|
||||
set (DST_DIR "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Debug/")
|
||||
|
||||
if (WIN32)
|
||||
set (COPY "echo")
|
||||
add_custom_target( COPY_DLL${CONFORMANCE_SUFFIX} ALL
|
||||
COMMAND ${COPY} \"${DLL_FILES}\" \"${DST_DIR}\"
|
||||
COMMENT "Copying dll files.. ")
|
||||
else (WIN32)
|
||||
set (COPY cp)
|
||||
add_custom_target( COPY_DLL${CONFORMANCE_SUFFIX} )
|
||||
endif(WIN32)
|
||||
|
||||
set_property(TARGET COPY_DLL${CONFORMANCE_SUFFIX} PROPERTY FOLDER "CONFORMANCE${CONFORMANCE_SUFFIX}")
|
||||
|
||||
if(WIN32)
|
||||
add_custom_target( COPY_FILES${CONFORMANCE_SUFFIX} ALL
|
||||
COMMAND ${COPY} ${PY_PATH} ${DST_DIR}
|
||||
COMMAND ${COPY} ${CSV_PATH} ${DST_DIR}
|
||||
COMMAND ${COPY} ${DLL_FILES} ${DST_DIR}
|
||||
COMMENT "Copying other files to output folder..." )
|
||||
else(WIN32)
|
||||
add_custom_target( COPY_FILES${CONFORMANCE_SUFFIX} )
|
||||
endif(WIN32)
|
||||
|
||||
# Copy required CL include directories into the build directory
|
||||
# as required for the compiler testing.
|
||||
|
||||
# ... For running the compiler test on the command line.
|
||||
file(COPY "${CLConform_SOURCE_DIR}/test_conformance/compiler/includeTestDirectory" DESTINATION ${DST_DIR})
|
||||
file(COPY "${CLConform_SOURCE_DIR}/test_conformance/compiler/secondIncludeTestDirectory" DESTINATION ${DST_DIR})
|
||||
|
||||
# ... For running the compiler test with VisualStudio.
|
||||
if(MSVC)
|
||||
file(COPY "${CLConform_SOURCE_DIR}/test_conformance/compiler/includeTestDirectory" DESTINATION "${CLConform_SOURCE_DIR}/build/test_conformance/compiler")
|
||||
file(COPY "${CLConform_SOURCE_DIR}/test_conformance/compiler/secondIncludeTestDirectory" DESTINATION "${CLConform_SOURCE_DIR}/build/test_conformance/compiler")
|
||||
endif(MSVC)
|
||||
|
||||
set_property(TARGET COPY_FILES${CONFORMANCE_SUFFIX} PROPERTY FOLDER "CONFORMANCE${CONFORMANCE_SUFFIX}")
|
||||
Reference in New Issue
Block a user