[Cmake-commits] CMake branch, next, updated. v2.8.12.2-1648-ga2aa041

Matthaus G. Chajdas cmake at anteru.net
Sat Feb 22 13:48:52 EST 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  a2aa041a37ed71cb50bbee001ee8f8ed0d8ab76a (commit)
       via  49f21d8967e2f76b8ee7d5d65855665a76f025e1 (commit)
       via  4e647cf6b5114307ff0e4bc985b53a0c04661623 (commit)
      from  2f164149ce6dfe7c9a5689ef523e9b3c16f69a2f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a2aa041a37ed71cb50bbee001ee8f8ed0d8ab76a
commit a2aa041a37ed71cb50bbee001ee8f8ed0d8ab76a
Merge: 2f16414 49f21d8
Author:     Matthaus G. Chajdas <cmake at anteru.net>
AuthorDate: Sat Feb 22 13:48:51 2014 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Sat Feb 22 13:48:51 2014 -0500

    Merge topic 'find-hg-opencl' into next
    
    49f21d89 Add FindOpenCL and FindHg modules.
    4e647cf6 CMake Nightly Date Stamp


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=49f21d8967e2f76b8ee7d5d65855665a76f025e1
commit 49f21d8967e2f76b8ee7d5d65855665a76f025e1
Author:     Matthäus G. Chajdas <cmake at anteru.net>
AuthorDate: Sat Feb 22 19:46:48 2014 +0100
Commit:     Matthäus G. Chajdas <cmake at anteru.net>
CommitDate: Sat Feb 22 19:46:48 2014 +0100

    Add FindOpenCL and FindHg modules.

diff --git a/Help/module/FindOpenCL.rst b/Help/module/FindOpenCL.rst
new file mode 100644
index 0000000..e87e289
--- /dev/null
+++ b/Help/module/FindOpenCL.rst
@@ -0,0 +1 @@
+.. cmake-module:: ../../Modules/FindOpenCL.cmake
diff --git a/Modules/FindHg.cmake b/Modules/FindHg.cmake
index a1fb33f..6887175 100644
--- a/Modules/FindHg.cmake
+++ b/Modules/FindHg.cmake
@@ -1,29 +1,46 @@
 #.rst:
-# FindHg
+# FindHG
 # ------
 #
-#
+# Extract information from a mercurial working copy
 #
 # The module defines the following variables:
 #
 # ::
 #
-#    HG_EXECUTABLE - path to mercurial command line client (hg)
-#    HG_FOUND - true if the command line client was found
-#    HG_VERSION_STRING - the version of mercurial found
+#   Hg_EXECUTABLE - path to mercurial command line client
+#   Hg_FOUND - true if the command line client was found
+#   Hg_VERSION_STRING - the version of the mercurial client
+#
+#
+# If the command line client executable is found the following macro is defined:
+#
+# ::
+#
+#   Hg_WC_INFO(<dir> <var-prefix>)
+#
+# Hg_WC_INFO extracts information of a mercurial working copy
+# at a given location.  This macro defines the following variables:
+#
+# ::
+#
+#   <var-prefix>_WC_CHANGESET - current changeset
+#   <var-prefix>_WC_REVISION - current revision
 #
 # Example usage:
 #
 # ::
 #
-#    find_package(Hg)
-#    if(HG_FOUND)
-#      message("hg found: ${HG_EXECUTABLE}")
-#    endif()
+#   find_package(Hg)
+#   if(Hg_FOUND)
+#     Hg_WC_INFO(${PROJECT_SOURCE_DIR} Project)
+#     message("Current revision is ${Project_WC_REVISION}")
+#     message("Current changeset is ${Project_WC_CHANGESET}")
+#   endif()
+#
 
 #=============================================================================
-# Copyright 2010-2012 Kitware, Inc.
-# Copyright 2012      Rolf Eike Beer <eike at sf-mail.de>
+# Copyright 2014 Matthaeus G. Chajdas
 #
 # Distributed under the OSI-approved BSD License (the "License");
 # see accompanying file Copyright.txt for details.
@@ -35,27 +52,40 @@
 # (To distribute this file outside of CMake, substitute the full
 #  License text for the above reference.)
 
-find_program(HG_EXECUTABLE
+FIND_PROGRAM(Hg_EXECUTABLE
   NAMES hg
-  PATH_SUFFIXES Mercurial
-  DOC "hg command line client"
-  )
-mark_as_advanced(HG_EXECUTABLE)
+  PATHS [HKEY_LOCAL_MACHINE\\Software\\TortoiseHG]
+      [HKEY_LOCAL_MACHINE\\Software\\Wow6432Node\\TortoiseHG]
+  DOC "hg command line client")
+MARK_AS_ADVANCED(Hg_EXECUTABLE)
+
+IF(Hg_EXECUTABLE)
+  EXECUTE_PROCESS(COMMAND ${Hg_EXECUTABLE} --version
+    OUTPUT_VARIABLE Hg_VERSION
+    ERROR_QUIET
+    OUTPUT_STRIP_TRAILING_WHITESPACE)
+  IF(Hg_VERSION MATCHES "^Mercurial Distributed SCM \\(version ([0-9][^)]*)\\)")
+    SET(Hg_VERSION_STRING "${CMAKE_MATCH_1}")
+  ENDIF()
+  UNSET(Hg_VERSION)
+
+  MACRO(Hg_WC_INFO dir prefix)
+    EXECUTE_PROCESS(COMMAND ${Hg_EXECUTABLE} id -i -n
+      WORKING_DIRECTORY ${dir}
+      ERROR_VARIABLE Hg_ERROR
+      OUTPUT_VARIABLE ${prefix}_WC_DATA
+      OUTPUT_STRIP_TRAILING_WHITESPACE)
+    IF(NOT ${Hg_error} EQUAL 0)
+      MESSAGE(SEND_ERROR "Command \"${Hg_EXECUTBALE} id -n\" in directory ${dir} failed with output:\n${Hg_ERROR}")
+    ENDIF()
 
-if(HG_EXECUTABLE)
-  execute_process(COMMAND ${HG_EXECUTABLE} --version
-                  OUTPUT_VARIABLE hg_version
-                  ERROR_QUIET
-                  OUTPUT_STRIP_TRAILING_WHITESPACE)
-  if(hg_version MATCHES "^Mercurial Distributed SCM \\(version ([0-9][^)]*)\\)")
-    set(HG_VERSION_STRING "${CMAKE_MATCH_1}")
-  endif()
-  unset(hg_version)
-endif()
+    STRING(REGEX REPLACE "([0-9a-f]+)\\+? [0-9]+\\+?" "\\1" ${prefix}_WC_CHANGESET ${${prefix}_WC_DATA})
+    STRING(REGEX REPLACE "[0-9a-f]+\\+? ([0-9]+)\\+?" "\\1" ${prefix}_WC_REVISION ${${prefix}_WC_DATA})
+  ENDMACRO(Hg_WC_INFO)
+ENDIF(Hg_EXECUTABLE)
 
-# Handle the QUIETLY and REQUIRED arguments and set HG_FOUND to TRUE if
-# all listed variables are TRUE
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+INCLUDE(FindPackageHandleStandardArgs)
 find_package_handle_standard_args(Hg
-                                  REQUIRED_VARS HG_EXECUTABLE
-                                  VERSION_VAR HG_VERSION_STRING)
+  FOUND_VAR Hg_FOUND
+  REQUIRED_VARS Hg_EXECUTABLE
+  VERSION_VAR Hg_VERSION_STRING)
diff --git a/Modules/FindOpenCL.cmake b/Modules/FindOpenCL.cmake
new file mode 100644
index 0000000..e82a04e
--- /dev/null
+++ b/Modules/FindOpenCL.cmake
@@ -0,0 +1,127 @@
+#.rst:
+# FindOpenCL
+# ----------
+#
+# Try to find OpenCL
+#
+# Once done this will define
+#
+# ::
+#
+#   OpenCL_FOUND          - system has OpenCL
+#   OpenCL_INCLUDE_DIR    - the OpenCL include directory
+#   OpenCL_LIBRARIES      - Link against this library to use OpenCL
+#   OpenCL_LIBRARY        - Path to the OpenCL library
+#   OpenCL_VERSION_STRING - Highest supported OpenCL version (eg. 1.2)
+#
+
+#=============================================================================
+# Copyright 2014 Matthaeus G. Chajdas
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+#  License text for the above reference.)
+
+FUNCTION(_FIND_OPENCL_VERSION)
+  INCLUDE(CheckSymbolExists)
+  INCLUDE(CMakePushCheckState)
+
+  CMAKE_PUSH_CHECK_STATE()
+  FOREACH(VERSION "2_0" "1_2" "1_1" "1_0")
+    SET(CMAKE_REQUIRED_INCLUDES "${OpenCL_INCLUDE_DIR}")
+
+    IF(APPLE)
+      CHECK_SYMBOL_EXISTS(
+        CL_VERSION_${VERSION}
+        "${OpenCL_INCLUDE_DIR}/OpenCL/cl.h"
+        OPENCL_VERSION_${VERSION})
+    ELSE()
+      CHECK_SYMBOL_EXISTS(
+        CL_VERSION_${VERSION}
+        "${OpenCL_INCLUDE_DIR}/CL/cl.h"
+        OPENCL_VERSION_${VERSION})
+    ENDIF()
+
+    IF(OPENCL_VERSION_${VERSION})
+      STRING(REPLACE "_" "." VERSION "${VERSION}")
+      SET(OpenCL_VERSION_STRING ${VERSION} CACHE
+        STRING "Highest supported OpenCL version")
+      BREAK()
+    ENDIF()
+  ENDFOREACH()
+  CMAKE_POP_CHECK_STATE()
+ENDFUNCTION()
+
+FIND_PATH(OpenCL_INCLUDE_DIR
+  NAMES
+    CL/cl.h OpenCL/cl.h
+  PATHS ENV
+    "PROGRAMFILES(X86)"
+    AMDAPPSDKROOT
+    INTELOCLSDKROOT
+    NVSDKCOMPUTE_ROOT
+    CUDA_PATH
+    ATISTREAMSDKROOT
+  PATH_SUFFIXES
+    OpenCL/common/inc
+    "AMD APP/include")
+
+_FIND_OPENCL_VERSION()
+
+IF(WIN32)
+  IF(CMAKE_SIZEOF_VOID_P EQUAL 4)
+    FIND_LIBRARY(OpenCL_LIBRARY
+      NAMES OpenCL
+      PATHS ENV
+        "PROGRAMFILES(X86)"
+        AMDAPPSDKROOT
+        INTELOCLSDKROOT
+        CUDA_PATH
+        NVSDKCOMPUTE_ROOT
+        ATISTREAMSDKROOT
+      PATH_SUFFIXES
+        "AMD APP/lib/x86"
+        lib/x86
+        lib/Win32
+        OpenCL/common/lib/Win32)
+  ELSEIF(CMAKE_SIZEOF_VOID_P EQUAL 8)
+    FIND_LIBRARY(OpenCL_LIBRARY
+      NAMES OpenCL
+      PATHS ENV
+        "PROGRAMFILES(X86)"
+        AMDAPPSDKROOT
+        INTELOCLSDKROOT
+        CUDA_PATH
+        NVSDKCOMPUTE_ROOT
+        ATISTREAMSDKROOT
+      PATH_SUFFIXES
+        "AMD APP/lib/x86_64"
+        lib/x86_64
+        lib/x64
+        OpenCL/common/lib/x64)
+  ENDIF()
+ELSE()
+  FIND_LIBRARY(OpenCL_LIBRARY
+    NAMES OpenCL)
+ENDIF()
+
+SET(OpenCL_LIBRARIES ${OpenCL_LIBRARY})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(
+  OpenCL
+  FOUND_VAR OpenCL_FOUND
+  REQUIRED_VARS OpenCL_LIBRARY OpenCL_INCLUDE_DIR
+  VERSION_VAR OpenCL_VERSION_STRING)
+
+MARK_AS_ADVANCED(
+  OpenCL_INCLUDE_DIR
+  OpenCL_LIBRARY
+  OpenCL_LIBRARIES
+  OpenCL_VERSION_STRING)

-----------------------------------------------------------------------

Summary of changes:
 Help/module/FindOpenCL.rst |    1 +
 Modules/FindHg.cmake       |   92 +++++++++++++++++++++-----------
 Modules/FindOpenCL.cmake   |  127 ++++++++++++++++++++++++++++++++++++++++++++
 Source/CMakeVersion.cmake  |    2 +-
 4 files changed, 190 insertions(+), 32 deletions(-)
 create mode 100644 Help/module/FindOpenCL.rst
 create mode 100644 Modules/FindOpenCL.cmake


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list