Squashed 'cmake/' changes from 2d25566..813d030
813d030 Add module to get information about a git repo b2070d7 Fix installing docs optionally, even on old cmake versions e8cbbf5 Hide the module variable if we find it manually c1ad55e Fix opencv finder for old libraries 9ca6a00 Make the opencv module handle finding the config file, if it exists. beabdbd Merge commit 'aca0ca0aea326a4b8c10f6638024a6e8c0279d02' e36bb5b Merge branch 'master' of git@github.com:rpavlik/wiimote-head-tracker-gui.git b75b7df Improve wiiuse locator 92f1870 Remove all old build systems ee0ce40 Add Windows HID library finder b8878cb Update wiiuse finder to locate DLL from cmake-based install 5b7d5d9 Add a Bluez find module ee17e2a Update cmake modules 30e28b2 Update cmake files dc48ba7 Fix windows build 1958481 Fix RPATH handling on Linux 3fe03cd Initial commit git-subtree-dir: cmake git-subtree-split: 813d0301a4ed5b53d8187608c2986904ce99ab4e
This commit is contained in:
@@ -59,7 +59,86 @@ if(PDFLATEX_COMPILER)
|
|||||||
set(DOXYGEN_PDFLATEX "YES")
|
set(DOXYGEN_PDFLATEX "YES")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# An optional single-file install that supports cmake older than 2.8.0
|
||||||
|
# For internal use
|
||||||
|
function(_dt_install_file target filename dest rename)
|
||||||
|
if(CMAKE_VER VERSION_LESS 2.8.0)
|
||||||
|
set(INSTALL_CODE "
|
||||||
|
if(EXISTS \"${filename}\")
|
||||||
|
message(STATUS \"Found: ${filename}\")
|
||||||
|
file(INSTALL
|
||||||
|
DESTINATION \"\${CMAKE_INSTALL_PREFIX}/${dest}\"
|
||||||
|
TYPE FILE
|
||||||
|
RENAME \"${rename}\"
|
||||||
|
FILES \"${filename}\")
|
||||||
|
else()
|
||||||
|
message(STATUS \"Skipping (build '${target}' to create): ${filename}\")
|
||||||
|
endif()
|
||||||
|
")
|
||||||
|
if(NOT ARGN STREQUAL "")
|
||||||
|
set(INSTALL_COMPONENT "${ARGN}")
|
||||||
|
set(INSTALL_CODE "
|
||||||
|
if(NOT CMAKE_INSTALL_COMPONENT OR \"\${CMAKE_INSTALL_COMPONENT}\" STREQUAL \"${INSTALL_COMPONENT}\")
|
||||||
|
${INSTALL_CODE}
|
||||||
|
endif()
|
||||||
|
")
|
||||||
|
endif()
|
||||||
|
install(CODE "${INSTALL_CODE}")
|
||||||
|
else()
|
||||||
|
set(COMPONENT_ARGS)
|
||||||
|
if(NOT ARGN STREQUAL "")
|
||||||
|
set(COMPONENT_ARGS COMPONENT "${ARGN}")
|
||||||
|
endif()
|
||||||
|
install(FILES
|
||||||
|
"${filename}"
|
||||||
|
DESTINATION
|
||||||
|
"${dest}"
|
||||||
|
RENAME "${rename}"
|
||||||
|
${COMPONENT_ARGS}
|
||||||
|
OPTIONAL)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# An optional single-directory install that supports cmake older than 2.8.0
|
||||||
|
# For internal use
|
||||||
|
function(_dt_install_dir target dir dest)
|
||||||
|
if(CMAKE_VER VERSION_LESS 2.8.0)
|
||||||
|
set(INSTALL_CODE "
|
||||||
|
if(EXISTS \"${dir}\")
|
||||||
|
message(STATUS \"Found: ${dir}\")
|
||||||
|
file(INSTALL
|
||||||
|
DESTINATION \"\${CMAKE_INSTALL_PREFIX}/${dest}\"
|
||||||
|
TYPE DIRECTORY
|
||||||
|
FILES \"${dir}\")
|
||||||
|
else()
|
||||||
|
message(STATUS \"Skipping (build '${target}' to create): ${dir}\")
|
||||||
|
endif()
|
||||||
|
")
|
||||||
|
if(NOT ARGN STREQUAL "")
|
||||||
|
set(INSTALL_COMPONENT "${ARGN}")
|
||||||
|
set(INSTALL_CODE "
|
||||||
|
|
||||||
|
if(NOT CMAKE_INSTALL_COMPONENT OR \"\${CMAKE_INSTALL_COMPONENT}\" STREQUAL \"${INSTALL_COMPONENT}\")
|
||||||
|
${INSTALL_CODE}
|
||||||
|
endif()
|
||||||
|
")
|
||||||
|
endif()
|
||||||
|
install(CODE "${INSTALL_CODE}")
|
||||||
|
else()
|
||||||
|
set(COMPONENT_ARGS)
|
||||||
|
if(NOT ARGN STREQUAL "")
|
||||||
|
set(COMPONENT_ARGS COMPONENT "${ARGN}")
|
||||||
|
endif()
|
||||||
|
install(DIRECTORY
|
||||||
|
"${dir}"
|
||||||
|
DESTINATION
|
||||||
|
"${dest}"
|
||||||
|
${COMPONENT_ARGS}
|
||||||
|
OPTIONAL)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endfunction()
|
||||||
|
|
||||||
function(add_doxygen _doxyfile)
|
function(add_doxygen _doxyfile)
|
||||||
# parse arguments
|
# parse arguments
|
||||||
@@ -215,30 +294,15 @@ function(add_doxygen _doxyfile)
|
|||||||
|
|
||||||
if(INSTALL_DESTINATION)
|
if(INSTALL_DESTINATION)
|
||||||
if(INSTALL_COMPONENT)
|
if(INSTALL_COMPONENT)
|
||||||
install(DIRECTORY
|
_dt_install_dir("${DOC_TARGET}" "${OUTPUT_DIRECTORY}/html" "${INSTALL_DESTINATION}" "${INSTALL_COMPONENT}")
|
||||||
"${OUTPUT_DIRECTORY}/html"
|
|
||||||
DESTINATION
|
|
||||||
"${INSTALL_DESTINATION}"
|
|
||||||
COMPONENT
|
|
||||||
"${INSTALL_COMPONENT}"
|
|
||||||
OPTIONAL)
|
|
||||||
if(MAKE_PDF)
|
if(MAKE_PDF)
|
||||||
install(FILES "${OUTPUT_DIRECTORY}/latex/refman.pdf"
|
_dt_install_file("${DOC_TARGET}" "${OUTPUT_DIRECTORY}/latex/refman.pdf" "${INSTALL_DESTINATION}" "${INSTALL_PDF_NAME}" "${INSTALL_COMPONENT}")
|
||||||
DESTINATION "${INSTALL_DESTINATION}"
|
|
||||||
COMPONENT "${INSTALL_COMPONENT}"
|
|
||||||
RENAME "${INSTALL_PDF_NAME}"
|
|
||||||
OPTIONAL)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
else()
|
else()
|
||||||
install(DIRECTORY
|
_dt_install_dir("${DOC_TARGET}" "${OUTPUT_DIRECTORY}/html" "${INSTALL_DESTINATION}")
|
||||||
"${OUTPUT_DIRECTORY}/html"
|
|
||||||
DESTINATION
|
|
||||||
"${INSTALL_DESTINATION}")
|
|
||||||
if(MAKE_PDF)
|
if(MAKE_PDF)
|
||||||
install(FILES "${OUTPUT_DIRECTORY}/latex/refman.pdf"
|
_dt_install_file("${DOC_TARGET}" "${OUTPUT_DIRECTORY}/latex/refman.pdf" "${INSTALL_DESTINATION}" "${INSTALL_PDF_NAME}")
|
||||||
DESTINATION "${INSTALL_DESTINATION}"
|
|
||||||
RENAME "${INSTALL_PDF_NAME}")
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
77
FindBluez.cmake
Normal file
77
FindBluez.cmake
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
# - try to find Bluez
|
||||||
|
#
|
||||||
|
# Cache Variables: (probably not for direct use in your scripts)
|
||||||
|
# BLUEZ_INCLUDE_DIR
|
||||||
|
# BLUEZ_LIBRARY
|
||||||
|
#
|
||||||
|
# Non-cache variables you might use in your CMakeLists.txt:
|
||||||
|
# BLUEZ_FOUND
|
||||||
|
# BLUEZ_INCLUDE_DIRS
|
||||||
|
# BLUEZ_LIBRARIES
|
||||||
|
#
|
||||||
|
# Requires these CMake modules:
|
||||||
|
# FindPackageHandleStandardArgs (known included with CMake >=2.6.2)
|
||||||
|
#
|
||||||
|
# Original Author:
|
||||||
|
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
|
||||||
|
# http://academic.cleardefinition.com
|
||||||
|
# Iowa State University HCI Graduate Program/VRAC
|
||||||
|
#
|
||||||
|
# Copyright Iowa State University 2009-2010
|
||||||
|
# Distributed under the Boost Software License, Version 1.0.
|
||||||
|
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
# http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
|
if(WIN32 OR APPLE OR NOT UNIX)
|
||||||
|
if(NOT Bluez_FIND_QUIETLY)
|
||||||
|
message(STATUS "Platform not supported by Bluez - skipping search")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
set(BLUEZ_ROOT_DIR
|
||||||
|
"${BLUEZ_ROOT_DIR}"
|
||||||
|
CACHE
|
||||||
|
PATH
|
||||||
|
"Directory to search")
|
||||||
|
|
||||||
|
if(CMAKE_SIZEOF_VOID_P MATCHES "8")
|
||||||
|
set(_LIBSUFFIXES lib64 lib)
|
||||||
|
else()
|
||||||
|
set(_LIBSUFFIXES lib)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_library(BLUEZ_LIBRARY
|
||||||
|
NAMES
|
||||||
|
bluetooth
|
||||||
|
HINTS
|
||||||
|
"${BLUEZ_ROOT_DIR}"
|
||||||
|
PATH_SUFFIXES
|
||||||
|
"${_LIBSUFFIXES}")
|
||||||
|
|
||||||
|
# Might want to look close to the library first for the includes.
|
||||||
|
get_filename_component(_libdir "${BLUEZ_LIBRARY}" PATH)
|
||||||
|
|
||||||
|
find_path(BLUEZ_INCLUDE_DIR
|
||||||
|
NAMES
|
||||||
|
bluetooth/bluetooth.h
|
||||||
|
HINTS
|
||||||
|
"${_libdir}/.."
|
||||||
|
PATHS
|
||||||
|
"${BLUEZ_ROOT_DIR}"
|
||||||
|
PATH_SUFFIXES
|
||||||
|
include/)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(Bluez
|
||||||
|
DEFAULT_MSG
|
||||||
|
BLUEZ_LIBRARY
|
||||||
|
BLUEZ_INCLUDE_DIR)
|
||||||
|
|
||||||
|
if(BLUEZ_FOUND)
|
||||||
|
set(BLUEZ_LIBRARIES "${BLUEZ_LIBRARY}")
|
||||||
|
set(BLUEZ_INCLUDE_DIRS "${BLUEZ_INCLUDE_DIR}")
|
||||||
|
mark_as_advanced(BLUEZ_ROOT_DIR)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
mark_as_advanced(BLUEZ_INCLUDE_DIR
|
||||||
|
BLUEZ_LIBRARY)
|
||||||
@@ -30,6 +30,11 @@ set(OPENCV_ROOT_DIR
|
|||||||
PATH
|
PATH
|
||||||
"Path to search for OpenCV")
|
"Path to search for OpenCV")
|
||||||
|
|
||||||
|
find_package(OpenCV QUIET NO_MODULE)
|
||||||
|
if(OpenCV_LIBS AND NOT OpenCV_LIBRARIES)
|
||||||
|
set(OPENCV_LIBRARIES ${OpenCV_LIBS})
|
||||||
|
set(OPENCV_FOUND true)
|
||||||
|
else()
|
||||||
include(ProgramFilesGlob)
|
include(ProgramFilesGlob)
|
||||||
|
|
||||||
# typical root dirs of installations, exactly one of them is used
|
# typical root dirs of installations, exactly one of them is used
|
||||||
@@ -171,7 +176,7 @@ else()
|
|||||||
foreach(component ${OPENCV_OLD_COMPONENTS})
|
foreach(component ${OPENCV_OLD_COMPONENTS})
|
||||||
find_library(OPENCV_${component}_LIBRARY
|
find_library(OPENCV_${component}_LIBRARY
|
||||||
NAMES
|
NAMES
|
||||||
cvaux
|
${component}
|
||||||
HINTS
|
HINTS
|
||||||
${OPENCV_BASE_DIR}
|
${OPENCV_BASE_DIR}
|
||||||
PATH_SUFFIXES
|
PATH_SUFFIXES
|
||||||
@@ -224,10 +229,13 @@ if(OPENCV_FOUND)
|
|||||||
|
|
||||||
set(OPENCV_INCLUDE_DIRS ${_req_includes})
|
set(OPENCV_INCLUDE_DIRS ${_req_includes})
|
||||||
set(OPENCV_LIBRARIES ${_req_libs})
|
set(OPENCV_LIBRARIES ${_req_libs})
|
||||||
mark_as_advanced(OPENCV_ROOT_DIR)
|
mark_as_advanced(OPENCV_ROOT_DIR OpenCV_DIR)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
mark_as_advanced(OPENCV_BASE_DIR)
|
mark_as_advanced(OPENCV_BASE_DIR)
|
||||||
foreach(component ${OPENCV_NEW_COMPONENTS} ${OPENCV_OLD_COMPONENTS})
|
foreach(component ${OPENCV_NEW_COMPONENTS} ${OPENCV_OLD_COMPONENTS})
|
||||||
mark_as_advanced(OPENCV_${component}_LIBRARY OPENCV_${component}_INCLUDE_DIR)
|
mark_as_advanced(OPENCV_${component}_LIBRARY OPENCV_${component}_INCLUDE_DIR)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,15 @@ find_path(WIIUSE_INCLUDE_DIR
|
|||||||
|
|
||||||
set(_deps_check)
|
set(_deps_check)
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
find_file(WIIUSE_RUNTIME_LIBRARY NAMES wiiuse.dll HINTS "${_libdir}")
|
find_file(WIIUSE_RUNTIME_LIBRARY
|
||||||
|
NAMES
|
||||||
|
wiiuse.dll
|
||||||
|
HINTS
|
||||||
|
"${_libdir}"
|
||||||
|
"${_libdir}/.."
|
||||||
|
PATH_SUFFIXES
|
||||||
|
bin)
|
||||||
|
|
||||||
set(WIIUSE_RUNTIME_LIBRARIES "${WIIUSE_RUNTIME_LIBRARY}")
|
set(WIIUSE_RUNTIME_LIBRARIES "${WIIUSE_RUNTIME_LIBRARY}")
|
||||||
get_filename_component(WIIUSE_RUNTIME_LIBRARY_DIRS
|
get_filename_component(WIIUSE_RUNTIME_LIBRARY_DIRS
|
||||||
"${WIIUSE_RUNTIME_LIBRARY}"
|
"${WIIUSE_RUNTIME_LIBRARY}"
|
||||||
|
|||||||
127
FindWinHID.cmake
Normal file
127
FindWinHID.cmake
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
# - try to find Windows HID support, part of the WDK/DDK
|
||||||
|
#
|
||||||
|
# Cache Variables: (probably not for direct use in your scripts)
|
||||||
|
# WINHID_INCLUDE_DIR
|
||||||
|
# WINHID_CRT_INCLUDE_DIR
|
||||||
|
# WINHID_LIBRARY
|
||||||
|
#
|
||||||
|
# Non-cache variables you might use in your CMakeLists.txt:
|
||||||
|
# WINHID_FOUND
|
||||||
|
# WINHID_INCLUDE_DIRS
|
||||||
|
# WINHID_LIBRARIES
|
||||||
|
#
|
||||||
|
# Requires these CMake modules:
|
||||||
|
# FindPackageHandleStandardArgs (known included with CMake >=2.6.2)
|
||||||
|
# PrefixListGlob
|
||||||
|
# CleanDirectoryList
|
||||||
|
#
|
||||||
|
# Original Author:
|
||||||
|
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
|
||||||
|
# http://academic.cleardefinition.com
|
||||||
|
# Iowa State University HCI Graduate Program/VRAC
|
||||||
|
#
|
||||||
|
# Copyright Iowa State University 2009-2010
|
||||||
|
# Distributed under the Boost Software License, Version 1.0.
|
||||||
|
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
# http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
|
if(NOT WIN32)
|
||||||
|
find_package_handle_standard_args(WinHID
|
||||||
|
"Skipping search for Windows HID on non-Windows platform"
|
||||||
|
WIN32)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if( (NOT WINHID_ROOT_DIR) AND (NOT ENV{DDKROOT} STREQUAL "") )
|
||||||
|
set(WINHID_ROOT_DIR "$ENV{DDKROOT}")
|
||||||
|
endif()
|
||||||
|
set(WINHID_ROOT_DIR
|
||||||
|
"${WINHID_ROOT_DIR}"
|
||||||
|
CACHE
|
||||||
|
PATH
|
||||||
|
"Directory to search")
|
||||||
|
|
||||||
|
if(CMAKE_SIZEOF_VOID_P MATCHES "8")
|
||||||
|
set(_arch amd64)
|
||||||
|
else()
|
||||||
|
set(_arch i386)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include(PrefixListGlob)
|
||||||
|
include(CleanDirectoryList)
|
||||||
|
prefix_list_glob(_prefixed "*/" "$ENV{SYSTEMDRIVE}/WinDDK/" "c:/WinDDK/")
|
||||||
|
clean_directory_list(_prefixed)
|
||||||
|
|
||||||
|
find_library(WINHID_LIBRARY
|
||||||
|
NAMES
|
||||||
|
hid
|
||||||
|
HINTS
|
||||||
|
"${WINHID_ROOT_DIR}"
|
||||||
|
${_prefixed}
|
||||||
|
PATH_SUFFIXES
|
||||||
|
"lib/w2k/${_arch}" # Win2k min requirement
|
||||||
|
"lib/wxp/${_arch}" # WinXP min requirement
|
||||||
|
"lib/wnet/${_arch}" # Win Server 2003 min requirement
|
||||||
|
"lib/wlh/${_arch}" # Win Vista ("Long Horn") min requirement
|
||||||
|
"lib/win7/${_arch}" # Win 7 min requirement
|
||||||
|
)
|
||||||
|
|
||||||
|
# Might want to look close to the library first for the includes.
|
||||||
|
get_filename_component(_libdir "${WINHID_LIBRARY}" PATH)
|
||||||
|
get_filename_component(_basedir "${_libdir}/../../.." ABSOLUTE)
|
||||||
|
|
||||||
|
find_path(WINHID_INCLUDE_DIR
|
||||||
|
NAMES
|
||||||
|
hidsdi.h
|
||||||
|
HINTS
|
||||||
|
"${_basedir}"
|
||||||
|
PATHS
|
||||||
|
"${WINHID_ROOT_DIR}"
|
||||||
|
PATH_SUFFIXES
|
||||||
|
inc/api)
|
||||||
|
|
||||||
|
find_path(WINHID_CRT_INCLUDE_DIR # otherwise you get weird compile errors
|
||||||
|
NAMES
|
||||||
|
stdio.h
|
||||||
|
HINTS
|
||||||
|
"${_basedir}"
|
||||||
|
PATHS
|
||||||
|
"${WINHID_ROOT_DIR}"
|
||||||
|
PATH_SUFFIXES
|
||||||
|
inc/crt
|
||||||
|
NO_DEFAULT_PATH)
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(WinHID
|
||||||
|
DEFAULT_MSG
|
||||||
|
WINHID_LIBRARY
|
||||||
|
WINHID_INCLUDE_DIR
|
||||||
|
WINHID_CRT_INCLUDE_DIR)
|
||||||
|
|
||||||
|
if(WINHID_FOUND)
|
||||||
|
set(_winreq "Unknown")
|
||||||
|
if(WINHID_LIBRARY MATCHES "lib/w2k")
|
||||||
|
set(_winreq "Windows 2000")
|
||||||
|
elseif(WINHID_LIBRARY MATCHES "lib/wxp")
|
||||||
|
set(_winreq "Windows XP")
|
||||||
|
elseif(WINHID_LIBRARY MATCHES "lib/wnet")
|
||||||
|
set(_winreq "Windows Server 2003")
|
||||||
|
elseif(WINHID_LIBRARY MATCHES "lib/wlh")
|
||||||
|
set(_winreq "Windows Vista")
|
||||||
|
elseif(WINHID_LIBRARY MATCHES "lib/win7")
|
||||||
|
set(_winreq "Windows 7")
|
||||||
|
endif()
|
||||||
|
if(NOT "${WINHID_MIN_WINDOWS_VER}" STREQUAL "${_winreq}")
|
||||||
|
if(NOT WinHID_FIND_QUIETLY)
|
||||||
|
message(STATUS "Linking against WINHID_LIBRARY will enforce this minimum version: ${_winreq}")
|
||||||
|
endif()
|
||||||
|
set(WINHID_MIN_WINDOWS_VER "${_winreq}" CACHE INTERNAL "" FORCE)
|
||||||
|
endif()
|
||||||
|
set(WINHID_LIBRARIES "${WINHID_LIBRARY}")
|
||||||
|
set(WINHID_INCLUDE_DIRS "${WINHID_CRT_INCLUDE_DIR}" "${WINHID_INCLUDE_DIR}")
|
||||||
|
mark_as_advanced(WINHID_ROOT_DIR)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
mark_as_advanced(WINHID_INCLUDE_DIR
|
||||||
|
WINHID_CRT_INCLUDE_DIR
|
||||||
|
WINHID_LIBRARY)
|
||||||
104
GetGitRevisionDescription.cmake
Normal file
104
GetGitRevisionDescription.cmake
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
# - Returns a version string from Git
|
||||||
|
#
|
||||||
|
# These functions force a re-configure on each git commit so that you can
|
||||||
|
# trust the values of the variables in your build system.
|
||||||
|
#
|
||||||
|
# get_git_head_revision(<refspecvar> <hashvar> [<additonal arguments to git describe> ...])
|
||||||
|
#
|
||||||
|
# Returns the refspec and sha hash of the current head revision
|
||||||
|
#
|
||||||
|
# git_describe(<var> [<additonal arguments to git describe> ...])
|
||||||
|
#
|
||||||
|
# Returns the results of git describe on the source tree, and adjusting
|
||||||
|
# the output so that it tests false if an error occurs.
|
||||||
|
#
|
||||||
|
# git_get_exact_tag(<var> [<additonal arguments to git describe> ...])
|
||||||
|
#
|
||||||
|
# Returns the results of git describe --exact-match on the source tree,
|
||||||
|
# and adjusting the output so that it tests false if there was no exact
|
||||||
|
# matching tag.
|
||||||
|
#
|
||||||
|
# Requires CMake 2.6 or newer (uses the 'function' command)
|
||||||
|
#
|
||||||
|
# Original Author:
|
||||||
|
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
|
||||||
|
# http://academic.cleardefinition.com
|
||||||
|
# Iowa State University HCI Graduate Program/VRAC
|
||||||
|
#
|
||||||
|
# Copyright Iowa State University 2009-2010
|
||||||
|
# Distributed under the Boost Software License, Version 1.0.
|
||||||
|
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
# http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
|
if(__get_git_revision_description)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
set(__get_git_revision_description YES)
|
||||||
|
|
||||||
|
# We must run the following at "include" time, not at function call time,
|
||||||
|
# to find the path to this module rather than the path to a calling list file
|
||||||
|
get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
|
||||||
|
|
||||||
|
function(get_git_head_revision _refspecvar _hashvar)
|
||||||
|
set(GIT_DIR "${CMAKE_SOURCE_DIR}/.git")
|
||||||
|
if(NOT EXISTS "${GIT_DIR}")
|
||||||
|
# not in git
|
||||||
|
set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
|
||||||
|
set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data")
|
||||||
|
if(NOT EXISTS "${GIT_DATA}")
|
||||||
|
file(MAKE_DIRECTORY "${GIT_DATA}")
|
||||||
|
endif()
|
||||||
|
set(HEAD_FILE "${GIT_DATA}/HEAD")
|
||||||
|
configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY)
|
||||||
|
|
||||||
|
configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in" "${GIT_DATA}/grabRef.cmake" @ONLY)
|
||||||
|
include("${GIT_DATA}/grabRef.cmake")
|
||||||
|
|
||||||
|
set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE)
|
||||||
|
set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
function(git_describe _var)
|
||||||
|
if(NOT GIT_FOUND)
|
||||||
|
find_package(Git QUIET)
|
||||||
|
endif()
|
||||||
|
get_git_head_revision(refspec hash)
|
||||||
|
if(NOT GIT_FOUND)
|
||||||
|
set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
if(NOT hash)
|
||||||
|
set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# TODO sanitize
|
||||||
|
#if((${ARGN}" MATCHES "&&") OR
|
||||||
|
# (ARGN MATCHES "||") OR
|
||||||
|
# (ARGN MATCHES "\\;"))
|
||||||
|
# message("Please report the following error to the project!")
|
||||||
|
# message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}")
|
||||||
|
#endif()
|
||||||
|
|
||||||
|
#message(STATUS "Arguments to execute_process: ${ARGN}")
|
||||||
|
|
||||||
|
execute_process(COMMAND "${GIT_EXECUTABLE}" describe ${hash} ${ARGN}
|
||||||
|
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||||
|
RESULT_VARIABLE res
|
||||||
|
OUTPUT_VARIABLE out
|
||||||
|
ERROR_QUIET
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
if(NOT res EQUAL 0)
|
||||||
|
set(out "${out}-${res}-NOTFOUND")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(${_var} "${out}" PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
function(git_get_exact_tag _var)
|
||||||
|
git_describe(out --exact-match ${ARGN})
|
||||||
|
set(${_var} "${out}" PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
24
GetGitRevisionDescription.cmake.in
Normal file
24
GetGitRevisionDescription.cmake.in
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#
|
||||||
|
# Internal file for GetGitRevisionDescription.cmake
|
||||||
|
#
|
||||||
|
# Requires CMake 2.6 or newer (uses the 'function' command)
|
||||||
|
#
|
||||||
|
# Original Author:
|
||||||
|
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
|
||||||
|
# http://academic.cleardefinition.com
|
||||||
|
# Iowa State University HCI Graduate Program/VRAC
|
||||||
|
#
|
||||||
|
# Copyright Iowa State University 2009-2010
|
||||||
|
# Distributed under the Boost Software License, Version 1.0.
|
||||||
|
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
# http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
|
file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024)
|
||||||
|
|
||||||
|
string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS)
|
||||||
|
string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}")
|
||||||
|
|
||||||
|
configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
|
||||||
|
|
||||||
|
file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
|
||||||
|
string(STRIP "${HEAD_HASH}" HEAD_HASH)
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
#! make
|
|
||||||
#
|
|
||||||
# Automatically generate PDF, PNG, and JPG files from DOT files.
|
|
||||||
#
|
|
||||||
# Original Author:
|
|
||||||
# 2009 Ryan Pavlik <rpavlik@iastate.edu>
|
|
||||||
# http://academic.cleardefinition.com
|
|
||||||
# Iowa State University HCI Graduate Program/VRAC
|
|
||||||
|
|
||||||
pdfs := $(patsubst %.dot,%.pdf,$(wildcard *.dot))
|
|
||||||
pngs := $(patsubst %.dot,%.png,$(wildcard *.dot))
|
|
||||||
jpgs := $(patsubst %.dot,%.jpg,$(wildcard *.dot))
|
|
||||||
|
|
||||||
all: $(pdfs) $(pngs) $(jpgs)
|
|
||||||
pdf: $(pdfs)
|
|
||||||
png: $(pngs)
|
|
||||||
jpg: $(jpgs)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
-rm -f $(pdfs) $(pngs) $(jpgs)
|
|
||||||
realclean: clean
|
|
||||||
-rm -f *~
|
|
||||||
|
|
||||||
.PHONY: all pdf png jpg clean realclean
|
|
||||||
|
|
||||||
$(pdfs): %.pdf: %.dot
|
|
||||||
dot -Tpdf $< -o$@
|
|
||||||
|
|
||||||
$(pngs): %.png: %.dot
|
|
||||||
dot -Tpng $< -o$@
|
|
||||||
|
|
||||||
$(jpgs): %.jpg: %.dot
|
|
||||||
dot -Tjpg $< -o$@
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user