diff --git a/DoxygenTargets.cmake b/DoxygenTargets.cmake index 1643083..fab68d1 100644 --- a/DoxygenTargets.cmake +++ b/DoxygenTargets.cmake @@ -59,7 +59,86 @@ if(PDFLATEX_COMPILER) set(DOXYGEN_PDFLATEX "YES") 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) # parse arguments @@ -215,30 +294,15 @@ function(add_doxygen _doxyfile) if(INSTALL_DESTINATION) if(INSTALL_COMPONENT) - install(DIRECTORY - "${OUTPUT_DIRECTORY}/html" - DESTINATION - "${INSTALL_DESTINATION}" - COMPONENT - "${INSTALL_COMPONENT}" - OPTIONAL) + _dt_install_dir("${DOC_TARGET}" "${OUTPUT_DIRECTORY}/html" "${INSTALL_DESTINATION}" "${INSTALL_COMPONENT}") if(MAKE_PDF) - install(FILES "${OUTPUT_DIRECTORY}/latex/refman.pdf" - DESTINATION "${INSTALL_DESTINATION}" - COMPONENT "${INSTALL_COMPONENT}" - RENAME "${INSTALL_PDF_NAME}" - OPTIONAL) + _dt_install_file("${DOC_TARGET}" "${OUTPUT_DIRECTORY}/latex/refman.pdf" "${INSTALL_DESTINATION}" "${INSTALL_PDF_NAME}" "${INSTALL_COMPONENT}") endif() else() - install(DIRECTORY - "${OUTPUT_DIRECTORY}/html" - DESTINATION - "${INSTALL_DESTINATION}") + _dt_install_dir("${DOC_TARGET}" "${OUTPUT_DIRECTORY}/html" "${INSTALL_DESTINATION}") if(MAKE_PDF) - install(FILES "${OUTPUT_DIRECTORY}/latex/refman.pdf" - DESTINATION "${INSTALL_DESTINATION}" - RENAME "${INSTALL_PDF_NAME}") + _dt_install_file("${DOC_TARGET}" "${OUTPUT_DIRECTORY}/latex/refman.pdf" "${INSTALL_DESTINATION}" "${INSTALL_PDF_NAME}") endif() endif() endif() diff --git a/FindBluez.cmake b/FindBluez.cmake new file mode 100644 index 0000000..d783453 --- /dev/null +++ b/FindBluez.cmake @@ -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 +# 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) diff --git a/FindOpenCV.cmake b/FindOpenCV.cmake index f015d56..8acfef2 100644 --- a/FindOpenCV.cmake +++ b/FindOpenCV.cmake @@ -30,204 +30,212 @@ set(OPENCV_ROOT_DIR PATH "Path to search for OpenCV") -include(ProgramFilesGlob) +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) -# typical root dirs of installations, exactly one of them is used -program_files_glob(_dirs "/OpenCV*/") + # typical root dirs of installations, exactly one of them is used + program_files_glob(_dirs "/OpenCV*/") -# -# select exactly ONE OPENCV base directory/tree -# to avoid mixing different version headers and libs -# -find_path(OPENCV_BASE_DIR - NAMES - cv/include/cv.h - include/opencv/cv.h - include/cv/cv.h - include/cv.h - HINTS - "${OPENCV_ROOT_DIR}" - "$ENV{OPENCV_ROOT_DIR}" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Intel(R) Open Source Computer Vision Library_is1;Inno Setup: App Path]" - ${_dirs}) - - - - -# header include dir suffixes appended to OPENCV_BASE_DIR -set(OPENCV_INCDIR_SUFFIXES - include - include/cv - include/opencv - cv/include - cxcore/include - cvaux/include - otherlibs/cvcam/include - otherlibs/highgui - otherlibs/highgui/include - otherlibs/_graphics/include) - -# library linkdir suffixes appended to OPENCV_BASE_DIR -set(OPENCV_LIBDIR_SUFFIXES lib lib64 OpenCV/lib otherlibs/_graphics/lib) - - -# -# find incdir for each lib -# -find_path(OPENCV_cv_INCLUDE_DIR - NAMES - cv.h - HINTS - "${OPENCV_BASE_DIR}" - "${OPENCV_ROOT_DIR}" - PATH_SUFFIXES - ${OPENCV_INCDIR_SUFFIXES}) -find_path(OPENCV_cxcore_INCLUDE_DIR - NAMES - cxcore.h - HINTS - "${OPENCV_BASE_DIR}" - "${OPENCV_ROOT_DIR}" - PATH_SUFFIXES - ${OPENCV_INCDIR_SUFFIXES}) -find_path(OPENCV_cxcore_INCLUDE_DIR - NAMES - cvaux.h - HINTS - "${OPENCV_BASE_DIR}" - "${OPENCV_ROOT_DIR}" - PATH_SUFFIXES - ${OPENCV_INCDIR_SUFFIXES}) -find_path(OPENCV_highgui_INCLUDE_DIR - NAMES - highgui.h - HINTS - "${OPENCV_BASE_DIR}" - "${OPENCV_ROOT_DIR}" - PATH_SUFFIXES - ${OPENCV_INCDIR_SUFFIXES}) -find_path(OPENCV_cvcam_INCLUDE_DIR - NAMES - cvcam.h - HINTS - "${OPENCV_BASE_DIR}" - "${OPENCV_ROOT_DIR}" - PATH_SUFFIXES - ${OPENCV_INCDIR_SUFFIXES}) - -# -# find sbsolute path to all libraries -# some are optionally, some may not exist on Linux -# -find_library(OPENCV_legacy_LIBRARY - NAMES - opencv_legacy - HINTS - "${OPENCV_BASE_DIR}" - "${OPENCV_ROOT_DIR}" - PATH_SUFFIXES - ${OPENCV_LIBDIR_SUFFIXES}) - -set(OPENCV_NEW_COMPONENTS calib3d contrib core features2d highgui imgproc legacy ml objdetect video) -set(OPENCV_OLD_COMPONENTS cv cvaux cvcam cvhaartraining cxcore cxts highgui ml trs) -set(opencv_components) -if(OPENCV_NEW_LIBRARY_NAMES OR OPENCV_legacy_LIBRARY) - - # New-style library names - foreach(component ${OPENCV_NEW_COMPONENTS}) - find_library(OPENCV_${component}_LIBRARY + # + # select exactly ONE OPENCV base directory/tree + # to avoid mixing different version headers and libs + # + find_path(OPENCV_BASE_DIR NAMES - opencv_${component} + cv/include/cv.h + include/opencv/cv.h + include/cv/cv.h + include/cv.h HINTS - ${OPENCV_BASE_DIR} + "${OPENCV_ROOT_DIR}" + "$ENV{OPENCV_ROOT_DIR}" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Intel(R) Open Source Computer Vision Library_is1;Inno Setup: App Path]" + ${_dirs}) + + + + + # header include dir suffixes appended to OPENCV_BASE_DIR + set(OPENCV_INCDIR_SUFFIXES + include + include/cv + include/opencv + cv/include + cxcore/include + cvaux/include + otherlibs/cvcam/include + otherlibs/highgui + otherlibs/highgui/include + otherlibs/_graphics/include) + + # library linkdir suffixes appended to OPENCV_BASE_DIR + set(OPENCV_LIBDIR_SUFFIXES lib lib64 OpenCV/lib otherlibs/_graphics/lib) + + + # + # find incdir for each lib + # + find_path(OPENCV_cv_INCLUDE_DIR + NAMES + cv.h + HINTS + "${OPENCV_BASE_DIR}" + "${OPENCV_ROOT_DIR}" + PATH_SUFFIXES + ${OPENCV_INCDIR_SUFFIXES}) + find_path(OPENCV_cxcore_INCLUDE_DIR + NAMES + cxcore.h + HINTS + "${OPENCV_BASE_DIR}" + "${OPENCV_ROOT_DIR}" + PATH_SUFFIXES + ${OPENCV_INCDIR_SUFFIXES}) + find_path(OPENCV_cxcore_INCLUDE_DIR + NAMES + cvaux.h + HINTS + "${OPENCV_BASE_DIR}" + "${OPENCV_ROOT_DIR}" + PATH_SUFFIXES + ${OPENCV_INCDIR_SUFFIXES}) + find_path(OPENCV_highgui_INCLUDE_DIR + NAMES + highgui.h + HINTS + "${OPENCV_BASE_DIR}" + "${OPENCV_ROOT_DIR}" + PATH_SUFFIXES + ${OPENCV_INCDIR_SUFFIXES}) + find_path(OPENCV_cvcam_INCLUDE_DIR + NAMES + cvcam.h + HINTS + "${OPENCV_BASE_DIR}" + "${OPENCV_ROOT_DIR}" + PATH_SUFFIXES + ${OPENCV_INCDIR_SUFFIXES}) + + # + # find sbsolute path to all libraries + # some are optionally, some may not exist on Linux + # + find_library(OPENCV_legacy_LIBRARY + NAMES + opencv_legacy + HINTS + "${OPENCV_BASE_DIR}" + "${OPENCV_ROOT_DIR}" PATH_SUFFIXES ${OPENCV_LIBDIR_SUFFIXES}) - endforeach() - # cv components with header and library if COMPONENTS unspecified - if(NOT OpenCV_FIND_COMPONENTS) - # default - set(opencv_components core legacy imgproc highgui) - if(WIN32) - list(APPEND opencv_components video) # WIN32 only actually - endif() - else() - # TODO: clean up/convert to new components - string(TOLOWER "${OpenCV_FIND_COMPONENTS}" opencv_components) - endif() + set(OPENCV_NEW_COMPONENTS calib3d contrib core features2d highgui imgproc legacy ml objdetect video) + set(OPENCV_OLD_COMPONENTS cv cvaux cvcam cvhaartraining cxcore cxts highgui ml trs) + set(opencv_components) + if(OPENCV_NEW_LIBRARY_NAMES OR OPENCV_legacy_LIBRARY) -else() - # Old-style lib names - if(NOT OpenCV_FIND_COMPONENTS) - # default - set(opencv_components cv cxcore cvaux highgui) - if(WIN32) - list(APPEND opencv_components cvcam) # WIN32 only actually - endif() - else() - string(TOLOWER "${OpenCV_FIND_COMPONENTS}" opencv_components) - endif() - - foreach(component ${OPENCV_OLD_COMPONENTS}) - find_library(OPENCV_${component}_LIBRARY + # New-style library names + foreach(component ${OPENCV_NEW_COMPONENTS}) + find_library(OPENCV_${component}_LIBRARY NAMES - cvaux + opencv_${component} HINTS ${OPENCV_BASE_DIR} PATH_SUFFIXES ${OPENCV_LIBDIR_SUFFIXES}) - endforeach() -endif() + endforeach() -# -# Logic selecting required libs and headers -# + # cv components with header and library if COMPONENTS unspecified + if(NOT OpenCV_FIND_COMPONENTS) + # default + set(opencv_components core legacy imgproc highgui) + if(WIN32) + list(APPEND opencv_components video) # WIN32 only actually + endif() + else() + # TODO: clean up/convert to new components + string(TOLOWER "${OpenCV_FIND_COMPONENTS}" opencv_components) + endif() -set(_req_check) -set(_req_libs) -set(_req_includes) -foreach(component ${opencv_components}) - #message(STATUS "Component requested: ${component}") + else() + # Old-style lib names + if(NOT OpenCV_FIND_COMPONENTS) + # default + set(opencv_components cv cxcore cvaux highgui) + if(WIN32) + list(APPEND opencv_components cvcam) # WIN32 only actually + endif() + else() + string(TOLOWER "${OpenCV_FIND_COMPONENTS}" opencv_components) + endif() - # only good if header and library both found - list(APPEND - _req_check - OPENCV_${component}_LIBRARY) - list(APPEND _req_libs "${OPENCV_${component}_LIBRARY}") - if(DEFINED OPENCV_${component}_INCLUDE_DIR) - list(APPEND - _req_check - OPENCV_${component}_INCLUDE_DIR) - list(APPEND _req_includes "${OPENCV_${component}_INCLUDE_DIR}") + foreach(component ${OPENCV_OLD_COMPONENTS}) + find_library(OPENCV_${component}_LIBRARY + NAMES + ${component} + HINTS + ${OPENCV_BASE_DIR} + PATH_SUFFIXES + ${OPENCV_LIBDIR_SUFFIXES}) + endforeach() endif() + # + # Logic selecting required libs and headers + # -endforeach() + set(_req_check) + set(_req_libs) + set(_req_includes) + foreach(component ${opencv_components}) + #message(STATUS "Component requested: ${component}") + + # only good if header and library both found + list(APPEND + _req_check + OPENCV_${component}_LIBRARY) + list(APPEND _req_libs "${OPENCV_${component}_LIBRARY}") + if(DEFINED OPENCV_${component}_INCLUDE_DIR) + list(APPEND + _req_check + OPENCV_${component}_INCLUDE_DIR) + list(APPEND _req_includes "${OPENCV_${component}_INCLUDE_DIR}") + endif() -# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if -# all listed variables are TRUE -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(OpenCV - DEFAULT_MSG - OPENCV_cv_INCLUDE_DIR - ${_req_check}) -if(OPENCV_FOUND) - set(OPENCV_LIBRARY_DIRS) - foreach(lib ${_req_libs}) - get_filename_component(dir "${lib}" PATH) - list(APPEND OPENCV_LIBRARY_DIRS "${dir}") endforeach() - list(REVERSE OPENCV_LIBRARY_DIRS) - list(REMOVE_DUPLICATES OPENCV_LIBRARY_DIRS) - list(REVERSE OPENCV_LIBRARY_DIRS) - set(OPENCV_INCLUDE_DIRS ${_req_includes}) - set(OPENCV_LIBRARIES ${_req_libs}) - mark_as_advanced(OPENCV_ROOT_DIR) + # handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if + # all listed variables are TRUE + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(OpenCV + DEFAULT_MSG + OPENCV_cv_INCLUDE_DIR + ${_req_check}) + + if(OPENCV_FOUND) + set(OPENCV_LIBRARY_DIRS) + foreach(lib ${_req_libs}) + get_filename_component(dir "${lib}" PATH) + list(APPEND OPENCV_LIBRARY_DIRS "${dir}") + endforeach() + list(REVERSE OPENCV_LIBRARY_DIRS) + list(REMOVE_DUPLICATES OPENCV_LIBRARY_DIRS) + list(REVERSE OPENCV_LIBRARY_DIRS) + + set(OPENCV_INCLUDE_DIRS ${_req_includes}) + set(OPENCV_LIBRARIES ${_req_libs}) + mark_as_advanced(OPENCV_ROOT_DIR OpenCV_DIR) + endif() + + mark_as_advanced(OPENCV_BASE_DIR) + foreach(component ${OPENCV_NEW_COMPONENTS} ${OPENCV_OLD_COMPONENTS}) + mark_as_advanced(OPENCV_${component}_LIBRARY OPENCV_${component}_INCLUDE_DIR) + endforeach() endif() -mark_as_advanced(OPENCV_BASE_DIR) -foreach(component ${OPENCV_NEW_COMPONENTS} ${OPENCV_OLD_COMPONENTS}) - mark_as_advanced(OPENCV_${component}_LIBRARY OPENCV_${component}_INCLUDE_DIR) -endforeach() + diff --git a/FindWiiUse.cmake b/FindWiiUse.cmake index d906911..521b990 100644 --- a/FindWiiUse.cmake +++ b/FindWiiUse.cmake @@ -59,7 +59,15 @@ find_path(WIIUSE_INCLUDE_DIR set(_deps_check) 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}") get_filename_component(WIIUSE_RUNTIME_LIBRARY_DIRS "${WIIUSE_RUNTIME_LIBRARY}" diff --git a/FindWinHID.cmake b/FindWinHID.cmake new file mode 100644 index 0000000..af3e29a --- /dev/null +++ b/FindWinHID.cmake @@ -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 +# 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) diff --git a/GetGitRevisionDescription.cmake b/GetGitRevisionDescription.cmake new file mode 100644 index 0000000..57b4cd0 --- /dev/null +++ b/GetGitRevisionDescription.cmake @@ -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( [ ...]) +# +# Returns the refspec and sha hash of the current head revision +# +# 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( [ ...]) +# +# 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 +# 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() diff --git a/GetGitRevisionDescription.cmake.in b/GetGitRevisionDescription.cmake.in new file mode 100644 index 0000000..77cc6e0 --- /dev/null +++ b/GetGitRevisionDescription.cmake.in @@ -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 +# 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) diff --git a/module-docs/Makefile b/module-docs/Makefile deleted file mode 100644 index da3d218..0000000 --- a/module-docs/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -#! make -# -# Automatically generate PDF, PNG, and JPG files from DOT files. -# -# Original Author: -# 2009 Ryan Pavlik -# 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$@ -