The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

cmake: Add missing modules

authored by

Ryan Pavlik and committed by
Jakob Bornecrantz
6b083146 1aff19e9

+169
+48
cmake/CleanDirectoryList.cmake
··· 1 + # - Removes duplicate entries and non-directories from a provided list 2 + # 3 + # clean_directory_list(<listvar> [<additional list items>...]) 4 + # 5 + # Requires CMake 2.6 or newer (uses the 'function' command) 6 + # 7 + # Original Author: 8 + # 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net> 9 + # http://academic.cleardefinition.com 10 + # Iowa State University HCI Graduate Program/VRAC 11 + # 12 + # Copyright Iowa State University 2009-2010. 13 + # Distributed under the Boost Software License, Version 1.0. 14 + # (See accompanying file LICENSE_1_0.txt or copy at 15 + # http://www.boost.org/LICENSE_1_0.txt) 16 + 17 + if(__clean_directory_list) 18 + return() 19 + endif() 20 + set(__clean_directory_list YES) 21 + 22 + function(clean_directory_list _var) 23 + # combine variable's current value with additional list items 24 + set(_in ${${_var}} ${ARGN}) 25 + 26 + if(_in) 27 + # Initial list cleaning 28 + list(REMOVE_DUPLICATES _in) 29 + 30 + # Grab the absolute path of each actual directory 31 + set(_out) 32 + foreach(_dir ${_in}) 33 + if(IS_DIRECTORY "${_dir}") 34 + get_filename_component(_dir "${_dir}" ABSOLUTE) 35 + file(TO_CMAKE_PATH "${_dir}" _dir) 36 + list(APPEND _out "${_dir}") 37 + endif() 38 + endforeach() 39 + 40 + if(_out) 41 + # Clean up the output list now 42 + list(REMOVE_DUPLICATES _out) 43 + endif() 44 + 45 + # return _out 46 + set(${_var} "${_out}" PARENT_SCOPE) 47 + endif() 48 + endfunction()
+36
cmake/PrefixListGlob.cmake
··· 1 + # - For each given prefix in a list, glob using the prefix+pattern 2 + # 3 + # 4 + # Original Author: 5 + # 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net> 6 + # http://academic.cleardefinition.com 7 + # Iowa State University HCI Graduate Program/VRAC 8 + # 9 + # Copyright Iowa State University 2009-2010. 10 + # Distributed under the Boost Software License, Version 1.0. 11 + # (See accompanying file LICENSE_1_0.txt or copy at 12 + # http://www.boost.org/LICENSE_1_0.txt) 13 + 14 + if(__prefix_list_glob) 15 + return() 16 + endif() 17 + set(__prefix_list_glob YES) 18 + 19 + function(prefix_list_glob var pattern) 20 + set(_out) 21 + set(_result) 22 + foreach(prefix ${ARGN}) 23 + file(GLOB _globbed ${prefix}${pattern}) 24 + if(_globbed) 25 + list(SORT _globbed) 26 + list(REVERSE _globbed) 27 + list(APPEND _out ${_globbed}) 28 + endif() 29 + endforeach() 30 + foreach(_name ${_out}) 31 + get_filename_component(_name "${_name}" ABSOLUTE) 32 + list(APPEND _result "${_name}") 33 + endforeach() 34 + 35 + set(${var} "${_result}" PARENT_SCOPE) 36 + endfunction()
+85
cmake/ProgramFilesGlob.cmake
··· 1 + # - Find bit-appropriate program files directories matching a given pattern 2 + # 3 + # Requires these CMake modules: 4 + # CleanDirectoryList 5 + # PrefixListGlob 6 + # 7 + # Original Author: 8 + # 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net> 9 + # http://academic.cleardefinition.com 10 + # Iowa State University HCI Graduate Program/VRAC 11 + # 12 + # Copyright Iowa State University 2009-2010. 13 + # Distributed under the Boost Software License, Version 1.0. 14 + # (See accompanying file LICENSE_1_0.txt or copy at 15 + # http://www.boost.org/LICENSE_1_0.txt) 16 + 17 + include(PrefixListGlob) 18 + include(CleanDirectoryList) 19 + 20 + if(__program_files_glob) 21 + return() 22 + endif() 23 + set(__program_files_glob YES) 24 + 25 + macro(_program_files_glob_var_prep) 26 + # caution - ENV{ProgramFiles} on Win64 is adjusted to point to the arch 27 + # of the running executable which, since CMake is 32-bit on Windows as 28 + # I write this, will always be = $ENV{ProgramFiles(x86)}. 29 + # Thus, we only use this environment variable if we are on a 32 machine 30 + 31 + # 32-bit dir on win32, useless to us on win64 32 + file(TO_CMAKE_PATH "$ENV{ProgramFiles}" _PROG_FILES) 33 + 34 + # 32-bit dir: only set on win64 35 + set(_PF86 "ProgramFiles(x86)") 36 + file(TO_CMAKE_PATH "$ENV{${_PF86}}" _PROG_FILES_X86) 37 + 38 + # 64-bit dir: only set on win64 39 + file(TO_CMAKE_PATH "$ENV{ProgramW6432}" _PROG_FILES_W6432) 40 + endmacro() 41 + 42 + function(program_files_glob var pattern) 43 + _program_files_glob_var_prep() 44 + if(CMAKE_SIZEOF_VOID_P MATCHES "8") 45 + # 64-bit build on win64 46 + set(_PROGFILESDIRS "${_PROG_FILES_W6432}") 47 + else() 48 + if(_PROG_FILES_W6432) 49 + # 32-bit build on win64 50 + set(_PROGFILESDIRS "${_PROG_FILES_X86}") 51 + else() 52 + # 32-bit build on win32 53 + set(_PROGFILESDIRS "${_PROG_FILES}") 54 + endif() 55 + endif() 56 + 57 + prefix_list_glob(_prefixed "${pattern}" ${_PROGFILESDIRS}) 58 + clean_directory_list(_prefixed) 59 + set(${var} ${_prefixed} PARENT_SCOPE) 60 + endfunction() 61 + 62 + function(program_files_fallback_glob var pattern) 63 + _program_files_glob_var_prep() 64 + if(CMAKE_SIZEOF_VOID_P MATCHES "8") 65 + # 64-bit build on win64 66 + # look in the "32 bit" (c:\program files (x86)\) directory as a 67 + # fallback in case of weird/poorly written installers, like those 68 + # that put both 64- and 32-bit libs in the same program files directory 69 + set(_PROGFILESDIRS "${_PROG_FILES_W6432}" "${_PROG_FILES_X86}") 70 + else() 71 + if(_PROG_FILES_W6432) 72 + # 32-bit build on win64 73 + # look in the "64 bit" (c:\program files\) directory as a fallback 74 + # in case of old/weird/poorly written installers 75 + set(_PROGFILESDIRS "${_PROG_FILES_X86}" "${_PROG_FILES_W6432}") 76 + else() 77 + # 32-bit build on win32 78 + set(_PROGFILESDIRS "${_PROG_FILES}") 79 + endif() 80 + endif() 81 + 82 + prefix_list_glob(_prefixed "${pattern}" ${_PROGFILESDIRS}) 83 + clean_directory_list(_prefixed) 84 + set(${var} ${_prefixed} PARENT_SCOPE) 85 + endfunction()