[Beignet] [PATCH] Fix a makefile bug for gcc is not the default compiler

Zhigang Gong zhigang.gong at linux.intel.com
Sun Dec 14 17:43:57 PST 2014


The patch itself LGTM, but please don't forget to add some commit messages
next time. I added the following message for this commit and will push it
latter:

"
If no compiler macro is defined and the system only has clang
or icc, the previous implementation will treat clang as gcc and
will set some incorrect parameters. Now fix it.
"

Thanks,
Zhigang Gong.

On Mon, Dec 01, 2014 at 11:45:52AM +0800, Lv Meng wrote:
> Signed-off-by: Lv Meng <meng.lv at intel.com>
> ---
>  CMakeLists.txt | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/CMakeLists.txt b/CMakeLists.txt
> index 49c8929..369aba7 100644
> --- a/CMakeLists.txt
> +++ b/CMakeLists.txt
> @@ -1,6 +1,7 @@
>  # compiler choose,now support ICC,GCC CLANG compiler
> -set (COMPILER "GCC" CACHE INT "Compiler to choose on Linux (GCC,ICC,CLANG)")
>  if (COMPILER STREQUAL "GCC")
> +  find_program(CMAKE_C_COMPILER NAMES gcc)
> +  find_program(CMAKE_CXX_COMPILER NAMES g++)
>  elseif (COMPILER STREQUAL "CLANG")
>    set (CMAKE_C_COMPILER   "clang")
>    set (CMAKE_CXX_COMPILER "clang++")
> @@ -19,7 +20,13 @@ set (LIBCL_DRIVER_VERSION_MAJOR 1)
>  set (LIBCL_DRIVER_VERSION_MINOR 0)
>  set (LIBCL_C_VERSION_MAJOR 1)
>  set (LIBCL_C_VERSION_MINOR 2)
> -
> +if( ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
> +  set(COMPILER "CLANG")
> +elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
> +  set(COMPILER "GCC")
> +elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel")
> +  set(COMPILER "ICC")
> +endif()
>  configure_file (
>    "src/OCLConfig.h.in"
>    "src/OCLConfig.h"
> -- 
> 1.9.1
> 
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list