mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
- Remove the build_<platform> scripts that were simply calling cmake in favor of using cmake directly - Move flag CRT_SECURE_NO_WARNING into a section specifically for visual studio - Change vendor file selection to just use the file if present - Add a variable for determining whether to link against pthread - Delete all lines in CMakeVendor.txt so each implementation can define their own Change-Id: Ibbd83521ce4d42d09dcbd0b16efa9fbe6cbf785d
This commit is contained in:
committed by
GitHub
parent
8d44302935
commit
6adf4ead5c
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1,4 +0,0 @@
|
||||
# build directories
|
||||
build/
|
||||
build_lnx/
|
||||
build_win/
|
||||
@@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
cmake_minimum_required(VERSION 3.5.1)
|
||||
|
||||
set( CONFORMANCE_SUFFIX "" )
|
||||
set(CLConform_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
@@ -60,10 +60,7 @@ set(CONFORMANCE_SUFFIX "" )
|
||||
#-----------------------------------------------------------
|
||||
#Vendor Customization File can be included here to provide a way to automatically
|
||||
#build driver as a dependency of the conformance tests, or other such CMake customization
|
||||
option(USE_VENDOR_CUSTOM_FILE "Use Vendor Customization File" OFF)
|
||||
if(USE_VENDOR_CUSTOM_FILE)
|
||||
include(CMakeVendor.txt OPTIONAL)
|
||||
endif(USE_VENDOR_CUSTOM_FILE)
|
||||
include(CMakeVendor.txt OPTIONAL)
|
||||
|
||||
#-----------------------------------------------------------
|
||||
# Development options for OpenCL C++ tests
|
||||
@@ -175,17 +172,30 @@ else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D__SSE__")
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
# Don't warn when using standard non-secure functions.
|
||||
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
|
||||
if( WIN32 AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel" )
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qlong-double -Qpc80 /DWIN32 /D_WINDOWS /W3 /GR /EHsc -nologo -Od -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -EHsc -Wall -Qdiag-disable:68,111,177,186,161,869,1028,2259,2553,181,239,265,1188 -fp:strict -fp:source")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Qlong-double -Qpc80 /DWIN32 /D_WINDOWS /W3 /GR /EHsc -nologo -Od -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -EHsc -Wall -Qdiag-disable:68,111,177,186,161,869,1028,2259,2553,181,239,265,1188 -fp:strict -fp:source")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qlong-double -Qpc80 /DWIN32 /D_WINDOWS /W3 /GR /EHsc -nologo -Od -D_CRT_NONSTDC_NO_WARNINGS -EHsc -Wall -Qdiag-disable:68,111,177,186,161,869,1028,2259,2553,181,239,265,1188 -fp:strict -fp:source")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Qlong-double -Qpc80 /DWIN32 /D_WINDOWS /W3 /GR /EHsc -nologo -Od -D_CRT_NONSTDC_NO_WARNINGS -EHsc -Wall -Qdiag-disable:68,111,177,186,161,869,1028,2259,2553,181,239,265,1188 -fp:strict -fp:source")
|
||||
endif()
|
||||
|
||||
list(APPEND CLConform_LIBRARIES ${OPENCL_LIBRARIES})
|
||||
if(ANDROID)
|
||||
list(APPEND CLConform_LIBRARIES m)
|
||||
elseif(NOT WIN32)
|
||||
endif()
|
||||
if(NOT DEFINED LINK_PTHREAD)
|
||||
if(ANDROID OR WIN32)
|
||||
set(LINK_PTHREAD OFF)
|
||||
else()
|
||||
set(LINK_PTHREAD ON)
|
||||
endif()
|
||||
endif()
|
||||
if(LINK_PTHREAD)
|
||||
list(APPEND CLConform_LIBRARIES pthread)
|
||||
endif(ANDROID)
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
find_library(corefoundation CoreFoundation)
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
# We intentionally hardcode "_win32" to ensure backwards compatibility (to avoid breaking HAAVE)
|
||||
if(ANDROID)
|
||||
if(ARM64_V8A)
|
||||
set(ARCH "64")
|
||||
else(ARM64_V8A)
|
||||
set(ARCH "32")
|
||||
endif(ARM64_V8A)
|
||||
endif (ANDROID)
|
||||
161
build_android.py
161
build_android.py
@@ -1,161 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------#
|
||||
# android-cmake and android-ndk based build script for conformance
|
||||
#-------------------------------------------------------------------------------#
|
||||
"""
|
||||
Dependencies:
|
||||
|
||||
1) android-ndk version android-ndk-r10d or higher is required. Further, the environment
|
||||
variable ANDROID_NDK should be defined to point to it.
|
||||
|
||||
2) android-cmake should be installed (else the script can install it for you). If installed,
|
||||
the environment variable ANDROID_CMAKE should point to install location, unless it is in the current
|
||||
working directory in which case it is picked up by default.
|
||||
|
||||
3) CL_INCLUDE_DIR should be defined to point to CL headers. Alternately, this can be provided
|
||||
as an input (-I)
|
||||
|
||||
4) Path to opencl library to link against (libOpenCL.so) can be provided using -L. If this isn't
|
||||
available the script will try to use CL_LIB_DIR_64 or CL_LIB_DIR_32 environment variables -
|
||||
if available - to pick up the right library for the architecture being built.
|
||||
|
||||
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
import argparse
|
||||
import time
|
||||
import shlex
|
||||
|
||||
start = time.time()
|
||||
script = os.path.basename( sys.argv[ 0 ] )
|
||||
|
||||
def die (msg):
|
||||
print msg
|
||||
exit(-1)
|
||||
|
||||
def execute (cmdline):
|
||||
retcode = subprocess.call(cmdline)
|
||||
if retcode != 0:
|
||||
raise Exception("Failed to execute '%s', got %d" % (commandLine, retcode))
|
||||
|
||||
def build(args):
|
||||
if not (args.testDir):
|
||||
print("building...")
|
||||
execute("make")
|
||||
else:
|
||||
if os.path.exists( os.path.join(args.bld_dir, "test_conformance", args.testDir) ):
|
||||
os.chdir( os.path.join("test_conformance",args.testDir) )
|
||||
print("Building test: %s..." %args.testDir)
|
||||
execute("make")
|
||||
os.chdir(args.bld_dir)
|
||||
else:
|
||||
print ("Error: %s test doesn't exist" %args.testDir)
|
||||
|
||||
|
||||
def configure (args):
|
||||
print("configuring...")
|
||||
cmdline = []
|
||||
cmdline.extend(['cmake', "-DCMAKE_TOOLCHAIN_FILE=" + os.path.join(args.android_cmake,"android.toolchain.cmake")])
|
||||
for var in args.cmake_defs :
|
||||
cmdline.extend([ '-D', var ])
|
||||
cmdline.extend(['-DCL_INCLUDE_DIR=' + args.inc_dir])
|
||||
cmdline.extend(['-DCL_LIB_DIR=' + args.lib_dir])
|
||||
cmdline.extend(['-DANDROID_NATIVE_API_LEVEL=' + "android-21"])
|
||||
if args.arch == "64":
|
||||
cmdline.extend(['-DANDROID_ABI=arm64-v8a'])
|
||||
cmdline.extend(['-DANDROID_SO_UNDEFINED=ON'])
|
||||
cmdline.extend([args.src_dir])
|
||||
execute(cmdline)
|
||||
|
||||
def check_var (parser, args, name):
|
||||
if not(args.__dict__[name]):
|
||||
parser.error("%s needs to be defined" % name)
|
||||
|
||||
def print_config(args):
|
||||
print("----------CONFIGURATION--------------\n")
|
||||
print("android_cmake: %s" % args.android_cmake)
|
||||
print("android_ndk: %s" % args.android_ndk)
|
||||
print("lib_dir: %s" % args.lib_dir)
|
||||
print("inc_dir: %s" % args.inc_dir)
|
||||
if len(args.cmake_defs):
|
||||
print("cmake options:" + "\n:".join( [ " `%s'" % dir for dir in args.cmake_defs ] ))
|
||||
print("architecture: %s" % args.arch)
|
||||
print("-------------------------------------\n")
|
||||
|
||||
def get_input():
|
||||
yes = set(['yes','y', 'ye', ''])
|
||||
no = set(['no','n'])
|
||||
|
||||
choice = raw_input().lower()
|
||||
if choice in yes:
|
||||
return True
|
||||
elif choice in no:
|
||||
return False
|
||||
else:
|
||||
sys.stdout.write("Please respond with 'yes' or 'no'")
|
||||
exit()
|
||||
|
||||
def install_android_cmake():
|
||||
parser.print_help()
|
||||
print "\nandroid-cmake doesn't seem to be installed - It should be provided as a) cmdline input b) environment variable $ANDROID_CMAKE or c) present in the current directory\n"
|
||||
print "if you would like to download and install it in the current directory please enter yes\n"
|
||||
print "if you would like to provide an environment variable($ANDROID_CMAKE) or command-line input(--android_cmake) rerun the script enter no\n"
|
||||
print "input: "
|
||||
if get_input():
|
||||
print("installing android-cmake")
|
||||
#subprocess.call(['git', 'clone', 'https://github.com/taka-no-me/android-cmake'])
|
||||
# Use a newer fork of android-cmake which has been updated to support Clang. GCC is deprecated in newer NDKs and C11 atomics conformance doesn't build with NDK > 10.
|
||||
subprocess.call(['git', 'clone', 'https://github.com/daewoong-jang/android-cmake'])
|
||||
args.android_cmake = os.path.join(args.src_dir,"android-cmake")
|
||||
else:
|
||||
exit()
|
||||
|
||||
try:
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--android_cmake', dest='android_cmake', default=os.environ.get('ANDROID_CMAKE'), help="Path to android-cmake (can also be set using environment variable $ANDROID_CMAKE).")
|
||||
parser.add_argument('--android_ndk', dest='android_ndk', default=os.environ.get('ANDROID_NDK'), help="Path to android-ndk (can also be set using environment variable $ANDROID_NDK).")
|
||||
parser.add_argument('-L','--lib_dir', dest='lib_dir', default="", help="Path to libOpenCL to link against (can also be set using environment variable $CL_LIB_DIR_32 and $CL_LIB_DIR_64).")
|
||||
parser.add_argument('-I','--include_dir', dest='inc_dir', default=os.environ.get('CL_INCLUDE_DIR'), help="Path to headers (can also be set using environment variable $CL_INCLUDE_DIR).")
|
||||
parser.add_argument('-D', dest='cmake_defs', action='append', default=[], help="Define CMAKE variable")
|
||||
parser.add_argument('-a','--arch', default="32", help="Architecture to build for (32 or 64)")
|
||||
parser.add_argument('-t','--test', dest='testDir', default="", help="Builds the given test")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
args.src_dir = os.path.realpath(os.path.dirname( sys.argv[ 0 ]))
|
||||
|
||||
if not (args.android_cmake):
|
||||
if os.path.exists(os.path.join(args.src_dir,"android-cmake")):
|
||||
args.android_cmake = os.path.join(args.src_dir,"android-cmake")
|
||||
else:
|
||||
install_android_cmake()
|
||||
|
||||
if not (args.lib_dir):
|
||||
lib_var_name = "CL_LIB_DIR_" + ("32" if (args.arch == "32") else "64")
|
||||
args.lib_dir = os.environ.get(lib_var_name)
|
||||
|
||||
check_var(parser, args, "android_cmake")
|
||||
check_var(parser, args, "lib_dir")
|
||||
check_var(parser, args, "inc_dir")
|
||||
check_var(parser, args, "android_ndk")
|
||||
|
||||
print_config(args)
|
||||
|
||||
args.bld_dir = os.path.join(args.src_dir, 'bld_android_%s' % args.arch)
|
||||
if not os.path.exists(args.bld_dir):
|
||||
os.makedirs(args.bld_dir)
|
||||
os.chdir(args.bld_dir)
|
||||
|
||||
configure(args)
|
||||
build(args)
|
||||
|
||||
sys.exit( 0 )
|
||||
|
||||
finally:
|
||||
finish = time.time()
|
||||
print("Elapsed time: %.0f s." % ( finish - start ) )
|
||||
12
build_lnx.sh
12
build_lnx.sh
@@ -1,12 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
mkdir -p build_lnx
|
||||
cd build_lnx
|
||||
cmake -G "Unix Makefiles" ../ \
|
||||
-DKHRONOS_OFFLINE_COMPILER=<TO_SET> \
|
||||
-DCL_LIBCLCXX_DIR=<TO_SET> \
|
||||
-DCL_INCLUDE_DIR=<TO_SET> \
|
||||
-DCL_LIB_DIR=<TO_SET> \
|
||||
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=. \
|
||||
-DOPENCL_LIBRARIES=OpenCL
|
||||
make --jobs 8
|
||||
@@ -1,32 +0,0 @@
|
||||
@ECHO off
|
||||
setlocal ENABLEDELAYEDEXPANSION
|
||||
|
||||
IF DEFINED ProgramFiles(x86) SET ProgFilesDir=%ProgramFiles(x86)%
|
||||
IF NOT DEFINED ProgFilesDir SET ProgFilesDir=%ProgramFiles%
|
||||
|
||||
rem -------------------------------- Update these to match what's on your PC ------------------------------------------------
|
||||
|
||||
SET VCPATH="%ProgFilesDir%\Microsoft Visual Studio 14.0\Common7\IDE\devenv.com"
|
||||
|
||||
SET PATH=%CMAKEPATH%;%PATH%
|
||||
|
||||
rem -------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
setlocal ENABLEDELAYEDEXPANSION
|
||||
|
||||
call "%VS140COMNTOOLS%\vsvars32.bat"
|
||||
|
||||
mkdir build_win
|
||||
pushd build_win
|
||||
IF NOT EXIST CLConform.sln (
|
||||
echo "Solution file not found, running Cmake"
|
||||
cmake -G "Visual Studio 14 2015 Win64" ..\. -DKHRONOS_OFFLINE_COMPILER=<TO_SET> -DCL_LIBCLCXX_DIR=<TO_SET> -DCL_INCLUDE_DIR=<TO_SET> -DCL_LIB_DIR=<TO_SET> -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=. -DOPENCL_LIBRARIES=OpenCL
|
||||
) else (
|
||||
echo "Solution file found CLConform.sln "
|
||||
)
|
||||
|
||||
echo Building CLConform.sln...
|
||||
%VCPATH% CLConform.sln /build
|
||||
|
||||
|
||||
GOTO:EOF
|
||||
@@ -49,7 +49,9 @@ add_subdirectory( subgroups )
|
||||
add_subdirectory( workgroups )
|
||||
add_subdirectory( pipes )
|
||||
add_subdirectory( device_timer )
|
||||
add_subdirectory( clcpp )
|
||||
if(KHRONOS_OFFLINE_COMPILER)
|
||||
add_subdirectory( clcpp )
|
||||
endif()
|
||||
add_subdirectory( spirv_new )
|
||||
add_subdirectory( spir )
|
||||
|
||||
|
||||
@@ -17,19 +17,17 @@ set(${MODULE_NAME}_SOURCES
|
||||
|
||||
include(../CMakeCommon.txt)
|
||||
|
||||
# Copy required CL include directories into the binary directory
|
||||
|
||||
set(COMPILER_SOURCE_DIR ${CLConform_SOURCE_DIR}/test_conformance/compiler)
|
||||
set(COMPILER_TARGET ${${MODULE_NAME}_OUT})
|
||||
|
||||
# Copy the required test include directories into the build directory.
|
||||
if(NOT DEFINED COMPILER_TEST_RESOURCES)
|
||||
set(COMPILER_TEST_RESOURCES $<TARGET_FILE_DIR:${${MODULE_NAME}_OUT}>)
|
||||
endif()
|
||||
add_custom_command(
|
||||
TARGET ${COMPILER_TARGET}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
"${COMPILER_SOURCE_DIR}/includeTestDirectory"
|
||||
$<TARGET_FILE_DIR:${COMPILER_TARGET}>/includeTestDirectory)
|
||||
|
||||
add_custom_command(
|
||||
TARGET ${COMPILER_TARGET}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
"${COMPILER_SOURCE_DIR}/secondIncludeTestDirectory"
|
||||
$<TARGET_FILE_DIR:${COMPILER_TARGET}>/secondIncludeTestDirectory)
|
||||
COMMENT "Copying compiler test resources..."
|
||||
TARGET ${${MODULE_NAME}_OUT}
|
||||
PRE_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
${CLConform_SOURCE_DIR}/test_conformance/compiler/includeTestDirectory
|
||||
${COMPILER_TEST_RESOURCES}/includeTestDirectory
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
${CLConform_SOURCE_DIR}/test_conformance/compiler/secondIncludeTestDirectory
|
||||
${COMPILER_TEST_RESOURCES}/secondIncludeTestDirectory)
|
||||
|
||||
Reference in New Issue
Block a user