cmake_modules/CheckHaskellModuleExists.cmake
author koda
Sun, 20 Mar 2016 03:08:51 -0400
changeset 11617 b7d5d75469ee
parent 11333 facac91c7c65
child 11860 ad435d95ca4b
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:
10109
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
     1
# Based on CheckLibraryExists.cmake from CMake
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
     2
#=============================================================================
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
     3
# Copyright 2002-2009 Kitware, Inc.
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
     4
#
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
     5
# Distributed under the OSI-approved BSD License
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
     6
#
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
     7
# This software is distributed WITHOUT ANY WARRANTY; without even the
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
     8
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
     9
# See the License for more information.
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
    10
#=============================================================================
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
    11
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
    12
macro(CHECK_HASKELL_MODULE_EXISTS MODULE FUNCTION PARAMCOUNT LIBRARY)
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
    13
  set(VARIABLE "HS_MODULE_${LIBRARY}_${FUNCTION}")
11333
facac91c7c65 Remove quotes when checking Haskell Modules to adopt new CMake
Milo Mordaunt <milomord@gmail.com>
parents: 10723
diff changeset
    14
  if(${VARIABLE} MATCHES ^${VARIABLE}$)
10109
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
    15
    message(STATUS "Looking for ${FUNCTION} in ${MODULE}")
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
    16
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
    17
    set(PARAMETERS "")
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
    18
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
    19
    if(PARAMCOUNT GREATER 0)
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
    20
        foreach(__TRASH__ RANGE 1 ${PARAMCOUNT})
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
    21
            set(PARAMETERS "${PARAMETERS} undefined")
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
    22
        endforeach()
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
    23
    endif()
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
    24
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
    25
    set(PARAMETERS "")
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
    26
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
    27
    execute_process(COMMAND ${GHC_EXECUTABLE}
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
    28
                    "-DMODULE=${MODULE}"
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
    29
                    "-DFUNCTION=${FUNCTION}"
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
    30
                    "-DPARAMETERS=${PARAMETERS}"
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
    31
                    -cpp
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
    32
                    -c "${CMAKE_MODULE_PATH}/checkModule.hs"
10723
2cfa65083621 Use ghc return value instead of looking for the stderr, do not throw error when an haskell module throws a build failure, e.g. because of false positives like this one (debian/arm*)
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents: 10109
diff changeset
    33
                    RESULT_VARIABLE COMMAND_RESULT
10109
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
    34
                    ERROR_VARIABLE BUILD_ERROR
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
    35
                    OUTPUT_STRIP_TRAILING_WHITESPACE
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
    36
                    )
10723
2cfa65083621 Use ghc return value instead of looking for the stderr, do not throw error when an haskell module throws a build failure, e.g. because of false positives like this one (debian/arm*)
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents: 10109
diff changeset
    37
    if(${COMMAND_RESULT} EQUAL 0)
10109
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
    38
      message(STATUS "Looking for ${FUNCTION} in ${MODULE} - found")
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
    39
      set(${VARIABLE} 1 CACHE INTERNAL "Have module ${MODULE}")
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
    40
      file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
    41
        "Determining if the function ${FUNCTION} exists in the ${MODULE} passed\n\n")
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
    42
    else()
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
    43
      message(STATUS "Looking for ${FUNCTION} in ${MODULE} - not found")
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
    44
      set(${VARIABLE} "" CACHE INTERNAL "Have module ${MODULE}")
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
    45
      file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
    46
        "Determining if the function ${FUNCTION} exists in the ${MODULE} "
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
    47
        "failed with the following output:\n"
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
    48
        "${BUILD_ERROR}\n\n")
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
    49
      message(FATAL_ERROR "Haskell library '${LIBRARY}' required")
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
    50
    endif()
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
    51
  endif()
91d126fbd7bd CMake checks for haskell modules needed
unc0rr
parents:
diff changeset
    52
endmacro()