From 64609a7d78c8098ebd5ac29c7b698605da179f8b Mon Sep 17 00:00:00 2001 From: Pierre Moreau Date: Tue, 30 Apr 2019 16:19:52 +0200 Subject: [PATCH] cl20: CMake improvements (#235) * Do not append non-existing folder to CMAKE_MODULE_PATH Fixes #221 * Add use of deprecated OpenCL 1.2 APIs * Define CL_TARGET_OPENCL_VERSION to 200 Fixes #227 * Define cmake_minimum_required as first operation The CMake documentation mentions that > Call the cmake_minimum_required() command at the beginning of the > top-level CMakeLists.txt file even before calling the project() > command. It is important to establish version and policy settings > before invoking other commands whose behavior they may affect. * CMake: Match both AppleClang and Clang --- CMakeLists.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f81c7b36..b33f65dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,3 +1,5 @@ +cmake_minimum_required(VERSION 3.1) + set( CONFORMANCE_SUFFIX "" ) set(CLConform_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) @@ -18,14 +20,12 @@ 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 3.1) +add_definitions(-DCL_TARGET_OPENCL_VERSION=200) add_definitions(-DCL_USE_DEPRECATED_OPENCL_2_0_APIS=1) +add_definitions(-DCL_USE_DEPRECATED_OPENCL_1_2_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") @@ -61,7 +61,7 @@ include(CMakeVendor.txt OPTIONAL) include(CheckFunctionExists) include(CheckIncludeFiles) -if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") +if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?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 @@ -79,7 +79,7 @@ else() endif() # Clang gives C++11 narrowing warnings so suppress these for now -if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") +if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?Clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-c++11-narrowing") endif()