cmake_modules/FindClang.cmake
author koda
Sun, 20 Mar 2016 03:08:51 -0400
changeset 11617 b7d5d75469ee
parent 9246 75f430ebeb74
permissions -rw-r--r--
Move pixel format conversion from uVideoRec to AVWrapper This has several benefits, being in C-land allows us to better use libav API and avoid mixing memory allocated from Pascal. Also the C code for the conversion loop generated by GCC or Clang is probably more optimized than by Freepascal. Finally it will simplify code in the future if we are going to enable any other pixel format than yuv420p. Change the coefficients to improve color accuracy during conversion.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9246
75f430ebeb74 new FindClang.cmake
koda
parents: 9133
diff changeset
     1
# - Try to find the Clang/LLVM executable
75f430ebeb74 new FindClang.cmake
koda
parents: 9133
diff changeset
     2
# Once done this will define
75f430ebeb74 new FindClang.cmake
koda
parents: 9133
diff changeset
     3
#
75f430ebeb74 new FindClang.cmake
koda
parents: 9133
diff changeset
     4
#  CLANG_FOUND       - system has Clang
75f430ebeb74 new FindClang.cmake
koda
parents: 9133
diff changeset
     5
#  CLANG_VERSION     - Clang version
75f430ebeb74 new FindClang.cmake
koda
parents: 9133
diff changeset
     6
#  CLANG_EXECUTABLE  - Clang executable
75f430ebeb74 new FindClang.cmake
koda
parents: 9133
diff changeset
     7
#
75f430ebeb74 new FindClang.cmake
koda
parents: 9133
diff changeset
     8
# Copyright (c) 2013, Vittorio Giovara <vittorio.giovara@gmail.com>
75f430ebeb74 new FindClang.cmake
koda
parents: 9133
diff changeset
     9
#
75f430ebeb74 new FindClang.cmake
koda
parents: 9133
diff changeset
    10
# Redistribution and use is allowed according to the terms of the BSD license.
75f430ebeb74 new FindClang.cmake
koda
parents: 9133
diff changeset
    11
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
75f430ebeb74 new FindClang.cmake
koda
parents: 9133
diff changeset
    12
75f430ebeb74 new FindClang.cmake
koda
parents: 9133
diff changeset
    13
find_program(CLANG_EXECUTABLE
8450
404ddce27b23 add support for clang 3.3 (although there has to be a better way for this) and output right version number
koda
parents: 8113
diff changeset
    14
        NAMES clang-mp-3.3 clang-mp-3.2 clang-mp-3.1 clang-mp-3.0 clang
8109
b5cd8cad2d86 Move code for Clang to separate CMake module.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents:
diff changeset
    15
        PATHS /opt/local/bin /usr/local/bin /usr/bin)
9246
75f430ebeb74 new FindClang.cmake
koda
parents: 9133
diff changeset
    16
75f430ebeb74 new FindClang.cmake
koda
parents: 9133
diff changeset
    17
if (CLANG_EXECUTABLE)
75f430ebeb74 new FindClang.cmake
koda
parents: 9133
diff changeset
    18
    execute_process(COMMAND ${CLANG_EXECUTABLE} --version
75f430ebeb74 new FindClang.cmake
koda
parents: 9133
diff changeset
    19
                    OUTPUT_VARIABLE CLANG_VERSION_OUTPUT
75f430ebeb74 new FindClang.cmake
koda
parents: 9133
diff changeset
    20
                    ERROR_VARIABLE CLANG_VERSION_ERROR
75f430ebeb74 new FindClang.cmake
koda
parents: 9133
diff changeset
    21
                    RESULT_VARIABLE CLANG_VERSION_RESULT
75f430ebeb74 new FindClang.cmake
koda
parents: 9133
diff changeset
    22
                    OUTPUT_STRIP_TRAILING_WHITESPACE
75f430ebeb74 new FindClang.cmake
koda
parents: 9133
diff changeset
    23
                    )
75f430ebeb74 new FindClang.cmake
koda
parents: 9133
diff changeset
    24
75f430ebeb74 new FindClang.cmake
koda
parents: 9133
diff changeset
    25
    if(${CLANG_VERSION_RESULT} EQUAL 0)
75f430ebeb74 new FindClang.cmake
koda
parents: 9133
diff changeset
    26
        string(REGEX MATCH "[0-9]+\\.[0-9]+" CLANG_VERSION "${CLANG_VERSION_OUTPUT}")
75f430ebeb74 new FindClang.cmake
koda
parents: 9133
diff changeset
    27
        string(REGEX REPLACE "([0-9]+\\.[0-9]+)" "\\1" CLANG_VERSION "${CLANG_VERSION}")
75f430ebeb74 new FindClang.cmake
koda
parents: 9133
diff changeset
    28
    else()
75f430ebeb74 new FindClang.cmake
koda
parents: 9133
diff changeset
    29
        message(SEND_ERROR "Command \"${CLANG_EXECUTABLE} --version\" failed with output: ${CLANG_VERSION_ERROR}")
75f430ebeb74 new FindClang.cmake
koda
parents: 9133
diff changeset
    30
    endif()
8113
0ad9c42dca7c Refactor Clang module.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents: 8111
diff changeset
    31
endif()
8109
b5cd8cad2d86 Move code for Clang to separate CMake module.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents:
diff changeset
    32
9246
75f430ebeb74 new FindClang.cmake
koda
parents: 9133
diff changeset
    33
include(FindPackageHandleStandardArgs)
75f430ebeb74 new FindClang.cmake
koda
parents: 9133
diff changeset
    34
find_package_handle_standard_args(Clang DEFAULT_MSG CLANG_EXECUTABLE CLANG_VERSION)
75f430ebeb74 new FindClang.cmake
koda
parents: 9133
diff changeset
    35
mark_as_advanced(CLANG_VERSION)
8109
b5cd8cad2d86 Move code for Clang to separate CMake module.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents:
diff changeset
    36