Skip to content

Commit

Permalink
Squashed 'cmake/' changes from 1cc81cc..0875d12
Browse files Browse the repository at this point in the history
0875d12 FindSDL2: standardize indentation within the file.
75ba012 FindSDL2: Use MinGWSearchPathExtras if it's available and suitable.
66d7885 MinGW: build a list of prefixes too.
83f169b FindSDL2: sdlmain must come before sdl2.
6d639f6 Update list of dependencies in FindWinHID
2c5bec7 Update WinHID drastically to use FindWindowsSDK, so it can easily build against much newer SDKs/DDKs/WDKs.
2273ac4 Add two new functions to FindWindowsSDK
eded907 Fix quietness of finding windows SDK and add comment
3f5f7df Add a module to help find things on MinGW (specifically MSYS2).
c90ca93 Backported bugfixed version of WriteCompilerDetectionHeader.
6a941e5 ColibriApi: Module written for VRPN.
1dd3d89 Another flag in ExtraCompilerWarnings, to get GCC to stop whining about boost::optional.
90d1a89 Formatting fix in finddirectshow
8b37b27 Updated the InterSense finder to look in default install locations.
bd6a7ca Improvements to the WindowsSDK finder for newer win10 sdks and better handling of them.
58ed198 Add a minor tweak to the VRPN module
83a2091 Add a FindJsonCpp module I wrote for various OSVR projects.
faf198f Major improvements to FindSDL2 for Mac support. Thanks to David, aka @d235j for lots of help.
fe2273c Add GenerateCompatibilityVersionFile, for keeping your msvc from compiling against your android builds.
01d0c41 Major improvements to FindWindowsSDK and FindDirectShow
16a3a8c Add an upstream "FindGit" from CMake 3.2.0
6bc6a53 Fix up create dashboard scripts to use a shared Git location.

git-subtree-dir: cmake
git-subtree-split: 0875d124fd6f0a7b775227e1790f17dcf45a7ec6
  • Loading branch information
rpavlik committed Apr 26, 2016
1 parent 1662318 commit 2680388
Show file tree
Hide file tree
Showing 18 changed files with 2,406 additions and 284 deletions.
19 changes: 19 additions & 0 deletions CompatibilityVersionFile-BASIC.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# will always be the actual version one
# Wrapped in a macro because it's got a return before we want.
macro(_gcvf_version)
@GCVF_PREVIOUS_FILE@
endmacro()
_gcvf_version()


if(NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "@CMAKE_SYSTEM_NAME@")
set(PACKAGE_VERSION "${PACKAGE_VERSION} (@CMAKE_SYSTEM_NAME@)")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
return()
endif()

if(ANDROID AND NOT ("${ANDROID_ABI}" STREQUAL "@ANDROID_ABI@"))
set(PACKAGE_VERSION "${PACKAGE_VERSION} (Android @ANDROID_ABI@)")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
return()
endif()
29 changes: 29 additions & 0 deletions CompatibilityVersionFile-CXX_ABI.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
@GCVF_PREVIOUS_FILE@

if(MSVC)
if(NOT "${MSVC_VERSION}" STREQUAL "@MSVC_VERSION@")
set(PACKAGE_VERSION "${PACKAGE_VERSION} (@GCVF_WIN_CXXLAYOUT@)")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
return()
endif()
endif()

macro(_gcvf_compute_cxxabi _var _compilerid _compilerver)
set(${_var})
if("${_compilerid}" STREQUAL "GNU" AND NOT ("${_compilerver}" STREQUAL ""))
if("${_compilerver}" VER_LESS 5.0)
# This is pre-gcc5, not compatible with post-gcc5
set(${_var} "g++ < 5.0")
else()
set(${_var} "g++ >= 5.0")
endif()
endif()
endmacro()
_gcvr_compute_cxxabi(_installed_cxx "@CMAKE_CXX_COMPILER_ID@" "@CMAKE_CXX_COMPILER_VERSION@")
_gcvr_compute_cxxabi(_current_cxx "${CMAKE_CXX_COMPILER_ID}" "${CMAKE_CXX_COMPILER_VERSION}")

# if(NOT "${_installed_cxx}" STREQUAL "${_current_cxx}")
# set(PACKAGE_VERSION "${PACKAGE_VERSION} (${_installed_cxx})")
# set(PACKAGE_VERSION_UNSUITABLE TRUE)
# return()
# endif()
16 changes: 16 additions & 0 deletions CompatibilityVersionFile-CXX_LAYOUT.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@GCVF_PREVIOUS_FILE@

set(GCVF_WIN_CXXLAYOUT)
if(MSVC)
set(GCVF_WIN_CXXLAYOUT "MSVC")
elseif(MINGW)
set(GCVF_WIN_CXXLAYOUT "MinGW")
elseif(WIN32)
set(GCVF_WIN_CXXLAYOUT "other")
endif()

if(NOT "@GCVF_WIN_CXXLAYOUT@" STREQUAL "${GCVF_WIN_CXXLAYOUT}")
set(PACKAGE_VERSION "${PACKAGE_VERSION} (@GCVF_WIN_CXXLAYOUT@)")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
return()
endif()
16 changes: 16 additions & 0 deletions CompatibilityVersionFile-C_ABI.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@GCVF_PREVIOUS_FILE@

if(NOT ("${CMAKE_C_COMPILER_ABI}" STREQUAL "") AND NOT ("@CMAKE_C_COMPILER_ABI@" STREQUAL ""))
if(NOT "${CMAKE_C_COMPILER_ABI}" STREQUAL "@CMAKE_C_COMPILER_ABI@")
set(PACKAGE_VERSION "${PACKAGE_VERSION} (@CMAKE_C_COMPILER_ABI@)")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
return()
endif()
endif()

if(NOT "${CMAKE_C_COMPILER_TARGET}" STREQUAL "@CMAKE_C_COMPILER_TARGET@")
set(PACKAGE_VERSION "${PACKAGE_VERSION} (@CMAKE_C_COMPILER_TARGET@)")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
return()
endif()
# todo anything for a C ABI beyond just "basic"?
21 changes: 15 additions & 6 deletions CreateDashboardScripts.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
# Requires these CMake modules:
# GetCompilerInfoString
#
# Requires CMake 2.6 or newer (uses the 'function' command)
# Requires CMake 2.6 or newer (uses the 'function' command),
# as well as FindGit.cmake (included with 2.8.2, may be backported)
#
# Original Author:
# 2009-2010 Ryan Pavlik <[email protected]> <[email protected]>
Expand Down Expand Up @@ -118,13 +119,21 @@ if(NOT IN_DASHBOARD_SCRIPT)

if(NOT "1.${CMAKE_VERSION}" VERSION_LESS "1.2.8.0")
if(IS_DIRECTORY "${CMAKE_SOURCE_DIRECTORY}/.git")
find_program(DASHBOARDSCRIPT_GIT_EXECUTABLE NAMES git git.cmd)
if(DASHBOARDSCRIPT_GIT_EXECUTABLE)

if(NOT GIT_FOUND)
find_package(Git QUIET)
endif()
# If we have a valid git we found ourselves in older version of the module,
# let the regular FindGit module (since 2.8.2) know.
if(DASHBOARDSCRIPT_GIT_EXECUTABLE AND EXISTS "${DASHBOARDSCRIPT_GIT_EXECUTABLE}" AND NOT GIT_FOUND)
set(GIT_EXECUTABLE "${DASHBOARDSCRIPT_GIT_EXECUTABLE}" CACHE FILEPATH "Git executable" FORCE)
find_package(Git QUIET)
endif()
unset(DASHBOARDSCRIPT_GIT_EXECUTABLE)
unset(DASHBOARDSCRIPT_GIT_EXECUTABLE CACHE)
if(GIT_FOUND)
set(UPDATE_TYPE "git")
set(UPDATE_COMMAND "${DASHBOARDSCRIPT_GIT_EXECUTABLE}")
set(UPDATE_COMMAND "${GIT_EXECUTABLE}")
set(UPDATE_OPTIONS "")
mark_as_advanced(DASHBOARDSCRIPT_GIT_EXECUTABLE)
endif()
endif()
endif()
Expand Down
9 changes: 9 additions & 0 deletions EnableExtraCompilerWarnings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ macro(_enable_extra_compiler_warnings_flags)
set(_flags "${_flags} -Wextra")
endif()

if(SUPPORTS_WALL_FLAG)
# At least GCC includes -Wmaybe-uninitialized in -Wall, which
# unneccesarily whines about boost::optional (by it's nature
# it's a "maybe" warning - prone to noisy false-positives)
check_cxx_compiler_flag(-Wno-maybe-uninitialized SUPPORTS_WNO_MAYBE_UNINITIALIZED_FLAG)
if(SUPPORTS_WNO_MAYBE_UNINITIALIZED_FLAG)
set(_flags "${_flags} -Wno-maybe-uninitialized")
endif()
endif()
endif()
endmacro()

Expand Down
120 changes: 120 additions & 0 deletions FindColibriApi.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# - try to find Trivisio Colibri API library
#
# Cache Variables:
# COLIBRIAPI_LIBRARY
# COLIBRIAPI_INCLUDE_DIR
#
# Non-cache variables you might use in your CMakeLists.txt:
# COLIBRIAPI_FOUND
# COLIBRIAPI_SERVER_LIBRARIES - server libraries
# COLIBRIAPI_LIBRARIES - client libraries
# COLIBRIAPI_CLIENT_DEFINITIONS - definitions if you only use the client library
# COLIBRIAPI_DEFINITIONS - Client-only definition if all we found was the client library.
# COLIBRIAPI_INCLUDE_DIRS
#
# COLIBRIAPI_ROOT_DIR is searched preferentially for these files
#
# Requires these CMake modules:
# FindPackageHandleStandardArgs (known included with CMake >=2.6.2)
#
# Original Author:
# 2009-2012 Ryan Pavlik <[email protected]> <[email protected]>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2012.
# 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)

set(COLIBRIAPI_ROOT_DIR
"${COLIBRIAPI_ROOT_DIR}"
CACHE
PATH
"Root directory to search for Colibri API")

if("${CMAKE_SIZEOF_VOID_P}" MATCHES "8")
set(_libsuffixes lib64 lib)

# 64-bit dir: only set on win64
file(TO_CMAKE_PATH "$ENV{ProgramW6432}" _progfiles)
else()
set(_libsuffixes lib)
set(_PF86 "ProgramFiles(x86)")
if(NOT "$ENV{${_PF86}}" STREQUAL "")
# 32-bit dir: only set on win64
file(TO_CMAKE_PATH "$ENV{${_PF86}}" _progfiles)
else()
# 32-bit dir on win32, useless to us on win64
file(TO_CMAKE_PATH "$ENV{ProgramFiles}" _progfiles)
endif()
endif()

###
# Configure COLIBRIAPI
###

find_path(COLIBRIAPI_INCLUDE_DIR
NAMES
colibri_api.h
PATH_SUFFIXES
include
HINTS
"${COLIBRIAPI_ROOT_DIR}"
PATHS
"${_progfiles}/ColibriAPI 1.1.20140925 (64-bit)"
"$ENV{HOME}"
"$ENV{HOME}/ColibriAPI-1.1.20140710-Linux-amd64"
C:/usr/local
/usr/local)

find_library(COLIBRIAPI_LIBRARY
NAMES
colibri-api
PATH_SUFFIXES
${_libsuffixes}
HINTS
"${COLIBRIAPI_ROOT_DIR}"
PATHS
"${_progfiles}/ColibriAPI 1.1.20140925 (64-bit)"
"$ENV{HOME}"
"$ENV{HOME}/ColibriAPI-1.1.20140710-Linux-amd64"
C:/usr/local
/usr/local)

###
# Dependencies
###
set(_deps_libs)
set(_deps_includes)
set(_deps_check)

find_package(quatlib)
list(APPEND _deps_libs ${QUATLIB_LIBRARIES})
list(APPEND _deps_includes ${QUATLIB_INCLUDE_DIRS})
list(APPEND _deps_check QUATLIB_FOUND)

if(NOT WIN32)
find_package(Threads)
list(APPEND _deps_libs ${CMAKE_THREAD_LIBS_INIT})
list(APPEND _deps_check CMAKE_HAVE_THREADS_LIBRARY)
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(ColibriApi
DEFAULT_MSG
COLIBRIAPI_LIBRARY
COLIBRIAPI_INCLUDE_DIR
${_deps_check})

if(COLIBRIAPI_FOUND)
set(COLIBRIAPI_INCLUDE_DIRS "${COLIBRIAPI_INCLUDE_DIR}" ${_deps_includes})
set(COLIBRIAPI_LIBRARIES "${COLIBRIAPI_LIBRARY}" ${_deps_libs})

mark_as_advanced(COLIBRIAPI_ROOT_DIR)
endif()

mark_as_advanced(COLIBRIAPI_LIBRARY COLIBRIAPI_INCLUDE_DIR)
81 changes: 78 additions & 3 deletions FindDirectShow.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

set(_ds_quiet)
if(DirectShow_FIND_QUIETLY)
set(_ds_quiet QUIET)
set(_ds_quiet QUIET)
endif()
find_package(WindowsSDK ${_ds_quiet})
find_package(DirectX ${_ds_quiet})
Expand Down Expand Up @@ -71,24 +71,99 @@ find_path(DIRECTSHOW_WINDOWSSDK_INCLUDE_DIR
PATH_SUFFIXES
"Include")

###
# Begin code dedicated to finding a proper qedit.h file...
###

# Checks to see if a directory has qedit.h and if that file contains ISampleGrabber.
function(_directshow_check_qedit _dir _var)
set(fn "${_dir}/qedit.h")
if(NOT EXISTS "${fn}")
set(${_var} FALSE PARENT_SCOPE)
return()
endif()
file(STRINGS "${fn}" samplegrabber REGEX ISampleGrabber)
if(NOT samplegrabber)
set(${_var} FALSE PARENT_SCOPE)
return()
endif()
set(${_var} TRUE PARENT_SCOPE)
endfunction()

function(_directshow_check_current_qedit)
if(DIRECTSHOW_QEDIT_INCLUDE_DIR)
_directshow_check_qedit("${DIRECTSHOW_QEDIT_INCLUDE_DIR}" _ds_ok)
if(NOT _ds_ok)
message(STATUS "FindDirectShow: qedit.h in ${DIRECTSHOW_QEDIT_INCLUDE_DIR} lacks ISampleGrabber, unsetting DIRECTSHOW_QEDIT_INCLUDE_DIR")
set(DIRECTSHOW_QEDIT_INCLUDE_DIR "" CACHE PATH "" FORCE)
endif()
endif()
endfunction()

# Check before deciding if we should make our list of possible locations.
_directshow_check_current_qedit()

# Compose a list of possible directories that might hold a qedit.h file.
set(DIRECTSHOW_QEDIT_SEARCH)
if(WINDOWSSDK_FOUND AND NOT DIRECTSHOW_QEDIT_INCLUDE_DIR)
foreach(_sdk ${WINDOWSSDK_DIRS})
windowssdk_build_lookup("${_sdk}" _build)
if(_build AND ("${_build}" VERSION_LESS 6.2))
get_windowssdk_include_dirs("${_sdk}" _dirs)
if(_dirs)
list(APPEND DIRECTSHOW_QEDIT_SEARCH ${_dirs})
endif()
endif()
endforeach()
endif()

# This one we can grab from another SDK version.
find_path(DIRECTSHOW_QEDIT_INCLUDE_DIR
NAMES
qedit.h
HINTS
"${DIRECTSHOW_WINDOWSSDK_ROOT}"
PATHS
${WINDOWSSDK_DIRS}
${DIRECTSHOW_QEDIT_SEARCH}
PATH_SUFFIXES
"Include")

# Check if the directory is OK after the search.
_directshow_check_current_qedit()

# If we didn't find a proper qedit, manually look through the possibilities.
if(NOT DIRECTSHOW_QEDIT_INCLUDE_DIR)
foreach(_dir "${DIRECTSHOW_WINDOWSSDK_ROOT}/Include" ${DIRECTSHOW_QEDIT_SEARCH})
if(NOT DIRECTSHOW_QEDIT_INCLUDE_DIR)
_directshow_check_qedit("${_dir}" _ds_ok)
if(_ds_ok)
set(DIRECTSHOW_QEDIT_INCLUDE_DIR "${_dir}" CACHE PATH "" FORCE)
endif()
endif()
endforeach()
endif()

###
# End qedit.h section.
###

set(DIRECTSHOW_STRMIIDS_SEARCH)
if(WINDOWSSDK_FOUND AND NOT DIRECTSHOW_STRMIIDS_LIBRARY)
foreach(_sdk ${WINDOWSSDK_DIRS})
get_windowssdk_library_dirs("${_sdk}" _dirs)
message(STATUS "- ${_dirs}")
if(_dirs)
list(APPEND DIRECTSHOW_STRMIIDS_SEARCH ${_dirs})
endif()
endforeach()
endif()
find_library(DIRECTSHOW_STRMIIDS_LIBRARY
NAMES
strmiids
HINTS
"${DIRECTSHOW_WINDOWSSDK_ROOT}"
PATHS
${_acceptable_winsdk}
${DIRECTSHOW_STRMIIDS_SEARCH}
PATH_SUFFIXES
"Lib${DIRECTSHOW_LIB_SUBDIR}")

Expand Down
Loading

0 comments on commit 2680388

Please sign in to comment.