diff --git a/CMakeLists.txt b/CMakeLists.txt index dc34c20ea..46d3784d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -270,7 +270,7 @@ if(USE_WIIUSE) if(WIIUSE_BUILD) add_subdirectory("${PROJECT_SOURCE_DIR}/lib/wiiuse") endif() - include_directories("${PROJECT_SOURCE_DIR}/lib/wiiuse") + include_directories("${PROJECT_SOURCE_DIR}/lib/wiiuse/src") endif() # Set include paths diff --git a/lib/wiiuse/.clang-format b/lib/wiiuse/.clang-format new file mode 100644 index 000000000..1e8502543 --- /dev/null +++ b/lib/wiiuse/.clang-format @@ -0,0 +1,94 @@ +--- +Language: Cpp +# BasedOnStyle: LLVM +AccessModifierOffset: -4 +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: true +AlignConsecutiveDeclarations: false +AlignEscapedNewlinesLeft: true +AlignOperands: true +AlignTrailingComments: true +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortBlocksOnASingleLine: true +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: All +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: false +BinPackArguments: true +BinPackParameters: true +BraceWrapping: + AfterClass: true + AfterControlStatement: true + AfterEnum: true + AfterFunction: true + AfterNamespace: true + AfterObjCDeclaration: true + AfterStruct: true + AfterUnion: true + BeforeCatch: false + BeforeElse: false + IndentBraces: false +BreakBeforeBinaryOperators: true +BreakBeforeBraces: Custom +BreakBeforeTernaryOperators: true +BreakConstructorInitializersBeforeComma: true +BreakAfterJavaFieldAnnotations: false +BreakStringLiterals: true +ColumnLimit: 110 +CommentPragmas: '^ IWYU pragma:' +ConstructorInitializerAllOnOneLineOrOnePerLine: true +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DerivePointerAlignment: false +DisableFormat: false +ExperimentalAutoDetectBinPacking: false +ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] +IncludeCategories: + - Regex: '^"(llvm|llvm-c|clang|clang-c)/' + Priority: 2 + - Regex: '^(<|"(gtest|isl|json)/)' + Priority: 3 + - Regex: '.*' + Priority: 1 +IncludeIsMainRegex: '$' +IndentCaseLabels: false +IndentWidth: 4 +IndentWrappedFunctionNames: false +JavaScriptQuotes: Leave +JavaScriptWrapImports: true +KeepEmptyLinesAtTheStartOfBlocks: true +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: None +ObjCBlockIndentWidth: 4 +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: true +PenaltyBreakBeforeFirstCallParameter: 19 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 60 +PointerAlignment: Right +ReflowComments: true +SortIncludes: false +SpaceAfterCStyleCast: false +SpaceBeforeAssignmentOperators: true +SpaceBeforeParens: ControlStatements +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 +SpacesInAngles: false +SpacesInContainerLiterals: true +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +Standard: Cpp11 +TabWidth: 8 +UseTab: Never +... diff --git a/lib/wiiuse/.gitignore b/lib/wiiuse/.gitignore new file mode 100644 index 000000000..837131d79 --- /dev/null +++ b/lib/wiiuse/.gitignore @@ -0,0 +1,2 @@ +build +.cquery_cached_index diff --git a/lib/wiiuse/.travis.yml b/lib/wiiuse/.travis.yml new file mode 100644 index 000000000..be275cc79 --- /dev/null +++ b/lib/wiiuse/.travis.yml @@ -0,0 +1,15 @@ +os: + - linux + - osx + +language: c + +compiler: + - clang + - gcc + +sudo: required +dist: trusty + +install: . scripts/ci/$TRAVIS_OS_NAME/install.sh +script: . scripts/ci/common/script.sh diff --git a/lib/wiiuse/CHANGELOG.mkd b/lib/wiiuse/CHANGELOG.mkd new file mode 100644 index 000000000..923aa9cb4 --- /dev/null +++ b/lib/wiiuse/CHANGELOG.mkd @@ -0,0 +1,482 @@ +WiiUse Changelog +================ + +De-facto official fork, located at + +Original project (0.12 and earlier): + +- +- Now-defunct web sites: + - wiiuse.net: + most recent archive from 2011 + + - wiiuse.sourceforge.net: + most recent archive from 2010 (looks identical on homepage to 2011 snapshot above) + + +v0.15.4 -- 28-Nov-2018 +-------------------- + +Fixed: + +- Windows build - verified to work on VS Community 2017 from fresh install. + +Changed: + +- Removed `WCONST` macro of questionable value - + it made some struct members "const" for consuming software, + but non-const within the library. + Made it too complex to maintain. + Shouldn't really affect usage (doesn't change layout, etc.), + but noted separately because it is technically a (very minor) API change. +- Removed broken links to old project web sites. + +v0.15.3 -- 25-Nov-2018 +-------------------- + +Fixed: + +- Fixed forgotten version number +- Fixed library installation prefix on 64bit systems + +v0.15.2 -- 25-Nov-2018 +-------------------- + +Fixed the L2CAP channel setup on Linux, now we use only the +interrupt/data channel (0x13) and not the control channel (0x11). This +finally fixes the RVL-CNT-01-TR (gen 2) Wiimote. The control channel +is still kept open, in case something needs it in the future. + +Cleaned the indentation by running the code through clang-format. + +v0.15.1 -- 20-Nov-2018 +-------------------- + +"Brown paper bag" release - missed some build-related pull requests +before tagging 0.15. + +v0.15 -- 20-Nov-2018 +-------------------- + +**Roll-up release of accumulated changes - library has been "stable" now +for some time** + +Added: + +- Callback API with constant-size wiimote_callback_data_t. + Added to more easily support a ctypes python binding, generated + by and included with RPythonic + Thanks to hartsantler for this feature. + +- Ability to build as a static library - must define WIIUSE_STATIC in + client app as well as choosing the appropriate option when building + WiiUse. The default is still a shared library (dll/so). Merged from + paulburton and added to build system. + +- Initial MotionPlus support. Thanks to admiral0 for the initial pull + request merging from fwiine, and to Jan Ciger Reviatech SAS for building + on it with fwiine and WiiC code as well as additional code. Try it out + in the example by pressing 1 to start and 2 to stop. + +- Full Mac support using Apple's native Bluetooth stack, based on [wiic](http://wiic.sourceforge.net/). + +Fixed: + +- Properly disable rumbling when told to. Thanks to Jeff Baker from + [Inv3rsion, LLC.](http://www.inv3rsion.com/) + +- Builds properly now on mingw (both cross-compile and native). + +- Improved reliability on Windows when running an app twice without dis-connecting + the Wiimote (came as a part of the MotionPlus support.) + +- Build system fixes. + +Changed: + +- Improved header includes using feedback from (include-what-you-use)[iwyu] + +- Additional internal function `wiiuse_millisleep()` to reduce the number + of `ifdef`s scattered through the code. + +- Provide endianness-conversion and buffer/unbuffer functions, rather than + a jumble of function-style macros and raw type punning. This should + fix all aliasing warnings. + +- Cleaned up README and CHANGELOG. + +- Migrated repo to its own organization on GitHUb. + +[iwyu]:http://code.google.com/p/include-what-you-use/ + +v0.14 -- 2 May 2011 +------------------- + +Added: + +- Support for redirecting or disabling messages: function + `wiiuse_set_output` in `wiiuse.h`. The preprocessor symbol + `WIIUSE_HAS_OUTPUT_REDIRECTION` indicates the presence of this feature. + Thanks to Johannes Zarl for this handy feature! + +- Doxyfile and "doc" target to the build system, to easily make use of + the documentation already in the code, along with doc cleanups and + improvements. (rp) + +- Added balance board code to example (Paul Burton, rp) + +Fixed: + +- Off-by-two overflow in IR dot ordering - thanks to Karl Semich (xloem on GitHub) + +- Documentation typo fix - thanks to Johannes Zarl + +- Check malloc results. (rp) + +- Initialize an array entirely. (rp) + +- Fixed reading of balance board data. (rp) + +Changed: + +- Cleaned up README. (rp) + +- Removed references to the LGPL/noncommercial license, since it's + confusing and not useful in a practical sense. See, e.g., + + +- Renamed bundled workaround stdint.h header for Visual Studio, which + we still have to use on MSVC 2010 for some unknown reason. (rp) + +v0.13.1 -- 11 November 2010 +--------------------------- + +Fixed: + +- Fix crashers due to unchecked pointer use. + +- [Windows] Fix crashers due to unchecked pointer use. + +v0.13 -- 11 November 2010 +------------------------- + +Added: + +- Support for Wii Balance Board ("wiiboard"): your code can + `#ifdef EXP_WII_BOARD` (support based in part on code from TU-Delft) + +- CMake-based cross-platform build system + +- Version defines in `wiiuse.h` + +Fixed: + +- [Linux] Bluez issue with not initializing structure on newer kernels + +- Use `stdint.h` types for guaranteed type size independent of platform + +- Bundle a suitable `stdint.h` for MSVC builds + +- Setting IR to off before handshake complete actually respected now. + (fix via Harald ) + +Changed: + +- Old makefiles and Visual Studio projects removed. + +- CMake allows easy building of binary packages with a uniform + directory structure: .dll/.exe in bin, .lib/.so in lib, .h in + include. + +v0.12 -- 2 Apr 2008 +------------------- + +Added: + +- API function `wiiuse_set_ir_sensitivity()` + +- Macro `WIIUSE_GET_IR_SENSITIVITY()` + +- Event type `WIIUSE_READ_DATA` + +- Event type `WIIUSE_UNEXPECTED_DISCONNECT` + +Fixed: + +- [Linux] Ability to try to `select()` nothing + +- [Linux] Changed Makefile to include debug output when compiling in debug mode + +Changed: + +- `wiiuse_set_nunchuk_orient_threshold()` now takes a`wiimote_t` pointer + +- `wiiuse_set_nunchuk_accel_threshold()` now takes a `wiimote_t` pointer + +- `wiiuse_read_data()` generates an event `WIIUSE_READ_DATA` rather than + executing a callback + +v0.11 -- 25 Feb 2008 +-------------------- + +Added: + +- API function `wiiuse_set_nunchuk_orient_threshold()` + +- API function `wiiuse_set_nunchuk_accel_threshold()` + +- Event type `WIIUSE_NUNCHUK_INSERTED` + +- Event type `WIIUSE_NUNCHUK_REMOVED` + +- Event type `WIIUSE_CLASSIC_CTRL_INSERTED` + +- Event type `WIIUSE_CLASSIC_CTRL_REMOVED` + +- Event type `WIIUSE_GUITAR_HERO_3_CTRL_INSERTED` + +- Event type `WIIUSE_GUITAR_HERO_3_CTRL_REMOVED` + +Fixed: + +- Added some missing function prototypes to wiiuse.h + +- [Linux] Fixed Makefile to link libmath and libbluetooth + +- Status event is set when a status report comes in + +- Orientation threshold not being saved in lstate + +v0.10 -- 11 Feb 2008 +-------------------- + +Added: + +- Real dynamic linking (by noisehole) + +- Changed from callback to SDL style + +- Guitar Hero 3 controller support + +- API function `wiiuse_set_accel_threshold()` + +- API function `wiiuse_version()` + +- Macro `WIIUSE_USING_SPEAKER()` + +- Macro `WIIUSE_IS_LED_SET(wm, num)` + +- `wiiuse_init()` now autogenerates unids + +- `orient_t::a_roll/a_pitch` + +- `wiiuse_resync()` + +- `wiiuse_cleanup()` + +- `wiiuse_set_timeout()` + +Fixed: + +- [Windows] Fixed bug where it did not detect expansions on startup + +- Renamed `INFO/WARNING/DEBUG` macros to `WIIUSE_*` (by noisehole) + +- Updated Makefiles (by noisehole) + +- Fixed incorrect roll/pitch when smoothing was enabled + +- Fixed nunchuk and classic controller flooding events when significant changes occurred + +- Fixed bug where IR was not correct on roll if IR was enabled before handshake + +Removed: + +- `wiiuse_startup()`, no longer needed + +v0.9 -- 3 Nov 2007 +------------------ + +Fixed: + +- Can now use `include/wiiuse.h` in C++ projects. + +- HOME button works again. + +- IR now functions after expansion is connected or removed. + +v0.8 -- 27 Oct 2007 +------------------- + +Changed: + +- Bumped API version to 8 + +- Exported all API functions for usage with non-C/C++ languages. + +- Changed event callback to only trigger if a significant state change + occurs. + +Added: + +- `wiimote_t::lstate` structure + +Fixed: + +- Bug 1820140 - Buffer overflow in `io_nix.c`. Thanks proppy. + +v0.7 -- 19 Oct 2007 +------------------- + +Changed: + +- Bumped API version to 7 + +- Renamed Linux build from `wii.so` to `wiiuse.so` + +- Changed version representation from float to const char*. + +Added: + +- [Windows] BlueSoleil support. + +- [Windows] Bluetooth stack auto-detection (WinXP SP2, Bluesoleil, + Widdcomm tested). + +- [Windows] API function `wiiuse_set_bluetooth_stack()`. + +- Calculates yaw if IR tracking is enabled. + +Fixed: + +- [Windows] Problem where a connection is made to a wiimote that does + not exist. + +- [Windows] Issue that occurred while using multiple wiimotes. + +v0.6 -- 16 Oct 2007 +------------------- + +Changed: + +- Bumped API version to 0.6. + +- Ported to Microsoft Windows. + +- Improved IR tracking. + +- Default IR virtual screen resolutions changed depending on 16:9 or 4:3. + +Added: + +- `src/msvc/` and `api/msvc/` - Microsoft Visual C++ 6.0 project files. + +v0.5 -- 13 Oct 2007 +------------------- + +Changed: + +- Bumped API version to 0.5. + +- Greatly improved IR tracking. + +- Renamed function `wiiuse_set_ir_correction()` to `wiiuse_set_ir_position()`. + +Added: + +- API function `wiiuse_set_aspect_ratio()` + +Fixed: + +- When rolling around 180 degree rotation smoothing would not be seemless. + +v0.4 -- 08 Oct 2007 +------------------- + +Changed: + +- Bumped API version to 0.4. + +- Greatly improved classic controller joystick functionality. + +- Changed all functions named `wiimote_*()` to `wiiuse_*()` + +- Renamed many macros from `WIIMOTE_*` to `WIIUSE_*` + +Added: + +- IR support + +- New `WIIMOTE_CONTINUOUS` flag to set continuous reporting + +- Macro `IS_JUST_PRESSED()` + +- Macro `WIIUSE_USING_ACC()` + +- Macro `WIIUSE_USING_EXP()` + +- Macro `WIIUSE_USING_IR()` + +- API function `wiiuse_set_ir()` + +- API function `wiiuse_set_ir_vres()` + +- API function `wiiuse_set_ir_correction()` + +- `gfx/` - A small OpenGL example that renders IR data + +Fixed: + +- Sometimes classic controller would only report infinite angle and magnitude for joysticks. + +v0.3 -- 10 Sept 2007 +-------------------- + +Changed: + +- Moved license to GPLv3. + +- Bumped API version to 0.3. + +Added: + +- Support for Classic Controller + +- Smoothing for roll and pitch values of the wiimote and nunchuk. + +- API: `wiimote_set_flags()` to set or disable wiimote options. + +- API: `wiimote_set_smooth_alpha()` to set smoothing alpha value. + +Fixed: + +- When the wiimote accelerates the roll or pitch is unreliable and was + set to 0. It now remains at previous tilt value. + +- If no event callback was specified then no events would be processed + internally. + +v0.2 -- 25 Aug 2007 +------------------- + +Changed: + +- Bumped API version to 0.2. + +Added: + +- Nunchuk support. + +- Ability to write to flash memory. + +Fixed: + +- Roll and pitch rotation now ranges from -180 to 180 degrees + (previously -90 to 90). + +- Bug when reading data from flash memory would read wrong address. + +v0.1 -- 23 Feb 2007 +------------------- + +- Initial release diff --git a/lib/wiiuse/CMakeLists.txt b/lib/wiiuse/CMakeLists.txt index 49fcd5278..293a48d75 100644 --- a/lib/wiiuse/CMakeLists.txt +++ b/lib/wiiuse/CMakeLists.txt @@ -1,86 +1,142 @@ -# CMakeLists.txt - wiiuse +# 2009-2011 Ryan Pavlik +# http://academic.cleardefinition.com/ +# Iowa State University HCI Graduate Program/VRAC -cmake_minimum_required(VERSION 2.8.1) +cmake_minimum_required(VERSION 2.8.0) -# libbluetooth is required on Unix platforms -if(UNIX AND (NOT APPLE)) - include(FindPkgConfig) - pkg_check_modules(BLUETOOTH bluez) - if(NOT BLUETOOTH_FOUND) - message(FATAL_ERROR "Bluetooth library not found. " - "Either install libbluetooth or disable wiiuse support with -DUSE_WIIUSE=0") - endif() +# Set package properties +project(WiiUse) + +### +# Set up options +### + +if(NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) + set(SUBPROJECT YES) endif() -set(WIIUSE_SOURCES - classic.c - dynamics.c - events.c - guitar_hero_3.c - io.c - ir.c - motion_plus.c - nunchuk.c - os_nix.c - os_win.c - util.c - wiiboard.c - wiiuse.c -) +include("./ParseVersion.cmake") +message(STATUS "Configuring WiiUse version ${CPACK_PACKAGE_VERSION}") -if(APPLE) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch x86_64") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch x86_64 -F/Library/Frameworks") - set(WIIUSE_SOURCES ${WIIUSE_SOURCES} - os_mac/os_mac_find.m - os_mac/os_mac_interface.m - os_mac/os_mac.m - ) +option(BUILD_EXAMPLE "Should we build the example app?" YES) +option(BUILD_EXAMPLE_SDL "Should we build the SDL-based example app?" YES) +option(BUILD_WIIUSE_SHARED_LIB "Should we build as a shared library (dll/so)?" YES) +option(INSTALL_EXAMPLES "Should we install the example apps?" YES) + +option(CPACK_MONOLITHIC_INSTALL "Only produce a single component installer, rather than multi-component." NO) + +### +# Perform build configuration of dependencies +### + +# Locally-developed modules dist'ed with this app - always have this first. +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +include(UseBackportedModules) +include(DoxygenTargets) + +if(BUILD_WIIUSE_SHARED_LIB) + set(WIIUSE_LIB_TYPE SHARED) +else() + set(WIIUSE_LIB_TYPE STATIC) + add_definitions(-DWIIUSE_STATIC) +endif() + +if(NOT WIN32 AND NOT APPLE) + set(LINUX YES) + find_package(Bluez REQUIRED) + include_directories(${BLUEZ_INCLUDE_DIRS}) + + include("GNUInstallDirs") +else() + set(LINUX NO) + set(CMAKE_INSTALL_LIBDIR "lib") endif() if(WIN32) - add_definitions("/DWIIUSE_STATIC") - add_library(wiiuse STATIC ${WIIUSE_SOURCES}) -else() - add_library(wiiuse ${WIIUSE_SOURCES}) + find_package(WinHID REQUIRED) + include_directories(${WINHID_INCLUDE_DIRS}) + if(MSVC) + # Minimum requirement is WinXP + add_definitions(-D_WIN32_WINNT=0x0501) + endif() endif() -if(MSVC) - if(MSVC90) - set(WIIUSE_VS_INCLUDE_DIR "C:\\Program\ Files\ (x86)\\Microsoft\ Visual\ Studio\ 9.0\\VC\\include" - CACHE STRING "VS 9.0 include directory, see lib/wiiuse/README for details") - elseif(MSVC10) - set(WIIUSE_VS_INCLUDE_DIR "C:\\Program\ Files\ (x86)\\Microsoft\ Visual\ Studio\ 10.0\\VC\\include" - CACHE STRING "VS 10.0 include directory, see lib/wiiuse/README for details") - endif() - mark_as_advanced(WIIUSE_VS_INCLUDE_DIR) - - if(MSVC90 OR MSVC10) - # VS 9 does not have the windows device driver kit - # So the driver must be installed additionally. Also, - # in order to avoid a compilation error, you have to - # specify the visual studio include path FIRST (google - # it, known issue). So in this case add appropriate - # variables that can be set. - set(WIIUSE_WINDDK_ROOT "C:/WinDDK" CACHE - STRING "Install directory of Windows Driver Kits") - mark_as_advanced(WIIUSE_WINDDK_ROOT) - include_directories(${WIIUSE_VS_INCLUDE_DIR} ${WIIUSE_WINDDK_ROOT}/inc/api) - endif() - add_library(setupapi.lib STATIC IMPORTED) - add_library(hid.lib STATIC IMPORTED) - set_target_properties(setupapi.lib PROPERTIES - IMPORTED_LOCATION ${WIIUSE_WINDDK_ROOT}/lib/win7/i386/setupapi.lib) - set_target_properties(hid.lib PROPERTIES - IMPORTED_LOCATION ${WIIUSE_WINDDK_ROOT}/lib/win7/i386/hid.lib) - # This doesn't work for me with VS 11, which apparently finds its own - # copy of the libs - if(MSVC90 OR MSVC10) - set_target_properties(wiiuse PROPERTIES STATIC_LIBRARY_FLAGS - "${WIIUSE_WINDDK_ROOT}/lib/win7/i386/setupapi.lib ${WIIUSE_WINDDK_ROOT}/lib/win7/i386/hid.lib") - else() - set_target_properties(wiiuse PROPERTIES STATIC_LIBRARY_FLAGS "setupapi.lib hid.lib") - endif() -elseif(MINGW) - target_link_libraries(wiiuse hid setupapi) -endif() \ No newline at end of file +### +# Build the project +### + +# The lib is in the "src" subdirectory +add_subdirectory(src) + +if(NOT SUBPROJECT) + # Example apps + if(BUILD_EXAMPLE) + add_subdirectory(example) + endif() + + if(BUILD_EXAMPLE_SDL) + add_subdirectory(example-sdl) + endif() +endif() + +if(SUBPROJECT) + set(WIIUSE_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src" PARENT_SCOPE) + set(WIIUSE_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src" PARENT_SCOPE) + set(WIIUSE_LIBRARY wiiuse PARENT_SCOPE) + set(WIIUSE_LIBRARIES wiiuse PARENT_SCOPE) + set(WIIUSE_FOUND ON PARENT_SCOPE) +endif() + +if(NOT SUBPROJECT) +### +# Set packaging options (for CPack) +### + + if(WIN32) + set(DOC_DIR .) + else() + set(DOC_DIR share/doc/wiiuse) + endif() + + # Documentation + add_doxygen(Doxyfile + INSTALL_DESTINATION ${DOC_DIR} + INSTALL_COMPONENT docs + NO_PDF) + + install(FILES + CHANGELOG.mkd + LICENSE + README.mkd + DESTINATION ${DOC_DIR} COMPONENT docs) + + if(INSTALL_EXAMPLES) + install(FILES example/example.c + DESTINATION ${DOC_DIR}/example COMPONENT examples) + install(FILES example-sdl/sdl.c + DESTINATION ${DOC_DIR}/example-sdl COMPONENT examples) + endif() + + set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") + set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.mkd") + + include(GetCompilerInfoString) + get_compiler_info_string(_compiler) + + set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${CPACK_PACKAGE_VERSION}-${_compiler}") + + # Include the packaging system now that we have it all set up + include(CPack) + + cpack_add_component(docs HIDDEN) + + cpack_add_component(development + DISPLAY_NAME "Development Files") + + cpack_add_component(examples + DISPLAY_NAME "Examples") + + cpack_add_component(runtime + DISPLAY_NAME "Runtime Library" + REQUIRED) +endif() diff --git a/lib/wiiuse/Doxyfile b/lib/wiiuse/Doxyfile new file mode 100644 index 000000000..29a6de0d0 --- /dev/null +++ b/lib/wiiuse/Doxyfile @@ -0,0 +1,1691 @@ +# Doxyfile 1.7.3 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# http://www.gnu.org/software/libiconv for the list of possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = WiiUse + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer +# a quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = + +# With the PROJECT_LOGO tag one can specify an logo or icon that is +# included in the documentation. The maximum height of the logo should not +# exceed 55 pixels and the maximum width should not exceed 200 pixels. +# Doxygen will copy the logo to the output directory. + +PROJECT_LOGO = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = docs-generated/ + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = YES + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, +# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English +# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, +# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, +# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = NO + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = NO + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = NO + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = src/ + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful if your file system +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = YES + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = YES + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for +# Java. For instance, namespaces will be presented as packages, qualified +# scopes will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources only. Doxygen will then generate output that is more tailored for +# Fortran. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for +# VHDL. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given extension. +# Doxygen has a built-in mapping, but you can override or extend it using this +# tag. The format is ext=language, where ext is a file extension, and language +# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, +# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make +# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C +# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions +# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also makes the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. +# Doxygen will parse them like normal C++ but will assume all classes use public +# instead of private inheritance when no explicit protection keyword is present. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate getter +# and setter methods for a property. Setting this option to YES (the default) +# will make doxygen replace the get and set methods by a property in the +# documentation. This will only work if the methods are indeed getting or +# setting a simple type. If this is not the case, or you want to show the +# methods anyway, you should set this option to NO. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum +# is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. + +TYPEDEF_HIDES_STRUCT = YES + +# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to +# determine which symbols to keep in memory and which to flush to disk. +# When the cache is full, less often used symbols will be written to disk. +# For small to medium size projects (<1000 input files) the default value is +# probably good enough. For larger projects a too small cache size can cause +# doxygen to be busy swapping symbols to and from disk most of the time +# causing a significant performance penalty. +# If the system has enough physical memory increasing the cache will improve the +# performance by keeping more symbols in memory. Note that the value works on +# a logarithmic scale so increasing the size by one will roughly double the +# memory usage. The cache size is given by this formula: +# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols + +SYMBOL_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base +# name of the file that contains the anonymous namespace. By default +# anonymous namespaces are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = YES + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = NO + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = YES + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen +# will list include files with double quotes in the documentation +# rather than with sharp brackets. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen +# will sort the (brief and detailed) documentation of class members so that +# constructors and destructors are listed first. If set to NO (the default) +# the constructors will appear in the respective orders defined by +# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. +# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO +# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the +# hierarchy of group names into alphabetical order. If set to NO (the default) +# the group names will appear in their defined order. + +SORT_GROUP_NAMES = YES + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to +# do proper type resolution of all parameters of a function it will reject a +# match between the prototype and the implementation of a member function even +# if there is only one candidate or it is obvious which candidate to choose +# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen +# will still accept a match between prototype and implementation in such cases. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or macro consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and macros in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. The default is NO. + +SHOW_DIRECTORIES = NO + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. +# This will remove the Files entry from the Quick Index and from the +# Folder Tree View (if specified). The default is YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the +# Namespaces page. This will remove the Namespaces entry from the Quick Index +# and from the Folder Tree View (if specified). The default is YES. + +SHOW_NAMESPACES = NO + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. The create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. +# You can optionally specify a file name after the option, if omitted +# DoxygenLayout.xml will be used as the name of the layout file. + +LAYOUT_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# The WARN_NO_PARAMDOC option can be enabled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = src + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is +# also the default input encoding. Doxygen uses libiconv (or the iconv built +# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh +# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py +# *.f90 *.f *.for *.vhd *.vhdl + +FILE_PATTERNS = + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = NO + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = src/wiiuse_msvcstdint.h + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = * + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty or if +# non of the patterns match the file name, INPUT_FILTER is applied. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) +# and it is also possible to disable source filtering for a specific pattern +# using *.ext= (so without naming a filter). This option only has effect when +# FILTER_SOURCE_FILES is enabled. + +FILTER_SOURCE_PATTERNS = + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = YES + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = NO + +# If the REFERENCED_BY_RELATION tag is set to YES +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = YES + +# If the REFERENCES_RELATION tag is set to YES +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = YES + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. Otherwise they will link to the documentation. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. +# Doxygen will adjust the colors in the stylesheet and background images +# according to this color. Hue is specified as an angle on a colorwheel, +# see http://en.wikipedia.org/wiki/Hue for more information. +# For instance the value 0 represents red, 60 is yellow, 120 is green, +# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. +# The allowed range is 0 to 359. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of +# the colors in the HTML output. For a value of 0 the output will use +# grayscales only. A value of 255 will produce the most vivid colors. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to +# the luminance component of the colors in the HTML output. Values below +# 100 gradually make the output lighter, whereas values above 100 make +# the output darker. The value divided by 100 is the actual gamma applied, +# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, +# and 100 does not change the gamma. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting +# this to NO can help when comparing the output of multiple runs. + +HTML_TIMESTAMP = YES + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. For this to work a browser that supports +# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox +# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). + +HTML_DYNAMIC_SECTIONS = YES + +# If the GENERATE_DOCSET tag is set to YES, additional index files +# will be generated that can be used as input for Apple's Xcode 3 +# integrated development environment, introduced with OSX 10.5 (Leopard). +# To create a documentation set, doxygen will generate a Makefile in the +# HTML output directory. Running make will produce the docset in that +# directory and running "make install" will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find +# it at startup. +# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. + +GENERATE_DOCSET = NO + +# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the +# feed. A documentation feed provides an umbrella under which multiple +# documentation sets from a single provider (such as a company or product suite) +# can be grouped. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that +# should uniquely identify the documentation set bundle. This should be a +# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen +# will append .docset to the name. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING +# is used to encode HtmlHelp index (hhk), content (hhc) and project file +# content. + +CHM_INDEX_ENCODING = + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated +# that can be used as input for Qt's qhelpgenerator to generate a +# Qt Compressed Help (.qch) of the generated HTML documentation. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can +# be used to specify the file name of the resulting .qch file. +# The path specified is relative to the HTML output folder. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#namespace + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#virtual-folders + +QHP_VIRTUAL_FOLDER = doc + +# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to +# add. For more information please see +# http://doc.trolltech.com/qthelpproject.html#custom-filters + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see +# +# Qt Help Project / Custom Filters. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's +# filter section matches. +# +# Qt Help Project / Filter Attributes. + +QHP_SECT_FILTER_ATTRS = + +# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can +# be used to specify the location of Qt's qhelpgenerator. +# If non-empty doxygen will try to run qhelpgenerator on the generated +# .qhp file. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files +# will be generated, which together with the HTML files, form an Eclipse help +# plugin. To install this plugin and make it available under the help contents +# menu in Eclipse, the contents of the directory containing the HTML and XML +# files needs to be copied into the plugins directory of eclipse. The name of +# the directory within the plugins directory should be the same as +# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before +# the help appears. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have +# this name. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [0,1..20]) +# that doxygen will group on one line in the generated HTML documentation. +# Note that a value of 0 will completely suppress the enum values from +# appearing in the overview section. + +ENUM_VALUES_PER_LINE = 4 + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. +# If the tag value is set to YES, a side panel will be generated +# containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). +# Windows users are probably better off using the HTML help feature. + +GENERATE_TREEVIEW = YES + +# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, +# and Class Hierarchy pages using a tree view instead of an ordered list. + +USE_INLINE_TREES = NO + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open +# links to external symbols imported via tag files in a separate window. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of Latex formulas included +# as images in the HTML documentation. The default is 10. Note that +# when you change the font size after a successful doxygen run you need +# to manually remove any form_*.png images from the HTML output directory +# to force them to be regenerated. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are +# not supported properly for IE 6.0, but are supported on all modern browsers. +# Note that when changing this option you need to delete any form_*.png files +# in the HTML output before the changes have effect. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax +# (see http://www.mathjax.org) which uses client side Javascript for the +# rendering instead of using prerendered bitmaps. Use this if you do not +# have LaTeX installed or if you want to formulas look prettier in the HTML +# output. When enabled you also need to install MathJax separately and +# configure the path to it using the MATHJAX_RELPATH option. + +USE_MATHJAX = NO + +# When MathJax is enabled you need to specify the location relative to the +# HTML output directory using the MATHJAX_RELPATH option. The destination +# directory should contain the MathJax.js script. For instance, if the mathjax +# directory is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to the +# mathjax.org site, so you can quickly see the result without installing +# MathJax, but it is strongly recommended to install a local copy of MathJax +# before deployment. + +MATHJAX_RELPATH = http://www.mathjax.org/mathjax + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box +# for the HTML output. The underlying search engine uses javascript +# and DHTML and should work on any modern browser. Note that when using +# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets +# (GENERATE_DOCSET) there is already a search function so this one should +# typically be disabled. For large projects the javascript based search engine +# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. + +SEARCHENGINE = YES + +# When the SERVER_BASED_SEARCH tag is enabled the search engine will be +# implemented using a PHP enabled web server instead of at the web client +# using Javascript. Doxygen will generate the search PHP script and index +# file to put on the web server. The advantage of the server +# based approach is that it scales better to large projects and allows +# full text search. The disadvantages are that it is more difficult to setup +# and does not have live searching capabilities. + +SERVER_BASED_SEARCH = NO + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = YES + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. +# Note that when enabling USE_PDFLATEX this option is only used for +# generating bitmaps for formulas in the HTML output, but not in the +# Makefile that is written to the output directory. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = YES + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = letter + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = YES + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = YES + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = YES + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +# If LATEX_SOURCE_CODE is set to YES then doxygen will include +# source code with syntax highlighting in the LaTeX output. +# Note that which sources are shown also depends on other settings +# such as SOURCE_BROWSER. + +LATEX_SOURCE_CODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = YES + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = YES + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. This is useful +# if you want to understand what is going on. On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = WIIUSE_WIN32 \ + WIIUSE_BLUEZ \ + WIIUSE_PLATFORM \ + WIIUSE_DOXYGEN_PARSING + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition that +# overrules the definition found in the source code. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all references to function-like macros +# that are alone on a line, have an all uppercase name, and do not end with a +# semicolon, because these will confuse the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option also works with HAVE_DOT disabled, but it is recommended to +# install and use dot, since it yields more powerful graphs. + +CLASS_DIAGRAMS = YES + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see +# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the +# documentation. The MSCGEN_PATH tag allows you to specify the directory where +# the mscgen tool resides. If left empty the tool is assumed to be found in the +# default search path. + +MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = YES + +# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is +# allowed to run in parallel. When set to 0 (the default) doxygen will +# base this on the number of processors available in the system. You can set it +# explicitly to a value larger than 0 to get control over the balance +# between CPU load and processing speed. + +DOT_NUM_THREADS = 0 + +# By default doxygen will write a font called Helvetica to the output +# directory and reference it in all dot files that doxygen generates. +# When you want a differently looking font you can specify the font name +# using DOT_FONTNAME. You need to make sure dot is able to find the font, +# which can be done by putting it in a standard location or by setting the +# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory +# containing the font. + +DOT_FONTNAME = FreeSans + +# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. +# The default size is 10pt. + +DOT_FONTSIZE = 10 + +# By default doxygen will tell dot to use the output directory to look for the +# FreeSans.ttf font (which doxygen will put there itself). If you specify a +# different font using DOT_FONTNAME you can set the path where dot +# can find it using this tag. + +DOT_FONTPATH = + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT options are set to YES then +# doxygen will generate a call dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable call graphs +# for selected functions only using the \callgraph command. + +CALL_GRAPH = YES + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then +# doxygen will generate a caller dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable caller +# graphs for selected functions only using the \callergraph command. + +CALLER_GRAPH = YES + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will generate a graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, svg, gif or svg. +# If left blank png will be used. + +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MSCFILE_DIRS tag can be used to specify one or more directories that +# contain msc files that are included in the documentation (see the +# \mscfile command). + +MSCFILE_DIRS = + +# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the +# number of direct children of the root node in a graph is already larger than +# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + +DOT_GRAPH_MAX_NODES = 50 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, because dot on Windows does not +# seem to support this out of the box. Warning: Depending on the platform used, +# enabling this option may lead to badly anti-aliased labels on the edges of +# a graph (i.e. they become hard to read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = YES + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES diff --git a/lib/wiiuse/LICENSE b/lib/wiiuse/LICENSE new file mode 100644 index 000000000..85b8e5992 --- /dev/null +++ b/lib/wiiuse/LICENSE @@ -0,0 +1,620 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + diff --git a/lib/wiiuse/ParseVersion.cmake b/lib/wiiuse/ParseVersion.cmake new file mode 100644 index 000000000..96873cc35 --- /dev/null +++ b/lib/wiiuse/ParseVersion.cmake @@ -0,0 +1,28 @@ +set(_version_file "${CMAKE_CURRENT_SOURCE_DIR}/src/wiiuse.h") +if(EXISTS "${_version_file}") + file(READ "${_version_file}" _version_contents) +endif() + +if("${_version_contents}" MATCHES "WIIUSE_MAJOR ([0-9]+)") + set(CPACK_PACKAGE_VERSION_MAJOR "${CMAKE_MATCH_1}") +else() + set(CPACK_PACKAGE_VERSION_MAJOR "0") + message("Could not parse major version from wiiuse.h") +endif() + +if("${_version_contents}" MATCHES "WIIUSE_MINOR ([0-9]+)") + set(CPACK_PACKAGE_VERSION_MINOR "${CMAKE_MATCH_1}") +else() + set(CPACK_PACKAGE_VERSION_MINOR "13") + message("Could not parse minor version from wiiuse.h") +endif() + +if("${_version_contents}" MATCHES "WIIUSE_MICRO ([0-9]+)") + set(CPACK_PACKAGE_VERSION_MICRO "${CMAKE_MATCH_1}") +else() + set(CPACK_PACKAGE_VERSION_MICRO "0") + message("Could not parse micro version from wiiuse.h") +endif() + +set(CPACK_PACKAGE_VERSION + "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_MICRO}") \ No newline at end of file diff --git a/lib/wiiuse/README b/lib/wiiuse/README deleted file mode 100644 index a08368e42..000000000 --- a/lib/wiiuse/README +++ /dev/null @@ -1,18 +0,0 @@ -Windows -======= -Compiling the wiiuse library requires installation of -the windows driver development kit (DDT). -While the wiiuse project is part of the windows STK solution, -it is not compiled by default, instead the lib is -linked from the dependency package (and output of the -wiiuse project is in the dependency directory as well). -Reason is that compiling this lib needs two hardcoded -paths to be set, which are not portable (see properties -of the wiiuse project, then Configuration, C/C++, -General: Additional Include Directories): -first the standard VS include path (!!), THEN the -include path for the windows DDK. Without those -settings in this order wiiuse can not be compiled -(known problems when compiling ddk code with -Visual Studio - google it). Also the path to the ddk -must be set as additional library directory. diff --git a/lib/wiiuse/README.mkd b/lib/wiiuse/README.mkd new file mode 100644 index 000000000..b7c818069 --- /dev/null +++ b/lib/wiiuse/README.mkd @@ -0,0 +1,301 @@ +# WiiUse README + +Semi-Official Fork, located at + +Issue/bug tracker: + +Mailing list: - just email to subscribe. See + for archives and + for more information. + +Changelog: + +[![Build Status](https://travis-ci.com/wiiuse/wiiuse.svg?branch=master)](https://travis-ci.com/wiiuse/wiiuse/master) + +**NOTE**: This library sees little change not because it is dead, +but because it is effectively "complete". +That being said, if you think there are changes that it could use, +and are willing to step up to assist with maintenance, +please file an issue. + +## About + +Wiiuse is a library written in C that connects with several Nintendo +Wii remotes. Supports motion sensing, IR tracking, nunchuk, classic +controller, Balance Board, and the Guitar Hero 3 controller. Single +threaded and nonblocking makes a light weight and clean API. + +Distributed under the GPL 3+. + +This is a friendly fork, prompted by apparent non-maintained status +of upstream project but proliferation of ad-hoc forks without +project infrastructure. Balance board support has been merged from +[TU-Delft][1] cross-referenced with other similar implementations in +embedded forks of WiiUse in other applications. Additional community +contributions have since been merged. Hopefully GitHub will help the +community maintain this project more seamlessly now. + +Patches and improvements are greatly appreciated - the easiest way +to submit them is to fork the repository on GitHub and make the +changes, then submit a pull request. The "fork and edit this file" +button on the web interface should make this even simpler. + +[1]: http://graphics.tudelft.nl/Projects/WiiBalanceBoard + +## Authors + +Mostly-absentee (but delegating!) Fork Maintainer: Ryan Pavlik or + +Original Author: Michael Laforest < para > < thepara (--AT--) g m a i l [--DOT--] com > + +Additional Contributors: + +- Jan Ciger - Reviatech SAS (effective co-maintainer) +- dhewg +- Christopher Sawczuk @ TU-Delft (initial Balance Board support) +- Paul Burton +- Karl Semich +- Johannes Zarl +- hartsantler +- admiral0 and fwiine project +- Jeff Baker/Inv3rsion, LLC. +- Gabriele Randelli and the WiiC project +- Juan Sebastian Casallas +- Lysann Schlegel +- Franklin Ta +- Thomas Geissl +- Mattes D +- Chadwick Boulay +- Florian Baumgartl + +## License + +> This program is free software: you can redistribute it and/or modify +> it under the terms of the GNU General Public License as published by +> the Free Software Foundation, either version 3 of the License, or +> (at your option) any later version. +> +> This program is distributed in the hope that it will be useful, +> but WITHOUT ANY WARRANTY; without even the implied warranty of +> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +> GNU General Public License for more details. +> +> You should have received a copy of the GNU General Public License +> along with this program. If not, see . + +## Audience + +This project is intended for developers who wish to include support +for the Nintendo Wii remote with their third party application. + +## Supported Hardware + +### Official Nintendo controllers: + +- Wiimotes: + - Gen 1.0 - Original Wiimote without Motion Plus (Bluetooth name: RVL-CNT-01) + - Gen 1.5 - Same as gen 1 but has integrated Motion Plus (Bluetooth name: RVL-CNT-01) + - Gen 2.0 - New Wiimote (since about 2011), has integrated Motion + Plus and different firmware (Bluetooth name: RVL-CNT-01-TR) + +- Wii Balance Board (Bluetooth name: RVL-WBC-01) + +- Expansions: + - Nunchuk + - Classic controller + - Guitar controller + - Motion Plus dongle (for the gen 1 Wiimote) + +### Clones and 3rdparty devices + +3rdparty controllers (wiimotes, nunchuks etc.) may or may not work - +some manufacturers take major liberties with the protocols so it is +impossible to guarantee functionality. However, most will probably +just work. + + +## Platforms and Dependencies + +Wiiuse currently operates on Linux, Windows and Mac. You will need: + +### For Linux + +- The kernel must support Bluetooth +- The BlueZ Bluetooth drivers must be installed +- If compiling, you'll need the BlueZ dev files (Debian/Ubuntu package + `libbluetooth-dev`) + +### For Windows + +- Bluetooth driver (tested with Microsoft's stack with Windows XP SP2 thru Windows 10) + +### For Mac + +- Mac OS X 10.2 or newer (to have the Mac OS X Bluetooth protocol stack) + +### For all platforms + +- If compiling, [CMake](http://cmake.org) is needed to generate a makefile/project + +## Compiling + +You need SDL and OpenGL installed to compile the (optional) SDL example. + +### Linux & Mac + + mkdir build + cd build + ccmake .. [-DCMAKE_INSTALL_PREFIX=/usr/local] [-DCMAKE_BUILD_TYPE=Release] [-DBUILD_EXAMPLE_SDL=NO] + +OR + + cmake-gui .. + make [target] + +If `target` is omitted then everything is compiled. + +Where `target` can be any of the following: + +- *wiiuse* - Compiles `libwiiuse.so` +- *wiiuseexample* - Compiles `wiiuse-example` +- *wiiuseexample-sdl* - Compiles `wiiuse-sdl` +- *doc* - Generates doxygen-based API documentation in HTML and PDF + format in `docs-generated` + +For a system-wide install, become root (or run with `sudo`) and: + + make install + +- `libwiiuse.so` is installed to `CMAKE_INSTALL_PREFIX/lib` +- `wiiuse-example` and `wiiuse-sdl` are installed to `CMAKE_INSTALL_PREFIX/bin` + +### Windows + +The CMake GUI can be used to generate a Visual Studio solution. + +You may need to install the Windows SDK (in recent versions) or +DDK (driver development kit - for old Windows SDK only) to compile +wiiuse. + +With Visual Studio Community 2017, this is very easy to build now: +if you have chosen to install the "desktop C++" tools, +you'll automatically have what you need. + +## Using the Library + +To use the library in your own program you must first compile wiiuse as +a module. Include `include/wiiuse.h` in any file that uses wiiuse. + +For Linux you must link `libwiiuse.so` ( `-lwiiuse` ). For Windows you +must link `wiiuse.lib`. When your program runs it will need +`wiiuse.dll`. + +## Known Issues + +On Windows using more than one wiimote (usually more than two wiimotes) +may cause significant latency. + +If you are going to use Motion+, make sure to call `wiiuse_poll` or `wiiuse_update` +in a loop for some 10-15 seconds before enabling it. Ideally you should be checking +the status of any expansion (nunchuk) you may have connected as well. +Otherwise the extra expansion may not initialize correctly - the initialization +and calibration takes some time. + +### Mac OS X + +Wiiuse can only connect to a device if it is in discoverable mode. Enable discoverable +mode by pressing the button on the inside of the battery cover. + +Wiiuse may not be able to connect to the device if it has been paired to the +operating system. Unpair it by opening Bluetooth Preferences (Apple > System +Preferences > Bluetooth), selecting the device (e.g., "Nintendo RVL-CNT-01"), and +pressing the X next to the device (alternatively: right-click and select "Remove"). It is +not enough to simply disconnect it. + +Enable discoverable mode and try again. + +## Acknowledgements by Michael Laforest (Original Author) + + + +> This site and their users have contributed an immense amount of +> information about the wiimote and its technical details. I could +> not have written this program without the vast amounts of +> reverse engineered information that was researched by them. + +Nintendo + +> Of course Nintendo for designing and manufacturing the Wii and Wii remote. + +BlueZ + +> Easy and intuitive Bluetooth stack for Linux. + +Thanks to Brent for letting me borrow his Guitar Hero 3 controller. + +## Known Forks/Derivative Versions + +The last "old upstream" version of WiiUse was 0.12. A number of projects +forked or embedded that version or earlier, making their own improvements. +A (probably incomplete) list follows, split between those whose improvements +are completed integrated into this new mainline version, and those whose +improvements have not yet been ported/merged into this version. An eventual +goal is to integrate all appropriate improvements (under the GPL 3+) back +into this mainline community-maintained "master fork" - contributions are +greatly appreciated. + +### Forks that have been fully integrated + +- [TU Delft's version with Balance Board support](http://graphics.tudelft.nl/Projects/WiiBalanceBoard) + - Added balance board support only. + - Integrated into mainline 0.13. + +### Forks not yet fully integrated + +- [libogc/WPAD/DevKitPro](http://wiibrew.org/wiki/Libogc) + - Started before the disappearance of the original upstream + - Focused on Wiimote use with Wii hardware + - Functions renamed, copyright statements removed + - Additional functionality unknown? + - git-svn mirror found here: +- [fwiine](http://sourceforge.net/projects/fwiine/files/wiiuse/0.13/) + - Created an 0.13 version with some very preliminary MotionPlus support. + - Integrated into branch `fwiine-motionplus`, not yet merged pending + alternate MotionPlus merge from WiiC by Jan Ciger. +- [DolphinEmu](https://github.com/dolphin-emu/dolphin) + - used to have a WiiUse fork labeled version 0.13.0 (no relation to 0.13 in this current project) + - Embedded, converted to C++, drastically changed over time, + mostly unrecognizable, and then removed before 3.0. + - Added Mac support. + - Added code to handle finding and pairing wiimotes on windows. + - A mostly intact version is here: + + - Last code state before removal is here: + + - Their new replacement is +- [paulburton on github](https://github.com/paulburton/wiiuse) + - Added balance board support - skipped in favor of the TU Delft version. + - Added static library support - not yet added to the mainline. +- [KzMz on github)](https://github.com/KzMz/wiiuse_fork) + - Started work on speaker support. +- [WiiC](https://github.com/grandelli/WiiC) + - Dramatically changed, C++ API added. + - MotionPlus support added. + - Added Mac support. + +## Other Links + +- Thread about MotionPlus: +- Possible alternative using the Linux kernel support for the Wiimote + and the standard Linux input system: + +Original project (0.12 and earlier): + +- +- Now-defunct web sites: + - wiiuse.net: + most recent archive from 2011 + + - wiiuse.sourceforge.net: + most recent archive from 2010 (looks identical on homepage to 2011 snapshot above) + diff --git a/lib/wiiuse/RELEASE.md b/lib/wiiuse/RELEASE.md new file mode 100644 index 000000000..4332d809d --- /dev/null +++ b/lib/wiiuse/RELEASE.md @@ -0,0 +1,8 @@ +# Release Checklist + +This project unfortunately has a several-step release process, +and it's easy to miss one of the steps. + +- Update `CHANGELOG.mkd` +- Ensure contributor list in `README.mkd` is accurate/up to date. +- Bump version in wiiuse.h diff --git a/lib/wiiuse/classic.c b/lib/wiiuse/classic.c deleted file mode 100644 index eea8ffc7f..000000000 --- a/lib/wiiuse/classic.c +++ /dev/null @@ -1,175 +0,0 @@ -/* - * wiiuse - * - * Written By: - * Michael Laforest < para > - * Email: < thepara (--AT--) g m a i l [--DOT--] com > - * - * Copyright 2006-2007 - * - * This file is part of wiiuse. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * $Header$ - * - */ - -/** - * @file - * @brief Classic controller expansion device. - */ - -#include "classic.h" -#include "dynamics.h" /* for calc_joystick_state */ -#include "events.h" /* for handshake_expansion */ - -#include /* for malloc */ -#include /* for memset */ - -static void classic_ctrl_pressed_buttons(struct classic_ctrl_t* cc, short now); - -/** - * @brief Handle the handshake data from the classic controller. - * - * @param cc A pointer to a classic_ctrl_t structure. - * @param data The data read in from the device. - * @param len The length of the data block, in bytes. - * - * @return Returns 1 if handshake was successful, 0 if not. - */ -#define HANDSHAKE_BYTES_USED 12 -int classic_ctrl_handshake(struct wiimote_t* wm, struct classic_ctrl_t* cc, byte* data, unsigned short len) { - - cc->btns = 0; - cc->btns_held = 0; - cc->btns_released = 0; - cc->r_shoulder = 0; - cc->l_shoulder = 0; - - if (data[0] == 0xFF || len < HANDSHAKE_BYTES_USED) { - /* - * Sometimes the data returned here is not correct. - * This might happen because the wiimote is lagging - * behind our initialization sequence. - * To fix this just request the handshake again. - * - * Other times it's just the first 16 bytes are 0xFF, - * but since the next 16 bytes are the same, just use - * those. - */ - if (len < 17 || len < HANDSHAKE_BYTES_USED + 16 || data[16] == 0xFF) { - /* get the calibration data */ - byte* handshake_buf = (byte *)malloc(EXP_HANDSHAKE_LEN * sizeof(byte)); - - WIIUSE_DEBUG("Classic controller handshake appears invalid, trying again."); - wiiuse_read_data_cb(wm, handshake_expansion, handshake_buf, WM_EXP_MEM_CALIBR, EXP_HANDSHAKE_LEN); - - return 0; - } else { - data += 16; - } - } - - - /* joystick stuff */ - cc->ljs.max.x = data[0] / 4; - cc->ljs.min.x = data[1] / 4; - cc->ljs.center.x = data[2] / 4; - cc->ljs.max.y = data[3] / 4; - cc->ljs.min.y = data[4] / 4; - cc->ljs.center.y = data[5] / 4; - - cc->rjs.max.x = data[6] / 8; - cc->rjs.min.x = data[7] / 8; - cc->rjs.center.x = data[8] / 8; - cc->rjs.max.y = data[9] / 8; - cc->rjs.min.y = data[10] / 8; - cc->rjs.center.y = data[11] / 8; - - /* handshake done */ - wm->exp.type = EXP_CLASSIC; - -#ifdef WIIUSE_WIN32 - wm->timeout = WIIMOTE_DEFAULT_TIMEOUT; -#endif - - return 1; -} - - -/** - * @brief The classic controller disconnected. - * - * @param cc A pointer to a classic_ctrl_t structure. - */ -void classic_ctrl_disconnected(struct classic_ctrl_t* cc) { - memset(cc, 0, sizeof(struct classic_ctrl_t)); -} - - - -/** - * @brief Handle classic controller event. - * - * @param cc A pointer to a classic_ctrl_t structure. - * @param msg The message specified in the event packet. - */ -void classic_ctrl_event(struct classic_ctrl_t* cc, byte* msg) { - int lx, ly, rx, ry; - byte l, r; - - classic_ctrl_pressed_buttons(cc, from_big_endian_uint16_t(msg + 4)); - - /* left/right buttons */ - l = (((msg[2] & 0x60) >> 2) | ((msg[3] & 0xE0) >> 5)); - r = (msg[3] & 0x1F); - - /* - * TODO - LR range hardcoded from 0x00 to 0x1F. - * This is probably in the calibration somewhere. - */ - cc->r_shoulder = ((float)r / 0x1F); - cc->l_shoulder = ((float)l / 0x1F); - - /* calculate joystick orientation */ - lx = (msg[0] & 0x3F); - ly = (msg[1] & 0x3F); - rx = ((msg[0] & 0xC0) >> 3) | ((msg[1] & 0xC0) >> 5) | ((msg[2] & 0x80) >> 7); - ry = (msg[2] & 0x1F); - - calc_joystick_state(&cc->ljs, (float)lx, (float)ly); - calc_joystick_state(&cc->rjs, (float)rx, (float)ry); -} - - -/** - * @brief Find what buttons are pressed. - * - * @param cc A pointer to a classic_ctrl_t structure. - * @param msg The message byte specified in the event packet. - */ -static void classic_ctrl_pressed_buttons(struct classic_ctrl_t* cc, short now) { - /* message is inverted (0 is active, 1 is inactive) */ - now = ~now & CLASSIC_CTRL_BUTTON_ALL; - - /* pressed now & were pressed, then held */ - cc->btns_held = (now & cc->btns); - - /* were pressed or were held & not pressed now, then released */ - cc->btns_released = ((cc->btns | cc->btns_held) & ~now); - - /* buttons pressed now */ - cc->btns = now; -} diff --git a/lib/wiiuse/cmake/.gitattributes b/lib/wiiuse/cmake/.gitattributes new file mode 100644 index 000000000..c20db92e9 --- /dev/null +++ b/lib/wiiuse/cmake/.gitattributes @@ -0,0 +1,10 @@ +# Auto detect text files and perform LF normalization +* text=auto + +*.sh text eol=lf + +# cmake launcher templates +*.sh.in text eol=lf +*.cmd.in text eol=crlf +*vcproj.user.in text eol=crlf +*vcxproj.user.in text eol=crlf diff --git a/lib/wiiuse/cmake/AboutTheseModules.cmake b/lib/wiiuse/cmake/AboutTheseModules.cmake new file mode 100644 index 000000000..72082b1cf --- /dev/null +++ b/lib/wiiuse/cmake/AboutTheseModules.cmake @@ -0,0 +1,34 @@ +# - Dummy module containing information about these modules for the HELP file +# This file documents a snapshot of the cmake-modules available from +# http://github.com/rpavlik/cmake-modules/ +# The latest version of these modules can always be found there. +# Additionally, you can find instructions on how to integrate these modules +# into your own project either in the README.markdown file in this directory, +# or on the GitHub page listed above (scroll to the bottom to see the README +# rendered attractively). +# +# In short: Modules of the form "FindSomeName.cmake" are considered to be +# "find modules", and are intended to be used indirectly by calling find_package, +# not by calling include. Thus, you'll want to do something like: +# find_package(SomeName) +# They define a number of variables allowing you to use whatever software +# they search for, such as include directories and libraries. A few also +# define some functions for your use. +# +# All other modules provide functionality, either immediately upon including +# them, or by defining functions that perform some task of varying utility +# that you can use any time after including them. Note that if a module +# has the filename, for example, cmake/BoostTestTargets.cmake, you only +# need to call: +# include(BoostTestTargets) +# +# For more information, see the documentation for individual modules, the +# cmake-modules github page, and/or the upstream CMake documentation at +# http://www.cmake.org/cmake/help/cmake-2-8-docs.html +# +# +# 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) + diff --git a/lib/wiiuse/cmake/BoostTestTargets.cmake b/lib/wiiuse/cmake/BoostTestTargets.cmake new file mode 100644 index 000000000..31b3ae677 --- /dev/null +++ b/lib/wiiuse/cmake/BoostTestTargets.cmake @@ -0,0 +1,258 @@ +# - Add tests using boost::test +# +# Add this line to your test files in place of including a basic boost test header: +# #include +# +# If you cannot do that and must use the included form for a given test, +# include the line +# // OVERRIDE_BOOST_TEST_INCLUDED_WARNING +# in the same file with the boost test include. +# +# include(BoostTestTargets) +# add_boost_test( SOURCES [] +# [FAIL_REGULAR_EXPRESSION ] +# [LAUNCHER ] +# [LIBRARIES [...]] +# [RESOURCES [...]] +# [TESTS [...]]) +# +# If for some reason you need access to the executable target created, +# it can be found in ${${testdriver_name}_TARGET_NAME} as specified when +# you called add_boost_test +# +# Requires CMake 2.6 or newer (uses the 'function' command) +# +# Requires: +# GetForceIncludeDefinitions +# CopyResourcesToBuildTree +# +# 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(__add_boost_test) + return() +endif() +set(__add_boost_test YES) + +set(BOOST_TEST_TARGET_PREFIX "boosttest") + +if(NOT Boost_FOUND) + find_package(Boost 1.34.0 QUIET) +endif() +if("${Boost_VERSION}0" LESS "1034000") + set(_shared_msg + "NOTE: boost::test-based targets and tests cannot " + "be added: boost >= 1.34.0 required but not found. " + "(found: '${Boost_VERSION}'; want >=103400) ") + if(BUILD_TESTING) + message(FATAL_ERROR + ${_shared_msg} + "You may disable BUILD_TESTING to continue without the " + "tests.") + else() + message(STATUS + ${_shared_msg} + "BUILD_TESTING disabled, so continuing anyway.") + endif() +endif() + +include(GetForceIncludeDefinitions) +include(CopyResourcesToBuildTree) + +if(Boost_FOUND AND NOT "${Boost_VERSION}0" LESS "1034000") + set(_boosttesttargets_libs) + set(_boostConfig "BoostTestTargetsIncluded.h") + if(NOT Boost_UNIT_TEST_FRAMEWORK_LIBRARY) + find_package(Boost 1.34.0 QUIET COMPONENTS unit_test_framework) + endif() + if(Boost_UNIT_TEST_FRAMEWORK_LIBRARY) + set(_boosttesttargets_libs "${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}") + if(Boost_USE_STATIC_LIBS) + set(_boostConfig "BoostTestTargetsStatic.h") + else() + if(NOT APPLE) + set(_boostConfig "BoostTestTargetsDynamic.h") + endif() + endif() + endif() + get_filename_component(_moddir ${CMAKE_CURRENT_LIST_FILE} PATH) + configure_file("${_moddir}/${_boostConfig}" + "${CMAKE_CURRENT_BINARY_DIR}/BoostTestTargetConfig.h" + COPYONLY) + include_directories("${CMAKE_CURRENT_BINARY_DIR}") +endif() + +function(add_boost_test _name) + if(NOT BUILD_TESTING) + return() + endif() + + # parse arguments + set(_nowhere) + set(_curdest _nowhere) + set(_val_args + SOURCES + FAIL_REGULAR_EXPRESSION + LAUNCHER + LIBRARIES + RESOURCES + TESTS) + set(_bool_args + USE_COMPILED_LIBRARY) + foreach(_arg ${_val_args} ${_bool_args}) + set(${_arg}) + endforeach() + foreach(_element ${ARGN}) + list(FIND _val_args "${_element}" _val_arg_find) + list(FIND _bool_args "${_element}" _bool_arg_find) + if("${_val_arg_find}" GREATER "-1") + set(_curdest "${_element}") + elseif("${_bool_arg_find}" GREATER "-1") + set("${_element}" ON) + set(_curdest _nowhere) + else() + list(APPEND ${_curdest} "${_element}") + endif() + endforeach() + + if(_nowhere) + message(FATAL_ERROR "Syntax error in use of add_boost_test!") + endif() + + if(NOT SOURCES) + message(FATAL_ERROR + "Syntax error in use of add_boost_test: at least one source file required!") + endif() + + if(Boost_FOUND AND NOT "${Boost_VERSION}0" LESS "1034000") + + include_directories(${Boost_INCLUDE_DIRS}) + + set(includeType) + foreach(src ${SOURCES}) + file(READ ${src} thefile) + if("${thefile}" MATCHES ".*BoostTestTargetConfig.h.*") + set(includeType CONFIGURED) + set(includeFileLoc ${src}) + break() + elseif("${thefile}" MATCHES ".*boost/test/included/unit_test.hpp.*") + set(includeType INCLUDED) + set(includeFileLoc ${src}) + set(_boosttesttargets_libs) # clear this out - linking would be a bad idea + if(NOT + "${thefile}" + MATCHES + ".*OVERRIDE_BOOST_TEST_INCLUDED_WARNING.*") + message("Please replace the include line in ${src} with this alternate include line instead:") + message(" \#include ") + message("Once you've saved your changes, re-run CMake. (See BoostTestTargets.cmake for more info)") + endif() + break() + endif() + endforeach() + + if(NOT _boostTestTargetsNagged${_name} STREQUAL "${includeType}") + if("${includeType}" STREQUAL "CONFIGURED") + message(STATUS + "Test '${_name}' uses the CMake-configurable form of the boost test framework - congrats! (Including File: ${includeFileLoc})") + elseif("${includeType}" STREQUAL "INCLUDED") + message("In test '${_name}': ${includeFileLoc} uses the 'included' form of the boost unit test framework.") + else() + message("In test '${_name}': Didn't detect the CMake-configurable boost test include.") + message("Please replace your existing boost test include in that test with the following:") + message(" \#include ") + message("Once you've saved your changes, re-run CMake. (See BoostTestTargets.cmake for more info)") + endif() + endif() + set(_boostTestTargetsNagged${_name} + "${includeType}" + CACHE + INTERNAL + "" + FORCE) + + + if(RESOURCES) + list(APPEND SOURCES ${RESOURCES}) + endif() + + # Generate a unique target name, using the relative binary dir + # and provided name. (transform all / into _ and remove all other + # non-alphabet characters) + file(RELATIVE_PATH + targetpath + "${CMAKE_BINARY_DIR}" + "${CMAKE_CURRENT_BINARY_DIR}") + string(REGEX REPLACE "[^A-Za-z/_]" "" targetpath "${targetpath}") + string(REPLACE "/" "_" targetpath "${targetpath}") + + set(_target_name ${BOOST_TEST_TARGET_PREFIX}-${targetpath}-${_name}) + set(${_name}_TARGET_NAME "${_target_name}" PARENT_SCOPE) + + # Build the test. + add_executable(${_target_name} ${SOURCES}) + + list(APPEND LIBRARIES ${_boosttesttargets_libs}) + + if(LIBRARIES) + target_link_libraries(${_target_name} ${LIBRARIES}) + endif() + + if(RESOURCES) + set_property(TARGET ${_target_name} PROPERTY RESOURCE ${RESOURCES}) + copy_resources_to_build_tree(${_target_name}) + endif() + + if(NOT Boost_TEST_FLAGS) +# set(Boost_TEST_FLAGS --catch_system_error=yes --output_format=XML) + set(Boost_TEST_FLAGS --catch_system_error=yes) + endif() + + # TODO: Figure out why only recent boost handles individual test running properly + + if(LAUNCHER) + set(_test_command ${LAUNCHER} "\$") + else() + set(_test_command ${_target_name}) + endif() + + if(TESTS AND ( "${Boost_VERSION}" VERSION_GREATER "103799" )) + foreach(_test ${TESTS}) + add_test( + ${_name}-${_test} + ${_test_command} --run_test=${_test} ${Boost_TEST_FLAGS} + ) + if(FAIL_REGULAR_EXPRESSION) + set_tests_properties(${_name}-${_test} + PROPERTIES + FAIL_REGULAR_EXPRESSION + "${FAIL_REGULAR_EXPRESSION}") + endif() + endforeach() + else() + add_test( + ${_name}-boost_test + ${_test_command} ${Boost_TEST_FLAGS} + ) + if(FAIL_REGULAR_EXPRESSION) + set_tests_properties(${_name}-boost_test + PROPERTIES + FAIL_REGULAR_EXPRESSION + "${FAIL_REGULAR_EXPRESSION}") + endif() + endif() + + # CppCheck the test if we can. + if(COMMAND add_cppcheck) + add_cppcheck(${_target_name} STYLE UNUSED_FUNCTIONS) + endif() + + endif() +endfunction() diff --git a/lib/wiiuse/cmake/BoostTestTargetsDynamic.h b/lib/wiiuse/cmake/BoostTestTargetsDynamic.h new file mode 100644 index 000000000..ae1f38e74 --- /dev/null +++ b/lib/wiiuse/cmake/BoostTestTargetsDynamic.h @@ -0,0 +1,9 @@ +// Small header computed by CMake to set up boost test. +// include AFTER #define BOOST_TEST_MODULE whatever +// but before any other boost test includes. + +// Using the Boost UTF dynamic library + +#define BOOST_TEST_DYN_LINK +#include + diff --git a/lib/wiiuse/cmake/BoostTestTargetsIncluded.h b/lib/wiiuse/cmake/BoostTestTargetsIncluded.h new file mode 100644 index 000000000..253133ce2 --- /dev/null +++ b/lib/wiiuse/cmake/BoostTestTargetsIncluded.h @@ -0,0 +1,7 @@ +// Small header computed by CMake to set up boost test. +// include AFTER #define BOOST_TEST_MODULE whatever +// but before any other boost test includes. + +// Using the Boost UTF included framework + +#include diff --git a/lib/wiiuse/cmake/BoostTestTargetsStatic.h b/lib/wiiuse/cmake/BoostTestTargetsStatic.h new file mode 100644 index 000000000..dd3cddae1 --- /dev/null +++ b/lib/wiiuse/cmake/BoostTestTargetsStatic.h @@ -0,0 +1,7 @@ +// Small header computed by CMake to set up boost test. +// include AFTER #define BOOST_TEST_MODULE whatever +// but before any other boost test includes. + +// Using the Boost UTF static library + +#include diff --git a/lib/wiiuse/cmake/BundleOSGPlugins.cmake b/lib/wiiuse/cmake/BundleOSGPlugins.cmake new file mode 100644 index 000000000..ef491d877 --- /dev/null +++ b/lib/wiiuse/cmake/BundleOSGPlugins.cmake @@ -0,0 +1,95 @@ +# - Provide access to the OpenSceneGraph runtime files for bundling in +# an installation or package. +# +# Sets these variables: +# - OSGDB_PLUGINS_RELEASE +# - OSGDB_PLUGINS_DEBUG +# - OSGWRAPPER_PLUGINS_RELEASE +# - OSGWRAPPER_PLUGINS_DEBUG +# - OSG_RUNTIME_LIBRARY_DIR +# - OSG_PATH_TO_PLUGINS +# +# Creates this function: +# - install_osg_plugins( {varNameForOutputFilenames} ) +# +# Requires these CMake modules: +# no additional modules required +# +# 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) + + +function(_osgbundle_split_debug_versions releasevar debugvar) + set(release) + set(debug) + foreach(fn ${ARGN}) + get_filename_component(name "${fn}" NAME_WE) + if("${name}" MATCHES "d$") + list(APPEND debug "${fn}") + else() + list(APPEND release "${fn}") + endif() + endforeach() + set(${releasevar} ${release} PARENT_SCOPE) + set(${debugvar} ${debug} PARENT_SCOPE) +endfunction() + +function(_osgbundle_find_plugins varprefix filenameprefix) + file(GLOB + all + "${OSG_RUNTIME_LIBRARY_DIR}/osgPlugins-${OPENSCENEGRAPH_VERSION}/${filenameprefix}*${CMAKE_SHARED_LIBRARY_SUFFIX}") + _osgbundle_split_debug_versions(${varprefix}_PLUGINS_RELEASE + ${varprefix}_PLUGINS_DEBUG + ${all}) + set(${varprefix}_PLUGINS_RELEASE + "${${varprefix}_PLUGINS_RELEASE}" + PARENT_SCOPE) + set(${varprefix}_PLUGINS_DEBUG + "${${varprefix}_PLUGINS_DEBUG}" + PARENT_SCOPE) +endfunction() + +if(OPENSCENEGRAPH_FOUND) + if(WIN32) + get_filename_component(_osglibdir "${OSG_LIBRARY}" PATH) + get_filename_component(_osgroot "${_osglibdir}/.." ABSOLUTE) + set(OSG_RUNTIME_LIBRARY_DIR "${_osgroot}/bin") + set(OSG_PATH_TO_PLUGINS "bin/osgPlugins-${OPENSCENEGRAPH_VERSION}/") + else() + get_filename_component(_osglibdir "${OSG_LIBRARY}" PATH) + set(OSG_RUNTIME_LIBRARY_DIR "${_osglibdir}") + set(OSG_PATH_TO_PLUGINS "lib/osgPlugins-${OPENSCENEGRAPH_VERSION}/") + endif() + # Find the osgDB plugins + _osgbundle_find_plugins(OSGDB osgdb) + _osgbundle_find_plugins(OSGWRAPPER osgwrapper) +endif() + +function(install_osg_plugins var) + set(INSTALLEDPLUGINS) + foreach(plugin ${OSGDB_PLUGINS_RELEASE} ${OSGWRAPPER_PLUGINS_RELEASE}) + install(FILES "${plugin}" + DESTINATION "${OSG_PATH_TO_PLUGINS}" + CONFIGURATIONS Release RelWithDebInfo MinSizeRel) + get_filename_component(name "${plugin}" NAME) + list(APPEND INSTALLEDPLUGINS "${OSG_PATH_TO_PLUGINS}/${name}") + endforeach() + foreach(plugin ${OSGDB_PLUGINS_DEBUG} ${OSGWRAPPER_PLUGINS_DEBUG}) + install(FILES + "${plugin}" + DESTINATION + "${OSG_PATH_TO_PLUGINS}" + CONFIGURATIONS + Debug) + #get_filename_component(name "${plugin}" NAME) + #list(APPEND INSTALLEDPLUGINS "${OSG_PATH_TO_PLUGINS}/${name}") + endforeach() + set(${var} ${INSTALLEDPLUGINS} PARENT_SCOPE) +endfunction() diff --git a/lib/wiiuse/cmake/BundleOSGRuntime.cmake b/lib/wiiuse/cmake/BundleOSGRuntime.cmake new file mode 100644 index 000000000..8d119261b --- /dev/null +++ b/lib/wiiuse/cmake/BundleOSGRuntime.cmake @@ -0,0 +1,118 @@ +# - Include the OpenSceneGraph runtime files in an installation or built package. +# +# OSGRUNTIME_BUNDLE - Set to "yes" to enable this behavior +# OSGRUNTIME_zlib1dll - Must be set to the location of zlib1.dll on Windows +# OSGRUNTIME_zlib1ddll - Can be set to the location of zlib1d.dll (debug) on Windows. +# If set, will be installed. +# +# Requires these CMake modules: +# no additional modules required +# +# 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) + +function(_osgbundle_split_debug_versions releasevar debugvar) + set(release) + set(debug) + foreach(fn ${ARGN}) + get_filename_component(name "${fn}" NAME_WE) + if(${name} MATCHES "d$") + list(APPEND debug "${fn}") + else() + list(APPEND release "${fn}") + endif() + endforeach() + set(${releasevar} ${release} PARENT_SCOPE) + set(${debugvar} ${debug} PARENT_SCOPE) +endfunction() + +function(_osgbundle_find_plugins varprefix filenameprefix) + file(GLOB + all + "${OSG_RUNTIME_LIBRARY_DIR}/osgPlugins-${OPENSCENEGRAPH_VERSION}/${filenameprefix}*${CMAKE_SHARED_LIBRARY_SUFFIX}") + _osgbundle_split_debug_versions(${varprefix}_PLUGINS_RELEASE + ${varprefix}_PLUGINS_DEBUG + ${all}) +endfunction() + +if(OPENSCENEGRAPH_FOUND) + if(WIN32) + get_filename_component(_osglibdir "${OSG_LIBRARY}" PATH) + get_filename_component(_osgroot "${_osglibdir}/.." ABSOLUTE) + set(OSG_RUNTIME_LIBRARY_DIR "${_osgroot}/bin") + find_file(OSGBUNDLE_zlib1dll + zlib1.dll + PATHS + "${_osgroot}/bin" + "${_osgroot}/lib") + find_file(OSGBUNDLE_zlib1ddll + zlib1d.dll + PATHS + "${_osgroot}/bin" + "${_osgroot}/lib") + mark_as_advanced(OSGBUNDLE_zlib1dll OSGBUNDLE_zlib1ddll) + set(_osgbundle_required OSGBUNDLE_zlib1dll) + set(_osgbundle_platformOK on) + else() + get_filename_component(_osglibdir "${OSG_LIBRARY}" PATH) + set(OSG_RUNTIME_LIBRARY_DIR "${_osglibdir}") + set(_osgbundle_platformOK on) + endif() + + # Find the osgDB plugins + + _osgbundle_find_plugins(OSGDB osgdb) + _osgbundle_find_plugins(OSGWRAPPER osgwrapper) +endif() + + + +if(_osgbundle_platformOK) + set(_osgbundle_caninstall on) + foreach(_var ${_osgbundle_required}) + if(NOT ${_var}) + # If we are missing a single required file, cut out now. + set(_osgbundle_caninstall off) + option(OSGRUNTIME_BUNDLE + "Install a local copy of the OpenSceneGraph runtime files with the project." + off) + endif() + endforeach() + if(_osgbundle_caninstall) + option(OSGRUNTIME_BUNDLE + "Install a local copy of the OpenSceneGraph runtime files with the project." + on) + endif() +endif() + +mark_as_advanced(OSGRUNTIME_BUNDLE) + +if(OSGRUNTIME_BUNDLE AND OPENSCENEGRAPH_FOUND AND _osgbundle_caninstall) + if(WIN32) + set(DESTINATION bin) + install(FILES "${OSGBUNDLE_zlib1dll}" + DESTINATION ${DESTINATION}) + + if(OSGBUNDLE_zlib1ddll) + install(FILES "${OSGBUNDLE_zlib1ddll}" + DESTINATION ${DESTINATION}) + endif() + + else() + set(DESTINATION lib) + endif() + + install(DIRECTORY "${_osgroot}/bin/" "${_osgroot}/lib/" + DESTINATION ${DESTINATION} + FILES_MATCHING + + # Runtime files + PATTERN "*${CMAKE_SHARED_LIBRARY_SUFFIX}") +endif() diff --git a/lib/wiiuse/cmake/BundleVRJ22Runtime.cmake b/lib/wiiuse/cmake/BundleVRJ22Runtime.cmake new file mode 100644 index 000000000..9198d2598 --- /dev/null +++ b/lib/wiiuse/cmake/BundleVRJ22Runtime.cmake @@ -0,0 +1,99 @@ +# - Include the VR Juggler runtime files in an installation or built package. +# +# VRJUGGLERRUNTIME_BUNDLE +# VRJUGGLERRUNTIME_BUNDLE_DEBUG - set to yes to include debug dll's as well +# +# Requires these CMake modules: +# FindVRJuggler22 and its dependencies +# +# 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) + option(VRJUGGLERRUNTIME_BUNDLE + "Install a local copy of the VR Juggler runtime files with the project." + on) + option(VRJUGGLERRUNTIME_BUNDLE_DEBUG + "Install the VR Juggler debug runtime files as well." + off) + mark_as_advanced(VRJUGGLERRUNTIME_BUNDLE_DEBUG) +else() + # TODO - how to handle when not on Windows? + #option(VRJUGGLERRUNTIME_BUNDLE "Install a local copy of the VR Juggler runtime files with the project." off) +endif() + +mark_as_advanced(VRJUGGLERRUNTIME_BUNDLE VRJUGGLERRUNTIME_BUNDLE_DEBUG) + +if(VRJUGGLERRUNTIME_BUNDLE AND VRJUGGLER22_FOUND) + if(WIN32) + get_filename_component(_vrjlibdir "${VRJ22_LIBRARY_RELEASE}" PATH) + get_filename_component(_vrjroot "${_vrjlibdir}/../" ABSOLUTE) + + # TODO - make sure gadgeteer and sonix can find their DSO's at runtime... + + foreach(_dir bin lib) + if(VRJUGGLERRUNTIME_BUNDLE_DEBUG) + install(DIRECTORY "${_vrjroot}/${_dir}/" + DESTINATION bin + PATTERN "*.lib" EXCLUDE # exclude static and link libraries + PATTERN "*.exe" EXCLUDE # exclude unneeded executables + PATTERN "*.py" EXCLUDE # exclude unneeded python executables + PATTERN "*.pyc" EXCLUDE # exclude unneeded python executables + ) + else() + install(DIRECTORY ${_vrjroot}/${_dir}/ + DESTINATION bin + PATTERN "*.lib" EXCLUDE # exclude static and link libraries + PATTERN "*.exe" EXCLUDE # exclude unneeded executables + PATTERN "*.py" EXCLUDE # exclude unneeded python executables + PATTERN "*.pyc" EXCLUDE # exclude unneeded python executables + + PATTERN "*d.dll" EXCLUDE # exclude debug dll's + PATTERN "*-gd-*.dll" EXCLUDE # exclude Boost debug dll's + ) + endif() + + endforeach() + + install(DIRECTORY ${_vrjroot}/share/ + DESTINATION share + FILES_MATCHING + + # Runtime files + PATTERN "*.dll" + PATTERN "*.jar" + + # Data files + PATTERN "*.wav" + PATTERN "*.xml" + PATTERN "*.xsl" + PATTERN "*.xsd" + PATTERN "*.flt" + PATTERN "*.dat" + PATTERN "*.table" + + + # Config files + PATTERN "*.jdef" + PATTERN "*.jconf" + PATTERN "*.cfg" + PATTERN "hosts.allow" + + # Other Files + PATTERN "*.txt" + PATTERN "COPYING*" + PATTERN "ChangeLog" + ) + + endif() + + + +endif() diff --git a/lib/wiiuse/cmake/BundleVRJ30Runtime.cmake b/lib/wiiuse/cmake/BundleVRJ30Runtime.cmake new file mode 100644 index 000000000..c661da0fe --- /dev/null +++ b/lib/wiiuse/cmake/BundleVRJ30Runtime.cmake @@ -0,0 +1,96 @@ +# - Include the VR Juggler runtime files in an installation or built package. +# +# VRJUGGLERRUNTIME_BUNDLE +# VRJUGGLERRUNTIME_BUNDLE_DEBUG - set to yes to include debug dll's as well +# +# Requires these CMake modules: +# FindVRJuggler22 and its dependencies +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# Updated for VR Juggler 3.0 by: +# Brandon Newendorp + +if(WIN32) + option(VRJUGGLERRUNTIME_BUNDLE + "Install a local copy of the VR Juggler runtime files with the project." + on) + option(VRJUGGLERRUNTIME_BUNDLE_DEBUG + "Install the VR Juggler debug runtime files as well." + off) + mark_as_advanced(VRJUGGLERRUNTIME_BUNDLE_DEBUG) +else() + # TODO - how to handle when not on Windows? + #option(VRJUGGLERRUNTIME_BUNDLE "Install a local copy of the VR Juggler runtime files with the project." off) +endif() + +mark_as_advanced(VRJUGGLERRUNTIME_BUNDLE VRJUGGLERRUNTIME_BUNDLE_DEBUG) + +if(VRJUGGLERRUNTIME_BUNDLE AND VRJUGGLER22_FOUND) + if(WIN32) + get_filename_component(_vrjlibdir "${VRJ22_LIBRARY_RELEASE}" PATH) + get_filename_component(_vrjroot "${_vrjlibdir}/../" ABSOLUTE) + + # TODO - make sure gadgeteer and sonix can find their DSO's at runtime... + + foreach(_dir bin lib) + if(VRJUGGLERRUNTIME_BUNDLE_DEBUG) + install(DIRECTORY "${_vrjroot}/${_dir}/" + DESTINATION bin + PATTERN "*.lib" EXCLUDE # exclude static and link libraries + PATTERN "*.exe" EXCLUDE # exclude unneeded executables + PATTERN "*.py" EXCLUDE # exclude unneeded python executables + PATTERN "*.pyc" EXCLUDE # exclude unneeded python executables + ) + else() + install(DIRECTORY ${_vrjroot}/${_dir}/ + DESTINATION bin + PATTERN "*.lib" EXCLUDE # exclude static and link libraries + PATTERN "*.exe" EXCLUDE # exclude unneeded executables + PATTERN "*.py" EXCLUDE # exclude unneeded python executables + PATTERN "*.pyc" EXCLUDE # exclude unneeded python executables + + PATTERN "*d.dll" EXCLUDE # exclude debug dll's + PATTERN "*-gd-*.dll" EXCLUDE # exclude Boost debug dll's + ) + endif() + + endforeach() + + install(DIRECTORY ${_vrjroot}/share/ + DESTINATION share + FILES_MATCHING + + # Runtime files + PATTERN "*.dll" + PATTERN "*.jar" + + # Data files + PATTERN "*.wav" + PATTERN "*.xml" + PATTERN "*.xsl" + PATTERN "*.xsd" + PATTERN "*.flt" + PATTERN "*.dat" + PATTERN "*.table" + + + # Config files + PATTERN "*.jdef" + PATTERN "*.jconf" + PATTERN "*.cfg" + PATTERN "hosts.allow" + + # Other Files + PATTERN "*.txt" + PATTERN "COPYING*" + PATTERN "ChangeLog" + ) + + endif() + + + +endif() diff --git a/lib/wiiuse/cmake/CheckMacHIDAPI.cmake b/lib/wiiuse/cmake/CheckMacHIDAPI.cmake new file mode 100644 index 000000000..54337835a --- /dev/null +++ b/lib/wiiuse/cmake/CheckMacHIDAPI.cmake @@ -0,0 +1,73 @@ +# - Script to check if the signature for a mac HID callback uses UInt32 or uint32_t +# Requires that the associated CPP file be present: CheckMacHIDAPI.cpp. +# +# MACOSX_HID_UINT32T, set according to the results of our test. +# +# Use add_definitions(-DMACOSX_HID_UINT32T=${MACOSX_HID_UINT32T}) in your +# listfile and the following prototype for the function you'd like to +# register using setInterruptReportHandlerCallback: +# void ReaderReportCallback( +# void *target, +# IOReturn result, +# void *refcon, +# void *sender, +# MACOSX_HID_UINT32T size +# ) +# +# 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(APPLE) + if(NOT MACOSX_HID_UINT32T) + get_filename_component(_moddir ${CMAKE_CURRENT_LIST_FILE} PATH) + + try_compile(_HID_uint32t + ${CMAKE_BINARY_DIR} + ${_moddir}/CheckMacHIDAPI.cpp + OUTPUT_VARIABLE + _HID_uint32t_OUTPUT + COMPILE_DEFINITIONS + -DMACOSX_HID_UINT32T=uint32_t) + message(STATUS + "Checking uint32_t in HID callback signature... ${_HID_uint32t}") + + try_compile(_HID_UInt32 + ${CMAKE_BINARY_DIR} + ${_moddir}/CheckMacHIDAPI.cpp + OUTPUT_VARIABLE + _HID_UInt32_OUTPUT + COMPILE_DEFINITIONS + -DMACOSX_HID_UINT32T=UInt32) + message(STATUS + "Checking UInt32 in HID callback signature... ${_HID_UInt32}") + + + if(_HID_uint32t) + set(MACOSX_HID_UINT32T + "uint32_t" + CACHE + STRING + "The 32-bit uint type desired in the callback set by setInterruptReportHandlerCallback") + mark_as_advanced(MACOSX_HID_UINT32T) + elseif(_HID_UInt32) + set(MACOSX_HID_UINT32T + "UInt32" + CACHE + STRING + "The 32-bit uint type desired in the callback set by setInterruptReportHandlerCallback") + mark_as_advanced(MACOSX_HID_UINT32T) + else() + message(SEND_ERROR + "ERROR: Could not detect appropriate Mac HID uint32 type!") + endif() + + endif() +endif() diff --git a/lib/wiiuse/cmake/CheckMacHIDAPI.cpp b/lib/wiiuse/cmake/CheckMacHIDAPI.cpp new file mode 100644 index 000000000..00d2a4679 --- /dev/null +++ b/lib/wiiuse/cmake/CheckMacHIDAPI.cpp @@ -0,0 +1,45 @@ +/** + * \file CheckMacHIDAPI.cpp + * \brief C++ source file used by CMake module CheckMacHIDAPI.cmake + * + * \author + * Ryan Pavlik, 2009-2010 + * + * http://academic.cleardefinition.com/ + * + * \author + * Based on code extracted from VRPN 07.22 for use as a minimal test case + * + * Attempts to compile a difficult bit of code against the Mac + * HID API, as two different types have been required in the callback + * function (UInt32 and uint32_t) and testing is the best way to know + * which one is correct for a given system. + * + */ + + +#if defined(__APPLE__) + +#include +#include +#include +#include +#include +void ReaderReportCallback( + void *target, IOReturn result, void *refcon, void *sender, MACOSX_HID_UINT32T size + ) + {} +#endif + +int main(int argc, char* argv[]) { +#if defined(__APPLE__) + io_object_t _ioObject; + IOHIDDeviceInterface122 **_interface; + unsigned char _buffer[512]; + IOReturn result = (*_interface)->setInterruptReportHandlerCallback(_interface, + _buffer, 512, + ReaderReportCallback, + NULL, 0); +#endif + return 0; +} diff --git a/lib/wiiuse/cmake/CheckVersion.cmake b/lib/wiiuse/cmake/CheckVersion.cmake new file mode 100644 index 000000000..baece76d8 --- /dev/null +++ b/lib/wiiuse/cmake/CheckVersion.cmake @@ -0,0 +1,47 @@ +# - Utility function for Find modules considering multiple possible versions +# +# Requires these CMake modules: +# no additional modules required +# +# 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(__check_version) + return() +endif() +set(__check_version YES) + +function(check_version var packagename version) + # By default, we say that the version is good enough + set(_result TRUE) + + # Was a version requested? If so, what is our test condition? + if(${packagename}_FIND_VERSION) + if(${packagename}_FIND_VERSION_EXACT) + # Yes, an exact == version was requested - check it. + + if(NOT "${version}" VERSION_EQUAL "${${packagename}_FIND_VERSION}") + # version is not an exact match + set(_result FALSE) + endif() + else() + # Yes, a minimum >= version was requested - check it. + + if("${version}" VERSION_LESS "${${packagename}_FIND_VERSION}") + # version is lower than requested + set(_result FALSE) + endif() + + endif() + endif() + + # Return _result + set(${var} ${_result} PARENT_SCOPE) +endfunction() diff --git a/lib/wiiuse/cmake/CleanDirectoryList.cmake b/lib/wiiuse/cmake/CleanDirectoryList.cmake new file mode 100644 index 000000000..58b8963f9 --- /dev/null +++ b/lib/wiiuse/cmake/CleanDirectoryList.cmake @@ -0,0 +1,48 @@ +# - Removes duplicate entries and non-directories from a provided list +# +# clean_directory_list( [...]) +# +# 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(__clean_directory_list) + return() +endif() +set(__clean_directory_list YES) + +function(clean_directory_list _var) + # combine variable's current value with additional list items + set(_in ${${_var}} ${ARGN}) + + if(_in) + # Initial list cleaning + list(REMOVE_DUPLICATES _in) + + # Grab the absolute path of each actual directory + set(_out) + foreach(_dir ${_in}) + if(IS_DIRECTORY "${_dir}") + get_filename_component(_dir "${_dir}" ABSOLUTE) + file(TO_CMAKE_PATH "${_dir}" _dir) + list(APPEND _out "${_dir}") + endif() + endforeach() + + if(_out) + # Clean up the output list now + list(REMOVE_DUPLICATES _out) + endif() + + # return _out + set(${_var} "${_out}" PARENT_SCOPE) + endif() +endfunction() diff --git a/lib/wiiuse/cmake/CleanLibraryList.cmake b/lib/wiiuse/cmake/CleanLibraryList.cmake new file mode 100644 index 000000000..77613934d --- /dev/null +++ b/lib/wiiuse/cmake/CleanLibraryList.cmake @@ -0,0 +1,72 @@ +# - A smarter replacement for list(REMOVE_DUPLICATES) for library lists +# +# Note that, in the case of cyclic link dependencies, you _do_ actually need +# a library in a list multiple times. So, only use this function when you know +# that the dependency graph is acyclic. +# +# clean_library_list( [...]) - where +# listvar is the name of a destination variable, and also possibly a source, and +# it is followed by any number (including 0) of additional libraries to append +# to the list before processing. +# +# Removes duplicates from the list, leaving only the last instance, while +# preserving the meaning of the "optimized", "debug", and "general" labeling. +# (Libraries listed as general are listed in the result instead as optimized and +# debug) +# +# 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(__clean_library_list) + return() +endif() +set(__clean_library_list YES) + +function(clean_library_list _var) + # combine variable's current value with additional list items + set(_work ${${_var}} ${ARGN}) + if(_work) + # Turn each of optimized, debug, and general into flags + # prefixed on their respective library (combining list items) + string(REGEX REPLACE "optimized;" "1CLL%O%" _work "${_work}") + string(REGEX REPLACE "debug;" "1CLL%D%" _work "${_work}") + string(REGEX REPLACE "general;" "1CLL%G%" _work "${_work}") + + # Any library that doesn't have a prefix is general, and a general + # library is both debug and optimized so stdize it + set(_std) + foreach(_lib ${_work}) + if(NOT "${_lib}" MATCHES "^1CLL%.%") + list(APPEND _std "1CLL%D%${_lib}" "1CLL%O%${_lib}") + elseif("${_lib}" MATCHES "^1CLL%G%") + string(REPLACE "1CLL%G%" "" _justlib "${_lib}") + list(APPEND _std "1CLL%D%${_justlib}" "1CLL%O%${_justlib}") + else() + list(APPEND _std "${_lib}") + endif() + endforeach() + + # REMOVE_DUPLICATES leaves the first - so we reverse before and after + # to keep the last, instead + list(REVERSE _std) + list(REMOVE_DUPLICATES _std) + list(REVERSE _std) + + # Split list items back out again: turn prefixes into the + # library type flags. + string(REGEX REPLACE "1CLL%D%" "debug;" _std "${_std}") + string(REGEX REPLACE "1CLL%O%" "optimized;" _std "${_std}") + + # Return _std + set(${_var} ${_std} PARENT_SCOPE) + endif() +endfunction() diff --git a/lib/wiiuse/cmake/CompatibilityVersionFile-BASIC.cmake.in b/lib/wiiuse/cmake/CompatibilityVersionFile-BASIC.cmake.in new file mode 100644 index 000000000..d2b97ba7a --- /dev/null +++ b/lib/wiiuse/cmake/CompatibilityVersionFile-BASIC.cmake.in @@ -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() \ No newline at end of file diff --git a/lib/wiiuse/cmake/CompatibilityVersionFile-CXX_ABI.cmake.in b/lib/wiiuse/cmake/CompatibilityVersionFile-CXX_ABI.cmake.in new file mode 100644 index 000000000..f09043d6a --- /dev/null +++ b/lib/wiiuse/cmake/CompatibilityVersionFile-CXX_ABI.cmake.in @@ -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() diff --git a/lib/wiiuse/cmake/CompatibilityVersionFile-CXX_LAYOUT.cmake.in b/lib/wiiuse/cmake/CompatibilityVersionFile-CXX_LAYOUT.cmake.in new file mode 100644 index 000000000..8f98a084c --- /dev/null +++ b/lib/wiiuse/cmake/CompatibilityVersionFile-CXX_LAYOUT.cmake.in @@ -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() diff --git a/lib/wiiuse/cmake/CompatibilityVersionFile-C_ABI.cmake.in b/lib/wiiuse/cmake/CompatibilityVersionFile-C_ABI.cmake.in new file mode 100644 index 000000000..656e90ffa --- /dev/null +++ b/lib/wiiuse/cmake/CompatibilityVersionFile-C_ABI.cmake.in @@ -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"? \ No newline at end of file diff --git a/lib/wiiuse/cmake/CopyImportedTarget.cmake b/lib/wiiuse/cmake/CopyImportedTarget.cmake new file mode 100644 index 000000000..fed23b4fa --- /dev/null +++ b/lib/wiiuse/cmake/CopyImportedTarget.cmake @@ -0,0 +1,32 @@ +# - Copy shared libraries from imported targets to the target build directory +# on Windows during post-build. Install them in all cases. +# +# copy_imported_targets( [ ...]) +# +# install_imported_target( +# +# Copyright Sensics, Inc. 2015. +# 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) + +function(copy_imported_targets _target) + foreach(_dep ${ARGN}) + if(WIN32) + add_custom_command(TARGET ${_target} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy $ $ + COMMENT "Copying required DLL for dependency ${_dep}" + VERBATIM) + endif() + endforeach() +endfunction() + + +function(install_imported_target _dep) + install(FILES $ ${ARGN}) +endfunction() diff --git a/lib/wiiuse/cmake/CopyResourcesToBuildTree.cmake b/lib/wiiuse/cmake/CopyResourcesToBuildTree.cmake new file mode 100644 index 000000000..3512cc484 --- /dev/null +++ b/lib/wiiuse/cmake/CopyResourcesToBuildTree.cmake @@ -0,0 +1,83 @@ +# - Copy the resources your app needs to the build tree. +# +# copy_resources_to_build_tree() +# +# 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(__copy_resources_to_build_tree) + return() +endif() +set(__copy_resources_to_build_tree YES) + +function(copy_resources_to_build_tree _target) + get_target_property(_resources ${_target} RESOURCE) + if(NOT _resources) + # Bail if no resources + message(STATUS + "Told to copy resources for target ${_target}, but " + "no resources are set!") + return() + endif() + + get_target_property(_path ${_target} LOCATION) + get_filename_component(_path "${_path}" PATH) + + if(NOT MSVC AND NOT "${CMAKE_GENERATOR}" MATCHES "Makefiles") + foreach(_config ${CMAKE_CONFIGURATION_TYPES}) + get_target_property(_path${_config} ${_target} LOCATION_${_config}) + get_filename_component(_path${_config} "${_path${_config}}" PATH) + add_custom_command(TARGET ${_target} + POST_BUILD + COMMAND + ${CMAKE_COMMAND} + ARGS -E make_directory "${_path${_config}}/" + COMMENT "Creating directory ${_path${_config}}/") + endforeach() + endif() + + foreach(_res ${_resources}) + if(NOT IS_ABSOLUTE "${_res}") + get_filename_component(_res "${_res}" ABSOLUTE) + endif() + get_filename_component(_name "${_res}" NAME) + + if(MSVC) + # Working dir is solution file dir, not exe file dir. + add_custom_command(TARGET ${_target} + POST_BUILD + COMMAND + ${CMAKE_COMMAND} + ARGS -E copy "${_res}" "${CMAKE_BINARY_DIR}/" + COMMENT "Copying ${_name} to ${CMAKE_BINARY_DIR}/ for MSVC") + else() + if("${CMAKE_GENERATOR}" MATCHES "Makefiles") + add_custom_command(TARGET ${_target} + POST_BUILD + COMMAND + ${CMAKE_COMMAND} + ARGS -E copy "${_res}" "${_path}/" + COMMENT "Copying ${_name} to ${_path}/") + else() + foreach(_config ${CMAKE_CONFIGURATION_TYPES}) + add_custom_command(TARGET ${_target} + POST_BUILD + COMMAND + ${CMAKE_COMMAND} + ARGS -E copy "${_res}" "${_path${_config}}" + COMMENT "Copying ${_name} to ${_path${_config}}") + endforeach() + + endif() + endif() + endforeach() +endfunction() diff --git a/lib/wiiuse/cmake/CppcheckTargets.cmake b/lib/wiiuse/cmake/CppcheckTargets.cmake new file mode 100644 index 000000000..cb21bed73 --- /dev/null +++ b/lib/wiiuse/cmake/CppcheckTargets.cmake @@ -0,0 +1,241 @@ +# - Run cppcheck on c++ source files as a custom target and a test +# +# include(CppcheckTargets) +# add_cppcheck( [UNUSED_FUNCTIONS] [STYLE] [POSSIBLE_ERROR] [FORCE] [FAIL_ON_WARNINGS]) - +# Create a target to check a target's sources with cppcheck and the indicated options +# add_cppcheck_sources( [UNUSED_FUNCTIONS] [STYLE] [POSSIBLE_ERROR] [FORCE] [FAIL_ON_WARNINGS]) - +# Create a target to check standalone sources with cppcheck and the indicated options +# +# Requires these CMake modules: +# Findcppcheck +# +# Requires CMake 2.8 or newer (uses VERSION_LESS) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010. +# Copyright Anthony Pesch 2014 +# Copyright Stefan Eilemann 2014 +# Copyright Nicholas Brown 2015 +# Copyright Ryan Pavlik 2017 +# 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(__add_cppcheck) + return() +endif() +set(__add_cppcheck YES) + +if(NOT CPPCHECK_FOUND) + find_package(cppcheck QUIET) +endif() + +if(NOT CPPCHECK_FOUND) + add_custom_target(all_cppcheck + COMMENT "cppcheck executable not found") + set_target_properties(all_cppcheck PROPERTIES EXCLUDE_FROM_ALL TRUE) +elseif(CPPCHECK_VERSION VERSION_LESS 1.53.0) + add_custom_target(all_cppcheck + COMMENT "Need at least cppcheck 1.53, found ${CPPCHECK_VERSION}") + set_target_properties(all_cppcheck PROPERTIES EXCLUDE_FROM_ALL TRUE) + set(CPPCHECK_FOUND) +endif() + +if(NOT TARGET all_cppcheck) + add_custom_target(all_cppcheck) +endif() + +function(add_cppcheck_sources _targetname) + if(CPPCHECK_FOUND) + set(_cppcheck_args -I ${CMAKE_SOURCE_DIR} ${CPPCHECK_EXTRA_ARGS}) + set(_input ${ARGN}) + list(FIND _input UNUSED_FUNCTIONS _unused_func) + if("${_unused_func}" GREATER "-1") + list(APPEND _cppcheck_args ${CPPCHECK_UNUSEDFUNC_ARG}) + list(REMOVE_AT _input ${_unused_func}) + endif() + + list(FIND _input STYLE _style) + if("${_style}" GREATER "-1") + list(APPEND _cppcheck_args ${CPPCHECK_STYLE_ARG}) + list(REMOVE_AT _input ${_style}) + endif() + + list(FIND _input POSSIBLE_ERROR _poss_err) + if("${_poss_err}" GREATER "-1") + list(APPEND _cppcheck_args ${CPPCHECK_POSSIBLEERROR_ARG}) + list(REMOVE_AT _input ${_poss_err}) + endif() + + list(FIND _input FORCE _force) + if("${_force}" GREATER "-1") + list(APPEND _cppcheck_args "--force") + list(REMOVE_AT _input ${_force}) + endif() + + list(FIND _input FAIL_ON_WARNINGS _fail_on_warn) + if("${_fail_on_warn}" GREATER "-1") + list(APPEND + CPPCHECK_FAIL_REGULAR_EXPRESSION + ${CPPCHECK_WARN_REGULAR_EXPRESSION}) + list(REMOVE_AT _input ${_fail_on_warn}) + endif() + + set(_files) + foreach(_source ${_input}) + get_source_file_property(_cppcheck_loc "${_source}" LOCATION) + if(_cppcheck_loc) + # This file has a source file property, carry on. + get_source_file_property(_cppcheck_lang "${_source}" LANGUAGE) + if(("${_cppcheck_lang}" STREQUAL "C") OR ("${_cppcheck_lang}" STREQUAL "CXX")) + list(APPEND _files "${_cppcheck_loc}") + endif() + else() + # This file doesn't have source file properties - figure it out. + get_filename_component(_cppcheck_loc "${_source}" ABSOLUTE) + if(EXISTS "${_cppcheck_loc}") + list(APPEND _files "${_cppcheck_loc}") + else() + message(FATAL_ERROR + "Adding CPPCHECK for file target ${_targetname}: " + "File ${_source} does not exist or needs a corrected path location " + "since we think its absolute path is ${_cppcheck_loc}") + endif() + endif() + endforeach() + + if("1.${CMAKE_VERSION}" VERSION_LESS "1.2.8.0") + # Older than CMake 2.8.0 + add_test(${_targetname}_cppcheck_test + "${CPPCHECK_EXECUTABLE}" + ${CPPCHECK_TEMPLATE_ARG} + ${_cppcheck_args} + ${_files}) + else() + # CMake 2.8.0 and newer + add_test(NAME + ${_targetname}_cppcheck_test + COMMAND + "${CPPCHECK_EXECUTABLE}" + ${CPPCHECK_TEMPLATE_ARG} + ${_cppcheck_args} + ${_files}) + endif() + + set_tests_properties(${_targetname}_cppcheck_test + PROPERTIES + FAIL_REGULAR_EXPRESSION + "${CPPCHECK_FAIL_REGULAR_EXPRESSION}") + + add_custom_target(${_targetname}_cppcheck + COMMAND + ${CPPCHECK_EXECUTABLE} + ${CPPCHECK_QUIET_ARG} + ${CPPCHECK_TEMPLATE_ARG} + ${_cppcheck_args} + ${_files} + WORKING_DIRECTORY + "${CMAKE_CURRENT_SOURCE_DIR}" + COMMENT + "${_targetname}_cppcheck: Running cppcheck on target ${_targetname}..." + VERBATIM) + add_dependencies(cppcheck ${_targetname}_cppcheck) + endif() +endfunction() + +function(add_cppcheck _name) + if(NOT TARGET ${_name}) + message(FATAL_ERROR + "add_cppcheck given a target name that does not exist: '${_name}' !") + endif() + if(CPPCHECK_FOUND) + set(_cppcheck_args -I ${CMAKE_SOURCE_DIR} ${CPPCHECK_EXTRA_ARGS}) + + list(FIND ARGN UNUSED_FUNCTIONS _unused_func) + if("${_unused_func}" GREATER "-1") + list(APPEND _cppcheck_args ${CPPCHECK_UNUSEDFUNC_ARG}) + endif() + + list(FIND ARGN STYLE _style) + if("${_style}" GREATER "-1") + list(APPEND _cppcheck_args ${CPPCHECK_STYLE_ARG}) + endif() + + list(FIND ARGN POSSIBLE_ERROR _poss_err) + if("${_poss_err}" GREATER "-1") + list(APPEND _cppcheck_args ${CPPCHECK_POSSIBLEERROR_ARG}) + endif() + + list(FIND ARGN FORCE _force) + if("${_force}" GREATER "-1") + list(APPEND _cppcheck_args "--force") + endif() + + list(FIND _input FAIL_ON_WARNINGS _fail_on_warn) + if("${_fail_on_warn}" GREATER "-1") + list(APPEND + CPPCHECK_FAIL_REGULAR_EXPRESSION + ${CPPCHECK_WARN_REGULAR_EXPRESSION}) + list(REMOVE_AT _input ${_unused_func}) + endif() + + get_target_property(_cppcheck_includes "${_name}" INCLUDE_DIRECTORIES) + set(_includes) + foreach(_include ${_cppcheck_includes}) + list(APPEND _includes "-I${_include}") + endforeach() + + get_target_property(_cppcheck_sources "${_name}" SOURCES) + set(_files) + foreach(_source ${_cppcheck_sources}) + get_source_file_property(_cppcheck_lang "${_source}" LANGUAGE) + get_source_file_property(_cppcheck_loc "${_source}" LOCATION) + if(("${_cppcheck_lang}" STREQUAL "C") OR ("${_cppcheck_lang}" STREQUAL "CXX")) + list(APPEND _files "${_cppcheck_loc}") + endif() + endforeach() + + if("1.${CMAKE_VERSION}" VERSION_LESS "1.2.8.0") + # Older than CMake 2.8.0 + add_test(${_name}_cppcheck_test + "${CPPCHECK_EXECUTABLE}" + ${CPPCHECK_TEMPLATE_ARG} + ${_cppcheck_args} + ${_files}) + else() + # CMake 2.8.0 and newer + add_test(NAME + ${_name}_cppcheck_test + COMMAND + "${CPPCHECK_EXECUTABLE}" + ${CPPCHECK_TEMPLATE_ARG} + ${_cppcheck_args} + ${_files}) + endif() + + set_tests_properties(${_name}_cppcheck_test + PROPERTIES + FAIL_REGULAR_EXPRESSION + "${CPPCHECK_FAIL_REGULAR_EXPRESSION}") + + add_custom_target(${_name}_cppcheck + COMMAND + ${CPPCHECK_EXECUTABLE} + ${CPPCHECK_QUIET_ARG} + ${CPPCHECK_TEMPLATE_ARG} + ${_cppcheck_args} + ${_includes} + ${_files} + WORKING_DIRECTORY + "${CMAKE_CURRENT_SOURCE_DIR}" + COMMENT + "${_name}_cppcheck: Running cppcheck on target ${_name}..." + VERBATIM) + add_dependencies(all_cppcheck ${_name}_cppcheck) + endif() + +endfunction() diff --git a/lib/wiiuse/cmake/CreateDashboardScripts.cmake b/lib/wiiuse/cmake/CreateDashboardScripts.cmake new file mode 100644 index 000000000..22420b5b4 --- /dev/null +++ b/lib/wiiuse/cmake/CreateDashboardScripts.cmake @@ -0,0 +1,205 @@ +# - Create ctest -S scripts to use to run dashboard builds +# +# include(CreateDashboardScripts) +# create_dashboard_scripts([]) +# +# If you need additional settings to persist from the "parent" CMake instance +# to the initial cache created by the dashboard script, +# you may pass a filename which will be configured into the initial cache. +# +# In the resulting DASHBOARDSCRIPT_BASE_DIRECTORY, an end-user +# may optionally create a file named +# CustomInitialCache.${DASHBOARDSCRIPT_SCRIPT_NAME} +# (by default, CustomInitialCache.go.cmake) containing set commands that use +# the CACHE option, to set up additional site-local cache variable values. +# +# Requires these CMake modules: +# GetCompilerInfoString +# +# 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 +# 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) + +# Only do any of the prep work if not already in a dashboard script +if(NOT IN_DASHBOARD_SCRIPT) + + # Hide a CTest variable + mark_as_advanced(DART_TESTING_TIMEOUT) + + include(GetCompilerInfoString) + + get_compiler_info_string(_COMPILERID) + + # 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(_dashboardmoddir + ${CMAKE_CURRENT_LIST_FILE} + PATH) + + if(NOT "$ENV{USER}" MATCHES "^$") + set(_user "$ENV{USER}") + elseif(NOT "$ENV{USERNAME}" MATCHES "^$") + set(_user "$ENV{USERNAME}") + endif() + + if(NOT _dashboardscript_machine) + if(NOT SITE) + site_name(SITE) + endif() + set(_dashboardscript_machine "${SITE}" CACHE INTERNAL "") + set(SITE + "${_user}@${_dashboardscript_machine}" + CACHE + STRING + "Human-readable site name" + FORCE) + endif() + + set(DASHBOARDSCRIPT_BASE_DIRECTORY + "${CMAKE_BINARY_DIR}/Dashboards-${_dashboardscript_machine}-${_user}" + CACHE + PATH + "Directory to use as the root of all dashboard work") + mark_as_advanced(DASHBOARDSCRIPT_BASE_DIRECTORY) + + set(DASHBOARDSCRIPT_SOURCE_DIRECTORY "${CMAKE_SOURCE_DIR}") + + set(BUILDNAME + "${CMAKE_SYSTEM}-${CMAKE_SYSTEM_PROCESSOR}-${_COMPILERID}" + CACHE + STRING + "Human-readable build ID info") + + set(DASHBOARDSCRIPT_CMAKE_COMMAND + "${CMAKE_COMMAND}" + CACHE + FILEPATH + "The cmake binary to use when configuring a dashboard build") + mark_as_advanced(DASHBOARDSCRIPT_CMAKE_COMMAND) + + # Try to find CTest, preferably right next to the chosen CMake + if(DASHBOARDSCRIPT_CMAKE_COMMAND) + get_filename_component(_cmake_dir + ${DASHBOARDSCRIPT_CMAKE_COMMAND} + PATH) + else() + get_filename_component(_cmake_dir ${CMAKE_COMMAND} PATH) + endif() + find_program(DASHBOARDSCRIPT_CTEST_EXECUTABLE + NAMES + ctest + HINTS + "${_cmake_dir}" + NO_DEFAULT_PATH) + find_program(DASHBOARDSCRIPT_CTEST_EXECUTABLE + NAMES + ctest + HINTS + "${_cmake_dir}") + + + set(DASHBOARDSCRIPT_CTEST_EXECUTABLE + "${DASHBOARDSCRIPT_CTEST_EXECUTABLE}" + CACHE + FILEPATH + "Path to the CTest executable to use for dashboard builds.") + mark_as_advanced(DASHBOARDSCRIPT_CTEST_EXECUTABLE) + + + # Optionals + + if(NOT "1.${CMAKE_VERSION}" VERSION_LESS "1.2.8.0") + if(IS_DIRECTORY "${CMAKE_SOURCE_DIRECTORY}/.git") + 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 "${GIT_EXECUTABLE}") + set(UPDATE_OPTIONS "") + endif() + endif() + endif() + +else() + # IN_DASHBOARD_SCRIPT is YES + message(STATUS + "CreateDashboardScripts detected that we're in a dashboard script already.") +endif() + +function(create_dashboard_scripts) + # Only create the script if we have all the required variables + # and are not already in it, and are at least 2.8.0. + if(DASHBOARDSCRIPT_BASE_DIRECTORY AND + DASHBOARDSCRIPT_SOURCE_DIRECTORY AND + DASHBOARDSCRIPT_BASE_DIRECTORY AND + BUILDNAME AND + DASHBOARDSCRIPT_CMAKE_COMMAND AND + DASHBOARDSCRIPT_CTEST_EXECUTABLE AND + NOT IN_DASHBOARD_SCRIPT AND + NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.0") + + set(_Continuous_cron "15 * * * * ") + set(_Nightly_cron "15 0 * * * ") + set(_Experimental_cron + "\nor run this command for an one-off experimental test build:\n") + set(_Experimental_flags "-VV") + + message(STATUS + "Dashboard scripts have been generated for automatic nightly and continuous builds.") + if(WIN32) + set(_Continuous_cron) + set(_Nightly_cron) + message(STATUS + "You can set up scheduled tasks to run these command lines:") + else() + message(STATUS "You can add these sample lines to your crontab:") + endif() + + set(_msg) + + if(NOT DASHBOARDSCRIPT_BUILD_CONFIGURATION) + set(DASHBOARDSCRIPT_BUILD_CONFIGURATION "RelWithDebInfo") + endif() + set(DASHBOARDSCRIPT_BUILD_CONFIGURATION "${DASHBOARDSCRIPT_BUILD_CONFIGURATION}" CACHE STRING "Build configuration to use for dashboard builds by default") + mark_as_advanced(DASHBOARDSCRIPT_BUILD_CONFIGURATION) + + foreach(DASHBOARDSCRIPT_DASH_TYPE Nightly Continuous Experimental) + # If given a cache template, configure it + if(ARGN) + configure_file(${ARGN} + "${DASHBOARDSCRIPT_BASE_DIRECTORY}/GeneratedInitialCache.run${DASHBOARDSCRIPT_DASH_TYPE}.cmake" + @ONLY) + endif() + + # Actually create the script file + configure_file(${_dashboardmoddir}/DashboardScript.cmake.in + "${DASHBOARDSCRIPT_BASE_DIRECTORY}/run${DASHBOARDSCRIPT_DASH_TYPE}.cmake" + @ONLY) + + set(_msg + "${_msg}\n${_${DASHBOARDSCRIPT_DASH_TYPE}_cron}\"${DASHBOARDSCRIPT_CTEST_EXECUTABLE}\" -S \"${DASHBOARDSCRIPT_BASE_DIRECTORY}/run${DASHBOARDSCRIPT_DASH_TYPE}.cmake\" ${_${DASHBOARDSCRIPT_DASH_TYPE}_flags}") + + endforeach() + message(STATUS "\n${_msg}\n") + message(STATUS "") + + endif() +endfunction() diff --git a/lib/wiiuse/cmake/CreateImportedTarget.cmake b/lib/wiiuse/cmake/CreateImportedTarget.cmake new file mode 100644 index 000000000..31fb3b7e8 --- /dev/null +++ b/lib/wiiuse/cmake/CreateImportedTarget.cmake @@ -0,0 +1,64 @@ +# - A smarter replacement for list(REMOVE_DUPLICATES) for library lists +# +# create_imported_target( [SHARED|STATIC|MODULE] [...]) - where +# ${libname}_LIBRARIES is set to this library's paths. +# +# Removes duplicates from the list then sorts while preserving "optimized", +# "debug", and "general" labeling +# +# 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(__create_imported_target) + return() +endif() +set(__create_imported_target YES) + +function(create_imported_target _libname) + if(ARGN) + list(FIND ARGN SHARED _target_shared) + list(FIND ARGN STATIC _target_static) + list(FIND ARGN MODULE _target_module) + + if(${_target_shared} GREATER -1) + set(_target_type SHARED) + elseif(${_target_static} GREATER -1) + set(_target_type STATIC) + elseif(${_target_module} GREATER -1) + set(_target_type MODULE) + else() + set(_target_type UNKNOWN) + endif() + + set(_deps ${ARGN}) + list(REMOVE_ITEM _deps SHARED STATIC MODULE UNKNOWN) + else() + set(_target_type UNKNOWN) + set(_deps) + endif() + + if(${_libname}_LIBRARIES AND NOT TARGET ${_libname}_imported) + add_library(${_libname}_imported ${_target_type} IMPORTED) + #message(STATUS "Library ${_libname}: lib ${${_libname}_LIBRARIES}") + #message(STATUS "Deps: ${_deps}") + set_target_properties(${_libname}_imported + PROPERTIES + IMPORTED_LOCATION + "${${_libname}_LIBRARIES}" + IMPORTED_LINK_INTERFACE_LIBRARIES + "${_deps}") + endif() + + if(TARGET ${_libname}_imported) + set(${_libname}_LIBRARIES ${_libname}_imported PARENT_SCOPE) + endif() +endfunction() diff --git a/lib/wiiuse/cmake/CreateLaunchers.cmake b/lib/wiiuse/cmake/CreateLaunchers.cmake new file mode 100644 index 000000000..571f044d7 --- /dev/null +++ b/lib/wiiuse/cmake/CreateLaunchers.cmake @@ -0,0 +1,349 @@ +# - Create launchers to set working directory, env. vars, etc. +# +# include(CreateLaunchers) - to make these available +# guess_runtime_library_dirs( [ ...]) +# create_default_target_launcher( +# [ARGS ] +# [FORWARD_ARGS] +# [RUNTIME_LIBRARY_DIRS ] +# [WORKING_DIRECTORY ] +# [ENVIRONMENT [...]]) +# +# create_target_launcher( +# [ARGS ] +# [FORWARD_ARGS] +# [RUNTIME_LIBRARY_DIRS ] +# [WORKING_DIRECTORY ] +# [ENVIRONMENT [...]]) +# +# create_generic_launcher( +# [RUNTIME_LIBRARY_DIRS ] +# [WORKING_DIRECTORY ] +# [ENVIRONMENT [...]]) +# - sets GENERIC_LAUNCHER_COMMAND and GENERIC_LAUNCHER_FAIL_REGULAR_EXPRESSION +# +# Requires these CMake modules: +# ListFilter +# ProgramFilesGlob +# CleanDirectoryList +# +# 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(__create_launchers) + return() +endif() +set(__create_launchers YES) + +include(CleanDirectoryList) + +# 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(_launchermoddir + ${CMAKE_CURRENT_LIST_FILE} + PATH) +set(_launchermoddir "${_launchermoddir}/launcher-templates") + +macro(_launcher_system_settings) + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(BITS 64) + else() + set(BITS 32) + endif() + + if(WIN32) + # Find user and system name + set(SYSTEM_NAME $ENV{USERDOMAIN}) + set(USER_NAME $ENV{USERNAME}) + set(VCPROJ_TYPE vcproj) + set(USERFILE_EXTENSION ${SYSTEM_NAME}.${USER_NAME}.user) + set(LAUNCHER_LINESEP " ") + if(MSVC90) + set(USERFILE_VC_VERSION 9.00) + elseif(MSVC80) + set(USERFILE_VC_VERSION 8.00) + elseif(MSVC71) + set(USERFILE_VC_VERSION 7.10) + elseif(MSVC10 OR (MSVC AND MSVC_VERSION GREATER 1600)) # 2010 or newer + set(LAUNCHER_LINESEP "\n") + set(USERFILE_VC_VERSION 10.00) + set(USERFILE_EXTENSION user) + set(VCPROJ_TYPE vcxproj) + endif() + if(BITS EQUAL 64) + set(USERFILE_PLATFORM x64) + else() + set(USERFILE_PLATFORM Win${BITS}) + endif() + set(_pathdelim ";") + set(_suffix "cmd") + else() + set(_pathdelim ":") + set(USERFILE_PLATFORM ${CMAKE_SYSTEM_NAME}${BITS}) + set(_suffix "sh") + find_package(GDB QUIET) + if(GDB_FOUND) + set(LAUNCHERS_GOT_GDB YES) + if(GDB_HAS_RETURN_CHILD_RESULT) + set(LAUNCHERS_GDB_ARG --return-child-result) + endif() + else() + set(LAUNCHERS_GOT_GDB) + endif() + endif() + + if(WIN32 AND NOT USERFILE_REMOTE_MACHINE) + site_name(USERFILE_REMOTE_MACHINE) + mark_as_advanced(USERFILE_REMOTE_MACHINE) + endif() +endmacro() + +macro(_launcher_process_args) + set(_nowhere) + set(_curdest _nowhere) + set(_val_args + ARGS + RUNTIME_LIBRARY_DIRS + WORKING_DIRECTORY + ENVIRONMENT + TARGET_PLATFORM) + set(_bool_args FORWARD_ARGS) + foreach(_arg ${_val_args} ${_bool_args}) + set(${_arg}) + endforeach() + foreach(_element ${ARGN}) + string(REPLACE ";" "\\;" _element "${_element}") + list(FIND _val_args "${_element}" _val_arg_find) + list(FIND _bool_args "${_element}" _bool_arg_find) + if("${_val_arg_find}" GREATER "-1") + set(_curdest "${_element}") + elseif("${_bool_arg_find}" GREATER "-1") + set("${_element}" ON) + set(_curdest _nowhere) + else() + list(APPEND ${_curdest} "${_element}") + endif() + endforeach() + + if(_nowhere) + message(FATAL_ERROR + "Syntax error in use of a function in CreateLaunchers!") + endif() + + # Turn into a list of native paths + set(_runtime_lib_dirs) + foreach(_dlldir ${RUNTIME_LIBRARY_DIRS}) + file(TO_NATIVE_PATH "${_dlldir}" _path) + set(_runtime_lib_dirs "${_runtime_lib_dirs}${_path}${_pathdelim}") + endforeach() + + if(NOT WORKING_DIRECTORY) + set(WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") + endif() + + if(FORWARD_ARGS) + if(WIN32) + set(FWD_ARGS %*) + else() + set(FWD_ARGS $*) + endif() + else() + set(FWD_ARGS) + endif() + + if(TARGET_PLATFORM) + set(USERFILE_PLATFORM ${TARGET_PLATFORM}) + endif() + + set(USERFILE_WORKING_DIRECTORY "${WORKING_DIRECTORY}") + set(USERFILE_COMMAND_ARGUMENTS "${ARGS}") + set(LAUNCHERSCRIPT_COMMAND_ARGUMENTS "${ARGS} ${FWD_ARGS}") + + if(WIN32) + if(_runtime_lib_dirs) + set(RUNTIME_LIBRARIES_ENVIRONMENT "PATH=${_runtime_lib_dirs};%PATH%") + endif() + file(READ + "${_launchermoddir}/launcher.env.cmd.in" + _cmdenv) + else() + if(_runtime_lib_dirs) + if(APPLE) + + set(RUNTIME_LIBRARIES_ENVIRONMENT + "DYLD_LIBRARY_PATH=${_runtime_lib_dirs}:$DYLD_LIBRARY_PATH") + else() + set(RUNTIME_LIBRARIES_ENVIRONMENT + "LD_LIBRARY_PATH=${_runtime_lib_dirs}:$LD_LIBRARY_PATH") + endif() + endif() + file(READ + "${_launchermoddir}/launcher.env.sh.in" + _cmdenv) + endif() + set(USERFILE_ENVIRONMENT "${RUNTIME_LIBRARIES_ENVIRONMENT}") + + set(USERFILE_ENV_COMMANDS) + foreach(_arg "${RUNTIME_LIBRARIES_ENVIRONMENT}" ${ENVIRONMENT}) + if(_arg) + string(CONFIGURE + "@USERFILE_ENVIRONMENT@@LAUNCHER_LINESEP@@_arg@" + USERFILE_ENVIRONMENT + @ONLY) + endif() + string(CONFIGURE + "@USERFILE_ENV_COMMANDS@${_cmdenv}" + USERFILE_ENV_COMMANDS + @ONLY) + endforeach() +endmacro() + +macro(_launcher_produce_vcproj_user) + if(MSVC) + file(READ + "${_launchermoddir}/perconfig.${VCPROJ_TYPE}.user.in" + _perconfig) + set(USERFILE_CONFIGSECTIONS) + foreach(USERFILE_CONFIGNAME ${CMAKE_CONFIGURATION_TYPES}) + get_target_property(USERFILE_${USERFILE_CONFIGNAME}_COMMAND + ${_targetname} + LOCATION_${USERFILE_CONFIGNAME}) + file(TO_NATIVE_PATH + "${USERFILE_${USERFILE_CONFIGNAME}_COMMAND}" + USERFILE_${USERFILE_CONFIGNAME}_COMMAND) + string(CONFIGURE "${_perconfig}" _temp @ONLY ESCAPE_QUOTES) + string(CONFIGURE + "${USERFILE_CONFIGSECTIONS}${_temp}" + USERFILE_CONFIGSECTIONS + ESCAPE_QUOTES) + endforeach() + + + configure_file("${_launchermoddir}/${VCPROJ_TYPE}.user.in" + ${VCPROJNAME}.${VCPROJ_TYPE}.${USERFILE_EXTENSION} + @ONLY) + endif() + +endmacro() + +macro(_launcher_configure_executable _src _tmp _target) +# get_filename_component(_targetname "${_target}" NAME) + get_filename_component(_targetpath "${_target}" PATH) + configure_file("${_src}" + "${_tmp}" + @ONLY) + file(COPY "${_tmp}" + DESTINATION "${_targetpath}" + FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) +endmacro() + +macro(_launcher_create_target_launcher) + if(CMAKE_CONFIGURATION_TYPES) + # Multi-config generator - multiple launchers + foreach(_config ${CMAKE_CONFIGURATION_TYPES}) + get_target_property(USERFILE_${_config}_COMMAND + ${_targetname} + LOCATION_${_config}) + file(TO_NATIVE_PATH + "${USERFILE_${_config}_COMMAND}" + USERFILE_COMMAND) + set(_fn "launch-${_targetname}-${_config}.${_suffix}") + _launcher_configure_executable("${_launchermoddir}/targetlauncher.${_suffix}.in" + "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${_fn}" + "${CMAKE_CURRENT_BINARY_DIR}/${_fn}") + endforeach() + else() + # Single-config generator - single launcher + get_target_property(USERFILE_COMMAND + ${_targetname} + LOCATION) + file(TO_NATIVE_PATH + "${USERFILE_COMMAND}" + USERFILE_COMMAND) + _launcher_configure_executable("${_launchermoddir}/targetlauncher.${_suffix}.in" + "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/launch-${_targetname}.${_suffix}" + "${CMAKE_CURRENT_BINARY_DIR}/launch-${_targetname}.${_suffix}" + @ONLY) + endif() +endmacro() + +function(create_default_target_launcher _targetname) + _launcher_system_settings() + _launcher_process_args(${ARGN}) + + set(VCPROJNAME "${CMAKE_BINARY_DIR}/ALL_BUILD") + _launcher_produce_vcproj_user() + + _launcher_create_target_launcher() +endfunction() + +function(create_target_launcher _targetname) + _launcher_system_settings() + _launcher_process_args(${ARGN}) + + set(VCPROJNAME "${CMAKE_CURRENT_BINARY_DIR}/${_targetname}") + _launcher_produce_vcproj_user() + + _launcher_create_target_launcher() +endfunction() + +function(create_generic_launcher _launchername) + _launcher_system_settings() + _launcher_process_args(${ARGN}) + + if(NOT IS_ABSOLUTE _launchername) + set(_launchername + "${CMAKE_CURRENT_BINARY_DIR}/${_launchername}.${_suffix}") + else() + set(_launchername "${_launchername}.${_suffix}") + endif() + if(WIN32) + set(GENERIC_LAUNCHER_COMMAND "${_launchername}" PARENT_SCOPE) + set(GENERIC_LAUNCHER_FAIL_REGULAR_EXPRESSION) + else() + set(GENERIC_LAUNCHER_COMMAND sh "${_launchername}" PARENT_SCOPE) + set(GENERIC_LAUNCHER_FAIL_REGULAR_EXPRESSION + "Program terminated with signal") + endif() + + _launcher_configure_executable("${_launchermoddir}/genericlauncher.${_suffix}.in" + "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/genericlauncher.${_suffix}.in" + "${_launchername}") +endfunction() + +function(guess_runtime_library_dirs _var) + # Start off with the link directories of the calling listfile's directory + get_directory_property(_libdirs LINK_DIRECTORIES) + + # Add additional libraries passed to the function + foreach(_lib ${ARGN}) + get_filename_component(_libdir "${_lib}" PATH) + list(APPEND _libdirs "${_libdir}") + endforeach() + + # Now, build a list of potential dll directories + set(_dlldirs) + foreach(_libdir ${_libdirs}) + # Add the libdir itself + list(APPEND _dlldirs "${_libdir}") + + # Look also in libdir/../bin since the dll might not be with the lib + get_filename_component(_libdir "${_libdir}/../bin" ABSOLUTE) + list(APPEND _dlldirs "${_libdir}") + endforeach() + + # Only keep the valid, unique directories + clean_directory_list(_dlldirs) + + # Return _dlldirs + set(${_var} "${_dlldirs}" PARENT_SCOPE) +endfunction() diff --git a/lib/wiiuse/cmake/DashboardScript.cmake.in b/lib/wiiuse/cmake/DashboardScript.cmake.in new file mode 100644 index 000000000..da348a8c5 --- /dev/null +++ b/lib/wiiuse/cmake/DashboardScript.cmake.in @@ -0,0 +1,122 @@ +# - Dashboard driver script for use with ctest. +# +# Generated file processed by CreateDashboardScripts.cmake +# Run it like: +# ctest -S nameofthisfile +# with -V or -V -VV if you want more feedback. +# +# Generally you do not need to edit this file by hand! +# +# If this file isn't named DashboardScript.cmake.in and located +# in the same directory as CreateDashboardScripts.cmake, it has been +# auto-generated and will be overwritten every time CMake configures +# itself. (This may be every build!) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC + +cmake_minimum_required(VERSION 2.8 FATAL_ERROR) + +set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_PROJECT_NAME "@PROJECT_NAME@") + +set(CTEST_DASHBOARD_ROOT "@DASHBOARDSCRIPT_BASE_DIRECTORY@") +set(CTEST_SOURCE_DIRECTORY "@DASHBOARDSCRIPT_SOURCE_DIRECTORY@") +set(DASH_TYPE "@DASHBOARDSCRIPT_DASH_TYPE@") +set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/build-${DASH_TYPE}") + +set(CTEST_NOTES_FILES + "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}" + "${CTEST_DASHBOARD_ROOT}/GeneratedCombinedCache.${CTEST_SCRIPT_NAME}") + +set(CTEST_BUILD_NAME "@BUILDNAME@") +set(CTEST_SITE "@SITE@") + +set(CTEST_USE_LAUNCHERS TRUE) + +set(CTEST_COMMAND "@DASHBOARDSCRIPT_CTEST_EXECUTABLE@") +set(CTEST_CMAKE_COMMAND "@DASHBOARDSCRIPT_CMAKE_COMMAND@") +set(CTEST_UPDATE_TYPE "@UPDATE_TYPE@") +set(CTEST_UPDATE_COMMAND "@UPDATE_COMMAND@") +set(CTEST_UPDATE_OPTIONS "@UPDATE_OPTIONS@") + +if((NOT CTEST_CONFIGURATION_TYPE) OR (NOT CTEST_BUILD_CONFIGURATION)) + set(CTEST_BUILD_CONFIGURATION "@DASHBOARDSCRIPT_BUILD_CONFIGURATION@") + set(CTEST_CONFIGURATION_TYPE "@DASHBOARDSCRIPT_BUILD_CONFIGURATION@") +endif() + + +# Avoid non-ascii characters in tool output. +set(ENV{LC_ALL} C) + +if(EXISTS "${CTEST_DASHBOARD_ROOT}/GeneratedInitialCache.${CTEST_SCRIPT_NAME}") + file(READ "${CTEST_DASHBOARD_ROOT}/GeneratedInitialCache.${CTEST_SCRIPT_NAME}" _initcache) +else() + set(_initcache) +endif() + +if(EXISTS "${CTEST_DASHBOARD_ROOT}/CustomInitialCache.cmake") + file(READ "${CTEST_DASHBOARD_ROOT}/CustomInitialCache.cmake" _customcache) + set(_initcache "${_initcache} +${_customcache}") +endif() +set(_initcache "# This file is automatically regenerated every dashboard build - +# Do not edit it directly! +# If you want to add initial cache values, you can create/modify +# the CustomInitialCache.cmake file in this directory. + +# Pretty typical settings to preseve from the generating cache +set(BUILD_TESTING ON CACHE BOOL docstring) +set(IN_DASHBOARD_SCRIPT ON CACHE BOOL docstring) +set(CTEST_USE_LAUNCHERS ON CACHE BOOL docstring) +set(CMAKE_PREFIX_PATH \"@CMAKE_PREFIX_PATH@\" CACHE STRING docstring) +set(CMAKE_BUILD_TYPE \"@CMAKE_BUILD_TYPE@\" CACHE STRING docstring) +set(CTEST_CONFIGURATION_TYPE \"@CMAKE_BUILD_TYPE@\" CACHE STRING docstring) + +# testing tool locations +# Saved here because the tools in the path might be outdated +set(CPPCHECK_EXECUTABLE \"@CPPCHECK_EXECUTABLE@\" CACHE FILEPATH docstring) +set(DOXYGEN_EXECUTABLE \"@DOXYGEN_EXECUTABLE@\" CACHE FILEPATH docstring) + +${_initcache}") + +file(WRITE "${CTEST_DASHBOARD_ROOT}/GeneratedCombinedCache.${CTEST_SCRIPT_NAME}" "${_initcache}") + +ctest_empty_binary_directory("${CTEST_BINARY_DIRECTORY}") + +ctest_start(${DASH_TYPE}) + +if(CTEST_UPDATE_COMMAND AND NOT DASH_TYPE STREQUAL "Experimental") + ctest_update(SOURCE "${CTEST_SOURCE_DIRECTORY}" RETURN_VALUE res) +endif() + +# Only proceed if we updated a file or if we're not a continuous build +set(PROCEED NO) +if(res GREATER 0) + message(STATUS "One or more files were updated, so we will proceed to " + "and build") + set(PROCEED YES) +endif() + +if(NOT DASH_TYPE STREQUAL "Continuous") + message(STATUS "We are not a continuous dashboard, so continuing regardless " + "of whether any files were updated") + set(PROCEED YES) +endif() + +if(PROCEED) + ctest_configure(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res + OPTIONS "-C${CTEST_DASHBOARD_ROOT}/GeneratedCombinedCache.${CTEST_SCRIPT_NAME}") + if(${res} EQUAL 0) + # Only try to build if we could configure + ctest_build(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) + + # Some tests, like cppcheck tests, don't depend on a successful build + ctest_test(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) + endif() +endif() + +# Always submit results +ctest_submit(RETURN_VALUE res) diff --git a/lib/wiiuse/cmake/DoxygenTargets.cmake b/lib/wiiuse/cmake/DoxygenTargets.cmake new file mode 100644 index 000000000..df7c08812 --- /dev/null +++ b/lib/wiiuse/cmake/DoxygenTargets.cmake @@ -0,0 +1,357 @@ +# - Run doxygen on source files as a custom target +# +# include(DoxygenTargets) +# add_doxygen( [OUTPUT_DIRECTORY ] +# [EXTRA_INPUT ] +# [EXTRA_STRIP_FROM_PATH ] +# [EXTRA_STRIP_FROM_INC_PATH ] +# [INSTALL_DESTINATION +# [INSTALL_COMPONENT ] +# [INSTALL_PDF_NAME ] ] +# [DOC_TARGET ] +# [PROJECT_NUMBER ] +# [NO_WARNINGS] +# [NO_PDF]) +# +# Requires these CMake modules: +# FindDoxygen +# +# 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(__add_doxygen) + return() +endif() +set(__add_doxygen 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(_doxygenmoddir ${CMAKE_CURRENT_LIST_FILE} PATH) + +if(APPLE) + list(APPEND CMAKE_PREFIX_PATH "/usr/texbin") +endif() + +if(NOT DOXYGEN_FOUND) + find_package(Doxygen QUIET) +endif() + +set(DOXYGEN_LATEX "NO") +set(DOXYGEN_PDFLATEX "NO") +set(DOXYGEN_DOT "NO") + +if(DOXYGEN_DOT_EXECUTABLE) + set(DOXYGEN_DOT "YES") +endif() + +find_package(LATEX QUIET) +if(LATEX_COMPILER AND MAKEINDEX_COMPILER) + set(DOXYGEN_LATEX "YES") +endif() + +if(PDFLATEX_COMPILER) + set(DOXYGEN_PDFLATEX "YES") +endif() + +set(_PF86 "ProgramFiles(x86)") +find_program(DOXYGEN_MSCGEN_EXECUTABLE + mscgen + PATHS + "$ENV{ProgramFiles}/Mscgen" + "$ENV{${_PF86}}/Mscgen" + "$ENV{ProgramW6432}/Mscgen") +if(DOXYGEN_MSCGEN_EXECUTABLE) + mark_as_advanced(DOXYGEN_MSCGEN_EXECUTABLE) +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 + set(WARNINGS YES) + set(_nowhere) + set(_curdest _nowhere) + set(_val_args + OUTPUT_DIRECTORY + EXTRA_INPUT + EXTRA_STRIP_FROM_PATH + EXTRA_STRIP_FROM_INC_PATH + DOC_TARGET + INSTALL_DESTINATION + INSTALL_COMPONENT + INSTALL_PDF_NAME + PROJECT_NUMBER) + set(_bool_args + NO_WARNINGS + NO_PDF) + foreach(_arg ${_val_args} ${_bool_args}) + set(${_arg}) + endforeach() + foreach(_element ${ARGN}) + list(FIND _val_args "${_element}" _val_arg_find) + list(FIND _bool_args "${_element}" _bool_arg_find) + if("${_val_arg_find}" GREATER "-1") + set(_curdest "${_element}") + elseif("${_bool_arg_find}" GREATER "-1") + set("${_element}" ON) + set(_curdest _nowhere) + else() + list(APPEND ${_curdest} "${_element}") + endif() + endforeach() + + if(_nowhere) + message(FATAL_ERROR "Syntax error in use of add_doxygen!") + endif() + + if(NO_WARNINGS) + set(WARNINGS NO) + endif() + + if(NOT DOC_TARGET) + set(DOC_TARGET doc) + endif() + + if(NOT OUTPUT_DIRECTORY) + set(OUTPUT_DIRECTORY "docs-generated") + endif() + + file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_DIRECTORY}") + + if(NOT INSTALL_PDF_NAME) + set(INSTALL_PDF_NAME "docs-generated.pdf") + endif() + + if(NOT PROJECT_NUMBER) + set(PROJECT_NUMBER "${CPACK_PACKAGE_VERSION}") + endif() + + if(DOXYGEN_FOUND) + if(TARGET ${DOC_TARGET}) + message(FATAL_ERROR "Documentation target ${DOC_TARGET} already exists!") + endif() + + if(NOT IS_ABSOLUTE "${OUTPUT_DIRECTORY}") + get_filename_component(OUTPUT_DIRECTORY + "${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_DIRECTORY}" + ABSOLUTE) + endif() + + set_property(DIRECTORY + APPEND + PROPERTY + ADDITIONAL_MAKE_CLEAN_FILES + "${OUTPUT_DIRECTORY}/html" + "${OUTPUT_DIRECTORY}/latex") + + if(NOT TARGET ${DOC_TARGET}_open) + # Create a target to open the generated HTML file. + if(WIN32) + set(DOXYGEN_LAUNCHER_COMMAND start) + elseif(NOT APPLE) + set(DOXYGEN_LAUNCHER_COMMAND xdg-open) + endif() + if(DOXYGEN_LAUNCHER_COMMAND) + add_custom_target(${DOC_TARGET}_open + COMMAND ${DOXYGEN_LAUNCHER_COMMAND} "${OUTPUT_DIRECTORY}/html/index.html" + VERBATIM) + set_target_properties(${DOC_TARGET}_open + PROPERTIES + EXCLUDE_FROM_ALL + TRUE) + set_target_properties(${DOC_TARGET}_open + PROPERTIES + EXCLUDE_FROM_DEFAULT_BUILD + TRUE) + add_dependencies(${DOC_TARGET}_open ${DOC_TARGET}) + endif() + endif() + + get_filename_component(_doxyfileabs "${_doxyfile}" ABSOLUTE) + get_filename_component(INCLUDE_FILE "${_doxyfileabs}" NAME) + get_filename_component(INCLUDE_PATH "${_doxyfileabs}" PATH) + + # Doesn't currently work on Windows, so don't bother + if(DOXYGEN_LATEX AND NOT NO_PDF AND NOT WIN32) + set(MAKE_PDF YES) + set(GENERATE_LATEX YES) + else() + set(MAKE_PDF NO) + set(GENERATE_LATEX NO) + endif() + + if(DOXYGEN_PDFLATEX AND MAKE_PDF) + set(USE_PDFLATEX YES) + else() + set(USE_PDFLATEX NO) + endif() + + if(DOXYGEN_DOT) + set(HAVE_DOT YES) + set(DOT_PATH ${DOXYGEN_DOT_PATH}) + else() + set(HAVE_DOT NO) + set(DOT_PATH) + endif() + + if(DOXYGEN_MSCGEN_EXECUTABLE) + get_filename_component(MSCGEN_PATH "${DOXYGEN_MSCGEN_EXECUTABLE}" PATH) + endif() + + # See http://www.cmake.org/pipermail/cmake/2006-August/010786.html + # for info on this variable + if("${CMAKE_BUILD_TOOL}" MATCHES "(msdev|devenv)") + set(WARN_FORMAT "\"$file($line) : $text \"") + else() + set(WARN_FORMAT "\"$file:$line: $text \"") + endif() + + configure_file("${_doxygenmoddir}/DoxygenTargets.doxyfile.in" + "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.${DOC_TARGET}.additional" + @ONLY) + + if(IN_DASHBOARD_SCRIPT) + set(ALL_IN_DASHBOARD ALL) + else() + set(ALL_IN_DASHBOARD) + endif() + + add_custom_target(${DOC_TARGET} ${ALL_IN_DASHBOARD} + COMMAND + "${DOXYGEN_EXECUTABLE}" + "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.${DOC_TARGET}.additional" + WORKING_DIRECTORY + "${CMAKE_CURRENT_SOURCE_DIR}" + #MAIN_DEPENDENCY ${DOC_TARGET} + COMMENT + "Running Doxygen with configuration ${_doxyfile}..." + VERBATIM) + + if(NOT IN_DASHBOARD_SCRIPT) + set_target_properties(${DOC_TARGET} + PROPERTIES + EXCLUDE_FROM_ALL + TRUE) + set_target_properties(${DOC_TARGET} + PROPERTIES + EXCLUDE_FROM_DEFAULT_BUILD + TRUE) + endif() + if(MAKE_PDF) + add_custom_command(TARGET + ${DOC_TARGET} + POST_BUILD + COMMAND + ${CMAKE_MAKE_PROGRAM} + WORKING_DIRECTORY + "${OUTPUT_DIRECTORY}/latex" + COMMENT + "Generating PDF using PDFLaTeX..." + VERBATIM) + endif() + + if(INSTALL_DESTINATION) + if(INSTALL_COMPONENT) + _dt_install_dir("${DOC_TARGET}" "${OUTPUT_DIRECTORY}/html" "${INSTALL_DESTINATION}" "${INSTALL_COMPONENT}") + if(MAKE_PDF) + _dt_install_file("${DOC_TARGET}" "${OUTPUT_DIRECTORY}/latex/refman.pdf" "${INSTALL_DESTINATION}" "${INSTALL_PDF_NAME}" "${INSTALL_COMPONENT}") + endif() + + else() + _dt_install_dir("${DOC_TARGET}" "${OUTPUT_DIRECTORY}/html" "${INSTALL_DESTINATION}") + if(MAKE_PDF) + _dt_install_file("${DOC_TARGET}" "${OUTPUT_DIRECTORY}/latex/refman.pdf" "${INSTALL_DESTINATION}" "${INSTALL_PDF_NAME}") + endif() + endif() + endif() + + endif() +endfunction() diff --git a/lib/wiiuse/cmake/DoxygenTargets.doxyfile.in b/lib/wiiuse/cmake/DoxygenTargets.doxyfile.in new file mode 100644 index 000000000..3cf36aba6 --- /dev/null +++ b/lib/wiiuse/cmake/DoxygenTargets.doxyfile.in @@ -0,0 +1,23 @@ +@INCLUDE_PATH = "@INCLUDE_PATH@" +@INCLUDE = "@INCLUDE_FILE@" + +OUTPUT_DIRECTORY = "@OUTPUT_DIRECTORY@" +GENERATE_LATEX = "@GENERATE_LATEX@" +USE_PDFLATEX = @USE_PDFLATEX@ +HAVE_DOT = @HAVE_DOT@ +DOT_PATH = "@DOT_PATH@" +MSCGEN_PATH = "@MSCGEN_PATH@" +LATEX_CMD_NAME = "@LATEX_COMPILER@" +MAKEINDEX_CMD_NAME = "@MAKEINDEX_COMPILER@" + +WARNINGS = @WARNINGS@ +WARN_FORMAT = @WARN_FORMAT@ + +PROJECT_NUMBER = @PROJECT_NUMBER@ + +INPUT += @EXTRA_INPUT@ +STRIP_FROM_PATH += @EXTRA_STRIP_FROM_PATH@ +STRIP_FROM_INC_PATH += @EXTRA_STRIP_FROM_INC_PATH@ + +LATEX_BATCHMODE = YES +QUIET = YES diff --git a/lib/wiiuse/cmake/EnableExtraCompilerWarnings.cmake b/lib/wiiuse/cmake/EnableExtraCompilerWarnings.cmake new file mode 100644 index 000000000..4c0e5c78d --- /dev/null +++ b/lib/wiiuse/cmake/EnableExtraCompilerWarnings.cmake @@ -0,0 +1,88 @@ +# - Add flags to compile with extra warnings +# +# enable_extra_compiler_warnings() +# globally_enable_extra_compiler_warnings() - to modify CMAKE_CXX_FLAGS, etc +# to change for all targets declared after the command, instead of per-command +# +# +# Original Author: +# 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(__enable_extra_compiler_warnings) + return() +endif() +set(__enable_extra_compiler_warnings YES) + +macro(_enable_extra_compiler_warnings_flags) + set(_flags) + if(MSVC) + option(COMPILER_WARNINGS_EXTREME + "Use compiler warnings that are probably overkill." + off) + mark_as_advanced(COMPILER_WARNINGS_EXTREME) + set(_flags "/W4") + if(COMPILER_WARNINGS_EXTREME) + set(_flags "${_flags} /Wall /wd4619 /wd4668 /wd4820 /wd4571 /wd4710") + endif() + else() + include(CheckCXXCompilerFlag) + set(_flags) + + check_cxx_compiler_flag(-W SUPPORTS_W_FLAG) + if(SUPPORTS_W_FLAG) + set(_flags "${_flags} -W") + endif() + + check_cxx_compiler_flag(-Wall SUPPORTS_WALL_FLAG) + if(SUPPORTS_WALL_FLAG) + set(_flags "${_flags} -Wall") + endif() + + check_cxx_compiler_flag(-Wextra SUPPORTS_WEXTRA_FLAG) + if(SUPPORTS_WEXTRA_FLAG) + 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() + +function(enable_extra_compiler_warnings _target) + _enable_extra_compiler_warnings_flags() + get_target_property(_origflags ${_target} COMPILE_FLAGS) + if(_origflags) + set_property(TARGET + ${_target} + PROPERTY + COMPILE_FLAGS + "${_flags} ${_origflags}") + else() + set_property(TARGET + ${_target} + PROPERTY + COMPILE_FLAGS + "${_flags}") + endif() + +endfunction() + +function(globally_enable_extra_compiler_warnings) + _enable_extra_compiler_warnings_flags() + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_flags}" PARENT_SCOPE) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_flags}" PARENT_SCOPE) +endfunction() diff --git a/lib/wiiuse/cmake/EnableProfiling.cmake b/lib/wiiuse/cmake/EnableProfiling.cmake new file mode 100644 index 000000000..e2a340f7c --- /dev/null +++ b/lib/wiiuse/cmake/EnableProfiling.cmake @@ -0,0 +1,56 @@ +# - Add flags to compile with profiling support - currently only for GCC +# +# enable_profiling() +# globally_enable_profiling() - to modify CMAKE_CXX_FLAGS, etc +# to change for all targets declared after the command, instead of per-command +# +# +# Original Author: +# 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(__enable_profiling) + return() +endif() +set(__enable_profiling YES) + +macro(_enable_profiling_flags) + set(_flags) + if(MSVC) + # TODO: what kind of flags are needed to profile on MSVC? + #set(_flags /W4) + elseif(CMAKE_COMPILER_IS_GNUCXX) + set(_flags "-p") + endif() +endmacro() + +function(enable_profiling _target) + _enable_profiling_flags() + get_target_property(_origflags ${_target} COMPILE_FLAGS) + if(_origflags) + set_property(TARGET + ${_target} + PROPERTY + COMPILE_FLAGS + "${_flags} ${_origflags}") + else() + set_property(TARGET + ${_target} + PROPERTY + COMPILE_FLAGS + "${_flags}") + endif() + +endfunction() + +function(globally_enable_profiling) + _enable_profiling_flags() + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_flags}" PARENT_SCOPE) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_flags}" PARENT_SCOPE) +endfunction() diff --git a/lib/wiiuse/cmake/FileCopyTargets.cmake b/lib/wiiuse/cmake/FileCopyTargets.cmake new file mode 100644 index 000000000..13eb11a4e --- /dev/null +++ b/lib/wiiuse/cmake/FileCopyTargets.cmake @@ -0,0 +1,103 @@ +# - Add a target for files that just need to be copied +# +# include(FileCopyTargets) +# add_file_copy_target( [...]) +# Creates a custom target that copies the files to a directory, if needed. +# Relative paths for the destination directory are considered with +# with respect to CMAKE_CURRENT_BINARY_DIR +# You can use this target in all the usual ways, including +# add_dependencies(some_other_target this_target) to specify that another +# target depends on this. +# +# install_file_copy_target( [arguments to INSTALL(PROGRAMS ...) ]) +# Works just the same as INSTALL(PROGRAMS ...) because it wraps it to install +# the files you specified in add_file_copy_target +# +# +# 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(__add_file_copy_target) + return() +endif() +set(__add_file_copy_target YES) + +define_property(TARGET + PROPERTY + FILE_COPY_TARGET + BRIEF_DOCS + "File Copy target" + FULL_DOCS + "Is this a target created by add_file_copy_target?") + +function(add_file_copy_target _target _dest) + if(NOT ARGN) + message(WARNING + "In add_file_copy_target call for target ${_target}, no source files were specified!") + return() + endif() + + set(ALLFILES) + set(SOURCES) + foreach(fn ${ARGN}) + # Produce an absolute path to the input file + if(IS_ABSOLUTE "${fn}") + get_filename_component(fullpath "${fn}" ABSOLUTE) + get_filename_component(fn "${fn}" NAME) + else() + get_filename_component(fullpath + "${CMAKE_CURRENT_SOURCE_DIR}/${fn}" + ABSOLUTE) + endif() + + # Clean up output file name + get_filename_component(absout "${_dest}/${fn}" ABSOLUTE) + + add_custom_command(OUTPUT "${absout}" + COMMAND + ${CMAKE_COMMAND} + ARGS -E make_directory "${_dest}" + COMMAND + ${CMAKE_COMMAND} + ARGS -E copy "${fullpath}" "${_dest}" + MAIN_DEPENDENCY "${fullpath}" + VERBATIM + COMMENT "Copying ${fn} to ${absout}") + list(APPEND SOURCES "${fullpath}") + list(APPEND ALLFILES "${absout}") + endforeach() + + # Custom target depending on all the file copy commands + add_custom_target(${_target} + SOURCES ${SOURCES} + DEPENDS ${ALLFILES}) + + set_property(TARGET ${_target} PROPERTY FILE_COPY_TARGET YES) +endfunction() + +function(install_file_copy_target _target) + get_target_property(_isFCT ${_target} FILE_COPY_TARGET) + if(NOT _isFCT) + message(WARNING + "install_file_copy_target called on a target not created with add_file_copy_target!") + return() + endif() + + # Get sources + get_target_property(_srcs ${_target} SOURCES) + + # Remove the "fake" file forcing build + list(REMOVE_AT _srcs 0) + + # Forward the call to install + install(PROGRAMS ${_srcs} ${ARGN}) +endfunction() diff --git a/lib/wiiuse/cmake/FindALUT.cmake b/lib/wiiuse/cmake/FindALUT.cmake new file mode 100644 index 000000000..48d062d70 --- /dev/null +++ b/lib/wiiuse/cmake/FindALUT.cmake @@ -0,0 +1,136 @@ +# - try to find the OpenAL ALUT library +# +# Users may optionally supply: +# ALUT_ROOT_DIR - a prefix to start searching. +# +# Cache Variables: (probably not for direct use in your scripts) +# ALUT_INCLUDE_DIR +# ALUT_LIBRARY +# +# Non-cache variables you might use in your CMakeLists.txt: +# ALUT_FOUND +# ALUT_INCLUDE_DIRS +# ALUT_LIBRARIES +# ALUT_WORKAROUND_INCLUDE_DIRS - add these to your include path with +# include_directories(${ALUT_WORKAROUND_INCLUDE_DIRS} ${ALUT_INCLUDE_DIRS}) +# so you can always #include and #include even on +# Mac where the paths might differ. +# +# 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) + +set(ALUT_ROOT_DIR + "${ALUT_ROOT_DIR}" + CACHE + PATH + "Path to search for ALUT library") + +# Share search paths with OpenAL +if(NOT "$ENV{OPENALDIR}" STREQUAL "") + if(NOT ALUT_ROOT_DIR) + set(ALUT_ROOT_DIR "$ENV{OPENALDIR}") + endif() +else() + if(ALUT_ROOT_DIR) + set(ENV{OPENALDIR} "${ALUT_ROOT_DIR}") + endif() +endif() + + + +### +# Configure ALUT +### +find_path(ALUT_INCLUDE_DIR + NAMES + alut.h + HINTS + "${ALUT_ROOT_DIR}" + PATH_SUFFIXES + AL + alut + OpenAL + include + include/alut + include/freealut + include/AL + include/OpenAL + PATHS + /usr/local + /opt/local + /sw) +mark_as_advanced(ALUT_INCLUDE_DIR) + +find_library(ALUT_LIBRARY + NAMES + alut + HINTS + "${ALUT_ROOT_DIR}" + PATH_SUFFIXES + lib + lib64 + PATHS + /usr/local + /opt/local + /sw) +mark_as_advanced(ALUT_LIBRARY) + +### +# Prereq: OpenAL +### + +# On Mac OS X, the ALUT headers were in the OpenAL framework until 10.4.7 +# If we found ALUT headers elsewhere, it's probably freealut which may +# define the same symbols as the library in the framework (?) +# so we might want to save/restore the CMake variable that controls searching +# in frameworks +find_package(OpenAL QUIET) + +# 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(ALUT + DEFAULT_MSG + ALUT_LIBRARY + ALUT_INCLUDE_DIR + OPENAL_FOUND) + +if(ALUT_FOUND) + set(ALUT_INCLUDE_DIRS "${OPENAL_INCLUDE_DIR}" "${ALUT_INCLUDE_DIR}") + set(ALUT_LIBRARIES "${OPENAL_LIBRARY}" ${ALUT_LIBRARY}) + if(APPLE) + get_filename_component(_moddir ${CMAKE_CURRENT_LIST_FILE} PATH) + if("${OPENAL_INCLUDE_DIR}" MATCHES "\\.framework$") + # OpenAL is in a framework - need a workaround + set(OPENAL_WORKAROUND_INCLUDE_DIR + "${_moddir}/workarounds/mac-openal") + list(APPEND + ALUT_WORKAROUND_INCLUDE_DIRS + "${OPENAL_WORKAROUND_INCLUDE_DIR}") + endif() + if("${ALUT_INCLUDE_DIR}" MATCHES "\\.framework$") + # ALUT is in the OpenAL framework - need a workaround + set(ALUT_WORKAROUND_INCLUDE_DIR + "${_moddir}/workarounds/mac-alut-framework") + list(APPEND + ALUT_WORKAROUND_INCLUDE_DIRS + "${ALUT_WORKAROUND_INCLUDE_DIR}") + endif() + endif() + + if("${ALUT_INCLUDE_DIR}" MATCHES "AL$") + get_filename_component(_parent "${ALUT_INCLUDE_DIR}/.." ABSOLUTE) + list(APPEND ALUT_INCLUDE_DIRS "${_parent}") + endif() + mark_as_advanced(ALUT_ROOT_DIR) +endif() diff --git a/lib/wiiuse/cmake/FindAdrienne.cmake b/lib/wiiuse/cmake/FindAdrienne.cmake new file mode 100644 index 000000000..d4f174c0c --- /dev/null +++ b/lib/wiiuse/cmake/FindAdrienne.cmake @@ -0,0 +1,202 @@ +# - try to find Adrienne Electronics Corporation timecode card library +# +# SDK available from the manufacturer: http://www.adrielec.com/ +# +# Cache Variables: (probably not for direct use in your scripts) +# ADRIENNE_INCLUDE_DIR +# ADRIENNE_LIBRARY +# ADRIENNE_RUNTIME_LIBRARY +# ADRIENNE_INCLUDE_FILE +# +# Variables you might use in your CMakeLists.txt: +# ADRIENNE_FOUND +# ADRIENNE_INCLUDE_DIRS +# ADRIENNE_LIBRARIES +# ADRIENNE_RUNTIME_LIBRARIES - the AEC_NTTC.dll file +# ADRIENNE_RUNTIME_LIBRARY_DIRS +# +# ADRIENNE_INCLUDE_FILENAME - this is probably AEC_NTTC.h, but it might also +# be AECINTTC.H. +# +# ADRIENNE_INCLUDE_HAS_EXTERN_C - Some (most) versions of the header already +# wrap their definitions in extern "C" { }, but some do not. +# +# ADRIENNE_DEFINITIONS - defines a quoted ADRIENNE_INCLUDE_FILENAME as above, +# so you can write a line like #include ADRIENNE_INCLUDE_FILENAME +# Also defines ADRIENNE_BEFORE_INCLUDE and ADRIENNE_AFTER_INCLUDE to handle +# adding extern "C" { and } if the header file doesn't do so itself. +# +# Variables that might be set by the user in the gui/command line to help +# find the library: +# ADRIENNE_ROOT_DIR - root of an Adrienne CD, disk, or extracted/copied contents +# thereof. +# +# Requires these CMake modules: +# FindPackageHandleStandardArgs (known included with CMake >=2.6.2) +# +# Original Author: +# 2012 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 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) + +# Apparently Windows only. +if(WIN32 OR CYGWIN) + set(ADRIENNE_ROOT_DIR + "${ADRIENNE_ROOT_DIR}" + CACHE + PATH + "Directory to search for Adrienne Electronics Timecode data - root of a software distribution or extracted download from http://www.adrielec.com/") + + set(ADRIENNE_DEFINITIONS) + + set(ADRIENNE_INCLUDE_SEARCH + # from AecPCIeTC_8-12a: contains AEC_NTTC.h with extern "C" and three extra functions: + # AEC_PCTC_OPEN_ALL, AEC_PCTC_CLOSE_ALL, AEC_PCTC_INITIALIZE_EVENT + "SDK_SourceCode" + + # from AecPci6_02_CD - called AECINTTC.H but otherwise essentially identical to earlier versions + "TestPrograms_WithDLL/DLL_API_INFO" + # A zipped development project contains essentially the same, named AEC_NTTC.h so we'll add this in case it's unzipped. + "TestPrograms_WithDLL/ZippedDevelopmentProjects/AecMfc32_Rel504" + + # from pc-ltc - called AECINTTC.H and lacks extern "C" + "NT-CODE/C40-APP1" + ) + set(ADRIENNE_HEADER_NAMES + AEC_NTTC.H + AEC_NTTC.h + Aec_nttc.h + AECINTTC.H) + + set(ADRIENNE_LIB_SEARCH) + set(ADRIENNE_DLL_SEARCH) + + if(CMAKE_SIZEOF_VOID_P MATCHES "8") + # 64 bit code - apparently initially packaged only in the + # PCIe version of their software + list(APPEND ADRIENNE_LIB_SEARCH + # from AecPCIeTC_8-12a + "64BitOS_files/DLL Versions") + + list(APPEND ADRIENNE_DLL_SEARCH + # from AecPCIeTC_8-12a + "64BitOS_files/DLL Versions") + else() + # 32-bit code, much more prevalent. + list(APPEND ADRIENNE_LIB_SEARCH + # from AecPCIeTC_8-12a + "32BitOS_files/DLLversions" + + # from AecPci6_02_CD + "TestPrograms_WithDLL/DLL_API_INFO" + + # from pc-ltc + "NT-CODE/DLL" + ) + + list(APPEND ADRIENNE_DLL_SEARCH + # from AecPCIeTC_8-12a + "32BitOS_files/DLLversions" + + # from AecPci6_02_CD + "TestPrograms_WithDLL" + + # from pc-ltc + "NT-CODE/DLL") + endif() + + find_library(ADRIENNE_LIBRARY + NAMES + AEC_NTTC + PATHS + "${ADRIENNE_ROOT_DIR}" + PATH_SUFFIXES + ${ADRIENNE_LIB_SEARCH}) + + find_path(ADRIENNE_INCLUDE_DIR + NAMES + ${ADRIENNE_HEADER_NAMES} + PATHS + "${ADRIENNE_ROOT_DIR}" + PATH_SUFFIXES + ${ADRIENNE_INCLUDE_SEARCH}) + + if(ADRIENNE_INCLUDE_DIR) + find_file(ADRIENNE_INCLUDE_FILE + NAMES + ${ADRIENNE_HEADER_NAMES} + HINTS + ${ADRIENNE_INCLUDE_DIR}) + + # Get include filename + get_filename_component(ADRIENNE_INCLUDE_FILENAME + "${ADRIENNE_INCLUDE_FILE}" + NAME) + list(APPEND ADRIENNE_DEFINITIONS -DADRIENNE_INCLUDE_FILENAME="ADRIENNE_INCLUDE_FILENAME") + + # Find out if it has extern "C" in it. + file(STRINGS "${ADRIENNE_INCLUDE_FILE}" strings) + set(ADRIENNE_INCLUDE_HAS_EXTERN_C OFF) + foreach(_line ${strings}) + if("${_line}" STREQUAL "extern \"C\"") + set(ADRIENNE_INCLUDE_HAS_EXTERN_C ON) + break() + endif() + endforeach() + + if(ADRIENNE_INCLUDE_HAS_EXTERN_C) + list(APPEND ADRIENNE_DEFINITIONS -DADRIENNE_BEFORE_INCLUDE -DADRIENNE_AFTER_INCLUDE) + else() + list(APPEND ADRIENNE_DEFINITIONS "-DADRIENNE_BEFORE_INCLUDE=extern \"C\" {" "-DADRIENNE_AFTER_INCLUDE=}") + endif() + endif() + + get_filename_component(_adrienne_libdir "${ADRIENNE_LIBRARY}" PATH) + find_file(ADRIENNE_RUNTIME_LIBRARY + NAMES + AEC_NTTC.dll + HINTS + "${_adrienne_libdir}" + "${_adrienne_libdir}/.." + PATHS + "${ADRIENNE_ROOT_DIR}" + PATH_SUFFIXES + ${ADRIENNE_DLL_SEARCH}) + + + set(ADRIENNE_RUNTIME_LIBRARIES "${ADRIENNE_RUNTIME_LIBRARY}") + get_filename_component(ADRIENNE_RUNTIME_LIBRARY_DIRS + "${ADRIENNE_RUNTIME_LIBRARY}" + PATH) + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(Adrienne + DEFAULT_MSG + ADRIENNE_LIBRARY + ADRIENNE_RUNTIME_LIBRARY + ADRIENNE_INCLUDE_DIR + ADRIENNE_INCLUDE_FILENAME) + + if(ADRIENNE_FOUND) + set(ADRIENNE_LIBRARIES "${ADRIENNE_LIBRARY}") + set(ADRIENNE_INCLUDE_DIRS "${ADRIENNE_INCLUDE_DIR}") + mark_as_advanced(ADRIENNE_ROOT_DIR) + endif() + + mark_as_advanced( + ADRIENNE_LIBRARY + ADRIENNE_RUNTIME_LIBRARY + ADRIENNE_INCLUDE_DIR + ADRIENNE_INCLUDE_FILE) +else() + set(ADRIENNE_FOUND OFF) + set(ADRIENNE_SDK_IS_WINDOWS_ONLY NOTFOUND) + find_package_handle_standard_args(Adrienne + DEFAULT_MSG + ADRIENNE_SDK_IS_WINDOWS_ONLY) +endif() diff --git a/lib/wiiuse/cmake/FindBluez.cmake b/lib/wiiuse/cmake/FindBluez.cmake new file mode 100644 index 000000000..f4f8e0d10 --- /dev/null +++ b/lib/wiiuse/cmake/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/lib/wiiuse/cmake/FindCPPDOM.cmake b/lib/wiiuse/cmake/FindCPPDOM.cmake new file mode 100644 index 000000000..449ab73a5 --- /dev/null +++ b/lib/wiiuse/cmake/FindCPPDOM.cmake @@ -0,0 +1,216 @@ +# - try to find CPPDOM library +# Optionally uses Flagpoll and FindFlagpoll.cmake +# +# CPPDOM_LIBRARY_DIR, library search path +# CPPDOM_INCLUDE_DIR, include search path +# CPPDOM_LIBRARY, the library to link against +# CPPDOM_CXX_FLAGS +# CPPDOM_FOUND, If false, do not try to use this library. +# +# Useful configuration variables you might want to add to your cache: +# CPPDOM_ROOT_DIR - A directory prefix to search +# (a path that contains include/ as a subdirectory) +# CPPDOM_ADDITIONAL_VERSIONS - Additional versions (outside of 0.7.8 to 1.2.0) +# to use when constructing search names and paths +# +# This script will use Flagpoll, if found, to provide hints to the location +# of this library, but does not use the compiler flags returned by Flagpoll +# directly. +# +# VR Juggler requires this package, so this Find script takes that into +# account when determining where to search for the desired files. +# The VJ_BASE_DIR environment variable is searched (preferentially) +# when searching for this package, so most sane VR Juggler build environments +# should "just work." Note that you need to manually re-run CMake if you +# change this environment variable, because it cannot auto-detect this change +# and trigger an automatic re-run. +# +# Original Author: +# 2009-2012 Ryan Pavlik +# 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(_HUMAN "cppdom") +set(_HEADER cppdom/cppdom.h) +set(_FP_PKG_NAME cppdom) + +set(CPPDOM_VERSIONS + ${CPPDOM_ADDITIONAL_VERSIONS} + 1.3.0 + 1.2.0 + 1.1.2 + 1.1.1 + 1.1.0 + 1.0.3 + 1.0.2 + 1.0.1 + 1.0.0 + 0.7.10 + 0.7.9 + 0.7.8) +set(CPPDOM_DIRS) +set(CPPDOM_RELEASE_LIB_NAMES) +set(CPPDOM_DEBUG_LIB_NAMES) +foreach(_version ${CPPDOM_VERSIONS}) + string(REGEX REPLACE "[-\\.]" "_" _versionclean ${_version}) + list(APPEND CPPDOM_DIRS cppdom-${_version}) + list(APPEND CPPDOM_HEADER_DIRS include/cppdom-${_version}) + list(APPEND CPPDOM_RELEASE_LIB_NAMES cppdom-${_versionclean}) + list(APPEND CPPDOM_DEBUG_LIB_NAMES cppdom_d-${_versionclean}) +endforeach() + +include(SelectLibraryConfigurations) +include(CreateImportedTarget) +include(CleanLibraryList) +include(CleanDirectoryList) +include(FindPackageHandleStandardArgs) + +# Handle the case where a recent cppdom is supplying its own cmake config file. +option(CPPDOM_ATTEMPT_CMAKE_MODULE "Should we attempt to use CPPDOM's own CMake module for configuration?" ON) +mark_as_advanced(CPPDOM_ATTEMPT_CMAKE_MODULE) +if(NOT cppdom_FOUND) + find_package(cppdom QUIET NO_MODULE) + if(cppdom_FOUND) + set(CPPDOM_LIBRARIES ${cppdom_LIBRARIES}) + set(CPPDOM_INCLUDE_DIRS ${cppdom_INCLUDE_DIRS}) + find_package_handle_standard_args(CPPDOM + DEFAULT_MSG + CPPDOM_LIBRARIES + CPPDOM_INCLUDE_DIRS) + return() + endif() +endif() + +if(CPPDOM_INCLUDE_DIRS AND CPPDOM_LIBRARIES) + # in cache already + set(CPPDOM_FIND_QUIETLY TRUE) +endif() + +# Try flagpoll. +find_package(Flagpoll QUIET) + +if(FLAGPOLL) + flagpoll_get_include_dirs(${_FP_PKG_NAME} NO_DEPS) + flagpoll_get_library_dirs(${_FP_PKG_NAME} NO_DEPS) + flagpoll_get_library_names(${_FP_PKG_NAME} NO_DEPS) +endif() + +set(CPPDOM_ROOT_DIR + "${CPPDOM_ROOT_DIR}" + CACHE + PATH + "Root directory to search for CPPDOM") +if(DEFINED VRJUGGLER22_ROOT_DIR) + mark_as_advanced(CPPDOM_ROOT_DIR) +endif() +if(NOT CPPDOM_ROOT_DIR) + if(VRJUGGLER22_ROOT_DIR) + set(CPPDOM_ROOT_DIR "${VRJUGGLER22_ROOT_DIR}") + elseif(VRJUGGLER30_ROOT_DIR) + set(CPPDOM_ROOT_DIR "${VRJUGGLER30_ROOT_DIR}") + endif() +endif() + +set(_ROOT_DIR "${CPPDOM_ROOT_DIR}") + +if(CMAKE_SIZEOF_VOID_P MATCHES "8") + set(_VRJ_LIBSUFFIXES lib64 lib) + set(_VRJ_LIBDSUFFIXES + debug + lib64/x86_64/debug + lib64/debug + lib64 + lib/x86_64/debug + lib/debug + lib) + set(_VRJ_LIBDSUFFIXES_ONLY + debug + lib64/x86_64/debug + lib64/debug + lib/x86_64/debug + lib/debug) +else() + set(_VRJ_LIBSUFFIXES lib) + set(_VRJ_LIBDSUFFIXES debug lib/i686/debug lib/debug lib) + set(_VRJ_LIBDSUFFIXES_ONLY debug lib/i686/debug lib/debug) +endif() + +find_path(CPPDOM_INCLUDE_DIR + ${_HEADER} + HINTS + ${_ROOT_DIR} + ${${_FP_PKG_NAME}_FLAGPOLL_INCLUDE_DIRS} + PATHS + PATH_SUFFIXES + ${CPPDOM_DIRS} + ${CPPDOM_HEADER_DIRS} + include + DOC + "Path to ${_HUMAN} includes root") + +find_library(CPPDOM_LIBRARY_RELEASE + NAMES + ${CPPDOM_RELEASE_LIB_NAMES} + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_NAMES} + HINTS + ${_ROOT_DIR} + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBSUFFIXES} + DOC + "${_HUMAN} library full path") + +find_library(CPPDOM_LIBRARY_DEBUG + NAMES + ${CPPDOM_DEBUG_LIB_NAMES} + HINTS + ${_ROOT_DIR} + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBDSUFFIXES} + DOC + "${_HUMAN} debug library full path") + +# Fallback to same library name but in the debug folder +if(NOT CPPDOM_LIBRARY_DEBUG) + find_library(CPPDOM_LIBRARY_DEBUG + NAMES + ${CPPDOM_LIB_NAMES} + HINTS + ${CPPDOM_INCLUDE_DIR}/../ + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBDSUFFIXES_ONLY} + NO_DEFAULT_PATH + DOC + "${_HUMAN} debug library full path") +endif() + +if(CPPDOM_LIBRARY_RELEASE OR CPPDOM_LIBRARY_DEBUG) + select_library_configurations(CPPDOM) +endif() + +# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if +# all listed variables are TRUE +find_package_handle_standard_args(CPPDOM + DEFAULT_MSG + CPPDOM_LIBRARY + CPPDOM_INCLUDE_DIR) + +if(CPPDOM_FOUND) + set(CPPDOM_INCLUDE_DIRS ${CPPDOM_INCLUDE_DIR}) + if(MSVC) + set(CPPDOM_CXX_FLAGS "/wd4290") + endif() + + mark_as_advanced(CPPDOM_ROOT_DIR) +endif() + +mark_as_advanced(CPPDOM_LIBRARY_RELEASE + CPPDOM_LIBRARY_DEBUG + CPPDOM_INCLUDE_DIR) diff --git a/lib/wiiuse/cmake/FindColibriApi.cmake b/lib/wiiuse/cmake/FindColibriApi.cmake new file mode 100644 index 000000000..0d7b4ff36 --- /dev/null +++ b/lib/wiiuse/cmake/FindColibriApi.cmake @@ -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 +# 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) diff --git a/lib/wiiuse/cmake/FindDCubed.cmake b/lib/wiiuse/cmake/FindDCubed.cmake new file mode 100644 index 000000000..4ca33d25f --- /dev/null +++ b/lib/wiiuse/cmake/FindDCubed.cmake @@ -0,0 +1,192 @@ +# - try to find DCUBED library +# +# DCUBED_LIBRARY_DIR, library search path +# DCUBED_INCLUDE_DIR, include search path +# DCUBED_{component}_LIBRARY, the library to link against +# DCUBED_ENVIRONMENT +# DCUBED_FOUND, If false, do not try to use this library. +# +# Plural versions refer to this library and its dependencies, and +# are recommended to be used instead, unless you have a good reason. +# +# Useful configuration variables you might want to add to your cache: +# DCUBED_ROOT_DIR - A directory prefix to search +# (a path that contains include/ as a subdirectory) +# +# 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 BITS) + if(CMAKE_SIZEOF_VOID_P MATCHES "8") + set(BITS 64) + else() + set(BITS 32) + endif() +endif() + +if(WIN32 AND MSVC) + include(CMakeDetermineVSServicePack) + determinevsservicepack(_sp) + if(MSVC71) + set(VC_VER vc71) + set(VC_VER_LONG vc71) + elseif(MSVC80) + set(VC_VER vc8) + set(VC_VER_LONG vc80) + # FIXME TODO provide more options here + set(D3BUILD nt8) + if("${_sp}" STREQUAL "vc80sp1") + set(_verstring nt8s1) + else() + set(_verstring nt8) + endif() + elseif(MSVC90) + set(VC_VER vc9) + set(VC_VER_LONG vc90) + set(_verstring nt9) + endif() + + if(BITS EQUAL 32) + set(PLATFORM win32) + else() + set(PLATFORM win64) + endif() +endif() + +if(NOT DCUBED_ROOT_DIR) + if(EXISTS "$ENV{DCUBED}" AND IS_DIRECTORY "$ENV{DCUBED}") + set(DCUBED_ROOT_DIR "$ENV{DCUBED}") + endif() +endif() + +file(TO_CMAKE_PATH "${DCUBED_ROOT_DIR}" DCUBED_ROOT_DIR) + +set(DCUBED_ROOT_DIR + "${DCUBED_ROOT_DIR}" + CACHE + PATH + "Root directory to search for DCubed") + +# Do this by default +if(NOT DEFINED DCUBED_NESTED_TARGETS) + set(DCUBED_NESTED_TARGETS TRUE) +endif() + +set(DCUBED_NESTED_TARGETS + "${DCUBED_NESTED_TARGETS}" + CACHE + BOOL + "Whether we should compile the wrappers as a part of the solution") +mark_as_advanced(DCUBED_NESTED_TARGETS) + +### +# Configure DCubed +### + + +find_path(DCUBED_CORE_INCLUDE_DIR + d3ew_inc/modelgate.hxx + PATHS + "${DCUBED_ROOT_DIR}/inc") + +foreach(lib aem cdmwp d3e_base d3e_cd dcm dcm3 g3) + find_library(DCUBED_${lib}_LIBRARY + ${lib} + PATHS + "${DCUBED_ROOT_DIR}/lib/${_verstring}") + if(DCUBED_${lib}_LIBRARY) + list(APPEND DCUBED_LIBRARIES ${DCUBED_${lib}_LIBRARY}) + list(APPEND DCUBED_CORE_LIBRARIES ${DCUBED_${lib}_LIBRARY}) + endif() + mark_as_advanced(DCUBED_${lib}_LIBRARY) +endforeach() + +find_path(DCUBED_WRAPPER_INCLUDE_DIR + d3ew_p/p_utils.hxx + PATHS + "${DCUBED_ROOT_DIR}/source/wrapper_source/") + +foreach(lib d3ew_p d3ew_scene) + find_library(DCUBED_WRAPPER_${lib}_LIBRARY + ${lib}_${D3BUILD} + PATHS + "${DCUBED_ROOT_DIR}/wrappers/cdmwp/${lib}") + mark_as_advanced(DCUBED_WRAPPER_${lib}_LIBRARY) +endforeach() + +set(_nest_targets) +if(DCUBED_WRAPPER_INCLUDE_DIR) + foreach(lib d3ew_p d3ew_scene) + if(DCUBED_NESTED_TARGETS OR NOT DCUBED_WRAPPER_${lib}_LIBRARY) + if(PARASOLID_FOUND) + set(_nest_targets YES) + set(DCUBED_WRAPPER_${lib}_LIBRARY + "dcubed_wrapper_${lib}_nested_target" + CACHE + STRING + "We will build the DCubed wrapper ${lib} lib." + FORCE) + else() + set(DCUBED_WRAPPER_${lib}_LIBRARY + "NESTED_TARGET_REQUIRES_PARASOLID-NOTFOUND" + CACHE + STRING + "Can't build the DCubed wrapper ${lib} without first finding Parasolid." + FORCE) + endif() + endif() + endforeach() +endif() + +foreach(lib d3ew_p d3ew_scene) + if(DCUBED_WRAPPER_${lib}_LIBRARY) + list(APPEND DCUBED_WRAPPER_LIBRARIES ${DCUBED_WRAPPER_${lib}_LIBRARY}) + endif() +endforeach() + +if(NOT DCUBED_ROOT_DIR) + get_filename_component(_path "${DCUBED_dcm_LIBRARY}" PATH) + get_filename_component(_path "${_path}/../.." ABSOLUTE) + set(DCUBED_ROOT_DIR + "${_path}" + CACHE + PATH + "Root directory to search for DCubed" + FORCE) +endif() + +#file(TO_NATIVE_PATH "${DCUBED_ROOT_DIR}" _d3envdir) +set(DCUBED_ENVIRONMENT "DCUBED=${DCUBED_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(DCubed + DEFAULT_MSG + DCUBED_ROOT_DIR + DCUBED_LIBRARIES + DCUBED_CORE_LIBRARIES + DCUBED_CORE_INCLUDE_DIR + DCUBED_WRAPPER_INCLUDE_DIR + DCUBED_WRAPPER_LIBRARIES) + +if(DCUBED_FOUND) + if(_nest_targets) + get_filename_component(_moddir "${CMAKE_CURRENT_LIST_FILE}" PATH) + add_subdirectory("${_moddir}/nested_targets/DCubed") + endif() + set(DCUBED_INCLUDE_DIRS + "${DCUBED_CORE_INCLUDE_DIR}" + "${DCUBED_CORE_INCLUDE_DIR}/if3" + "${DCUBED_CORE_INCLUDE_DIR}/.." + "${DCUBED_WRAPPER_INCLUDE_DIR}") + mark_as_advanced(DCUBED_ROOT_DIR) +endif() + +mark_as_advanced(DCUBED_CORE_INCLUDE_DIR DCUBED_WRAPPER_INCLUDE_DIR) diff --git a/lib/wiiuse/cmake/FindDirectShow.cmake b/lib/wiiuse/cmake/FindDirectShow.cmake new file mode 100644 index 000000000..1fb33061a --- /dev/null +++ b/lib/wiiuse/cmake/FindDirectShow.cmake @@ -0,0 +1,204 @@ +# - Find Microsoft DirectShow sample files, library, and headers. +# +# DIRECTSHOW_INCLUDE_DIRS - where to find needed include file +# DIRECTSHOW_BASECLASS_DIR- Directory containing the DirectShow baseclass sample code. +# DIRECTSHOW_FOUND - True if DirectShow found. +# +# Requires these CMake modules: +# FindPackageHandleStandardArgs (known included with CMake >=2.6.2) +# +# Initially in VRPN - Distributed under the Boost Software License, Version 1.0. +# +# Almost entirely re-written by: +# 2012 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 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) + +# Look for one of the sample files. + +set(_ds_quiet) +if(DirectShow_FIND_QUIETLY) + set(_ds_quiet QUIET) +endif() +find_package(WindowsSDK ${_ds_quiet}) +find_package(DirectX ${_ds_quiet}) + +set(DIRECTSHOW_WINDOWSSDK_ROOT + "${DIRECTSHOW_WINDOWSSDK_ROOT}" + CACHE + PATH + "A specific Windows SDK to use for DirectShow.") + +if(MSVC AND CMAKE_CL_64) + set(DIRECTSHOW_LIB_SUBDIR /x64) +else() + set(DIRECTSHOW_LIB_SUBDIR) +endif() + +set(_acceptable_winsdk) +if(WINDOWSSDK_FOUND) + foreach(_sdkdir ${WINDOWSSDK_DIRS}) + if(EXISTS "${_sdkdir}/Samples/Multimedia/DirectShow/BaseClasses/streams.h" + AND EXISTS "${_sdkdir}/Lib${DIRECTSHOW_LIB_SUBDIR}/strmiids.lib" + AND EXISTS "${_sdkdir}/Include/DShow.h") + list(APPEND _acceptable_winsdk "${_sdkdir}") + endif() + endforeach() +endif() + +find_path(DIRECTSHOW_BASECLASS_DIR + NAMES + streams.h + HINTS + "${DIRECTSHOW_WINDOWSSDK_ROOT}" + PATHS + ${_acceptable_winsdk} + PATH_SUFFIXES + "Samples/Multimedia/DirectShow/BaseClasses") + +find_path(DIRECTSHOW_WINDOWSSDK_INCLUDE_DIR + NAMES + DShow.h + HINTS + "${DIRECTSHOW_WINDOWSSDK_ROOT}" + PATHS + ${_acceptable_winsdk} + 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 + ${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) + if(_dirs) + list(APPEND DIRECTSHOW_STRMIIDS_SEARCH ${_dirs}) + endif() + endforeach() +endif() + +find_library(DIRECTSHOW_STRMIIDS_LIBRARY + NAMES + strmiids + HINTS + "${DIRECTSHOW_WINDOWSSDK_ROOT}" + PATHS + ${DIRECTSHOW_STRMIIDS_SEARCH} + PATH_SUFFIXES + "Lib${DIRECTSHOW_LIB_SUBDIR}") + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(DirectShow + DEFAULT_MSG + DIRECTSHOW_BASECLASS_DIR + DIRECTSHOW_WINDOWSSDK_INCLUDE_DIR + DIRECTSHOW_QEDIT_INCLUDE_DIR + DIRECTX_INCLUDE_DIR + DIRECTSHOW_STRMIIDS_LIBRARY) + +if(DIRECTSHOW_FOUND) + set(DIRECTSHOW_INCLUDE_DIRS + # Baseclass must be before SDK so it gets the correct refclock.h + "${DIRECTSHOW_BASECLASS_DIR}" + "${DIRECTSHOW_WINDOWSSDK_INCLUDE_DIR}" + "${DIRECTX_INCLUDE_DIR}" + ) + if(EXISTS "${DIRECTSHOW_WINDOWSSDK_INCLUDE_DIR}/atl/atlbase.h") + list(APPEND + DIRECTSHOW_INCLUDE_DIRS + "${DIRECTSHOW_WINDOWSSDK_INCLUDE_DIR}/atl") + endif() + if(NOT "${DIRECTSHOW_QEDIT_INCLUDE_DIR}" STREQUAL "${DIRECTSHOW_WINDOWSSDK_INCLUDE_DIR}") + # QEdit include dir might be an older SDK, so put it last. + list(APPEND DIRECTSHOW_INCLUDE_DIRS "${DIRECTSHOW_QEDIT_INCLUDE_DIR}") + endif() + + set(DIRECTSHOW_LIBRARIES "${DIRECTSHOW_STRMIIDS_LIBRARY}") + + mark_as_advanced(DIRECTSHOW_WINDOWSSDK_ROOT) +endif() + +mark_as_advanced(DIRECTSHOW_BASECLASS_DIR + DIRECTSHOW_WINDOWSSDK_INCLUDE_DIR + DIRECTSHOW_QEDIT_INCLUDE_DIR + DIRECTSHOW_STRMIIDS_LIBRARY) diff --git a/lib/wiiuse/cmake/FindDirectX.cmake b/lib/wiiuse/cmake/FindDirectX.cmake new file mode 100644 index 000000000..d77ca757e --- /dev/null +++ b/lib/wiiuse/cmake/FindDirectX.cmake @@ -0,0 +1,322 @@ +# - try to find part of DirectX SDK +# +# Cache Variables: (probably not for direct use in your scripts) +# DIRECTX_INCLUDE_DIR +# +# Variables you should use in your CMakeLists.txt: +# DIRECTX_DXGUID_LIBRARY - deprecated, see below +# DIRECTX_DXERR_LIBRARY - deprecated, see http://blogs.msdn.com/b/chuckw/archive/2012/04/24/where-s-dxerr-lib.aspx +# DIRECTX_DINPUT_LIBRARY +# DIRECTX_DINPUT_INCLUDE_DIR +# DIRECTX_D3D9_LIBRARY +# DIRECTX_D3DXOF_LIBRARY +# DIRECTX_D3DX9_LIBRARIES +# DIRECTX_INCLUDE_DIRS +# DIRECTX_FOUND - if this is not true, do not attempt to use this library +# +# Defines these macros: +# find_directx_include - wrapper for find_path that provides PATHS, HINTS, and PATH_SUFFIXES. +# find_directx_library - wrapper for find_library that provides PATHS, HINTS, and PATH_SUFFIXES. +# Requires these CMake modules: +# FindPackageHandleStandardArgs (known included with CMake >=2.6.2) +# SelectLibraryConfigurations +# +# Original Author: +# 2012 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 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(DIRECTX_ROOT_DIR + "${DIRECTX_ROOT_DIR}" + CACHE + PATH + "Root directory to search for DirectX") + +if(MSVC) + file(TO_CMAKE_PATH "$ENV{ProgramFiles}" _PROG_FILES) + set(_PF86 "ProgramFiles(x86)") + file(TO_CMAKE_PATH "$ENV{${_PF86}}" _PROG_FILES_X86) + if(_PROG_FILES_X86) + set(_PROG_FILES "${_PROG_FILES_X86}") + endif() + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(_dx_lib_suffixes lib/x64 lib) + else() + set(_dx_lib_suffixes lib/x86 lib) + endif() + set(DXSDK_DIRS) + + set(_dx_quiet) + if(DirectX_FIND_QUIETLY) + set(_dx_quiet QUIET) + endif() + find_package(WindowsSDK ${_dx_quiet}) + if(WINDOWSSDK_FOUND) + foreach(_dir ${WINDOWSSDK_DIRS}) + get_windowssdk_include_dirs(${_dir} _include_dirs) + if(_include_dirs) + list(APPEND DXSDK_DIRS ${_include_dirs}) + endif() + endforeach() + endif() + + macro(_append_dxsdk_in_inclusive_range _low _high) + if((NOT MSVC_VERSION LESS ${_low}) AND (NOT MSVC_VERSION GREATER ${_high})) + list(APPEND DXSDK_DIRS ${ARGN}) + endif() + endmacro() + _append_dxsdk_in_inclusive_range(1500 1600 "${_PROG_FILES}/Microsoft DirectX SDK (June 2010)") + _append_dxsdk_in_inclusive_range(1400 1600 + "${_PROG_FILES}/Microsoft DirectX SDK (February 2010)" + "${_PROG_FILES}/Microsoft DirectX SDK (August 2009)" + "${_PROG_FILES}/Microsoft DirectX SDK (March 2009)" + "${_PROG_FILES}/Microsoft DirectX SDK (November 2008)" + "${_PROG_FILES}/Microsoft DirectX SDK (August 2008)" + "${_PROG_FILES}/Microsoft DirectX SDK (June 2008)" + "${_PROG_FILES}/Microsoft DirectX SDK (March 2008)") + _append_dxsdk_in_inclusive_range(1310 1500 + "${_PROG_FILES}/Microsoft DirectX SDK (November 2007)" + "${_PROG_FILES}/Microsoft DirectX SDK (August 2007)" + "${_PROG_FILES}/Microsoft DirectX SDK (June 2007)" + "${_PROG_FILES}/Microsoft DirectX SDK (April 2007)" + "${_PROG_FILES}/Microsoft DirectX SDK (February 2007)" + "${_PROG_FILES}/Microsoft DirectX SDK (December 2006)" + "${_PROG_FILES}/Microsoft DirectX SDK (October 2006)" + "${_PROG_FILES}/Microsoft DirectX SDK (August 2006)" + "${_PROG_FILES}/Microsoft DirectX SDK (June 2006)" + "${_PROG_FILES}/Microsoft DirectX SDK (April 2006)" + "${_PROG_FILES}/Microsoft DirectX SDK (February 2006)") + + file(TO_CMAKE_PATH "$ENV{DXSDK_DIR}" ENV_DXSDK_DIR) + if(ENV_DXSDK_DIR) + list(APPEND DXSDK_DIRS ${ENV_DXSDK_DIR}) + endif() +else() + set(_dx_lib_suffixes lib) + set(DXSDK_DIRS /mingw) +endif() + +find_path(DIRECTX_INCLUDE_DIR + NAMES + dxdiag.h + dinput.h + dxerr8.h + PATHS + ${DXSDK_DIRS} + HINTS + "${DIRECTX_ROOT_DIR}" + PATH_SUFFIXES + include) +find_path(DIRECTX_DINPUT_INCLUDE_DIR + NAMES + dinput.h + PATHS + ${DXSDK_DIRS} + HINTS + "${DIRECTX_ROOT_DIR}" + PATH_SUFFIXES + include) + +set(DXLIB_HINTS) +if(WINDOWSSDK_FOUND AND DIRECTX_INCLUDE_DIR) + get_windowssdk_from_component("${DIRECTX_INCLUDE_DIR}" _winsdk) + if(_winsdk) + get_windowssdk_library_dirs("${_winsdk}" _libdirs) + if(_libdirs) + list(APPEND DXLIB_HINTS ${_libdirs}) + endif() + endif() +endif() + +if(WINDOWSSDK_FOUND AND DIRECTX_DINPUT_INCLUDE_DIR) + get_windowssdk_from_component("${DIRECTX_DINPUT_INCLUDE_DIR}" _winsdk) + if(_winsdk) + get_windowssdk_library_dirs("${_winsdk}" _includes) + if(_includes) + list(APPEND DXLIB_HINTS ${_includes}) + endif() + endif() +endif() + +find_library(DIRECTX_DXGUID_LIBRARY + NAMES + dxguid + PATHS + ${DXLIB_HINTS} + ${DXSDK_DIRS} + HINTS + "${DIRECTX_ROOT_DIR}" + PATH_SUFFIXES + ${_dx_lib_suffixes}) + +if(DIRECTX_DXGUID_LIBRARY) + get_filename_component(_dxsdk_lib_dir ${DIRECTX_DXGUID_LIBRARY} PATH) + list(APPEND DXLIB_HINTS "${_dxsdk_lib_dir}") +endif() + +find_library(DIRECTX_DINPUT_LIBRARY + NAMES + dinput8 + dinput + PATHS + ${DXSDK_DIRS} + HINTS + ${DXLIB_HINTS} + "${DIRECTX_ROOT_DIR}" + PATH_SUFFIXES + ${_dx_lib_suffixes}) + +find_library(DIRECTX_DXERR_LIBRARY + NAMES + dxerr + dxerr9 + dxerr8 + PATHS + ${DXSDK_DIRS} + HINTS + ${DXLIB_HINTS} + "${DIRECTX_ROOT_DIR}" + PATH_SUFFIXES + ${_dx_lib_suffixes}) + +find_library(DIRECTX_D3D9_LIBRARY + NAMES + d3d9 + PATHS + ${DXSDK_DIRS} + HINTS + ${DXLIB_HINTS} + "${DIRECTX_ROOT_DIR}" + PATH_SUFFIXES + ${_dx_lib_suffixes}) + +find_library(DIRECTX_D3DXOF_LIBRARY + NAMES + d3dxof + PATHS + ${DXSDK_DIRS} + HINTS + ${DXLIB_HINTS} + "${DIRECTX_ROOT_DIR}" + PATH_SUFFIXES + ${_dx_lib_suffixes}) + +find_library(DIRECTX_D3DX9_LIBRARY_RELEASE + NAMES + d3dx9 + PATHS + ${DXSDK_DIRS} + HINTS + ${DXLIB_HINTS} + "${DIRECTX_ROOT_DIR}" + PATH_SUFFIXES + ${_dx_lib_suffixes}) + +find_library(DIRECTX_D3DX9_LIBRARY_DEBUG + NAMES + d3dx9d + PATHS + ${DXSDK_DIRS} + HINTS + ${DXLIB_HINTS} + "${DIRECTX_ROOT_DIR}" + PATH_SUFFIXES + ${_dx_lib_suffixes}) + +find_library(DIRECTX_XINPUT_LIBRARY + NAMES + Xinput9_1_0 + Xinput + PATHS + ${DXSDK_DIRS} + HINTS + ${DXLIB_HINTS} + "${DIRECTX_ROOT_DIR}" + PATH_SUFFIXES + ${_dx_lib_suffixes}) + +include(SelectLibraryConfigurations) +select_library_configurations(DIRECTX_D3DX9) + +set(DIRECTX_EXTRA_CHECK) +if(DIRECTX_INCLUDE_DIR) + if(MSVC80) + set(DXSDK_DEPRECATION_BUILD 1962) + endif() + + if(DXSDK_DEPRECATION_BUILD) + include(CheckCSourceCompiles) + set(_dinput_old_includes ${CMAKE_REQUIRED_INCLUDES}) + set(CMAKE_REQUIRED_INCLUDES "${DIRECTX_INCLUDE_DIR}") + check_c_source_compiles(" + #include + #if _DXSDK_BUILD_MAJOR >= ${DXSDK_DEPRECATION_BUILD} + #error + #else + int main(int argc, char * argv[]) { + return 0; + } + #endif + " + DIRECTX_SDK_SUPPORTS_COMPILER) + set(DIRECTX_EXTRA_CHECK DIRECTX_SDK_SUPPORTS_COMPILER) + set(CMAKE_REQUIRED_INCLUDES "${_dinput_old_includes}") + else() + # Until proven otherwise. + set(DIRECTX_SDK_SUPPORTS_COMPILER TRUE) + endif() +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(DirectX + DEFAULT_MSG + DIRECTX_DXGUID_LIBRARY + DIRECTX_DINPUT_LIBRARY + DIRECTX_INCLUDE_DIR + ${DIRECTX_EXTRA_CHECK}) + +if(DIRECTX_FOUND) + set(DIRECTX_LIBRARIES + "${DIRECTX_DXGUID_LIBRARY}" + "${DIRECTX_DINPUT_LIBRARY}") + + set(DIRECTX_INCLUDE_DIRS "${DIRECTX_INCLUDE_DIR}") + + mark_as_advanced(DIRECTX_ROOT_DIR) +endif() + +macro(find_directx_library) + find_library(${ARGN} + PATHS + ${DXSDK_DIRS} + HINTS + ${DXLIB_HINTS} + "${DIRECTX_ROOT_DIR}" + PATH_SUFFIXES + ${_dx_lib_suffixes}) +endmacro() +macro(find_directx_include) + find_path(${ARGN} + PATHS + ${DXSDK_DIRS} + HINTS + ${DIRECTX_INCLUDE_DIR} + "${DIRECTX_ROOT_DIR}" + PATH_SUFFIXES + include) +endmacro() + +mark_as_advanced(DIRECTX_DINPUT_LIBRARY + DIRECTX_DXGUID_LIBRARY + DIRECTX_DXERR_LIBRARY + DIRECTX_D3D9_LIBRARY + DIRECTX_D3DXOF_LIBRARY + DIRECTX_D3DX9_LIBRARY_RELEASE + DIRECTX_D3DX9_LIBRARY_DEBUG + DIRECTX_INCLUDE_DIR) diff --git a/lib/wiiuse/cmake/FindFlagpoll.cmake b/lib/wiiuse/cmake/FindFlagpoll.cmake new file mode 100644 index 000000000..a016656db --- /dev/null +++ b/lib/wiiuse/cmake/FindFlagpoll.cmake @@ -0,0 +1,151 @@ +# - try to find Flagpoll application, and offer package-finding services +# FLAGPOLL, the executable: if not defined, do not try to use Flagpoll. +# +# Useful configuration variables you might want to add to your cache: +# FLAGPOLL_ROOT_DIR - A directory prefix to search for the app +# (a path that contains bin/ as a subdirectory) +# +# VR Juggler requires this package, so this Find script takes that into +# account when determining where to search for the desired files. +# The VJ_BASE_DIR environment variable is searched (preferentially) +# when searching for this package, so most sane VR Juggler build environments +# should "just work." Note that you need to manually re-run CMake if you +# change this environment variable, because it cannot auto-detect this change +# and trigger an automatic re-run. +# +# You can use Flagpoll to provide directories to use as HINTS for find_* +# These are the provided macros: +# flagpoll_get_include_dirs +# flagpoll_get_library_dirs +# flagpoll_get_library_names +# flagpoll_get_extra_libs +# All take the name of the desired package, optionally NO_DEPS to pass --no-deps +# to Flagpoll, and return yourpkgname_FLAGPOLL_INCLUDE_DIRS(etc. for the other +# macros). +# +# Example usage: +# flagpoll_get_include_dirs(vpr NO_DEPS) +# find_path(VPR20_INCLUDE_DIRS vpr/vpr.h +# HINTS ${vpr_FLAGPOLL_INCLUDE_DIRS}) +# +# 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) + + +### +# Flagpoll detection +### +set(Flagpoll_FIND_QUIETLY true) +find_program(FLAGPOLL + NAMES + flagpoll + flagpoll.exe + PATHS + "${FLAGPOLL_ROOT_DIR}" + "${VRJUGGLER22_ROOT_DIR}" + PATH_SUFFIXES + bin) + +# 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(Flagpoll DEFAULT_MSG FLAGPOLL) + +mark_as_advanced(FLAGPOLL) + +### +# Macro for internal use - shared workings between all the public macros below. +### +macro(_flagpoll_get_results _package _arg _flag _output) + if(FLAGPOLL) + + # If the CMakeLists that called the flagpoll macro passed NO_DEPS, + # we won't return the results for dependencies + if("${ARGN}" MATCHES "NO_DEPS") + set(_FLAGPOLL_NODEP "--no-deps") + else() + set(_FLAGPOLL_NODEP "") + endif() + + # Run flagpoll + execute_process(COMMAND + ${FLAGPOLL} + ${_package} + ${_arg} + ${_FLAGPOLL_NODEP} + OUTPUT_VARIABLE + _FLAGPOLL_OUTPUT + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + + if(_FLAGPOLL_OUTPUT) + # Remove -I and /I(or equivalent for other flags + string(REGEX + REPLACE + "[-/]${_flag}" + "" + _FLAGPOLL_OUTPUT + ${_FLAGPOLL_OUTPUT}) + + # Remove extra spaces + string(REGEX REPLACE " +" " " _FLAGPOLL_OUTPUT ${_FLAGPOLL_OUTPUT}) + + # Make a CMake list, standardize paths, and append only what we want to our final list + separate_arguments(_FLAGPOLL_OUTPUT) + foreach(_RESULT ${_FLAGPOLL_OUTPUT}) + string(REGEX MATCH "^-" _BAD ${_RESULT}) + if(_RESULT AND NOT _BAD) + file(TO_CMAKE_PATH "${_RESULT}" _RESULT_CLEAN) + list(APPEND ${_output} ${_RESULT_CLEAN}) + endif() + endforeach() + endif() + + endif() +endmacro() + +### +# "Public" macros - to use flagpoll to give you HINTS directories when finding things +### +macro(flagpoll_get_include_dirs _package) + # Passing ARGN along so if they specified NO_DEPS we actually do it. + _flagpoll_get_results(${_package} + "--cflags-only-I" + I + ${_package}_FLAGPOLL_INCLUDE_DIRS + ${ARGN}) +endmacro() + +macro(flagpoll_get_library_dirs _package) + # Passing ARGN along so if they specified NO_DEPS we actually do it. + _flagpoll_get_results(${_package} + "--libs-only-L" + L + ${_package}_FLAGPOLL_LIBRARY_DIRS + ${ARGN}) +endmacro() + +macro(flagpoll_get_library_names _package) + # Passing ARGN along so if they specified NO_DEPS we actually do it. + _flagpoll_get_results(${_package} + "--libs-only-l" + l + ${_package}_FLAGPOLL_LIBRARY_NAMES + ${ARGN}) +endmacro() + +macro(flagpoll_get_extra_libs _package) + # Passing ARGN along so if they specified NO_DEPS we actually do it. + _flagpoll_get_results(${_package} + "--get-extra-libs" + l + ${_package}_FLAGPOLL_EXTRA_LIBS + ${ARGN}) +endmacro() diff --git a/lib/wiiuse/cmake/FindGDB.cmake b/lib/wiiuse/cmake/FindGDB.cmake new file mode 100644 index 000000000..e7caa190c --- /dev/null +++ b/lib/wiiuse/cmake/FindGDB.cmake @@ -0,0 +1,74 @@ +# - Try to find GDB +# +# Once done, this will define: +# GDB_FOUND - system has GDB +# GDB_COMMAND - the command to run +# GDB_VERSION - version +# GDB_HAS_RETURN_CHILD_RESULT - if the --return-child-result flag is supported +# +# Useful configuration variables you might want to add to your cache: +# GDB_ROOT_DIR - A directory prefix to search +# +# 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) + + +set(GDB_ROOT_DIR + "${GDB_ROOT_DIR}" + CACHE + PATH + "Directory to start our search in") + +find_program(GDB_COMMAND + NAMES + gdb + HINTS + "${GDB_ROOT_DIR}" + PATH_SUFFIXES + bin + libexec) + +if(GDB_COMMAND) + execute_process(COMMAND + gdb + --version + COMMAND + head + -n + 1 + OUTPUT_VARIABLE + GDB_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE) + string(REGEX + REPLACE + "[^0-9]*([0-9]+[0-9.]*).*" + "\\1" + GDB_VERSION + "${GDB_VERSION}") +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(GDB + DEFAULT_MSG + GDB_COMMAND + GDB_VERSION) + +if(GDB_FOUND) + mark_as_advanced(GDB_ROOT_DIR) + if(GDB_VERSION VERSION_LESS 6.4) + set(GDB_HAS_RETURN_CHILD_RESULT FALSE) + else() + set(GDB_HAS_RETURN_CHILD_RESULT TRUE) + endif() +endif() + +mark_as_advanced(GDB_COMMAND) diff --git a/lib/wiiuse/cmake/FindGHOST.cmake b/lib/wiiuse/cmake/FindGHOST.cmake new file mode 100644 index 000000000..71f17ee56 --- /dev/null +++ b/lib/wiiuse/cmake/FindGHOST.cmake @@ -0,0 +1,90 @@ +# - try to find Sensable GHOST library and include files +# GHOST_INCLUDE_DIRS, where to find GL/glut.h, etc. +# GHOST_LIBRARIES, the libraries to link against +# GHOST_FOUND, If false, do not try to use GLUT. +# GHOST_RUNTIME_LIBRARY_DIRS, path to DLL on Windows for runtime use. +# +# Requires these CMake modules: +# no additional modules required +# +# 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) + +set(GHOST_ROOT_DIR + "${GHOST_ROOT_DIR}" + CACHE + PATH + "Path to search for GHOST") + +set(_dirs) +if(WIN32) + include(ProgramFilesGlob) + program_files_fallback_glob(_dirs "/Sensable/GHOST/v*/") +endif() + +find_path(GHOST_INCLUDE_DIR + gstPHANToM.h + PATHS + ${_dirs} + HINTS + "${GHOST_ROOT_DIR}" + PATH_SUFFIXES + include) + +find_library(GHOST_LIBRARY + GHOST40 + GHOST31 + PATHS + ${_dirs} + HINTS + "${GHOST_ROOT_DIR}" + PATH_SUFFIXES + lib) + +if(MSVC) + if(MSVC_VERSION GREATER 1300) + # .NET and newer: fake the STL headers + get_filename_component(_moddir "${CMAKE_CURRENT_LIST_FILE}" PATH) + set(GHOST_STL_INCLUDE_DIR "${_moddir}/ghost-fake-stl") + else() + # 6.0 and earlier - use GHOST-provided STL + find_path(GHOST_STL_INCLUDE_DIR + vector.h + PATHS + ${_dirs} + HINTS + "${GHOST_ROOT_DIR}" + "${GHOST_INCLUDE_DIR}" + PATH_SUFFIXES + external/stl + stl) + endif() + set(_deps_check GHOST_STL_INCLUDE_DIR) +else() + set(_deps_check) +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(GHOST + DEFAULT_MSG + GHOST_LIBRARY + ${_deps_check} + GHOST_INCLUDE_DIR) + +if(GHOST_FOUND) + set(GHOST_LIBRARIES "${GHOST_LIBRARY}") + set(GHOST_INCLUDE_DIRS "${GHOST_INCLUDE_DIR}") + + mark_as_advanced(GHOST_ROOT_DIR) +endif() + +mark_as_advanced(GHOST_LIBRARY GHOST_STL_INCLUDE_DIR GHOST_INCLUDE_DIR) diff --git a/lib/wiiuse/cmake/FindGLEW.cmake b/lib/wiiuse/cmake/FindGLEW.cmake new file mode 100644 index 000000000..684f6f10d --- /dev/null +++ b/lib/wiiuse/cmake/FindGLEW.cmake @@ -0,0 +1,132 @@ +#.rst: +# FindGLEW +# -------- +# +# Find the OpenGL Extension Wrangler Library (GLEW) +# +# IMPORTED Targets +# ^^^^^^^^^^^^^^^^ +# +# This module defines the :prop_tgt:`IMPORTED` target ``GLEW::GLEW``, +# if GLEW has been found. +# +# Result Variables +# ^^^^^^^^^^^^^^^^ +# +# This module defines the following variables: +# +# :: +# +# GLEW_INCLUDE_DIRS - include directories for GLEW +# GLEW_LIBRARIES - libraries to link against GLEW +# GLEW_FOUND - true if GLEW has been found and can be used + +#============================================================================= +# Copyright 2012 Benjamin Eikel +# Copyright 2016 Ryan Pavlik +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# 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. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +find_path(GLEW_INCLUDE_DIR GL/glew.h) +if(WIN32) + # TODO how to make this exclude arm? + if(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(GLEW_ARCH Win32) + else() + set(GLEW_ARCH x64) + endif() + set(GLEW_EXTRA_SUFFIXES lib/Release/${GLEW_ARCH} bin/Release/${GLEW_ARCH}) +endif() + +if(WIN32 AND GLEW_INCLUDE_DIR) + get_filename_component(GLEW_LIB_ROOT_CANDIDATE "${GLEW_INCLUDE_DIR}/.." ABSOLUTE) +endif() + +find_library(GLEW_LIBRARY + NAMES GLEW glew32 glew glew32s + PATH_SUFFIXES lib64 ${GLEW_EXTRA_SUFFIXES} + HINTS "${GLEW_LIB_ROOT_CANDIDATE}") + +if(WIN32 AND GLEW_LIBRARY AND NOT GLEW_LIBRARY MATCHES ".*s.lib") + get_filename_component(GLEW_LIB_DIR "${GLEW_LIBRARY}" DIRECTORY) + get_filename_component(GLEW_BIN_ROOT_CANDIDATE1 "${GLEW_LIB_DIR}/.." ABSOLUTE) + get_filename_component(GLEW_BIN_ROOT_CANDIDATE2 "${GLEW_LIB_DIR}/../../.." ABSOLUTE) + find_file(GLEW_RUNTIME_LIBRARY + NAMES glew32.dll + PATH_SUFFIXES bin ${GLEW_EXTRA_SUFFIXES} + HINTS + "${GLEW_BIN_ROOT_CANDIDATE1}" + "${GLEW_BIN_ROOT_CANDIDATE2}") +endif() + +set(GLEW_INCLUDE_DIRS ${GLEW_INCLUDE_DIR}) +set(GLEW_LIBRARIES ${GLEW_LIBRARY}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(GLEW + REQUIRED_VARS GLEW_INCLUDE_DIR GLEW_LIBRARY) + +if(GLEW_FOUND AND NOT TARGET GLEW::GLEW) + if(WIN32 AND GLEW_LIBRARY MATCHES ".*s.lib") + # Windows, known static library. + add_library(GLEW::GLEW STATIC IMPORTED) + set_target_properties(GLEW::GLEW PROPERTIES + IMPORTED_LOCATION "${GLEW_LIBRARY}" + PROPERTY INTERFACE_COMPILE_DEFINITIONS GLEW_STATIC) + + elseif(WIN32 AND GLEW_RUNTIME_LIBRARY) + # Windows, known dynamic library and we have both pieces + # TODO might be different for mingw + add_library(GLEW::GLEW SHARED IMPORTED) + set_target_properties(GLEW::GLEW PROPERTIES + IMPORTED_LOCATION "${GLEW_RUNTIME_LIBRARY}" + IMPORTED_IMPLIB "${GLEW_LIBRARY}") + else() + + # Anything else - previous behavior. + add_library(GLEW::GLEW UNKNOWN IMPORTED) + set_target_properties(GLEW::GLEW PROPERTIES + IMPORTED_LOCATION "${GLEW_LIBRARY}") + endif() + + set_target_properties(GLEW::GLEW PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${GLEW_INCLUDE_DIRS}") + +endif() + +mark_as_advanced(GLEW_INCLUDE_DIR GLEW_LIBRARY GLEW_RUNTIME_LIBRARY) diff --git a/lib/wiiuse/cmake/FindGLUI.cmake b/lib/wiiuse/cmake/FindGLUI.cmake new file mode 100644 index 000000000..51797cae4 --- /dev/null +++ b/lib/wiiuse/cmake/FindGLUI.cmake @@ -0,0 +1,136 @@ +# - Try to find GLUI (GL User Interface) +# Requires OpenGL and GLUT - searches for them using find_package +# Once done, this will define +# +# GLUI_INCLUDE_DIR, where to find GL/glui.h (or GLUI/glui.h on mac) +# GLUI_LIBRARY, the libraries to link against +# GLUI_FOUND, If false, do not try to use GLUI. +# +# Plural versions refer to this library and its dependencies, and +# are recommended to be used instead, unless you have a good reason. +# +# Useful configuration variables you might want to add to your cache: +# GLUI_ROOT_DIR - A directory prefix to search +# (usually a path that contains include/ as a subdirectory) +# +# 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(GLUI_FIND_QUIETLY) + find_package(OpenGL QUIET) + find_package(GLUT QUIET) +else() + find_package(OpenGL) + find_package(GLUT) +endif() + +if(OPENGL_FOUND AND GLUT_FOUND) + if(WIN32) + find_path(GLUI_INCLUDE_DIR + NAMES + GL/glui.h + PATHS + ${GLUI_ROOT_PATH}/include + DOC + "GLUI include directory") + find_library(GLUI_LIBRARY + NAMES + glui + ${GLUI_ROOT_DIR}/lib + ${GLUI_ROOT_DIR}/Release + HINTS + ${OPENGL_LIBRARY_DIR} + ${OPENGL_INCLUDE_DIR}/../lib + DOC + "GLUI library") + find_library(GLUI_DEBUG_LIBRARY + NAMES + glui32 + ${GLUI_ROOT_DIR}/lib + ${GLUI_ROOT_DIR}/Debug + HINTS + ${OPENGL_LIBRARY_DIR} + ${OPENGL_INCLUDE_DIR}/../lib + DOC + "GLUI debug library") + else() + find_library(GLUI_LIBRARY + NAMES + GLUI + glui + PATHS + ${GLUI_ROOT_DIR}/lib64 + ${GLUI_ROOT_DIR}/lib + ${GLUI_ROOT_DIR} + /usr/openwin/lib + HINTS + ${OPENGL_LIBRARY_DIR} + ${OPENGL_INCLUDE_DIR}/../lib64 + ${OPENGL_INCLUDE_DIR}/../lib + DOC + "GLUI library") + + if(APPLE) + find_path(GLUI_INCLUDE_DIR + GLUI/glui.h + HINTS + ${OPENGL_INCLUDE_DIR} + DOC + "GLUI include directory") + else() + find_path(GLUI_INCLUDE_DIR + GL/glui.h + PATHS + ${GLUI_ROOT_DIR}/include + /usr/include/GL + /usr/openwin/share/include + /usr/openwin/include + /opt/graphics/OpenGL/include + /opt/graphics/OpenGL/contrib/libglui + DOC + "GLUI include directory") + endif() + endif() +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(GLUI + DEFAULT_MSG + GLUI_INCLUDE_DIR + GLUI_LIBRARY + GLUT_FOUND + OPENGL_FOUND) + +if(GLUI_FOUND) + if(WIN32 AND GLUI_LIBRARY AND GLUI_DEBUG_LIBRARY) + set(GLUI_LIBRARIES + optimized + ${GLUI_LIBRARY} + debug + ${GLUI_DEBUG_LIBRARY} + ${GLUT_LIBRARIES} + ${OPENGL_LIBRARIES}) + else() + set(GLUI_LIBRARIES + ${GLUI_LIBRARY} + ${GLUT_LIBRARIES} + ${OPENGL_LIBRARIES}) + endif() + set(GLUI_INCLUDE_DIRS + ${GLUI_INCLUDE_DIR} + ${GLUT_INCLUDE_DIR} + ${OPENGL_INCLUDE_DIR}) +endif() + +if(GLUI_LIBRARY AND GLUI_INCLUDE_DIR) + mark_as_advanced(GLUI_INCLUDE_DIR GLUI_LIBRARY GLUI_DEBUG_LIBRARY) +endif() diff --git a/lib/wiiuse/cmake/FindGLUT.cmake b/lib/wiiuse/cmake/FindGLUT.cmake new file mode 100644 index 000000000..79486f07a --- /dev/null +++ b/lib/wiiuse/cmake/FindGLUT.cmake @@ -0,0 +1,132 @@ +# - try to find glut library and include files +# GLUT_INCLUDE_DIRS, where to find GL/glut.h, etc. +# GLUT_LIBRARIES, the libraries to link against +# GLUT_FOUND, If false, do not try to use GLUT. +# GLUT_RUNTIME_LIBRARY_DIRS, path to DLL on Windows for runtime use. +# GLUT_RUNTIME_LIBRARY, dll on Windows, for installation purposes +# +# Also defined, but not for general use are: +# GLUT_INCLUDE_DIR, where to find GL/glut.h, etc. +# GLUT_glut_LIBRARY = the full path to the glut library. + +#============================================================================= +# Copyright 2001-2009 Kitware, Inc. +# Copyright 2009-2010 Iowa State University +# (Author: Ryan Pavlik ) +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# 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. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +if(GLUT_FIND_QUIETLY) + find_package(OpenGL QUIET) +else() + find_package(OpenGL) +endif() + +if(OPENGL_FOUND) + get_filename_component(_ogl_libdir ${OPENGL_gl_LIBRARY} PATH) + find_path(GLUT_INCLUDE_DIR + NAMES + GL/glut.h + GLUT/glut.h + glut.h + PATHS + ${_ogl_libdir}/../include + ${GLUT_ROOT_PATH} + ${GLUT_ROOT_PATH}/include + /usr/include/GL + /usr/openwin/share/include + /usr/openwin/include + /opt/graphics/OpenGL/include + /opt/graphics/OpenGL/contrib/libglut) + + find_library(GLUT_glut_LIBRARY + NAMES + glut + glut32 + GLUT + freeglut + PATHS + ${_ogl_libdir} + ${GLUT_ROOT_PATH} + ${GLUT_ROOT_PATH}/Release + /usr/openwin/lib) + +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(GLUT + DEFAULT_MSG + GLUT_glut_LIBRARY + GLUT_INCLUDE_DIR + OPENGL_FOUND) + +if(GLUT_FOUND) + set(GLUT_LIBRARIES ${GLUT_glut_LIBRARY} ${OPENGL_LIBRARIES}) + set(GLUT_INCLUDE_DIRS ${GLUT_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR}) + + if(WIN32) + get_filename_component(_basename "${GLUT_glut_LIBRARY}" NAME_WE) + get_filename_component(_libpath "${GLUT_glut_LIBRARY}" PATH) + find_path(GLUT_RUNTIME_LIBRARY + NAMES + ${_basename}.dll + glut.dll + glut32.dll + freeglut.dll + HINTS + ${_libpath} + ${_libpath}/../bin) + if(GLUT_RUNTIME_LIBRARY) + get_filename_component(GLUT_RUNTIME_LIBRARY_DIRS + "${GLUT_RUNTIME_LIBRARY}" + PATH) + else() + set(GLUT_RUNTIME_LIBRARY_DIRS) + endif() + endif() + + #The following deprecated settings are for backwards compatibility with CMake1.4 + set(GLUT_LIBRARY ${GLUT_LIBRARIES}) + set(GLUT_INCLUDE_PATH ${GLUT_INCLUDE_DIR}) +endif() + +mark_as_advanced(GLUT_INCLUDE_DIR + GLUT_glut_LIBRARY + GLUT_RUNTIME_LIBRARY) diff --git a/lib/wiiuse/cmake/FindGMTL.cmake b/lib/wiiuse/cmake/FindGMTL.cmake new file mode 100644 index 000000000..bdc23e4e5 --- /dev/null +++ b/lib/wiiuse/cmake/FindGMTL.cmake @@ -0,0 +1,111 @@ +# - Try to find GMTL +# Optionally uses Flagpoll and FindFlagpoll.cmake +# Once done, this will define +# +# GMTL_FOUND - system has GMTL +# GMTL_INCLUDE_DIR - the GMTL include directory +# +# Useful configuration variables you might want to add to your cache: +# GMTL_ROOT_DIR - A directory prefix to search +# (a path that contains include/ as a subdirectory) +# GMTL_ADDITIONAL_VERSIONS - Additional versions (outside of 0.5.1 to 0.7.0) +# to use when constructing search names and paths +# +# This script will use Flagpoll, if found, to provide hints to the location +# of this library, but does not use the compiler flags returned by Flagpoll +# directly. +# +# VR Juggler requires this package, so this Find script takes that into +# account when determining where to search for the desired files. +# The VJ_BASE_DIR environment variable is searched (preferentially) +# when searching for this package, so most sane VR Juggler build environments +# should "just work." Note that you need to manually re-run CMake if you +# change this environment variable, because it cannot auto-detect this change +# and trigger an automatic re-run. +# +# Original Author: +# 2009-2012 Ryan Pavlik +# 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(_HUMAN "GMTL") +set(_HEADER gmtl/gmtl.h) +set(_FP_PKG_NAME gmtl) + +include(CheckVersion) + +set(GMTL_VERSIONS + ${GMTL_ADDITIONAL_VERSIONS} + 0.7.0 + 0.6.2 + 0.6.1 + 0.6.0 + 0.5.4 + 0.5.3 + 0.5.2 + 0.5.1) +set(GMTL_DIRS) +foreach(_version ${GMTL_VERSIONS}) + check_version(_ver_ok GMTL ${_version}) + if(_ver_ok) + list(APPEND GMTL_DIRS gmtl-${_version}) + list(APPEND GMTL_HEADER_DIRS include/gmtl-${_version}) + endif() +endforeach() + +include(SelectLibraryConfigurations) +include(CreateImportedTarget) +include(CleanDirectoryList) + +# Try flagpoll. +find_package(Flagpoll QUIET) + +if(FLAGPOLL) + flagpoll_get_include_dirs(${_FP_PKG_NAME}) +endif() + +set(GMTL_ROOT_DIR + "${GMTL_ROOT_DIR}" + CACHE + PATH + "Root directory to search for GMTL") +if(DEFINED VRJUGGLER22_ROOT_DIR) + mark_as_advanced(GMTL_ROOT_DIR) +endif() +if(NOT GMTL_ROOT_DIR) + set(GMTL_ROOT_DIR "${VRJUGGLER22_ROOT_DIR}") +endif() + +set(_ROOT_DIR "${GMTL_ROOT_DIR}") + +# Include dir +find_path(GMTL_INCLUDE_DIR + NAMES + ${_HEADER} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_INCLUDE_DIRS} + PATHS + PATH_SUFFIXES + ${GMTL_DIRS} + ${GMTL_HEADER_DIRS} + include/ + DOC + "GMTL include path") + +# 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(GMTL DEFAULT_MSG GMTL_INCLUDE_DIR) + +if(GMTL_FOUND) + set(GMTL_INCLUDE_DIRS "${GMTL_INCLUDE_DIR}") + mark_as_advanced(GMTL_ROOT_DIR) +endif() + +mark_as_advanced(GMTL_INCLUDE_DIR) diff --git a/lib/wiiuse/cmake/FindGPM.cmake b/lib/wiiuse/cmake/FindGPM.cmake new file mode 100644 index 000000000..ea70d8550 --- /dev/null +++ b/lib/wiiuse/cmake/FindGPM.cmake @@ -0,0 +1,43 @@ +# - try to find GPM library +# +# Cache Variables: (probably not for direct use in your scripts) +# GPM_INCLUDE_DIR +# GPM_LIBRARY +# +# Non-cache variables you might use in your CMakeLists.txt: +# GPM_FOUND +# GPM_INCLUDE_DIRS +# GPM_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) + +find_library(GPM_LIBRARY + NAMES gpm) + +find_path(GPM_INCLUDE_DIR + NAMES gpm.h) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(GPM + DEFAULT_MSG + GPM_LIBRARY + GPM_INCLUDE_DIR) + +if(GPM_FOUND) + set(GPM_LIBRARIES "${GPM_LIBRARY}") + + set(GPM_INCLUDE_DIRS "${GPM_INCLUDE_DIR}") +endif() + +mark_as_advanced(GPM_INCLUDE_DIR GPM_LIBRARY) diff --git a/lib/wiiuse/cmake/FindGadgeteer12.cmake b/lib/wiiuse/cmake/FindGadgeteer12.cmake new file mode 100644 index 000000000..42c33f8e5 --- /dev/null +++ b/lib/wiiuse/cmake/FindGadgeteer12.cmake @@ -0,0 +1,186 @@ +# - try to find Gadgeteer 1.2 library +# Requires JCCL 1.2 and VPR 2.0 (thus FindJCCL12.cmake and FindVPR20.cmake) +# Requires X11 if not on Mac or Windows. +# Optionally uses Flagpoll and FindFlagpoll.cmake +# +# This library is a part of VR Juggler 2.2 - you probably want to use +# find_package(VRJuggler22) instead, for an easy interface to this and +# related scripts. See FindVRJuggler22.cmake for more information. +# +# GADGETEER12_LIBRARY_DIR, library search path +# GADGETEER12_INCLUDE_DIR, include search path +# GADGETEER12_LIBRARY, the library to link against +# GADGETEER12_FOUND, If false, do not try to use this library. +# +# Plural versions refer to this library and its dependencies, and +# are recommended to be used instead, unless you have a good reason. +# +# Useful configuration variables you might want to add to your cache: +# GADGETEER12_ROOT_DIR - A directory prefix to search +# (a path that contains include/ as a subdirectory) +# +# This script will use Flagpoll, if found, to provide hints to the location +# of this library, but does not use the compiler flags returned by Flagpoll +# directly. +# +# The VJ_BASE_DIR environment variable is also searched (preferentially) +# when searching for this component, so most sane build environments should +# "just work." Note that you need to manually re-run CMake if you change +# this environment variable, because it cannot auto-detect this change +# and trigger an automatic re-run. +# +# 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) + +set(_HUMAN "Gadgeteer 1.2") +set(_RELEASE_NAMES gadget-1_2 libgadget-1_2) +set(_DEBUG_NAMES gadget_d-1_2 libgadget_d-1_2) +set(_DIR gadgeteer-1.2) +set(_HEADER gadget/gadgetConfig.h) +set(_FP_PKG_NAME gadgeteer) + +include(SelectLibraryConfigurations) +include(CreateImportedTarget) +include(CleanLibraryList) +include(CleanDirectoryList) + +if(Gadgeteer12_FIND_QUIETLY) + set(_FIND_FLAGS "QUIET") +else() + set(_FIND_FLAGS "") +endif() + +# Try flagpoll. +find_package(Flagpoll QUIET) + +if(FLAGPOLL) + flagpoll_get_include_dirs(${_FP_PKG_NAME} NO_DEPS) + flagpoll_get_library_dirs(${_FP_PKG_NAME} NO_DEPS) + flagpoll_get_extra_libs(${_FP_PKG_NAME} NO_DEPS) +endif() + +set(GADGETEER12_ROOT_DIR + "${GADGETEER12_ROOT_DIR}" + CACHE + PATH + "Root directory to search for Gadgeteer") +if(DEFINED VRJUGGLER22_ROOT_DIR) + mark_as_advanced(GADGETEER12_ROOT_DIR) +endif() +if(NOT GADGETEER12_ROOT_DIR) + set(GADGETEER12_ROOT_DIR "${VRJUGGLER22_ROOT_DIR}") +endif() + +set(_ROOT_DIR "${GADGETEER12_ROOT_DIR}") + +find_path(GADGETEER12_INCLUDE_DIR + ${_HEADER} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_INCLUDE_DIRS} + PATH_SUFFIXES + ${_DIR} + include/${_DIR} + include/ + DOC + "Path to ${_HUMAN} includes root") + +find_library(GADGETEER12_LIBRARY_RELEASE + NAMES + ${_RELEASE_NAMES} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBSUFFIXES} + DOC + "${_HUMAN} release library full path") + +find_library(GADGETEER12_LIBRARY_DEBUG + NAMES + ${_DEBUG_NAMES} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBDSUFFIXES} + DOC + "${_HUMAN} debug library full path") + +select_library_configurations(GADGETEER12) + +# Dependencies +foreach(package JCCL12 VPR20 GMTL) + if(NOT ${PACKAGE}_FOUND) + find_package(${package} ${_FIND_FLAGS}) + endif() +endforeach() + +if(UNIX AND NOT APPLE AND NOT WIN32) + # We need X11 if not on Mac or Windows + if(NOT X11_FOUND) + find_package(X11 ${_FIND_FLAGS}) + endif() + + set(_CHECK_EXTRAS + X11_FOUND + X11_X11_LIB + X11_ICE_LIB + X11_SM_LIB + X11_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(Gadgeteer12 + DEFAULT_MSG + GADGETEER12_LIBRARY + GADGETEER12_INCLUDE_DIR + JCCL12_FOUND + JCCL12_LIBRARIES + JCCL12_INCLUDE_DIR + VPR20_FOUND + VPR20_LIBRARIES + VPR20_INCLUDE_DIR + GMTL_FOUND + GMTL_INCLUDE_DIR + ${_CHECK_EXTRAS}) + +if(GADGETEER12_FOUND) + set(_DEPS ${JCCL12_LIBRARIES} ${VPR20_LIBRARIES}) + + set(GADGETEER12_INCLUDE_DIRS ${GADGETEER12_INCLUDE_DIR}) + list(APPEND + GADGETEER12_INCLUDE_DIRS + ${JCCL12_INCLUDE_DIRS} + ${VPR20_INCLUDE_DIRS} + ${GMTL_INCLUDE_DIRS}) + + if(UNIX AND NOT APPLE AND NOT WIN32) + # We need X11 if not on Mac or Windows + list(APPEND _DEPS ${X11_X11_LIB} ${X11_ICE_LIB} ${X11_SM_LIB}) + list(APPEND GADGETEER12_INCLUDE_DIRS ${X11_INCLUDE_DIR}) + endif() + + clean_directory_list(GADGETEER12_INCLUDE_DIRS) + + if(VRJUGGLER22_CREATE_IMPORTED_TARGETS) + create_imported_target(GADGETEER12 ${_DEPS}) + else() + clean_library_list(GADGETEER12_LIBRARIES ${_DEPS}) + endif() + + mark_as_advanced(GADGETEER12_ROOT_DIR) +endif() + +mark_as_advanced(GADGETEER12_LIBRARY_RELEASE + GADGETEER12_LIBRARY_DEBUG + GADGETEER12_INCLUDE_DIR) diff --git a/lib/wiiuse/cmake/FindGadgeteer20.cmake b/lib/wiiuse/cmake/FindGadgeteer20.cmake new file mode 100644 index 000000000..f6f3b44de --- /dev/null +++ b/lib/wiiuse/cmake/FindGadgeteer20.cmake @@ -0,0 +1,187 @@ +# - try to find Gadgeteer 2.0 library +# Requires JCCL 1.4 and VPR 2.2 (thus FindJCCL14.cmake and FindVPR22.cmake) +# Requires X11 if not on Mac or Windows. +# Optionally uses Flagpoll and FindFlagpoll.cmake +# +# This library is a part of VR Juggler 3.0 - you probably want to use +# find_package(VRJuggler30) instead, for an easy interface to this and +# related scripts. See FindVRJuggler30.cmake for more information. +# +# GADGETEER20_LIBRARY_DIR, library search path +# GADGETEER20_INCLUDE_DIR, include search path +# GADGETEER20_LIBRARY, the library to link against +# GADGETEER20_FOUND, If false, do not try to use this library. +# +# Plural versions refer to this library and its dependencies, and +# are recommended to be used instead, unless you have a good reason. +# +# Useful configuration variables you might want to add to your cache: +# GADGETEER20_ROOT_DIR - A directory prefix to search +# (a path that contains include/ as a subdirectory) +# +# This script will use Flagpoll, if found, to provide hints to the location +# of this library, but does not use the compiler flags returned by Flagpoll +# directly. +# +# The VJ_BASE_DIR environment variable is also searched (preferentially) +# when searching for this component, so most sane build environments should +# "just work." Note that you need to manually re-run CMake if you change +# this environment variable, because it cannot auto-detect this change +# and trigger an automatic re-run. +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# Updated for VR Juggler 3.0 by: +# Brandon Newendorp + +set(_HUMAN "Gadgeteer 2.0") +set(_FP_PKG_NAME gadgeteer) +set(_RELEASE_NAMES) +set(_DEBUG_NAMES) +foreach(VER 2_0 2_0_0 2_0_1 2_0_2) + list(APPEND _RELEASE_NAMES gadget-${VER}) + list(APPEND _DEBUG_NAMES gadget_d-${VER}) +endforeach() +set(_DIR gadgeteer-2.0) +set(_HEADER gadget/gadgetConfig.h) + +include(SelectLibraryConfigurations) +include(CreateImportedTarget) +include(CleanLibraryList) +include(CleanDirectoryList) + +if(GADGETEER20_FIND_QUIETLY) + set(_FIND_FLAGS "QUIET") +else() + set(_FIND_FLAGS "") +endif() + +# Try flagpoll. +find_package(Flagpoll QUIET) + +if(FLAGPOLL) + flagpoll_get_include_dirs(${_FP_PKG_NAME} NO_DEPS) + flagpoll_get_library_dirs(${_FP_PKG_NAME} NO_DEPS) + flagpoll_get_extra_libs(${_FP_PKG_NAME} NO_DEPS) +endif() + +set(GADGETEER20_ROOT_DIR + "${GADGETEER20_ROOT_DIR}" + CACHE + PATH + "Root directory to search for Gadgeteer") +if(DEFINED VRJUGGLER30_ROOT_DIR) + mark_as_advanced(GADGETEER20_ROOT_DIR) +endif() +if(NOT GADGETEER20_ROOT_DIR) + set(GADGETEER20_ROOT_DIR "${VRJUGGLER30_ROOT_DIR}") +endif() + +set(_ROOT_DIR "${GADGETEER20_ROOT_DIR}") + +find_path(GADGETEER20_INCLUDE_DIR + ${_HEADER} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_INCLUDE_DIRS} + PATH_SUFFIXES + ${_DIR} + include/${_DIR} + include/ + DOC + "Path to ${_HUMAN} includes root") + +find_library(GADGETEER20_LIBRARY_RELEASE + NAMES + ${_RELEASE_NAMES} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBSUFFIXES} + DOC + "${_HUMAN} release library full path") + +find_library(GADGETEER20_LIBRARY_DEBUG + NAMES + ${_DEBUG_NAMES} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBDSUFFIXES} + DOC + "${_HUMAN} debug library full path") + +select_library_configurations(GADGETEER20) + +# Dependencies +foreach(package JCCL14 VPR22 GMTL) + if(NOT ${PACKAGE}_FOUND) + find_package(${package} ${_FIND_FLAGS}) + endif() +endforeach() + +if(UNIX AND NOT APPLE AND NOT WIN32) + # We need X11 if not on Mac or Windows + if(NOT X11_FOUND) + find_package(X11 ${_FIND_FLAGS}) + endif() + + set(_CHECK_EXTRAS + X11_FOUND + X11_X11_LIB + X11_ICE_LIB + X11_SM_LIB + X11_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(GADGETEER20 + DEFAULT_MSG + GADGETEER20_LIBRARY + GADGETEER20_INCLUDE_DIR + JCCL14_FOUND + JCCL14_LIBRARIES + JCCL14_INCLUDE_DIR + VPR22_FOUND + VPR22_LIBRARIES + VPR22_INCLUDE_DIR + GMTL_FOUND + GMTL_INCLUDE_DIR + ${_CHECK_EXTRAS}) + +if(GADGETEER20_FOUND) + set(_DEPS ${JCCL14_LIBRARIES} ${VPR22_LIBRARIES}) + + set(GADGETEER20_INCLUDE_DIRS ${GADGETEER20_INCLUDE_DIR}) + list(APPEND + GADGETEER20_INCLUDE_DIRS + ${JCCL14_INCLUDE_DIRS} + ${VPR22_INCLUDE_DIRS} + ${GMTL_INCLUDE_DIRS}) + + if(UNIX AND NOT APPLE AND NOT WIN32) + # We need X11 if not on Mac or Windows + list(APPEND _DEPS ${X11_X11_LIB} ${X11_ICE_LIB} ${X11_SM_LIB}) + list(APPEND GADGETEER20_INCLUDE_DIRS ${X11_INCLUDE_DIR}) + endif() + + clean_directory_list(GADGETEER20_INCLUDE_DIRS) + + if(VRJUGGLER30_CREATE_IMPORTED_TARGETS) + create_imported_target(GADGETEER20 ${_DEPS}) + else() + clean_library_list(GADGETEER20_LIBRARIES ${_DEPS}) + endif() + + mark_as_advanced(GADGETEER20_ROOT_DIR) +endif() + +mark_as_advanced(GADGETEER20_LIBRARY_RELEASE + GADGETEER20_LIBRARY_DEBUG + GADGETEER20_INCLUDE_DIR) diff --git a/lib/wiiuse/cmake/FindGlove5DT.cmake b/lib/wiiuse/cmake/FindGlove5DT.cmake new file mode 100644 index 000000000..fca626bd2 --- /dev/null +++ b/lib/wiiuse/cmake/FindGlove5DT.cmake @@ -0,0 +1,203 @@ +# - try to find Glove5DT libraries +# +# Cache Variables: (probably not for direct use in your scripts) +# GLOVE5DT_INCLUDE_DIR +# GLOVE5DT_LIBRARY +# GLOVE5DT_LIBRARY_RELEASE +# GLOVE5DT_LIBRARY_DEBUG +# GLOVE5DT_RUNTIME_LIBRARY_RELEASE +# GLOVE5DT_RUNTIME_LIBRARY_DEBUG +# +# Non-cache variables you might use in your CMakeLists.txt: +# GLOVE5DT_FOUND +# GLOVE5DT_INCLUDE_DIRS +# GLOVE5DT_LIBRARIES +# GLOVE5DT_RUNTIME_LIBRARY_DIRS +# +# Requires these CMake modules: +# CleanDirectoryList +# CleanLibraryList +# ListCombinations +# ProgramFilesGlob +# SelectLibraryConfigurations (included with CMake >=2.8.0) +# 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) + +set(GLOVE5DT_ROOT_DIR + "${GLOVE5DT_ROOT_DIR}" + CACHE + PATH + "Path to search for Glove5DT SDK") + +### +# Configure Glove5DT +### + +include(SelectLibraryConfigurations) +include(ListCombinations) +include(CleanDirectoryList) +include(ProgramFilesGlob) + +if(WIN32) + # Data Glove 5 and 16 use these directories for includes, lib, and runtime + program_files_glob(_dirs516 "/5DT/*/Driver") + set(_dirs516 + "${GLOVE5DT_ROOT_DIR}/Driver" + "${GLOVE5DT_ROOT_DIR}" + ${_dirs516}) + + # Data Glove Ultra uses this directory as the base for a dll, inc, and lib directory + program_files_glob(_dirsultra "/5DT/*/SDK") + + list_combinations(_libsearchultra + PREFIXES + "${GLOVE5DT_ROOT_DIR}" + "${_dirsultra}" + SUFFIXES + "/lib") + list_combinations(_incsearchultra + PREFIXES + "${GLOVE5DT_ROOT_DIR}" + "${_dirsultra}" + SUFFIXES + "/inc") + list_combinations(_dllsearchultra + PREFIXES + "${GLOVE5DT_ROOT_DIR}" + "${_dirsultra}" + SUFFIXES + "/dll") +endif() + + +### +# First search for the Ultra (2.0) SDK +### +find_path(GLOVE5DT_INCLUDE_DIR + NAMES + fglove.h + HINTS + ${_incsearchultra} + ${GLOVE5DT_ROOT_DIR}) + +find_library(GLOVE5DT_LIBRARY_RELEASE + NAMES + fglove + HINTS + ${_libsearchultra} + ${GLOVE5DT_ROOT_DIR}) + +find_library(GLOVE5DT_LIBRARY_DEBUG + NAMES + fgloved + HINTS + ${_libsearchultra} + ${GLOVE5DT_ROOT_DIR}) + + +select_library_configurations(GLOVE5DT) +# As a post condition, either both LIBRARY_RELEASE and LIBRARY_DEBUG are set, or +# neither is. + + +### +# Ultra (2.0) SDK Runtime Libraries +### +if(WIN32) + find_file(GLOVE5DT_RUNTIME_LIBRARY_RELEASE + NAMES + fglove.dll + HINTS + ${_dllsearchultra}) + + find_file(GLOVE5DT_RUNTIME_LIBRARY_DEBUG + NAMES + fgloved.dll + HINTS + ${_dllsearchultra}) +else() + # the library is the runtime library + set(GLOVE5DT_RUNTIME_LIBRARY_RELEASE "${GLOVE5DT_LIBRARY_RELEASE}") + set(GLOVE5DT_RUNTIME_LIBRARY_DEBUG "${GLOVE5DT_LIBRARY_DEBUG}") +endif() + + +select_library_configurations(GLOVE5DT_RUNTIME) + + +### +# Fallback to the 5/16 (1.0) SDK +### +find_path(GLOVE5DT_INCLUDE_DIR + NAMES + fglove.h + HINTS + ${_dirs516}) + +find_library(GLOVE5DT_LIBRARY_RELEASE + NAMES + fglove + HINTS + ${_dirs516}) + +select_library_configurations(GLOVE5DT) + +### +# 5/16 (1.0) SDK Runtime Libraries +### + +if(WIN32) + find_file(GLOVE5DT_RUNTIME_LIBRARY_RELEASE + NAMES + fglove.dll + HINTS + ${_dirs516}) +else() + # the library is the runtime library + set(GLOVE5DT_RUNTIME_LIBRARY_RELEASE "${GLOVE5DT_LIBRARY_RELEASE}") +endif() + +select_library_configurations(GLOVE5DT_RUNTIME) + +# 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(Glove5DT + DEFAULT_MSG + GLOVE5DT_LIBRARY_RELEASE + GLOVE5DT_RUNTIME_LIBRARY_RELEASE + GLOVE5DT_INCLUDE_DIR) + + +if(GLOVE5DT_FOUND) + set(GLOVE5DT_RUNTIME_LIBRARY_DIRS) + foreach(_lib + GLOVE5DT_RUNTIME_LIBRARY_RELEASE + GLOVE5DT_RUNTIME_LIBRARY_DEBUG) + if(${_lib}) + get_filename_component(_libdir ${${_lib}} PATH) + list(APPEND GLOVE5DT_RUNTIME_LIBRARY_DIRS "${_libdir}") + endif() + endforeach() + + clean_directory_list(GLOVE5DT_RUNTIME_LIBRARY_DIRS) + set(GLOVE5DT_INCLUDE_DIRS "${GLOVE5DT_INCLUDE_DIR}") + set(GLOVE5DT_LIBRARIES ${GLOVE5DT_LIBRARY}) + mark_as_advanced(GLOVE5DT_ROOT_DIR) +endif() + + +mark_as_advanced(GLOVE5DT_INCLUDE_DIR + GLOVE5DT_LIBRARY_RELEASE + GLOVE5DT_LIBRARY_DEBUG + GLOVE5DT_RUNTIME_LIBRARY_RELEASE + GLOVE5DT_RUNTIME_LIBRARY_DEBUG) diff --git a/lib/wiiuse/cmake/FindHIDAPI.cmake b/lib/wiiuse/cmake/FindHIDAPI.cmake new file mode 100644 index 000000000..646f90026 --- /dev/null +++ b/lib/wiiuse/cmake/FindHIDAPI.cmake @@ -0,0 +1,46 @@ +# - try to find HIDAPI library +# from http://www.signal11.us/oss/hidapi/ +# +# Cache Variables: (probably not for direct use in your scripts) +# HIDAPI_INCLUDE_DIR +# HIDAPI_LIBRARY +# +# Non-cache variables you might use in your CMakeLists.txt: +# HIDAPI_FOUND +# HIDAPI_INCLUDE_DIRS +# HIDAPI_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) + +find_library(HIDAPI_LIBRARY + NAMES hidapi hidapi-libusb) + +find_path(HIDAPI_INCLUDE_DIR + NAMES hidapi.h + PATH_SUFFIXES + hidapi) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(HIDAPI + DEFAULT_MSG + HIDAPI_LIBRARY + HIDAPI_INCLUDE_DIR) + +if(HIDAPI_FOUND) + set(HIDAPI_LIBRARIES "${HIDAPI_LIBRARY}") + + set(HIDAPI_INCLUDE_DIRS "${HIDAPI_INCLUDE_DIR}") +endif() + +mark_as_advanced(HIDAPI_INCLUDE_DIR HIDAPI_LIBRARY) diff --git a/lib/wiiuse/cmake/FindIDLJ.cmake b/lib/wiiuse/cmake/FindIDLJ.cmake new file mode 100644 index 000000000..04def2212 --- /dev/null +++ b/lib/wiiuse/cmake/FindIDLJ.cmake @@ -0,0 +1,92 @@ +# - try to find Java's IDLJ Interface Definition Language compiler. +# +# Ideally used with CMake 2.8.5 or newer for Java support using FindJava.cmake +# and UseJava.cmake +# +# Variables: +# Java_IDLJ_COMMAND, executable for idlj +# IDLJ_FOUND, If false, do not try to use this +# +# Function: +# java_idlj(varname idlfile [extra idlj args]) - Generates +# the Java source files from the IDL file you indicate, and +# appends filenames suitable to add to a add_jar() call to the +# variable you specified. +# +# Because the files generated from an IDL file are not entirely predictable, +# java_idlj runs idlj in the cmake step, rather than the build step, and triggers +# a CMake re-run when an idl file is modified. Already up-to-date generated source +# is not re-generated, however. +# +# Files are generated in a directory created specifically for +# the particular IDL file and the particular call, in the build directory - +# there should be no worries about overwriting files or picking up too much +# with the wildcard. +# +# You may wish to add the IDL file to your list of sources if you want it +# to appear in your IDE, but it is not necessary. +# +# Original Author: +# 2012 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 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) + +if(NOT JAVA_FOUND) + find_package(Java QUIET) +endif() + +if(JAVA_FOUND) + get_filename_component(JAVA_BIN_DIR "${Java_JAVAC_EXECUTABLE}" PATH) + find_program(Java_IDLJ_COMMAND + idlj + HINTS + ${JAVA_BIN_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(IDLJ + DEFAULT_MSG + Java_IDLJ_COMMAND + JAVA_FOUND) + +if(IDLJ_FOUND) + function(java_idlj _varname _idlfile) + # Get some unique value we can use in a directory name + # TODO would be better to somehow munge the full path relative to CMAKE_CURRENT_SOURCE_DIR + # in case somebody has multiple idl files with the same name + get_filename_component(_idl_name "${_idlfile}" NAME_WE) + get_filename_component(_idl_abs "${_idlfile}" ABSOLUTE) + + # Compute directory name and stamp filename + set(outdir "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/idlj/${_idl_name}.dir") + set(stampfile "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/idlj/${_idl_name}.stamp") + + # Force re-cmake if idl file changes + configure_file("${_idl_abs}" "${stampfile}" COPY_ONLY) + + if((NOT EXISTS "${outdir}") OR ("${_idl_abs}" IS_NEWER_THAN "${outdir}")) + file(REMOVE_RECURSE "${outdir}") + message(STATUS "Processing ${_idlfile} with Java's idlj") + execute_process(COMMAND + "${Java_IDLJ_COMMAND}" -fclient -fallTIE -td "${outdir}" ${ARGN} "${_idlfile}" + WORKING_DIRECTORY + "${CMAKE_CURRENT_SOURCE_DIR}") + endif() + file(GLOB_RECURSE _idl_output "${outdir}/*") + + set(${_varname} ${_idl_output} PARENT_SCOPE) + + # Clean up after ourselves on make clean + set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${outdir}" "${stampfile}") + endfunction() +endif() + +mark_as_advanced(Java_IDLJ_COMMAND) diff --git a/lib/wiiuse/cmake/FindInterSense.cmake b/lib/wiiuse/cmake/FindInterSense.cmake new file mode 100644 index 000000000..855c9a1d2 --- /dev/null +++ b/lib/wiiuse/cmake/FindInterSense.cmake @@ -0,0 +1,108 @@ +# - try to find InterSense library +# +# Cache Variables: (probably not for direct use in your scripts) +# INTERSENSE_INCLUDE_DIR +# INTERSENSE_ISENSEC_DIR - location of the isense.c "import library" substitute. +# INTERSENSE_LIBRARY +# +# Non-cache variables you might use in your CMakeLists.txt: +# INTERSENSE_FOUND +# INTERSENSE_INCLUDE_DIRS +# INTERSENSE_LIBRARIES +# +# Requires these CMake modules: +# FindPackageHandleStandardArgs (known included with CMake >=2.6.2) +# +# Author: +# 2013 Eric Marsh +# http://wemarsh.com/ +# Kognitiv Neuroinformatik, Universität Bremen +# +# (building on Ryan Pavlik's templates) +# +# 2013 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# 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(INTERSENSE_ROOT_DIR + "${INTERSENSE_ROOT_DIR}" + CACHE + PATH + "Directory to search for the Intersense SDK") + +if(APPLE) + set(_ARCH UniversalLib) +else() + if(CMAKE_SIZEOF_VOID_P MATCHES "8") + set(_IS_ARCH x86_64) + else() + set(_IS_ARCH x86_32) + endif() +endif() + +set(_IS_INSTALLDIRS) +if(APPLE) + set(_IS_SDKDIR MacOSX) +elseif(WIN32) + set(_IS_SDKDIR Windows) + # Default locations, as well as registry places it records install locations, + # if you installed from a (actual or downloaded) product "CD" + foreach(_IS_PROD "IS-900 Software" "InertiaCube Software") + get_filename_component(_IS_REGPATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\InterSense\\${_IS_PROD};Path]" ABSOLUTE) + if(_IS_REGPATH AND (NOT "${_IS_REGPATH}" STREQUAL "/registry")) + list(APPEND _IS_INSTALLDIRS "${_IS_REGPATH}/SDK") + endif() + list(APPEND _IS_INSTALLDIRS "C:/InterSense/${_IS_PROD}/SDK") + endforeach() +else() # Assume Linux, since that's the only other platform supported by this library + set(_IS_SDKDIR Linux) +endif() + +find_path(INTERSENSE_INCLUDE_DIR + NAMES isense.h + PATHS "${INTERSENSE_ROOT_DIR}" "${INTERSENSE_ROOT_DIR}/SDK" ${_IS_INSTALLDIRS}) + +find_path(INTERSENSE_ISENSEC_DIR + NAMES isense.c + PATHS "${INTERSENSE_ROOT_DIR}" "${INTERSENSE_ROOT_DIR}/SDK" ${_IS_INSTALLDIRS} + PATH_SUFFIXES + "Windows/Sample/Visual C++ 2005" + "Windows/Sample/Visual C++ 2005 (single tracker)" + Linux/Sample + MacOSX/Sample) + +include(FindPackageHandleStandardArgs) + +# This is a weird one - no import library is supplied, and instead, at least on Windows, they use +# an isense.c file to call into the DLL. Not sure if MinGW can link right against the dll in this case. +if(WIN32) + find_package_handle_standard_args(InterSense + DEFAULT_MSG + INTERSENSE_INCLUDE_DIR + INTERSENSE_ISENSEC_DIR) + if(INTERSENSE_FOUND) + set(INTERSENSE_LIBRARIES "") + set(INTERSENSE_INCLUDE_DIRS "${INTERSENSE_INCLUDE_DIR}" "${INTERSENSE_ISENSEC_DIR}") + endif() +else() # Only MSVC on Windows theoretically needs import libraries, so... + find_library(INTERSENSE_LIBRARY + NAMES isense + PATHS "${INTERSENSE_ROOT_DIR}" "${INTERSENSE_ROOT_DIR}/SDK" ${_IS_INSTALLDIRS} + PATH_SUFFIXES "${_IS_SDKDIR}/${_IS_ARCH}") + + find_package_handle_standard_args(InterSense + DEFAULT_MSG + INTERSENSE_LIBRARY + INTERSENSE_INCLUDE_DIR) + + if(INTERSENSE_FOUND) + set(INTERSENSE_LIBRARIES "${INTERSENSE_LIBRARY}" ${CMAKE_DL_LIBS}) + set(INTERSENSE_INCLUDE_DIRS "${INTERSENSE_INCLUDE_DIR}") + endif() +endif() + +mark_as_advanced(INTERSENSE_INCLUDE_DIR INTERSENSE_ISENSEC_DIR INTERSENSE_LIBRARY) diff --git a/lib/wiiuse/cmake/FindJCCL12.cmake b/lib/wiiuse/cmake/FindJCCL12.cmake new file mode 100644 index 000000000..a936c945c --- /dev/null +++ b/lib/wiiuse/cmake/FindJCCL12.cmake @@ -0,0 +1,152 @@ +# - try to find JCCL 1.2 library +# Requires VPR 2.0 (thus FindVPR20.cmake) +# Optionally uses Flagpoll and FindFlagpoll.cmake +# +# This library is a part of VR Juggler 2.2 - you probably want to use +# find_package(VRJuggler22) instead, for an easy interface to this and +# related scripts. See FindVRJuggler22.cmake for more information. +# +# JCCL12_LIBRARY_DIR, library search path +# JCCL12_INCLUDE_DIR, include search path +# JCCL12_LIBRARY, the library to link against +# JCCL12_FOUND, If false, do not try to use this library. +# +# Plural versions refer to this library and its dependencies, and +# are recommended to be used instead, unless you have a good reason. +# +# Useful configuration variables you might want to add to your cache: +# JCCL12_ROOT_DIR - A directory prefix to search +# (a path that contains include/ as a subdirectory) +# +# This script will use Flagpoll, if found, to provide hints to the location +# of this library, but does not use the compiler flags returned by Flagpoll +# directly. +# +# The VJ_BASE_DIR environment variable is also searched (preferentially) +# when searching for this component, so most sane build environments should +# "just work." Note that you need to manually re-run CMake if you change +# this environment variable, because it cannot auto-detect this change +# and trigger an automatic re-run. +# +# 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) + + +set(_HUMAN "JCCL 1.2") +set(_RELEASE_NAMES jccl-1_2 libjccl-1_2) +set(_DEBUG_NAMES jccl_d-1_2 libjccl_d-1_2) +set(_DIR jccl-1.2) +set(_HEADER jccl/jcclConfig.h) +set(_FP_PKG_NAME jccl) + +include(SelectLibraryConfigurations) +include(CreateImportedTarget) +include(CleanLibraryList) +include(CleanDirectoryList) + +if(JCCL12_FIND_QUIETLY) + set(_FIND_FLAGS "QUIET") +else() + set(_FIND_FLAGS "") +endif() + +# Try flagpoll. +find_package(Flagpoll QUIET) + +if(FLAGPOLL) + flagpoll_get_include_dirs(${_FP_PKG_NAME} NO_DEPS) + flagpoll_get_library_dirs(${_FP_PKG_NAME} NO_DEPS) +endif() + +set(JCCL12_ROOT_DIR + "${JCCL12_ROOT_DIR}" + CACHE + PATH + "Root directory to search for JCCL") +if(DEFINED VRJUGGLER22_ROOT_DIR) + mark_as_advanced(JCCL12_ROOT_DIR) +endif() +if(NOT JCCL12_ROOT_DIR) + set(JCCL12_ROOT_DIR "${VRJUGGLER22_ROOT_DIR}") +endif() + +set(_ROOT_DIR ${JCCL12_ROOT_DIR}) + +find_path(JCCL12_INCLUDE_DIR + ${_HEADER} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_INCLUDE_DIRS} + PATH_SUFFIXES + ${_DIR} + include/${_DIR} + include/ + DOC + "Path to ${_HUMAN} includes root") + +find_library(JCCL12_LIBRARY_RELEASE + NAMES + ${_RELEASE_NAMES} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBSUFFIXES} + DOC + "${_HUMAN} release library full path") + +find_library(JCCL12_LIBRARY_DEBUG + NAMES + ${_DEBUG_NAMES} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBDSUFFIXES} + DOC + "${_HUMAN} debug library full path") + +select_library_configurations(JCCL12) + +# Dependency +if(NOT VPR20_FOUND) + find_package(VPR20 ${_FIND_FLAGS}) +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(JCCL12 + DEFAULT_MSG + JCCL12_LIBRARY + JCCL12_INCLUDE_DIR + VPR20_FOUND + VPR20_LIBRARIES + VPR20_INCLUDE_DIR) + +if(JCCL12_FOUND) + set(_DEPS ${VPR20_LIBRARIES}) + + set(JCCL12_INCLUDE_DIRS ${JCCL12_INCLUDE_DIR}) + list(APPEND JCCL12_INCLUDE_DIRS ${VPR20_INCLUDE_DIRS}) + clean_directory_list(JCCL12_INCLUDE_DIRS) + + if(VRJUGGLER22_CREATE_IMPORTED_TARGETS) + create_imported_target(JCCL12 ${_DEPS}) + else() + clean_library_list(JCCL12_LIBRARIES) + endif() + + mark_as_advanced(JCCL12_ROOT_DIR) +endif() + +mark_as_advanced(JCCL12_LIBRARY_RELEASE + JCCL12_LIBRARY_DEBUG + JCCL12_INCLUDE_DIR) diff --git a/lib/wiiuse/cmake/FindJCCL14.cmake b/lib/wiiuse/cmake/FindJCCL14.cmake new file mode 100644 index 000000000..147bb0122 --- /dev/null +++ b/lib/wiiuse/cmake/FindJCCL14.cmake @@ -0,0 +1,153 @@ +# - try to find JCCL 1.4 library +# Requires VPR 2.2 (thus FindVPR22.cmake) +# Optionally uses Flagpoll and FindFlagpoll.cmake +# +# This library is a part of VR Juggler 3.0 - you probably want to use +# find_package(VRJuggler30) instead, for an easy interface to this and +# related scripts. See FindVRJuggler30.cmake for more information. +# +# JCCL14_LIBRARY_DIR, library search path +# JCCL14_INCLUDE_DIR, include search path +# JCCL14_LIBRARY, the library to link against +# JCCL14_FOUND, If false, do not try to use this library. +# +# Plural versions refer to this library and its dependencies, and +# are recommended to be used instead, unless you have a good reason. +# +# Useful configuration variables you might want to add to your cache: +# JCCL14_ROOT_DIR - A directory prefix to search +# (a path that contains include/ as a subdirectory) +# +# This script will use Flagpoll, if found, to provide hints to the location +# of this library, but does not use the compiler flags returned by Flagpoll +# directly. +# +# The VJ_BASE_DIR environment variable is also searched (preferentially) +# when searching for this component, so most sane build environments should +# "just work." Note that you need to manually re-run CMake if you change +# this environment variable, because it cannot auto-detect this change +# and trigger an automatic re-run. +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# Updated for VR Juggler 3.0 by: +# Brandon Newendorp + + +set(_HUMAN "JCCL 1.4") +set(_FP_PKG_NAME jccl) +set(_RELEASE_NAMES) +set(_DEBUG_NAMES) +foreach(VER 1_4 1_4_0 1_4_1 1_4_2) + list(APPEND _RELEASE_NAMES ${_FP_PKG_NAME}-${VER}) + list(APPEND _DEBUG_NAMES ${_FP_PKG_NAME}_d-${VER}) +endforeach() +set(_DIR jccl-1.4) +set(_HEADER jccl/jcclConfig.h) + +include(SelectLibraryConfigurations) +include(CreateImportedTarget) +include(CleanLibraryList) +include(CleanDirectoryList) + +if(JCCL14_FIND_QUIETLY) + set(_FIND_FLAGS "QUIET") +else() + set(_FIND_FLAGS "") +endif() + +# Try flagpoll. +find_package(Flagpoll QUIET) + +if(FLAGPOLL) + flagpoll_get_include_dirs(${_FP_PKG_NAME} NO_DEPS) + flagpoll_get_library_dirs(${_FP_PKG_NAME} NO_DEPS) +endif() + +set(JCCL14_ROOT_DIR + "${JCCL14_ROOT_DIR}" + CACHE + PATH + "Root directory to search for JCCL") +if(DEFINED VRJUGGLER30_ROOT_DIR) + mark_as_advanced(JCCL14_ROOT_DIR) +endif() +if(NOT JCCL14_ROOT_DIR) + set(JCCL14_ROOT_DIR "${VRJUGGLER30_ROOT_DIR}") +endif() + +set(_ROOT_DIR ${JCCL14_ROOT_DIR}) + +find_path(JCCL14_INCLUDE_DIR + ${_HEADER} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_INCLUDE_DIRS} + PATH_SUFFIXES + ${_DIR} + include/${_DIR} + include/ + DOC + "Path to ${_HUMAN} includes root") + +find_library(JCCL14_LIBRARY_RELEASE + NAMES + ${_RELEASE_NAMES} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBSUFFIXES} + DOC + "${_HUMAN} release library full path") + +find_library(JCCL14_LIBRARY_DEBUG + NAMES + ${_DEBUG_NAMES} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBDSUFFIXES} + DOC + "${_HUMAN} debug library full path") + +select_library_configurations(JCCL14) + +# Dependency +if(NOT VPR22_FOUND) + find_package(VPR22 ${_FIND_FLAGS}) +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(JCCL14 + DEFAULT_MSG + JCCL14_LIBRARY + JCCL14_INCLUDE_DIR + VPR22_FOUND + VPR22_LIBRARIES + VPR22_INCLUDE_DIR) + +if(JCCL14_FOUND) + set(_DEPS ${VPR22_LIBRARIES}) + + set(JCCL14_INCLUDE_DIRS ${JCCL14_INCLUDE_DIR}) + list(APPEND JCCL14_INCLUDE_DIRS ${VPR22_INCLUDE_DIRS}) + clean_directory_list(JCCL14_INCLUDE_DIRS) + + if(VRJUGGLER30_CREATE_IMPORTED_TARGETS) + create_imported_target(JCCL14 ${_DEPS}) + else() + clean_library_list(JCCL14_LIBRARIES) + endif() + + mark_as_advanced(JCCL14_ROOT_DIR) +endif() + +mark_as_advanced(JCCL14_LIBRARY_RELEASE + JCCL14_LIBRARY_DEBUG + JCCL14_INCLUDE_DIR) diff --git a/lib/wiiuse/cmake/FindJsonCpp.cmake b/lib/wiiuse/cmake/FindJsonCpp.cmake new file mode 100644 index 000000000..28fca2f9f --- /dev/null +++ b/lib/wiiuse/cmake/FindJsonCpp.cmake @@ -0,0 +1,392 @@ +# - Find jsoncpp - Overarching find module +# This is a over-arching find module to find older jsoncpp versions and those sadly built +# without JSONCPP_WITH_CMAKE_PACKAGE=ON, as well as those built with the cmake config file. +# It also wraps the different versions of the module. +# +# On CMake 3.0 and newer: +# JsonCpp::JsonCpp - Imported target (possibly an interface/alias) to use: +# if anything is populated, this is. If both shared and static are found, then +# this will be the static version on DLL platforms and shared on non-DLL platforms. +# JsonCpp::JsonCppShared - Imported target (possibly an interface/alias) for a +# shared library version. +# JsonCpp::JsonCppStatic - Imported target (possibly an interface/alias) for a +# static library version. +# +# On all CMake versions: (Note that on CMake 2.8.10 and earlier, you may need to use JSONCPP_INCLUDE_DIRS) +# JSONCPP_LIBRARY - wraps JsonCpp::JsonCpp or equiv. +# JSONCPP_LIBRARY_IS_SHARED - if we know for sure JSONCPP_LIBRARY is shared, this is true-ish. We try to "un-set" it if we don't know one way or another. +# JSONCPP_LIBRARY_SHARED - wraps JsonCpp::JsonCppShared or equiv. +# JSONCPP_LIBRARY_STATIC - wraps JsonCpp::JsonCppStatic or equiv. +# JSONCPP_INCLUDE_DIRS - Include directories - should (generally?) not needed if you require CMake 2.8.11+ since it handles target include directories. +# +# JSONCPP_FOUND - True if JsonCpp was found. +# +# Original Author: +# 2016 Ryan Pavlik +# Incorporates work from the module contributed to VRPN under the same license: +# 2011 Philippe Crassous (ENSAM ParisTech / Institut Image) p.crassous _at_ free.fr +# +# Copyright Philippe Crassous 2011. +# Copyright Sensics, Inc. 2016. +# 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(__jsoncpp_have_namespaced_targets OFF) +set(__jsoncpp_have_interface_support OFF) +if(NOT ("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 3.0)) + set(__jsoncpp_have_namespaced_targets ON) + set(__jsoncpp_have_interface_support ON) +elseif(("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" EQUAL 2.8) AND "${CMAKE_PATCH_VERSION}" GREATER 10) + set(__jsoncpp_have_interface_support ON) +endif() + +# sets __jsoncpp_have_jsoncpplib based on whether or not we have a real imported jsoncpp_lib target. +macro(_jsoncpp_check_for_real_jsoncpplib) + set(__jsoncpp_have_jsoncpplib FALSE) + if(TARGET jsoncpp_lib) + get_property(__jsoncpp_lib_type TARGET jsoncpp_lib PROPERTY TYPE) + # We make interface libraries. If an actual config module made it, it would be an imported library. + if(NOT __jsoncpp_lib_type STREQUAL "INTERFACE_LIBRARY") + set(__jsoncpp_have_jsoncpplib TRUE) + endif() + endif() + #message(STATUS "__jsoncpp_have_jsoncpplib ${__jsoncpp_have_jsoncpplib}") +endmacro() + +include(FindPackageHandleStandardArgs) +# Ensure that if this is TRUE later, it's because we set it. +set(JSONCPP_FOUND FALSE) +set(__jsoncpp_have_jsoncpplib FALSE) + +# See if we find a CMake config file - there is no harm in calling this more than once, +# and we need to call it at least once every CMake invocation to create the original +# imported targets, since those don't stick around like cache variables. +find_package(jsoncpp QUIET NO_MODULE) + +if(jsoncpp_FOUND) + # Build a string to help us figure out when to invalidate our cache variables. + # start with where we found jsoncpp + set(__jsoncpp_info_string "[${jsoncpp_DIR}]") + + # part of the string to indicate if we found a real jsoncpp_lib (and what kind) + _jsoncpp_check_for_real_jsoncpplib() + + macro(_jsoncpp_apply_map_config target) + if(MSVC) + # Can't do this - different runtimes, incompatible ABI, etc. + set(_jsoncpp_debug_fallback) + else() + set(_jsoncpp_debug_fallback DEBUG) + #osvr_stash_map_config(DEBUG DEBUG RELWITHDEBINFO RELEASE MINSIZEREL NONE) + endif() + # Appending, just in case using project or upstream fixes this. + set_property(TARGET ${target} APPEND PROPERTY MAP_IMPORTED_CONFIG_RELEASE RELEASE RELWITHDEBINFO MINSIZEREL NONE ${_jsoncpp_debug_fallback}) + set_property(TARGET ${target} APPEND PROPERTY MAP_IMPORTED_CONFIG_RELWITHDEBINFO RELWITHDEBINFO RELEASE MINSIZEREL NONE ${_jsoncpp_debug_fallback}) + set_property(TARGET ${target} APPEND PROPERTY MAP_IMPORTED_CONFIG_MINSIZEREL MINSIZEREL RELEASE RELWITHDEBINFO NONE ${_jsoncpp_debug_fallback}) + set_property(TARGET ${target} APPEND PROPERTY MAP_IMPORTED_CONFIG_NONE RELEASE RELWITHDEBINFO MINSIZEREL ${_jsoncpp_debug_fallback}) + if(NOT MSVC) + set_property(TARGET ${target} APPEND PROPERTY MAP_IMPORTED_CONFIG_DEBUG DEBUG RELWITHDEBINFO RELEASE MINSIZEREL NONE) + endif() + endmacro() + if(__jsoncpp_have_jsoncpplib) + list(APPEND __jsoncpp_info_string "[${__jsoncpp_lib_type}]") + _jsoncpp_apply_map_config(jsoncpp_lib) + else() + list(APPEND __jsoncpp_info_string "[]") + endif() + # part of the string to indicate if we found jsoncpp_lib_static + if(TARGET jsoncpp_lib_static) + list(APPEND __jsoncpp_info_string "[T]") + _jsoncpp_apply_map_config(jsoncpp_lib_static) + else() + list(APPEND __jsoncpp_info_string "[]") + endif() +endif() + + +# If we found something, and it's not the exact same as what we've found before... +# NOTE: The contents of this "if" block update only (internal) cache variables! +# (since this will only get run the first CMake pass that finds jsoncpp or that finds a different/updated install) +if(jsoncpp_FOUND AND NOT __jsoncpp_info_string STREQUAL "${JSONCPP_CACHED_JSONCPP_DIR_DETAILS}") + #message("Updating jsoncpp cache variables! ${__jsoncpp_info_string}") + set(JSONCPP_CACHED_JSONCPP_DIR_DETAILS "${__jsoncpp_info_string}" CACHE INTERNAL "" FORCE) + unset(JSONCPP_IMPORTED_LIBRARY_SHARED) + unset(JSONCPP_IMPORTED_LIBRARY_STATIC) + unset(JSONCPP_IMPORTED_LIBRARY) + unset(JSONCPP_IMPORTED_INCLUDE_DIRS) + unset(JSONCPP_IMPORTED_LIBRARY_IS_SHARED) + + # if(__jsoncpp_have_jsoncpplib) is equivalent to if(TARGET jsoncpp_lib) except it excludes our + # "invented" jsoncpp_lib interface targets, made for convenience purposes after this block. + + if(__jsoncpp_have_jsoncpplib AND TARGET jsoncpp_lib_static) + + # A veritable cache of riches - we have both shared and static! + set(JSONCPP_IMPORTED_LIBRARY_SHARED jsoncpp_lib CACHE INTERNAL "" FORCE) + set(JSONCPP_IMPORTED_LIBRARY_STATIC jsoncpp_lib_static CACHE INTERNAL "" FORCE) + if(WIN32 OR CYGWIN OR MINGW) + # DLL platforms: static library should be default + set(JSONCPP_IMPORTED_LIBRARY ${JSONCPP_IMPORTED_LIBRARY_STATIC} CACHE INTERNAL "" FORCE) + set(JSONCPP_IMPORTED_LIBRARY_IS_SHARED FALSE CACHE INTERNAL "" FORCE) + else() + # Other platforms - might require PIC to be linked into shared libraries, so safest to prefer shared. + set(JSONCPP_IMPORTED_LIBRARY ${JSONCPP_IMPORTED_LIBRARY_SHARED} CACHE INTERNAL "" FORCE) + set(JSONCPP_IMPORTED_LIBRARY_IS_SHARED TRUE CACHE INTERNAL "" FORCE) + endif() + + elseif(TARGET jsoncpp_lib_static) + # Well, only one variant, but we know for sure that it's static. + set(JSONCPP_IMPORTED_LIBRARY_STATIC jsoncpp_lib_static CACHE INTERNAL "" FORCE) + set(JSONCPP_IMPORTED_LIBRARY jsoncpp_lib_static CACHE INTERNAL "" FORCE) + set(JSONCPP_IMPORTED_LIBRARY_IS_SHARED FALSE CACHE INTERNAL "" FORCE) + + elseif(__jsoncpp_have_jsoncpplib AND __jsoncpp_lib_type STREQUAL "STATIC_LIBRARY") + # We were able to figure out the mystery library is static! + set(JSONCPP_IMPORTED_LIBRARY_STATIC jsoncpp_lib CACHE INTERNAL "" FORCE) + set(JSONCPP_IMPORTED_LIBRARY jsoncpp_lib CACHE INTERNAL "" FORCE) + set(JSONCPP_IMPORTED_LIBRARY_IS_SHARED FALSE CACHE INTERNAL "" FORCE) + + elseif(__jsoncpp_have_jsoncpplib AND __jsoncpp_lib_type STREQUAL "SHARED_LIBRARY") + # We were able to figure out the mystery library is shared! + set(JSONCPP_IMPORTED_LIBRARY_SHARED jsoncpp_lib CACHE INTERNAL "" FORCE) + set(JSONCPP_IMPORTED_LIBRARY jsoncpp_lib CACHE INTERNAL "" FORCE) + set(JSONCPP_IMPORTED_LIBRARY_IS_SHARED TRUE CACHE INTERNAL "" FORCE) + + elseif(__jsoncpp_have_jsoncpplib) + # One variant, and we have no idea if this is just an old version or if + # this is shared based on the target name alone. Hmm. + set(JSONCPP_IMPORTED_LIBRARY jsoncpp_lib CACHE INTERNAL "" FORCE) + endif() + + # Now, we need include directories. Can't just limit this to old CMakes, since + # new CMakes might be used to build projects designed to support older ones. + if(__jsoncpp_have_jsoncpplib) + get_property(__jsoncpp_interface_include_dirs TARGET jsoncpp_lib PROPERTY INTERFACE_INCLUDE_DIRECTORIES) + if(__jsoncpp_interface_include_dirs) + set(JSONCPP_IMPORTED_INCLUDE_DIRS "${__jsoncpp_interface_include_dirs}" CACHE INTERNAL "" FORCE) + endif() + endif() + if(TARGET jsoncpp_lib_static AND NOT JSONCPP_IMPORTED_INCLUDE_DIRS) + get_property(__jsoncpp_interface_include_dirs TARGET jsoncpp_lib_static PROPERTY INTERFACE_INCLUDE_DIRECTORIES) + if(__jsoncpp_interface_include_dirs) + set(JSONCPP_IMPORTED_INCLUDE_DIRS "${__jsoncpp_interface_include_dirs}" CACHE INTERNAL "" FORCE) + endif() + endif() +endif() + +# As a convenience... +if(TARGET jsoncpp_lib_static AND NOT TARGET jsoncpp_lib) + add_library(jsoncpp_lib INTERFACE) + target_link_libraries(jsoncpp_lib INTERFACE jsoncpp_lib_static) +endif() + +if(JSONCPP_IMPORTED_LIBRARY) + if(NOT JSONCPP_IMPORTED_INCLUDE_DIRS) + # OK, so we couldn't get it from the target... maybe we can figure it out from jsoncpp_DIR. + + # take off the jsoncpp component + get_filename_component(__jsoncpp_import_root "${jsoncpp_DIR}/.." ABSOLUTE) + set(__jsoncpp_hints "${__jsoncpp_import_root}") + # take off the cmake component + get_filename_component(__jsoncpp_import_root "${__jsoncpp_import_root}/.." ABSOLUTE) + list(APPEND __jsoncpp_hints "${__jsoncpp_import_root}") + # take off the lib component + get_filename_component(__jsoncpp_import_root "${__jsoncpp_import_root}/.." ABSOLUTE) + list(APPEND __jsoncpp_hints "${__jsoncpp_import_root}") + # take off one more component in case of multiarch lib + get_filename_component(__jsoncpp_import_root "${__jsoncpp_import_root}/.." ABSOLUTE) + list(APPEND __jsoncpp_hints "${__jsoncpp_import_root}") + + # Now, search. + find_path(JsonCpp_INCLUDE_DIR + NAMES + json/json.h + PATH_SUFFIXES include jsoncpp include/jsoncpp + HINTS ${__jsoncpp_hints}) + if(JsonCpp_INCLUDE_DIR) + mark_as_advanced(JsonCpp_INCLUDE_DIR) + # Note - this does not set it in the cache, in case we find it better at some point in the future! + set(JSONCPP_IMPORTED_INCLUDE_DIRS ${JsonCpp_INCLUDE_DIR}) + endif() + endif() + + find_package_handle_standard_args(JsonCpp + DEFAULT_MSG + jsoncpp_DIR + JSONCPP_IMPORTED_LIBRARY + JSONCPP_IMPORTED_INCLUDE_DIRS) +endif() + +if(JSONCPP_FOUND) + # Create any missing namespaced targets from the config module. + if(__jsoncpp_have_namespaced_targets) + if(JSONCPP_IMPORTED_LIBRARY AND NOT TARGET JsonCpp::JsonCpp) + add_library(JsonCpp::JsonCpp INTERFACE IMPORTED) + set_target_properties(JsonCpp::JsonCpp PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${JSONCPP_IMPORTED_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${JSONCPP_IMPORTED_LIBRARY}") + endif() + + if(JSONCPP_IMPORTED_LIBRARY_SHARED AND NOT TARGET JsonCpp::JsonCppShared) + add_library(JsonCpp::JsonCppShared INTERFACE IMPORTED) + set_target_properties(JsonCpp::JsonCppShared PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${JSONCPP_IMPORTED_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${JSONCPP_IMPORTED_LIBRARY_SHARED}") + endif() + + if(JSONCPP_IMPORTED_LIBRARY_STATIC AND NOT TARGET JsonCpp::JsonCppStatic) + add_library(JsonCpp::JsonCppStatic INTERFACE IMPORTED) + set_target_properties(JsonCpp::JsonCppStatic PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${JSONCPP_IMPORTED_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${JSONCPP_IMPORTED_LIBRARY_STATIC}") + endif() + + # Hide the stuff we didn't, and no longer, need. + if(NOT JsonCpp_LIBRARY) + unset(JsonCpp_LIBRARY CACHE) + endif() + if(NOT JsonCpp_INCLUDE_DIR) + unset(JsonCpp_INCLUDE_DIR CACHE) + endif() + endif() + + set(JSONCPP_LIBRARY ${JSONCPP_IMPORTED_LIBRARY}) + set(JSONCPP_INCLUDE_DIRS ${JSONCPP_IMPORTED_INCLUDE_DIRS}) + if(DEFINED JSONCPP_IMPORTED_LIBRARY_IS_SHARED) + set(JSONCPP_LIBRARY_IS_SHARED ${JSONCPP_IMPORTED_LIBRARY_IS_SHARED}) + else() + unset(JSONCPP_LIBRARY_IS_SHARED) + endif() + + if(JSONCPP_IMPORTED_LIBRARY_SHARED) + set(JSONCPP_LIBRARY_SHARED ${JSONCPP_IMPORTED_LIBRARY_SHARED}) + endif() + + if(JSONCPP_IMPORTED_LIBRARY_STATIC) + set(JSONCPP_LIBRARY_STATIC ${JSONCPP_IMPORTED_LIBRARY_STATIC}) + endif() +endif() + +# Still nothing after looking for the config file: must go "old-school" +if(NOT JSONCPP_FOUND) + # Invoke pkgconfig for hints + find_package(PkgConfig QUIET) + set(_JSONCPP_INCLUDE_HINTS) + set(_JSONCPP_LIB_HINTS) + if(PKG_CONFIG_FOUND) + pkg_search_module(_JSONCPP_PC QUIET jsoncpp) + if(_JSONCPP_PC_INCLUDE_DIRS) + set(_JSONCPP_INCLUDE_HINTS ${_JSONCPP_PC_INCLUDE_DIRS}) + endif() + if(_JSONCPP_PC_LIBRARY_DIRS) + set(_JSONCPP_LIB_HINTS ${_JSONCPP_PC_LIBRARY_DIRS}) + endif() + if(_JSONCPP_PC_LIBRARIES) + set(_JSONCPP_LIB_NAMES ${_JSONCPP_PC_LIBRARIES}) + endif() + endif() + + if(NOT _JSONCPP_LIB_NAMES) + # OK, if pkg-config wasn't able to give us a library name suggestion, then we may + # have to resort to some intense old logic. + set(_JSONCPP_LIB_NAMES jsoncpp) + set(_JSONCPP_PATHSUFFIXES) + + if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + list(APPEND _JSONCPP_PATHSUFFIXES + linux-gcc) # bit of a generalization but close... + endif() + if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_SYSTEM_NAME STREQUAL "Linux") + list(APPEND + _JSONCPP_LIB_NAMES + json_linux-gcc-${CMAKE_CXX_COMPILER_VERSION}_libmt + json_linux-gcc_libmt) + list(APPEND _JSONCPP_PATHSUFFIXES + linux-gcc-${CMAKE_CXX_COMPILER_VERSION}) + + elseif(MSVC) + if(MSVC_VERSION EQUAL 1200) + list(APPEND _JSONCPP_LIB_NAMES json_vc6_libmt) + list(APPEND _JSONCPP_PATHSUFFIXES msvc6) + elseif(MSVC_VERSION EQUAL 1300) + list(APPEND _JSONCPP_LIB_NAMES json_vc7_libmt) + list(APPEND _JSONCPP_PATHSUFFIXES msvc7) + elseif(MSVC_VERSION EQUAL 1310) + list(APPEND _JSONCPP_LIB_NAMES json_vc71_libmt) + list(APPEND _JSONCPP_PATHSUFFIXES msvc71) + elseif(MSVC_VERSION EQUAL 1400) + list(APPEND _JSONCPP_LIB_NAMES json_vc8_libmt) + list(APPEND _JSONCPP_PATHSUFFIXES msvc80) + elseif(MSVC_VERSION EQUAL 1500) + list(APPEND _JSONCPP_LIB_NAMES json_vc9_libmt) + list(APPEND _JSONCPP_PATHSUFFIXES msvc90) + elseif(MSVC_VERSION EQUAL 1600) + list(APPEND _JSONCPP_LIB_NAMES json_vc10_libmt) + list(APPEND _JSONCPP_PATHSUFFIXES msvc10 msvc100) + endif() + + elseif(MINGW) + list(APPEND _JSONCPP_LIB_NAMES + json_mingw_libmt) + list(APPEND _JSONCPP_PATHSUFFIXES mingw) + + else() + list(APPEND _JSONCPP_LIB_NAMES + json_suncc_libmt + json_vacpp_libmt) + endif() + endif() # end of old logic + + # Actually go looking. + find_path(JsonCpp_INCLUDE_DIR + NAMES + json/json.h + PATH_SUFFIXES jsoncpp + HINTS ${_JSONCPP_INCLUDE_HINTS}) + find_library(JsonCpp_LIBRARY + NAMES + ${_JSONCPP_LIB_NAMES} + PATHS libs + PATH_SUFFIXES ${_JSONCPP_PATHSUFFIXES} + HINTS ${_JSONCPP_LIB_HINTS}) + + find_package_handle_standard_args(JsonCpp + DEFAULT_MSG + JsonCpp_INCLUDE_DIR + JsonCpp_LIBRARY) + + if(JSONCPP_FOUND) + # We already know that the target doesn't exist, let's make it. + # TODO don't know why we get errors like: + # error: 'JsonCpp::JsonCpp-NOTFOUND', needed by 'bin/osvr_json_to_c', missing and no known rule to make it + # when we do the imported target commented out below. So, instead, we make an interface + # target with an alias. Hmm. + + #add_library(JsonCpp::JsonCpp UNKNOWN IMPORTED) + #set_target_properties(JsonCpp::JsonCpp PROPERTIES + # IMPORTED_LOCATION "${JsonCpp_LIBRARY}" + # INTERFACE_INCLUDE_DIRECTORIES "${JsonCpp_INCLUDE_DIR}" + # IMPORTED_LINK_INTERFACE_LANGUAGES "CXX") + + set(JSONCPP_LIBRARY "${JsonCpp_LIBRARY}") + set(JSONCPP_INCLUDE_DIRS "${JsonCpp_INCLUDE_DIR}") + unset(JSONCPP_LIBRARY_IS_SHARED) + + if(__jsoncpp_have_interface_support AND NOT TARGET jsoncpp_interface) + add_library(jsoncpp_interface INTERFACE) + set_target_properties(jsoncpp_interface PROPERTIES + INTERFACE_LINK_LIBRARIES "${JsonCpp_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${JsonCpp_INCLUDE_DIR}") + endif() + if(__jsoncpp_have_namespaced_targets) + if(NOT TARGET JsonCpp::JsonCpp) + add_library(JsonCpp::JsonCpp ALIAS jsoncpp_interface) + endif() + endif() + endif() +endif() + +if(JSONCPP_FOUND) + mark_as_advanced(jsoncpp_DIR JsonCpp_INCLUDE_DIR JsonCpp_LIBRARY) +endif() diff --git a/lib/wiiuse/cmake/FindJtTk.cmake b/lib/wiiuse/cmake/FindJtTk.cmake new file mode 100644 index 000000000..9ef214157 --- /dev/null +++ b/lib/wiiuse/cmake/FindJtTk.cmake @@ -0,0 +1,455 @@ +# - try to find JTTK library +# +# JTTK_LIBRARY_DIRS, library search path +# JTTK_INCLUDE_DIRS, include search path +# JTTK_{component}_LIBRARY, the library to link against +# JTTK_ENVIRONMENT, environment variables to set +# JTTK_RUNTIME_LIBRARY_DIRS +# JTTK_FOUND, If false, do not try to use this library. +# +# If you have license issues, you might run this command on each JtTk-using target: +# jttk_stamp_binary() +# +# Plural versions refer to this library and its dependencies, and +# are recommended to be used instead, unless you have a good reason. +# +# Useful configuration variables you might want to add to your cache: +# JTTK_ROOT_DIR - A directory prefix to search +# (a path that contains include/ as a subdirectory) +# +# 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) + +include(ListCombinations) +include(CheckVersion) +include(GetDirectoryList) +include(PrefixListGlob) +include(GetCompilerInfoString) +if(WIN32) + include(ProgramFilesGlob) +endif() + +set(JTTK_ROOT_DIR + "${JTTK_ROOT_DIR}" + CACHE + PATH + "Root directory to search for JtTk") + +if(NOT JTTK_CUSTOMER_ID) + set(JTTK_CUSTOMER_ID "$ENV{JTTK_CUSTOMER_ID}") +endif() + +set(JTTK_CUSTOMER_ID + "${JTTK_CUSTOMER_ID}" + CACHE + STRING + "JtTk customer ID, to place in the environment") + + +get_filename_component(_jttk_mod_dir "${CMAKE_CURRENT_LIST_FILE}" PATH) + +if(NOT BITS) + if(CMAKE_SIZEOF_VOID_P MATCHES "8") + set(BITS 64) + else() + set(BITS 32) + endif() +endif() + +set(JTTK_ENVIRONMENT "JTTK_DEV_PLATFORM=${BITS}") +if(JTTK_CUSTOMER_ID) + list(APPEND JTTK_ENVIRONMENT "JTTK_CUSTOMER_ID=${JTTK_CUSTOMER_ID}") +endif() + +if(WIN32 AND MSVC) + if(MSVC90) + set(VC_VER vc9) + set(VC_VER_LONG vc90) + elseif(MSVC80) + set(VC_VER vc8) + set(VC_VER_LONG vc80) + elseif(MSVC71) + set(VC_VER vc71) + set(VC_VER_LONG vc71) + endif() + + if(BITS EQUAL 32) + set(PLATFORM win32) + else() + set(PLATFORM win64) + endif() +endif() + +if(NOT "${3RDPARTYROOT}") + set(3RDPARTYROOT ${CMAKE_SOURCE_DIR}/third-party) +endif() + +set(libsearchdirs) +set(includesearchdirs) +set(_jttklibs) +set(_libsuffixes) +if(WIN32) + program_files_fallback_glob(_dirs "/UGS/JTOpenToolkit/*/dev") + program_files_fallback_glob(_dirs2 "/Siemens/JTOpenToolkit/*/dev") + list(APPEND _dirs ${_dirs2}) + + file(TO_CMAKE_PATH "$ENV{JTTK_DEV_PATH}" _envloc) + list(APPEND _dirs "${_envloc}") + + if(MSVC90) + prefix_list_glob(_vc9_libdirs + "/lib/win_${BITS}vc9/JtTk*.dll" + "${JTTK_ROOT_DIR}" + ${_dirs}) + list(APPEND _jttklibs ${_vc9_libdirs}) + prefix_list_glob(_vc9_libdirs + "/lib/win_${BITS}_vc9/JtTk*.dll" + "${JTTK_ROOT_DIR}" + ${_dirs}) + list(APPEND _jttklibs ${_vc9_libdirs}) + list(APPEND _libsuffixes "/lib/win_${BITS}vc9" "/lib/win_${BITS}_vc9") + endif() + if(MSVC80) + prefix_list_glob(_vc8_libdirs + "/lib/win_${BITS}/JtTk*.dll" + "${JTTK_ROOT_DIR}" + ${_dirs}) + list(APPEND _jttklibs ${_vc8_libdirs}) + list(APPEND _libsuffixes "/lib/win_${BITS}") + endif() + if(MSVC71) + prefix_list_glob(_vc71_libdirs + "/lib/win_${BITS}vs7/JtTk*.dll" + "${dirs}") + list(APPEND _jttklibs "${_vc71_libdirs}") + list(APPEND _libsuffixes "/lib/win_${BITS}vs7") + endif() + +elseif(UNIX) + + get_gcc_version(_gccver) + if("${_gccver}" VERSION_LESS "4.1.0") + set(_compiler "") + else() + set(_compiler "_gcc41") + endif() + + string(TOLOWER "${CMAKE_SYSTEM_NAME}" _sysname) + file(TO_CMAKE_PATH "$ENV{JTTK_DEV_PATH}" _envloc) + prefix_list_glob(_jttklibs + "/lib/${_sysname}_${BITS}${_compiler}/libJtTk*" + "${JTTK_ROOT_DIR}" + "/usr/" + "/usr/local/" + "/usr/local/siemens/" + "/usr/local/ugs/") + prefix_list_glob(_jttklibs2 + "/dev/lib/${_sysname}_${BITS}${_compiler}/libJtTk*" + "${JTTK_ROOT_DIR}" + "/usr/" + "/usr/local/" + "/usr/local/siemens/" + "/usr/local/ugs/" + "${_envloc}/") + list(APPEND _jttklibs ${_jttklibs2}) + + list(APPEND _libsuffixes "/lib/${_sysname}_${BITS}${_compiler}") +endif() + +foreach(_lib ${_jttklibs}) + string(REGEX MATCH "JtTk[0-9][0-9]" _jttkver "${_lib}") + if(_jttkver) + string(REGEX + REPLACE + "JtTk([0-9])([0-9])" + "\\1.\\2" + _verstd + "${_jttkver}") + string(REGEX + REPLACE + "JtTk([0-9])([0-9])" + "\\1\\2" + _vernodot + "${_jttkver}") + endif() + check_version(_result JtTk "${_verstd}") + if(_result) + get_filename_component(_libpath "${_lib}" PATH) + list(APPEND JTTK_JTTK_VERSIONS ${_vernodot}) + list(APPEND JTTK_DEV_PATHS "${_libpath}") + else() + #message(STATUS "Found JtTk version ${ver}, does not meet requirements") + endif() +endforeach() + +if(JTTK_JTTK_VERSIONS) + list(SORT JTTK_JTTK_VERSIONS) + list(REVERSE JTTK_JTTK_VERSIONS) +endif() + +### +# Configure JtTk +### + +### +# Find the link library +### +list_combinations(names PREFIXES "JtTk" SUFFIXES ${JTTK_JTTK_VERSIONS}) +find_library(JTTK_JtTk_LIBRARY + NAMES + ${names} + HINTS + ${JTTK_DEV_PATHS} + PATH_SUFFIXES + ${_libsuffixes}) +set(JTTK_LIBRARY "${JTTK_JtTk_LIBRARY}") +set(JTTK_LIBRARIES "${JTTK_JtTk_LIBRARY}") + +### +# Prepare for the rest of our search based off of where we found the link library +### +get_filename_component(JTTK_LIBRARY_DIR "${JTTK_LIBRARY}" PATH) +get_filename_component(JTTK_DEV_PATH + "${JTTK_LIBRARY_DIR}/../.." + ABSOLUTE) + +# Grab JtTk version +string(REGEX MATCH "JtTk[0-9]*" _ver "${JTTK_LIBRARY}") +string(REGEX + REPLACE + "JtTk([0-9])([0-9])" + "\\1.\\2" + JTTK_JTTK_VERSION + "${_ver}") +string(REGEX + REPLACE + "JtTk([0-9])([0-9])" + "\\1\\2" + JTTK_JTTK_VERNODOT + "${_ver}") + +# Grab JT version +file(GLOB _jtdll "${JTTK_LIBRARY_DIR}/*JtBrep*") +string(REGEX MATCH "JtBrep[0-9]*" _jtver "${_jtdll}") +string(REGEX + REPLACE + "JtBrep([0-9])([0-9])" + "\\1\\2" + JTTK_JT_VERNODOT + "${_jtver}") + +# Setup dev path +get_filename_component(JTTK_DEV_PATH + "${JTTK_LIBRARY_DIR}/../../" + ABSOLUTE) + +list(APPEND JTTK_ENVIRONMENT "JTTK_DEV_PATH=${JTTK_DEV_PATH}") +set(ENV{JTTK_DEV_PLATFORM} ${BITS}) +set(ENV{JTTK_DEV_PATH} "${JTTK_DEV_PATH}") + +set(_deps_libs) +set(_deps_includes) +set(_deps_check) + +### +# Find the headers +### +find_path(JTTK_INCLUDE_DIR + JtTk/JtkEntity.h + HINTS + ${JTTK_DEV_PATH}/include) + +if(WIN32) + ### + # Find the DLL's + ### + + # Find the versioned DLL's + foreach(dll Jt JtBrep JtLibra JtSimp JtSupt JtXTBrep ParaSupt) + find_file(JTTK_${dll}_DLL + NAMES + "${dll}${JTTK_JT_VERNODOT}.dll" + HINTS + "${JTTK_LIBRARY_DIR}") + list(APPEND JTTK_DLLS ${JTTK_${dll}_DLL}) + mark_as_advanced(JTTK_${dll}_DLL) + endforeach() + + # Find the unversioned DLL's and the matching JtTk dll + foreach(dll psbodyshop pskernel psxttoolkit JtTk${JTTK_JTTK_VERNODOT}) + list_combinations(names PREFIXES "${dll}" SUFFIXES ".dll") + find_file(JTTK_${dll}_DLL + NAMES + ${names} + HINTS + "${JTTK_LIBRARY_DIR}") + list(APPEND JTTK_DLLS ${JTTK_${dll}_DLL}) + mark_as_advanced(JTTK_${dll}_DLL) + endforeach() + + get_directory_list(JTTK_RUNTIME_LIBRARY_DIRS ${JTTK_DLLS}) + +elseif(UNIX) + + foreach(_lib Jt JtBrep JtLibra JtSimp JtSupt JtXTBrep ParaSupt) + find_library(JTTK_${_lib}_LIBRARY + NAMES + "${_lib}${JTTK_JT_VERNODOT}" + HINTS + "${JTTK_LIBRARY_DIR}") + list(APPEND _deps_libs "${JTTK_${_lib}_LIBRARY}") + list(APPEND _deps_check JTTK_${_lib}_LIBRARY) + mark_as_advanced(JTTK_${_lib}_LIBRARY) + endforeach() + + # Find the unversioned libs + foreach(_lib psbodyshop pskernel psxttoolkit eaiunicode) + find_library(JTTK_${_lib}_LIBRARY + NAMES + ${_lib} + HINTS + "${JTTK_LIBRARY_DIR}") + list(APPEND _deps_libs "${JTTK_${_lib}_LIBRARY}") + list(APPEND _deps_check JTTK_${_lib}_LIBRARY) + mark_as_advanced(JTTK_${_lib}_LIBRARY) + endforeach() + + # Find stamper + #list(APPEND _deps_check JTTK_KEYS) + + find_program(JTTK_STAMP_COMMAND + stampkey + HINTS + "${JTTK_DEV_PATH}/../bin") + list(APPEND _deps_check JTTK_STAMP_COMMAND) + + find_program(JTTK_STAMP_PLATFORM_COMMAND + stampkey + HINTS + "${JTTK_DEV_PATH}/../bin/${_sysname}") + list(APPEND _deps_check JTTK_STAMP_PLATFORM_COMMAND) + + + if("${JTTK_KEYS}" STREQUAL "${JTTK_KEYS_AUTO}" OR NOT JTTK_KEYS) + find_file(JTTK_INSTALL_LOG + install.log + HINTS + "${JTTK_DEV_PATH}/.." + NO_DEFAULT_PATH) + #list(APPEND _deps_check JTTK_INSTALL_LOG) + mark_as_advanced(JTTK_INSTALL_LOG) + + if(JTTK_INSTALL_LOG) + file(READ "${JTTK_INSTALL_LOG}" _log) + string(REGEX MATCHALL "..key ([0-9A-Z])+" _keylines "${_log}") + set(JTTK_KEYS) + foreach(_keyline ${_keylines}) + string(REGEX + REPLACE + "..key (([0-9A-Z])+)$" + "\\1" + _key + "${_keyline}") + list(APPEND JTTK_KEYS "${_key}") + message(STATUS "Found JtTk key: ${_key}") + endforeach() + set(JTTK_KEYS + "${JTTK_KEYS}" + CACHE + STRING + "A semi-colon separated list of JtTk keys to stamp on the binaries." + FORCE) + set(JTTK_KEYS_AUTO + "${JTTK_KEYS}" + CACHE + INTERNAL + "The keys we auto-detected" + FORCE) + endif() + else() + foreach(_key ${JTTK_KEYS}) + message(STATUS "Using cached JtTk key: ${_key}") + endforeach() + set(JTTK_KEYS + "${JTTK_KEYS}" + CACHE + STRING + "A semi-colon separated list of JtTk keys to stamp on the binaries.") + endif() + + # Find dependencies + find_library(JTTK_MATH_LIBRARY m) + mark_as_advanced(JTTK_MATH_LIBRARY) + list(APPEND _deps_check JTTK_MATH_LIBRARY) + list(APPEND _deps_libs ${JTTK_MATH_LIBRARY}) + + if(NOT X11_FOUND) + find_package(X11) + endif() + list(APPEND _deps_check X11_FOUND) + list(APPEND _deps_libs ${X11_LIBRARIES}) + list(APPEND _deps_includes ${X11_INCLUDE_DIRS}) + + if(NOT OPENGL_FOUND) + find_package(OpenGL) + endif() + list(APPEND _deps_check OPENGL_FOUND) + list(APPEND _deps_libs ${OPENGL_LIBRARIES}) + list(APPEND _deps_includes ${OPENGL_INCLUDE_DIR}) + + if(NOT THREADS_FOUND) + find_package(Threads) + endif() + list(APPEND _deps_check THREADS_FOUND) + list(APPEND _deps_libs ${CMAKE_THREAD_LIBS_INIT}) + + get_directory_list(JTTK_RUNTIME_LIBRARY_DIRS ${_deps_libs}) +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(JtTk + DEFAULT_MSG + JTTK_JtTk_LIBRARY + JTTK_CUSTOMER_ID + JTTK_INCLUDE_DIR + ${_deps_check}) + +if(JTTK_FOUND) + set(JTTK_INCLUDE_DIRS "${JTTK_INCLUDE_DIR}" ${_deps_includes}) + set(JTTK_LIBRARIES "${JTTK_LIBRARY}" ${_deps_libs}) + mark_as_advanced(JTTK_CUSTOMER_ID JTTK_ROOT_DIR) +endif() + +function(jttk_stamp_binary _target) + if(UNIX) + get_target_property(_binary "${_target}" LOCATION) + configure_file("${_jttk_mod_dir}/FindJtTk.stampkey.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/${_target}.stampkey.cmake" + @ONLY) + add_custom_command(TARGET + "${_target}" + POST_BUILD + COMMAND + "${CMAKE_COMMAND}" + -P + "${CMAKE_CURRENT_BINARY_DIR}/${_target}.stampkey.cmake" + COMMENT + "Stamping executable ${_binary} with JtTk keys..." + VERBATIM) + endif() +endfunction() + +mark_as_advanced(JTTK_JtTk_LIBRARY + JTTK_INCLUDE_DIR + JTTK_KEYS + JTTK_STAMP_COMMAND + JTTK_STAMP_PLATFORM_COMMAND) diff --git a/lib/wiiuse/cmake/FindJtTk.stampkey.cmake.in b/lib/wiiuse/cmake/FindJtTk.stampkey.cmake.in new file mode 100644 index 000000000..53985d26f --- /dev/null +++ b/lib/wiiuse/cmake/FindJtTk.stampkey.cmake.in @@ -0,0 +1,42 @@ +# Small script to stamp the JtTk license key on an executable +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC + +set(ENV{JTTK_DEV_PLATFORM} @BITS@) +set(ENV{JTTK_DEV_PATH} @JTTK_DEV_PATH@) +set(ENV{LD_LIBRARY_PATH} "$ENV{LD_LIBRARY_PATH}:@JTTK_LIBRARY_DIR@") +set(ENV{PATH} "$ENV{PATH}:@JTTK_DEV_PATH@/../bin/") + +message(STATUS "The stamp commands are being run with these environment variables:") +execute_process(COMMAND ${CMAKE_COMMAND} -E environment) + +set(JTTK_KEYS @JTTK_KEYS@) +foreach(_key ${JTTK_KEYS}) + execute_process(COMMAND ${_command} @JTTK_STAMP_COMMAND@ ${_key} @_binary@ + RESULT_VARIABLE _result) + + if(NOT "${_result}" EQUAL "0") + message(STATUS "Failed (error ${_result}) running stamp command: +@JTTK_STAMP_COMMAND@ ${_key} @_binary@") + + else() + message(STATUS "Succeeded running stamp command: +@JTTK_STAMP_COMMAND@ ${_key} @_binary@") + endif() + + execute_process(COMMAND @JTTK_STAMP_PLATFORM_COMMAND@ ${_key} @_binary@ + RESULT_VARIABLE _result) + + if(NOT "${_result}" EQUAL "0") + message(STATUS "Failed (error ${_result}) running stamp command: +@JTTK_STAMP_PLATFORM_COMMAND@ ${_key} @_binary@") + + else() + message(STATUS "Succeeded running stamp command: +@JTTK_STAMP_PLATFORM_COMMAND@ ${_key} @_binary@") + endif() + +endforeach() diff --git a/lib/wiiuse/cmake/FindLAPACKLibs.cmake b/lib/wiiuse/cmake/FindLAPACKLibs.cmake new file mode 100644 index 000000000..51d0c41dd --- /dev/null +++ b/lib/wiiuse/cmake/FindLAPACKLibs.cmake @@ -0,0 +1,91 @@ +# - Try to find LAPACK and BLAS libraries +# Once done, this will define +# LAPACKLIBS_LIBRARIES, all libraries to link against +# LAPACKLIBS_FOUND, If false, do not try to use LAPACK library features. +# +# Users may wish to set: +# LAPACKLIBS_ROOT_DIR, location to start searching for LAPACK libraries +# +# 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) + +set(_check) + +set(LAPACKLIBS_ROOT_DIR + "${LAPACKLIBS_ROOT_DIR}" + CACHE + PATH + "Directory to search for LAPACK libraries") + +if(APPLE) + find_library(LAPACKLIBS_VECLIB_FRAMEWORK veclib) + find_library(LAPACKLIBS_ACCELERATE_FRAMEWORK accelerate) + mark_as_advanced(LAPACKLIBS_VECLIB_FRAMEWORK + LAPACKLIBS_ACCELERATE_FRAMEWORK) + + set(LAPACKLIBS_LIBRARIES + "${LAPACKLIBS_VECLIB_FRAMEWORK}" + "${LAPACKLIBS_ACCELERATE_FRAMEWORK}") + list(APPEND + _check + LAPACKLIBS_VECLIB_FRAMEWORK + LAPACKLIBS_ACCELERATE_FRAMEWORK) +elseif(WIN32) + # Tested to work with the files from http://www.fi.muni.cz/~xsvobod2/misc/lapack/ + # You might also see http://icl.cs.utk.edu/lapack-for-windows/clapack/index.html for + # the libraries and headers. + + # Good luck! + + find_library(LAPACKLIBS_LAPACK_LIBRARY + NAMES + lapack_win32_MT + lapack + lapackd + HINTS + ${LAPACKLIBS_ROOT_DIR} + PATH_SUFFIXES + lapack-MT-release + lapack-MT-debug + lib) + find_library(LAPACKLIBS_BLAS_LIBRARY + NAMES + blas_win32_MT + blas + blasd + HINTS + ${LAPACKLIBS_ROOT_DIR} + PATH_SUFFIXES + lapack-MT-release + lapack-MT-debug + lib) + set(LAPACKLIBS_LIBRARIES + "${LAPACKLIBS_LAPACK_LIBRARY}" + "${LAPACKLIBS_BLAS_LIBRARY}") + list(APPEND _check LAPACKLIBS_LAPACK_LIBRARY LAPACKLIBS_BLAS_LIBRARY) +elseif(UNIX) + # All other Linux/Unix should have lapack without a fuss + list(APPEND _check LAPACKLIBS_LAPACK_LIBRARY) + find_library(LAPACKLIBS_LAPACK_LIBRARY lapack) + set(LAPACKLIBS_LIBRARIES "${LAPACKLIBS_LAPACK_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(LAPACKLibs + DEFAULT_MSG + ${_check}) + +if(LAPACKLIBS_FOUND) + mark_as_advanced(LAPACKLIBS_ROOT_DIR + LAPACKLIBS_LAPACK_LIBRARY + LAPACKLIBS_BLAS_LIBRARY) +endif() diff --git a/lib/wiiuse/cmake/FindLibFreespace.cmake b/lib/wiiuse/cmake/FindLibFreespace.cmake new file mode 100644 index 000000000..b83e837bb --- /dev/null +++ b/lib/wiiuse/cmake/FindLibFreespace.cmake @@ -0,0 +1,78 @@ +# - try to find Hillcrest Labs' libfreespace library +# +# Cache Variables: (probably not for direct use in your scripts) +# LIBFREESPACE_INCLUDE_DIR +# LIBFREESPACE_LIBRARY +# +# Non-cache variables you might use in your CMakeLists.txt: +# LIBFREESPACE_FOUND +# LIBFREESPACE_INCLUDE_DIRS +# LIBFREESPACE_LIBRARIES +# +# Requires these CMake modules: +# FindPackageHandleStandardArgs (known included with CMake >=2.6.2) +# +# Original Author: +# 2014 Ryan Pavlik +# http://academic.cleardefinition.com +# +# Copyright Sensics, Inc. 2014. +# 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(LIBFREESPACE_ROOT_DIR + "${LIBFREESPACE_ROOT_DIR}" + CACHE + PATH + "Directory to search for libfreespace") + +find_library(LIBFREESPACE_LIBRARY + NAMES + freespace + libfreespace + PATHS + "${LIBFREESPACE_ROOT_DIR}" + PATH_SUFFIXES + lib) + +get_filename_component(_libdir "${LIBFREESPACE_LIBRARY}" PATH) + +find_path(LIBFREESPACE_INCLUDE_DIR + NAMES + freespace/freespace.h + HINTS + "${_libdir}" + "${_libdir}/.." + PATHS + "${LIBFREESPACE_ROOT_DIR}" + PATH_SUFFIXES + include/) + + +include(FindPackageHandleStandardArgs) +if(WIN32) + find_package(WinHID QUIET) + find_package_handle_standard_args(LibFreespace + DEFAULT_MSG + LIBFREESPACE_LIBRARY + LIBFREESPACE_INCLUDE_DIR + WINHID_LIBRARIES) +else() + find_package_handle_standard_args(LibFreespace + DEFAULT_MSG + LIBFREESPACE_LIBRARY + LIBFREESPACE_INCLUDE_DIR) +endif() + +if(LIBFREESPACE_FOUND) + set(LIBFREESPACE_LIBRARIES "${LIBFREESPACE_LIBRARY}") + if(WIN32) + list(APPEND LIBFREESPACE_LIBRARIES ${WINHID_LIBRARIES}) + endif() + set(LIBFREESPACE_INCLUDE_DIRS "${LIBFREESPACE_INCLUDE_DIR}") + mark_as_advanced(LIBFREESPACE_ROOT_DIR) +endif() + +mark_as_advanced(LIBFREESPACE_INCLUDE_DIR + LIBFREESPACE_LIBRARY) diff --git a/lib/wiiuse/cmake/FindLibusb1.cmake b/lib/wiiuse/cmake/FindLibusb1.cmake new file mode 100644 index 000000000..b161c81e0 --- /dev/null +++ b/lib/wiiuse/cmake/FindLibusb1.cmake @@ -0,0 +1,96 @@ +# - try to find libusb-1 library +# +# Cache Variables: (probably not for direct use in your scripts) +# LIBUSB1_LIBRARY +# LIBUSB1_INCLUDE_DIR +# +# Non-cache variables you should use in your CMakeLists.txt: +# LIBUSB1_LIBRARIES +# LIBUSB1_INCLUDE_DIRS +# LIBUSB1_FOUND - if this is not true, do not attempt to use this library +# +# Requires these CMake modules: +# ProgramFilesGlob +# 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) + + +set(LIBUSB1_ROOT_DIR + "${LIBUSB1_ROOT_DIR}" + CACHE + PATH + "Root directory to search for libusb-1") + +if(WIN32) + include(ProgramFilesGlob) + program_files_fallback_glob(_dirs "LibUSB-Win32") + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + if(MSVC) + set(_lib_suffixes lib/msvc_x64 MS64/static) + endif() + else() + if(MSVC) + set(_lib_suffixes lib/msvc MS32/static) + elseif(COMPILER_IS_GNUCXX) + set(_lib_suffixes lib/gcc) + endif() + endif() +else() + set(_lib_suffixes) + find_package(PkgConfig QUIET) + if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_LIBUSB1 libusb-1.0) + endif() +endif() + +find_path(LIBUSB1_INCLUDE_DIR + NAMES + libusb.h + PATHS + ${PC_LIBUSB1_INCLUDE_DIRS} + ${PC_LIBUSB1_INCLUDEDIR} + ${_dirs} + HINTS + "${LIBUSB1_ROOT_DIR}" + PATH_SUFFIXES + include/libusb-1.0 + include + libusb-1.0) + +find_library(LIBUSB1_LIBRARY + NAMES + libusb-1.0 + usb-1.0 + PATHS + ${PC_LIBUSB1_LIBRARY_DIRS} + ${PC_LIBUSB1_LIBDIR} + ${_dirs} + HINTS + "${LIBUSB1_ROOT_DIR}" + PATH_SUFFIXES + ${_lib_suffixes}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Libusb1 + DEFAULT_MSG + LIBUSB1_LIBRARY + LIBUSB1_INCLUDE_DIR) + +if(LIBUSB1_FOUND) + set(LIBUSB1_LIBRARIES "${LIBUSB1_LIBRARY}") + + set(LIBUSB1_INCLUDE_DIRS "${LIBUSB1_INCLUDE_DIR}") + + mark_as_advanced(LIBUSB1_ROOT_DIR) +endif() + +mark_as_advanced(LIBUSB1_INCLUDE_DIR LIBUSB1_LIBRARY) diff --git a/lib/wiiuse/cmake/FindLuabind.cmake b/lib/wiiuse/cmake/FindLuabind.cmake new file mode 100644 index 000000000..29062d3af --- /dev/null +++ b/lib/wiiuse/cmake/FindLuabind.cmake @@ -0,0 +1,73 @@ +# - try to find Luabind +# +# Users may optionally supply: +# LUABIND_ROOT_DIR - a prefix to start searching +# +# Non-cache variables you might use in your CMakeLists.txt: +# LUABIND_FOUND +# LUABIND_DEFINITIONS +# LUABIND_INCLUDE_DIRS +# LUABIND_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) + +set(LUABIND_ROOT_DIR + "${LUABIND_ROOT_DIR}" + CACHE + PATH + "Path to search for Luabind") + +### +# Dependencies +### +find_package(Lua51 QUIET) + +### +# Configure Luabind +### +find_path(LUABIND_INCLUDE_DIR + NAMES + luabind/luabind.hpp + HINTS + "${LUABIND_ROOT_DIR}" + PATH_SUFFIXES + include) +mark_as_advanced(LUABIND_INCLUDE_DIR) + +find_library(LUABIND_LIBRARY + NAMES + luabind + HINTS + "${LUABIND_ROOT_DIR}" + PATH_SUFFIXES + lib64 + lib) +mark_as_advanced(LUABIND_LIBRARY) + +# 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(Luabind + DEFAULT_MSG + LUABIND_LIBRARY + LUABIND_INCLUDE_DIR + LUA_LIBRARIES + LUA_INCLUDE_DIR) + +if(LUABIND_FOUND) + set(LUABIND_INCLUDE_DIRS "${LUABIND_INCLUDE_DIR}" "${LUA_INCLUDE_DIR}") + set(LUABIND_LIBRARIES "${LUABIND_LIBRARY}" ${LUA_LIBRARIES}) + set(LUABIND_DEFINITIONS "-DLUABIND_DYNAMIC_LINK") + mark_as_advanced(LUABIND_ROOT_DIR) +endif() diff --git a/lib/wiiuse/cmake/FindLyX.cmake b/lib/wiiuse/cmake/FindLyX.cmake new file mode 100644 index 000000000..7ec33b78d --- /dev/null +++ b/lib/wiiuse/cmake/FindLyX.cmake @@ -0,0 +1,144 @@ +# - Try to find LyX, and define some custom commands to export from LyX +# +# Once done, this will define: +# LYX_FOUND - system has LyX +# LYX_COMMAND - the command to run +# +# and the following new functions: +# lyx_export( +# INPUT [...] +# [OUTPUT_TO_SOURCE_DIR] +# [ EXTRA_DEPS [...] ]) - the base function +# +# These shortcut functions all have the same syntax: +# lyx_export_to_XXX( +# INPUT [...] +# [OUTPUT_TO_SOURCE_DIR] +# [ EXTRA_DEPS [...] ]) +# +# Available shortcuts: +# lyx_export_to_docbook_xml +# lyx_export_to_docbook +# lyx_export_to_pdf +# lyx_export_to_pdf_via_pdflatex +# lyx_export_to_pdf_via_dvi +# +# Useful configuration variables you might want to add to your cache: +# LYX_ROOT_DIR - A directory prefix to search +# +# 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) + + +set(LYX_ROOT_DIR + "${LYX_ROOT_DIR}" + CACHE + PATH + "Directory to start our search in") + +find_program(LYX_COMMAND + NAMES + lyx + HINTS + "${LYX_ROOT_DIR}" + PATH_SUFFIXES + bin) + +# 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(LyX DEFAULT_MSG LYX_COMMAND) + +if(LYX_FOUND) + mark_as_advanced(LYX_ROOT_DIR) +endif() + +mark_as_advanced(LYX_COMMAND) + +function(lyx_export _format _extension _outvar) + set(_nowhere) + set(_curdest _nowhere) + set(_val_args EXTRA_DEPS INPUT) + set(_bool_args OUTPUT_TO_SOURCE_DIR) + foreach(_arg ${_val_args} ${_bool_args}) + set(${_arg}) + endforeach() + foreach(_element ${ARGN}) + list(FIND _val_args "${_element}" _val_arg_find) + list(FIND _bool_args "${_element}" _bool_arg_find) + if("${_val_arg_find}" GREATER "-1") + set(_curdest "${_element}") + elseif("${_bool_arg_find}" GREATER "-1") + set("${_element}" ON) + set(_curdest _nowhere) + else() + list(APPEND ${_curdest} "${_element}") + endif() + endforeach() + + if(_nowhere) + message(FATAL_ERROR "Syntax error in use of a lyx_export command!") + endif() + + set(_out) + set(_outname) + foreach(_file ${INPUT}) + get_filename_component(_base "${_file}" NAME_WE) + + if(NOT OUTPUT_TO_SOURCE_DIR) + set(_outname "${CMAKE_CURRENT_BINARY_DIR}/${_base}.${_extension}") + else() + set(_outname "${CMAKE_CURRENT_SOURCE_DIR}/${_base}.${_extension}") + endif() + + list(APPEND _out "${_outname}") + if(LYX_COMMAND) + add_custom_command(OUTPUT "${_outname}" + COMMAND ${CMAKE_COMMAND} -E remove "${_outname}" + #COMMAND ${LYX_COMMAND} "${_file}" --export ${_format} + COMMAND ${LYX_COMMAND} "${_file}" + --execute + "buffer-export-custom ${_format} ${CMAKE_COMMAND} -E copy '$$$$FName' '${_outname}'" + --execute + "lyx-quit" + MAIN_DEPENDENCY "${_file}" + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + DEPENDS "${_file}" ${EXTRA_DEPS} + COMMENT "Exporting ${_file} to ${_format}...") + endif() + endforeach() + + set(${_outvar} ${_out} PARENT_SCOPE) +endfunction() + +function(lyx_export_to_docbook_xml _outvar) + lyx_export(docbook-xml xml ${_outvar} ${ARGN}) + set(${_outvar} ${${_outvar}} PARENT_SCOPE) +endfunction() + +function(lyx_export_to_docbook _outvar) + lyx_export(docbook sgml ${_outvar} ${ARGN}) + set(${_outvar} ${${_outvar}} PARENT_SCOPE) +endfunction() + +function(lyx_export_to_pdf _outvar) + lyx_export(pdf pdf ${_outvar} ${ARGN}) + set(${_outvar} ${${_outvar}} PARENT_SCOPE) +endfunction() + +function(lyx_export_to_pdf_via_pdflatex _outvar) + lyx_export(pdf2 pdf ${_outvar} ${ARGN}) + set(${_outvar} ${${_outvar}} PARENT_SCOPE) +endfunction() + +function(lyx_export_to_pdf_via_dvi _outvar) + lyx_export(pdf3 pdf ${_outvar} ${ARGN}) + set(${_outvar} ${${_outvar}} PARENT_SCOPE) +endfunction() diff --git a/lib/wiiuse/cmake/FindMacHID.cmake b/lib/wiiuse/cmake/FindMacHID.cmake new file mode 100644 index 000000000..d96baceb5 --- /dev/null +++ b/lib/wiiuse/cmake/FindMacHID.cmake @@ -0,0 +1,66 @@ +# - try to find Mac HID frameworks +# +# Cache Variables: (probably not for direct use in your scripts) +# MACHID_CoreFoundation_LIBRARY +# MACHID_CoreFoundation_INCLUDE_DIR +# MACHID_IOKit_LIBRARY +# MACHID_IOKit_INCLUDE_DIR +# MACOSX_HID_UINT32T (from CheckMacHIDAPI) +# +# Non-cache variables you should use in your CMakeLists.txt: +# MACHID_DEFINITIONS +# MACHID_LIBRARIES +# MACHID_INCLUDE_DIRS +# MACHID_FOUND - if this is not true, do not attempt to use this library +# +# Requires these CMake modules: +# CheckMacHIDAPI +# 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(APPLE) + find_library(MACHID_CoreFoundation_LIBRARY CoreFoundation) + find_path(MACHID_CoreFoundation_INCLUDE_DIR + CoreFoundation/CoreFoundation.h) + + find_library(MACHID_IOKit_LIBRARY IOKit) + find_path(MACHID_IOKit_INCLUDE_DIR IOKit/hid/IOHIDLib.h) + + include(CheckMacHIDAPI) + set(MACHID_DEFINITIONS "-DMACOSX_HID_UINT32T=${MACOSX_HID_UINT32T}") + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(MacHID + DEFAULT_MSG + MACHID_CoreFoundation_LIBRARY + MACHID_CoreFoundation_INCLUDE_DIR + MACHID_IOKit_LIBRARY + MACHID_IOKit_INCLUDE_DIR + MACOSX_HID_UINT32T) + +endif() + +if(MACHID_FOUND) + set(MACHID_LIBRARIES + "${MACHID_CoreFoundation_LIBRARY}" + "${MACHID_IOKit_LIBRARY}") + + set(MACHID_INCLUDE_DIRS + "${MACHID_CoreFoundation_INCLUDE_DIR}" + "${MACHID_IOKit_INCLUDE_DIR}") + + mark_as_advanced(MACHID_CoreFoundation_LIBRARY + MACHID_CoreFoundation_INCLUDE_DIR + MACHID_IOKit_LIBRARY + MACHID_IOKit_INCLUDE_DIR) + +endif() diff --git a/lib/wiiuse/cmake/FindMarkdown.cmake b/lib/wiiuse/cmake/FindMarkdown.cmake new file mode 100644 index 000000000..63b930532 --- /dev/null +++ b/lib/wiiuse/cmake/FindMarkdown.cmake @@ -0,0 +1,56 @@ +# - try to find Markdown tool +# +# Cache Variables: +# MARKDOWN_EXECUTABLE +# +# Non-cache variables you might use in your CMakeLists.txt: +# MARKDOWN_FOUND +# +# Requires these CMake modules: +# FindPackageHandleStandardArgs (known included with CMake >=2.6.2) +# +# Original Author: +# 2011 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2011. +# 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(TO_CMAKE_PATH "${MARKDOWN_ROOT_DIR}" MARKDOWN_ROOT_DIR) +set(MARKDOWN_ROOT_DIR + "${MARKDOWN_ROOT_DIR}" + CACHE + PATH + "Path to search for Markdown") + +if(MARKDOWN_EXECUTABLE AND NOT EXISTS "${MARKDOWN_EXECUTABLE}") + set(MARKDOWN_EXECUTABLE "notfound" CACHE PATH FORCE "") +endif() + +# If we have a custom path, look there first. +if(MARKDOWN_ROOT_DIR) + find_program(MARKDOWN_EXECUTABLE + NAMES + markdown + PATHS + "${MARKDOWN_ROOT_DIR}" + PATH_SUFFIXES + bin + NO_DEFAULT_PATH) +endif() + +find_program(MARKDOWN_EXECUTABLE NAMES markdown) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Markdown + DEFAULT_MSG + MARKDOWN_EXECUTABLE) + +if(MARKDOWN_FOUND) + mark_as_advanced(MARKDOWN_ROOT_DIR) +endif() + +mark_as_advanced(MARKDOWN_EXECUTABLE) diff --git a/lib/wiiuse/cmake/FindOVR.cmake b/lib/wiiuse/cmake/FindOVR.cmake new file mode 100644 index 000000000..fa1473f7c --- /dev/null +++ b/lib/wiiuse/cmake/FindOVR.cmake @@ -0,0 +1,219 @@ +# - try to find Oculus VR's SDK for Oculus Rift support +# +# Cache Variables: (probably not for direct use in your scripts) +# OVR_INCLUDE_DIR +# OVR_SOURCE_DIR +# OVR_LIBRARY +# +# Non-cache variables you might use in your CMakeLists.txt: +# OVR_FOUND +# OVR_INCLUDE_DIRS +# OVR_LIBRARIES +# +# Requires these CMake modules: +# FindPackageHandleStandardArgs (known included with CMake >=2.6.2) +# +# Original Author: +# 2014 Kevin M. Godby +# +# 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(OVR_ROOT_DIR + "${OVR_ROOT_DIR}" + CACHE + PATH + "Directory to search for Oculus SDK") + +# The OVR library is built in a directory tree that varies based on platform, +# architecture, and compiler. +# +# The libraries live in one of the following locations: +# +# Lib/Win32/VS2012/libovrd.lib +# Lib/Win32/VS2012/libovr.lib +# Lib/Win32/VS2013/libovrd.lib +# Lib/Win32/VS2013/libovr.lib +# Lib/Win32/VS2010/libovrd.lib +# Lib/Win32/VS2010/libovr.lib +# Lib/x64/VS2012/libovr64d.lib +# Lib/x64/VS2012/libovr64.lib +# Lib/x64/VS2013/libovr64d.lib +# Lib/x64/VS2013/libovr64.lib +# Lib/x64/VS2010/libovr64d.lib +# Lib/x64/VS2010/libovr64.lib +# Lib/Linux/Release/x86_64/libovr.a +# Lib/Linux/Debug/x86_64/libovr.a +# Lib/Linux/Release/i386/libovr.a +# Lib/Linux/Debug/i386/libovr.a +# Lib/Mac/Release/libovr.a +# Lib/Mac/Debug/libovr.a + +set(OVR_LIBRARY_PATH_SUFFIX "Lib") + +# Test compiler +if(MSVC10) # Microsoft Visual Studio 2010 + set(_ovr_library_compiler "VS2010") +elseif(MSVC11) # Microsoft Visual Studio 2012 + set(_ovr_library_compiler "VS2012") +elseif(MSVC12) # Microsoft Visual Studio 2013 + set(_ovr_library_compiler "VS2013") +endif() + + +# Test 32/64 bits +if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") + set(_ovr_library_arch "x86_64") + if (WIN32) + set(_ovr_library_arch "x64") + set(_ovr_libname_bitsuffix "64") + endif(WIN32) +else() + set(_ovr_library_arch "i386") + if (WIN32) + set(_ovr_library_arch "Win32") + set(_ovr_libname_bitsuffix "") + endif(WIN32) +endif() + +# Test platform +if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") + set(OVR_LIBRARY_PATH_SUFFIX_START "Lib/Linux") # needs build type and arch +elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + set(OVR_LIBRARY_PATH_SUFFIX_START "Lib/Mac") # needs build type +elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows") + set(OVR_LIBRARY_PATH_SUFFIX "Lib/${_ovr_library_arch}/${_ovr_library_compiler}") +endif() + +find_library(OVR_LIBRARY_RELEASE + NAMES + ovr${_ovr_libname_bitsuffix} + libovr${_ovr_libname_bitsuffix} + PATHS + "${OVR_ROOT_DIR}" + "${OVR_ROOT_DIR}/LibOVR" + c:/tools/oculus-sdk.install/OculusSDK/LibOVR + PATH_SUFFIXES + ${OVR_LIBRARY_PATH_SUFFIX} + ${OVR_LIBRARY_PATH_SUFFIX_START}/Release + ${OVR_LIBRARY_PATH_SUFFIX_START}/Release/${_ovr_library_arch}) + +find_library(OVR_LIBRARY_DEBUG + NAMES + ovr${_ovr_libname_bitsuffix}d + libovr${_ovr_libname_bitsuffix}d + PATHS + "${OVR_ROOT_DIR}" + "${OVR_ROOT_DIR}/LibOVR" + c:/tools/oculus-sdk.install/OculusSDK/LibOVR + PATH_SUFFIXES + ${OVR_LIBRARY_PATH_SUFFIX} + ${OVR_LIBRARY_PATH_SUFFIX_START}/Debug + ${OVR_LIBRARY_PATH_SUFFIX_START}/Debug/${_ovr_library_arch}) + +include(SelectLibraryConfigurations) +select_library_configurations(OVR) + +if(OVR_LIBRARY_RELEASE) + get_filename_component(_libdir "${OVR_LIBRARY_RELEASE}" PATH) +endif() + +find_path(OVR_INCLUDE_DIR + NAMES + OVR.h + HINTS + "${_libdir}" + "${_libdir}/.." + "${_libdir}/../.." + "${_libdir}/../../.." + PATHS + "${OVR_ROOT_DIR}" + PATH_SUFFIXES + include + Include + ) + +find_path(OVR_SOURCE_DIR + NAMES + OVR_CAPI.h + HINTS + "${_libdir}" + "${_libdir}/.." + "${_libdir}/../.." + "${_libdir}/../../.." + PATHS + "${OVR_ROOT_DIR}" + PATH_SUFFIXES + Src + ) + +# Dependencies + +set(_ovr_dependency_libraries "") +set(_ovr_dependency_includes "") + +if(NOT OPENGL_FOUND) + find_package(OpenGL) + list(APPEND _ovr_dependency_libraries ${OPENGL_LIBRARIES}) + list(APPEND _ovr_dependency_includes ${OPENGL_INCLUDE_DIR}) + list(APPEND _ovr_dependencies OPENGL_FOUND) +endif() + +if(NOT THREADS_FOUND) + find_package(Threads) + list(APPEND _ovr_dependency_libraries ${CMAKE_THREAD_LIBS_INIT}) + list(APPEND _ovr_dependencies THREADS_FOUND) +endif() + +# Linux-only dependencies +if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") + if(NOT X11_FOUND) + find_package(X11) + list(APPEND _ovr_dependency_libraries ${X11_LIBRARIES}) + list(APPEND _ovr_dependency_includes ${X11_INCLUDE_DIR}) + list(APPEND _ovr_dependencies X11_FOUND) + endif() + + if(NOT XRANDR_FOUND) + find_package(Xrandr) + list(APPEND _ovr_dependency_libraries ${XRANDR_LIBRARIES}) + list(APPEND _ovr_dependency_includes ${XRANDR_INCLUDE_DIR}) + list(APPEND _ovr_dependencies XRANDR_FOUND) + endif() + + if(NOT UDEV_FOUND) + find_package(udev) + list(APPEND _ovr_dependency_libraries ${UDEV_LIBRARIES}) + list(APPEND _ovr_dependency_includes ${UDEV_INCLUDE_DIR}) + list(APPEND _ovr_dependencies UDEV_FOUND) + endif() +endif() + +if(WIN32) + #find_library(OVR_WINMM_LIBRARY winmm) + #find_library(OVR_WS2_LIBRARY ws2_32) + list(APPEND _ovr_dependency_libraries winmm ws2_32)#${OVR_WINMM_LIBRARY} ${OVR_WS2_LIBRARY}) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(OVR + DEFAULT_MSG + OVR_LIBRARY + OVR_INCLUDE_DIR + OVR_SOURCE_DIR + ${_ovr_dependencies} + ) + +if(OVR_FOUND) + set(OVR_LIBRARIES ${OVR_LIBRARY} ${_ovr_dependency_libraries}) + set(OVR_INCLUDE_DIRS ${OVR_INCLUDE_DIR} ${OVR_SOURCE_DIR} ${_ovr_dependency_includes}) + mark_as_advanced(OVR_ROOT_DIR) +endif() + +mark_as_advanced(OVR_INCLUDE_DIR + OVR_SOURCE_DIR + OVR_LIBRARY + OVR_WINMM_LIBRARY + OVR_WS2_LIBRARY) + diff --git a/lib/wiiuse/cmake/FindOpenCV1.cmake b/lib/wiiuse/cmake/FindOpenCV1.cmake new file mode 100644 index 000000000..148af568f --- /dev/null +++ b/lib/wiiuse/cmake/FindOpenCV1.cmake @@ -0,0 +1,245 @@ +# - Try to find OpenCV library installation +# See http://sourceforge.net/projects/opencvlibrary/ +# +# The following variable is optionally searched for defaults +# OPENCV_ROOT_DIR: Base directory of OpenCv tree to use. +# +# OPENCV_NEW_LIBRARY_NAMES Set to YES before searching if you want to +# The following are set after configuration is done: +# OPENCV_FOUND +# OPENCV_INCLUDE_DIRS +# OPENCV_LIBRARIES +# +# 2004/05 Jan Woetzel, Friso, Daniel Grest +# 2006/01 complete rewrite by Jan Woetzel +# 2006/09 2nd rewrite introducing ROOT_DIR and PATH_SUFFIXES +# to handle multiple installed versions gracefully by Jan Woetzel +# 2010/02 Ryan Pavlik (Iowa State University) - partial rewrite to standardize +# +# tested with: +# -OpenCV 0.97 (beta5a): MSVS 7.1, gcc 3.3, gcc 4.1 +# -OpenCV 0.99 (1.0rc1): MSVS 7.1 +# +# www.mip.informatik.uni-kiel.de/~jw +# academic.cleardefinition.com +# -------------------------------- + +set(OPENCV_ROOT_DIR + "${OPENCV_ROOT_DIR}" + CACHE + PATH + "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) + + # 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 + NAMES + opencv_${component} + HINTS + ${OPENCV_BASE_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() + + 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 + NAMES + ${component} + HINTS + ${OPENCV_BASE_DIR} + PATH_SUFFIXES + ${OPENCV_LIBDIR_SUFFIXES}) + endforeach() + endif() + + # + # Logic selecting required libs and headers + # + + 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() + + + endforeach() + + # 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() + + diff --git a/lib/wiiuse/cmake/FindOpenHaptics.cmake b/lib/wiiuse/cmake/FindOpenHaptics.cmake new file mode 100644 index 000000000..0e4958c5f --- /dev/null +++ b/lib/wiiuse/cmake/FindOpenHaptics.cmake @@ -0,0 +1,481 @@ +# - try to find OpenHaptics libraries +# +# Cache Variables: (probably not for direct use in your scripts) +# HDAPI_INCLUDE_DIR +# HDAPI_LIBRARY +# HDAPI_LIBRARY_RELEASE +# HDAPI_LIBRARY_DEBUG +# HDAPI_HDU_INCLUDE_DIR +# HDAPI_HDU_LIBRARY +# HDAPI_HDU_LIBRARY_RELEASE +# HDAPI_HDU_LIBRARY_DEBUG +# HLAPI_INCLUDE_DIR +# HLAPI_LIBRARY +# HLAPI_LIBRARY_RELEASE +# HLAPI_LIBRARY_DEBUG +# HLAPI_HLU_INCLUDE_DIR +# HLAPI_HLU_LIBRARY +# HLAPI_HLU_LIBRARY_RELEASE +# HLAPI_HLU_LIBRARY_DEBUG +# +# Non-cache variables you might use in your CMakeLists.txt: +# OPENHAPTICS_FOUND +# HDAPI_INCLUDE_DIRS +# HDAPI_LIBRARIES +# HDAPI_HDU_INCLUDE_DIRS +# HDAPI_HDU_LIBRARIES +# HLAPI_INCLUDE_DIRS +# HLAPI_LIBRARIES +# HLAPI_HLU_INCLUDE_DIRS +# HLAPI_HLU_LIBRARIES +# OPENHAPTICS_LIBRARIES - includes HD, HDU, HL, HLU +# OPENHAPTICS_RUNTIME_LIBRARY_DIRS +# OPENHAPTICS_ENVIRONMENT +# OPENHAPTICS_LIBRARY_DIRS +# OPENHAPTICS_INCLUDE_DIRS +# +# Requires these CMake modules: +# CleanDirectoryList +# CleanLibraryList +# ListCombinations +# ProgramFilesGlob +# SelectLibraryConfigurations (included with CMake >=2.8.0) +# FindPackageHandleStandardArgs (known included with CMake >=2.6.2) +# CMake 2.6.3 (uses "unset") +# +# Original Author: +# 2009-2012 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) + +cmake_minimum_required(VERSION 2.6.3) + +set(OPENHAPTICS_ROOT_DIR + "${OPENHAPTICS_ROOT_DIR}" + CACHE + PATH + "Path to search for OpenHaptics") +option(OPENHAPTICS_NESTED_TARGETS + "Whether we should compile HDU and HLU, if needed, as a part of the solution" + ON) +mark_as_advanced(OPENHAPTICS_NESTED_TARGETS) + +### +# Configure OpenHaptics +### + +include(SelectLibraryConfigurations) +include(ListCombinations) +include(CleanDirectoryList) +include(CleanLibraryList) +include(ProgramFilesGlob) + +set(_nest_targets) +set(_incsearchdirs) +set(_libsearchdirs) +set(OPENHAPTICS_ENVIRONMENT) +set(OPENHAPTICS_RUNTIME_LIBRARY_DIRS) + +set(_dirs) +if(NOT "$ENV{OH_SDK_BASE}" STREQUAL "") + list(APPEND _dirs "$ENV{OH_SDK_BASE}") +elseif(NOT "$ENV{3DTOUCH_BASE}" STREQUAL "") + list(APPEND _dirs "$ENV{3DTOUCH_BASE}") +endif() +if(WIN32) + program_files_fallback_glob(_pfdirs "/Sensable/3DTouch*/") + foreach(_OH_DEFAULT_LOCATION "C:/OpenHaptics/3.1" "C:/OpenHaptics/Academic/3.1") + if(EXISTS "${_OH_DEFAULT_LOCATION}") + list(APPEND _dirs "${_OH_DEFAULT_LOCATION}") + endif() + endforeach() + set(_dirs "${_dirs};${_pfdirs}") + if(MSVC60) + set(_vc "vc6") + elseif(MSVC70 OR MSVC71) + set(_vc "vc7") + elseif(MSVC80) + set(_vc "vc8") + endif() + if(CMAKE_SIZEOF_VOID_P MATCHES "8") + # 64-bit + list_combinations(_libsearch + PREFIXES + "${OPENHAPTICS_ROOT_DIR}" + ${_dirs} + SUFFIXES + "/lib/x64") + list_combinations(_libsearch2 + PREFIXES + "${OPENHAPTICS_ROOT_DIR}" + ${_dirs} + SUFFIXES + "/utilities/lib/x64") + else() + # 32-bit + list_combinations(_libsearch + PREFIXES + "${OPENHAPTICS_ROOT_DIR}" + ${_dirs} + SUFFIXES + "/lib" + "/lib/win32") + list_combinations(_libsearch2 + PREFIXES + "${OPENHAPTICS_ROOT_DIR}" + ${_dirs} + SUFFIXES + "/utilities/lib/Win32" + "/utilities/lib" + "/utilities/lib/${_vc}") + endif() + + clean_directory_list(_libsearchdirs ${_libsearch} ${_libsearch2}) +endif() + +list_combinations(_incsearch + PREFIXES + "${OPENHAPTICS_ROOT_DIR}" + ${_dirs} + SUFFIXES + "/include") +list_combinations(_incsearch2 + PREFIXES + "${OPENHAPTICS_ROOT_DIR}" + ${_dirs} + SUFFIXES + "/utilities/include") +clean_directory_list(_incsearchdirs ${_incsearch} ${_incsearch2}) + +set(_deps_check) +set(_deps_libs) + +### +# HDAPI: HD +### + +if(UNIX) + find_library(HDAPI_PHANToMIO_LIBRARY + NAMES + PHANToMIO + HINTS + ${_libsearchdirs}) + mark_as_advanced(HDAPI_PHANToMIO_LIBRARY) + list(APPEND _deps_check HDAPI_PHANToMIO_LIBRARY) + list(APPEND _deps_libs "${HDAPI_PHANToMIO_LIBRARY}") +endif() + +find_path(HDAPI_INCLUDE_DIR + NAMES + HD/hd.h + HINTS + ${_incsearchdirs}) + +find_library(HDAPI_LIBRARY_RELEASE + NAMES + HD + PATH_SUFFIXES + ReleaseAcademicEdition + Release + HINTS + ${_libsearchdirs}) + +find_library(HDAPI_LIBRARY_DEBUG + NAMES + HD + PATH_SUFFIXES + DebugAcademicEdition + Debug + HINTS + ${_libsearchdirs}) + +select_library_configurations(HDAPI) + +### +# HDAPI: HDU +### +find_path(HDAPI_HDU_INCLUDE_DIR + NAMES + HDU/hdu.h + HINTS + ${_incsearchdirs}) + +find_library(HDAPI_HDU_LIBRARY_RELEASE + NAMES + HDU + PATH_SUFFIXES + ReleaseAcademicEdition + Release + HINTS + ${_libsearchdirs}) + +find_library(HDAPI_HDU_LIBRARY_DEBUG + NAMES + HDU + PATH_SUFFIXES + DebugAcademicEdition + Debug + HINTS + ${_libsearchdirs}) + +# Fallback +find_library(HDAPI_HDU_LIBRARY_DEBUG + NAMES + HDUD + PATH_SUFFIXES + DebugAcademicEdition + Debug + HINTS + ${_libsearchdirs}) + +select_library_configurations(HDAPI_HDU) + +if(OPENHAPTICS_NESTED_TARGETS OR NOT HDAPI_HDU_LIBRARY) + if(HDAPI_HDU_SOURCE_DIR AND NOT EXISTS "${HDAPI_HDU_SOURCE_DIR}/hdu.cpp") + unset(HDAPI_HDU_SOURCE_DIR) + endif() + find_path(HDAPI_HDU_SOURCE_DIR + NAMES + hdu.cpp + PATH_SUFFIXES + src + src/HDU + src/HDU/src + libsrc/HDU + HINTS + "${HDAPI_HDU_INCLUDE_DIR}/.." + "${HDAPI_HDU_INCLUDE_DIR}/../share/3DTouch") + list(APPEND _deps_check HDAPI_HDU_SOURCE_DIR) + if(HDAPI_HDU_SOURCE_DIR) + mark_as_advanced(HDAPI_HDU_SOURCE_DIR) + set(_nest_targets YES) + set(HDAPI_HDU_LIBRARY + "openhaptics_hdu_nested_target" + CACHE + STRING + "We will build the OpenHaptics HDU lib." + FORCE) + set(HDAPI_HDU_LIBRARIES ${HDAPI_HDU_LIBRARY}) + endif() +endif() + + +### +# HLAPI: HL +### +find_path(HLAPI_INCLUDE_DIR + NAMES + HL/hl.h + HINTS + ${_incsearchdirs}) + +find_library(HLAPI_LIBRARY_RELEASE + NAMES + HL + PATH_SUFFIXES + ReleaseAcademicEdition + Release + HINTS + ${_libsearchdirs}) + +find_library(HLAPI_LIBRARY_DEBUG + NAMES + HL + PATH_SUFFIXES + DebugAcademicEdition + Debug + HINTS + ${_libsearchdirs}) + +select_library_configurations(HLAPI) + +### +# HLAPI: HLU +### +find_path(HLAPI_HLU_INCLUDE_DIR + NAMES + HLU/hlu.h + HINTS + ${_incsearchdirs}) + +find_library(HLAPI_HLU_LIBRARY_RELEASE + NAMES + HLU + PATH_SUFFIXES + ReleaseAcademicEdition + Release + HINTS + ${_libsearchdirs}) + +find_library(HLAPI_HLU_LIBRARY_DEBUG + NAMES + HLU + PATH_SUFFIXES + DebugAcademicEdition + Debug + HINTS + ${_libsearchdirs}) + +# fallback +find_library(HLAPI_HLU_LIBRARY_DEBUG + NAMES + HLUD + PATH_SUFFIXES + DebugAcademicEdition + Debug + HINTS + ${_libsearchdirs}) + +select_library_configurations(HLAPI_HLU) + +if(OPENHAPTICS_NESTED_TARGETS OR NOT HLAPI_HLU_LIBRARY) + if(HLAPI_HLU_SOURCE_DIR AND NOT EXISTS "${HLAPI_HLU_SOURCE_DIR}/hlu.cpp") + unset(HLAPI_HLU_SOURCE_DIR) + endif() + find_path(HLAPI_HLU_SOURCE_DIR + NAMES + hlu.cpp + PATH_SUFFIXES + src + src/HLU + src/HLU/src + libsrc/HLU + HINTS + "${HLAPI_HLU_INCLUDE_DIR}/.." + "${HLAPI_HLU_INCLUDE_DIR}/../share/3DTouch") + list(APPEND _deps_check HLAPI_HLU_SOURCE_DIR) + if(HLAPI_HLU_SOURCE_DIR) + mark_as_advanced(HLAPI_HLU_SOURCE_DIR) + set(_nest_targets YES) + set(HLAPI_HLU_LIBRARY + "openhaptics_hlu_nested_target" + CACHE + STRING + "We will build the OpenHaptics HLU lib." + FORCE) + set(HLAPI_HLU_LIBRARIES ${HLAPI_HLU_LIBRARY}) + endif() +endif() + +### +# Add dependencies: Libraries +### +set(HDAPI_LIBRARIES "${HDAPI_LIBRARY}" ${_deps_libs}) + +if(HDAPI_HDU_LIBRARIES AND HDAPI_LIBRARIES) + list(APPEND HDAPI_HDU_LIBRARIES ${HDAPI_LIBRARIES}) +else() + set(HDAPI_HDU_LIBRARIES) +endif() + +if(HLAPI_LIBRARY AND HDAPI_LIBRARIES) + set(HLAPI_LIBRARIES ${HLAPI_LIBRARY} ${HDAPI_LIBRARIES}) +else() + set(HLAPI_LIBRARIES) +endif() + +if(HLAPI_HLU_LIBRARIES AND HLAPI_LIBRARIES) + list(APPEND HLAPI_HLU_LIBRARIES ${HLAPI_LIBRARIES}) +else() + set(HLAPI_HLU_LIBRARIES) +endif() + +### +# Add dependencies: Include dirs +### +if(HDAPI_INCLUDE_DIR) + set(HDAPI_INCLUDE_DIRS ${HDAPI_INCLUDE_DIR}) + + if(HDAPI_HDU_INCLUDE_DIR) + set(HDAPI_HDU_INCLUDE_DIRS + ${HDAPI_INCLUDE_DIRS} + ${HDAPI_HDU_INCLUDE_DIR}) + + if(HDAPI_HDU_INCLUDE_DIR) + set(HLAPI_INCLUDE_DIRS ${HDAPI_INCLUDE_DIRS} ${HLAPI_INCLUDE_DIR}) + + if(HLAPI_HLU_INCLUDE_DIR) + set(HLAPI_HLU_INCLUDE_DIRS + ${HLAPI_INCLUDE_DIRS} + ${HLAPI_HLU_INCLUDE_DIR}) + + endif() + endif() + endif() +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(OpenHaptics + DEFAULT_MSG + HDAPI_LIBRARY + HDAPI_INCLUDE_DIR + HDAPI_HDU_INCLUDE_DIR + HDAPI_HDU_LIBRARY + HLAPI_INCLUDE_DIR + HLAPI_LIBRARY + HLAPI_HLU_INCLUDE_DIR + HLAPI_HLU_LIBRARY + ${_deps_check}) + +if(OPENHAPTICS_FOUND) + # Recurse into the nested targets subdirectory if needed + if(_nest_targets) + get_filename_component(_moddir "${CMAKE_CURRENT_LIST_FILE}" PATH) + add_subdirectory("${_moddir}/nested_targets/OpenHaptics" "OpenHapticsNestedTargets") + endif() + + set(OPENHAPTICS_LIBRARIES + ${HDAPI_LIBRARY} + ${HDAPI_HDU_LIBRARY} + ${HLAPI_LIBRARY} + ${HLAPI_HLU_LIBRARY}) + set(OPENHAPTICS_LIBRARY_DIRS) + foreach(_lib + ${_deps_check} + HDAPI_LIBRARY_RELEASE + HDAPI_LIBRARY_DEBUG + HDAPI_HDU_LIBRARY_RELEASE + HDAPI_HDU_LIBRARY_DEBUG + HLAPI_LIBRARY_RELEASE + HLAPI_LIBRARY_DEBUG + HLAPI_HLU_LIBRARY_RELEASE + HLAPI_HLU_LIBRARY_DEBUG) + get_filename_component(_libdir ${${_lib}} PATH) + list(APPEND OPENHAPTICS_LIBRARY_DIRS ${_libdir}) + endforeach() + + set(OPENHAPTICS_INCLUDE_DIRS + ${HLAPI_HLU_INCLUDE_DIRS} + ${HDAPI_HDU_INCLUDE_DIRS}) + + clean_directory_list(OPENHAPTICS_LIBRARY_DIRS) + clean_directory_list(OPENHAPTICS_INCLUDE_DIRS) + + list(APPEND + OPENHAPTICS_RUNTIME_LIBRARY_DIRS + ${OPENHAPTICS_LIBRARY_DIRS}) + + clean_library_list(OPENHAPTICS_LIBRARIES) + + mark_as_advanced(OPENHAPTICS_ROOT_DIR) +endif() + +mark_as_advanced(HDAPI_INCLUDE_DIR + HDAPI_LIBRARY_RELEASE + HDAPI_LIBRARY_DEBUG + HDAPI_HDU_INCLUDE_DIR + HDAPI_HDU_LIBRARY_RELEASE + HDAPI_HDU_LIBRARY_DEBUG + HLAPI_INCLUDE_DIR + HLAPI_LIBRARY_RELEASE + HLAPI_LIBRARY_DEBUG + HLAPI_HLU_INCLUDE_DIR + HLAPI_HLU_LIBRARY_RELEASE + HLAPI_HLU_LIBRARY_DEBUG) diff --git a/lib/wiiuse/cmake/FindParasolid.cmake b/lib/wiiuse/cmake/FindParasolid.cmake new file mode 100644 index 000000000..17636d702 --- /dev/null +++ b/lib/wiiuse/cmake/FindParasolid.cmake @@ -0,0 +1,305 @@ +# - try to find PARASOLID library +# Important note: If you are also using JtTk, do your +# find_package(JtTk) +# first, to avoid runtime PK_* errors! +# +# PARASOLID_LIBRARY_DIR, library search path +# PARASOLID_INCLUDE_DIR, include search path +# PARASOLID_{component}_LIBRARY, the library to link against +# PARASOLID_FOUND, If false, do not try to use this library. +# +# Plural versions refer to this library and its dependencies, and +# are recommended to be used instead, unless you have a good reason. +# +# Requires these CMake modules: +# CheckVersion +# ListCombinations +# ProgramFilesGlob +# 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) + +include(ListCombinations) +include(CheckVersion) +include(PrefixListGlob) +include(CleanDirectoryList) +if(WIN32) + include(ProgramFilesGlob) +endif() + +set(PARASOLID_ROOT_DIR + "${PARASOLID_ROOT_DIR}" + CACHE + PATH + "Root directory to search for Parasolid") + +file(TO_CMAKE_PATH "${PARASOLID_ROOT_DIR}" PARASOLID_ROOT_DIR) + +# Do this by default +if(NOT DEFINED PARASOLID_NESTED_TARGETS) + set(PARASOLID_NESTED_TARGETS TRUE) +endif() + +set(PARASOLID_NESTED_TARGETS + "${PARASOLID_NESTED_TARGETS}" + CACHE + BOOL + "Whether we should compile fg and frustrum as a part of the solution") +mark_as_advanced(PARASOLID_NESTED_TARGETS) + +set(_nest_targets) + +### +# Configure Parasolid +### + +string(TOLOWER "${CMAKE_SYSTEM_NAME}" _lcsystem) +set(libsearchdirs) +if(WIN32) + if(CMAKE_SIZEOF_VOID_P MATCHES "8") + # 64-bit + program_files_fallback_glob(dirs "/Parasolid*/kernel/x64_win/base") + program_files_fallback_glob(dirs2 "/Parasolid/kernel/*/x64_win/base") + list(APPEND dirs ${dirs2}) + else() + # 32-bit + program_files_glob(dirs "/Parasolid*/kernel/intel_nt/base") + program_files_fallback_glob(dirs2 "/Parasolid/kernel/*/intel_nt/base") + list(APPEND dirs ${dirs2}) + endif() + + list_combinations(libsearchdirs + PREFIXES + ${dirs} + "${PARASOLID_ROOT_DIR}" + SUFFIXES + "/dll") + list(APPEND libsearchdirs ${dirs} "${PARASOLID_ROOT_DIR}") +elseif("${_lcsystem}" MATCHES "linux") + if(CMAKE_SIZEOF_VOID_P MATCHES "8") + # 64-bit + prefix_list_glob(libsearchdirs + "/Parasolid*/kernel/intel_linux/base_lx64" + "${PARASOLID_ROOT_DIR}" + "/usr" + "/usr/local" + "/usr/local/ugs") + else() + # 32-bit + prefix_list_glob(libsearchdirs + "/Parasolid*/kernel/intel_linux/base_lx32" + "${PARASOLID_ROOT_DIR}" + "/usr" + "/usr/local" + "/usr/local/ugs") + endif() +endif() + +### +# Find the link library +### +find_library(PARASOLID_pskernel_LIBRARY + NAMES + pskernel + PATH_SUFFIXES + dll + shared_object + HINTS + ${libsearchdirs} + PATHS + "${PARASOLID_ROOT_DIR}") + + +# Don't add this library to the default list of libraries +find_library(PARASOLID_pskernel_archive_LIBRARY + NAMES + pskernel_archive + pskernel_archive.lib + HINTS + ${libsearchdirs} + PATHS + "${PARASOLID_ROOT_DIR}") +mark_as_advanced(PARASOLID_pskernel_archive_LIBRARY) + + +### +# Prepare for the rest of our search based off of where we found the link library +### +get_filename_component(PARASOLID_LIBRARY_DIR + "${PARASOLID_pskernel_LIBRARY}" + PATH) + +# Setup include search path +get_filename_component(_includedir + "${PARASOLID_LIBRARY_DIR}/../include" + ABSOLUTE) +get_filename_component(_includedir2 + "${PARASOLID_LIBRARY_DIR}/.." + ABSOLUTE) +set(includesearchdirs + "${PARASOLID_LIBRARY_DIR}" + "${_includedir}" + "${_includedir2}") +clean_directory_list(includesearchdirs) + +### +# Find the headers +### +find_path(PARASOLID_INCLUDE_DIR + NAMES + parasolid_kernel.h + HINTS + ${includesearchdirs} + PATHS + "${PARASOLID_ROOT_DIR}") + +### +# Find remaining libs +### + +# Default libs +foreach(lib fg frustrum) + find_library(PARASOLID_${lib}_LIBRARY + NAMES + ${lib} + PATH_SUFFIXES + dll + HINTS + "${PARASOLID_LIBRARY_DIR}" + ${libsearchdirs} + PATHS + "${PARASOLID_ROOT_DIR}") + +endforeach() + +if(PARASOLID_pskernel_LIBRARY OR PARASOLID_INCLUDE_DIR) + get_filename_component(_libdir "${PARASOLID_pskernel_LIBRARY}" PATH) + get_filename_component(_incdir "${PARASOLID_INCLUDE_DIR}" PATH) + + if(PARASOLID_NESTED_TARGETS OR NOT PARASOLID_fg_LIBRARY) + find_file(PARASOLID_FG_C + NAMES + fg.c + HINTS + "${_libdir}" + "${_libdir}/.." + "${_incdir}") + if(PARASOLID_FG_C) + mark_as_advanced(PARASOLID_FG_C) + set(_nest_targets YES) + set(PARASOLID_fg_LIBRARY + "parasolid_fg_nested_target" + CACHE + STRING + "We will build the Parasolid fg lib." + FORCE) + endif() + endif() + + if(PARASOLID_NESTED_TARGETS OR NOT PARASOLID_frustrum_LIBRARY) + find_file(PARASOLID_FRUSTRUM_C + NAMES + frustrum.c + HINTS + "${_libdir}" + "${_libdir}/.." + "${_incdir}") + if(PARASOLID_FRUSTRUM_C) + mark_as_advanced(PARASOLID_FRUSTRUM_C) + set(_nest_targets YES) + set(PARASOLID_frustrum_LIBRARY + "parasolid_frustrum_nested_target" + CACHE + STRING + "We will build the Parasolid frustrum lib." + FORCE) + endif() + endif() + +endif() + +# Non-default libs +foreach(lib testfr) + find_library(PARASOLID_${lib}_LIBRARY + NAMES + ${lib} + PATH_SUFFIXES + dll + HINTS + ${PARASOLID_LIBRARY_DIR} + ${libsearchdirs} + PATHS + "${PARASOLID_ROOT_DIR}") + mark_as_advanced(PARASOLID_${lib}_LIBRARY) +endforeach() + +### +# Find the DLL's +### + +if(JTTK_FOUND AND JTTK_pskernel_DLL) + # If we have JtTk, must use the dll there or we'll have weird runtime errors + # in parasolid + set(PARASOLID_pskernel_DLL "${JTTK_pskernel_DLL}") +else() + # Find the unversioned DLL + set(dll pskernel) + find_file(PARASOLID_${dll}_DLL + NAMES + ${dll}.dll + PATH_SUFFIXES + dll + HINTS + ${PARASOLID_LIBRARY_DIR} + ${libsearchdirs} + PATHS + "${PARASOLID_ROOT_DIR}") + list(APPEND PARASOLID_DLLS ${PARASOLID_${dll}_DLL}) + mark_as_advanced(PARASOLID_${dll}_DLL) +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(Parasolid + DEFAULT_MSG + PARASOLID_pskernel_LIBRARY + PARASOLID_fg_LIBRARY + PARASOLID_frustrum_LIBRARY + PARASOLID_INCLUDE_DIR) + +if(PARASOLID_FOUND) + # Recurse into the nested targets subdirectory if needed + if(_nest_targets) + get_filename_component(_moddir "${CMAKE_CURRENT_LIST_FILE}" PATH) + add_subdirectory("${_moddir}/nested_targets/Parasolid") + endif() + + set(PARASOLID_INCLUDE_DIRS "${PARASOLID_INCLUDE_DIR}") + set(PARASOLID_LIBRARIES + "${PARASOLID_pskernel_LIBRARY}" + "${PARASOLID_fg_LIBRARY}" + "${PARASOLID_frustrum_LIBRARY}") + if(PARASOLID_pskernel_DLL) + get_filename_component(PARASOLID_RUNTIME_LIBRARY_DIRS + "${PARASOLID_pskernel_DLL}" + PATH) + endif() + mark_as_advanced(PARASOLID_ROOT_DIR) +endif() + +mark_as_advanced(PARASOLID_pskernel_LIBRARY + PARASOLID_pskernel_archive_LIBRARY + PARASOLID_fg_LIBRARY + PARASOLID_frustrum_LIBRARY + PARASOLID_INCLUDE_DIR + PARASOLID_FRUSTRUM_C + PARASOLID_FG_C) diff --git a/lib/wiiuse/cmake/FindPerformer.cmake b/lib/wiiuse/cmake/FindPerformer.cmake new file mode 100644 index 000000000..db2b9c5cc --- /dev/null +++ b/lib/wiiuse/cmake/FindPerformer.cmake @@ -0,0 +1,153 @@ +# - try to find the OpenGL Performer library +# +# Users may optionally supply: +# PERFORMER_ROOT_DIR - a prefix to start searching. +# +# Cache Variables: (probably not for direct use in your scripts) +# PERFORMER_INCLUDE_DIR +# PERFORMER_LIBRARY +# PERFORMER_PFUI_LIBRARY - doesn't get included in PERFORMER_LIBRARIES +# PERFORMER_PFDU_UTIL_LIBRARY - doesn't get included in PERFORMER_LIBRARIES +# PERFORMER_PFV_LIBRARY - doesn't get included in PERFORMER_LIBRARIES +# +# Non-cache variables you might use in your CMakeLists.txt: +# PERFORMER_FOUND +# PERFORMER_INCLUDE_DIRS +# PERFORMER_LIBRARIES +# PERFORMER_RUNTIME_LIBRARY_DIRS +# +# Requires these CMake modules: +# FindPackageHandleStandardArgs (known included with CMake >=2.6.2) +# +# Original Author: +# 2012 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 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(PERFORMER_ROOT_DIR + "${PERFORMER_ROOT_DIR}" + CACHE + PATH + "Path to search for OpenGL Performer library") + + +find_path(PERFORMER_INCLUDE_DIR + NAMES + pf.h + HINTS + "${PERFORMER_ROOT_DIR}" + PATH_SUFFIXES + include + include/Performer + Performer + PATHS + $ENV{PFROOT}) +mark_as_advanced(PERFORMER_INCLUDE_DIR) + +if(WIN32) + set(_pf_libnameprefix lib) + find_library(PERFORMER_PFDU_UTIL_LIBRARY + NAMES + libpfdu-util + HINTS + "${PERFORMER_ROOT_DIR}" + PATH_SUFFIXES + lib + PATHS + $ENV{PFROOT}) +else() + set(_pf_libnameprefix) + find_library(PERFORMER_PFDU_LIBRARY + NAMES + pfdu + HINTS + "${PERFORMER_ROOT_DIR}" + PATH_SUFFIXES + lib + PATHS + $ENV{PFROOT}) + find_library(PERFORMER_PFUTIL_LIBRARY + NAMES + pfutil + HINTS + "${PERFORMER_ROOT_DIR}" + PATH_SUFFIXES + lib + PATHS + $ENV{PFROOT}) + if(PERFORMER_PFDU_LIBRARY AND PERFORMER_PFUTIL_LIBRARY) + set(PERFORMER_PFDU_UTIL_LIBRARY + ${PERFORMER_PFDU_LIBRARY} + ${PERFORMER_PFUTIL_LIBRARY}) + endif() +endif() + +find_library(PERFORMER_LIBRARY + NAMES + ${_pf_libnameprefix}pf + HINTS + "${PERFORMER_ROOT_DIR}" + PATH_SUFFIXES + lib + PATHS + $ENV{PFROOT}) +find_library(PERFORMER_PFUI_LIBRARY + NAMES + ${_pf_libnameprefix}pfui + HINTS + "${PERFORMER_ROOT_DIR}" + PATH_SUFFIXES + lib + PATHS + $ENV{PFROOT}) +find_library(PERFORMER_PFV_LIBRARY + NAMES + ${_pf_libnameprefix}pfv + HINTS + "${PERFORMER_ROOT_DIR}" + PATH_SUFFIXES + lib + PATHS + $ENV{PFROOT}) + +### +# Prereq: OpenGL +### + +find_package(OpenGL QUIET) + +# 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(Performer + DEFAULT_MSG + PERFORMER_LIBRARY + PERFORMER_PFUI_LIBRARY + PERFORMER_PFV_LIBRARY + PERFORMER_PFDU_UTIL_LIBRARY + PERFORMER_INCLUDE_DIR + OPENGL_FOUND) + +if(PERFORMER_FOUND) + set(PERFORMER_INCLUDE_DIRS + "${OPENGL_INCLUDE_DIR}" + "${PERFORMER_INCLUDE_DIR}") + if(PERFORMER_INCLUDE_DIR MATCHES ".*Performer.*") + list(APPEND PERFORMER_INCLUDE_DIRS "${PERFORMER_INCLUDE_DIR}/..") + endif() + set(PERFORMER_LIBRARIES "${OPENGL_LIBRARY}" "${PERFORMER_LIBRARY}") + mark_as_advanced(PERFORMER_ROOT_DIR) +endif() + +mark_as_advanced(PERFORMER_LIBRARY + PERFORMER_PFUI_LIBRARY + PERFORMER_PFV_LIBRARY + PERFORMER_PFDU_LIBRARY + PERFORMER_PFUTIL_LIBRARY + PERFORMER_PFDU_UTIL_LIBRARY + PERFORMER_INCLUDE_DIR) diff --git a/lib/wiiuse/cmake/FindPerlModules.cmake b/lib/wiiuse/cmake/FindPerlModules.cmake new file mode 100644 index 000000000..f09ff851d --- /dev/null +++ b/lib/wiiuse/cmake/FindPerlModules.cmake @@ -0,0 +1,78 @@ +# - try to find perl modules, passed as COMPONENTS +# +# Non-cache variable you might use in your CMakeLists.txt: +# PERLMODULES_FOUND +# +# Requires these CMake modules: +# FindPackageHandleStandardArgs (known included with CMake >=2.6.2) +# +# Original Author: +# 2012 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 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) + +if(NOT PERL_FOUND) + find_package(Perl QUIET) +endif() + +set(_deps_check) +if(PERL_FOUND) + foreach(module ${PerlModules_FIND_COMPONENTS}) + string(REPLACE "::" "/" modfilename "${module}.pm") + string(REPLACE "::" "_" modvarname "PERLMODULES_${module}_MODULE") + string(TOUPPER "${modvarname}" modvarname) + list(APPEND _deps_check ${modvarname}) + if(NOT ${modvarname}) + if(NOT PerlModules_FIND_QUIETLY) + message(STATUS "Checking for perl module ${module}") + endif() + execute_process(COMMAND + "${PERL_EXECUTABLE}" + "-e" + "use ${module}; print \$INC{\"${modfilename}\"}" + RESULT_VARIABLE result_code + OUTPUT_VARIABLE filename + ERROR_VARIABLE error_info + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(result_code EQUAL 0) + if(NOT PerlModules_FIND_QUIETLY) + message(STATUS + "Checking for perl module ${module} - found at ${filename}") + endif() + set(${modvarname} + "${filename}" + CACHE + FILEPATH + "Location found for module ${module}" + FORCE) + mark_as_advanced(${modvarname}) + else() + if(NOT PerlModules_FIND_QUIETLY) + message(STATUS "Checking for perl module ${module} - failed") + endif() + set(${modvarname} + "NOTFOUND" + CACHE + FILEPATH + "No location found for module ${module}" + FORCE) + file(APPEND + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining if the Perl module ${module} exists failed with the following error output:\n" + "${error_info}\n\n") + endif() + endif() + endforeach() +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(PerlModules + DEFAULT_MSG + PERL_FOUND + ${_deps_check}) + diff --git a/lib/wiiuse/cmake/FindQVRPN.cmake b/lib/wiiuse/cmake/FindQVRPN.cmake new file mode 100644 index 000000000..37e1af2b9 --- /dev/null +++ b/lib/wiiuse/cmake/FindQVRPN.cmake @@ -0,0 +1,81 @@ +# - try to find QVRPN library +# +# Of course, you may also just choose to make QVRPN a submodule of your +# project itself. +# +# Cache Variables: +# QVRPN_LIBRARY +# QVRPN_INCLUDE_DIR +# +# Non-cache variables you might use in your CMakeLists.txt: +# QVRPN_FOUND +# QVRPN_LIBRARIES +# QVRPN_INCLUDE_DIRS +# +# QVRPN_ROOT_DIR is searched preferentially for these files +# +# Requires these CMake modules: +# FindPackageHandleStandardArgs (known included with CMake >=2.6.2) +# +# Refactored from FindVRPN.cmake by: +# Juan Sebastian Casallas +# +# FindVRPN.cmake Original Author: +# 2009-2010 Ryan Pavlik +# 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(QVRPN_ROOT_DIR + "${QVRPN_ROOT_DIR}" + CACHE + PATH + "Root directory to search for QVRPN") + +if(CMAKE_SIZEOF_VOID_P MATCHES "8") + set(_LIBSUFFIXES /lib64 /lib) +else() + set(_LIBSUFFIXES /lib) +endif() + +### +# Configure QVRPN +### + +find_path(QVRPN_INCLUDE_DIR + NAMES + vrpn_QMainloopContainer.h + PATH_SUFFIXES + include + include/qvrpn + HINTS + "${QVRPN_ROOT_DIR}") + +find_library(QVRPN_LIBRARY + NAMES + qvrpn + PATH_SUFFIXES + ${_libsuffixes} + HINTS + "${QVRPN_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(QVRPN + DEFAULT_MSG + QVRPN_LIBRARY + QVRPN_INCLUDE_DIR) + +if(QVRPN_FOUND) + set(QVRPN_INCLUDE_DIRS "${QVRPN_INCLUDE_DIR}") + set(QVRPN_LIBRARIES "${QVRPN_LIBRARY}") + + mark_as_advanced(QVRPN_ROOT_DIR) +endif() + +mark_as_advanced(QVRPN_LIBRARY QVRPN_INCLUDE_DIR) diff --git a/lib/wiiuse/cmake/FindSDL2.cmake b/lib/wiiuse/cmake/FindSDL2.cmake new file mode 100644 index 000000000..f69c68a13 --- /dev/null +++ b/lib/wiiuse/cmake/FindSDL2.cmake @@ -0,0 +1,249 @@ +# - Find SDL2 +# Find the SDL2 headers and libraries +# +# SDL2::SDL2 - Imported target to use for building a library +# SDL2::SDL2main - Imported interface target to use if you want SDL and SDLmain. +# SDL2_FOUND - True if SDL2 was found. +# SDL2_DYNAMIC - If we found a DLL version of SDL (meaning you might want to copy a DLL from SDL2::SDL2) +# +# Original Author: +# 2015 Ryan Pavlik +# +# Copyright Sensics, Inc. 2015. +# 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 up architectures (for windows) and prefixes (for mingw builds) +if(WIN32) + if(MINGW) + include(MinGWSearchPathExtras OPTIONAL) + if(MINGWSEARCH_TARGET_TRIPLE) + set(SDL2_PREFIX ${MINGWSEARCH_TARGET_TRIPLE}) + endif() + endif() + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(SDL2_LIB_PATH_SUFFIX lib/x64) + if(NOT MSVC AND NOT SDL2_PREFIX) + set(SDL2_PREFIX x86_64-w64-mingw32) + endif() + else() + set(SDL2_LIB_PATH_SUFFIX lib/x86) + if(NOT MSVC AND NOT SDL2_PREFIX) + set(SDL2_PREFIX i686-w64-mingw32) + endif() + endif() +endif() + +if(SDL2_PREFIX) + set(SDL2_ORIGPREFIXPATH ${CMAKE_PREFIX_PATH}) + if(SDL2_ROOT_DIR) + list(APPEND CMAKE_PREFIX_PATH "${SDL2_ROOT_DIR}") + endif() + if(CMAKE_PREFIX_PATH) + foreach(_prefix ${CMAKE_PREFIX_PATH}) + list(APPEND CMAKE_PREFIX_PATH "${_prefix}/${SDL2_PREFIX}") + endforeach() + endif() + if(MINGWSEARCH_PREFIXES) + list(APPEND CMAKE_PREFIX_PATH ${MINGWSEARCH_PREFIXES}) + endif() +endif() + +# Invoke pkgconfig for hints +find_package(PkgConfig QUIET) +set(SDL2_INCLUDE_HINTS) +set(SDL2_LIB_HINTS) +if(PKG_CONFIG_FOUND) + pkg_search_module(SDL2PC QUIET sdl2) + if(SDL2PC_INCLUDE_DIRS) + set(SDL2_INCLUDE_HINTS ${SDL2PC_INCLUDE_DIRS}) + endif() + if(SDL2PC_LIBRARY_DIRS) + set(SDL2_LIB_HINTS ${SDL2PC_LIBRARY_DIRS}) + endif() +endif() + +include(FindPackageHandleStandardArgs) + +find_library(SDL2_LIBRARY + NAMES + SDL2 + HINTS + ${SDL2_LIB_HINTS} + PATHS + ${SDL2_ROOT_DIR} + ENV SDL2DIR + PATH_SUFFIXES lib SDL2 ${SDL2_LIB_PATH_SUFFIX}) + +set(_sdl2_framework FALSE) +# Some special-casing if we've found/been given a framework. +# Handles whether we're given the library inside the framework or the framework itself. +if(APPLE AND "${SDL2_LIBRARY}" MATCHES "(/[^/]+)*.framework(/.*)?$") + set(_sdl2_framework TRUE) + set(SDL2_FRAMEWORK "${SDL2_LIBRARY}") + # Move up in the directory tree as required to get the framework directory. + while("${SDL2_FRAMEWORK}" MATCHES "(/[^/]+)*.framework(/.*)$" AND NOT "${SDL2_FRAMEWORK}" MATCHES "(/[^/]+)*.framework$") + get_filename_component(SDL2_FRAMEWORK "${SDL2_FRAMEWORK}" DIRECTORY) + endwhile() + if("${SDL2_FRAMEWORK}" MATCHES "(/[^/]+)*.framework$") + set(SDL2_FRAMEWORK_NAME ${CMAKE_MATCH_1}) + # If we found a framework, do a search for the header ahead of time that will be more likely to get the framework header. + find_path(SDL2_INCLUDE_DIR + NAMES + SDL_haptic.h # this file was introduced with SDL2 + HINTS + "${SDL2_FRAMEWORK}/Headers/") + else() + # For some reason we couldn't get the framework directory itself. + # Shouldn't happen, but might if something is weird. + unset(SDL2_FRAMEWORK) + endif() +endif() + +find_path(SDL2_INCLUDE_DIR + NAMES + SDL_haptic.h # this file was introduced with SDL2 + HINTS + ${SDL2_INCLUDE_HINTS} + PATHS + ${SDL2_ROOT_DIR} + ENV SDL2DIR + PATH_SUFFIXES include include/sdl2 include/SDL2 SDL2) + +if(WIN32 AND SDL2_LIBRARY) + find_file(SDL2_RUNTIME_LIBRARY + NAMES + SDL2.dll + libSDL2.dll + HINTS + ${SDL2_LIB_HINTS} + PATHS + ${SDL2_ROOT_DIR} + ENV SDL2DIR + PATH_SUFFIXES bin lib ${SDL2_LIB_PATH_SUFFIX}) +endif() + + +if(WIN32 OR ANDROID OR IOS OR (APPLE AND NOT _sdl2_framework)) + set(SDL2_EXTRA_REQUIRED SDL2_SDLMAIN_LIBRARY) + find_library(SDL2_SDLMAIN_LIBRARY + NAMES + SDL2main + PATHS + ${SDL2_ROOT_DIR} + ENV SDL2DIR + PATH_SUFFIXES lib ${SDL2_LIB_PATH_SUFFIX}) +endif() + +if(MINGW AND NOT SDL2PC_FOUND) + find_library(SDL2_MINGW_LIBRARY mingw32) + find_library(SDL2_MWINDOWS_LIBRARY mwindows) +endif() + +if(SDL2_PREFIX) + # Restore things the way they used to be. + set(CMAKE_PREFIX_PATH ${SDL2_ORIGPREFIXPATH}) +endif() + +# handle the QUIETLY and REQUIRED arguments and set QUATLIB_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(SDL2 + DEFAULT_MSG + SDL2_LIBRARY + SDL2_INCLUDE_DIR + ${SDL2_EXTRA_REQUIRED}) + +if(SDL2_FOUND) + if(NOT TARGET SDL2::SDL2) + # Create SDL2::SDL2 + if(WIN32 AND SDL2_RUNTIME_LIBRARY) + set(SDL2_DYNAMIC TRUE) + add_library(SDL2::SDL2 SHARED IMPORTED) + set_target_properties(SDL2::SDL2 + PROPERTIES + IMPORTED_IMPLIB "${SDL2_LIBRARY}" + IMPORTED_LOCATION "${SDL2_RUNTIME_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIR}" + ) + else() + add_library(SDL2::SDL2 UNKNOWN IMPORTED) + if(SDL2_FRAMEWORK AND SDL2_FRAMEWORK_NAME) + # Handle the case that SDL2 is a framework and we were able to decompose it above. + set_target_properties(SDL2::SDL2 PROPERTIES + IMPORTED_LOCATION "${SDL2_FRAMEWORK}/${SDL2_FRAMEWORK_NAME}") + elseif(_sdl2_framework AND SDL2_LIBRARY MATCHES "(/[^/]+)*.framework$") + # Handle the case that SDL2 is a framework and SDL_LIBRARY is just the framework itself. + + # This takes the basename of the framework, without the extension, + # and sets it (as a child of the framework) as the imported location for the target. + # This is the library symlink inside of the framework. + set_target_properties(SDL2::SDL2 PROPERTIES + IMPORTED_LOCATION "${SDL2_LIBRARY}/${CMAKE_MATCH_1}") + else() + # Handle non-frameworks (including non-Mac), as well as the case that we're given the library inside of the framework + set_target_properties(SDL2::SDL2 PROPERTIES + IMPORTED_LOCATION "${SDL2_LIBRARY}") + endif() + set_target_properties(SDL2::SDL2 + PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIR}" + ) + endif() + + if(APPLE) + # Need Cocoa here, is always a framework + find_library(SDL2_COCOA_LIBRARY Cocoa) + list(APPEND SDL2_EXTRA_REQUIRED SDL2_COCOA_LIBRARY) + if(SDL2_COCOA_LIBRARY) + set_target_properties(SDL2::SDL2 PROPERTIES + IMPORTED_LINK_INTERFACE_LIBRARIES ${SDL2_COCOA_LIBRARY}) + endif() + endif() + + + # Compute what to do with SDL2main + set(SDL2MAIN_LIBRARIES SDL2::SDL2) + add_library(SDL2::SDL2main INTERFACE IMPORTED) + if(SDL2_SDLMAIN_LIBRARY) + add_library(SDL2::SDL2main_real STATIC IMPORTED) + set_target_properties(SDL2::SDL2main_real + PROPERTIES + IMPORTED_LOCATION "${SDL2_SDLMAIN_LIBRARY}") + set(SDL2MAIN_LIBRARIES SDL2::SDL2main_real ${SDL2MAIN_LIBRARIES}) + endif() + if(MINGW) + # MinGW requires some additional libraries to appear earlier in the link line. + if(SDL2PC_LIBRARIES) + # Use pkgconfig-suggested extra libraries if available. + list(REMOVE_ITEM SDL2PC_LIBRARIES SDL2main SDL2) + set(SDL2MAIN_LIBRARIES ${SDL2PC_LIBRARIES} ${SDL2MAIN_LIBRARIES}) + else() + # fall back to extra libraries specified in pkg-config in + # an official binary distro of SDL2 for MinGW I downloaded + if(SDL2_MINGW_LIBRARY) + set(SDL2MAIN_LIBRARIES ${SDL2_MINGW_LIBRARY} ${SDL2MAIN_LIBRARIES}) + endif() + if(SDL2_MWINDOWS_LIBRARY) + set(SDL2MAIN_LIBRARIES ${SDL2_MWINDOWS_LIBRARY} ${SDL2MAIN_LIBRARIES}) + endif() + endif() + set_target_properties(SDL2::SDL2main + PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "main=SDL_main") + endif() + set_target_properties(SDL2::SDL2main + PROPERTIES + INTERFACE_LINK_LIBRARIES "${SDL2MAIN_LIBRARIES}") + endif() + mark_as_advanced(SDL2_ROOT_DIR) +endif() + +mark_as_advanced(SDL2_LIBRARY + SDL2_RUNTIME_LIBRARY + SDL2_INCLUDE_DIR + SDL2_SDLMAIN_LIBRARY + SDL2_COCOA_LIBRARY + SDL2_MINGW_LIBRARY + SDL2_MWINDOWS_LIBRARY) diff --git a/lib/wiiuse/cmake/FindSonix12.cmake b/lib/wiiuse/cmake/FindSonix12.cmake new file mode 100644 index 000000000..0ab159961 --- /dev/null +++ b/lib/wiiuse/cmake/FindSonix12.cmake @@ -0,0 +1,162 @@ +# - try to find Sonix 1.2 library +# Requires VPR 2.0 and GMTL (thus FindVPR20.cmake and FindGMTL.cmake) +# Optionally uses Flagpoll and FindFlagpoll.cmake +# +# This library is a part of VR Juggler 2.2 - you probably want to use +# find_package(VRJuggler22) instead, for an easy interface to this and +# related scripts. See FindVRJuggler22.cmake for more information. +# +# SONIX12_LIBRARY_DIR, library search path +# SONIX12_INCLUDE_DIR, include search path +# SONIX12_LIBRARY, the library to link against +# SONIX12_FOUND, If false, do not try to use this library. +# +# Plural versions refer to this library and its dependencies, and +# are recommended to be used instead, unless you have a good reason. +# +# Useful configuration variables you might want to add to your cache: +# SONIX12_ROOT_DIR - A directory prefix to search +# (a path that contains include/ as a subdirectory) +# +# This script will use Flagpoll, if found, to provide hints to the location +# of this library, but does not use the compiler flags returned by Flagpoll +# directly. +# +# The VJ_BASE_DIR environment variable is also searched (preferentially) +# when searching for this component, so most sane build environments should +# "just work." Note that you need to manually re-run CMake if you change +# this environment variable, because it cannot auto-detect this change +# and trigger an automatic re-run. +# +# 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) + + +set(_HUMAN "Sonix 1.2") +set(_RELEASE_NAMES sonix-1_2 libsonix-1_2) +set(_DEBUG_NAMES sonix_d-1_2 libsonix_d-1_2) +set(_DIR sonix-1.2) +set(_HEADER snx/sonix.h) +set(_FP_PKG_NAME sonix) + +include(SelectLibraryConfigurations) +include(CreateImportedTarget) +include(CleanLibraryList) +include(CleanDirectoryList) + +if(Sonix12_FIND_QUIETLY) + set(_FIND_FLAGS "QUIET") +else() + set(_FIND_FLAGS "") +endif() + +# Try flagpoll. +find_package(Flagpoll QUIET) + +if(FLAGPOLL) + flagpoll_get_include_dirs(${_FP_PKG_NAME} NO_DEPS) + flagpoll_get_library_dirs(${_FP_PKG_NAME} NO_DEPS) +endif() + +set(SONIX12_ROOT_DIR + "${SONIX12_ROOT_DIR}" + CACHE + PATH + "Root directory to search for Sonix") +if(DEFINED VRJUGGLER22_ROOT_DIR) + mark_as_advanced(SONIX12_ROOT_DIR) +endif() +if(NOT SONIX12_ROOT_DIR) + set(SONIX12_ROOT_DIR "${VRJUGGLER22_ROOT_DIR}") +endif() + +set(_ROOT_DIR "${SONIX12_ROOT_DIR}") + +find_path(SONIX12_INCLUDE_DIR + ${_HEADER} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_INCLUDE_DIRS} + PATH_SUFFIXES + ${_DIR} + include/${_DIR} + include/ + DOC + "Path to ${_HUMAN} includes root") + +find_library(SONIX12_LIBRARY_RELEASE + NAMES + ${_RELEASE_NAMES} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBSUFFIXES} + DOC + "${_HUMAN} release library full path") + +find_library(SONIX12_LIBRARY_DEBUG + NAMES + ${_DEBUG_NAMES} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBDSUFFIXES} + DOC + "${_HUMAN} debug library full path") + +select_library_configurations(SONIX12) + +# Dependencies +if(NOT VPR20_FOUND) + find_package(VPR20 ${_FIND_FLAGS}) +endif() + +if(NOT GMTL_FOUND) + find_package(GMTL ${_FIND_FLAGS}) +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(Sonix12 + DEFAULT_MSG + SONIX12_LIBRARY + SONIX12_INCLUDE_DIR + VPR20_FOUND + VPR20_LIBRARIES + VPR20_INCLUDE_DIR + GMTL_FOUND + GMTL_INCLUDE_DIR) + +if(SONIX12_FOUND) + set(_DEPS ${VPR20_LIBRARIES}) + + set(SONIX12_INCLUDE_DIRS ${SONIX12_INCLUDE_DIR}) + list(APPEND + SONIX12_INCLUDE_DIRS + ${VPR20_INCLUDE_DIRS} + ${GMTL_INCLUDE_DIRS}) + + clean_directory_list(SONIX12_INCLUDE_DIRS) + + if(VRJUGGLER22_CREATE_IMPORTED_TARGETS) + create_imported_target(SONIX12 ${_DEPS}) + else() + clean_library_list(SONIX12_LIBRARIES ${_DEPS}) + endif() + + mark_as_advanced(SONIX12_ROOT_DIR) +endif() + +mark_as_advanced(SONIX12_LIBRARY_RELEASE + SONIX12_LIBRARY_DEBUG + SONIX12_INCLUDE_DIR) diff --git a/lib/wiiuse/cmake/FindSonix14.cmake b/lib/wiiuse/cmake/FindSonix14.cmake new file mode 100644 index 000000000..692216fdf --- /dev/null +++ b/lib/wiiuse/cmake/FindSonix14.cmake @@ -0,0 +1,163 @@ +# - try to find Sonix 1.4 library +# Requires VPR 2.2 and GMTL (thus FindVPR22.cmake and FindGMTL.cmake) +# Optionally uses Flagpoll and FindFlagpoll.cmake +# +# This library is a part of VR Juggler 3.0 - you probably want to use +# find_package(VRJuggler30) instead, for an easy interface to this and +# related scripts. See FindVRJuggler30.cmake for more information. +# +# SONIX14_LIBRARY_DIR, library search path +# SONIX14_INCLUDE_DIR, include search path +# SONIX14_LIBRARY, the library to link against +# SONIX14_FOUND, If false, do not try to use this library. +# +# Plural versions refer to this library and its dependencies, and +# are recommended to be used instead, unless you have a good reason. +# +# Useful configuration variables you might want to add to your cache: +# SONIX14_ROOT_DIR - A directory prefix to search +# (a path that contains include/ as a subdirectory) +# +# This script will use Flagpoll, if found, to provide hints to the location +# of this library, but does not use the compiler flags returned by Flagpoll +# directly. +# +# The VJ_BASE_DIR environment variable is also searched (preferentially) +# when searching for this component, so most sane build environments should +# "just work." Note that you need to manually re-run CMake if you change +# this environment variable, because it cannot auto-detect this change +# and trigger an automatic re-run. +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# Updated for VR Juggler 3.0 by: +# Brandon Newendorp + + +set(_HUMAN "Sonix 1.4") +set(_FP_PKG_NAME sonix) +set(_RELEASE_NAMES) +set(_DEBUG_NAMES) +foreach(VER 1_4 1_4_0 1_4_1 1_4_2) + list(APPEND _RELEASE_NAMES ${_FP_PKG_NAME}-${VER}) + list(APPEND _DEBUG_NAMES ${_FP_PKG_NAME}_d-${VER}) +endforeach() +set(_DIR sonix-1.4) +set(_HEADER snx/sonix.h) + +include(SelectLibraryConfigurations) +include(CreateImportedTarget) +include(CleanLibraryList) +include(CleanDirectoryList) + +if(SONIX14_FIND_QUIETLY) + set(_FIND_FLAGS "QUIET") +else() + set(_FIND_FLAGS "") +endif() + +# Try flagpoll. +find_package(Flagpoll QUIET) + +if(FLAGPOLL) + flagpoll_get_include_dirs(${_FP_PKG_NAME} NO_DEPS) + flagpoll_get_library_dirs(${_FP_PKG_NAME} NO_DEPS) +endif() + +set(SONIX14_ROOT_DIR + "${SONIX14_ROOT_DIR}" + CACHE + PATH + "Root directory to search for Sonix") +if(DEFINED VRJUGGLER30_ROOT_DIR) + mark_as_advanced(SONIX14_ROOT_DIR) +endif() +if(NOT SONIX14_ROOT_DIR) + set(SONIX14_ROOT_DIR "${VRJUGGLER30_ROOT_DIR}") +endif() + +set(_ROOT_DIR "${SONIX14_ROOT_DIR}") + +find_path(SONIX14_INCLUDE_DIR + ${_HEADER} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_INCLUDE_DIRS} + PATH_SUFFIXES + ${_DIR} + include/${_DIR} + include/ + DOC + "Path to ${_HUMAN} includes root") + +find_library(SONIX14_LIBRARY_RELEASE + NAMES + ${_RELEASE_NAMES} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBSUFFIXES} + DOC + "${_HUMAN} release library full path") + +find_library(SONIX14_LIBRARY_DEBUG + NAMES + ${_DEBUG_NAMES} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBDSUFFIXES} + DOC + "${_HUMAN} debug library full path") + +select_library_configurations(SONIX14) + +# Dependencies +if(NOT VPR22_FOUND) + find_package(VPR22 ${_FIND_FLAGS}) +endif() + +if(NOT GMTL_FOUND) + find_package(GMTL ${_FIND_FLAGS}) +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(SONIX14 + DEFAULT_MSG + SONIX14_LIBRARY + SONIX14_INCLUDE_DIR + VPR22_FOUND + VPR22_LIBRARIES + VPR22_INCLUDE_DIR + GMTL_FOUND + GMTL_INCLUDE_DIR) + +if(SONIX14_FOUND) + set(_DEPS ${VPR22_LIBRARIES}) + + set(SONIX14_INCLUDE_DIRS ${SONIX14_INCLUDE_DIR}) + list(APPEND + SONIX14_INCLUDE_DIRS + ${VPR22_INCLUDE_DIRS} + ${GMTL_INCLUDE_DIRS}) + + clean_directory_list(SONIX14_INCLUDE_DIRS) + + if(VRJUGGLER30_CREATE_IMPORTED_TARGETS) + create_imported_target(SONIX14 ${_DEPS}) + else() + clean_library_list(SONIX14_LIBRARIES ${_DEPS}) + endif() + + mark_as_advanced(SONIX14_ROOT_DIR) +endif() + +mark_as_advanced(SONIX14_LIBRARY_RELEASE + SONIX14_LIBRARY_DEBUG + SONIX14_INCLUDE_DIR) diff --git a/lib/wiiuse/cmake/FindTR1.cmake b/lib/wiiuse/cmake/FindTR1.cmake new file mode 100644 index 000000000..82bb1db50 --- /dev/null +++ b/lib/wiiuse/cmake/FindTR1.cmake @@ -0,0 +1,73 @@ +# - Try to find C++ TR1 headers and libraries +# Once done, this will define +# +# TR1_USE_FILE, which you may "include" in your CMake file to be able +# to use TR1 features transparently +# TR1_INCLUDE_DIRS, any directories needed to access TR1 headers +# TR1_LIBRARY_DIRS, any directories needed to access (auto-link) TR1 libraries +# TR1_FOUND, If false, do not try to use TR1 features. +# +# If TR1 features are not built-in, we will try to use Boost to +# substitute for them. +# +# 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 we were sought quietly, any dependencies should be quiet as well +if(TR1_FIND_QUIETLY) + set(_findflags QUIET) +else() + set(_findflags) +endif() + +set(_check) +set(TR1_INCLUDE_DIRS) +set(TR1_LIBRARY_DIRS) + +get_filename_component(_findtr1moddir + ${CMAKE_CURRENT_LIST_FILE} + PATH) +set(TR1_USE_FILE "${_findtr1moddir}/UseTR1.cmake") + +if(WIN32) + if(MSVC) + set(PLATFORM "Visual Studio - no workarounds") + else() + set(PLATFORM "Unknown Windows platform - no workarounds set") + endif() + + if(MSVC_VERSION LESS 1600) + # Earlier than VS 2010 + # Missing stdint.h/cstdint + set(PLATFORM "Visual Studio older than Visual Studio 2010") + endif() + + if(MSVC_VERSION LESS 1500) + # Earlier than VS 2008 + # Missing all of TR1 + # (The feature pack or SP1 is required for VS2008 TR support) + set(PLATFORM "Visual Studio older than Visual Studio 2008") + list(APPEND _check Boost_FOUND) + find_package(Boost COMPONENTS math_c99 math_tr1 ${_findflags}) + list(APPEND + TR1_INCLUDE_DIRS + "${Boost_INCLUDE_DIR}/boost/tr1/tr1" + "${Boost_INCLUDE_DIR}/boost/tr1" + "${Boost_INCLUDE_DIR}") + list(APPEND TR1_LIBRARY_DIRS ${Boost_LIBRARY_DIRS}) + endif() +else() + set(PLATFORM "Non-Windows Platform - no workarounds set") +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(TR1 DEFAULT_MSG PLATFORM ${_check}) diff --git a/lib/wiiuse/cmake/FindTooN.cmake b/lib/wiiuse/cmake/FindTooN.cmake new file mode 100644 index 000000000..1dda1de68 --- /dev/null +++ b/lib/wiiuse/cmake/FindTooN.cmake @@ -0,0 +1,68 @@ +# - try to find TooN headers +# +# Users may optionally supply: +# TOON_ROOT_DIR - a prefix to start searching for the toon headers. +# +# Cache Variables: (probably not for direct use in your scripts) +# TOON_INCLUDE_DIR +# +# Non-cache variables you might use in your CMakeLists.txt: +# TOON_FOUND +# TOON_INCLUDE_DIRS +# TOON_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) + +set(TOON_ROOT_DIR + "${TOON_ROOT_DIR}" + CACHE + PATH + "Path to search for TooN") + +### +# Dependencies +### +if(NOT LAPACKLIBS_ROOT_DIR) + set(LAPACKLIBS_ROOT_DIR "${TOON_ROOT_DIR}") +endif() +find_package(LAPACKLibs QUIET) + +### +# Configure TooN +### +find_path(TOON_INCLUDE_DIR + NAMES + TooN/TooN.h + HINTS + "${TOON_ROOT_DIR}" + PATH_SUFFIXES + include) +mark_as_advanced(TOON_INCLUDE_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(TooN + DEFAULT_MSG + TOON_INCLUDE_DIR + LAPACKLIBS_FOUND) + +if(TOON_FOUND) + set(TOON_INCLUDE_DIRS "${TOON_INCLUDE_DIR}") + set(TOON_LIBRARIES ${LAPACKLIBS_LIBRARIES}) + mark_as_advanced(TOON_ROOT_DIR) +endif() + + + diff --git a/lib/wiiuse/cmake/FindTooNtag.cmake b/lib/wiiuse/cmake/FindTooNtag.cmake new file mode 100644 index 000000000..76e790660 --- /dev/null +++ b/lib/wiiuse/cmake/FindTooNtag.cmake @@ -0,0 +1,84 @@ +# - try to find tag algorithm library (built on TooN) +# +# Users may optionally supply: +# TAG_ROOT_DIR - a prefix to start searching for the toon headers. +# +# Cache Variables: (probably not for direct use in your scripts) +# TAG_INCLUDE_DIR +# TAG_LIBRARY +# +# Non-cache variables you might use in your CMakeLists.txt: +# TOONTAG_FOUND +# TOONTAG_INCLUDE_DIRS +# TOONTAG_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) + +set(TOONTAG_ROOT_DIR + "${TOONTAG_ROOT_DIR}" + CACHE + PATH + "Path to search for tag") + +### +# Dependencies +### +if(NOT TOON_ROOT_DIR) + set(TOON_ROOT_DIR "${TOONTAG_ROOT_DIR}") +endif() +find_package(TooN QUIET) + +find_package(TR1 QUIET) +include("${TR1_USE_FILE}") + +### +# Configure tag +### +find_path(TOONTAG_INCLUDE_DIR + NAMES + tag/helpers.h + HINTS + "${TOONTAG_ROOT_DIR}" + PATH_SUFFIXES + tag + include) +mark_as_advanced(TOONTAG_INCLUDE_DIR) + +find_library(TOONTAG_LIBRARY + NAMES + toontag + HINTS + "${TOONTAG_ROOT_DIR}" + PATH_SUFFIXES + lib + lib64) +mark_as_advanced(TOONTAG_LIBRARY) + +# 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(TooNtag + DEFAULT_MSG + TOONTAG_LIBRARY + TOONTAG_INCLUDE_DIR + TOON_FOUND) + +if(TOONTAG_FOUND) + set(TOONTAG_INCLUDE_DIRS "${TOONTAG_INCLUDE_DIR}" ${TOON_INCLUDE_DIRS}) + set(TOONTAG_LIBRARIES "${TOONTAG_LIBRARY}" ${TOON_LIBRARIES}) + mark_as_advanced(TOONTAG_ROOT_DIR) +endif() + + + diff --git a/lib/wiiuse/cmake/FindTweek12.cmake b/lib/wiiuse/cmake/FindTweek12.cmake new file mode 100644 index 000000000..47b9a5e1a --- /dev/null +++ b/lib/wiiuse/cmake/FindTweek12.cmake @@ -0,0 +1,153 @@ +# - try to find Tweek 1.2 library +# Requires VPR 2.0 (thus FindVPR20.cmake) +# Optionally uses Flagpoll and FindFlagpoll.cmake +# +# This library is a part of VR Juggler 2.2 - you probably want to use +# find_package(VRJuggler22) instead, for an easy interface to this and +# related scripts. See FindVRJuggler22.cmake for more information. +# +# TWEEK12_LIBRARY_DIR, library search path +# TWEEK12_INCLUDE_DIR, include search path +# TWEEK12_LIBRARY, the library to link against +# TWEEK12_FOUND, If false, do not try to use this library. +# +# Plural versions refer to this library and its dependencies, and +# are recommended to be used instead, unless you have a good reason. +# +# Useful configuration variables you might want to add to your cache: +# TWEEK12_ROOT_DIR - A directory prefix to search +# (a path that contains include/ as a subdirectory) +# +# This script will use Flagpoll, if found, to provide hints to the location +# of this library, but does not use the compiler flags returned by Flagpoll +# directly. +# +# The VJ_BASE_DIR environment variable is also searched (preferentially) +# when searching for this component, so most sane build environments should +# "just work." Note that you need to manually re-run CMake if you change +# this environment variable, because it cannot auto-detect this change +# and trigger an automatic re-run. +# +# 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) + + +set(_HUMAN "Tweek 1.2") +set(_RELEASE_NAMES tweek-1_2 libtweek-1_2) +set(_DEBUG_NAMES tweek_d-1_2 libtweek_d-1_2) +set(_DIR tweek-1.2) +set(_HEADER tweek/tweek.h) +set(_FP_PKG_NAME tweek) + +include(SelectLibraryConfigurations) +include(CreateImportedTarget) +include(CleanLibraryList) +include(CleanDirectoryList) + +if(Tweek12_FIND_QUIETLY) + set(_FIND_FLAGS "QUIET") +else() + set(_FIND_FLAGS "") +endif() + +# Try flagpoll. +find_package(Flagpoll QUIET) + +if(FLAGPOLL) + flagpoll_get_include_dirs(${_FP_PKG_NAME} NO_DEPS) + flagpoll_get_library_dirs(${_FP_PKG_NAME} NO_DEPS) +endif() + +set(TWEEK12_ROOT_DIR + "${TWEEK12_ROOT_DIR}" + CACHE + PATH + "Root directory to search for Tweek") +if(DEFINED VRJUGGLER22_ROOT_DIR) + mark_as_advanced(TWEEK12_ROOT_DIR) +endif() +if(NOT TWEEK12_ROOT_DIR) + set(TWEEK12_ROOT_DIR "${VRJUGGLER22_ROOT_DIR}") +endif() + +set(_ROOT_DIR "${TWEEK12_ROOT_DIR}") + +find_path(TWEEK12_INCLUDE_DIR + ${_HEADER} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_INCLUDE_DIRS} + PATH_SUFFIXES + ${_DIR} + include/${_DIR} + include/ + DOC + "Path to ${_HUMAN} includes root") + +find_library(TWEEK12_LIBRARY_RELEASE + NAMES + ${_RELEASE_NAMES} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBSUFFIXES} + DOC + "${_HUMAN} release library full path") + +find_library(TWEEK12_LIBRARY_DEBUG + NAMES + ${_DEBUG_NAMES} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBDSUFFIXES} + DOC + "${_HUMAN} debug library full path") + +select_library_configurations(TWEEK12) + +# Dependency +if(NOT VPR20_FOUND) + find_package(VPR20 ${_FIND_FLAGS}) +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(Tweek12 + DEFAULT_MSG + TWEEK12_LIBRARY + TWEEK12_INCLUDE_DIR + VPR20_FOUND + VPR20_LIBRARIES + VPR20_INCLUDE_DIR) + +if(TWEEK12_FOUND) + set(_DEPS ${VPR20_LIBRARIES}) + + set(TWEEK12_INCLUDE_DIRS ${TWEEK12_INCLUDE_DIR}) + list(APPEND TWEEK12_INCLUDE_DIRS ${VPR20_INCLUDE_DIRS}) + + clean_directory_list(TWEEK12_INCLUDE_DIRS) + + if(VRJUGGLER22_CREATE_IMPORTED_TARGETS) + create_imported_target(TWEEK12 ${_DEPS}) + else() + clean_library_list(TWEEK12_LIBRARIES ${_DEPS}) + endif() + + mark_as_advanced(TWEEK12_ROOT_DIR) +endif() + +mark_as_advanced(TWEEK12_LIBRARY_RELEASE + TWEEK12_LIBRARY_DEBUG + TWEEK12_INCLUDE_DIR) diff --git a/lib/wiiuse/cmake/FindTweek14.cmake b/lib/wiiuse/cmake/FindTweek14.cmake new file mode 100644 index 000000000..c6e1e5b2d --- /dev/null +++ b/lib/wiiuse/cmake/FindTweek14.cmake @@ -0,0 +1,154 @@ +# - try to find Tweek 1.4 library +# Requires VPR 2.2 (thus FindVPR22.cmake) +# Optionally uses Flagpoll and FindFlagpoll.cmake +# +# This library is a part of VR Juggler 3.0 - you probably want to use +# find_package(VRJuggler30) instead, for an easy interface to this and +# related scripts. See FindVRJuggler30.cmake for more information. +# +# TWEEK14_LIBRARY_DIR, library search path +# TWEEK14_INCLUDE_DIR, include search path +# TWEEK14_LIBRARY, the library to link against +# TWEEK14_FOUND, If false, do not try to use this library. +# +# Plural versions refer to this library and its dependencies, and +# are recommended to be used instead, unless you have a good reason. +# +# Useful configuration variables you might want to add to your cache: +# TWEEK14_ROOT_DIR - A directory prefix to search +# (a path that contains include/ as a subdirectory) +# +# This script will use Flagpoll, if found, to provide hints to the location +# of this library, but does not use the compiler flags returned by Flagpoll +# directly. +# +# The VJ_BASE_DIR environment variable is also searched (preferentially) +# when searching for this component, so most sane build environments should +# "just work." Note that you need to manually re-run CMake if you change +# this environment variable, because it cannot auto-detect this change +# and trigger an automatic re-run. +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# Updated for VR Juggler 3.0 by: +# Brandon Newendorp + + +set(_HUMAN "Tweek 1.4") +set(_FP_PKG_NAME sonix) +set(_RELEASE_NAMES) +set(_DEBUG_NAMES) +foreach(VER 1_4 1_4_0 1_4_1 1_4_2) + list(APPEND _RELEASE_NAMES ${_FP_PKG_NAME}-${VER}) + list(APPEND _DEBUG_NAMES ${_FP_PKG_NAME}_d-${VER}) +endforeach() +set(_DIR tweek-1.4) +set(_HEADER tweek/tweek.h) + +include(SelectLibraryConfigurations) +include(CreateImportedTarget) +include(CleanLibraryList) +include(CleanDirectoryList) + +if(TWEEK14_FIND_QUIETLY) + set(_FIND_FLAGS "QUIET") +else() + set(_FIND_FLAGS "") +endif() + +# Try flagpoll. +find_package(Flagpoll QUIET) + +if(FLAGPOLL) + flagpoll_get_include_dirs(${_FP_PKG_NAME} NO_DEPS) + flagpoll_get_library_dirs(${_FP_PKG_NAME} NO_DEPS) +endif() + +set(TWEEK14_ROOT_DIR + "${TWEEK14_ROOT_DIR}" + CACHE + PATH + "Root directory to search for Tweek") +if(DEFINED VRJUGGLER30_ROOT_DIR) + mark_as_advanced(TWEEK14_ROOT_DIR) +endif() +if(NOT TWEEK14_ROOT_DIR) + set(TWEEK14_ROOT_DIR "${VRJUGGLER30_ROOT_DIR}") +endif() + +set(_ROOT_DIR "${TWEEK14_ROOT_DIR}") + +find_path(TWEEK14_INCLUDE_DIR + ${_HEADER} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_INCLUDE_DIRS} + PATH_SUFFIXES + ${_DIR} + include/${_DIR} + include/ + DOC + "Path to ${_HUMAN} includes root") + +find_library(TWEEK14_LIBRARY_RELEASE + NAMES + ${_RELEASE_NAMES} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBSUFFIXES} + DOC + "${_HUMAN} release library full path") + +find_library(TWEEK14_LIBRARY_DEBUG + NAMES + ${_DEBUG_NAMES} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBDSUFFIXES} + DOC + "${_HUMAN} debug library full path") + +select_library_configurations(TWEEK14) + +# Dependency +if(NOT VPR22_FOUND) + find_package(VPR22 ${_FIND_FLAGS}) +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(TWEEK14 + DEFAULT_MSG + TWEEK14_LIBRARY + TWEEK14_INCLUDE_DIR + VPR22_FOUND + VPR22_LIBRARIES + VPR22_INCLUDE_DIR) + +if(TWEEK14_FOUND) + set(_DEPS ${VPR22_LIBRARIES}) + + set(TWEEK14_INCLUDE_DIRS ${TWEEK14_INCLUDE_DIR}) + list(APPEND TWEEK14_INCLUDE_DIRS ${VPR22_INCLUDE_DIRS}) + + clean_directory_list(TWEEK14_INCLUDE_DIRS) + + if(VRJUGGLER30_CREATE_IMPORTED_TARGETS) + create_imported_target(TWEEK14 ${_DEPS}) + else() + clean_library_list(TWEEK14_LIBRARIES ${_DEPS}) + endif() + + mark_as_advanced(TWEEK14_ROOT_DIR) +endif() + +mark_as_advanced(TWEEK14_LIBRARY_RELEASE + TWEEK14_LIBRARY_DEBUG + TWEEK14_INCLUDE_DIR) diff --git a/lib/wiiuse/cmake/FindVPR20.cmake b/lib/wiiuse/cmake/FindVPR20.cmake new file mode 100644 index 000000000..03eb12dc6 --- /dev/null +++ b/lib/wiiuse/cmake/FindVPR20.cmake @@ -0,0 +1,276 @@ +# - try to find VPR 2.0 library +# Requires Boost 1.33.1 or greater (including filesystem and signals libraries) +# (and thus FindBoost.cmake from 2.8rc3 or newer, preferably) +# Requires NSPR4 (and PLC4) on Windows +# Requires pthreads on Unix (Mac or Linux) +# Requires libuuid on Linux +# Optionally uses Flagpoll and FindFlagpoll.cmake +# +# This library is a part of VR Juggler 2.2 - you probably want to use +# find_package(VRJuggler22) instead, for an easy interface to this and +# related scripts. See FindVRJuggler22.cmake for more information. +# +# VPR20_LIBRARY_DIR, library search path +# VPR20_INCLUDE_DIR, include search path +# VPR20_LIBRARY, the library to link against +# VPR20_FOUND, If false, do not try to use this library. +# +# Plural versions refer to this library and its dependencies, and +# are recommended to be used instead, unless you have a good reason. +# +# Useful configuration variables you might want to add to your cache: +# VPR20_ROOT_DIR - A directory prefix to search +# (a path that contains include/ as a subdirectory) +# +# This script will use Flagpoll, if found, to provide hints to the location +# of this library, but does not use the compiler flags returned by Flagpoll +# directly. +# +# The VJ_BASE_DIR environment variable is also searched (preferentially) +# when searching for this component, so most sane build environments should +# "just work." Note that you need to manually re-run CMake if you change +# this environment variable, because it cannot auto-detect this change +# and trigger an automatic re-run. +# +# 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) + +set(_HUMAN "VPR 2.0") +set(_RELEASE_NAMES vpr-2_0 libvpr-2_0) +set(_DEBUG_NAMES vpr_d-2_0 libvpr_d-2_0) +set(_DIR vpr-2.0) +set(_HEADER vpr/vpr.h) +set(_FP_PKG_NAME vpr) + +include(SelectLibraryConfigurations) +include(CreateImportedTarget) +include(CleanLibraryList) +include(CleanDirectoryList) + +if(VPR20_FIND_QUIETLY) + set(_FIND_FLAGS "QUIET") +else() + set(_FIND_FLAGS "") +endif() + +# Try flagpoll. +find_package(Flagpoll QUIET) + +if(FLAGPOLL) + flagpoll_get_include_dirs(${_FP_PKG_NAME} NO_DEPS) + flagpoll_get_library_dirs(${_FP_PKG_NAME} NO_DEPS) + flagpoll_get_extra_libs(${_FP_PKG_NAME} NO_DEPS) +endif() + +set(VPR20_ROOT_DIR + "${VPR20_ROOT_DIR}" + CACHE + PATH + "Root directory to search for VPR") +if(DEFINED VRJUGGLER22_ROOT_DIR) + mark_as_advanced(VPR20_ROOT_DIR) +endif() +if(NOT VPR20_ROOT_DIR) + set(VPR20_ROOT_DIR "${VRJUGGLER22_ROOT_DIR}") +endif() + +set(_ROOT_DIR "${VPR20_ROOT_DIR}") + +find_path(VPR20_INCLUDE_DIR + ${_HEADER} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_INCLUDE_DIRS} + PATH_SUFFIXES + ${_DIR} + include/${_DIR} + include/ + DOC + "Path to ${_HUMAN} includes root") + +find_library(VPR20_LIBRARY_RELEASE + NAMES + ${_RELEASE_NAMES} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBSUFFIXES} + DOC + "${_HUMAN} release library full path") + +find_library(VPR20_LIBRARY_DEBUG + NAMES + ${_DEBUG_NAMES} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBDSUFFIXES} + DOC + "${_HUMAN} debug library full path") + +select_library_configurations(VPR20) + +# Dependencies +set(_deps_libs) +set(_deps_includes) +set(_deps_check) +if(COMMAND cmake_policy) + cmake_policy(SET CMP0011 NEW) + cmake_policy(SET CMP0012 NEW) +endif() +if((NOT "${Boost_FOUND}") + OR (NOT "${Boost_FILESYSTEM_FOUND}") + OR (NOT "${Boost_SIGNALS_FOUND}") + OR (Boost_VERSION GREATER 103401 AND NOT Boost_SYSTEM_FOUND)) + if(VPR20_LIBRARY_RELEASE) + # Find Boost in the same place as VPR + get_filename_component(VPR20_LIBRARY_DIR + ${VPR20_LIBRARY_RELEASE} + PATH) + set(BOOST_ROOT ${VPR20_LIBRARY_DIR}/../) + + if(APPLE) + # VR Juggler 2.2.1 binaries for Mac are built against single-threaded boost. + set(Boost_USE_STATIC_LIBS ON) + #set(Boost_USE_MULTITHREADED OFF) + endif() + + find_package(Boost + 1.33.1 + ${_FIND_FLAGS} + COMPONENTS + filesystem + signals) + + mark_as_advanced(Boost_LIB_DIAGNOSTIC_DEFINITIONS) + + if(WIN32 AND NOT Boost_FOUND) + if(NOT VPR20_FIND_QUIETLY) + message(STATUS + "Searching for Boost using forced '-vc80' override...") + endif() + set(Boost_COMPILER "-vc80") + find_package(Boost + 1.33.1 + ${_FIND_FLAGS} + COMPONENTS + filesystem + signals) + endif() + + if(Boost_VERSION GREATER 103401) + find_package(Boost + ${_FIND_FLAGS} + COMPONENTS + filesystem + system + signals) + endif() + endif() + +endif() + +list(APPEND + _deps_libs + ${Boost_FILESYSTEM_LIBRARY} + ${Boost_SYSTEM_LIBRARY} + ${Boost_SIGNALS_LIBRARY}) +list(APPEND _deps_includes ${Boost_INCLUDE_DIRS}) +list(APPEND + _deps_check + Boost_FILESYSTEM_LIBRARY + Boost_SIGNALS_LIBRARY + Boost_INCLUDE_DIRS) + +if(NOT CPPDOM_FOUND) + find_package(CPPDOM ${_FIND_FLAGS}) +endif() + +list(APPEND _deps_libs ${CPPDOM_LIBRARIES}) +list(APPEND _deps_includes ${CPPDOM_INCLUDE_DIRS}) +list(APPEND _deps_check CPPDOM_LIBRARIES CPPDOM_INCLUDE_DIRS) + +if(UNIX AND NOT WIN32) + if(NOT THREADS_FOUND) + find_package(Threads ${_FIND_FLAGS}) + endif() + + list(APPEND _deps_check THREADS_FOUND) + list(APPEND _deps_libs ${CMAKE_THREAD_LIBS_INIT}) + + if(NOT APPLE) + find_library(VPR20_libuuid_LIBRARY NAMES uuid) + mark_as_advanced(VPR20_libuuid_LIBRARY) + list(APPEND _deps_check VPR20_libuuid_LIBRARY) + list(APPEND _deps_libs ${VPR20_libuuid_LIBRARY}) + endif() +endif() + +if(WIN32) + find_library(VPR20_libnspr4_LIBRARY + NAMES + nspr4 + libnspr4 + HINTS + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + "${_ROOT_DIR}" + PATH_SUFFIXES + ${_VRJ_LIBSUFFIXES} + DOC + "${_HUMAN} NSPR4 library full path") + + find_library(VPR20_libplc4_LIBRARY + NAMES + plc4 + libplc4 + HINTS + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + "${_ROOT_DIR}" + PATH_SUFFIXES + ${_VRJ_LIBDSUFFIXES} + DOC + "${_HUMAN} PLC4 library full path") + mark_as_advanced(VPR20_libnspr4_LIBRARY VPR20_libplc4_LIBRARY) + list(APPEND _deps_check VPR20_libnspr4_LIBRARY VPR20_libplc4_LIBRARY) + list(APPEND + _deps_libs + ${VPR20_libnspr4_LIBRARY} + ${VPR20_libplc4_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(VPR20 + DEFAULT_MSG + VPR20_LIBRARY + VPR20_INCLUDE_DIR + ${_deps_check}) + +if(VPR20_FOUND) + + set(VPR20_INCLUDE_DIRS "${VPR20_INCLUDE_DIR}" ${_deps_includes}) + + clean_directory_list(VPR20_INCLUDE_DIRS) + + if(VRJUGGLER22_CREATE_IMPORTED_TARGETS) + create_imported_target(VPR20 ${_deps_libs}) + else() + clean_library_list(VPR20_LIBRARIES ${VPR20_LIBRARY} ${_deps_libs}) + endif() + + mark_as_advanced(VPR20_ROOT_DIR) +endif() + +mark_as_advanced(VPR20_LIBRARY_RELEASE + VPR20_LIBRARY_DEBUG + VPR20_INCLUDE_DIR) diff --git a/lib/wiiuse/cmake/FindVPR22.cmake b/lib/wiiuse/cmake/FindVPR22.cmake new file mode 100644 index 000000000..d9ab26ff6 --- /dev/null +++ b/lib/wiiuse/cmake/FindVPR22.cmake @@ -0,0 +1,232 @@ +# - try to find VPR 2.2 library +# Requires Boost 1.33.1 or greater (including filesystem and signals libraries) +# (and thus FindBoost.cmake from 2.8rc3 or newer, preferably) +# Requires NSPR4 (and PLC4) on Windows +# Requires pthreads on Unix (Mac or Linux) +# Requires libuuid on Linux +# Optionally uses Flagpoll and FindFlagpoll.cmake +# +# This library is a part of VR Juggler 3.0 - you probably want to use +# find_package(VRJuggler30) instead, for an easy interface to this and +# related scripts. See FindVRJuggler30.cmake for more information. +# +# VPR22_LIBRARY_DIR, library search path +# VPR22_INCLUDE_DIR, include search path +# VPR22_LIBRARY, the library to link against +# VPR22_FOUND, If false, do not try to use this library. +# +# Plural versions refer to this library and its dependencies, and +# are recommended to be used instead, unless you have a good reason. +# +# Useful configuration variables you might want to add to your cache: +# VPR22_ROOT_DIR - A directory prefix to search +# (a path that contains include/ as a subdirectory) +# +# This script will use Flagpoll, if found, to provide hints to the location +# of this library, but does not use the compiler flags returned by Flagpoll +# directly. +# +# The VJ_BASE_DIR environment variable is also searched (preferentially) +# when searching for this component, so most sane build environments should +# "just work." Note that you need to manually re-run CMake if you change +# this environment variable, because it cannot auto-detect this change +# and trigger an automatic re-run. +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# Updated for VR Juggler 3.0 by: +# Brandon Newendorp + +set(_HUMAN "VPR 2.2") +set(_FP_PKG_NAME vpr) +set(_RELEASE_NAMES) +set(_DEBUG_NAMES) +foreach(VER 2_2 2_2_0 2_2_1 2_2_2) + list(APPEND _RELEASE_NAMES ${_FP_PKG_NAME}-${VER}) + list(APPEND _DEBUG_NAMES ${_FP_PKG_NAME}_d-${VER}) +endforeach() +set(_DIR vpr-2.2) +set(_HEADER vpr/vpr.h) + +include(SelectLibraryConfigurations) +include(CreateImportedTarget) +include(CleanLibraryList) +include(CleanDirectoryList) + +if(VPR22_FIND_QUIETLY) + set(_FIND_FLAGS "QUIET") +else() + set(_FIND_FLAGS "") +endif() + +# Try flagpoll. +find_package(Flagpoll QUIET) + +if(FLAGPOLL) + flagpoll_get_include_dirs(${_FP_PKG_NAME} NO_DEPS) + flagpoll_get_library_dirs(${_FP_PKG_NAME} NO_DEPS) + flagpoll_get_extra_libs(${_FP_PKG_NAME} NO_DEPS) +endif() + +set(VPR22_ROOT_DIR + "${VPR22_ROOT_DIR}" + CACHE + PATH + "Root directory to search for VPR") +if(DEFINED VRJUGGLER30_ROOT_DIR) + mark_as_advanced(VPR22_ROOT_DIR) +endif() +if(NOT VPR22_ROOT_DIR) + set(VPR22_ROOT_DIR "${VRJUGGLER30_ROOT_DIR}") +endif() + +set(_ROOT_DIR "${VPR22_ROOT_DIR}") + +find_path(VPR22_INCLUDE_DIR + ${_HEADER} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_INCLUDE_DIRS} + PATH_SUFFIXES + ${_DIR} + include/${_DIR} + include/ + DOC + "Path to ${_HUMAN} includes root") + +find_library(VPR22_LIBRARY_RELEASE + NAMES + ${_RELEASE_NAMES} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBSUFFIXES} + DOC + "${_HUMAN} release library full path") + +find_library(VPR22_LIBRARY_DEBUG + NAMES + ${_DEBUG_NAMES} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBDSUFFIXES} + DOC + "${_HUMAN} debug library full path") + +select_library_configurations(VPR22) + +# Dependencies +set(_deps_libs) +set(_deps_includes) +set(_deps_check) +if(COMMAND cmake_policy) + cmake_policy(SET CMP0011 NEW) + cmake_policy(SET CMP0012 NEW) +endif() +if((NOT Boost_FOUND) + OR (NOT Boost_FILESYSTEM_FOUND) + OR (NOT Boost_SIGNALS_FOUND) + OR (NOT Boost_SYSTEM_FOUND) + OR (NOT Boost_PROGRAM_OPTIONS_FOUND) + OR (NOT Boost_DATE_TIME_FOUND) + OR (NOT Boost_REGEX_FOUND)) + if(VPR22_LIBRARY_RELEASE) + # Find Boost in the same place as VPR + get_filename_component(VPR22_LIBRARY_DIR + ${VPR22_LIBRARY_RELEASE} + PATH) + set(BOOST_ROOT ${VPR22_LIBRARY_DIR}/../) + + find_package(Boost + 1.40.0 + ${_FIND_FLAGS} + COMPONENTS + filesystem + system + signals + program_options + date_time + regex) + + mark_as_advanced(Boost_LIB_DIAGNOSTIC_DEFINITIONS) + + endif() + +endif() + +list(APPEND + _deps_libs + ${Boost_FILESYSTEM_LIBRARY} + ${Boost_SYSTEM_LIBRARY} + ${Boost_SIGNALS_LIBRARY} + ${Boost_PROGRAM_OPTIONS_LIBRARY} + ${Boost_DATE_TIME_LIBRARY} + ${Boost_REGEX_LIBRARY}) +list(APPEND _deps_includes ${Boost_INCLUDE_DIRS}) +list(APPEND + _deps_check + Boost_FILESYSTEM_LIBRARY + Boost_SYSTEM_LIBRARY + Boost_SIGNALS_LIBRARY + Boost_PROGRAM_OPTIONS_LIBRARY + Boost_DATE_TIME_LIBRARY + Boost_REGEX_LIBRARY + Boost_INCLUDE_DIRS) + +if(NOT CPPDOM_FOUND) + find_package(CPPDOM ${_FIND_FLAGS}) +endif() + +list(APPEND _deps_libs ${CPPDOM_LIBRARIES}) +list(APPEND _deps_includes ${CPPDOM_INCLUDE_DIRS}) +list(APPEND _deps_check CPPDOM_LIBRARIES CPPDOM_INCLUDE_DIRS) + +if(UNIX AND NOT WIN32) + if(NOT THREADS_FOUND) + find_package(Threads ${_FIND_FLAGS}) + endif() + + list(APPEND _deps_check THREADS_FOUND) + list(APPEND _deps_libs ${CMAKE_THREAD_LIBS_INIT}) + + if(NOT APPLE) + find_library(VPR22_libuuid_LIBRARY NAMES uuid) + mark_as_advanced(VPR22_libuuid_LIBRARY) + if(VPR22_libuuid_LIBRARY) + list(APPEND _deps_libs ${VPR22_libuuid_LIBRARY}) + endif() + endif() +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(VPR22 + DEFAULT_MSG + VPR22_LIBRARY + VPR22_INCLUDE_DIR + ${_deps_check}) + +if(VPR22_FOUND) + + set(VPR22_INCLUDE_DIRS ${VPR22_INCLUDE_DIR} ${_deps_includes}) + + clean_directory_list(VPR22_INCLUDE_DIRS) + + if(VRJUGGLER30_CREATE_IMPORTED_TARGETS) + create_imported_target(VPR22 ${_deps_libs}) + else() + clean_library_list(VPR22_LIBRARIES ${VPR22_LIBRARY} ${_deps_libs}) + endif() + + mark_as_advanced(VPR22_ROOT_DIR) +endif() + +mark_as_advanced(VPR22_LIBRARY_RELEASE + VPR22_LIBRARY_DEBUG + VPR22_INCLUDE_DIR) diff --git a/lib/wiiuse/cmake/FindVPS.cmake b/lib/wiiuse/cmake/FindVPS.cmake new file mode 100644 index 000000000..c2b52c03a --- /dev/null +++ b/lib/wiiuse/cmake/FindVPS.cmake @@ -0,0 +1,304 @@ +# - try to find VPS library +# +# VPS_LIBRARY_DIR, library search path +# VPS_INCLUDE_DIR, include search path +# VPS_{component}_LIBRARY, the library to link against +# VPS_FOUND, If false, do not try to use this library. +# +# Plural versions refer to this library and its dependencies, and +# are recommended to be used instead, unless you have a good reason. +# +# Useful configuration variables you might want to add to your cache: +# VPS_ROOT_DIR - A directory prefix to search +# (a path that contains include/ as a subdirectory) +# +# 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) + +include(SelectLibraryConfigurations) +include(ListCombinations) +include(CheckVersion) +include(ListFilter) + +set(VPS_ROOT_DIR + "${VPS_ROOT_DIR}" + CACHE + PATH + "Root directory to search for VPS") + +# Try the config file mode. +find_package(VPS QUIET NO_MODULE) +if(VPS_FOUND) + mark_as_advanced(VPS_DIR VPS_ROOT_DIR) + return() +endif() + +if(NOT BITS) + if(CMAKE_SIZEOF_VOID_P MATCHES "8") + set(BITS 64) + else() + set(BITS 32) + endif() +endif() + +set(_vpslibnames) +set(_grviewerlibnames) + +### +# Cray MTA(Multi-Threaded Architecture) family: CMake build not tested +if("${CMAKE_SYSTEM_NAME}" STREQUAL "MTX") + set(VPS_PLATFORM MTX) + set(_VPS_FLAGS_32 "-pl all.pl -par") + set(_VPS_FLAGS_64 "-pl all.pl -par") +### +# Linux +elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") + set(VPS_PLATFORM LINUX) + set(_VPS_FLAGS_32 "-O2 -Wno-write-strings") + set(_VPS_FLAGS_64 "-m64 -O3 -ffast-math -funroll-all-loops -Wno-write-strings") + +### +# IBM-AIX: CMake build not tested +elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "AIX") + set(VPS_PLATFORM AIX) + set(_VPS_FLAGS_32 "-q32") + set(_VPS_FLAGS_64 "-q64") + +### +# HP-UX: CMake build not tested +elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "HP-UX") + set(VPS_PLATFORM HPUX) + set(_VPS_FLAGS_32 "-O") + +### +# SunOS: CMake build not tested +elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "SunOS") + set(VPS_PLATFORM SOLARIS) + set(_VPS_FLAGS_32 "-O") + +### +# IRIX: CMake build not tested +elseif("${CMAKE_SYSTEM_NAME}" MATCHES "IRIX") + set(VPS_PLATFORM IRIX) + set(_VPS_FLAGS_32 "-O2 -OPT") + set(_VPS_FLAGS_64 "-64 -O2 -OPT") + +### +# Mac OS X +elseif(APPLE AND "${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") + set(VPS_PLATFORM MACOSX) + set(_VPS_FLAGS_32 "-O2 -lm -lobjc -lstdc++ -Wno-write-strings") + set(_VPS_FLAGS_64 "-m64 -O3 -ffast-math -funroll-all-loops -lm -lobjc -lstdc++ -Wno-write-strings") + +### +# Windows +elseif(WIN32) + set(VPS_PLATFORM WINDOWS) + set(_VPS_FLAGS_32 "-O2") + set(_VPS_FLAGS_64 "-O2") + + if(MSVC) + set(DEFS_32 -D_CRT_SECURE_NO_DEPRECATE) + set(DEFS_64 -D_CRT_SECURE_NO_DEPRECATE) + if(MSVC60) + set(VPS_CRT "VC6") + elseif(MSVC70) + set(VPS_CRT "VC7") + elseif(MSVC71) + set(VPS_CRT "VC71") + elseif(MSVC80) + set(VPS_CRT "VC8") + elseif(MSVC90) + set(VPS_CRT "VC9") + elseif(MSVC10) + set(VPS_CRT "VC10") + else() + set(VPS_CRT "VC") + endif() + endif() +endif() + +if(WIN32 AND MSVC) + set(PLATFORM win${BITS}) + set(_threadsuffix Mt) + if(MSVC71) + set(VC_VER vc71) + set(VC_VER_LONG vc71) + elseif(MSVC80) + set(VC_SHORT VC8) + set(VC_LONG MSVC80) + elseif(MSVC90) + set(VC_SHORT VC9) + set(VC_LONG MSVC90) + endif() + list(APPEND + _vpslibnames + "Vps${VC_SHORT}_${BITS}" + "Vps${VC_SHORT}_${BITS}${_threadsuffix}") +endif() + +list(APPEND _vpslibnames "Vps${VPS_PLATFORM}${VPS_CRT}_${BITS}") +list(APPEND + _grviewerlibnames + "Viewer" + "GrViewer${VPS_PLATFORM}${VPS_CRT}_${BITS}") + +### +# Configure VPS +### + +set(_incsearchdirs) +set(_libsearchdirs) + +if(WIN32) + include(ProgramFilesGlob) + program_files_glob(_dirs "/VPS*/") + program_files_glob(_dirs2 "/VPS/*/") + list(APPEND _dirs ${_dirs2}) +endif() + +list_combinations(_libsearchdirs + PREFIXES + "${VPS_ROOT_DIR}" + "${_dirs}" + SUFFIXES + "/lib" + "/Viewer") +list_combinations(_libsearchdirs2 + PREFIXES + ${_libsearchdirs} + SUFFIXES + "/Release" + "/RelWithDebInfo" + "/MinSizeRel" + "/Debug") +clean_directory_list(_libsearchdirs ${_libsearchdirs2}) + +list_combinations(_incsearchdirs + PREFIXES + "${VPS_ROOT_DIR}" + "${_dirs}" + SUFFIXES + "/include" + "/include/vps" + "/src" + "/../src" + "/Viewer" + "/../Viewer") +clean_directory_list(_incsearchdirs) + +# If a version was specified, the least we can do is remove any directories +# from our search that contain too low of versions +if(VPS_FIND_VERSION) + + set(_badversions) + foreach(_dir ${_libsearchdirs}) + string(REGEX MATCH "([0-9]).([0-9]).([0-9])" _ver "${_dir}") + if(_ver) + string(REGEX + REPLACE + "([0-9]).([0-9]).([0-9])" + "\\1.\\2.\\3" + _verstd + "${_ver}") + check_version(_result VPS "${_verstd}") + if(NOT _result) + list(APPEND _badversions "${_verstd}") + endif() + endif() + endforeach() + + foreach(_badver ${_badversions}) + list_filter_out(_libsearchdirs ${_badver} ${_libsearchdirs}) + list_filter_out(_incsearchdirs ${_badver} ${_incsearchdirs}) + endforeach() +endif() +if(_libsearchdirs) + list(SORT _libsearchdirs) + list(REVERSE _libsearchdirs) +endif() + +if(_incsearchdirs) + list(SORT _incsearchdirs) + list(REVERSE _incsearchdirs) +endif() + +find_library(VPS_vps_LIBRARY + NAMES + ${_vpslibnames} + PATH_SUFFIXES + LP + HINTS + ${_libsearchdirs} + PATHS + ${VPS_ROOT_DIR} + ${VPS_ROOT_DIR}/src + ${VPS_ROOT_DIR}/lib) + +find_path(VPS_vps_INCLUDE_DIR + NAMES + Vps.h + HINTS + ${_incsearchdirs} + PATHS + ${VPS_ROOT_DIR} + PATH_SUFFIXES + include + include/vps + src) + +find_library(VPS_grviewer_LIBRARY + NAMES + ${_grviewerlibnames} + HINTS + ${_libsearchdirs} + PATHS + ${VPS_ROOT_DIR} + PATH_SUFFIXES + lib + Viewer) + +find_path(VPS_grviewer_INCLUDE_DIR + NAMES + grViewerLib.h + HINTS + ${_incsearchdirs} + PATHS + ${VPS_ROOT_DIR} + PATH_SUFFIXES + include + include/vps + Viewer) + +mark_as_advanced(VPS_vps_LIBRARY + VPS_vps_INCLUDE_DIR + VPS_grviewer_LIBRARY + VPS_grviewer_INCLUDE_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(VPS + DEFAULT_MSG + VPS_vps_LIBRARY + VPS_vps_INCLUDE_DIR) + +if(VPS_FOUND) + set(VPS_vps_INCLUDE_DIRS "${VPS_vps_INCLUDE_DIR}") + set(VPS_INCLUDE_DIRS "${VPS_vps_INCLUDE_DIR}") + set(VPS_grviewer_INCLUDE_DIRS + "${VPS_vps_INCLUDE_DIR}" + "${VPS_grviewer_INCLUDE_DIR}") + set(VPS_LIBRARIES "${VPS_vps_LIBRARY}") + set(VPS_grviewer_LIBRARIES + "${VPS_vps_LIBRARY}" + "${VPS_grviewer_LIBRARY}") + mark_as_advanced(VPS_ROOT_DIR VPS_DIR) +endif() diff --git a/lib/wiiuse/cmake/FindVRJ22.cmake b/lib/wiiuse/cmake/FindVRJ22.cmake new file mode 100644 index 000000000..7a291f0a4 --- /dev/null +++ b/lib/wiiuse/cmake/FindVRJ22.cmake @@ -0,0 +1,210 @@ +# - try to find VR Juggler 2.2 core library +# Requires JCCL 1.2, Gadgeteer 1.2, VPR 2.0, and Sonix 1.2 +# (thus FindJCCL12.cmake, FindGadgeteer12.cmake, FindVPR20.cmake, +# and FindSonix12.cmake) +# Requires X11 if not on Mac or Windows. +# Optionally uses Flagpoll and FindFlagpoll.cmake +# +# This library is a part of VR Juggler 2.2 - you probably want to use +# find_package(VRJuggler22) instead, for an easy interface to this and +# related scripts. See FindVRJuggler22.cmake for more information. +# +# VRJ22_LIBRARY_DIR, library search path +# VRJ22_INCLUDE_DIR, include search path +# VRJ22_LIBRARY, the library to link against +# VRJ22_FOUND, If false, do not try to use this library. +# +# Plural versions refer to this library and its dependencies, and +# are recommended to be used instead, unless you have a good reason. +# +# Useful configuration variables you might want to add to your cache: +# VRJ22_ROOT_DIR - A directory prefix to search +# (a path that contains include/ as a subdirectory) +# +# This script will use Flagpoll, if found, to provide hints to the location +# of this library, but does not use the compiler flags returned by Flagpoll +# directly. +# +# The VJ_BASE_DIR environment variable is also searched (preferentially) +# when searching for this component, so most sane build environments should +# "just work." Note that you need to manually re-run CMake if you change +# this environment variable, because it cannot auto-detect this change +# and trigger an automatic re-run. +# +# 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) + + +set(_HUMAN "VR Juggler 2.2 Core") +set(_RELEASE_NAMES vrj-2_2 libvrj-2_2) +set(_DEBUG_NAMES vrj_d-2_2 libvrj_d-2_2) +set(_DIR vrjuggler-2.2) +set(_HEADER vrj/Kernel/Kernel.h) +set(_FP_PKG_NAME vrjuggler) + +include(SelectLibraryConfigurations) +include(CreateImportedTarget) +include(CleanLibraryList) +include(CleanDirectoryList) + +if(VRJ22_FIND_QUIETLY) + set(_FIND_FLAGS "QUIET") +else() + set(_FIND_FLAGS "") +endif() + +# Try flagpoll. +find_package(Flagpoll QUIET) + +if(FLAGPOLL) + flagpoll_get_include_dirs(${_FP_PKG_NAME} NO_DEPS) + flagpoll_get_library_dirs(${_FP_PKG_NAME} NO_DEPS) + flagpoll_get_extra_libs(${_FP_PKG_NAME} NO_DEPS) +endif() + +set(VRJ22_ROOT_DIR + "${VRJ22_ROOT_DIR}" + CACHE + PATH + "Root directory to search for VRJ") +if(DEFINED VRJUGGLER22_ROOT_DIR) + mark_as_advanced(VRJ22_ROOT_DIR) +endif() +if(NOT VRJ22_ROOT_DIR) + set(VRJ22_ROOT_DIR "${VRJUGGLER22_ROOT_DIR}") +endif() + +set(_ROOT_DIR "${VRJ22_ROOT_DIR}") + +find_path(VRJ22_INCLUDE_DIR + ${_HEADER} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_INCLUDE_DIRS} + PATH_SUFFIXES + ${_DIR} + include/${_DIR} + include/ + DOC + "Path to ${_HUMAN} includes root") + +find_library(VRJ22_LIBRARY_RELEASE + NAMES + ${_RELEASE_NAMES} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBSUFFIXES} + DOC + "${_HUMAN} release library full path") + +find_library(VRJ22_LIBRARY_DEBUG + NAMES + ${_DEBUG_NAMES} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBDSUFFIXES} + DOC + "${_HUMAN} debug library full path") + +select_library_configurations(VRJ22) + +# Dependencies +if(NOT JCCL12_FOUND) + find_package(JCCL12 ${_FIND_FLAGS}) +endif() + +if(NOT GADGETEER12_FOUND) + find_package(Gadgeteer12 ${_FIND_FLAGS}) +endif() + +if(NOT VPR20_FOUND) + find_package(VPR20 ${_FIND_FLAGS}) +endif() + +if(NOT SONIX12_FOUND) + find_package(Sonix12 ${_FIND_FLAGS}) +endif() + +if(UNIX AND NOT APPLE AND NOT WIN32) + if(NOT X11_FOUND) + find_package(X11 ${_FIND_FLAGS}) + endif() + set(_CHECK_EXTRAS + X11_FOUND + X11_X11_LIB + X11_ICE_LIB + X11_SM_LIB + X11_INCLUDE_DIR) +endif() +if(UNIX AND NOT WIN32) + find_library(VRJ22_libm_LIBRARY m) + mark_as_advanced(VRJ22_libm_LIBRARY) + list(APPEND _CHECK_EXTRAS VRJ22_libm_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(VRJ22 + DEFAULT_MSG + VRJ22_LIBRARY + VRJ22_INCLUDE_DIR + JCCL12_FOUND + JCCL12_LIBRARIES + JCCL12_INCLUDE_DIR + GADGETEER12_FOUND + GADGETEER12_LIBRARIES + GADGETEER12_INCLUDE_DIR + VPR20_FOUND + VPR20_LIBRARIES + VPR20_INCLUDE_DIR + SONIX12_FOUND + SONIX12_LIBRARIES + SONIX12_INCLUDE_DIR + ${_CHECK_EXTRAS}) + +if(VRJ22_FOUND) + set(_DEPS + ${JCCL12_LIBRARIES} + ${GADGETEER12_LIBRARIES} + ${VPR20_LIBRARIES} + ${SONIX12_LIBRARIES}) + if(UNIX AND NOT APPLE AND NOT WIN32) + list(APPEND _DEPS ${X11_X11_LIB} ${X11_ICE_LIB} ${X11_SM_LIB}) + endif() + if(UNIX AND NOT WIN32) + list(APPEND _DEPS ${VRJ22_libm_LIBRARY}) + endif() + + set(VRJ22_INCLUDE_DIRS "${VRJ22_INCLUDE_DIR}") + list(APPEND + VRJ22_INCLUDE_DIRS + ${JCCL12_INCLUDE_DIRS} + ${GADGETEER12_INCLUDE_DIRS} + ${VPR20_INCLUDE_DIRS} + ${SONIX12_INCLUDE_DIRS}) + clean_directory_list(VRJ22_INCLUDE_DIRS) + + if(VRJUGGLER22_CREATE_IMPORTED_TARGETS) + create_imported_target(VRJ22 ${_DEPS}) + else() + clean_library_list(VRJ22_LIBRARIES ${_DEPS}) + endif() + + mark_as_advanced(VRJ22_ROOT_DIR) +endif() + +mark_as_advanced(VRJ22_LIBRARY_RELEASE + VRJ22_LIBRARY_DEBUG + VRJ22_INCLUDE_DIR) diff --git a/lib/wiiuse/cmake/FindVRJ30.cmake b/lib/wiiuse/cmake/FindVRJ30.cmake new file mode 100644 index 000000000..30091bccf --- /dev/null +++ b/lib/wiiuse/cmake/FindVRJ30.cmake @@ -0,0 +1,216 @@ +# - try to find VR Juggler 3.0 core library +# Requires JCCL 1.4, Gadgeteer 1.4, VPR 2.2, and Sonix 1.4 +# (thus FindJCCL14.cmake, FindGadgeteer20.cmake, FindVPR22.cmake, +# and FindSonix14.cmake) +# Requires X11 if not on Mac or Windows. +# Optionally uses Flagpoll and FindFlagpoll.cmake +# +# This library is a part of VR Juggler 3.0 - you probably want to use +# find_package(VRJuggler30) instead, for an easy interface to this and +# related scripts. See FindVRJuggler30.cmake for more information. +# +# VRJ30_LIBRARY_DIR, library search path +# VRJ30_INCLUDE_DIR, include search path +# VRJ30_LIBRARY, the library to link against +# VRJ30_FOUND, If false, do not try to use this library. +# +# Plural versions refer to this library and its dependencies, and +# are recommended to be used instead, unless you have a good reason. +# +# Useful configuration variables you might want to add to your cache: +# VRJ30_ROOT_DIR - A directory prefix to search +# (a path that contains include/ as a subdirectory) +# +# This script will use Flagpoll, if found, to provide hints to the location +# of this library, but does not use the compiler flags returned by Flagpoll +# directly. +# +# The VJ_BASE_DIR environment variable is also searched (preferentially) +# when searching for this component, so most sane build environments should +# "just work." Note that you need to manually re-run CMake if you change +# this environment variable, because it cannot auto-detect this change +# and trigger an automatic re-run. +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# Updated for VR Juggler 3.0 by: +# Brandon Newendorp +# +# 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) + + +set(_HUMAN "VR Juggler 3.0 Core") +set(_FP_PKG_NAME vrjuggler) +set(_RELEASE_NAMES) +set(_DEBUG_NAMES) +foreach(VER 3_0 3_0_0 3_0_1 3_0_2) + list(APPEND _RELEASE_NAMES vrj-${VER}) + list(APPEND _DEBUG_NAMES vrj_d-${VER}) +endforeach() +set(_DIR vrjuggler-3.0) +set(_HEADER vrj/Kernel/Kernel.h) + +include(SelectLibraryConfigurations) +include(CreateImportedTarget) +include(CleanLibraryList) +include(CleanDirectoryList) + +if(VRJ30_FIND_QUIETLY) + set(_FIND_FLAGS "QUIET") +else() + set(_FIND_FLAGS "") +endif() + +# Try flagpoll. +find_package(Flagpoll QUIET) + +if(FLAGPOLL) + flagpoll_get_include_dirs(${_FP_PKG_NAME} NO_DEPS) + flagpoll_get_library_dirs(${_FP_PKG_NAME} NO_DEPS) + flagpoll_get_extra_libs(${_FP_PKG_NAME} NO_DEPS) +endif() + +set(VRJ30_ROOT_DIR + "${VRJ30_ROOT_DIR}" + CACHE + PATH + "Root directory to search for VRJ") +if(DEFINED VRJUGGLER30_ROOT_DIR) + mark_as_advanced(VRJ30_ROOT_DIR) +endif() +if(NOT VRJ30_ROOT_DIR) + set(VRJ30_ROOT_DIR "${VRJUGGLER30_ROOT_DIR}") +endif() + +set(_ROOT_DIR "${VRJ30_ROOT_DIR}") + +find_path(VRJ30_INCLUDE_DIR + ${_HEADER} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_INCLUDE_DIRS} + PATH_SUFFIXES + ${_DIR} + include/${_DIR} + include/ + DOC + "Path to ${_HUMAN} includes root") + +find_library(VRJ30_LIBRARY_RELEASE + NAMES + ${_RELEASE_NAMES} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBSUFFIXES} + DOC + "${_HUMAN} release library full path") + +find_library(VRJ30_LIBRARY_DEBUG + NAMES + ${_DEBUG_NAMES} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBDSUFFIXES} + DOC + "${_HUMAN} debug library full path") + +select_library_configurations(VRJ30) + +# Dependencies +if(NOT JCCL14_FOUND) + find_package(JCCL14 ${_FIND_FLAGS}) +endif() + +if(NOT GADGETEER20_FOUND) + find_package(Gadgeteer20 ${_FIND_FLAGS}) +endif() + +if(NOT VPR22_FOUND) + find_package(VPR22 ${_FIND_FLAGS}) +endif() + +if(NOT SONIX14_FOUND) + find_package(Sonix14 ${_FIND_FLAGS}) +endif() + +if(UNIX AND NOT APPLE AND NOT WIN32) + if(NOT X11_FOUND) + find_package(X11 ${_FIND_FLAGS}) + endif() + set(_CHECK_EXTRAS + X11_FOUND + X11_X11_LIB + X11_ICE_LIB + X11_SM_LIB + X11_INCLUDE_DIR) +endif() +if(UNIX AND NOT WIN32) + find_library(VRJ30_libm_LIBRARY m) + mark_as_advanced(VRJ30_libm_LIBRARY) + list(APPEND _CHECK_EXTRAS VRJ30_libm_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(VRJ30 + DEFAULT_MSG + VRJ30_LIBRARY + VRJ30_INCLUDE_DIR + JCCL14_FOUND + JCCL14_LIBRARIES + JCCL14_INCLUDE_DIR + GADGETEER20_FOUND + GADGETEER20_LIBRARIES + GADGETEER20_INCLUDE_DIR + VPR22_FOUND + VPR22_LIBRARIES + VPR22_INCLUDE_DIR + SONIX14_FOUND + SONIX14_LIBRARIES + SONIX14_INCLUDE_DIR + ${_CHECK_EXTRAS}) + +if(VRJ30_FOUND) + set(_DEPS + ${JCCL14_LIBRARIES} + ${GADGETEER20_LIBRARIES} + ${VPR22_LIBRARIES} + ${SONIX14_LIBRARIES}) + if(UNIX AND NOT APPLE AND NOT WIN32) + list(APPEND _DEPS ${X11_X11_LIB} ${X11_ICE_LIB} ${X11_SM_LIB}) + endif() + if(UNIX AND NOT WIN32) + list(APPEND _DEPS ${VRJ30_libm_LIBRARY}) + endif() + + set(VRJ30_INCLUDE_DIRS ${VRJ30_INCLUDE_DIR}) + list(APPEND + VRJ30_INCLUDE_DIRS + ${JCCL14_INCLUDE_DIRS} + ${GADGETEER20_INCLUDE_DIRS} + ${VPR22_INCLUDE_DIRS} + ${SONIX14_INCLUDE_DIRS}) + clean_directory_list(VRJ30_INCLUDE_DIRS) + + if(VRJUGGLER30_CREATE_IMPORTED_TARGETS) + create_imported_target(VRJ30 ${_DEPS}) + else() + clean_library_list(VRJ30_LIBRARIES ${_DEPS}) + endif() + + mark_as_advanced(VRJ30_ROOT_DIR) +endif() + +mark_as_advanced(VRJ30_LIBRARY_RELEASE + VRJ30_LIBRARY_DEBUG + VRJ30_INCLUDE_DIR) diff --git a/lib/wiiuse/cmake/FindVRJOGL22.cmake b/lib/wiiuse/cmake/FindVRJOGL22.cmake new file mode 100644 index 000000000..7f0aafd8d --- /dev/null +++ b/lib/wiiuse/cmake/FindVRJOGL22.cmake @@ -0,0 +1,161 @@ +# - try to find VRJuggler 2.2 OpenGL library +# Requires VRJ core 2.2 (thus FindVRJ22.cmake) +# Requires OpenGL. +# Optionally uses Flagpoll and FindFlagpoll.cmake +# +# This library is a part of VR Juggler 2.2 - you probably want to use +# find_package(VRJuggler22) instead, for an easy interface to this and +# related scripts. See FindVRJuggler22.cmake for more information. +# +# VRJOGL22_LIBRARY_DIR, library search path +# VRJOGL22_INCLUDE_DIRS, include search path for dependencies +# VRJOGL22_LIBRARY, the library to link against +# VRJOGL22_FOUND, If false, do not try to use this library. +# +# Plural versions refer to this library and its dependencies, and +# are recommended to be used instead, unless you have a good reason. +# +# Useful configuration variables you might want to add to your cache: +# VRJOGL22_ROOT_DIR - A directory prefix to search +# (a path that contains include/ as a subdirectory) +# +# This script will use Flagpoll, if found, to provide hints to the location +# of this library, but does not use the compiler flags returned by Flagpoll +# directly. +# +# The VJ_BASE_DIR environment variable is also searched (preferentially) +# when searching for this component, so most sane build environments should +# "just work." Note that you need to manually re-run CMake if you change +# this environment variable, because it cannot auto-detect this change +# and trigger an automatic re-run. +# +# 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) + + +set(_HUMAN "VR Juggler 2.2 OpenGL Core") +set(_RELEASE_NAMES vrj_ogl-2_2 libvrj_ogl-2_2) +set(_DEBUG_NAMES vrj_ogl_d-2_2 libvrj_ogl_d-2_2) +set(_DIR vrjuggler-2.2) +set(_FP_PKG_NAME vrjuggler-opengl) + +include(SelectLibraryConfigurations) +include(CreateImportedTarget) +include(CleanLibraryList) +include(CleanDirectoryList) + +if(VRJOGL22_FIND_QUIETLY) + set(_FIND_FLAGS "QUIET") +else() + set(_FIND_FLAGS "") +endif() + +# Try flagpoll. +find_package(Flagpoll QUIET) + +if(FLAGPOLL) + flagpoll_get_library_dirs(${_FP_PKG_NAME} NO_DEPS) + flagpoll_get_library_names(${_FP_PKG_NAME} NO_DEPS) +endif() + +set(VRJOGL22_ROOT_DIR + "${VRJOGL22_ROOT_DIR}" + CACHE + PATH + "Root directory to search for VRJOGL") +if(DEFINED VRJUGGLER22_ROOT_DIR) + mark_as_advanced(VRJOGL22_ROOT_DIR) +endif() +if(NOT VRJOGL22_ROOT_DIR) + set(VRJOGL22_ROOT_DIR "${VRJUGGLER22_ROOT_DIR}") +endif() + +set(_ROOT_DIR "${VRJOGL22_ROOT_DIR}") + +find_library(VRJOGL22_LIBRARY_RELEASE + NAMES + ${_RELEASE_NAMES} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBSUFFIXES} + DOC + "${_HUMAN} release library full path") + +find_library(VRJOGL22_LIBRARY_DEBUG + NAMES + ${_DEBUG_NAMES} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBDSUFFIXES} + DOC + "${_HUMAN} debug library full path") + +select_library_configurations(VRJOGL22) + +# Dependency +if(NOT VRJ22_FOUND) + find_package(VRJ22 ${_FIND_FLAGS}) +endif() + +if(NOT OPENGL_FOUND) + find_package(OpenGL ${_FIND_FLAGS}) +endif() + +if(APPLE) + set(VRJOGL22_AppKit_LIBRARY + "-framework AppKit" + CACHE + STRING + "AppKit framework for OSX") + set(VRJOGL22_Cocoa_LIBRARY + "-framework Cocoa" + CACHE + STRING + "Cocoa framework for OSX") + mark_as_advanced(VRJOGL22_AppKit_LIBRARY VRJOGL22_Cocoa_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(VRJOGL22 + DEFAULT_MSG + VRJOGL22_LIBRARY + VRJ22_FOUND + VRJ22_LIBRARIES + VRJ22_INCLUDE_DIRS + OPENGL_FOUND + OPENGL_LIBRARIES) + +if(VRJOGL22_FOUND) + set(_DEPS ${VRJ22_LIBRARIES} ${OPENGL_LIBRARIES}) + if(APPLE) + list(APPEND + _DEPS + ${VRJOGL22_AppKit_LIBRARY} + ${VRJOGL22_Cocoa_LIBRARY}) + endif() + + set(VRJOGL22_INCLUDE_DIRS ${VRJ22_INCLUDE_DIRS} ${OPENGL_INCLUDE_DIRS}) + + if(VRJUGGLER22_CREATE_IMPORTED_TARGETS) + create_imported_target(VRJOGL22 ${_DEPS}) + else() + clean_library_list(VRJOGL22_LIBRARIES ${_DEPS}) + endif() + + mark_as_advanced(VRJOGL22_ROOT_DIR) +endif() + +mark_as_advanced(VRJOGL22_LIBRARY_RELEASE VRJOGL22_LIBRARY_DEBUG) diff --git a/lib/wiiuse/cmake/FindVRJOGL30.cmake b/lib/wiiuse/cmake/FindVRJOGL30.cmake new file mode 100644 index 000000000..780e2c335 --- /dev/null +++ b/lib/wiiuse/cmake/FindVRJOGL30.cmake @@ -0,0 +1,162 @@ +# - try to find VRJuggler 3.0 OpenGL library +# Requires VRJ core 3.0 (thus FindVRJ30.cmake) +# Requires OpenGL. +# Optionally uses Flagpoll and FindFlagpoll.cmake +# +# This library is a part of VR Juggler 3.0 - you probably want to use +# find_package(VRJuggler30) instead, for an easy interface to this and +# related scripts. See FindVRJuggler30.cmake for more information. +# +# VRJOGL30_LIBRARY_DIR, library search path +# VRJOGL30_INCLUDE_DIRS, include search path for dependencies +# VRJOGL30_LIBRARY, the library to link against +# VRJOGL30_FOUND, If false, do not try to use this library. +# +# Plural versions refer to this library and its dependencies, and +# are recommended to be used instead, unless you have a good reason. +# +# Useful configuration variables you might want to add to your cache: +# VRJOGL30_ROOT_DIR - A directory prefix to search +# (a path that contains include/ as a subdirectory) +# +# This script will use Flagpoll, if found, to provide hints to the location +# of this library, but does not use the compiler flags returned by Flagpoll +# directly. +# +# The VJ_BASE_DIR environment variable is also searched (preferentially) +# when searching for this component, so most sane build environments should +# "just work." Note that you need to manually re-run CMake if you change +# this environment variable, because it cannot auto-detect this change +# and trigger an automatic re-run. +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# Updated for VR Juggler 3.0 by: +# Brandon Newendorp + + +set(_HUMAN "VR Juggler 3.0 OpenGL Core") +set(_FP_PKG_NAME vrjuggler-opengl) +set(_RELEASE_NAMES) +set(_DEBUG_NAMES) +foreach(VER 3_0 3_0_0 3_0_1 3_0_2) + list(APPEND _RELEASE_NAMES vrj_ogl-${VER}) + list(APPEND _DEBUG_NAMES vrj_ogl_d-${VER}) +endforeach() +set(_DIR vrjuggler-3.0) + +include(SelectLibraryConfigurations) +include(CreateImportedTarget) +include(CleanLibraryList) +include(CleanDirectoryList) + +if(VRJOGL30_FIND_QUIETLY) + set(_FIND_FLAGS "QUIET") +else() + set(_FIND_FLAGS "") +endif() + +# Try flagpoll. +find_package(Flagpoll QUIET) + +if(FLAGPOLL) + flagpoll_get_library_dirs(${_FP_PKG_NAME} NO_DEPS) + flagpoll_get_library_names(${_FP_PKG_NAME} NO_DEPS) +endif() + +set(VRJOGL30_ROOT_DIR + "${VRJOGL30_ROOT_DIR}" + CACHE + PATH + "Root directory to search for VRJOGL") +if(DEFINED VRJUGGLER30_ROOT_DIR) + mark_as_advanced(VRJOGL30_ROOT_DIR) +endif() +if(NOT VRJOGL30_ROOT_DIR) + set(VRJOGL30_ROOT_DIR "${VRJUGGLER30_ROOT_DIR}") +endif() + +set(_ROOT_DIR "${VRJOGL30_ROOT_DIR}") + +find_library(VRJOGL30_LIBRARY_RELEASE + NAMES + ${_RELEASE_NAMES} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBSUFFIXES} + DOC + "${_HUMAN} release library full path") + +find_library(VRJOGL30_LIBRARY_DEBUG + NAMES + ${_DEBUG_NAMES} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBDSUFFIXES} + DOC + "${_HUMAN} debug library full path") + +select_library_configurations(VRJOGL30) + +# Dependency +if(NOT VRJ30_FOUND) + find_package(VRJ30 ${_FIND_FLAGS}) +endif() + +if(NOT OPENGL_FOUND) + find_package(OpenGL ${_FIND_FLAGS}) +endif() + +if(APPLE) + set(VRJOGL30_AppKit_LIBRARY + "-framework AppKit" + CACHE + STRING + "AppKit framework for OSX") + set(VRJOGL30_Cocoa_LIBRARY + "-framework Cocoa" + CACHE + STRING + "Cocoa framework for OSX") + mark_as_advanced(VRJOGL30_AppKit_LIBRARY VRJOGL30_Cocoa_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(VRJOGL30 + DEFAULT_MSG + VRJOGL30_LIBRARY + VRJ30_FOUND + VRJ30_LIBRARIES + VRJ30_INCLUDE_DIRS + OPENGL_FOUND + OPENGL_LIBRARIES) + +if(VRJOGL30_FOUND) + set(_DEPS ${VRJ30_LIBRARIES} ${OPENGL_LIBRARIES}) + if(APPLE) + list(APPEND + _DEPS + ${VRJOGL30_AppKit_LIBRARY} + ${VRJOGL30_Cocoa_LIBRARY}) + endif() + + set(VRJOGL30_INCLUDE_DIRS ${VRJ30_INCLUDE_DIRS} ${OPENGL_INCLUDE_DIRS}) + + if(VRJUGGLER30_CREATE_IMPORTED_TARGETS) + create_imported_target(VRJOGL30 ${_DEPS}) + else() + clean_library_list(VRJOGL30_LIBRARIES ${_DEPS}) + endif() + + mark_as_advanced(VRJOGL30_ROOT_DIR) +endif() + +mark_as_advanced(VRJOGL30_LIBRARY_RELEASE VRJOGL30_LIBRARY_DEBUG) diff --git a/lib/wiiuse/cmake/FindVRJuggler.cmake b/lib/wiiuse/cmake/FindVRJuggler.cmake new file mode 100644 index 000000000..c794d0906 --- /dev/null +++ b/lib/wiiuse/cmake/FindVRJuggler.cmake @@ -0,0 +1,198 @@ +# - try to find VR Juggler-related packages (combined finder) +# VRJUGGLER_INCLUDE_DIRS, include search paths +# VRJUGGLER_LIBRARIES, the libraries to link against +# VRJUGGLER_ENVIRONMENT +# VRJUGGLER_RUNTIME_LIBRARY_DIRS +# VRJUGGLER_CXX_FLAGS +# VRJUGGLER_DEFINITIONS +# VRJUGGLER_FOUND, If false, do not try to use VR Juggler. +# +# Components available to search for (uses "VRJOGL" by default): +# VRJOGL +# VRJ +# Gadgeteer +# JCCL +# VPR +# Sonix +# Tweek +# +# Additionally, a full setup requires these packages and their Find_.cmake scripts +# CPPDOM +# GMTL +# +# Optionally uses Flagpoll (and FindFlagpoll.cmake) +# +# Notes on components: +# - All components automatically include their dependencies. +# - If you do not specify a component, VRJOGL (the OpenGL view manager) +# will be used by default. +# - Capitalization of component names does not matter, but it's best to +# pretend it does and use the above capitalization. +# - Since this script calls find_package for your requested components and +# their dependencies, you can use any of the variables specified in those +# files in addition to the "summary" ones listed here, for more finely +# controlled building and linking. +# +# This CMake script requires all of the Find*.cmake scripts for the +# components listed above, as it is only a "meta-script" designed to make +# using those scripts more developer-friendly. +# +# Useful configuration variables you might want to add to your cache: +# (CAPS COMPONENT NAME)_ROOT_DIR - A directory prefix to search +# (a path that contains include/ as a subdirectory) +# +# The VJ_BASE_DIR environment variable is also searched (preferentially) +# when seeking any of the above components, as well as Flagpoll, CPPDOM, +# and Boost (from within VPR), so most sane build environments should +# "just work." +# +# IMPORTANT: Note that you need to manually re-run CMake if you change +# this environment variable, because it cannot auto-detect this change +# and trigger an automatic re-run. +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# Updated for VR Juggler 3.0 by: +# Brandon Newendorp +# +# 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) + +include(CleanLibraryList) +include(CleanDirectoryList) +include(FindPackageMessage) + +if(NOT VRJUGGLER_ROOT_DIR) + file(TO_CMAKE_PATH "$ENV{VJ_BASE_DIR}" VRJUGGLER_ROOT_DIR) +endif() + +set(VRJUGGLER_ROOT_DIR + "${VRJUGGLER_ROOT_DIR}" + CACHE + PATH + "Additional root directory to search for VR Juggler and its dependencies.") +if(NOT VRJUGGLER_ROOT_DIR) + file(TO_CMAKE_PATH "$ENV{VJ_BASE_DIR}" VRJUGGLER30_ROOT_DIR) +endif() + +# Default required components +if(NOT VRJuggler_FIND_COMPONENTS) + set(VRJuggler_FIND_COMPONENTS vrjogl) +endif() + +if(VRJuggler30_FIND_QUIETLY) + set(_FIND_FLAGS "QUIET") +else() + set(_FIND_FLAGS "") +endif() + +set(VRJUGGLER_FIND_22 TRUE) +set(VRJUGGLER_FIND_30 TRUE) +if(VRJuggler_FIND_VERSION) + if(VRJuggler_FIND_VERSION_EXACT) + if(VRJuggler_FIND_VERSION MATCHES "2.2" OR VRJuggler_FIND_VERSION MATCHES "22") + set(VRJUGGLER_FIND_30 FALSE) + elseif(VRJuggler_FIND_VERSION MATCHES "3.0" OR VRJuggler_FIND_VERSION MATCHES "30") + set(VRJUGGLER_FIND_22 FALSE) + endif() + else() + if(VRJuggler_FIND_VERSION MATCHES "3.0" OR VRJuggler_FIND_VERSION MATCHES "30") + set(VRJUGGLER_FIND_22 FALSE) + endif() + endif() +endif() + +if(VRJUGGLER_FIND_30) + if(NOT VRJUGGLER30_ROOT_DIR) + set(VRJUGGLER30_ROOT_DIR ${VRJUGGLER_ROOT_DIR}) + endif() + find_package(VRJuggler30 COMPONENTS ${VRJuggler_FIND_COMPONENTS}) + if(VRJUGGLER30_FOUND) + set(VRJUGGLER_FOUND TRUE) + + set(VRJUGGLER_LIBRARIES ${VRJUGGLER30_LIBRARIES}) + set(VRJUGGLER_INCLUDE_DIRS ${VRJUGGLER30_INCLUDE_DIRS}) + set(VRJUGGLER_LIBRARY_DIRS ${VRJUGGLER30_LIBRARY_DIRS}) + + set(VRJUGGLER_ENVIRONMENT ${VRJUGGLER30_ENVIRONMENT}) + set(VRJUGGLER_RUNTIME_LIBRARY_DIRS ${VRJUGGLER30_RUNTIME_LIBRARY_DIRS}) + + set(VRJUGGLER_CXX_FLAGS ${VRJUGGLER30_CXX_FLAGS}) + set(VRJUGGLER_DEFINITIONS ${VRJUGGLER30_DEFINITIONS}) + set(VRJUGGLER_BUNDLE_PLUGINS ${VRJUGGLER30_BUNDLE_PLUGINS}) + set(VRJUGGLER_VJ_BASE_DIR ${VRJUGGLER30_VJ_BASE_DIR}) + set(VRJUGGLER_VERSION 3.0) + + macro(install_vrjuggler_data_files prefix) + install_vrjuggler30_data_files("${prefix}" ${ARGN}) + endmacro() + + macro(install_vrjuggler_plugins prefix varForFilenames) + install_vrjuggler30_plugins("${prefix}" ${varForFilenames} ${ARGN}) + endmacro() + endif() +endif() + +if(VRJUGGLER_FIND_22 AND (NOT VRJUGGLER_FOUND)) + + if(NOT VRJUGGLER22_ROOT_DIR) + set(VRJUGGLER22_ROOT_DIR ${VRJUGGLER_ROOT_DIR}) + endif() + find_package(VRJuggler22 COMPONENTS ${VRJuggler_FIND_COMPONENTS}) + if(VRJUGGLER22_FOUND) + set(VRJUGGLER_FOUND TRUE) + + set(VRJUGGLER_LIBRARIES ${VRJUGGLER22_LIBRARIES}) + set(VRJUGGLER_INCLUDE_DIRS ${VRJUGGLER22_INCLUDE_DIRS}) + set(VRJUGGLER_LIBRARY_DIRS ${VRJUGGLER22_LIBRARY_DIRS}) + + set(VRJUGGLER_ENVIRONMENT ${VRJUGGLER22_ENVIRONMENT}) + set(VRJUGGLER_RUNTIME_LIBRARY_DIRS ${VRJUGGLER22_RUNTIME_LIBRARY_DIRS}) + + set(VRJUGGLER_CXX_FLAGS ${VRJUGGLER22_CXX_FLAGS}) + set(VRJUGGLER_DEFINITIONS ${VRJUGGLER22_DEFINITIONS}) + set(VRJUGGLER_BUNDLE_PLUGINS ${VRJUGGLER22_BUNDLE_PLUGINS}) + set(VRJUGGLER_VJ_BASE_DIR ${VRJUGGLER22_VJ_BASE_DIR}) + set(VRJUGGLER_VERSION 2.2) + + macro(install_vrjuggler_data_files prefix) + install_vrjuggler22_data_files("${prefix}" ${ARGN}) + endmacro() + + macro(install_vrjuggler_plugins prefix varForFilenames) + install_vrjuggler22_plugins("${prefix}" ${varForFilenames} ${ARGN}) + endmacro() + endif() +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(VRJuggler + REQUIRED_VARS + VRJUGGLER_LIBRARIES + VERSION_VAR + VRJUGGLER_VERSION) + +if(VRJUGGLER_FOUND) + mark_as_advanced(VRJUGGLER_ROOT_DIR) + + # Set generic component variables, like VPR_LIBRARIES + if(VRJUGGLER_VERSION VERSION_EQUAL 2.2) + set(_components VRJ22 VRJOGL22 VPR20 TWEEK12 SONIX12 JCCL12) + else() + set(_components VRJ30 VRJOGL30 VPR22 TWEEK14 SONIX14 JCCL14) + endif() + + foreach(comp ${_components}) + string(LENGTH "${comp}" len) + math(EXPR complen "${len} - 2") + string(SUBSTRING "${comp}" 0 ${complen} compshort) + set(${compshort}_LIBRARIES ${${comp}_LIBRARIES}) + set(${compshort}_INCLUDE_DIRS ${${comp}_INCLUDE_DIRS}) + set(${compshort}_LIBRARY_DIRS ${${comp}_LIBRARY_DIRS}) + set(${compshort}_CXX_FLAGS ${${comp}_CXX_FLAGS}) + endforeach() +endif() diff --git a/lib/wiiuse/cmake/FindVRJuggler22.cmake b/lib/wiiuse/cmake/FindVRJuggler22.cmake new file mode 100644 index 000000000..db9b3a22e --- /dev/null +++ b/lib/wiiuse/cmake/FindVRJuggler22.cmake @@ -0,0 +1,503 @@ +# - try to find VRJuggler 2.2-related packages (main finder) +# VRJUGGLER22_LIBRARY_DIRS, library search paths +# VRJUGGLER22_INCLUDE_DIRS, include search paths +# VRJUGGLER22_LIBRARIES, the libraries to link against +# VRJUGGLER22_ENVIRONMENT +# VRJUGGLER22_RUNTIME_LIBRARY_DIRS +# VRJUGGLER22_CXX_FLAGS +# VRJUGGLER22_DEFINITIONS +# VRJUGGLER22_FOUND, If false, do not try to use VR Juggler 2.2. +# +# Components available to search for (uses "VRJOGL22" by default): +# VRJOGL22 +# VRJ22 +# Gadgeteer12 +# JCCL12 +# VPR20 +# Sonix12 +# Tweek12 +# +# Additionally, a full setup requires these packages and their Find_.cmake scripts +# CPPDOM +# GMTL +# +# Optionally uses Flagpoll (and FindFlagpoll.cmake) +# +# Notes on components: +# - All components automatically include their dependencies. +# - You can search for the name above with or without the version suffix. +# - If you do not specify a component, VRJOGL22(the OpenGL view manager) +# will be used by default. +# - Capitalization of component names does not matter, but it's best to +# pretend it does and use the above capitalization. +# - Since this script calls find_package for your requested components and +# their dependencies, you can use any of the variables specified in those +# files in addition to the "summary" ones listed here, for more finely +# controlled building and linking. +# +# This CMake script requires all of the Find*.cmake scripts for the +# components listed above, as it is only a "meta-script" designed to make +# using those scripts more developer-friendly. +# +# Useful configuration variables you might want to add to your cache: +# (CAPS COMPONENT NAME)_ROOT_DIR - A directory prefix to search +# (a path that contains include/ as a subdirectory) +# +# The VJ_BASE_DIR environment variable is also searched (preferentially) +# when seeking any of the above components, as well as Flagpoll, CPPDOM, +# and Boost (from within VPR20), so most sane build environments should +# "just work." +# +# IMPORTANT: Note that you need to manually re-run CMake if you change +# this environment variable, because it cannot auto-detect this change +# and trigger an automatic re-run. +# +# 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) + +include(CleanLibraryList) +include(CleanDirectoryList) +include(FindPackageMessage) + +set(VRJUGGLER22_ROOT_DIR + "${VRJUGGLER22_ROOT_DIR}" + CACHE + PATH + "Additional root directory to search for VR Juggler and its dependencies.") +if(NOT VRJUGGLER22_ROOT_DIR) + file(TO_CMAKE_PATH "$ENV{VJ_BASE_DIR}" VRJUGGLER22_ROOT_DIR) +endif() + +# Default required components +if(NOT VRJuggler22_FIND_COMPONENTS) + set(VRJuggler22_FIND_COMPONENTS vrjogl22) +endif() + +if(VRJuggler22_FIND_QUIETLY) + set(_FIND_FLAGS "QUIET") +else() + set(_FIND_FLAGS "") +endif() + +set(VRJUGGLER22_SUBMODULES + VRJ22 + VRJOGL22 + Gadgeteer12 + JCCL12 + VPR20 + Sonix12 + Tweek12) +string(TOUPPER "${VRJUGGLER22_SUBMODULES}" VRJUGGLER22_SUBMODULES_UC) +string(TOUPPER + "${VRJuggler22_FIND_COMPONENTS}" + VRJUGGLER22_FIND_COMPONENTS_UC) + +# Turn a potentially messy components list into a nice one with versions. +set(VRJUGGLER22_REQUESTED_COMPONENTS) +foreach(VRJUGGLER22_LONG_NAME ${VRJUGGLER22_SUBMODULES_UC}) + # Look at requested components + foreach(VRJUGGLER22_REQUEST ${VRJUGGLER22_FIND_COMPONENTS_UC}) + string(REGEX + MATCH + "${VRJUGGLER22_REQUEST}" + VRJUGGLER22_MATCHING + "${VRJUGGLER22_LONG_NAME}") + if(VRJUGGLER22_MATCHING) + list(APPEND + VRJUGGLER22_REQUESTED_COMPONENTS + ${VRJUGGLER22_LONG_NAME}) + list(APPEND + VRJUGGLER22_COMPONENTS_FOUND + ${VRJUGGLER22_LONG_NAME}_FOUND) + endif() + endforeach() +endforeach() + +if(VRJUGGLER22_REQUESTED_COMPONENTS) + list(REMOVE_DUPLICATES VRJUGGLER22_REQUESTED_COMPONENTS) +endif() + +if(VRJUGGLER22_COMPONENTS_FOUND) + list(REMOVE_DUPLICATES VRJUGGLER22_COMPONENTS_FOUND) +endif() + +if(CMAKE_SIZEOF_VOID_P MATCHES "8") + set(_VRJ_LIBSUFFIXES lib64 lib) + set(_VRJ_LIBDSUFFIXES + debug + lib64/x86_64/debug + lib64/debug + lib64 + lib/x86_64/debug + lib/debug + lib) + set(_VRJ_LIBDSUFFIXES_ONLY + debug + lib64/x86_64/debug + lib64/debug + lib/x86_64/debug + lib/debug) +else() + set(_VRJ_LIBSUFFIXES lib) + set(_VRJ_LIBDSUFFIXES debug lib/i686/debug lib/debug lib) + set(_VRJ_LIBDSUFFIXES_ONLY debug lib/i686/debug lib/debug) +endif() + +if(NOT VRJuggler22_FIND_QUIETLY + AND NOT VRJUGGLER22_FOUND + AND NOT "${_VRJUGGLER22_SEARCH_COMPONENTS}" STREQUAL "${VRJUGGLER22_REQUESTED_COMPONENTS}") + message(STATUS + "Searching for these requested VR Juggler 2.2 components and their dependencies: ${VRJUGGLER22_REQUESTED_COMPONENTS}") +endif() + +# Find components +if("${VRJUGGLER22_REQUESTED_COMPONENTS}" MATCHES "VRJOGL22" AND NOT VRJOGL22_FOUND) + find_package(VRJOGL22 ${_FIND_FLAGS}) +endif() + +if("${VRJUGGLER22_REQUESTED_COMPONENTS}" MATCHES "VRJ22" AND NOT VRJ22_FOUND) + find_package(VRJ22 ${_FIND_FLAGS}) +endif() + +if("${VRJUGGLER22_REQUESTED_COMPONENTS}" MATCHES "JCCL12" AND NOT JCCL12_FOUND) + find_package(JCCL22 ${_FIND_FLAGS}) +endif() + +if("${VRJUGGLER22_REQUESTED_COMPONENTS}" MATCHES "GADGETEER12" AND NOT GADGETEER12_FOUND) + find_package(Gadgeteer12 ${_FIND_FLAGS}) +endif() + +if("${VRJUGGLER22_REQUESTED_COMPONENTS}" MATCHES "SONIX12" AND NOT SONIX12_FOUND) + find_package(Sonix12 ${_FIND_FLAGS}) +endif() + +if("${VRJUGGLER22_REQUESTED_COMPONENTS}" MATCHES "TWEEK12" AND NOT TWEEK12_FOUND) + find_package(Tweek12 ${_FIND_FLAGS}) +endif() + +if("${VRJUGGLER22_REQUESTED_COMPONENTS}" MATCHES "VPR20" AND NOT VPR20_FOUND) + find_package(VPR20 ${_FIND_FLAGS}) +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(VRJuggler22 + DEFAULT_MSG + ${VRJUGGLER22_COMPONENTS_FOUND}) + +if(VRJUGGLER22_FOUND) + foreach(VRJUGGLER22_REQUEST ${VRJUGGLER22_REQUESTED_COMPONENTS}) + list(APPEND VRJUGGLER22_LIBRARIES ${${VRJUGGLER22_REQUEST}_LIBRARIES}) + list(APPEND + VRJUGGLER22_INCLUDE_DIRS + ${${VRJUGGLER22_REQUEST}_INCLUDE_DIRS}) + endforeach() + + clean_library_list(VRJUGGLER22_LIBRARIES) + + clean_directory_list(VRJUGGLER22_INCLUDE_DIRS) + + set(_vjbase) + set(_vjbaseclean) + foreach(_lib + ${VPR20_LIBRARY} + ${VRJ22_LIBRARY} + ${VRJOGL22_LIBRARY} + ${JCCL12_LIBRARY} + ${GADGETEER12_LIBRARY}) + get_filename_component(_libpath "${_lib}" PATH) + get_filename_component(_abspath "${_libpath}/.." ABSOLUTE) + list(APPEND _vjbase "${_abspath}") + endforeach() + + clean_directory_list(_vjbase) + + set(_vrj22_have_base_dir NO) + list(LENGTH _vjbase _vjbaselen) + if("${_vjbaselen}" EQUAL 1 AND NOT VRJUGGLER22_VJ_BASE_DIR) + list(GET _vjbase 0 VRJUGGLER22_VJ_BASE_DIR) + mark_as_advanced(VRJUGGLER22_VJ_BASE_DIR) + if(NOT VRJUGGLER22_VJ_BASE_DIR STREQUAL _vrj22_base_dir) + unset(VRJUGGLER22_VJ_CFG_DIR) + endif() + set(_vrj22_have_base_dir YES) + else() + list(GET _vjbase 0 _calculated_base_dir) + if(NOT + "${_calculated_base_dir}" + STREQUAL + "${VRJUGGLER22_VJ_BASE_DIR}") + message("It looks like you might be mixing VR Juggler versions... ${_vjbaselen} ${_vjbase}") + message("If you are, fix your libraries then remove the VRJUGGLER22_VJ_BASE_DIR variable in CMake, then configure again") + message("If you aren't, set the VRJUGGLER22_VJ_BASE_DIR variable to the desired VJ_BASE_DIR to use when running") + else() + if(NOT VRJUGGLER22_VJ_BASE_DIR STREQUAL _vrj22_base_dir) + unset(VRJUGGLER22_VJ_CFG_DIR) + endif() + set(_vrj22_have_base_dir YES) + endif() + endif() + + set(_vrj22_base_dir "${VRJUGGLER22_VJ_BASE_DIR}") + set(_vrj22_base_dir "${_vrj22_base_dir}" CACHE INTERNAL "" FORCE) + + if(_vrj22_have_base_dir) + find_path(VRJUGGLER22_VJ_CFG_DIR + standalone.jconf + PATHS + ${VRJUGGLER22_VJ_BASE_DIR}/share/vrjuggler-2.2/data/configFiles + ${VRJUGGLER22_VJ_BASE_DIR}/share/vrjuggler/data/configFiles + NO_DEFAULT_PATH) + mark_as_advanced(VRJUGGLER22_VJ_CFG_DIR) + endif() + + set(VRJUGGLER22_VJ_BASE_DIR + "${VRJUGGLER22_VJ_BASE_DIR}" + CACHE + PATH + "Base directory to use as VJ_BASE_DIR when running your app." + FORCE) + set(VRJUGGLER22_ENVIRONMENT + "VJ_BASE_DIR=${VRJUGGLER22_VJ_BASE_DIR}" + "JCCL_BASE_DIR=${VRJUGGLER22_VJ_BASE_DIR}" + "SONIX_BASE_DIR=${VRJUGGLER22_VJ_BASE_DIR}" + "TWEEK_BASE_DIR=${VRJUGGLER22_VJ_BASE_DIR}" + "VJ_CFG_DIR=${VRJUGGLER22_VJ_CFG_DIR}") + + include(GetDirectoryList) + + get_directory_list(VRJUGGLER22_RUNTIME_LIBRARY_DIRS + ${VRJUGGLER22_LIBRARIES}) + if(WIN32) + foreach(dir ${VRJUGGLER22_RUNTIME_LIBRARY_DIRS}) + list(APPEND VRJUGGLER22_RUNTIME_LIBRARY_DIRS "${dir}/../bin") + endforeach() + endif() + + if(MSVC) + # Needed to make linking against boost work with 2.2.1 binaries - rp20091022 + # BOOST_ALL_DYN_LINK + set(VRJUGGLER22_DEFINITIONS + "-DBOOST_ALL_DYN_LINK" + "-DCPPDOM_DYN_LINK" + "-DCPPDOM_AUTO_LINK") + + # Disable these annoying warnings + # 4275: non dll-interface class used as base for dll-interface class + # 4251: needs to have dll-interface to be used by clients of class + # 4100: unused parameter + # 4512: assignment operator could not be generated + # 4127: (Not currently disabled) conditional expression in loop evaluates to constant + + set(VRJUGGLER22_CXX_FLAGS "/wd4275 /wd4251 /wd4100 /wd4512") + elseif(CMAKE_COMPILER_IS_GNUCXX) + # Silence annoying warnings about deprecated hash_map. + set(VRJUGGLER22_CXX_FLAGS "-Wno-deprecated") + + set(VRJUGGLER22_DEFINITIONS "") + endif() + set(VRJUGGLER22_CXX_FLAGS + "${VRJUGGLER22_CXX_FLAGS} ${CPPDOM_CXX_FLAGS}") + + set(_VRJUGGLER22_SEARCH_COMPONENTS + "${VRJUGGLER22_REQUESTED_COMPONENTS}" + CACHE + INTERNAL + "Requested components, used as a flag.") + + + + set(_plugin_dirs) + foreach(_libdir ${VRJUGGLER22_RUNTIME_LIBRARY_DIRS}) + # Find directories of Gadgeteer plugins and drivers + if(EXISTS "${_libdir}/gadgeteer") + list(APPEND + _plugin_dirs + "${_libdir}/gadgeteer/drivers" + "${_libdir}/gadgeteer/plugins") + elseif(EXISTS "${_libdir}/gadgeteer-1.2") + list(APPEND + _plugin_dirs + "${_libdir}/gadgeteer-1.2/drivers" + "${_libdir}/gadgeteer-1.2/plugins") + endif() + + # Find directories of Sonix plugins + if(EXISTS "${_libdir}/sonix") + list(APPEND _plugin_dirs "${_libdir}/sonix/plugins/dbg") + list(APPEND _plugin_dirs "${_libdir}/sonix/plugins/opt") + elseif(EXISTS "${_libdir}/sonix-1.2") + list(APPEND _plugin_dirs "${_libdir}/sonix-1.2/plugins/dbg") + list(APPEND _plugin_dirs "${_libdir}/sonix-1.2/plugins/opt") + endif() + endforeach() + + # Grab the actual plugins + foreach(_libdir ${_plugin_dirs}) + if(EXISTS "${_libdir}") + list(APPEND VRJUGGLER22_RUNTIME_LIBRARY_DIRS "${_libdir}") + file(GLOB _plugins "${_libdir}/*${CMAKE_SHARED_LIBRARY_SUFFIX}") + list(APPEND VRJUGGLER22_BUNDLE_PLUGINS ${_plugins}) + endif() + endforeach() + + mark_as_advanced(VRJUGGLER22_ROOT_DIR) +endif() + +mark_as_advanced(VRJUGGLER22_DEFINITIONS) + +function(install_vrjuggler22_data_files prefix) + set(base "${VRJUGGLER22_VJ_CFG_DIR}/..") + get_filename_component(base "${base}" ABSOLUTE) + file(RELATIVE_PATH reldest "${VRJUGGLER22_VJ_BASE_DIR}" "${base}") + if(prefix STREQUAL "" OR prefix STREQUAL "." OR prefix STREQUAL "./") + set(DEST "${reldest}") + else() + set(DEST "${prefix}/${reldest}") + endif() + + # configFiles *.jconf + file(GLOB + _vj_config_files + "${base}/configFiles/*.jconf") + install(FILES ${_vj_config_files} DESTINATION "${DEST}/configFiles/") + + # definitions *.jdef + file(GLOB + _vj_defs_files + "${base}/definitions/*.jdef") + install(FILES ${_vj_defs_files} DESTINATION "${DEST}/definitions/") + + # models *.flt + file(GLOB + _vj_model_files + "${base}/models/*.flt") + install(FILES ${_vj_model_files} DESTINATION "${DEST}/models/") + + # sounds *.wav + file(GLOB + _vj_sound_files + "${base}/sounds/*.wav") + install(FILES ${_vj_sound_files} DESTINATION "${DEST}/sounds/") + + # calibration.table - needed? + file(GLOB + _vj_config_files + "${base}/configFiles/*.jconf") + install(FILES "${base}/calibration.table" DESTINATION "${DEST}") +endfunction() + +function(install_vrjuggler22_plugins prefix varForFilenames) + set(DEST "${prefix}") + + set(out) + foreach(plugin ${VRJUGGLER22_BUNDLE_PLUGINS}) + get_filename_component(full "${plugin}" ABSOLUTE) + file(RELATIVE_PATH relloc "${VRJUGGLER22_VJ_BASE_DIR}" "${full}") + set(filedest "${DEST}/${relloc}") + get_filename_component(path "${filedest}" PATH) + list(APPEND out "${filedest}") + install(FILES "${full}" DESTINATION "${path}") + endforeach() + + set(${varForFilenames} ${out} PARENT_SCOPE) + +endfunction() + +function(get_vrjuggler_bundle_sources _target_sources) + if(APPLE) + set(_bundledir "${VRJUGGLER22_VJ_CFG_DIR}/../bundle") + get_filename_component(_bundledir "${_bundledir}" ABSOLUTE) + + set(_vj_base_dir .) + set(_vj_data_dir ${vj_base_dir}/share/vrjuggler-2.2) + + # Append Mac-specific sources to source list + set(_vj_bundle_src + ${_bundledir}/vrjuggler.icns + ${_bundledir}/vrjuggler.plist + ${_bundledir}/en.lproj/MainMenu.nib/classes.nib + ${_bundledir}/MainMenu.nib/info.nib + ${_bundledir}/MainMenu.nib/keyedobjects.nib) + + message(STATUS "vjbundlesrc: ${_vj_bundle_src}") + set(${_target_sources} + ${${_target_sources}} + ${_vj_bundle_src} + PARENT_SCOPE) + + # Set destination of nib files + set_source_files_properties(${_bundledir}/MainMenu.nib/classes.nib + ${_bundledir}/MainMenu.nib/info.nib + ${_bundledir}/MainMenu.nib/keyedobjects.nib + PROPERTIES + MACOSX_PACKAGE_LOCATION + Resources/en.lproj/MainMenu.nib/) + + # Set destination of Resources + set_source_files_properties(${_bundledir}/vrjuggler.icns + ${_bundledir}/vrjuggler.plist + PROPERTIES + MACOSX_PACKAGE_LOCATION + Resources/) + endif() +endfunction() + +get_filename_component(_vrjuggler22moddir + ${CMAKE_CURRENT_LIST_FILE} + PATH) +function(fixup_vrjuggler_app_bundle + _target + _targetInstallDest + _extralibs + _libdirs) + + if(NOT VRJUGGLER22_FOUND) + return() + endif() + + set(PACKAGE_DIR ${_vrjuggler22moddir}/package) + set(MACOSX_PACKAGE_DIR ${PACKAGE_DIR}/macosx) + + set(TARGET_LOCATION + "${_targetInstallDest}/${_target}${CMAKE_EXECUTABLE_SUFFIX}") + if(APPLE) + set(TARGET_LOCATION "${TARGET_LOCATION}.app") + endif() + + set_target_properties(${_target} + PROPERTIES + MACOSX_BUNDLE_INFO_PLIST + ${MACOSX_PACKAGE_DIR}/VRJuggler22BundleInfo.plist.in + MACOSX_BUNDLE_ICON_FILE + vrjuggler.icns + MACOSX_BUNDLE_INFO_STRING + "${PROJECT_NAME} (VR Juggler Application) version ${CPACK_PACKAGE_VERSION}, created by ${CPACK_PACKAGE_VENDOR}" + MACOSX_BUNDLE_GUI_IDENTIFIER + org.vrjuggler.${PROJECT_NAME} + MACOSX_BUNDLE_SHORT_VERSION_STRING + ${CPACK_PACKAGE_VERSION} + MACOSX_BUNDLE_BUNDLE_VERSION + ${CPACK_PACKAGE_VERSION}) + + if(WIN32) + list(APPEND _libdirs "${VRJUGGLER22_VJ_BASE_DIR}/bin") + endif() + + set(BUNDLE_LIBS ${_extralibs}) + set(BUNDLE_LIB_DIRS "${VRJUGGLER22_VJ_BASE_DIR}" ${_libdirs}) + + configure_file(${PACKAGE_DIR}/fixupbundle.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/${_target}-fixupbundle-juggler.cmake + @ONLY) + install(SCRIPT + "${CMAKE_CURRENT_BINARY_DIR}/${_target}-fixupbundle-juggler.cmake") +endfunction() diff --git a/lib/wiiuse/cmake/FindVRJuggler30.cmake b/lib/wiiuse/cmake/FindVRJuggler30.cmake new file mode 100644 index 000000000..4d28f015b --- /dev/null +++ b/lib/wiiuse/cmake/FindVRJuggler30.cmake @@ -0,0 +1,531 @@ +# - try to find VRJuggler 3.0-related packages (main finder) +# VRJUGGLER30_LIBRARY_DIRS, library search paths +# VRJUGGLER30_INCLUDE_DIRS, include search paths +# VRJUGGLER30_LIBRARIES, the libraries to link against +# VRJUGGLER30_ENVIRONMENT +# VRJUGGLER30_RUNTIME_LIBRARY_DIRS +# VRJUGGLER30_CXX_FLAGS +# VRJUGGLER30_DEFINITIONS +# VRJUGGLER30_FOUND, If false, do not try to use VR Juggler 3.0. +# +# Components available to search for (uses "VRJOGL30" by default): +# VRJOGL30 +# VRJ30 +# Gadgeteer20 +# JCCL14 +# VPR22 +# Sonix14 +# Tweek14 +# +# Additionally, a full setup requires these packages and their Find_.cmake scripts +# CPPDOM +# GMTL +# +# Optionally uses Flagpoll (and FindFlagpoll.cmake) +# +# Notes on components: +# - All components automatically include their dependencies. +# - You can search for the name above with or without the version suffix. +# - If you do not specify a component, VRJOGL30(the OpenGL view manager) +# will be used by default. +# - Capitalization of component names does not matter, but it's best to +# pretend it does and use the above capitalization. +# - Since this script calls find_package for your requested components and +# their dependencies, you can use any of the variables specified in those +# files in addition to the "summary" ones listed here, for more finely +# controlled building and linking. +# +# This CMake script requires all of the Find*.cmake scripts for the +# components listed above, as it is only a "meta-script" designed to make +# using those scripts more developer-friendly. +# +# Useful configuration variables you might want to add to your cache: +# (CAPS COMPONENT NAME)_ROOT_DIR - A directory prefix to search +# (a path that contains include/ as a subdirectory) +# +# The VJ_BASE_DIR environment variable is also searched (preferentially) +# when seeking any of the above components, as well as Flagpoll, CPPDOM, +# and Boost (from within VPR22), so most sane build environments should +# "just work." +# +# IMPORTANT: Note that you need to manually re-run CMake if you change +# this environment variable, because it cannot auto-detect this change +# and trigger an automatic re-run. +# +# Original Author: +# 2009-2011 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# Updated for VR Juggler 3.0 by: +# Brandon Newendorp and Ryan Pavlik +# +# Copyright Iowa State University 2009-2011. +# 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) + +include(CleanLibraryList) +include(CleanDirectoryList) +include(FindPackageMessage) + +set(VRJUGGLER30_ROOT_DIR + "${VRJUGGLER30_ROOT_DIR}" + CACHE + PATH + "Additional root directory to search for VR Juggler and its dependencies.") +if(NOT VRJUGGLER30_ROOT_DIR) + file(TO_CMAKE_PATH "$ENV{VJ_BASE_DIR}" VRJUGGLER30_ROOT_DIR) +endif() + +# Default required components +if(NOT VRJuggler30_FIND_COMPONENTS) + set(VRJuggler30_FIND_COMPONENTS vrjogl30) +endif() + +if(VRJuggler30_FIND_QUIETLY) + set(_FIND_FLAGS "QUIET") +else() + set(_FIND_FLAGS "") +endif() + +set(VRJUGGLER30_SUBMODULES + VRJ30 + VRJOGL30 + Gadgeteer20 + JCCL14 + VPR22 + Sonix14 + Tweek14) +string(TOUPPER "${VRJUGGLER30_SUBMODULES}" VRJUGGLER30_SUBMODULES_UC) +string(TOUPPER + "${VRJuggler30_FIND_COMPONENTS}" + VRJUGGLER30_FIND_COMPONENTS_UC) + +# Turn a potentially messy components list into a nice one with versions. +set(VRJUGGLER30_REQUESTED_COMPONENTS) +foreach(VRJUGGLER30_LONG_NAME ${VRJUGGLER30_SUBMODULES_UC}) + # Look at requested components + foreach(VRJUGGLER30_REQUEST ${VRJUGGLER30_FIND_COMPONENTS_UC}) + string(REGEX + MATCH + "${VRJUGGLER30_REQUEST}" + VRJUGGLER30_MATCHING + "${VRJUGGLER30_LONG_NAME}") + if(VRJUGGLER30_MATCHING) + list(APPEND + VRJUGGLER30_REQUESTED_COMPONENTS + ${VRJUGGLER30_LONG_NAME}) + list(APPEND + VRJUGGLER30_COMPONENTS_FOUND + ${VRJUGGLER30_LONG_NAME}_FOUND) + endif() + endforeach() +endforeach() + +if(VRJUGGLER30_REQUESTED_COMPONENTS) + list(REMOVE_DUPLICATES VRJUGGLER30_REQUESTED_COMPONENTS) +endif() + +if(VRJUGGLER30_COMPONENTS_FOUND) + list(REMOVE_DUPLICATES VRJUGGLER30_COMPONENTS_FOUND) +endif() + +if(CMAKE_SIZEOF_VOID_P MATCHES "8") + set(_VRJ_LIBSUFFIXES lib64 lib) + set(_VRJ_LIBDSUFFIXES + debug + lib64/x86_64/debug + lib64/debug + lib64 + lib/x86_64/debug + lib/debug + lib) + set(_VRJ_LIBDSUFFIXES_ONLY + debug + lib64/x86_64/debug + lib64/debug + lib/x86_64/debug + lib/debug) +else() + set(_VRJ_LIBSUFFIXES lib) + set(_VRJ_LIBDSUFFIXES debug lib/i686/debug lib/debug lib) + set(_VRJ_LIBDSUFFIXES_ONLY debug lib/i686/debug lib/debug) +endif() + +if(NOT VRJUGGLER30_FIND_QUIETLY + AND NOT VRJUGGLER30_FOUND + AND NOT "${_VRJUGGLER30_SEARCH_COMPONENTS}" STREQUAL "${VRJUGGLER30_REQUESTED_COMPONENTS}") + message(STATUS + "Searching for these requested VR Juggler 3.0 components and their dependencies: ${VRJUGGLER30_REQUESTED_COMPONENTS}") +endif() + +# Find components +if("${VRJUGGLER30_REQUESTED_COMPONENTS}" MATCHES "VRJOGL30" AND NOT VRJOGL30_FOUND) + find_package(VRJOGL30 ${_FIND_FLAGS}) +endif() + +if("${VRJUGGLER30_REQUESTED_COMPONENTS}" MATCHES "VRJ30" AND NOT VRJ30_FOUND) + find_package(VRJ30 ${_FIND_FLAGS}) +endif() + +if("${VRJUGGLER30_REQUESTED_COMPONENTS}" MATCHES "JCCL14" AND NOT JCCL14_FOUND) + find_package(JCCL14 ${_FIND_FLAGS}) +endif() + +if("${VRJUGGLER30_REQUESTED_COMPONENTS}" MATCHES "GADGETEER20" AND NOT GADGETEER20_FOUND) + find_package(Gadgeteer20 ${_FIND_FLAGS}) +endif() + +if("${VRJUGGLER30_REQUESTED_COMPONENTS}" MATCHES "SONIX14" AND NOT SONIX14_FOUND) + find_package(Sonix14 ${_FIND_FLAGS}) +endif() + +if("${VRJUGGLER30_REQUESTED_COMPONENTS}" MATCHES "TWEEK14" AND NOT TWEEK14_FOUND) + find_package(Tweek14 ${_FIND_FLAGS}) +endif() + +if("${VRJUGGLER30_REQUESTED_COMPONENTS}" MATCHES "VPR22" AND NOT VPR22_FOUND) + find_package(VPR22 ${_FIND_FLAGS}) +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(VRJuggler30 + DEFAULT_MSG + ${VRJUGGLER30_COMPONENTS_FOUND}) + +if(VRJUGGLER30_FOUND) + foreach(VRJUGGLER30_REQUEST ${VRJUGGLER30_REQUESTED_COMPONENTS}) + list(APPEND VRJUGGLER30_LIBRARIES ${${VRJUGGLER30_REQUEST}_LIBRARIES}) + list(APPEND + VRJUGGLER30_INCLUDE_DIRS + ${${VRJUGGLER30_REQUEST}_INCLUDE_DIRS}) + endforeach() + + clean_library_list(VRJUGGLER30_LIBRARIES) + + clean_directory_list(VRJUGGLER30_INCLUDE_DIRS) + + set(_vjbase) + set(_vjbaseclean) + foreach(_component VPR22 VRJ30 VRJOGL30 JCCL14 GADGETEER20) + + # Find the common parent directory of the include dir and the library dir + get_filename_component(_absincpath "${${_component}_INCLUDE_DIR}" PATH) + if(${_component}_INCLUDE_DIR) + get_filename_component(_curpath "${${_component}_LIBRARY_RELEASE}" PATH) + get_filename_component(_nextpath "${_curpath}/.." ABSOLUTE) + while(NOT _curpath STREQUAL _nextpath) + set(_curpath "${_nextpath}") + string(LENGTH "${_curpath}" _pathlen) + if("${_absincpath}" MATCHES "^${_curpath}.*") + list(APPEND _vjbase "${_curpath}") + break() + endif() + get_filename_component(_nextpath "${_curpath}/.." ABSOLUTE) + endwhile() + endif() + endforeach() + + clean_directory_list(_vjbase) + + set(_vrj30_have_base_dir NO) + list(LENGTH _vjbase _vjbaselen) + if("${_vjbaselen}" EQUAL 1 AND NOT VRJUGGLER30_VJ_BASE_DIR) + list(GET _vjbase 0 VRJUGGLER30_VJ_BASE_DIR) + mark_as_advanced(VRJUGGLER30_VJ_BASE_DIR) + if(NOT VRJUGGLER30_VJ_BASE_DIR STREQUAL _vrj30_base_dir) + unset(VRJUGGLER30_VJ_CFG_DIR) + endif() + set(_vrj30_have_base_dir YES) + else() + list(GET _vjbase 0 _calculated_base_dir) + if(NOT + "${_calculated_base_dir}" + STREQUAL + "${VRJUGGLER30_VJ_BASE_DIR}") + message("It looks like you might be mixing VR Juggler versions... ${_vjbaselen} ${_vjbase}") + message("If you are, fix your libraries then remove the VRJUGGLER30_VJ_BASE_DIR variable in CMake, then configure again") + message("If you aren't, set the VRJUGGLER30_VJ_BASE_DIR variable to the desired VJ_BASE_DIR to use when running") + else() + if(NOT VRJUGGLER30_VJ_BASE_DIR STREQUAL _vrj30_base_dir) + unset(VRJUGGLER30_VJ_CFG_DIR) + endif() + set(_vrj30_have_base_dir YES) + endif() + endif() + + set(_vrj30_base_dir "${VRJUGGLER30_VJ_BASE_DIR}") + set(_vrj30_base_dir "${_vrj30_base_dir}" CACHE INTERNAL "" FORCE) + + if(_vrj30_have_base_dir) + find_path(VRJUGGLER30_VJ_CFG_DIR + standalone.jconf + PATHS + ${VRJUGGLER30_VJ_BASE_DIR}/share/vrjuggler-3.0/data/configFiles + ${VRJUGGLER30_VJ_BASE_DIR}/share/vrjuggler/data/configFiles + NO_DEFAULT_PATH) + mark_as_advanced(VRJUGGLER30_VJ_CFG_DIR) + endif() + + set(VRJUGGLER30_VJ_BASE_DIR + "${VRJUGGLER30_VJ_BASE_DIR}" + CACHE + PATH + "Base directory to use as VJ_BASE_DIR when running your app." + FORCE) + set(VRJUGGLER30_ENVIRONMENT + "VJ_BASE_DIR=${VRJUGGLER30_VJ_BASE_DIR}" + "JCCL_BASE_DIR=${VRJUGGLER30_VJ_BASE_DIR}" + "SONIX_BASE_DIR=${VRJUGGLER30_VJ_BASE_DIR}" + "TWEEK_BASE_DIR=${VRJUGGLER30_VJ_BASE_DIR}" + "VJ_CFG_DIR=${VRJUGGLER30_VJ_CFG_DIR}") + + include(GetDirectoryList) + + get_directory_list(VRJUGGLER30_RUNTIME_LIBRARY_DIRS + ${VRJUGGLER30_LIBRARIES}) + if(WIN32) + foreach(dir ${VRJUGGLER30_RUNTIME_LIBRARY_DIRS}) + list(APPEND VRJUGGLER30_RUNTIME_LIBRARY_DIRS "${dir}/../bin") + endforeach() + endif() + + if(MSVC) + # BOOST_ALL_DYN_LINK + set(VRJUGGLER30_DEFINITIONS + "-DBOOST_ALL_DYN_LINK" + "-DCPPDOM_DYN_LINK" + "-DCPPDOM_AUTO_LINK") + + # Disable these annoying warnings + # 4275: non dll-interface class used as base for dll-interface class + # 4251: needs to have dll-interface to be used by clients of class + # 4100: unused parameter + # 4512: assignment operator could not be generated + # 4127: (Not currently disabled) conditional expression in loop evaluates to constant + + set(VRJUGGLER30_CXX_FLAGS "/wd4275 /wd4251 /wd4100 /wd4512") + elseif(CMAKE_COMPILER_IS_GNUCXX) + # Silence annoying warnings about deprecated hash_map. + set(VRJUGGLER30_CXX_FLAGS "-Wno-deprecated") + + set(VRJUGGLER30_DEFINITIONS "") + endif() + set(VRJUGGLER30_CXX_FLAGS + "${VRJUGGLER30_CXX_FLAGS} ${CPPDOM_CXX_FLAGS}") + + set(_VRJUGGLER30_SEARCH_COMPONENTS + "${VRJUGGLER30_REQUESTED_COMPONENTS}" + CACHE + INTERNAL + "Requested components, used as a flag.") + + + + set(_plugin_dirs) + foreach(_libdir ${VRJUGGLER30_RUNTIME_LIBRARY_DIRS}) + # Find directories of Gadgeteer plugins and drivers + if(EXISTS "${_libdir}/gadgeteer") + list(APPEND + _plugin_dirs + "${_libdir}/gadgeteer/drivers" + "${_libdir}/gadgeteer/plugins") + elseif(EXISTS "${_libdir}/gadgeteer-1.4") + list(APPEND + _plugin_dirs + "${_libdir}/gadgeteer-1.4/drivers" + "${_libdir}/gadgeteer-1.4/plugins") + endif() + + # Find directories of Sonix plugins + if(EXISTS "${_libdir}/sonix") + list(APPEND _plugin_dirs "${_libdir}/sonix/plugins/dbg") + list(APPEND _plugin_dirs "${_libdir}/sonix/plugins/opt") + elseif(EXISTS "${_libdir}/sonix-1.4") + list(APPEND _plugin_dirs "${_libdir}/sonix-1.4/plugins/dbg") + list(APPEND _plugin_dirs "${_libdir}/sonix-1.4/plugins/opt") + endif() + + # Find directories of JCCL plugins + if(EXISTS "${_libdir}/jccl/plugins") + list(APPEND _plugin_dirs "${_libdir}/jccl/plugins") + elseif(EXISTS "${_libdir}/jccl-1.4/plugins") + list(APPEND _plugin_dirs "${_libdir}/jccl-1.4/plugins") + endif() + + # Find directories of VR Juggler plugins + if(EXISTS "${_libdir}/vrjuggler/plugins") + list(APPEND _plugin_dirs "${_libdir}/vrjuggler/plugins") + elseif(EXISTS "${_libdir}/vrjuggler-3.0/plugins") + list(APPEND _plugin_dirs "${_libdir}/vrjuggler-3.0/plugins") + endif() + endforeach() + + # Grab the actual plugins + foreach(_libdir ${_plugin_dirs}) + if(EXISTS "${_libdir}") + list(APPEND VRJUGGLER30_RUNTIME_LIBRARY_DIRS "${_libdir}") + file(GLOB _plugins "${_libdir}/*${CMAKE_SHARED_LIBRARY_SUFFIX}") + foreach(_plugin ${_plugins}) + if("${_plugin}" MATCHES "_d${CMAKE_SHARED_LIBRARY_SUFFIX}") + list(APPEND VRJUGGLER30_BUNDLE_PLUGINS_DEBUG ${_plugin}) + else() + list(APPEND VRJUGGLER30_BUNDLE_PLUGINS ${_plugin}) + endif() + endforeach() + endif() + endforeach() + + mark_as_advanced(VRJUGGLER30_ROOT_DIR) +endif() + +mark_as_advanced(VRJUGGLER30_DEFINITIONS) + +function(install_vrjuggler30_data_files prefix) + set(base "${VRJUGGLER30_VJ_CFG_DIR}/..") + get_filename_component(base "${base}" ABSOLUTE) + file(RELATIVE_PATH reldest "${VRJUGGLER30_VJ_BASE_DIR}" "${base}") + if(prefix STREQUAL "" OR prefix STREQUAL "." OR prefix STREQUAL "./") + set(DEST "${reldest}") + else() + set(DEST "${prefix}/${reldest}") + endif() + + # configFiles *.jconf + file(GLOB + _vj_config_files + "${base}/configFiles/*.jconf") + install(FILES ${_vj_config_files} DESTINATION "${DEST}/configFiles/") + + # definitions *.jdef + file(GLOB + _vj_defs_files + "${base}/definitions/*.jdef") + install(FILES ${_vj_defs_files} DESTINATION "${DEST}/definitions/") + + # models *.flt + file(GLOB + _vj_model_files + "${base}/models/*.flt") + install(FILES ${_vj_model_files} DESTINATION "${DEST}/models/") + + # sounds *.wav + file(GLOB + _vj_sound_files + "${base}/sounds/*.wav") + install(FILES ${_vj_sound_files} DESTINATION "${DEST}/sounds/") +endfunction() + +macro(_vrjuggler30_plugin_install _VAR) + foreach(plugin ${${_VAR}}) + get_filename_component(full "${plugin}" ABSOLUTE) + file(RELATIVE_PATH relloc "${VRJUGGLER30_VJ_BASE_DIR}" "${full}") + set(filedest "${DEST}/${relloc}") + get_filename_component(path "${filedest}" PATH) + list(APPEND out "${filedest}") + install(FILES "${full}" DESTINATION "${path}" ${ARGN}) + endforeach() +endmacro() + +function(install_vrjuggler30_plugins prefix varForFilenames) + set(DEST "${prefix}") + + set(out) + _vrjuggler30_plugin_install(VRJUGGLER30_BUNDLE_PLUGINS) + _vrjuggler30_plugin_install(VRJUGGLER30_BUNDLE_PLUGINS_DEBUG CONFIGURATIONS DEBUG) + set(${varForFilenames} ${out} PARENT_SCOPE) + +endfunction() + +function(get_vrjuggler_bundle_sources _target_sources) + if(APPLE) + set(_bundledir "${VRJUGGLER30_VJ_CFG_DIR}/../bundle") + get_filename_component(_bundledir "${_bundledir}" ABSOLUTE) + + set(_vj_base_dir .) + set(_vj_data_dir ${vj_base_dir}/share/vrjuggler-3.0) + + # Append Mac-specific sources to source list + set(_vj_bundle_src + ${_bundledir}/vrjuggler.icns + ${_bundledir}/vrjuggler.plist + ${_bundledir}/en.lproj/MainMenu.nib/classes.nib + ${_bundledir}/MainMenu.nib/info.nib + ${_bundledir}/MainMenu.nib/keyedobjects.nib) + + message(STATUS "vjbundlesrc: ${_vj_bundle_src}") + set(${_target_sources} + ${${_target_sources}} + ${_vj_bundle_src} + PARENT_SCOPE) + + # Set destination of nib files + set_source_files_properties(${_bundledir}/MainMenu.nib/classes.nib + ${_bundledir}/MainMenu.nib/info.nib + ${_bundledir}/MainMenu.nib/keyedobjects.nib + PROPERTIES + MACOSX_PACKAGE_LOCATION + Resources/en.lproj/MainMenu.nib/) + + # Set destination of Resources + set_source_files_properties(${_bundledir}/vrjuggler.icns + ${_bundledir}/vrjuggler.plist + PROPERTIES + MACOSX_PACKAGE_LOCATION + Resources/) + endif() +endfunction() + +get_filename_component(_vrjuggler30moddir + ${CMAKE_CURRENT_LIST_FILE} + PATH) +function(fixup_vrjuggler_app_bundle + _target + _targetInstallDest + _extralibs + _libdirs) + + if(NOT VRJUGGLER30_FOUND) + return() + endif() + + + set(PACKAGE_DIR ${_vrjuggler30moddir}/package) + set(MACOSX_PACKAGE_DIR ${PACKAGE_DIR}/macosx) + + set(TARGET_LOCATION + "${_targetInstallDest}/${_target}${CMAKE_EXECUTABLE_SUFFIX}") + if(APPLE) + set(TARGET_LOCATION "${TARGET_LOCATION}.app") + endif() + + set_target_properties(${_target} + PROPERTIES + MACOSX_BUNDLE_INFO_PLIST + ${MACOSX_PACKAGE_DIR}/VRJuggler30BundleInfo.plist.in + MACOSX_BUNDLE_ICON_FILE + vrjuggler.icns + MACOSX_BUNDLE_INFO_STRING + "${PROJECT_NAME} (VR Juggler Application) version ${CPACK_PACKAGE_VERSION}, created by ${CPACK_PACKAGE_VENDOR}" + MACOSX_BUNDLE_GUI_IDENTIFIER + org.vrjuggler.${PROJECT_NAME} + MACOSX_BUNDLE_SHORT_VERSION_STRING + ${CPACK_PACKAGE_VERSION} + MACOSX_BUNDLE_BUNDLE_VERSION + ${CPACK_PACKAGE_VERSION}) + + if(WIN32) + list(APPEND _libdirs "${VRJUGGLER30_VJ_BASE_DIR}/bin") + endif() + + set(BUNDLE_LIBS ${_extralibs}) + set(BUNDLE_LIB_DIRS "${VRJUGGLER30_VJ_BASE_DIR}" ${_libdirs}) + + configure_file(${PACKAGE_DIR}/fixupbundle.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/${_target}-fixupbundle-juggler.cmake + @ONLY) + install(SCRIPT + "${CMAKE_CURRENT_BINARY_DIR}/${_target}-fixupbundle-juggler.cmake") +endfunction() diff --git a/lib/wiiuse/cmake/FindVRPN.cmake b/lib/wiiuse/cmake/FindVRPN.cmake new file mode 100644 index 000000000..641b62b70 --- /dev/null +++ b/lib/wiiuse/cmake/FindVRPN.cmake @@ -0,0 +1,156 @@ +# - try to find VRPN library +# +# Cache Variables: +# VRPN_LIBRARY +# VRPN_SERVER_LIBRARY +# VRPN_INCLUDE_DIR +# +# Non-cache variables you might use in your CMakeLists.txt: +# VRPN_FOUND +# VRPN_SERVER_LIBRARIES - server libraries +# VRPN_LIBRARIES - client libraries +# VRPN_CLIENT_DEFINITIONS - definitions if you only use the client library +# VRPN_DEFINITIONS - Client-only definition if all we found was the client library. +# VRPN_INCLUDE_DIRS +# +# VRPN_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 +# 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(VRPN_ROOT_DIR + "${VRPN_ROOT_DIR}" + CACHE + PATH + "Root directory to search for VRPN") + +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() + +set(_vrpn_quiet) +if(VRPN_FIND_QUIETLY) + set(_vrpn_quiet QUIET) +endif() + +### +# Configure VRPN +### + +find_path(VRPN_INCLUDE_DIR + NAMES + vrpn_Connection.h + PATH_SUFFIXES + include + include/vrpn + HINTS + "${VRPN_ROOT_DIR}" + PATHS + "${_progfiles}/VRPN" + C:/usr/local + /usr/local) + +find_library(VRPN_LIBRARY + NAMES + vrpn + PATH_SUFFIXES + ${_libsuffixes} + HINTS + "${VRPN_ROOT_DIR}" + PATHS + "${_progfiles}/VRPN" + C:/usr/local + /usr/local) + +find_library(VRPN_SERVER_LIBRARY + NAMES + vrpnserver + PATH_SUFFIXES + ${_libsuffixes} + HINTS + "${VRPN_ROOT_DIR}" + PATHS + "${_progfiles}/VRPN" + C:/usr/local + /usr/local) + +### +# Dependencies +### +set(_deps_libs) +set(_deps_includes) +set(_deps_check) + +find_package(quatlib ${_vrpn_quiet}) +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 ${_vrpn_quiet}) + list(APPEND _deps_libs ${CMAKE_THREAD_LIBS_INIT}) + list(APPEND _deps_check CMAKE_HAVE_THREADS_LIBRARY) +endif() + +if(WIN32) + find_package(Libusb1 QUIET) + if(LIBUSB1_FOUND) + list(APPEND _deps_libs ${LIBUSB1_LIBRARIES}) + list(APPEND _deps_includes ${LIBUSB1_INCLUDE_DIRS}) + endif() +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(VRPN + DEFAULT_MSG + VRPN_LIBRARY + VRPN_INCLUDE_DIR + ${_deps_check}) + +if(VRPN_FOUND) + set(VRPN_INCLUDE_DIRS "${VRPN_INCLUDE_DIR}" ${_deps_includes}) + set(VRPN_LIBRARIES "${VRPN_LIBRARY}" ${_deps_libs}) + set(VRPN_SERVER_LIBRARIES "${VRPN_SERVER_LIBRARY}" ${_deps_libs}) + + if(VRPN_LIBRARY) + set(VRPN_CLIENT_DEFINITIONS -DVRPN_CLIENT_ONLY) + else() + unset(VRPN_CLIENT_DEFINITIONS) + endif() + + if(VRPN_LIBRARY AND NOT VRPN_SERVER_LIBRARY) + set(VRPN_DEFINITIONS -DVRPN_CLIENT_ONLY) + else() + unset(VRPN_DEFINITIONS) + endif() + + mark_as_advanced(VRPN_ROOT_DIR) +endif() + +mark_as_advanced(VRPN_LIBRARY VRPN_SERVER_LIBRARY VRPN_INCLUDE_DIR) diff --git a/lib/wiiuse/cmake/FindViewPoint.cmake b/lib/wiiuse/cmake/FindViewPoint.cmake new file mode 100644 index 000000000..a18b6145d --- /dev/null +++ b/lib/wiiuse/cmake/FindViewPoint.cmake @@ -0,0 +1,94 @@ +# - try to find Arrington Research ViewPoint EyeTracker SDK +# +# Cache Variables: (probably not for direct use in your scripts) +# VIEWPOINT_INCLUDE_DIR +# VIEWPOINT_LIBRARY +# VIEWPOINT_RUNTIME_LIBRARY +# +# Non-cache variables you might use in your CMakeLists.txt: +# VIEWPOINT_FOUND +# VIEWPOINT_INCLUDE_DIRS +# VIEWPOINT_LIBRARIES +# VIEWPOINT_RUNTIME_LIBRARIES - aka the dll for installing +# VIEWPOINT_RUNTIME_LIBRARY_DIRS +# +# Requires these CMake modules: +# FindPackageHandleStandardArgs (known included with CMake >=2.6.2) +# +# Original Author: +# 2012 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 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(VIEWPOINT_ROOT_DIR + "${VIEWPOINT_ROOT_DIR}" + CACHE + PATH + "Directory to search for Arrington Research ViewPoint EyeTracker SDK") + +if(CMAKE_SIZEOF_VOID_P MATCHES "8") + set(_LIBSUFFIXES /lib64 /lib) +else() + set(_LIBSUFFIXES /lib) +endif() + +find_library(VIEWPOINT_LIBRARY + NAMES + VPX_InterApp + PATHS + "${VIEWPOINT_ROOT_DIR}" + PATH_SUFFIXES + "${_LIBSUFFIXES}") + +get_filename_component(_libdir "${VIEWPOINT_LIBRARY}" PATH) + +find_path(VIEWPOINT_INCLUDE_DIR + NAMES + vpx.h + HINTS + "${_libdir}" + PATHS + "${VIEWPOINT_ROOT_DIR}" + PATH_SUFFIXES + include/) + +set(_deps_check) +if(WIN32) + find_file(VIEWPOINT_RUNTIME_LIBRARY + NAMES + VPX_InterApp.dll + HINTS + "${_libdir}") + + set(VIEWPOINT_RUNTIME_LIBRARIES "${VIEWPOINT_RUNTIME_LIBRARY}") + get_filename_component(VIEWPOINT_RUNTIME_LIBRARY_DIRS + "${VIEWPOINT_RUNTIME_LIBRARY}" + PATH) + list(APPEND _deps_check VIEWPOINT_RUNTIME_LIBRARY) +else() + get_filename_component(VIEWPOINT_RUNTIME_LIBRARY_DIRS + "${VIEWPOINT_LIBRARY}" + PATH) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(ViewPoint + DEFAULT_MSG + VIEWPOINT_LIBRARY + VIEWPOINT_INCLUDE_DIR + ${_deps_check}) + +if(VIEWPOINT_FOUND) + set(VIEWPOINT_LIBRARIES "${VIEWPOINT_LIBRARY}") + set(VIEWPOINT_INCLUDE_DIRS "${VIEWPOINT_INCLUDE_DIR}") + mark_as_advanced(VIEWPOINT_ROOT_DIR) +endif() + +mark_as_advanced(VIEWPOINT_INCLUDE_DIR + VIEWPOINT_LIBRARY + VIEWPOINT_RUNTIME_LIBRARY) diff --git a/lib/wiiuse/cmake/FindVirtuoseAPI.cmake b/lib/wiiuse/cmake/FindVirtuoseAPI.cmake new file mode 100644 index 000000000..639d00dd4 --- /dev/null +++ b/lib/wiiuse/cmake/FindVirtuoseAPI.cmake @@ -0,0 +1,93 @@ +# - try to find Haption VirtuoseAPI library and include files +# +# VIRTUOSEAPI_INCLUDE_DIRS, where to find headers +# VIRTUOSEAPI_LIBRARIES, the libraries to link against +# VIRTUOSEAPI_FOUND, If false, do not try to use this library +# VIRTUOSEAPI_RUNTIME_LIBRARY_DIRS, path to DLL/SO for runtime use. +# VIRTUOSEAPI_RUNTIME_LIBRARIES, runtime libraries you might want to install + +set(VIRTUOSEAPI_ROOT_DIR + "${VIRTUOSEAPI_ROOT_DIR}" + CACHE + PATH + "Path to search for VirtuoseAPI") + +set(_dirs) +if(WIN32) + include(ProgramFilesGlob) + program_files_fallback_glob(_dirs "/VirtuoseAPI_v*/") +endif() + +find_path(VIRTUOSEAPI_INCLUDE_DIR + virtuoseAPI.h + VirtuoseAPI.h + PATHS + ${_dirs} + HINTS + "${VIRTUOSEAPI_ROOT_DIR}") + +set(_suffixes) +if(WIN32) + set(_lib_name virtuoseDLL) + set(_runtime_name virtuoseAPI.dll) + + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(_suffixes win64) + else() + set(_suffixes win32) + endif() +elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") + set(_lib_name virtuose) + set(_runtime_name virtuoseAPI.so) + + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(_suffixes linux-64b) + else() + set(_suffixes linux linux-2.6) + endif() +endif() + +if(_suffixes) + find_library(VIRTUOSEAPI_LIBRARY + NAMES + ${_lib_name} + PATHS + ${_dirs} + HINTS + "${VIRTUOSEAPI_ROOT_DIR}" + PATH_SUFFIXES + ${_suffixes}) + find_file(VIRTUOSEAPI_RUNTIME_LIBRARY + NAMES + ${_runtime_name} + PATHS + ${_dirs} + HINTS + "${VIRTUOSEAPI_ROOT_DIR}" + PATH_SUFFIXES + ${_suffixes}) +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(VirtuoseAPI + DEFAULT_MSG + VIRTUOSEAPI_LIBRARY + VIRTUOSEAPI_RUNTIME_LIBRARY + VIRTUOSEAPI_INCLUDE_DIR) + +if(VIRTUOSEAPI_FOUND) + set(VIRTUOSEAPI_LIBRARIES "${VIRTUOSEAPI_LIBRARY}") + set(VIRTUOSEAPI_RUNTIME_LIBRARIES "${VIRTUOSEAPI_RUNTIME_LIBRARY}") + set(VIRTUOSEAPI_INCLUDE_DIRS "${VIRTUOSEAPI_INCLUDE_DIR}") + get_filename_component(VIRTUOSEAPI_RUNTIME_LIBRARY_DIRS + "${VIRTUOSEAPI_RUNTIME_LIBRARY}" + PATH) + + mark_as_advanced(VIRTUOSEAPI_ROOT_DIR) +endif() + +mark_as_advanced(VIRTUOSEAPI_LIBRARY + VIRTUOSEAPI_RUNTIME_LIBRARY + VIRTUOSEAPI_INCLUDE_DIR) diff --git a/lib/wiiuse/cmake/FindVirtuoseVPP.cmake b/lib/wiiuse/cmake/FindVirtuoseVPP.cmake new file mode 100644 index 000000000..0cd45fc1e --- /dev/null +++ b/lib/wiiuse/cmake/FindVirtuoseVPP.cmake @@ -0,0 +1,49 @@ +# - try to find Haption VirtuoseAPI C++ wrapper include files +# +# Use of this header depends on the VirtuoseAPI, so we search for that too. +# +# VIRTUOSEVPP_INCLUDE_DIRS, where to find headers +# VIRTUOSEVPP_LIBRARIES, the libraries to link against +# VIRTUOSEVPP_FOUND, If false, do not try to use this library +# VIRTUOSEVPP_RUNTIME_LIBRARY_DIRS, path to DLL/SO for runtime use. +# VIRTUOSEAPI_RUNTIME_LIBRARIES, runtime libraries you might want to install + +set(VIRTUOSEVPP_ROOT_DIR + "${VIRTUOSEVPP_ROOT_DIR}" + CACHE + PATH + "Path to search for VirtuoseAPI VPP wrapper") + +find_package(VirtuoseAPI) + +find_path(VIRTUOSEVPP_INCLUDE_DIR + vpp.h + PATHS + ${_dirs} + HINTS + "${VIRTUOSEVPP_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(VirtuoseVPP + DEFAULT_MSG + VIRTUOSEVPP_INCLUDE_DIR + VIRTUOSEAPI_LIBRARY + VIRTUOSEAPI_RUNTIME_LIBRARIES + VIRTUOSEAPI_RUNTIME_LIBRARY_DIRS + VIRTUOSEAPI_INCLUDE_DIR) + +if(VIRTUOSEVPP_FOUND) + set(VIRTUOSEVPP_LIBRARIES "${VIRTUOSEAPI_LIBRARY}") + set(VIRTUOSEVPP_INCLUDE_DIRS + "${VIRTUOSEAPI_INCLUDE_DIR}" + "${VIRTUOSEVPP_INCLUDE_DIR}") + set(VIRTUOSEVPP_RUNTIME_LIBRARIES "${VIRTUOSEAPI_RUNTIME_LIBRARIES}") + set(VIRTUOSEVPP_RUNTIME_LIBRARY_DIRS + "${VIRTUOSEAPI_RUNTIME_LIBRARY_DIRS}") + + mark_as_advanced(VIRTUOSEVPP_ROOT_DIR) +endif() + +mark_as_advanced(VIRTUOSEVPP_INCLUDE_DIR) diff --git a/lib/wiiuse/cmake/FindWayland.cmake b/lib/wiiuse/cmake/FindWayland.cmake new file mode 100644 index 000000000..80aff5d3a --- /dev/null +++ b/lib/wiiuse/cmake/FindWayland.cmake @@ -0,0 +1,45 @@ +# - Try to Find Wayland +# +# Copyright 2015 Vlad Zagorodniy +# 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) +# +# Will be defined: +# WAYLAND_FOUND +# WAYLAND_CLIENT_FOUND +# WAYLAND_SERVER_FOUND +# WAYLAND_CLIENT_INCLUDE_DIR +# WAYLAND_SERVER_INCLUDE_DIR +# WAYLAND_CLIENT_LIBRARIES +# WAYLAND_SERVER_LIBRARIES +# + +find_package(PkgConfig) +pkg_check_modules(PKG_WAYLAND_CLIENT REQUIRED wayland-client) +pkg_check_modules(PKG_WAYLAND_SERVER REQUIRED wayland-server) + +if (NOT PKG_WAYLAND_CLIENT_FOUND) + message(FATAL_ERROR "No wayland-client") +endif(NOT PKG_WAYLAND_CLIENT_FOUND) + +if (NOT PKG_WAYLAND_SERVER_FOUND) + message(FATAL_ERROR "No wayland-server") +endif(NOT PKG_WAYLAND_SERVER_FOUND) + +# find include paths +find_path(WAYLAND_CLIENT_INCLUDE_DIR wayland-client.h ${PKG_WAYLAND_CLIENT_INCLUDE_DIRS}) +find_path(WAYLAND_SERVER_INCLUDE_DIR wayland-server.h ${PKG_WAYLAND_SERVER_INCLUDE_DIRS}) + +# find libs +find_library(WAYLAND_CLIENT_LIBRARIES NAMES wayland-client PATHS ${PKG_WAYLAND_CLIENT_LIBRARY_DIRS}) +find_library(WAYLAND_SERVER_LIBRARIES NAMES wayland-server PATHS ${PKG_WAYLAND_SERVER_LIBRARY_DIRS}) + +# set _FOUND vars +set(WAYLAND_CLIENT_FOUND TRUE) +set(WAYLAND_SERVER_FOUND TRUE) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(WAYLAND DEFAULT_MSG WAYLAND_CLIENT_INCLUDE_DIR WAYLAND_CLIENT_LIBRARIES + WAYLAND_SERVER_INCLUDE_DIR WAYLAND_SERVER_LIBRARIES) +mark_as_advanced(WAYLAND_CLIENT_INCLUDE_DIR WAYLAND_CLIENT_LIBRARIES + WAYLAND_SERVER_INCLUDE_DIR WAYLAND_SERVER_LIBRARIES) diff --git a/lib/wiiuse/cmake/FindWiiSCAAT.cmake b/lib/wiiuse/cmake/FindWiiSCAAT.cmake new file mode 100644 index 000000000..0b0dd1638 --- /dev/null +++ b/lib/wiiuse/cmake/FindWiiSCAAT.cmake @@ -0,0 +1,79 @@ +# - try to find the Wii SCAAT library +# +# Users may optionally supply: +# WIISCAAT_ROOT_DIR - a prefix to start searching for the headers. +# +# Cache Variables: (probably not for direct use in your scripts) +# WIISCAAT_INCLUDE_DIR +# WIISCAAT_LIBRARY +# +# Non-cache variables you might use in your CMakeLists.txt: +# WIISCAAT_FOUND +# WIISCAAT_INCLUDE_DIRS +# WIISCAAT_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) + +set(WIISCAAT_ROOT_DIR + "${WIISCAAT_ROOT_DIR}" + CACHE + PATH + "Path to search for Wii SCAAT module") + +### +# Prereq: tag +### +if(NOT TOONTAG_ROOT_DIR) + set(TOONTAG_ROOT_DIR "${WIISCAAT_ROOT_DIR}") +endif() +find_package(TooNtag QUIET) + +### +# Configure tag +### +find_path(WIISCAAT_INCLUDE_DIR + NAMES + HeadCollection.h + HINTS + "${WIISCAAT_ROOT_DIR}" + PATH_SUFFIXES + include) +mark_as_advanced(WIISCAAT_INCLUDE_DIR) + +find_library(WIISCAAT_LIBRARY + NAMES + wiiscaattracker + HINTS + "${WIISCAAT_ROOT_DIR}" + PATH_SUFFIXES + lib + lib64) +mark_as_advanced(WIISCAAT_LIBRARY) + +# 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(WiiSCAAT + DEFAULT_MSG + WIISCAAT_LIBRARY + WIISCAAT_INCLUDE_DIR + TOONTAG_FOUND) + +if(WIISCAAT_FOUND) + set(WIISCAAT_INCLUDE_DIRS + "${WIISCAAT_INCLUDE_DIR}" + ${TOONTAG_INCLUDE_DIRS}) + set(WIISCAAT_LIBRARIES "${WIISCAAT_LIBRARY}" ${TOONTAG_LIBRARIES}) + mark_as_advanced(WIISCAAT_ROOT_DIR) +endif() diff --git a/lib/wiiuse/cmake/FindWiiUse.cmake b/lib/wiiuse/cmake/FindWiiUse.cmake new file mode 100644 index 000000000..2657cbb60 --- /dev/null +++ b/lib/wiiuse/cmake/FindWiiUse.cmake @@ -0,0 +1,99 @@ +# - try to find WiiUse library +# +# Cache Variables: (probably not for direct use in your scripts) +# WIIUSE_INCLUDE_DIR +# WIIUSE_LIBRARY +# +# Non-cache variables you might use in your CMakeLists.txt: +# WIIUSE_FOUND +# WIIUSE_INCLUDE_DIRS +# WIIUSE_LIBRARIES +# WIIUSE_RUNTIME_LIBRARIES - aka the dll for installing +# WIIUSE_RUNTIME_LIBRARY_DIRS +# +# 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) + +set(WIIUSE_ROOT_DIR + "${WIIUSE_ROOT_DIR}" + CACHE + PATH + "Directory to search for WiiUse") + +if(CMAKE_SIZEOF_VOID_P MATCHES "8") + set(_LIBSUFFIXES /lib64 /lib) +else() + set(_LIBSUFFIXES /lib) +endif() + +find_library(WIIUSE_LIBRARY + NAMES + wiiuse + PATHS + "${WIIUSE_ROOT_DIR}" + PATH_SUFFIXES + "${_LIBSUFFIXES}") + +get_filename_component(_libdir "${WIIUSE_LIBRARY}" PATH) + +find_path(WIIUSE_INCLUDE_DIR + NAMES + wiiuse.h + HINTS + "${_libdir}" + "${_libdir}/.." + PATHS + "${WIIUSE_ROOT_DIR}" + PATH_SUFFIXES + include/) + +set(_deps_check) +if(WIN32) + 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}" + PATH) + list(APPEND _deps_check WIIUSE_RUNTIME_LIBRARY) +else() + set(WIIUSE_RUNTIME_LIBRARY "${WIIUSE_LIBRARY}") + set(WIIUSE_RUNTIME_LIBRARIES "${WIIUSE_RUNTIME_LIBRARY}") + get_filename_component(WIIUSE_RUNTIME_LIBRARY_DIRS + "${WIIUSE_LIBRARY}" + PATH) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(WiiUse + DEFAULT_MSG + WIIUSE_LIBRARY + WIIUSE_INCLUDE_DIR + ${_deps_check}) + +if(WIIUSE_FOUND) + set(WIIUSE_LIBRARIES "${WIIUSE_LIBRARY}") + set(WIIUSE_INCLUDE_DIRS "${WIIUSE_INCLUDE_DIR}") + mark_as_advanced(WIIUSE_ROOT_DIR) +endif() + +mark_as_advanced(WIIUSE_INCLUDE_DIR + WIIUSE_LIBRARY + WIIUSE_RUNTIME_LIBRARY) diff --git a/lib/wiiuse/cmake/FindWinHID.cmake b/lib/wiiuse/cmake/FindWinHID.cmake new file mode 100644 index 000000000..7dd057214 --- /dev/null +++ b/lib/wiiuse/cmake/FindWinHID.cmake @@ -0,0 +1,288 @@ +# - 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 +# MinGWSearchPathExtras +# FindWindowsSDK +# +# 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(MSVC) + if( (NOT WINHID_ROOT_DIR) AND (NOT ENV{DDKROOT} STREQUAL "") ) + set(WINHID_ROOT_DIR "$ENV{DDKROOT}") + endif() +endif() + +set(WINHID_ROOT_DIR + "${WINHID_ROOT_DIR}" + CACHE + PATH + "Directory to search") + +set(_deps_check) +set(_need_crt_dir) +if(MSVC) + + find_package(WindowsSDK) + set(WINSDK_LIBDIRS) + if(WINDOWSSDK_FOUND) + get_windowssdk_library_dirs_multiple(WINSDK_LIBDIRS ${WINDOWSSDK_PREFERRED_FIRST_DIRS}) + foreach(WINSDKDIR ${WINDOWSSDK_DIRS}) + get_windowssdk_library_dirs(${WINSDKDIR} WINSDK_CURRENT_LIBDIRS) + list(APPEND WINSDK_LIBDIRS ${WINSDK_CURRENT_LIBDIRS}) + endforeach() + endif() + + if(CMAKE_SIZEOF_VOID_P MATCHES "8") + set(_arch amd64) # what the architecture used to be called + set(_arch8 x64) # what the WDK for Win8+ calls this architecture + else() + set(_arch i386) # what the architecture used to be called + set(_arch8 x86) # what the WDK for Win8+ calls this architecture + endif() + include(PrefixListGlob) + include(CleanDirectoryList) + prefix_list_glob(_prefixed + "*/" + "$ENV{SYSTEMDRIVE}/WinDDK/" + "$ENV{ProgramFiles}/Windows Kits/" + "c:/WinDDK/") + clean_directory_list(_prefixed) + find_library(WINHID_LIBRARY + NAMES + hid + libhid + PATHS + "${WINHID_ROOT_DIR}" + ${WINSDK_LIBDIRS} + ${_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/wlh/um/${_arch8}" # Win Vista ("Long Horn") min requirement + "lib/win7/${_arch}" # Win 7 min requirement + "lib/win7/um/${_arch8}" # Win 7 min requirement + "lib/win8/${_arch}" # Win 8 min requirement + "lib/win8/um/${_arch8}" # Win 8 min requirement + ) + # Might want to look close to the library first for the includes. + if(WINHID_LIBRARY) + get_filename_component(WINHID_LIBRARY_DIR "${WINHID_LIBRARY}" PATH) + if(WINDOWSSDK_FOUND) + get_windowssdk_from_component("${WINHID_LIBRARY}" _USED_WINSDK) + set(WINHID_LIBRARY_FROM_WINDOWSSDK ON) + get_windowssdk_include_dirs(${_USED_WINSDK} WINHID_INCLUDE_HINTS) + endif() + endif() + + find_library(WINHID_SETUPAPI_LIBRARY + NAMES + setupapi + HINTS + "${WINHID_LIBRARY_DIR}" + PATHS + "${WINHID_ROOT_DIR}" + ${WINSDK_LIBDIRS} + ${_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/wlh/um/${_arch8}" # Win Vista ("Long Horn") min requirement + "lib/win7/${_arch}" # Win 7 min requirement + "lib/win7/um/${_arch8}" # Win 7 min requirement + "lib/win8/${_arch}" # Win 8 min requirement + "lib/win8/um/${_arch8}" # Win 8 min requirement + ) + + if(WINHID_LIBRARY AND NOT WINHID_LIBRARY_FROM_WINDOWSSDK) + set(_basedir "${WINHID_LIBRARY_DIR}") + set(_prevdir) + while(NOT IS_DIRECTORY "${_basedir}/lib" AND NOT (_basedir STREQUAL _prevdir)) + set(_prevdir "${_basedir}") + get_filename_component(_basedir "${_basedir}/.." ABSOLUTE) + endwhile() + + set(WINHID_INCLUDE_HINTS "${_basedir}") + + if(EXISTS "${_basedir}/inc") + 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) + list(APPEND _deps_check WINHID_CRT_INCLUDE_DIR) + set(_need_crt_dir ON) + endif() + endif() + find_path(WINHID_INCLUDE_DIR + NAMES + hidsdi.h + HINTS + ${WINHID_INCLUDE_HINTS} + PATHS + "${WINHID_ROOT_DIR}" + PATH_SUFFIXES + inc/ddk + inc/api + inc/w2k + inc/wxp + inc/wnet + include/shared) +else() + # This is the non-MSVC path. + if(MINGW) + include(MinGWSearchPathExtras) + + find_library(WINHID_LIBRARY + NAMES + libhid + HINTS + "${WINHID_ROOT_DIR}" + ${MINGWSEARCH_LIBRARY_DIRS} + /mingw + PATH_SUFFIXES + lib + lib/w32api) + find_library(WINHID_SETUPAPI_LIBRARY + NAMES + libsetupapi + HINTS + "${WINHID_ROOT_DIR}" + ${MINGWSEARCH_LIBRARY_DIRS} + /mingw + PATH_SUFFIXES + lib + lib/w32api) + else() + find_library(WINHID_LIBRARY + NAMES + hid + libhid + HINTS + "${WINHID_ROOT_DIR}" + /mingw + PATH_SUFFIXES + lib + lib/w32api) + find_library(WINHID_SETUPAPI_LIBRARY + NAMES + setupapi + libsetupapi + HINTS + "${WINHID_ROOT_DIR}" + /mingw + PATH_SUFFIXES + lib + lib/w32api) + endif() + find_path(WINHID_INCLUDE_DIR + NAMES + hidsdi.h + PATHS + "${WINHID_ROOT_DIR}" + ${MINGWSEARCH_INCLUDE_DIRS} + /mingw + PATH_SUFFIXES + include/w32api/ddk + include/ddk + ddk) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(WinHID + DEFAULT_MSG + WINHID_LIBRARY + WINHID_SETUPAPI_LIBRARY + WINHID_INCLUDE_DIR + ${_deps_check}) + +if(WINHID_FOUND) + if(MSVC) + set(_winreq) + if(WINHID_LIBRARY MATCHES "[Ll]ib/w2k") + set(_winreq "Windows 2000") + elseif(WINHID_LIBRARY MATCHES "[Ll]ib/wxp") + set(_winreq "Windows XP") + elseif(WINHID_LIBRARY MATCHES "[Ll]ib/wnet") + set(_winreq "Windows Server 2003") + elseif(WINHID_LIBRARY MATCHES "[Ll]ib/wlh") + set(_winreq "Windows Vista") + elseif(WINHID_LIBRARY MATCHES "[Ll]ib/win7") + set(_winreq "Windows 7") + elseif(WINHID_LIBRARY MATCHES "[Ll]ib/win8") + set(_winreq "Windows 8") + set(_winreq_uncertain ON) + elseif(WINHID_LIBRARY MATCHES "[Ll]ib/winv6.3") + set(_winreq "Windows 8.1") + set(_winreq_uncertain ON) + elseif(WINHID_LIBRARY MATCHES "[Ll]ib/10.0") + set(_winreq "Windows 10") + set(_winreq_uncertain ON) + endif() + if(NOT "${WINHID_MIN_WINDOWS_VER}" STREQUAL "${_winreq}") + if(NOT WinHID_FIND_QUIETLY) + if(NOT _winreq) + message("Couldn't determine if the WINHID_LIBRARY would result in a minimum version compatibility requirement.") + elseif(_winreq_uncertain) + message(STATUS + "Found WINHID_LIBRARY in the Windows SDK for ${_winreq} , which may or may not affect minimum compatible Windows version.") + else() + message(STATUS + "Linking against WINHID_LIBRARY will enforce this minimum version: ${_winreq}") + endif() + endif() + set(WINHID_MIN_WINDOWS_VER "${_winreq}" CACHE INTERNAL "" FORCE) + endif() + endif() + set(WINHID_LIBRARIES "${WINHID_LIBRARY}" "${WINHID_SETUPAPI_LIBRARY}") + if(_need_crt_dir) + set(WINHID_INCLUDE_DIRS + "${WINHID_CRT_INCLUDE_DIR}" + "${WINHID_INCLUDE_DIR}") + else() + # Don't need that CRT include dir for WDK 8+ + set(WINHID_INCLUDE_DIRS + "${WINHID_INCLUDE_DIR}") + endif() + mark_as_advanced(WINHID_ROOT_DIR) +endif() + +mark_as_advanced(WINHID_INCLUDE_DIR + WINHID_CRT_INCLUDE_DIR + WINHID_LIBRARY) diff --git a/lib/wiiuse/cmake/FindWindowsSDK.cmake b/lib/wiiuse/cmake/FindWindowsSDK.cmake new file mode 100644 index 000000000..c8691efa7 --- /dev/null +++ b/lib/wiiuse/cmake/FindWindowsSDK.cmake @@ -0,0 +1,630 @@ +# - Find the Windows SDK aka Platform SDK +# +# Relevant Wikipedia article: http://en.wikipedia.org/wiki/Microsoft_Windows_SDK +# +# Pass "COMPONENTS tools" to ignore Visual Studio version checks: in case +# you just want the tool binaries to run, rather than the libraries and headers +# for compiling. +# +# Variables: +# WINDOWSSDK_FOUND - if any version of the windows or platform SDK was found that is usable with the current version of visual studio +# WINDOWSSDK_LATEST_DIR +# WINDOWSSDK_LATEST_NAME +# WINDOWSSDK_FOUND_PREFERENCE - if we found an entry indicating a "preferred" SDK listed for this visual studio version +# WINDOWSSDK_PREFERRED_DIR +# WINDOWSSDK_PREFERRED_NAME +# +# WINDOWSSDK_DIRS - contains no duplicates, ordered most recent first. +# WINDOWSSDK_PREFERRED_FIRST_DIRS - contains no duplicates, ordered with preferred first, followed by the rest in descending recency +# +# Functions: +# windowssdk_name_lookup( ) - Find the name corresponding with the SDK directory you pass in, or +# NOTFOUND if not recognized. Your directory must be one of WINDOWSSDK_DIRS for this to work. +# +# windowssdk_build_lookup( ) - Find the build version number corresponding with the SDK directory you pass in, or +# NOTFOUND if not recognized. Your directory must be one of WINDOWSSDK_DIRS for this to work. +# +# get_windowssdk_from_component( ) - Given a library or include dir, +# find the Windows SDK root dir corresponding to it, or NOTFOUND if unrecognized. +# +# get_windowssdk_library_dirs( ) - Find the architecture-appropriate +# library directories corresponding to the SDK directory you pass in (or NOTFOUND if none) +# +# get_windowssdk_library_dirs_multiple( ...) - Find the architecture-appropriate +# library directories corresponding to the SDK directories you pass in, in order, skipping those not found. NOTFOUND if none at all. +# Good for passing WINDOWSSDK_DIRS or WINDOWSSDK_DIRS to if you really just want a file and don't care where from. +# +# get_windowssdk_include_dirs( ) - Find the +# include directories corresponding to the SDK directory you pass in (or NOTFOUND if none) +# +# get_windowssdk_include_dirs_multiple( ...) - Find the +# include directories corresponding to the SDK directories you pass in, in order, skipping those not found. NOTFOUND if none at all. +# Good for passing WINDOWSSDK_DIRS or WINDOWSSDK_DIRS to if you really just want a file and don't care where from. +# +# Requires these CMake modules: +# FindPackageHandleStandardArgs (known included with CMake >=2.6.2) +# +# Original Author: +# 2012 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 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(_preferred_sdk_dirs) # pre-output +set(_win_sdk_dirs) # pre-output +set(_win_sdk_versanddirs) # pre-output +set(_win_sdk_buildsanddirs) # pre-output +set(_winsdk_vistaonly) # search parameters +set(_winsdk_kits) # search parameters + + +set(_WINDOWSSDK_ANNOUNCE OFF) +if(NOT WINDOWSSDK_FOUND AND (NOT WindowsSDK_FIND_QUIETLY)) + set(_WINDOWSSDK_ANNOUNCE ON) +endif() +macro(_winsdk_announce) + if(_WINSDK_ANNOUNCE) + message(STATUS ${ARGN}) + endif() +endmacro() + +set(_winsdk_win10vers + 10.0.17763.0 # Redstone 5 aka Win10 1810 "October 2018 Update" + 10.0.17133.0 # Redstone 4 aka Win10 1803 "April 2018 Update" + 10.0.16299.0 # Redstone 3 aka Win10 1709 "Fall Creators Update" + 10.0.15063.0 # Redstone 2 aka Win10 1703 "Creators Update" + 10.0.14393.0 # Redstone aka Win10 1607 "Anniversary Update" + 10.0.10586.0 # TH2 aka Win10 1511 + 10.0.10240.0 # Win10 RTM + 10.0.10150.0 # just ucrt + 10.0.10056.0 +) + +if(WindowsSDK_FIND_COMPONENTS MATCHES "tools") + set(_WINDOWSSDK_IGNOREMSVC ON) + _winsdk_announce("Checking for tools from Windows/Platform SDKs...") +else() + set(_WINDOWSSDK_IGNOREMSVC OFF) + _winsdk_announce("Checking for Windows/Platform SDKs...") +endif() + +# Appends to the three main pre-output lists used only if the path exists +# and is not already in the list. +function(_winsdk_conditional_append _vername _build _path) + if(("${_path}" MATCHES "registry") OR (NOT EXISTS "${_path}")) + # Path invalid - do not add + return() + endif() + list(FIND _win_sdk_dirs "${_path}" _win_sdk_idx) + if(_win_sdk_idx GREATER -1) + # Path already in list - do not add + return() + endif() + _winsdk_announce( " - ${_vername}, Build ${_build} @ ${_path}") + # Not yet in the list, so we'll add it + list(APPEND _win_sdk_dirs "${_path}") + set(_win_sdk_dirs "${_win_sdk_dirs}" CACHE INTERNAL "" FORCE) + list(APPEND + _win_sdk_versanddirs + "${_vername}" + "${_path}") + set(_win_sdk_versanddirs "${_win_sdk_versanddirs}" CACHE INTERNAL "" FORCE) + list(APPEND + _win_sdk_buildsanddirs + "${_build}" + "${_path}") + set(_win_sdk_buildsanddirs "${_win_sdk_buildsanddirs}" CACHE INTERNAL "" FORCE) +endfunction() + +# Appends to the "preferred SDK" lists only if the path exists +function(_winsdk_conditional_append_preferred _info _path) + if(("${_path}" MATCHES "registry") OR (NOT EXISTS "${_path}")) + # Path invalid - do not add + return() + endif() + + get_filename_component(_path "${_path}" ABSOLUTE) + + list(FIND _win_sdk_preferred_sdk_dirs "${_path}" _win_sdk_idx) + if(_win_sdk_idx GREATER -1) + # Path already in list - do not add + return() + endif() + _winsdk_announce( " - Found \"preferred\" SDK ${_info} @ ${_path}") + # Not yet in the list, so we'll add it + list(APPEND _win_sdk_preferred_sdk_dirs "${_path}") + set(_win_sdk_preferred_sdk_dirs "${_win_sdk_dirs}" CACHE INTERNAL "" FORCE) + + # Just in case we somehow missed it: + _winsdk_conditional_append("${_info}" "" "${_path}") +endfunction() + +# Given a version like v7.0A, looks for an SDK in the registry under "Microsoft SDKs". +# If the given version might be in both HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows +# and HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots aka "Windows Kits", +# use this macro first, since these registry keys usually have more information. +# +# Pass a "default" build number as an extra argument in case we can't find it. +function(_winsdk_check_microsoft_sdks_registry _winsdkver) + set(SDKKEY "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\${_winsdkver}") + get_filename_component(_sdkdir + "[${SDKKEY};InstallationFolder]" + ABSOLUTE) + + set(_sdkname "Windows SDK ${_winsdkver}") + + # Default build number passed as extra argument + set(_build ${ARGN}) + # See if the registry holds a Microsoft-mutilated, err, designated, product name + # (just using get_filename_component to execute the registry lookup) + get_filename_component(_sdkproductname + "[${SDKKEY};ProductName]" + NAME) + if(NOT "${_sdkproductname}" MATCHES "registry") + # Got a product name + set(_sdkname "${_sdkname} (${_sdkproductname})") + endif() + + # try for a version to augment our name + # (just using get_filename_component to execute the registry lookup) + get_filename_component(_sdkver + "[${SDKKEY};ProductVersion]" + NAME) + if(NOT "${_sdkver}" MATCHES "registry" AND NOT MATCHES) + # Got a version + if(NOT "${_sdkver}" MATCHES "\\.\\.") + # and it's not an invalid one with two dots in it: + # use to override the default build + set(_build ${_sdkver}) + if(NOT "${_sdkname}" MATCHES "${_sdkver}") + # Got a version that's not already in the name, let's use it to improve our name. + set(_sdkname "${_sdkname} (${_sdkver})") + endif() + endif() + endif() + _winsdk_conditional_append("${_sdkname}" "${_build}" "${_sdkdir}") +endfunction() + +# Given a name for identification purposes, the build number, and a key (technically a "value name") +# corresponding to a Windows SDK packaged as a "Windows Kit", look for it +# in HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots +# Note that the key or "value name" tends to be something weird like KitsRoot81 - +# no easy way to predict, just have to observe them in the wild. +# Doesn't hurt to also try _winsdk_check_microsoft_sdks_registry for these: +# sometimes you get keys in both parts of the registry (in the wow64 portion especially), +# and the non-"Windows Kits" location is often more descriptive. +function(_winsdk_check_windows_kits_registry _winkit_name _winkit_build _winkit_key) + get_filename_component(_sdkdir + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;${_winkit_key}]" + ABSOLUTE) + _winsdk_conditional_append("${_winkit_name}" "${_winkit_build}" "${_sdkdir}") +endfunction() + +# Given a name for identification purposes and the build number +# corresponding to a Windows 10 SDK packaged as a "Windows Kit", look for it +# in HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots +# Doesn't hurt to also try _winsdk_check_microsoft_sdks_registry for these: +# sometimes you get keys in both parts of the registry (in the wow64 portion especially), +# and the non-"Windows Kits" location is often more descriptive. +function(_winsdk_check_win10_kits _winkit_build) + get_filename_component(_sdkdir + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot10]" + ABSOLUTE) + if(("${_sdkdir}" MATCHES "registry") OR (NOT EXISTS "${_sdkdir}")) + return() # not found + endif() + if(EXISTS "${_sdkdir}/Include/${_winkit_build}/um") + _winsdk_conditional_append("Windows Kits 10 (Build ${_winkit_build})" "${_winkit_build}" "${_sdkdir}") + endif() +endfunction() + +# Given a name for indentification purposes, the build number, and the associated package GUID, +# look in the registry under both HKLM and HKCU in \\SOFTWARE\\Microsoft\\MicrosoftSDK\\InstalledSDKs\\ +# for that guid and the SDK it points to. +function(_winsdk_check_platformsdk_registry _platformsdkname _build _platformsdkguid) + foreach(_winsdk_hive HKEY_LOCAL_MACHINE HKEY_CURRENT_USER) + get_filename_component(_sdkdir + "[${_winsdk_hive}\\SOFTWARE\\Microsoft\\MicrosoftSDK\\InstalledSDKs\\${_platformsdkguid};Install Dir]" + ABSOLUTE) + _winsdk_conditional_append("${_platformsdkname} (${_build})" "${_build}" "${_sdkdir}") + endforeach() +endfunction() + +### +# Detect toolchain information: to know whether it's OK to use Vista+ only SDKs +### +set(_winsdk_vistaonly_ok OFF) +if(MSVC AND NOT _WINDOWSSDK_IGNOREMSVC) + # VC 10 and older has broad target support + if(MSVC_VERSION LESS 1700) + # VC 11 by default targets Vista and later only, so we can add a few more SDKs that (might?) only work on vista+ + elseif("${CMAKE_VS_PLATFORM_TOOLSET}" MATCHES "_xp") + # This is the XP-compatible v110+ toolset + elseif("${CMAKE_VS_PLATFORM_TOOLSET}" STREQUAL "v100" OR "${CMAKE_VS_PLATFORM_TOOLSET}" STREQUAL "v90") + # This is the VS2010/VS2008 toolset + else() + # OK, we're VC11 or newer and not using a backlevel or XP-compatible toolset. + # These versions have no XP (and possibly Vista pre-SP1) support + set(_winsdk_vistaonly_ok ON) + if(_WINDOWSSDK_ANNOUNCE AND NOT _WINDOWSSDK_VISTAONLY_PESTERED) + set(_WINDOWSSDK_VISTAONLY_PESTERED ON CACHE INTERNAL "" FORCE) + message(STATUS "FindWindowsSDK: Detected Visual Studio 2012 or newer, not using the _xp toolset variant: including SDK versions that drop XP support in search!") + endif() + endif() +endif() +if(_WINDOWSSDK_IGNOREMSVC) + set(_winsdk_vistaonly_ok ON) +endif() + +### +# MSVC version checks - keeps messy conditionals in one place +# (messy because of _WINDOWSSDK_IGNOREMSVC) +### +set(_winsdk_msvc_greater_1200 OFF) +if(_WINDOWSSDK_IGNOREMSVC OR (MSVC AND (MSVC_VERSION GREATER 1200))) + set(_winsdk_msvc_greater_1200 ON) +endif() +# Newer than VS .NET/VS Toolkit 2003 +set(_winsdk_msvc_greater_1310 OFF) +if(_WINDOWSSDK_IGNOREMSVC OR (MSVC AND (MSVC_VERSION GREATER 1310))) + set(_winsdk_msvc_greater_1310 ON) +endif() + +# VS2005/2008 +set(_winsdk_msvc_less_1600 OFF) +if(_WINDOWSSDK_IGNOREMSVC OR (MSVC AND (MSVC_VERSION LESS 1600))) + set(_winsdk_msvc_less_1600 ON) +endif() + +# VS2013+ +set(_winsdk_msvc_not_less_1800 OFF) +if(_WINDOWSSDK_IGNOREMSVC OR (MSVC AND (NOT MSVC_VERSION LESS 1800))) + set(_winsdk_msvc_not_less_1800 ON) +endif() + +### +# START body of find module +### +if(_winsdk_msvc_greater_1310) # Newer than VS .NET/VS Toolkit 2003 + ### + # Look for "preferred" SDKs + ### + + # Environment variable for SDK dir + if(EXISTS "$ENV{WindowsSDKDir}" AND (NOT "$ENV{WindowsSDKDir}" STREQUAL "")) + _winsdk_conditional_append_preferred("WindowsSDKDir environment variable" "$ENV{WindowsSDKDir}") + endif() + + if(_winsdk_msvc_less_1600) + # Per-user current Windows SDK for VS2005/2008 + get_filename_component(_sdkdir + "[HKEY_CURRENT_USER\\Software\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]" + ABSOLUTE) + _winsdk_conditional_append_preferred("Per-user current Windows SDK" "${_sdkdir}") + + # System-wide current Windows SDK for VS2005/2008 + get_filename_component(_sdkdir + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]" + ABSOLUTE) + _winsdk_conditional_append_preferred("System-wide current Windows SDK" "${_sdkdir}") + endif() + + ### + # Begin the massive list of SDK searching! + ### + if(_winsdk_vistaonly_ok AND _winsdk_msvc_not_less_1800) + # These require at least Visual Studio 2013 (VC12) + + _winsdk_check_microsoft_sdks_registry(v10.0A) + + # Windows Software Development Kit (SDK) for Windows 10 + # Several different versions living in the same directory - if nothing else we can assume RTM (10240) + _winsdk_check_microsoft_sdks_registry(v10.0 10.0.10240.0) + foreach(_win10build ${_winsdk_win10vers}) + _winsdk_check_win10_kits(${_win10build}) + endforeach() + endif() # vista-only and 2013+ + + # Included in Visual Studio 2013 + # Includes the v120_xp toolset + _winsdk_check_microsoft_sdks_registry(v8.1A 8.1.51636) + + if(_winsdk_vistaonly_ok AND _winsdk_msvc_not_less_1800) + # Windows Software Development Kit (SDK) for Windows 8.1 + # http://msdn.microsoft.com/en-gb/windows/desktop/bg162891 + _winsdk_check_microsoft_sdks_registry(v8.1 8.1.25984.0) + _winsdk_check_windows_kits_registry("Windows Kits 8.1" 8.1.25984.0 KitsRoot81) + endif() # vista-only and 2013+ + + if(_winsdk_vistaonly_ok) + # Included in Visual Studio 2012 + _winsdk_check_microsoft_sdks_registry(v8.0A 8.0.50727) + + # Microsoft Windows SDK for Windows 8 and .NET Framework 4.5 + # This is the first version to also include the DirectX SDK + # http://msdn.microsoft.com/en-US/windows/desktop/hh852363.aspx + _winsdk_check_microsoft_sdks_registry(v8.0 6.2.9200.16384) + _winsdk_check_windows_kits_registry("Windows Kits 8.0" 6.2.9200.16384 KitsRoot) + endif() # vista-only + + # Included with VS 2012 Update 1 or later + # Introduces v110_xp toolset + _winsdk_check_microsoft_sdks_registry(v7.1A 7.1.51106) + if(_winsdk_vistaonly_ok) + # Microsoft Windows SDK for Windows 7 and .NET Framework 4 + # http://www.microsoft.com/downloads/en/details.aspx?FamilyID=6b6c21d2-2006-4afa-9702-529fa782d63b + _winsdk_check_microsoft_sdks_registry(v7.1 7.1.7600.0.30514) + endif() # vista-only + + # Included with VS 2010 + _winsdk_check_microsoft_sdks_registry(v7.0A 6.1.7600.16385) + + # Windows SDK for Windows 7 and .NET Framework 3.5 SP1 + # Works with VC9 + # http://www.microsoft.com/en-us/download/details.aspx?id=18950 + _winsdk_check_microsoft_sdks_registry(v7.0 6.1.7600.16385) + + # Two versions call themselves "v6.1": + # Older: + # Windows Vista Update & .NET 3.0 SDK + # http://www.microsoft.com/en-us/download/details.aspx?id=14477 + + # Newer: + # Windows Server 2008 & .NET 3.5 SDK + # may have broken VS9SP1? they recommend v7.0 instead, or a KB... + # http://www.microsoft.com/en-us/download/details.aspx?id=24826 + _winsdk_check_microsoft_sdks_registry(v6.1 6.1.6000.16384.10) + + # Included in VS 2008 + _winsdk_check_microsoft_sdks_registry(v6.0A 6.1.6723.1) + + # Microsoft Windows Software Development Kit for Windows Vista and .NET Framework 3.0 Runtime Components + # http://blogs.msdn.com/b/stanley/archive/2006/11/08/microsoft-windows-software-development-kit-for-windows-vista-and-net-framework-3-0-runtime-components.aspx + _winsdk_check_microsoft_sdks_registry(v6.0 6.0.6000.16384) +endif() + +# Let's not forget the Platform SDKs, which sometimes are useful! +if(_winsdk_msvc_greater_1200) + _winsdk_check_platformsdk_registry("Microsoft Platform SDK for Windows Server 2003 R2" "5.2.3790.2075.51" "D2FF9F89-8AA2-4373-8A31-C838BF4DBBE1") + _winsdk_check_platformsdk_registry("Microsoft Platform SDK for Windows Server 2003 SP1" "5.2.3790.1830.15" "8F9E5EF3-A9A5-491B-A889-C58EFFECE8B3") +endif() +### +# Finally, look for "preferred" SDKs +### +if(_winsdk_msvc_greater_1310) # Newer than VS .NET/VS Toolkit 2003 + + + # Environment variable for SDK dir + if(EXISTS "$ENV{WindowsSDKDir}" AND (NOT "$ENV{WindowsSDKDir}" STREQUAL "")) + _winsdk_conditional_append_preferred("WindowsSDKDir environment variable" "$ENV{WindowsSDKDir}") + endif() + + if(_winsdk_msvc_less_1600) + # Per-user current Windows SDK for VS2005/2008 + get_filename_component(_sdkdir + "[HKEY_CURRENT_USER\\Software\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]" + ABSOLUTE) + _winsdk_conditional_append_preferred("Per-user current Windows SDK" "${_sdkdir}") + + # System-wide current Windows SDK for VS2005/2008 + get_filename_component(_sdkdir + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]" + ABSOLUTE) + _winsdk_conditional_append_preferred("System-wide current Windows SDK" "${_sdkdir}") + endif() +endif() + + +function(windowssdk_name_lookup _dir _outvar) + list(FIND _win_sdk_versanddirs "${_dir}" _diridx) + math(EXPR _idx "${_diridx} - 1") + if(${_idx} GREATER -1) + list(GET _win_sdk_versanddirs ${_idx} _ret) + else() + set(_ret "NOTFOUND") + endif() + set(${_outvar} "${_ret}" PARENT_SCOPE) +endfunction() + +function(windowssdk_build_lookup _dir _outvar) + list(FIND _win_sdk_buildsanddirs "${_dir}" _diridx) + math(EXPR _idx "${_diridx} - 1") + if(${_idx} GREATER -1) + list(GET _win_sdk_buildsanddirs ${_idx} _ret) + else() + set(_ret "NOTFOUND") + endif() + set(${_outvar} "${_ret}" PARENT_SCOPE) +endfunction() + +# If we found something... +if(_win_sdk_dirs) + list(GET _win_sdk_dirs 0 WINDOWSSDK_LATEST_DIR) + windowssdk_name_lookup("${WINDOWSSDK_LATEST_DIR}" + WINDOWSSDK_LATEST_NAME) + set(WINDOWSSDK_DIRS ${_win_sdk_dirs}) + + # Fallback, in case no preference found. + set(WINDOWSSDK_PREFERRED_DIR "${WINDOWSSDK_LATEST_DIR}") + set(WINDOWSSDK_PREFERRED_NAME "${WINDOWSSDK_LATEST_NAME}") + set(WINDOWSSDK_PREFERRED_FIRST_DIRS ${WINDOWSSDK_DIRS}) + set(WINDOWSSDK_FOUND_PREFERENCE OFF) +endif() + +# If we found indications of a user preference... +if(_win_sdk_preferred_sdk_dirs) + list(GET _win_sdk_preferred_sdk_dirs 0 WINDOWSSDK_PREFERRED_DIR) + windowssdk_name_lookup("${WINDOWSSDK_PREFERRED_DIR}" + WINDOWSSDK_PREFERRED_NAME) + set(WINDOWSSDK_PREFERRED_FIRST_DIRS + ${_win_sdk_preferred_sdk_dirs} + ${_win_sdk_dirs}) + list(REMOVE_DUPLICATES WINDOWSSDK_PREFERRED_FIRST_DIRS) + set(WINDOWSSDK_FOUND_PREFERENCE ON) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(WindowsSDK + "No compatible version of the Windows SDK or Platform SDK found." + WINDOWSSDK_DIRS) + +if(WINDOWSSDK_FOUND) + # Internal: Architecture-appropriate library directory names. + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "ARM") + if(CMAKE_SIZEOF_VOID_P MATCHES "8") + # Only supported in Win10 SDK and up. + set(_winsdk_arch8 arm64) # what the WDK for Win8+ calls this architecture + else() + set(_winsdk_archbare /arm) # what the architecture used to be called in oldest SDKs + set(_winsdk_arch arm) # what the architecture used to be called + set(_winsdk_arch8 arm) # what the WDK for Win8+ calls this architecture + endif() + else() + if(CMAKE_SIZEOF_VOID_P MATCHES "8") + set(_winsdk_archbare /x64) # what the architecture used to be called in oldest SDKs + set(_winsdk_arch amd64) # what the architecture used to be called + set(_winsdk_arch8 x64) # what the WDK for Win8+ calls this architecture + else() + set(_winsdk_archbare ) # what the architecture used to be called in oldest SDKs + set(_winsdk_arch i386) # what the architecture used to be called + set(_winsdk_arch8 x86) # what the WDK for Win8+ calls this architecture + endif() + endif() + + function(get_windowssdk_from_component _component _var) + get_filename_component(_component "${_component}" ABSOLUTE) + file(TO_CMAKE_PATH "${_component}" _component) + foreach(_sdkdir ${WINDOWSSDK_DIRS}) + get_filename_component(_sdkdir "${_sdkdir}" ABSOLUTE) + string(LENGTH "${_sdkdir}" _sdklen) + file(RELATIVE_PATH _rel "${_sdkdir}" "${_component}") + # If we don't have any "parent directory" items... + if(NOT "${_rel}" MATCHES "[.][.]") + set(${_var} "${_sdkdir}" PARENT_SCOPE) + return() + endif() + endforeach() + # Fail. + set(${_var} "NOTFOUND" PARENT_SCOPE) + endfunction() + function(get_windowssdk_library_dirs _winsdk_dir _var) + set(_dirs) + set(_suffixes + "lib${_winsdk_archbare}" # SDKs like 7.1A + "lib/${_winsdk_arch}" # just because some SDKs have x86 dir and root dir + "lib/w2k/${_winsdk_arch}" # Win2k min requirement + "lib/wxp/${_winsdk_arch}" # WinXP min requirement + "lib/wnet/${_winsdk_arch}" # Win Server 2003 min requirement + "lib/wlh/${_winsdk_arch}" + "lib/wlh/um/${_winsdk_arch8}" # Win Vista ("Long Horn") min requirement + "lib/win7/${_winsdk_arch}" + "lib/win7/um/${_winsdk_arch8}" # Win 7 min requirement + ) + foreach(_ver + wlh # Win Vista ("Long Horn") min requirement + win7 # Win 7 min requirement + win8 # Win 8 min requirement + winv6.3 # Win 8.1 min requirement + ) + + list(APPEND _suffixes + "lib/${_ver}/${_winsdk_arch}" + "lib/${_ver}/um/${_winsdk_arch8}" + "lib/${_ver}/km/${_winsdk_arch8}" + ) + endforeach() + + # Look for WDF libraries in Win10+ SDK + foreach(_mode umdf kmdf) + file(GLOB _wdfdirs RELATIVE "${_winsdk_dir}" "${_winsdk_dir}/lib/wdf/${_mode}/${_winsdk_arch8}/*") + if(_wdfdirs) + list(APPEND _suffixes ${_wdfdirs}) + endif() + endforeach() + + # Look in each Win10+ SDK version for the components + foreach(_win10ver ${_winsdk_win10vers}) + foreach(_component um km ucrt mmos) + list(APPEND _suffixes "lib/${_win10ver}/${_component}/${_winsdk_arch8}") + endforeach() + endforeach() + + foreach(_suffix ${_suffixes}) + # Check to see if a library actually exists here. + file(GLOB _libs "${_winsdk_dir}/${_suffix}/*.lib") + if(_libs) + list(APPEND _dirs "${_winsdk_dir}/${_suffix}") + endif() + endforeach() + if("${_dirs}" STREQUAL "") + set(_dirs NOTFOUND) + else() + list(REMOVE_DUPLICATES _dirs) + endif() + set(${_var} ${_dirs} PARENT_SCOPE) + endfunction() + function(get_windowssdk_include_dirs _winsdk_dir _var) + set(_dirs) + + set(_subdirs shared um winrt km wdf mmos ucrt) + set(_suffixes Include) + + foreach(_dir ${_subdirs}) + list(APPEND _suffixes "Include/${_dir}") + endforeach() + + foreach(_ver ${_winsdk_win10vers}) + foreach(_dir ${_subdirs}) + list(APPEND _suffixes "Include/${_ver}/${_dir}") + endforeach() + endforeach() + + foreach(_suffix ${_suffixes}) + # Check to see if a header file actually exists here. + file(GLOB _headers "${_winsdk_dir}/${_suffix}/*.h") + if(_headers) + list(APPEND _dirs "${_winsdk_dir}/${_suffix}") + endif() + endforeach() + if("${_dirs}" STREQUAL "") + set(_dirs NOTFOUND) + else() + list(REMOVE_DUPLICATES _dirs) + endif() + set(${_var} ${_dirs} PARENT_SCOPE) + endfunction() + function(get_windowssdk_library_dirs_multiple _var) + set(_dirs) + foreach(_sdkdir ${ARGN}) + get_windowssdk_library_dirs("${_sdkdir}" _current_sdk_libdirs) + if(_current_sdk_libdirs) + list(APPEND _dirs ${_current_sdk_libdirs}) + endif() + endforeach() + if("${_dirs}" STREQUAL "") + set(_dirs NOTFOUND) + else() + list(REMOVE_DUPLICATES _dirs) + endif() + set(${_var} ${_dirs} PARENT_SCOPE) + endfunction() + function(get_windowssdk_include_dirs_multiple _var) + set(_dirs) + foreach(_sdkdir ${ARGN}) + get_windowssdk_include_dirs("${_sdkdir}" _current_sdk_incdirs) + if(_current_sdk_libdirs) + list(APPEND _dirs ${_current_sdk_incdirs}) + endif() + endforeach() + if("${_dirs}" STREQUAL "") + set(_dirs NOTFOUND) + else() + list(REMOVE_DUPLICATES _dirs) + endif() + set(${_var} ${_dirs} PARENT_SCOPE) + endfunction() +endif() diff --git a/lib/wiiuse/cmake/FindXrandr.cmake b/lib/wiiuse/cmake/FindXrandr.cmake new file mode 100644 index 000000000..965c42dba --- /dev/null +++ b/lib/wiiuse/cmake/FindXrandr.cmake @@ -0,0 +1,78 @@ +# - try to find the Xrandr library +# +# Cache Variables: (probably not for direct use in your scripts) +# XRANDR_INCLUDE_DIR +# XRANDR_SOURCE_DIR +# XRANDR_LIBRARY +# +# Non-cache variables you might use in your CMakeLists.txt: +# XRANDR_FOUND +# XRANDR_INCLUDE_DIRS +# XRANDR_LIBRARIES +# +# Requires these CMake modules: +# FindPackageHandleStandardArgs (known included with CMake >=2.6.2) +# +# Original Author: +# 2014 Kevin M. Godby +# +# 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(XRANDR_ROOT_DIR + "${XRANDR_ROOT_DIR}" + CACHE + PATH + "Directory to search for Xrandr") + +find_package(PkgConfig QUIET) +if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_LIBXRANDR xrandr) +endif() + +find_library(XRANDR_LIBRARY + NAMES + Xrandr + PATHS + ${PC_LIBXRANDR_LIBRARY_DIRS} + ${PC_LIBXRANDR_LIBDIR} + HINTS + "${XRANDR_ROOT_DIR}" + PATH_SUFFIXES + lib + ) + +get_filename_component(_libdir "${XRANDR_LIBRARY}" PATH) + +find_path(XRANDR_INCLUDE_DIR + NAMES + Xrandr.h + PATHS + ${PC_LIBXRANDR_INCLUDE_DIRS} + ${PC_LIBXRANDR_INCLUDEDIR} + HINTS + "${_libdir}" + "${_libdir}/.." + "${XRANDR_ROOT_DIR}" + PATH_SUFFIXES + X11 + X11/extensions + ) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(XRANDR + DEFAULT_MSG + XRANDR_LIBRARY + XRANDR_INCLUDE_DIR + ) + +if(XRANDR_FOUND) + list(APPEND XRANDR_LIBRARIES ${XRANDR_LIBRARY}) + list(APPEND XRANDR_INCLUDE_DIRS ${XRANDR_INCLUDE_DIR}) + mark_as_advanced(XRANDR_ROOT_DIR) +endif() + +mark_as_advanced(XRANDR_INCLUDE_DIR + XRANDR_LIBRARY) + diff --git a/lib/wiiuse/cmake/Findargp.cmake b/lib/wiiuse/cmake/Findargp.cmake new file mode 100644 index 000000000..140144d42 --- /dev/null +++ b/lib/wiiuse/cmake/Findargp.cmake @@ -0,0 +1,81 @@ +# - try to find the argp library/component of glibc +# +# Users may optionally supply: +# ARGP_ROOT_DIR - a prefix to start searching. +# +# Cache Variables: (probably not for direct use in your scripts) +# ARGP_INCLUDE_DIR +# ARGP_LIBRARY, only defined if linking to an extra library is required +# +# Non-cache variables you might use in your CMakeLists.txt: +# ARGP_FOUND +# ARGP_INCLUDE_DIRS +# ARGP_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) + +set(ARGP_ROOT_DIR + "${ARGP_ROOT_DIR}" + CACHE + PATH + "Path to search for ARGP library") + +### +# Configure ARGP +### +set(_check ARGP_INCLUDE_DIR) + +find_path(ARGP_INCLUDE_DIR + NAMES + argp.h + HINTS + "${ARGP_ROOT_DIR}" + PATHS + /usr/local + /opt/local + /sw) +mark_as_advanced(ARGP_INCLUDE_DIR) + +include(CheckFunctionExists) +check_function_exists(argp_parse ARGP_BUILTIN) + +if(NOT ARGP_BUILTIN) + find_library(ARGP_LIBRARY + NAMES + argp + HINTS + "${ARGP_ROOT_DIR}" + PATH_SUFFIXES + lib + lib64 + PATHS + /usr/local + /opt/local + /sw) + list(APPEND _check ARGP_LIBRARY) + mark_as_advanced(ARGP_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(argp + DEFAULT_MSG + ${_check}) + +if(ARGP_FOUND) + set(ARGP_INCLUDE_DIRS "${ARGP_INCLUDE_DIR}") + set(ARGP_LIBRARIES "${ARGP_LIBRARY}") + mark_as_advanced(ARGP_ROOT_DIR) +endif() diff --git a/lib/wiiuse/cmake/Findcppcheck.cmake b/lib/wiiuse/cmake/Findcppcheck.cmake new file mode 100644 index 000000000..3f13a6b3b --- /dev/null +++ b/lib/wiiuse/cmake/Findcppcheck.cmake @@ -0,0 +1,173 @@ +# - try to find cppcheck tool +# +# Cache Variables: +# CPPCHECK_EXECUTABLE +# +# Non-cache variables you might use in your CMakeLists.txt: +# CPPCHECK_FOUND +# CPPCHECK_VERSION +# CPPCHECK_POSSIBLEERROR_ARG +# CPPCHECK_UNUSEDFUNC_ARG +# CPPCHECK_STYLE_ARG +# CPPCHECK_QUIET_ARG +# CPPCHECK_INCLUDEPATH_ARG +# CPPCHECK_FAIL_REGULAR_EXPRESSION +# CPPCHECK_WARN_REGULAR_EXPRESSION +# CPPCHECK_MARK_AS_ADVANCED - whether to mark our vars as advanced even +# if we don't find this program. +# +# 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) + +file(TO_CMAKE_PATH "${CPPCHECK_ROOT_DIR}" CPPCHECK_ROOT_DIR) +set(CPPCHECK_ROOT_DIR + "${CPPCHECK_ROOT_DIR}" + CACHE + PATH + "Path to search for cppcheck") + +# cppcheck app bundles on Mac OS X are GUI, we want command line only +set(_oldappbundlesetting ${CMAKE_FIND_APPBUNDLE}) +set(CMAKE_FIND_APPBUNDLE NEVER) + +if(CPPCHECK_EXECUTABLE AND NOT EXISTS "${CPPCHECK_EXECUTABLE}") + set(CPPCHECK_EXECUTABLE "notfound" CACHE PATH FORCE "") +endif() + +# If we have a custom path, look there first. +if(CPPCHECK_ROOT_DIR) + find_program(CPPCHECK_EXECUTABLE + NAMES + cppcheck + cli + PATHS + "${CPPCHECK_ROOT_DIR}" + PATH_SUFFIXES + cli + NO_DEFAULT_PATH) +endif() + +find_program(CPPCHECK_EXECUTABLE NAMES cppcheck) + +# Restore original setting for appbundle finding +set(CMAKE_FIND_APPBUNDLE ${_oldappbundlesetting}) + +# Find out where our test file is +get_filename_component(_cppcheckmoddir ${CMAKE_CURRENT_LIST_FILE} PATH) +set(_cppcheckdummyfile "${_cppcheckmoddir}/Findcppcheck.cpp") +if(NOT EXISTS "${_cppcheckdummyfile}") + message(FATAL_ERROR + "Missing file ${_cppcheckdummyfile} - should be alongside Findcppcheck.cmake, can be found at https://github.com/rpavlik/cmake-modules") +endif() + +function(_cppcheck_test_arg _resultvar _arg) + if(NOT CPPCHECK_EXECUTABLE) + set(${_resultvar} NO) + return() + endif() + execute_process(COMMAND + "${CPPCHECK_EXECUTABLE}" + "${_arg}" + "--quiet" + "${_cppcheckdummyfile}" + RESULT_VARIABLE + _cppcheck_result + OUTPUT_QUIET + ERROR_QUIET) + if("${_cppcheck_result}" EQUAL 0) + set(${_resultvar} YES PARENT_SCOPE) + else() + set(${_resultvar} NO PARENT_SCOPE) + endif() +endfunction() + +function(_cppcheck_set_arg_var _argvar _arg) + if("${${_argvar}}" STREQUAL "") + _cppcheck_test_arg(_cppcheck_arg "${_arg}") + if(_cppcheck_arg) + set(${_argvar} "${_arg}" PARENT_SCOPE) + endif() + endif() +endfunction() + +if(CPPCHECK_EXECUTABLE) + + # Check for the two types of command line arguments by just trying them + _cppcheck_set_arg_var(CPPCHECK_STYLE_ARG "--enable=style") + _cppcheck_set_arg_var(CPPCHECK_STYLE_ARG "--style") + if("${CPPCHECK_STYLE_ARG}" STREQUAL "--enable=style") + + _cppcheck_set_arg_var(CPPCHECK_UNUSEDFUNC_ARG + "--enable=unusedFunction") + _cppcheck_set_arg_var(CPPCHECK_INFORMATION_ARG "--enable=information") + _cppcheck_set_arg_var(CPPCHECK_MISSINGINCLUDE_ARG + "--enable=missingInclude") + _cppcheck_set_arg_var(CPPCHECK_POSIX_ARG "--enable=posix") + _cppcheck_set_arg_var(CPPCHECK_POSSIBLEERROR_ARG + "--enable=possibleError") + _cppcheck_set_arg_var(CPPCHECK_POSSIBLEERROR_ARG "--enable=all") + + if(MSVC) + set(CPPCHECK_TEMPLATE_ARG --template vs) + set(CPPCHECK_FAIL_REGULAR_EXPRESSION "[(]error[)]") + set(CPPCHECK_WARN_REGULAR_EXPRESSION "[(]style[)]") + elseif(CMAKE_COMPILER_IS_GNUCXX) + set(CPPCHECK_TEMPLATE_ARG --template gcc) + set(CPPCHECK_FAIL_REGULAR_EXPRESSION " error: ") + set(CPPCHECK_WARN_REGULAR_EXPRESSION " style: ") + else() + set(CPPCHECK_TEMPLATE_ARG --template gcc) + set(CPPCHECK_FAIL_REGULAR_EXPRESSION " error: ") + set(CPPCHECK_WARN_REGULAR_EXPRESSION " style: ") + endif() + elseif("${CPPCHECK_STYLE_ARG}" STREQUAL "--style") + # Old arguments + _cppcheck_set_arg_var(CPPCHECK_UNUSEDFUNC_ARG "--unused-functions") + _cppcheck_set_arg_var(CPPCHECK_POSSIBLEERROR_ARG "--all") + set(CPPCHECK_FAIL_REGULAR_EXPRESSION "error:") + set(CPPCHECK_WARN_REGULAR_EXPRESSION "[(]style[)]") + else() + # No idea - some other issue must be getting in the way + message(STATUS + "WARNING: Can't detect whether CPPCHECK wants new or old-style arguments!") + endif() + + set(CPPCHECK_QUIET_ARG "--quiet") + set(CPPCHECK_INCLUDEPATH_ARG "-I") + +endif() + +set(CPPCHECK_ALL + "${CPPCHECK_EXECUTABLE} ${CPPCHECK_POSSIBLEERROR_ARG} ${CPPCHECK_UNUSEDFUNC_ARG} ${CPPCHECK_STYLE_ARG} ${CPPCHECK_QUIET_ARG} ${CPPCHECK_INCLUDEPATH_ARG} some/include/path") + +execute_process(COMMAND "${CPPCHECK_EXECUTABLE}" --version + OUTPUT_VARIABLE CPPCHECK_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE) +string(REGEX REPLACE ".* ([0-9]\\.([0-9]\\.[0-9])?)" "\\1" + CPPCHECK_VERSION "${CPPCHECK_VERSION}") + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(cppcheck + DEFAULT_MSG + CPPCHECK_ALL + CPPCHECK_EXECUTABLE + CPPCHECK_POSSIBLEERROR_ARG + CPPCHECK_UNUSEDFUNC_ARG + CPPCHECK_STYLE_ARG + CPPCHECK_INCLUDEPATH_ARG + CPPCHECK_QUIET_ARG) + +if(CPPCHECK_FOUND OR CPPCHECK_MARK_AS_ADVANCED) + mark_as_advanced(CPPCHECK_ROOT_DIR) +endif() + +mark_as_advanced(CPPCHECK_EXECUTABLE) diff --git a/lib/wiiuse/cmake/Findcppcheck.cpp b/lib/wiiuse/cmake/Findcppcheck.cpp new file mode 100644 index 000000000..84350db47 --- /dev/null +++ b/lib/wiiuse/cmake/Findcppcheck.cpp @@ -0,0 +1,16 @@ +/** + * \file Findcppcheck.cpp + * \brief Dummy C++ source file used by CMake module Findcppcheck.cmake + * + * \author + * Ryan Pavlik, 2009-2010 + * + * http://academic.cleardefinition.com/ + * + */ + + + +int main(int argc, char* argv[]) { + return 0; +} diff --git a/lib/wiiuse/cmake/Findcppunit.cmake b/lib/wiiuse/cmake/Findcppunit.cmake new file mode 100644 index 000000000..69150167e --- /dev/null +++ b/lib/wiiuse/cmake/Findcppunit.cmake @@ -0,0 +1,75 @@ +# - try to find cppunit library +# +# Cache Variables: (probably not for direct use in your scripts) +# CPPUNIT_INCLUDE_DIR +# CPPUNIT_LIBRARY +# +# Non-cache variables you might use in your CMakeLists.txt: +# CPPUNIT_FOUND +# CPPUNIT_INCLUDE_DIRS +# CPPUNIT_LIBRARIES +# +# Requires these CMake modules: +# SelectLibraryConfigurations (included with CMake >= 2.8.0) +# FindPackageHandleStandardArgs (known included with CMake >=2.6.2) +# +# Original Author: +# 2009-2011 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2011. +# 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(CPPUNIT_ROOT_DIR + "${CPPUNIT_ROOT_DIR}" + CACHE + PATH + "Directory to search") + +find_library(CPPUNIT_LIBRARY_RELEASE + NAMES + cppunit + HINTS + "${CPPUNIT_ROOT_DIR}") + +find_library(CPPUNIT_LIBRARY_DEBUG + NAMES + cppunitd + HINTS + "${CPPUNIT_ROOT_DIR}") + +include(SelectLibraryConfigurations) +select_library_configurations(CPPUNIT) + +# Might want to look close to the library first for the includes. +get_filename_component(_libdir "${CPPUNIT_LIBRARY_RELEASE}" PATH) + +find_path(CPPUNIT_INCLUDE_DIR + NAMES + cppunit/TestCase.h + HINTS + "${_libdir}/.." + PATHS + "${CPPUNIT_ROOT_DIR}" + PATH_SUFFIXES + include/) + + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(cppunit + DEFAULT_MSG + CPPUNIT_LIBRARY + CPPUNIT_INCLUDE_DIR) + +if(CPPUNIT_FOUND) + set(CPPUNIT_LIBRARIES ${CPPUNIT_LIBRARY} ${CMAKE_DL_LIBS}) + set(CPPUNIT_INCLUDE_DIRS "${CPPUNIT_INCLUDE_DIR}") + mark_as_advanced(CPPUNIT_ROOT_DIR) +endif() + +mark_as_advanced(CPPUNIT_INCLUDE_DIR + CPPUNIT_LIBRARY_RELEASE + CPPUNIT_LIBRARY_DEBUG) diff --git a/lib/wiiuse/cmake/Findcutil.cmake b/lib/wiiuse/cmake/Findcutil.cmake new file mode 100644 index 000000000..495f2840a --- /dev/null +++ b/lib/wiiuse/cmake/Findcutil.cmake @@ -0,0 +1,56 @@ +# - find NVIDIA CUDA and source for the cutil library, building cutil if needed. +# +# CUTIL_LIBRARIES - Libraries to link against to use CUTIL +# CUTIL_INCLUDE_DIRS - Include directories to add before building a CUTIL app. +# +# Functions: +# install_cutil({RUNTIME_LIBRARY_DESTINATION}) - Install the CUTIL shared lib if created. +# +# 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) + + +find_package(CUDA QUIET) + + +file(TO_CMAKE_PATH "${CUDA_SDK_ROOT_DIR}/C/common" CUTIL_ROOT_DIR) + +if(NOT EXISTS "${CUTIL_ROOT_DIR}/src/cutil.cpp") + set(CUDA_SDK_ROOT_DIR + SDKDIR-NOTFOUND + CACHE + PATH + "NVIDIA GPU Computing SDK dir" + FORCE) +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(cutil + DEFAULT_MSG + CUDA_SDK_ROOT_DIR + CUDA_FOUND) + +if(CUTIL_FOUND) + get_filename_component(_moddir "${CMAKE_CURRENT_LIST_FILE}" PATH) + add_subdirectory("${_moddir}/nested_targets/cutil") + + + function(install_cutil dest) + install(TARGETS cutil + RUNTIME DESTINATION "${dest}" + LIBRARY DESTINATION "${dest}") + endfunction() +else() + function(install_cutil) + message(FATAL_ERROR "Can't install cutil - didn't find it!") + endfunction() +endif() diff --git a/lib/wiiuse/cmake/Finddb2pdf.cmake b/lib/wiiuse/cmake/Finddb2pdf.cmake new file mode 100644 index 000000000..e3ad03a2b --- /dev/null +++ b/lib/wiiuse/cmake/Finddb2pdf.cmake @@ -0,0 +1,73 @@ +# - Try to find db2pdf, and define a custom command to turn docbook into pdf +# +# Once done, this will define: +# DB2PDF_FOUND - system has LyX +# DB2PDF_COMMAND - the command to run +# +# and the following function: +# docbook_to_pdf( ) +# +# Useful configuration variables you might want to add to your cache: +# DB2PDF_ROOT_DIR - A directory prefix to search +# +# 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) + + +set(DB2PDF_ROOT_DIR + "${DB2PDF_ROOT_DIR}" + CACHE + PATH + "Directory to start our search in") + +find_program(DB2PDF_COMMAND + NAMES + db2pdf + HINTS + "${DB2PDF_ROOT_DIR}" + PATH_SUFFIXES + bin) + +# 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(db2pdf DEFAULT_MSG DB2PDF_COMMAND) + +if(DB2PDF_FOUND) + mark_as_advanced(DB2PDF_ROOT_DIR) +endif() + +mark_as_advanced(DB2PDF_COMMAND) + +function(docbook_to_pdf _outvar) + set(INPUT ${ARGN}) + set(_out) + set(_outname) + + foreach(_file ${INPUT}) + get_filename_component(_base "${_file}" NAME_WE) + set(_outname "${CMAKE_CURRENT_BINARY_DIR}/${_base}.pdf") + list(APPEND _out "${_outname}") + if(DB2PDF_COMMAND) + add_custom_command(OUTPUT + "${_outname}" + COMMAND + ${DB2PDF_COMMAND} + -o + "${CMAKE_CURRENT_BINARY_DIR}" + "${_file}" + WORKING_DIRECTORY + "${CMAKE_CURRENT_SOURCE_DIR}" + MAIN_DEPENDENCY + "${_file}") + endif() + endforeach() + set(${_outvar} ${_out} PARENT_SCOPE) +endfunction() diff --git a/lib/wiiuse/cmake/FindosgLua.cmake b/lib/wiiuse/cmake/FindosgLua.cmake new file mode 100644 index 000000000..d6a682e64 --- /dev/null +++ b/lib/wiiuse/cmake/FindosgLua.cmake @@ -0,0 +1,71 @@ +# - try to find osgLua +# +# Users may optionally supply: +# OSGLUA_ROOT_DIR - a prefix to start searching +# +# Non-cache variables you might use in your CMakeLists.txt: +# OSGLUA_FOUND +# OSGLUA_INCLUDE_DIRS +# OSGLUA_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) + +set(OSGLUA_ROOT_DIR + "${OSGLUA_ROOT_DIR}" + CACHE + PATH + "Path to search for osgLua") + +### +# Dependencies +### +find_package(Lua51 QUIET) + +### +# Configure Luabind +### +find_path(OSGLUA_INCLUDE_DIR + NAMES + osgLua/Script + HINTS + "${OSGLUA_ROOT_DIR}" + PATH_SUFFIXES + include) +mark_as_advanced(OSGLUA_INCLUDE_DIR) + +find_library(OSGLUA_LIBRARY + NAMES + osgLua + HINTS + "${OSGLUA_ROOT_DIR}" + PATH_SUFFIXES + lib64 + lib) +mark_as_advanced(OSGLUA_LIBRARY) + +# 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(osgLua + DEFAULT_MSG + OSGLUA_LIBRARY + OSGLUA_INCLUDE_DIR + LUA_LIBRARIES + LUA_INCLUDE_DIR) + +if(OSGLUA_FOUND) + set(OSGLUA_INCLUDE_DIRS "${OSGLUA_INCLUDE_DIR}" "${LUA_INCLUDE_DIR}") + set(OSGLUA_LIBRARIES "${OSGLUA_LIBRARY}" ${LUA_LIBRARIES}) + mark_as_advanced(OSGLUA_ROOT_DIR) +endif() diff --git a/lib/wiiuse/cmake/Findquatlib.cmake b/lib/wiiuse/cmake/Findquatlib.cmake new file mode 100644 index 000000000..efca27f70 --- /dev/null +++ b/lib/wiiuse/cmake/Findquatlib.cmake @@ -0,0 +1,104 @@ +# - Find quatlib +# Find the quatlib headers and libraries. +# +# QUATLIB_INCLUDE_DIRS - where to find quat.h +# QUATLIB_LIBRARIES - List of libraries when using quatlib. +# QUATLIB_FOUND - True if quatlib found. +# +# 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(TARGET quat) + # Look for the header file. + find_path(QUATLIB_INCLUDE_DIR NAMES quat.h + PATHS ${quatlib_SOURCE_DIR}) + + set(QUATLIB_LIBRARY "quat") + +else() + set(QUATLIB_ROOT_DIR + "${QUATLIB_ROOT_DIR}" + CACHE + PATH + "Root directory to search for quatlib") + if(DEFINED VRPN_ROOT_DIR AND NOT QUATLIB_ROOT_DIR) + set(QUATLIB_ROOT_DIR "${VRPN_ROOT_DIR}") + mark_as_advanced(QUATLIB_ROOT_DIR) + endif() + + 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() + + # Look for the header file. + find_path(QUATLIB_INCLUDE_DIR + NAMES + quat.h + HINTS + "${QUATLIB_ROOT_DIR}" + PATH_SUFFIXES + include + PATHS + "${_progfiles}/VRPN" + "${_progfiles}/quatlib" + C:/usr/local + /usr/local) + + # Look for the library. + find_library(QUATLIB_LIBRARY + NAMES + quat.lib + libquat.a + HINTS + "${QUATLIB_ROOT_DIR}" + PATH_SUFFIXES + ${_libsuffixes} + PATHS + "${_progfiles}/VRPN" + "${_progfiles}/quatlib" + C:/usr/local + /usr/local) +endif() + +# handle the QUIETLY and REQUIRED arguments and set QUATLIB_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(quatlib + DEFAULT_MSG + QUATLIB_LIBRARY + QUATLIB_INCLUDE_DIR) + +if(QUATLIB_FOUND) + set(QUATLIB_LIBRARIES ${QUATLIB_LIBRARY}) + if(NOT WIN32) + list(APPEND QUATLIB_LIBRARIES m) + endif() + set(QUATLIB_INCLUDE_DIRS ${QUATLIB_INCLUDE_DIR}) + + mark_as_advanced(QUATLIB_ROOT_DIR) +else() + set(QUATLIB_LIBRARIES) + set(QUATLIB_INCLUDE_DIRS) +endif() + +mark_as_advanced(QUATLIB_LIBRARY QUATLIB_INCLUDE_DIR) diff --git a/lib/wiiuse/cmake/Findudev.cmake b/lib/wiiuse/cmake/Findudev.cmake new file mode 100644 index 000000000..ce454d576 --- /dev/null +++ b/lib/wiiuse/cmake/Findudev.cmake @@ -0,0 +1,77 @@ +# - try to find the udev library +# +# Cache Variables: (probably not for direct use in your scripts) +# UDEV_INCLUDE_DIR +# UDEV_SOURCE_DIR +# UDEV_LIBRARY +# +# Non-cache variables you might use in your CMakeLists.txt: +# UDEV_FOUND +# UDEV_INCLUDE_DIRS +# UDEV_LIBRARIES +# +# Requires these CMake modules: +# FindPackageHandleStandardArgs (known included with CMake >=2.6.2) +# +# Original Author: +# 2014 Kevin M. Godby +# +# 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(UDEV_ROOT_DIR + "${UDEV_ROOT_DIR}" + CACHE + PATH + "Directory to search for udev") + +find_package(PkgConfig QUIET) +if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_LIBUDEV libudev) +endif() + +find_library(UDEV_LIBRARY + NAMES + udev + PATHS + ${PC_LIBUDEV_LIBRARY_DIRS} + ${PC_LIBUDEV_LIBDIR} + HINTS + "${UDEV_ROOT_DIR}" + PATH_SUFFIXES + lib + ) + +get_filename_component(_libdir "${UDEV_LIBRARY}" PATH) + +find_path(UDEV_INCLUDE_DIR + NAMES + libudev.h + PATHS + ${PC_LIBUDEV_INCLUDE_DIRS} + ${PC_LIBUDEV_INCLUDEDIR} + HINTS + "${_libdir}" + "${_libdir}/.." + "${UDEV_ROOT_DIR}" + PATH_SUFFIXES + include + ) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(UDEV + DEFAULT_MSG + UDEV_LIBRARY + UDEV_INCLUDE_DIR + ) + +if(UDEV_FOUND) + list(APPEND UDEV_LIBRARIES ${UDEV_LIBRARY}) + list(APPEND UDEV_INCLUDE_DIRS ${UDEV_INCLUDE_DIR}) + mark_as_advanced(UDEV_ROOT_DIR) +endif() + +mark_as_advanced(UDEV_INCLUDE_DIR + UDEV_LIBRARY) + diff --git a/lib/wiiuse/cmake/GenerateCompatibilityVersionFile.cmake b/lib/wiiuse/cmake/GenerateCompatibilityVersionFile.cmake new file mode 100644 index 000000000..7ac28ed5f --- /dev/null +++ b/lib/wiiuse/cmake/GenerateCompatibilityVersionFile.cmake @@ -0,0 +1,83 @@ +#.rst: +# .. command:: generate_compatibility_version_file +# +# Create a version file for a project:: +# +# generate_compatibility_version_file( +# [VERSION ] +# COMPATIBILITY +# [C_ABI] +# [CXX_LAYOUT] +# [CXX_ABI]) + +#============================================================================= +# Copyright 2015 Sensics, Inc. +# Copyright 2012 Alexander Neundorf +# +# 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.) + + +include(CMakeParseArguments) +include(CMakePackageConfigHelpers) + +set(GCVF_DIR "${CMAKE_CURRENT_LIST_DIR}" CACHE INTERNAL "" FORCE) + +function(generate_compatibility_version_file _filename) + + set(options C_ABI CXX_LAYOUT CXX_ABI) + set(oneValueArgs VERSION COMPATIBILITY ) + set(multiValueArgs ) + cmake_parse_arguments(GCVF "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if(GCVF_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "Unknown keywords given to generate_compatibility_version_file(): ${GCVF_UNPARSED_ARGUMENTS}") + endif() + set(versionTemplateFile "${CMAKE_ROOT}/Modules/BasicConfigVersion-${GCVF_COMPATIBILITY}.cmake.in") + if(NOT EXISTS "${versionTemplateFile}") + message(FATAL_ERROR "Bad COMPATIBILITY value used for generate_compatibility_version_file(): \"${GCVF_COMPATIBILITY}\"") + endif() + + if(GCVF_CXX_ABI) + set(GCVF_CXX_LAYOUT TRUE) + endif() + if(GCVF_CXX_LAYOUT) + set(GCVF_C_ABI TRUE) + endif() + + if("${GCVF_VERSION}" STREQUAL "") + if("${PROJECT_VERSION}" STREQUAL "") + message(FATAL_ERROR "No VERSION specified for generate_compatibility_version_file()") + else() + set(GCVF_VERSION ${PROJECT_VERSION}) + endif() + endif() + + 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() + + set(PREV_FILE "${_filename}.cmakeversion") + write_basic_package_version_file("${PREV_FILE}" VERSION ${GCVF_VERSION} COMPATIBILITY ${GCVF_COMPATIBILITY}) + set(GCVF_BASIC TRUE) + foreach(level BASIC C_ABI CXX_LAYOUT CXX_ABI) + if(GCVF_${level}) + file(READ "${PREV_FILE}" GCVF_PREVIOUS_FILE) + set(PREV_FILE "${_filename}.${level}") + configure_file("${GCVF_DIR}/CompatibilityVersionFile-${level}.cmake.in" "${PREV_FILE}" @ONLY) + endif() + endforeach() + configure_file("${PREV_FILE}" "${_filename}" COPYONLY) +endfunction() \ No newline at end of file diff --git a/lib/wiiuse/cmake/GetCPUDetails.cmake b/lib/wiiuse/cmake/GetCPUDetails.cmake new file mode 100644 index 000000000..b29013c99 --- /dev/null +++ b/lib/wiiuse/cmake/GetCPUDetails.cmake @@ -0,0 +1,201 @@ +# - Set a number of variables to indicate things about the current CPU and OS +# +# CPU_COUNT +# CPU_INTEL +# CPU_EXE_64BIT +# CPU_EXE_32BIT +# CPU_HAS_SSE +# CPU_HAS_SSE2 +# CPU_HAS_SSE3 +# CPU_HAS_SSSE3 +# CPU_HAS_SSE4_1 +# CPU_HAS_SSE4_2 +# +# Requires these CMake modules: +# no additional modules required +# +# Original Author: +# 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_cpu_details) + return() +endif() +set(__get_cpu_details YES) + +function(get_cpu_details) + option(CPUDETAILS_VERBOSE + "Should we display results of the CPU info check?" + NO) + mark_as_advanced(CPUDETAILS_VERBOSE) + + ### See http://www.kitware.com/blog/home/post/63 + if(NOT DEFINED CPU_COUNT) + # Unknown: + set(CPU_COUNT 1) + # Linux: + set(cpuinfo_file "/proc/cpuinfo") + if(EXISTS "${cpuinfo_file}") + file(STRINGS "${cpuinfo_file}" procs REGEX "^processor.: [0-9]+$") + list(LENGTH procs CPU_COUNT) + endif() + # Mac: + if(APPLE) + find_program(cmd_sys_pro "system_profiler") + if(cmd_sys_pro) + execute_process(COMMAND ${cmd_sys_pro} OUTPUT_VARIABLE info) + string(REGEX REPLACE "^.*Total Number Of Cores: ([0-9]+).*$" "\\1" + CPU_COUNT "${info}") + endif() + endif() + # Windows: + if(WIN32) + set(CPU_COUNT "$ENV{NUMBER_OF_PROCESSORS}") + endif() + endif() + + ### + # CPU_INTEL + + if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "x86_64" OR "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "i[3456]86") + set(CPU_INTEL YES) + elseif(APPLE) + # Mac Intel boxes return i386 in 10.5 - so assume this is a PPC + set(CPU_INTEL NO) + else() + # TODO: Assuming yes in case of doubt - probably not a great idea + set(CPU_INTEL YES) + endif() + + set(CPU_INTEL + ${CPU_INTEL} + CACHE + INTERNAL + "Intel x86 or x86_64 architecture machine?") + + ### + # CPU_EXE_64BIT/32BIT + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(CPU_EXE_64BIT ON) + set(CPU_EXE_32BIT OFF) + else() + set(CPU_EXE_64BIT OFF) + set(CPU_EXE_32BIT ON) + endif() + + ### + # CPU_HAS_SSE/SSE2/SSE3/SSSE3/SSE4.1/SSE4.2 + if(CPU_INTEL) + if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + # Use /proc/cpuinfo to find this out. + file(STRINGS "/proc/cpuinfo" _cpuinfo) + if(_cpuinfo MATCHES "(sse)|(xmm)") + set(CPU_HAS_SSE YES) + else() + set(CPU_HAS_SSE NO) + endif() + + if(_cpuinfo MATCHES "(sse2)|(xmm2)") + set(CPU_HAS_SSE2 YES) + else() + set(CPU_HAS_SSE2 NO) + endif() + + if(_cpuinfo MATCHES "(sse3)|(xmm3)") + set(CPU_HAS_SSE3 YES) + else() + set(CPU_HAS_SSE3 NO) + endif() + + if(_cpuinfo MATCHES "ssse3") + set(CPU_HAS_SSSE3 YES) + else() + set(CPU_HAS_SSSE3 NO) + endif() + + if(_cpuinfo MATCHES "(sse4_1)|(xmm4_1)") + set(CPU_HAS_SSE4_1 YES) + else() + set(CPU_HAS_SSE4_1 NO) + endif() + + if(_cpuinfo MATCHES "(sse4_2)|(xmm4_2)") + set(CPU_HAS_SSE4_2 YES) + else() + set(CPU_HAS_SSE4_2 NO) + endif() + + elseif(APPLE) + # Mac OS X Intel requires SSE3 + set(CPU_HAS_SSE YES) + set(CPU_HAS_SSE2 YES) + set(CPU_HAS_SSE3 YES) + set(CPU_HAS_SSSE3 NO) + set(CPU_HAS_SSE4_1 NO) + set(CPU_HAS_SSE4_2 NO) + elseif(WIN32) + if(CPU_EXE_64BIT) + #TODO: Assume only common-denominator for 64-bit machines, + # since I don't know how to check. + set(CPU_HAS_SSE YES) + set(CPU_HAS_SSE2 YES) + set(CPU_HAS_SSE3 NO) + set(CPU_HAS_SSSE3 NO) + set(CPU_HAS_SSE4_1 NO) + set(CPU_HAS_SSE4_2 NO) + else() + #TODO: Assume no SSE, since I don't know how to check. + set(CPU_HAS_SSE NO) + set(CPU_HAS_SSE2 NO) + set(CPU_HAS_SSE3 NO) + set(CPU_HAS_SSSE3 NO) + set(CPU_HAS_SSE4_1 NO) + set(CPU_HAS_SSE4_2 NO) + endif() + endif() + endif() + + set(CPU_INTEL + ${CPU_INTEL} + CACHE + INTERNAL + "Intel x86 or x86_64 architecture machine?") + + foreach(_var + CPU_COUNT + CPU_EXE_64BIT + CPU_EXE_32BIT + CPU_HAS_SSE + CPU_HAS_SSE2 + CPU_HAS_SSE3 + CPU_HAS_SSSE3 + CPU_HAS_SSE4_1 + CPU_HAS_SSE4_2) + set(${_var} ${${_var}} CACHE INTERNAL "") + endforeach() + + if(CPUDETAILS_VERBOSE) + foreach(_var + CPU_COUNT + CPU_INTEL + CPU_EXE_64BIT + CPU_EXE_32BIT + CPU_HAS_SSE + CPU_HAS_SSE2 + CPU_HAS_SSE3 + CPU_HAS_SSSE3 + CPU_HAS_SSE4_1 + CPU_HAS_SSE4_2) + get_property(_help CACHE ${_var} PROPERTY HELPSTRING) + message(STATUS "[get_cpu_details] ${_var} (${_help}): ${${_var}}") + endforeach() + endif() +endfunction() diff --git a/lib/wiiuse/cmake/GetCompilerInfoString.cmake b/lib/wiiuse/cmake/GetCompilerInfoString.cmake new file mode 100644 index 000000000..1ee5b1f5a --- /dev/null +++ b/lib/wiiuse/cmake/GetCompilerInfoString.cmake @@ -0,0 +1,179 @@ +# - Utility function to return a human-useful-only string ID'ing the compiler +# +# get_compiler_info_string() +# +# and some helper functions: +# get_gcc_version() +# get_vs_short_version_string( ) +# +# You might consider using it when setting up CTest options, for example: +# include(GetCompilerInfoString) +# get_compiler_info_string(COMPILERID) +# set(CTEST_BUILD_NAME "${CMAKE_SYSTEM}-${CMAKE_SYSTEM_PROCESSOR}-${COMPILERID}") +# +# Requires these CMake modules: +# no additional modules required +# +# Original Author: +# 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) +# +# Some functions based on cmake-2.8.0 modules FindBoost.cmake and CTest.cmake +#============================================================================= +# Copyright 2006-2009 Kitware, Inc. +# Copyright 2006-2008 Andreas Schneider +# Copyright 2007 Wengo +# Copyright 2007 Mike Jackson +# Copyright 2008 Andreas Pakulat +# Copyright 2008-2009 Philip Lowman +# Copyright 2010 Iowa State University (Ryan Pavlik ) +# +# 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. +#============================================================================= +# CMake - Cross Platform Makefile Generator +# Copyright 2000-2009 Kitware, Inc., Insight Software Consortium +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +if(__get_compiler_info_string) + return() +endif() +set(__get_compiler_info_string YES) + + +function(get_compiler_info_string _var) + set(_out) + + if(CTEST_CMAKE_GENERATOR AND NOT CMAKE_GENERATOR) + # We're running in CTest - use that generator. + set(CMAKE_GENERATOR ${CTEST_CMAKE_GENERATOR}) + endif() + + if(NOT CMAKE_CXX_COMPILER) + # Also for use in CTest scripts + include(CMakeDetermineCXXCompiler) + endif() + + if(MSVC) + # Parse version for Visual Studio + get_vs_short_version_string("${CMAKE_GENERATOR}" _verstring) + if(${CMAKE_GENERATOR} MATCHES "Win64") + set(_verstring "${_verstring}win64") + endif() + + elseif(CMAKE_COMPILER_IS_GNUCXX) + # Parse version for GCC + get_gcc_version(_gccver) + set(_verstring "gcc${_gccver}") + + else() + # Some other compiler we don't handle in more detail yet. + string(REGEX REPLACE " " "_" _verstring "${CMAKE_GENERATOR}") + set(_verstring "${CMAKE_CXX_COMPILER_ID}:generator:${_verstring}") + endif() + + # Return _verstring + set(${_var} "${_verstring}" PARENT_SCOPE) +endfunction() + +## Based on a function in FindBoost.cmake from CMake 2.8.0 +#------------------------------------------------------------------------------- +# +# Runs compiler with "-dumpversion" and parses major/minor +# version with a regex. +# +function(get_gcc_version _var) + exec_program(${CMAKE_CXX_COMPILER} + ARGS + ${CMAKE_CXX_COMPILER_ARG1} + -dumpversion + OUTPUT_VARIABLE + _compilerinfo_COMPILER_VERSION) + + string(REGEX + MATCH + "([.0-9]+)" + "\\1" + _compilerinfo_COMPILER_VERSION + "${_compilerinfo_COMPILER_VERSION}") + + set(${_var} ${_compilerinfo_COMPILER_VERSION} PARENT_SCOPE) +endfunction() + +## Based on a function in CTest.cmake from CMake 2.8.0 +#------------------------------------------------------------------------------- +# +# function to turn generator name into a version string +# like vs7 vs71 vs8 vs9 +# +function(get_vs_short_version_string _generator _var) + set(_ver_string) + if("${_generator}" MATCHES "Visual Studio") + string(REGEX + REPLACE + "Visual Studio ([0-9][0-9]?)($|.*)" + "\\1" + _vsver + "${_generator}") + if("${_generator}" MATCHES "Visual Studio 7 .NET 2003") + # handle the weird one + set(_ver_string "vs71") + else() + set(_ver_string "vs${_vsver}") + endif() + elseif(MSVC) + if(MSVC71) + set(_ver_string "vs71") + else() + foreach(_ver 6 7 8 9 10) + if(MSVC${_ver}0) + set(_ver_string "vs${_ver}") + break() + endif() + endforeach() + endif() + endif() + + if(_ver_string) + set(${_var} ${_ver_string} PARENT_SCOPE) + endif() +endfunction() diff --git a/lib/wiiuse/cmake/GetDefineString.cmake b/lib/wiiuse/cmake/GetDefineString.cmake new file mode 100644 index 000000000..832fea8d1 --- /dev/null +++ b/lib/wiiuse/cmake/GetDefineString.cmake @@ -0,0 +1,58 @@ +# - Script to get the value of a preprocessor definition that is a string, +# after including the given files +# Requires that the associated source file be present: GetDefineString.cpp.in. +# +# get_define_string(NAME [INCLUDES ] RESULT +# [FLAGS ] +# [INCLUDE_DIRS ] +# [DEFINES] <-Ddefinitions>) +# Original Author: +# 2014 Ryan Pavlik +# +# Copyright Sensics, Inc. 2014. +# 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) + + +get_filename_component(_getdefinestring_moddir "${CMAKE_CURRENT_LIST_FILE}" PATH) + +function(get_define_string) + include(CMakeParseArguments) + cmake_parse_arguments(_gds "" "NAME;RESULT" "INCLUDES;FLAGS;INCLUDE_DIRS;DEFINES" ${ARGN}) + if(NOT _gds_NAME) + message(FATAL_ERROR "Must pass NAME to get_define_string!") + endif() + if(NOT _gds_RESULT) + message(FATAL_ERROR "Must pass RESULT to get_define_string!") + endif() + if(NOT DEFINED "${_gds_RESULT}_CHECKED" OR (NOT "${${_gds_RESULT}_CHECKED}" STREQUAL "${ARGN}")) + set(${_gds_RESULT}_CHECKED "${ARGN}" CACHE INTERNAL "" FORCE) + set(GET_DEFINE_STRING_NAME ${_gds_NAME}) + set(_INCLUDES) + if(_gds_INCLUDE_DIRS) + set(_INCLUDES "-DINCLUDE_DIRECTORIES:STRING=${_gds_INCLUDE_DIRS}") + endif() + set(GET_DEFINE_STRING_INCLUDES) + foreach(_file ${_gds_INCLUDES}) + set(GET_DEFINE_STRING_INCLUDES "${GET_DEFINE_STRING_INCLUDES}#include <${_file}>\n") + endforeach() + set(_src "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/GetDefineString${_gds_RESULT}.cpp") + set(_out "${CMAKE_CURRENT_BINARY_DIR}/GetDefineString${_gds_RESULT}.out") + configure_file("${_getdefinestring_moddir}/GetDefineString.cpp.in" "${_src}") + try_compile(_result "${CMAKE_CURRENT_BINARY_DIR}" SOURCES "${_src}" + CMAKE_FLAGS ${_INCLUDES} + COMPILE_DEFINITIONS ${_gds_DEFINES} + OUTPUT_VARIABLE OUTPUT + COPY_FILE "${_out}") + if(_result) + file(STRINGS "${_out}" _result_string REGEX "INFO:[A-Za-z0-9_]+\\[[^]]*\\]") + if("${_result_string}" MATCHES "INFO:define\\[([^]\"]*)\\]") + set(${_gds_RESULT}_CACHED "${CMAKE_MATCH_1}" CACHE INTERNAL "" FORCE) + endif() + else() + set(${_gds_RESULT}_CACHED NOTFOUND) + endif() + endif() + set(${_gds_RESULT} ${${_gds_RESULT}_CACHED} PARENT_SCOPE) +endfunction() \ No newline at end of file diff --git a/lib/wiiuse/cmake/GetDefineString.cpp.in b/lib/wiiuse/cmake/GetDefineString.cpp.in new file mode 100644 index 000000000..99cbbbc9d --- /dev/null +++ b/lib/wiiuse/cmake/GetDefineString.cpp.in @@ -0,0 +1,10 @@ +@GET_DEFINE_STRING_INCLUDES@ + +char const * info = "INFO" ":" "define[" @GET_DEFINE_STRING_NAME@ "]"; + +int main(int argc, char * argv[]) { + int require = 0; + require += info[argc]; + (void)argv; + return require; +} \ No newline at end of file diff --git a/lib/wiiuse/cmake/GetDirectoryList.cmake b/lib/wiiuse/cmake/GetDirectoryList.cmake new file mode 100644 index 000000000..60f2a0136 --- /dev/null +++ b/lib/wiiuse/cmake/GetDirectoryList.cmake @@ -0,0 +1,49 @@ +# - Returns a list of the parent directories of all files passed +# +# get_directory_list( [...]) +# +# 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_directory_list) + return() +endif() +set(__get_directory_list YES) + +function(get_directory_list _var) + # combine variable's current value with additional list items + set(_in ${ARGN}) + + if(_in) + # Initial list cleaning + list(REMOVE_DUPLICATES _in) + + # Grab the absolute path of each actual directory + set(_out) + foreach(_file ${_in}) + get_filename_component(_dir "${_file}" PATH) + if(IS_DIRECTORY "${_dir}") + get_filename_component(_dir "${_dir}" ABSOLUTE) + file(TO_CMAKE_PATH "${_dir}" _dir) + list(APPEND _out "${_dir}") + endif() + endforeach() + + if(_out) + # Clean up the output list now + list(REMOVE_DUPLICATES _out) + endif() + + # return _out + set(${_var} "${_out}" PARENT_SCOPE) + endif() +endfunction() diff --git a/lib/wiiuse/cmake/GetFileList.cmake b/lib/wiiuse/cmake/GetFileList.cmake new file mode 100644 index 000000000..2e0c3791e --- /dev/null +++ b/lib/wiiuse/cmake/GetFileList.cmake @@ -0,0 +1,45 @@ +# - Returns a list of the file names of all files passed +# +# get_file_list( [...]) +# +# 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_file_list) + return() +endif() +set(__get_file_list YES) + +function(get_file_list _var) + # combine variable's current value with additional list items + set(_in ${ARGN}) + + if(_in) + # Initial list cleaning + list(REMOVE_DUPLICATES _in) + + # Grab the absolute path of each actual directory + set(_out) + foreach(_file ${_in}) + get_filename_component(_fn "${_file}" FILE) + list(APPEND _out "${_fn}") + endforeach() + + if(_out) + # Clean up the output list now + list(REMOVE_DUPLICATES _out) + endif() + + # return _out + set(${_var} "${_out}" PARENT_SCOPE) + endif() +endfunction() diff --git a/lib/wiiuse/cmake/GetForceIncludeDefinitions.cmake b/lib/wiiuse/cmake/GetForceIncludeDefinitions.cmake new file mode 100644 index 000000000..efcca047b --- /dev/null +++ b/lib/wiiuse/cmake/GetForceIncludeDefinitions.cmake @@ -0,0 +1,44 @@ +# - Get the platform-appropriate flags to add to force inclusion of a file +# +# The most common use of this is to use a generated config.h-type file +# placed out of the source tree in all files. +# +# get_force_include_definitions(var forcedincludefiles...) - +# where var is the name of your desired output variable, and everything +# else is a source file to forcibly include. +# a list item to be filtered. +# +# 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_force_include_definitions) + return() +endif() +set(__get_force_include_definitions YES) + +function(get_force_include_definitions var) + set(_flagprefix) + if(CMAKE_COMPILER_IS_GNUCXX) + set(_flag "-include") + elseif(MSVC) + set(_flag "/FI") + else() + message(SEND_ERROR "You don't seem to be using MSVC or GCC, but") + message(SEND_ERROR "the project called get_force_include_definitions.") + message(SEND_ERROR "Contact this project with the name of your") + message(FATAL_ERROR "compiler and preferably the flag to force includes") + endif() + + set(_out) + foreach(_item ${ARGN}) + list(APPEND _out "${_flag} \"${_item}\"") + endforeach() + set(${var} "${_out}" PARENT_SCOPE) +endfunction() diff --git a/lib/wiiuse/cmake/GetGitRevisionDescription.cmake b/lib/wiiuse/cmake/GetGitRevisionDescription.cmake new file mode 100644 index 000000000..8ab03bc5f --- /dev/null +++ b/lib/wiiuse/cmake/GetGitRevisionDescription.cmake @@ -0,0 +1,168 @@ +# - 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. +# +# git_local_changes() +# +# Returns either "CLEAN" or "DIRTY" with respect to uncommitted changes. +# Uses the return code of "git diff-index --quiet HEAD --". +# Does not regard untracked files. +# +# 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_PARENT_DIR "${CMAKE_CURRENT_SOURCE_DIR}") + set(GIT_DIR "${GIT_PARENT_DIR}/.git") + while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories + set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}") + get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH) + if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT) + # We have reached the root directory, we are not in git + set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE) + set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE) + return() + endif() + set(GIT_DIR "${GIT_PARENT_DIR}/.git") + endwhile() + # check if this is a submodule + if(NOT IS_DIRECTORY ${GIT_DIR}) + file(READ ${GIT_DIR} submodule) + string(REGEX REPLACE "gitdir: (.*)\n$" "\\1" GIT_DIR_RELATIVE ${submodule}) + get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH) + get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE} ABSOLUTE) + endif() + set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data") + if(NOT EXISTS "${GIT_DATA}") + file(MAKE_DIRECTORY "${GIT_DATA}") + endif() + + if(NOT EXISTS "${GIT_DIR}/HEAD") + return() + 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_CURRENT_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() + +function(git_local_changes _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() + + execute_process(COMMAND + "${GIT_EXECUTABLE}" + diff-index --quiet HEAD -- + WORKING_DIRECTORY + "${CMAKE_CURRENT_SOURCE_DIR}" + RESULT_VARIABLE + res + OUTPUT_VARIABLE + out + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(res EQUAL 0) + set(${_var} "CLEAN" PARENT_SCOPE) + else() + set(${_var} "DIRTY" PARENT_SCOPE) + endif() +endfunction() diff --git a/lib/wiiuse/cmake/GetGitRevisionDescription.cmake.in b/lib/wiiuse/cmake/GetGitRevisionDescription.cmake.in new file mode 100644 index 000000000..6d8b708ef --- /dev/null +++ b/lib/wiiuse/cmake/GetGitRevisionDescription.cmake.in @@ -0,0 +1,41 @@ +# +# 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) + +set(HEAD_HASH) + +file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024) + +string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS) +if(HEAD_CONTENTS MATCHES "ref") + # named branch + string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}") + if(EXISTS "@GIT_DIR@/${HEAD_REF}") + configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY) + else() + configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY) + file(READ "@GIT_DATA@/packed-refs" PACKED_REFS) + if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}") + set(HEAD_HASH "${CMAKE_MATCH_1}") + endif() + endif() +else() + # detached HEAD + configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY) +endif() + +if(NOT HEAD_HASH) + file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024) + string(STRIP "${HEAD_HASH}" HEAD_HASH) +endif() diff --git a/lib/wiiuse/cmake/GetMSVCVersion.cmake b/lib/wiiuse/cmake/GetMSVCVersion.cmake new file mode 100644 index 000000000..48d7b7c17 --- /dev/null +++ b/lib/wiiuse/cmake/GetMSVCVersion.cmake @@ -0,0 +1,127 @@ +#.rst: +# GetMSVCVersion +# -------------- +# +# +# +# get_msvc_major_version() +# get_msvc_minor_version() +# get_msvc_combined_major_minor_version() +# get_msvc_major_minor_version( ) +# get_msvc_unique_decimal_version() +# +# This family of functions is designed to be used to convert +# MSVC_VERSION from the compiler version number to the Visual Studio +# decimal version number (2012 is 11.0, 2015 is 14.0). All take a name +# of a variable in to return their results in. +# +# Consider Visual Studio 2013, which reports 1800 in MSVC_VERSION (and +# the _MSC_VER preprocessor macro). It is also known as VS 12 or 12.0. +# (Minor versions are rarely used, except in the case of 7.1 aka +# VS.NET 2003) The functions would return this output for 2013: +# +# get_msvc_major_version: 12 +# get_msvc_minor_version: 0 +# get_msvc_combined_major_minor_version: 120 +# get_msvc_major_minor_version: 12 in , 0 in +# get_msvc_unique_decimal_version: 12 (this returns with a decimal and +# minor when needed to be precise, e.g. 7.1) +# +# The variable is not modified if not building with MSVC. + +#============================================================================= +# Copyright 2015 Ryan Pavlik +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# 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. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# This function serves as the main implementation, with the others just +# tweaking the result. +function(get_msvc_combined_major_minor_version _var) + if(NOT MSVC) + return() + endif() + math(EXPR _vs_ver "${MSVC_VERSION} / 10 - 60") + + # VS 2015 changed the pattern because they skipped VS 13 + if(_vs_ver GREATER 120) + math(EXPR _vs_ver "${_vs_ver} + 10") + endif() + set(${_var} ${_vs_ver} PARENT_SCOPE) +endfunction() + +# This function is also used as backend to some implementation, though +# its contents are simpler, no real business logic to speak of. +function(get_msvc_major_minor_version _major_var _minor_var) + if(NOT MSVC) + return() + endif() + get_msvc_combined_major_minor_version(_vs_ver) + + math(EXPR _vs_minor "${_vs_ver} % 10") + math(EXPR _vs_major "(${_vs_ver} - ${_vs_minor}) / 10") + set(${_major_var} ${_vs_major} PARENT_SCOPE) + set(${_minor_var} ${_vs_minor} PARENT_SCOPE) +endfunction() + +function(get_msvc_major_version _var) + if(NOT MSVC) + return() + endif() + get_msvc_major_minor_version(_vs_ver _dummy) + set(${_var} ${_vs_ver} PARENT_SCOPE) +endfunction() + +function(get_msvc_minor_version _var) + if(NOT MSVC) + return() + endif() + get_msvc_major_minor_version(_dummy _vs_ver) + set(${_var} ${_vs_ver} PARENT_SCOPE) +endfunction() + +function(get_msvc_unique_decimal_version _var) + if(NOT MSVC) + return() + endif() + get_msvc_major_minor_version(_vs_major _vs_minor) + set(_vs_ver ${_vs_major}) + if(_vs_minor GREATER 0) + set(_vs_ver "${_vs_ver}.${_vs_minor}") + endif() + set(${_var} ${_vs_ver} PARENT_SCOPE) +endfunction() diff --git a/lib/wiiuse/cmake/GetSubprojectStatus.cmake b/lib/wiiuse/cmake/GetSubprojectStatus.cmake new file mode 100644 index 000000000..888a2caec --- /dev/null +++ b/lib/wiiuse/cmake/GetSubprojectStatus.cmake @@ -0,0 +1,31 @@ +# - Returns whether the current project is on its own or within another project's build +# +# get_subproject_status() - resultvar will be YES if we are +# included in another project, or NO if we are being built separately +# +# 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_subproject_status) + return() +endif() +set(__get_subproject_status YES) + +function(get_subproject_status _var) + if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") + # Base source dir is our source dir - we are top-level + set(${_var} NO PARENT_SCOPE) + else() + # Base source dir is not our source dir - we are a subproject + set(${_var} YES PARENT_SCOPE) + endif() +endfunction() diff --git a/lib/wiiuse/cmake/InstallDebugSymbols.cmake b/lib/wiiuse/cmake/InstallDebugSymbols.cmake new file mode 100644 index 000000000..25cd6bae8 --- /dev/null +++ b/lib/wiiuse/cmake/InstallDebugSymbols.cmake @@ -0,0 +1,85 @@ +# Defines a function to install the symbols for a target +# +# install_debug_symbols(TARGETS [...] [DESTINATION ] +# [CONFIGURATIONS [...]] [PASSTHRU [...]]) +# +# DESTINATION is only optional if CMAKE_INSTALL_BINDIR and CMAKE_INSTALL_LIBDIR are set, +# then it will use CMAKE_INSTALL_BINDIR for executables (and DLLs) and CMAKE_INSTALL_LIBDIR +# for libraries (static libraries only on DLL platforms). +# +# CONFIGURATIONS are the config names for which symbols (PDB files) are expected - +# the default of RelWithDebInfo Debug is correct unless you've dramatically changed +# the set of configs. +# +# Anything after PASSTHRU is passed directly to the install( command after the arguments +# that the function generates. +# +# Currently a no-op if using CMake pre-3.2 (can't use generator expressions before then +# to get symbol location) or if not using MSVC (MSVC keeps its symbols separate in PDB files +# necessitating this function in the first place). +# +# Original Author: +# 2015, 2017 Ryan Pavlik +# http://ryanpavlik.com +# +# Copyright Sensics, Inc. 2015, 2017. +# 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(MSVC AND NOT CMAKE_VERSION VERSION_LESS 3.2) + include(CMakeParseArguments) + # debug symbols for MSVC: supported on CMake 3.2 and up where there's a + # generator expression for a target's PDB file + function(install_debug_symbols) + set(options) + set(oneValueArgs DESTINATION) + set(multiValueArgs TARGETS CONFIGURATIONS PASSTHRU) + cmake_parse_arguments(INSTALLSYMS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if(NOT INSTALLSYMS_DESTINATION AND NOT CMAKE_INSTALL_BINDIR AND NOT CMAKE_INSTALL_LIBDIR) + message(SEND_ERROR "install_debug_symbols call missing required DESTINATION argument") + return() + endif() + if(NOT INSTALLSYMS_TARGETS) + message(SEND_ERROR "install_debug_symbols call missing required TARGETS argument") + return() + endif() + if(NOT INSTALLSYMS_CONFIGURATIONS) + set(INSTALLSYMS_CONFIGURATIONS RelWithDebInfo Debug) + endif() + + # Wrap each config in a generator expression + set(HAS_SYMBOLS_CONDITION) + foreach(_config ${INSTALLSYMS_CONFIGURATIONS}) + list(APPEND HAS_SYMBOLS_CONDITION "$") + endif() + # make list comma separated + string(REPLACE ";" "," HAS_SYMBOLS_CONDITION "${HAS_SYMBOLS_CONDITION}") + # Wrap in an "OR" generator expression + set(HAS_SYMBOLS_CONDITION "$") + + set(EXTRA_INSTALL_ARGS ${INSTALLSYMS_PASSTHRU} ${INSTALLSYMS_UNPARSED_ARGUMENTS}) + if(INSTALLSYMS_DESTINATION) + set(DEST ${INSTALLSYMS_DESTINATION}) + endif() + foreach(_target ${INSTALLSYMS_TARGETS}) + if(NOT INSTALLSYMS_DESTINATION) + get_target_property(_target_type ${_target} TYPE) + if("${_target_type}" STREQUAL "EXECUTABLE" OR "${_target_type}" STREQUAL "SHARED_LIBRARY") + # exe or dll: put it alongside the runtime component + set(DEST ${CMAKE_INSTALL_BINDIR}) + else() + set(DEST ${CMAKE_INSTALL_LIBDIR}) + endif() + endif() + install(FILES $<${HAS_SYMBOLS_CONDITION}:$> + DESTINATION ${DEST} + ${EXTRA_INSTALL_ARGS}) + endforeach() + endfunction() +else() + function(install_debug_symbols) + # do nothing if too old of CMake or not MSVC. + endfunction() +endif() diff --git a/lib/wiiuse/cmake/LICENSE_1_0.txt b/lib/wiiuse/cmake/LICENSE_1_0.txt new file mode 100644 index 000000000..36b7cd93c --- /dev/null +++ b/lib/wiiuse/cmake/LICENSE_1_0.txt @@ -0,0 +1,23 @@ +Boost Software License - Version 1.0 - August 17th, 2003 + +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, unless such copies or derivative +works are solely in the form of machine-executable object code generated by +a source language processor. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/lib/wiiuse/cmake/Licensing.cmake b/lib/wiiuse/cmake/Licensing.cmake new file mode 100644 index 000000000..dae8e8b5a --- /dev/null +++ b/lib/wiiuse/cmake/Licensing.cmake @@ -0,0 +1,133 @@ +# - Building a licensing description file +# +# 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) + +define_property(GLOBAL + PROPERTY + PROPRIETARY_LICENSES + BRIEF_DOCS + "Text for proprietary licenses" + FULL_DOCS + "Text for proprietary licenses") +define_property(GLOBAL + PROPERTY + SHAREALIKE_LICENSES + BRIEF_DOCS + "Text for share-alike licenses" + FULL_DOCS + "Text for share-alike licenses (e.g. GPL)") +define_property(GLOBAL + PROPERTY + PERMISSIVE_LICENSES + BRIEF_DOCS + "Text for permissive licenses" + FULL_DOCS + "Text for permissive licenses (e.g. BSD, MIT, X11)") +define_property(GLOBAL + PROPERTY + PACKAGES_LICENSED + BRIEF_DOCS + "List of all packages whose licenses are registered here" + FULL_DOCS + "List of all packages whose licenses are registered here") +define_property(GLOBAL + PROPERTY + REDISTRIBUTION_WARNINGS + BRIEF_DOCS + "Text for important redistribution warnings" + FULL_DOCS + "Text for important redistribution warnings, such as 'This is not redistributable!'") + + +function(add_license LICENSE_TYPE_PROPERTY package license) + get_property(def GLOBAL PROPERTY LICENSE_PACKAGE_${package} DEFINED) + if(NOT def) + define_property(GLOBAL + PROPERTY + LICENSE_PACKAGE_${package} + BRIEF_DOCS + "Flag to indicate the addition of the license for ${package}" + FULL_DOCS + "Flag to indicate the addition of the license for ${package}") + get_property(existing GLOBAL PROPERTY ${LICENSE_TYPE_PROPERTY}) + set_property(GLOBAL + PROPERTY + ${LICENSE_TYPE_PROPERTY} + "${existing}${license}\n\n") + + if(ARGN) + define_property(GLOBAL + PROPERTY + LICENSE_EXTRAS_PACKAGE_${package} + BRIEF_DOCS + "Extras (like URL) for the license for ${package}" + FULL_DOCS + "Extras (like URL) for the license for ${package}") + set_property(GLOBAL + PROPERTY + LICENSE_EXTRAS_PACKAGE_${package} + "${ARGN}") + endif() + + get_property(allpackages GLOBAL PROPERTY PACKAGES_LICENSED) + list(APPEND allpackages "${package}") + set_property(GLOBAL PROPERTY PACKAGES_LICENSED "${allpackages}") + endif() +endfunction() + +function(add_proprietary_license package license) + add_license(PROPRIETARY_LICENSES "${package}" "${license}" ${ARGN}) +endfunction() + +function(add_sharealike_license package license) + add_license(SHAREALIKE_LICENSES "${package}" "${license}" ${ARGN}) +endfunction() + +function(add_permissive_license package license) + add_license(PERMISSIVE_LICENSES "${package}" "${license}" ${ARGN}) +endfunction() + +function(add_redistribution_warning warning) + get_property(existing GLOBAL PROPERTY REDISTRIBUTION_WARNINGS) + set_property(GLOBAL + PROPERTY + REDISTRIBUTION_WARNINGS + "${warning} ${existing}") +endfunction() + +function(configure_license_file input output) + get_property(PACKAGES_LICENSED GLOBAL PROPERTY PACKAGES_LICENSED) + if(PACKAGES_LICENSED) + list(SORT PACKAGES_LICENSED) + set(PACKAGES_LICENSED_BULLETED) + foreach(package ${PACKAGES_LICENSED}) + set(EXTRAS) + get_property(package_extras + GLOBAL + PROPERTY + "LICENSE_EXTRAS_PACKAGE_${package}") + if(package_extras) + set(EXTRAS " ${package_extras}") + endif() + set(PACKAGES_LICENSED_BULLETED + "${PACKAGES_LICENSED_BULLETED} * ${package}${EXTRAS}\n") + endforeach() + endif() + get_property(REDISTRIBUTION_WARNINGS + GLOBAL + PROPERTY + REDISTRIBUTION_WARNINGS) + get_property(PROPRIETARY_LICENSES GLOBAL PROPERTY PROPRIETARY_LICENSES) + get_property(SHAREALIKE_LICENSES GLOBAL PROPERTY SHAREALIKE_LICENSES) + get_property(PERMISSIVE_LICENSES GLOBAL PROPERTY PERMISSIVE_LICENSES) + configure_file("${input}" "${output}" ${ARGN}) +endfunction() + diff --git a/lib/wiiuse/cmake/ListCombinations.cmake b/lib/wiiuse/cmake/ListCombinations.cmake new file mode 100644 index 000000000..4321f624a --- /dev/null +++ b/lib/wiiuse/cmake/ListCombinations.cmake @@ -0,0 +1,53 @@ +# - Combine lists of prefixes and suffixes in all combinations +# +# list_combinations(var PREFIXES listitems... SUFFIXES listitems...) - +# where var is the name of your desired output variable and PREFIXES +# and SUFFIXES are special arguments that indicate the start of your +# list of prefixes or suffixes respectively. +# +# 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(__list_combinations) + return() +endif() +set(__list_combinations YES) + +function(list_combinations var) + # Parse arguments + set(_prefixes) + set(_suffixes) + set(_nowhere) + set(_curdest _nowhere) + foreach(_element ${ARGN}) + if("${_element}" STREQUAL "PREFIXES") + set(_curdest _prefixes) + elseif("${_element}" STREQUAL "SUFFIXES") + set(_curdest _suffixes) + else() + list(APPEND ${_curdest} "${_element}") + endif() + endforeach() + if(_nowhere) + message(STATUS "_prefixes ${_prefixes}") + message(STATUS "_prefixes ${_suffixes}") + message(STATUS "_prefixes ${_nowhere}") + message(FATAL_ERROR + "Syntax error in use of ${CMAKE_CURRENT_LIST_FILE}") + endif() + + foreach(_prefix ${_prefixes}) + foreach(_suffix ${_suffixes}) + list(APPEND _out "${_prefix}${_suffix}") + endforeach() + endforeach() + + set(${var} "${_out}" PARENT_SCOPE) +endfunction() diff --git a/lib/wiiuse/cmake/ListFilter.cmake b/lib/wiiuse/cmake/ListFilter.cmake new file mode 100644 index 000000000..037859520 --- /dev/null +++ b/lib/wiiuse/cmake/ListFilter.cmake @@ -0,0 +1,50 @@ +# - List filtering functions +# +# list_filter(var regex listitems...) - where var is the name of +# your desired output variable, regex is the regex whose matching items +# WILL be put in the output variable, and everything else is considered +# a list item to be filtered. +# +# list_filter_out(var regex listitems...) - where var is the name of +# your desired output variable, regex is the regex whose matching items +# will NOT be put in the output variable, and everything else is considered +# a list item to be filtered. +# +# 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(__list_filter_out) + return() +endif() +set(__list_filter_out YES) + +function(list_filter_out var regex) + set(_out) + foreach(_item ${ARGN}) + set(_re) + string(REGEX MATCH "${regex}" _re "${_item}") + if(NOT _re) + list(APPEND _out "${_item}") + endif() + endforeach() + set(${var} "${_out}" PARENT_SCOPE) +endfunction() + +function(list_filter var regex) + set(_out) + foreach(_item ${ARGN}) + set(_re) + string(REGEX MATCH "${regex}" _re "${_item}") + if(_re) + list(APPEND _out "${_item}") + endif() + endforeach() + set(${var} "${_out}" PARENT_SCOPE) +endfunction() diff --git a/lib/wiiuse/cmake/LuaTargets.cmake b/lib/wiiuse/cmake/LuaTargets.cmake new file mode 100644 index 000000000..040f6b44a --- /dev/null +++ b/lib/wiiuse/cmake/LuaTargets.cmake @@ -0,0 +1,108 @@ +# - Copy/parse lua source files as a custom target +# +# include(LuaTargets) +# add_lua_target( [ ]) +# Relative paths for the destination directory are considered with +# with respect to CMAKE_CURRENT_BINARY_DIR +# +# install_lua_target( [arguments to INSTALL(PROGRAMS ...) ]) +# +# Set this variable to specify location of luac, if it is not a target: +# LUA_TARGET_LUAC_EXECUTABLE +# +# 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(__add_lua) + return() +endif() +set(__add_lua YES) + +include(FileCopyTargets) + +function(add_lua_target _target _dest) + + if(NOT ARGN) + message(WARNING + "In add_lua_target call for target ${_target}, no source files were specified!") + return() + endif() + + if(NOT LUA_TARGET_LUAC_EXECUTABLE) + if(TARGET luac) + set(LUA_TARGET_LUAC_EXECUTABLE luac) + mark_as_advanced(LUA_TARGET_LUAC_EXECUTABLE) + else() + find_program(LUA_TARGET_LUAC_EXECUTABLE NAMES luac) + endif() + endif() + + if(NOT LUA_TARGET_LUAC_EXECUTABLE) + message(FATAL_ERROR + "Can't find luac: please give LUA_TARGET_LUAC_EXECUTABLE a useful value - currently ${LUA_TARGET_LUAC_EXECUTABLE}") + endif() + mark_as_advanced(LUA_TARGET_LUAC_EXECUTABLE) + + set(ALLFILES) + set(SOURCES) + foreach(fn ${ARGN}) + # Produce an absolute path to the input file + if(IS_ABSOLUTE "${fn}") + get_filename_component(fullpath "${fn}" ABSOLUTE) + get_filename_component(fn "${fn}" NAME) + else() + get_filename_component(fullpath + "${CMAKE_CURRENT_SOURCE_DIR}/${fn}" + ABSOLUTE) + endif() + + # Clean up output file name + get_filename_component(absout "${_dest}/${fn}" ABSOLUTE) + + add_custom_command(OUTPUT "${absout}" + COMMAND + ${CMAKE_COMMAND} + ARGS -E make_directory "${_dest}" + COMMAND + ${CMAKE_COMMAND} + ARGS -E copy "${fullpath}" "${_dest}" + COMMAND + "${LUA_TARGET_LUAC_EXECUTABLE}" + ARGS -p "${fullpath}" + MAIN_DEPENDENCY "${fullpath}" + VERBATIM + COMMENT "Copying ${fn} to ${absout} and parsing...") + list(APPEND SOURCES "${fullpath}") + list(APPEND ALLFILES "${absout}") + endforeach() + + # Custom target depending on all the file copy commands + add_custom_target(${_target} + SOURCES ${SOURCES} + DEPENDS ${ALLFILES}) + if(TARGET "${LUA_TARGET_LUAC_EXECUTABLE}") + get_property(_luac_imported + TARGET + "${LUA_TARGET_LUAC_EXECUTABLE}" + PROPERTY + IMPORTED) + if(NOT _luac_imported) + add_dependencies(${_target} ${LUA_TARGET_LUAC_EXECUTABLE}) + endif() + endif() + + set_property(TARGET ${_target} PROPERTY FILE_COPY_TARGET YES) +endfunction() + +function(install_lua_target) + install_file_copy_target(${ARGN}) +endfunction() diff --git a/lib/wiiuse/cmake/MSVCMultipleProcessCompile.cmake b/lib/wiiuse/cmake/MSVCMultipleProcessCompile.cmake new file mode 100644 index 000000000..aad4eabde --- /dev/null +++ b/lib/wiiuse/cmake/MSVCMultipleProcessCompile.cmake @@ -0,0 +1,31 @@ +# - Compile with multiple processes on MSVC +# +# include(MSVCMultipleProcessCompile) +# +# Requires these CMake modules: +# ListCombinations.cmake +# +# 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(MSVC AND NOT "${MSVC_VERSION}" LESS 1400) + # Only available in VS 2005 and newer + string(TOUPPER "${CMAKE_CONFIGURATION_TYPES}" _conftypesUC) + include(ListCombinations) + list_combinations(_varnames + PREFIXES + CMAKE_C_FLAGS_ + CMAKE_CXX_FLAGS_ + SUFFIXES + ${_conftypesUC}) + foreach(_var ${_varnames}) + set(${_var} "${${_var}} /MP") + endforeach() +endif() diff --git a/lib/wiiuse/cmake/MSVCStaticRuntime.cmake b/lib/wiiuse/cmake/MSVCStaticRuntime.cmake new file mode 100644 index 000000000..e4ceea6f9 --- /dev/null +++ b/lib/wiiuse/cmake/MSVCStaticRuntime.cmake @@ -0,0 +1,33 @@ +# - Modify compile flags to use the static runtimes of MSVC +# +# include(MSVCStaticRuntime) +# +# Requires these CMake modules: +# ListCombinations.cmake +# +# 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(MSVC) + string(TOUPPER "${CMAKE_CONFIGURATION_TYPES}" _conftypesUC) + include(ListCombinations) + list_combinations(_varnames + PREFIXES + CMAKE_C_FLAGS_ + CMAKE_CXX_FLAGS_ + SUFFIXES + ${_conftypesUC}) + foreach(_var ${_varnames}) + string(REPLACE "/MDd" "/MTd" ${_var} "${${_var}}") + string(REPLACE "/MD" "/MT" ${_var} "${${_var}}") + endforeach() +endif() + +set(Boost_USE_STATIC_LIBS ON) diff --git a/lib/wiiuse/cmake/MSVCVerboseLinking.cmake b/lib/wiiuse/cmake/MSVCVerboseLinking.cmake new file mode 100644 index 000000000..84d4a2278 --- /dev/null +++ b/lib/wiiuse/cmake/MSVCVerboseLinking.cmake @@ -0,0 +1,48 @@ +# - Add appropriate linker flags to show link details on Visual Studio +# +# include(MSVCVerboseLinking) - to add the flags automaticlly if applicable +# +# Be sure to include this module _BEFORE_ adding your targets, or the targets +# won't pick up the updated flags. +# +# Requires these CMake modules: +# - none +# +# Original Author: +# 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(MSVC) + if(NOT DEFINED MSVC_LINK_REALLY_VERBOSE) + if(IN_DASHBOARD_SCRIPT) + set(MSVC_LINK_REALLY_VERBOSE TRUE) + else() + set(MSVC_LINK_REALLY_VERBOSE FALSE) + endif() + endif() + set(MSVC_LINK_REALLY_VERBOSE + "${MSVC_LINK_REALLY_VERBOSE}" + CACHE + BOOL + "Provide maximum linker messages?") + mark_as_advanced(MSVC_LINK_REALLY_VERBOSE) + + if(MSVC_LINK_REALLY_VERBOSE) + set(_verbose_flag "/VERBOSE") + else() + set(_verbose_flag "/VERBOSE:LIB") + endif() + + set(CMAKE_EXE_LINKER_FLAGS + "${CMAKE_EXE_LINKER_FLAGS} ${_verbose_flag}") + set(CMAKE_MODULE_LINKER_FLAGS + "${CMAKE_MODULE_LINKER_FLAGS} ${_verbose_flag}") + set(CMAKE_SHARED_LINKER_FLAGS + "${CMAKE_SHARED_LINKER_FLAGS} ${_verbose_flag}") +endif() diff --git a/lib/wiiuse/cmake/MapImportedReleaseVariants.cmake b/lib/wiiuse/cmake/MapImportedReleaseVariants.cmake new file mode 100644 index 000000000..cd4ce93fc --- /dev/null +++ b/lib/wiiuse/cmake/MapImportedReleaseVariants.cmake @@ -0,0 +1,21 @@ +# Sets CMAKE_MAP_IMPORTED_CONFIG_* so that if there isn't a perfect match between +# the current project's build type and the imported build, but they're both some +# kind of "Release" variant, things will just work. +# +# Original Author: +# 2015 Ryan Pavlik +# http://academic.cleardefinition.com +# +# Copyright Sensics, Inc. 2015. +# 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) + +# RelWithDebInfo falls back to Release, then MinSizeRel +set(CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO RelWithDebInfo Release MinSizeRel NoConfig) + +# MinSizeRel falls back to Release, then RelWithDebInfo +set(CMAKE_MAP_IMPORTED_CONFIG_MINSIZEREL MinSizeRel Release RelWithDebInfo NoConfig) + +# Release falls back to RelWithDebInfo, then MinSizeRel +set(CMAKE_MAP_IMPORTED_CONFIG_RELEASE Release RelWithDebInfo MinSizeRel NoConfig) diff --git a/lib/wiiuse/cmake/MinGWSearchPathExtras.cmake b/lib/wiiuse/cmake/MinGWSearchPathExtras.cmake new file mode 100644 index 000000000..cd9fe69bb --- /dev/null +++ b/lib/wiiuse/cmake/MinGWSearchPathExtras.cmake @@ -0,0 +1,94 @@ +# - Additional help finding search paths on MinGW distributions, including MSYS2. +# +# Much of this is really more in the purview of CMake or the packages of CMake for +# those distributions, but if I can centralize/simplify the pain here, it's worth doing. +# +# Variables: (all are internal cache variables) +# MINGWSEARCH_INCLUDE_DIRS - use under PATHS in your find_path() commands +# MINGWSEARCH_LIBRARY_DIRS - use under PATHS in your find_library() commands +# MINGWSEARCH_PREFIXES - suitable for temporary use in CMAKE_FIND_ROOT_PATH or CMAKE_PREFIX_PATH. +# MINGWSEARCH_TARGET_TRIPLE - something like x86_64-w64-mingw32 or i686-w64-mingw32, use as you see fit. +# +# Original Author: +# 2016 Ryan Pavlik +# +# Copyright Sensics, Inc. 2016. +# 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(MINGW AND NOT MINGWSEARCH_COMPLETED) + ### + # Helper function + ### + function(_mingwsearch_conditional_add _var _path) + #message(STATUS "conditional add to ${_var}: ${_path}") + if(("${_path}" MATCHES "registry") OR (NOT IS_DIRECTORY "${_path}")) + # Path invalid - do not add + return() + endif() + list(FIND ${_var} "${_path}" _idx) + if(_idx GREATER -1) + # Path already in list - do not add + return() + endif() + # Not yet in the list, so we'll add it + list(APPEND ${_var} "${_path}") + set(${_var} ${${_var}} PARENT_SCOPE) + endfunction() + + # Clear the working variables. + set(MINGWSEARCH_INCLUDE_DIRS_WORK) + set(MINGWSEARCH_LIBRARY_DIRS_WORK) + set(MINGWSEARCH_PREFIXES_WORK) + set(_mingw_target_triple) + + # Try to find the string like x86_64-w64-mingw32 by parsing the implicit link directories... + # TODO this is a hack that either should be resolved in CMake or in MSYS2's package of CMake. + foreach(_link_dir ${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES}) + _mingwsearch_conditional_add(MINGWSEARCH_LIBRARY_DIRS_WORK "${_link_dir}") + if("${_link_dir}" MATCHES "/([^/]*-mingw32)/lib") + set(_mingw_target_triple ${CMAKE_MATCH_1}) + get_filename_component(_mingw_internal_basedir "${_link_dir}" PATH) + # Try adding the parallel include dir + if(IS_DIRECTORY "${_mingw_internal_basedir}/include") + _mingwsearch_conditional_add(MINGWSEARCH_INCLUDE_DIRS_WORK "${_mingw_internal_basedir}/include") + _mingwsearch_conditional_add(MINGWSEARCH_PREFIXES_WORK "${_mingw_internal_basedir}") + endif() + if(NOT CMAKE_CROSSCOMPILING) + # Try going up a level, since the directory with the target is usually a sibling to the main prefix. + get_filename_component(_mingw_main_basedir_candidate "${_mingw_internal_basedir}/.." ABSOLUTE) + if(IS_DIRECTORY "${_mingw_main_basedir_candidate}/include" AND NOT ("${_mingw_main_basedir_candidate}" STREQUAL "${_mingw_internal_basedir}")) + # If we could go up a level, add that include dir too. + _mingwsearch_conditional_add(MINGWSEARCH_INCLUDE_DIRS_WORK "${_mingw_main_basedir_candidate}/include") + _mingwsearch_conditional_add(MINGWSEARCH_PREFIXES_WORK "${_mingw_main_basedir_candidate}") + endif() + endif() + endif() + endforeach() + + ### + # Output results. + ### + if(MINGWSEARCH_INCLUDE_DIRS_WORK) + set(MINGWSEARCH_INCLUDE_DIRS "${MINGWSEARCH_INCLUDE_DIRS_WORK}" CACHE INTERNAL "" FORCE) + #message(STATUS "MINGWSEARCH_INCLUDE_DIRS ${MINGWSEARCH_INCLUDE_DIRS}") + endif() + + if(MINGWSEARCH_LIBRARY_DIRS_WORK) + set(MINGWSEARCH_LIBRARY_DIRS "${MINGWSEARCH_LIBRARY_DIRS_WORK}" CACHE INTERNAL "" FORCE) + #message(STATUS "MINGWSEARCH_LIBRARY_DIRS ${MINGWSEARCH_LIBRARY_DIRS}") + endif() + + if(MINGWSEARCH_PREFIXES_WORK) + set(MINGWSEARCH_PREFIXES "${MINGWSEARCH_PREFIXES_WORK}" CACHE INTERNAL "" FORCE) + #message(STATUS "MINGWSEARCH_PREFIXES ${MINGWSEARCH_PREFIXES}") + endif() + + if(_mingw_target_triple) + set(MINGWSEARCH_TARGET_TRIPLE ${_mingw_target_triple} CACHE INTERNAL "" FORCE) + #message(STATUS "MINGWSEARCH_TARGET_TRIPLE ${MINGWSEARCH_TARGET_TRIPLE}") + endif() + + set(MINGWSEARCH_COMPLETED TRUE CACHE INTERNAL "" FORCE) +endif() diff --git a/lib/wiiuse/cmake/OptionRequires.cmake b/lib/wiiuse/cmake/OptionRequires.cmake new file mode 100644 index 000000000..662121f57 --- /dev/null +++ b/lib/wiiuse/cmake/OptionRequires.cmake @@ -0,0 +1,53 @@ +# - Add an option that depends on one or more variables being true. +# +# option_requires( [...]) +# +# 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) + +function(option_requires name desc) + set(args ${ARGN}) + + set(OFF_BY_DEFAULT false) + list(FIND args "OFF_BY_DEFAULT" _off_found) + if(NOT _off_found EQUAL -1) + list(REMOVE_AT args ${_off_found}) + set(OFF_BY_DEFAULT true) + endif() + + set(found) + set(missing) + foreach(var ${args}) + if(${var}) + list(APPEND found ${var}) + else() + list(APPEND missing ${var}) + endif() + endforeach() + + if(NOT missing) + set(OK TRUE) + else() + set(OK FALSE) + endif() + + set(default ${OK}) + if(OFF_BY_DEFAULT) + set(default OFF) + endif() + + option(${name} "${desc}" ${default}) + + if(${name} AND (NOT OK)) + message(FATAL_ERROR + "${name} enabled but these dependencies were not valid: ${missing}") + endif() + +endfunction() diff --git a/lib/wiiuse/cmake/PlatformDefinitions.cmake b/lib/wiiuse/cmake/PlatformDefinitions.cmake new file mode 100644 index 000000000..17f71e6b0 --- /dev/null +++ b/lib/wiiuse/cmake/PlatformDefinitions.cmake @@ -0,0 +1,45 @@ +# Defines a series of preprocessor variables based on the current platform. +# +# Usage: define_platform_macros(PREFIX) +# +# where PREFIX is the macro prefix (i.e., if PREFIX is XYZZY then the macros +# will be named XYZZY_LINUX, XYZZY_WINDOWS, etc.). +# +# Author: +# Kevin M. Godby +# +# 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) +# + +function(_define_platform_macros_impl prefix platform_string variable_name) + if (${CMAKE_SYSTEM_NAME} MATCHES "${platform_string}") + string(TOUPPER "${prefix}_${variable_name}" _varname) + set(${_varname} TRUE PARENT_SCOPE) + endif() +endfunction() + +macro(define_platform_macros _prefix) + _define_platform_macros_impl(${_prefix} "AIX" AIX) + _define_platform_macros_impl(${_prefix} "Android" ANDROID) + _define_platform_macros_impl(${_prefix} "BS/DOS" BSDOS) + _define_platform_macros_impl(${_prefix} "FreeBSD" FREEBSD) + _define_platform_macros_impl(${_prefix} "HP-UX" HPUX) + _define_platform_macros_impl(${_prefix} "IRIX" IRIX) + _define_platform_macros_impl(${_prefix} "Linux" LINUX) + _define_platform_macros_impl(${_prefix} "GNU/kFreeBSD" KFREEBSD) + _define_platform_macros_impl(${_prefix} "NetBSD" NETBSD) + _define_platform_macros_impl(${_prefix} "OpenBSD" OPENBSD) + _define_platform_macros_impl(${_prefix} "OFS1" OFS1) + _define_platform_macros_impl(${_prefix} "SCO_SV" SCO_SV) + _define_platform_macros_impl(${_prefix} "UnixWare" UNIXWARE) + _define_platform_macros_impl(${_prefix} "Xenix" XENIX) + _define_platform_macros_impl(${_prefix} "SunOS" SUNOS) + _define_platform_macros_impl(${_prefix} "Tru64" TRU64) + _define_platform_macros_impl(${_prefix} "ULTRIX" ULTRIX) + _define_platform_macros_impl(${_prefix} "CYGWIN" CYGWIN) + _define_platform_macros_impl(${_prefix} "Darwin" MACOSX) + _define_platform_macros_impl(${_prefix} "Windows" WINDOWS) +endmacro() + diff --git a/lib/wiiuse/cmake/PrefixListGlob.cmake b/lib/wiiuse/cmake/PrefixListGlob.cmake new file mode 100644 index 000000000..3b1bb6460 --- /dev/null +++ b/lib/wiiuse/cmake/PrefixListGlob.cmake @@ -0,0 +1,36 @@ +# - For each given prefix in a list, glob using the prefix+pattern +# +# +# 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(__prefix_list_glob) + return() +endif() +set(__prefix_list_glob YES) + +function(prefix_list_glob var pattern) + set(_out) + set(_result) + foreach(prefix ${ARGN}) + file(GLOB _globbed ${prefix}${pattern}) + if(_globbed) + list(SORT _globbed) + list(REVERSE _globbed) + list(APPEND _out ${_globbed}) + endif() + endforeach() + foreach(_name ${_out}) + get_filename_component(_name "${_name}" ABSOLUTE) + list(APPEND _result "${_name}") + endforeach() + + set(${var} "${_result}" PARENT_SCOPE) +endfunction() diff --git a/lib/wiiuse/cmake/ProgramFilesGlob.cmake b/lib/wiiuse/cmake/ProgramFilesGlob.cmake new file mode 100644 index 000000000..9d7a9cc50 --- /dev/null +++ b/lib/wiiuse/cmake/ProgramFilesGlob.cmake @@ -0,0 +1,85 @@ +# - Find bit-appropriate program files directories matching a given pattern +# +# Requires these CMake modules: +# CleanDirectoryList +# PrefixListGlob +# +# 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) + +include(PrefixListGlob) +include(CleanDirectoryList) + +if(__program_files_glob) + return() +endif() +set(__program_files_glob YES) + +macro(_program_files_glob_var_prep) + # caution - ENV{ProgramFiles} on Win64 is adjusted to point to the arch + # of the running executable which, since CMake is 32-bit on Windows as + # I write this, will always be = $ENV{ProgramFiles(x86)}. + # Thus, we only use this environment variable if we are on a 32 machine + + # 32-bit dir on win32, useless to us on win64 + file(TO_CMAKE_PATH "$ENV{ProgramFiles}" _PROG_FILES) + + # 32-bit dir: only set on win64 + set(_PF86 "ProgramFiles(x86)") + file(TO_CMAKE_PATH "$ENV{${_PF86}}" _PROG_FILES_X86) + + # 64-bit dir: only set on win64 + file(TO_CMAKE_PATH "$ENV{ProgramW6432}" _PROG_FILES_W6432) +endmacro() + +function(program_files_glob var pattern) + _program_files_glob_var_prep() + if(CMAKE_SIZEOF_VOID_P MATCHES "8") + # 64-bit build on win64 + set(_PROGFILESDIRS "${_PROG_FILES_W6432}") + else() + if(_PROG_FILES_W6432) + # 32-bit build on win64 + set(_PROGFILESDIRS "${_PROG_FILES_X86}") + else() + # 32-bit build on win32 + set(_PROGFILESDIRS "${_PROG_FILES}") + endif() + endif() + + prefix_list_glob(_prefixed "${pattern}" ${_PROGFILESDIRS}) + clean_directory_list(_prefixed) + set(${var} ${_prefixed} PARENT_SCOPE) +endfunction() + +function(program_files_fallback_glob var pattern) + _program_files_glob_var_prep() + if(CMAKE_SIZEOF_VOID_P MATCHES "8") + # 64-bit build on win64 + # look in the "32 bit" (c:\program files (x86)\) directory as a + # fallback in case of weird/poorly written installers, like those + # that put both 64- and 32-bit libs in the same program files directory + set(_PROGFILESDIRS "${_PROG_FILES_W6432}" "${_PROG_FILES_X86}") + else() + if(_PROG_FILES_W6432) + # 32-bit build on win64 + # look in the "64 bit" (c:\program files\) directory as a fallback + # in case of old/weird/poorly written installers + set(_PROGFILESDIRS "${_PROG_FILES_X86}" "${_PROG_FILES_W6432}") + else() + # 32-bit build on win32 + set(_PROGFILESDIRS "${_PROG_FILES}") + endif() + endif() + + prefix_list_glob(_prefixed "${pattern}" ${_PROGFILESDIRS}) + clean_directory_list(_prefixed) + set(${var} ${_prefixed} PARENT_SCOPE) +endfunction() diff --git a/lib/wiiuse/cmake/README.markdown b/lib/wiiuse/cmake/README.markdown new file mode 100644 index 000000000..81ec9b22d --- /dev/null +++ b/lib/wiiuse/cmake/README.markdown @@ -0,0 +1,107 @@ +Ryan's CMake Modules +==================== + +Ryan A. Pavlik, Ph.D. + + + + +Introduction +------------ + +This is a collection of CMake modules that I've produced during the course +of a variety of software development. There are a number of find modules, +especially for virtual reality and physical simulation packages, some utility +modules of more general interest, and some patches or workarounds for +CMake itself. + +Each module is generally documented, and depending on how busy I was +when I created it, the documentation can be fairly complete. + +By now, it also includes contributions both from open-source projects I work on, +as well as friendly strangers on the Internet contributing their modules. I am +very grateful for improvements/fixes/pull requests! + +How to Integrate +---------------- + +These modules are probably best placed wholesale into a `cmake` subdirectory +of your project source. + +If you use Git, try installing [git-subtree][1] (included by default on +Git for Windows and perhaps for your Linux distro, especially post-1.9.1), so +you can easily use this repository for subtree merges, updating simply. + +For the initial checkout: + + cd projectdir + + git subtree add --squash --prefix=cmake https://github.com/rpavlik/cmake-modules.git master + +For updates: + + cd projectdir + + git subtree pull --squash --prefix=cmake https://github.com/rpavlik/cmake-modules.git master + +If you originally installed this by just copying the files, you'll sadly have +to delete the directory, commit that, then do the `git subtree add`. Annoying, +but I don't know a workaround. + +If you use some other version control, you can export a copy of this directory +without the git metadata by calling: + + ./export-to-directory.sh yourprojectdir/cmake + +You might also consider exporting to a temp directory and merging changes, since +this will not overwrite by default. You can pass -f to overwrite existing files. + +How to Use +---------- + +At the minimum, all you have to do is add a line like this near the top +of your root CMakeLists.txt file (but not before your `project()` call): + + list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") + +You might also want the extra automatic features/fixes included with the +modules, for that, just add another line following the first one: + + include(UseBackportedModules) + +Look at `module-help.html`/`.txt` (generated by `update-help.sh` on a unix-like shell with a pre-3.0 version of CMake.) +either in this directory or online at +for more information on individual modules. Since it requires an older CMake for generation, +the docs might get out of date, sorry - but you can always look at the files themselves. + + +Licenses +-------- + +The modules that I wrote myself are all subject to this license: + +> Copyright Iowa State University 2009-2014, +> or Copyright Sensics, Inc. 2014-2015, +> or Copyright Ryan A. Pavlik 2009-2015 +> +> Distributed under the Boost Software License, Version 1.0. +> +> (See accompanying file `LICENSE_1_0.txt` or copy at +> ) + +Modules based on those included with CMake are under the OSI-approved +BSD license, which is included in each of those modules. A few other modules +are modified from other sources - when in doubt, look at the `.cmake`. + +If you'd like to contribute, that would be great! Just make sure to include +the license boilerplate in your module, and send a pull request. + +Important License Note! +----------------------- + +If you find this file inside of another project, rather at the top-level +directory, you're in a separate project that is making use of these modules. +That separate project can (and probably does) have its own license specifics. + + +[1]: http://github.com/apenwarr/git-subtree "Git Subtree master" diff --git a/lib/wiiuse/cmake/ResetConfigurations.cmake b/lib/wiiuse/cmake/ResetConfigurations.cmake new file mode 100644 index 000000000..8c13fdf66 --- /dev/null +++ b/lib/wiiuse/cmake/ResetConfigurations.cmake @@ -0,0 +1,31 @@ +# - Re-set the available configurations to just RelWithDebInfo, Release, and Debug +# +# Requires these CMake modules: +# no additional modules required +# +# Original Author: +# 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(__reset_configurations) + return() +endif() +set(__reset_configurations YES) + +if(CMAKE_CONFIGURATION_TYPES) + set(CMAKE_CONFIGURATION_TYPES "RelWithDebInfo;Release;Debug") + set(CMAKE_CONFIGURATION_TYPES + "${CMAKE_CONFIGURATION_TYPES}" + CACHE + STRING + "Reset the configurations to what we need" + FORCE) +endif() diff --git a/lib/wiiuse/cmake/SearchProgramFilesForOpenSceneGraph.cmake b/lib/wiiuse/cmake/SearchProgramFilesForOpenSceneGraph.cmake new file mode 100644 index 000000000..aa7165ef5 --- /dev/null +++ b/lib/wiiuse/cmake/SearchProgramFilesForOpenSceneGraph.cmake @@ -0,0 +1,66 @@ +# - Use some smarts to try to find OpenSceneGraph in the Program Files dirs +# +# Also uses the OSGHOME environment variable as OSG_DIR, if it's found. +# +# Usage: +# include(SearchProgramFilesForOpenSceneGraph OPTIONAL) +# +# Requires these CMake modules: +# ListFilter +# ProgramFilesGlob +# +# 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) + +include(ListFilter) +include(ProgramFilesGlob) +include(CleanDirectoryList) + +# Try to find an OSG installation +set(_osgpaths) +if(WIN32) + program_files_glob(_osgpaths "/OpenSceneGraph*") + if(_osgpaths) + if(MSVC80) + list_filter_out(_osgpaths "[vV][cC]9" ${_osgpaths}) + elseif(MSVC90) + list_filter_out(_osgpaths "[vV][cC]8" ${_osgpaths}) + endif() + if(_osgpaths) + list(SORT _osgpaths) + list(REVERSE _osgpaths) + endif() + endif() +else() + prefix_list_glob(_osgpaths "/OpenSceneGraph*" /usr /usr/local /opt) + if(_osgpaths) + clean_directory_list(_osgpaths) + if(_osgpaths) + list(SORT _osgpaths) + list(REVERSE _osgpaths) + endif() + endif() +endif() + + +if(_osgpaths) + # Want them in reverse order so newer versions come up first + list(SORT _osgpaths) + list(REVERSE _osgpaths) + + # Use the environment variable to override + set(_osgpaths "$ENV{OSGHOME}" ${_osgpaths}) + clean_directory_list(_osgpaths) + + list(APPEND CMAKE_PREFIX_PATH ${_osgpaths}) +endif() + +# Not completely related +set(OpenSceneGraph_MARK_AS_ADVANCED TRUE) diff --git a/lib/wiiuse/cmake/SetDefaultBuildType.cmake b/lib/wiiuse/cmake/SetDefaultBuildType.cmake new file mode 100644 index 000000000..cd29e32ac --- /dev/null +++ b/lib/wiiuse/cmake/SetDefaultBuildType.cmake @@ -0,0 +1,31 @@ +# - Set a developer-chosen default build type +# +# Requires these CMake modules: +# no additional modules required +# +# Original Author: +# 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(__set_default_build_type) + return() +endif() +set(__set_default_build_type YES) + +function(set_default_build_type _type) + #if(DEFINED CMAKE_BUILD_TYPE AND NOT CMAKE_BUILD_TYPE) + if("${CMAKE_GENERATOR}" MATCHES "Makefiles" AND NOT CMAKE_BUILD_TYPE) + if(NOT __DEFAULT_BUILD_TYPE_SET) + set(CMAKE_BUILD_TYPE "${_type}" CACHE STRING "" FORCE) + set(__DEFAULT_BUILD_TYPE_SET YES CACHE INTERNAL "") + endif() + endif() +endfunction() diff --git a/lib/wiiuse/cmake/SplitLibraryList.cmake b/lib/wiiuse/cmake/SplitLibraryList.cmake new file mode 100644 index 000000000..c6e1a3442 --- /dev/null +++ b/lib/wiiuse/cmake/SplitLibraryList.cmake @@ -0,0 +1,40 @@ +# - Given a list of libraries with OPTIMIZED, DEBUG, etc. +# +# split_library_list(_generalvar _releasevar _debugvar) +# +# 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) + + +function(split_library_list _generalvar _releasevar _debugvar) + set(_general) + set(_debug) + set(_release) + set(_dest _general) + + foreach(item ${ARGN}) + if(${item} MATCHES "[dD][eE][bB][uU][gG]") + set(_dest _debug) + elseif(${item} MATCHES "[oO][pP][tT][iI][mM][iI][zZ][eE][dD]") + set(_dest _release) + elseif(${item} MATCHES "[gG][eE][nN][eE][rR][aA][lL]") + set(_dest _general) + else() + list(APPEND ${_dest} "${item}") + set(_dest _general) + endif() + endforeach() + + set(${_releasevar} ${_release} PARENT_SCOPE) + set(${_debugvar} ${_debug} PARENT_SCOPE) + set(${_generalvar} ${_general} PARENT_SCOPE) +endfunction() diff --git a/lib/wiiuse/cmake/StampSourcesWithVersion.cmake b/lib/wiiuse/cmake/StampSourcesWithVersion.cmake new file mode 100644 index 000000000..147fed8fc --- /dev/null +++ b/lib/wiiuse/cmake/StampSourcesWithVersion.cmake @@ -0,0 +1,180 @@ +# - When enabled, stamp the current version on C/C++ sources +# +# To set up your source code for proper stamping, start your file +# with a Doxygen-style comment block, starting with /* and ending with */ +# On a line by itself, with unimportant whitespace, add the standard Doxygen +# "version" command: +# @version xxx +# or +# \version xxx +# +# To make sure it works, please do actually put xxx as the current version: +# when you save, add one of the command below to your cmake build, and run +# cmake, it should replace xxx with the current version. (It replaces anything +# between the end of the whitespace after \version and the end of the line +# with the version that you pass in your build script, so put nothing else +# on that line!) +# +# For , I recommend passing the value of a CMake variable like +# ${CPACK_PACKAGE_VERSION} +# Remember, reduced duplication of information means reduced errors! +# +# WARNING! +# This does edit your source directory, but will only execute if the +# (hidden/advanced, default OFF) variable ENABLE_VERSION_STAMPING is on. +# +# Additionally, it tries to be very careful: +# - It will not edit files that are outside your source tree +# - It will only attempt a substitution within the first C-style comment block +# of your code (that is, the first /* */), but only if // is not found first +# +# stamp_target_with_version( [HEADERS_ONLY | ...]) - +# If no source file is specified, all will be processed. +# +# stamp_sources_with_version( [ ...]) - +# Use for files not directly associated with a target. +# +# 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(__stamp_sources_with_version) + return() +endif() +set(__stamp_sources_with_version YES) + +if(NOT APPLE) + option(ENABLE_VERSION_STAMPING + "Modify source files to update the version in the comment header. Maintainers only!" + OFF) + mark_as_advanced(ENABLE_VERSION_STAMPING) +endif() + +# Stash where our data is, at include() time +get_filename_component(_sswv_mod_dir ${CMAKE_CURRENT_LIST_FILE} PATH) + + +# Internal utility function - not for outside use +function(_stamp_file_with_version version filename) + if(NOT SED_EXECUTABLE) + find_program(SED_EXECUTABLE sed) + mark_as_advanced(SED_EXECUTABLE) + endif() + # TODO: fix the sed script on Mac + if(SED_EXECUTABLE AND ENABLE_VERSION_STAMPING AND NOT APPLE) + get_source_file_property(_abs "${filename}" LOCATION) + if(NOT _abs) + get_filename_component(_abs "${filename}" ABSOLUTE) + endif() + file(RELATIVE_PATH _rel "${CMAKE_SOURCE_DIR}" "${_abs}") + if(NOT "${_rel}" MATCHES "[.][.]") + # Only if this file is in the source tree + get_filename_component(_name "${filename}" NAME) + set(_in_source_dir YES) + # Create the sed script + configure_file("${_sswv_mod_dir}/StampSourcesWithVersion.sed.in" + "${CMAKE_CURRENT_BINARY_DIR}/stamp-${_name}.sed" + @ONLY) + + if(APPLE) + set(extendedre_arg -E) + else() + set(extendedre_arg -r) + endif() + + set(sedargs + ${extendedre_arg} + -f + "${CMAKE_CURRENT_BINARY_DIR}/stamp-${_name}.sed" + ${filename}) + + # Run the sed script + execute_process(COMMAND + ${SED_EXECUTABLE} + ${sedargs} + OUTPUT_FILE + "${CMAKE_CURRENT_BINARY_DIR}/stampedoutput-${_name}.out" + WORKING_DIRECTORY + "${CMAKE_CURRENT_SOURCE_DIR}") + + # Check to see if changes were made + execute_process(COMMAND + ${CMAKE_COMMAND} + -E + compare_files + "${CMAKE_CURRENT_BINARY_DIR}/stampedoutput-${_name}.out" + ${filename} + WORKING_DIRECTORY + "${CMAKE_CURRENT_SOURCE_DIR}" + RESULT_VARIABLE + files_different + OUTPUT_QUIET + ERROR_QUIET) + + # if so, run it again, but in-place this time + if(files_different) + message(STATUS "Stamping file ${_rel} with version ${version}") + execute_process(COMMAND + ${SED_EXECUTABLE} + -i + ${sedargs} + OUTPUT_FILE + "${CMAKE_CURRENT_BINARY_DIR}/stampedoutput-${_name}.out" + WORKING_DIRECTORY + "${CMAKE_CURRENT_SOURCE_DIR}") + else() + message(STATUS "Version stamp up-to-date on file ${_rel}") + endif() + endif() + endif() +endfunction() + +function(stamp_sources_with_version version) + foreach(_file ${ARGN}) + _stamp_file_with_version("${version}" "${_file}") + endforeach() +endfunction() + +function(stamp_target_with_version version target_name) + + set(_target_stampables) + + get_target_property(_target_sources ${target_name} SOURCES) + foreach(_source ${_target_sources}) + get_source_file_property(_lang "${_source}" LANGUAGE) + get_source_file_property(_loc "${_source}" LOCATION) + if("${_lang}" MATCHES "CXX" OR "${_lang}" MATCHES "C") + list(APPEND _target_stampables "${_loc}") + endif() + endforeach() + + set(_src_to_stamp) + if("${ARGN}" STREQUAL "HEADERS_ONLY") + # We were passed HEADERS_ONLY + foreach(_file ${_target_stampables}) + get_filename_component(_ext "${_file}" EXT) + if("${_ext}" MATCHES "[.]([hH]|hpp|HPP|hxx|HXX)$" OR NOT _ext) + list(APPEND _src_to_stamp "${_file}") + endif() + endforeach() + + elseif(ARGN) + # We were passed a list of files + set(_src_to_stamp ${ARGN}) + + else() + # We were passed only a target - process all source in the source tree. + set(_src_to_stamp ${_target_stampables}) + endif() + + stamp_sources_with_version(${version} ${_src_to_stamp}) +endfunction() + + + diff --git a/lib/wiiuse/cmake/StampSourcesWithVersion.sed.in b/lib/wiiuse/cmake/StampSourcesWithVersion.sed.in new file mode 100644 index 000000000..6fddf90b4 --- /dev/null +++ b/lib/wiiuse/cmake/StampSourcesWithVersion.sed.in @@ -0,0 +1,13 @@ +# Line by line summary: +# Until we find the first */ or // { +# In sections between /* and */ (that is, a block comment) { +# substitute @version WHATEVER with @version and the +# cmake-substituted version string. +# } +# } + +0,/[*/][/]/ { + /\/\*/,/\*\// { + s_([@\\])version(\s*).*$_\1version\2@version@_1g + } +} \ No newline at end of file diff --git a/lib/wiiuse/cmake/StashMapConfig.cmake b/lib/wiiuse/cmake/StashMapConfig.cmake new file mode 100644 index 000000000..d052028ee --- /dev/null +++ b/lib/wiiuse/cmake/StashMapConfig.cmake @@ -0,0 +1,86 @@ +# Manipulate CMAKE_MAP_IMPORTED_CONFIG_ cautiously and reversibly. +# +# In all usage docs, is a configuration name in all caps (RELEASE, DEBUG, +# RELWITHDEBINFO, MINSIZEREL, and NONE are the ones made by default - NONE is how +# targets are exported from single-config generators where CMAKE_BUILD_TYPE isn't set.) +# +# stash_map_config( ) and unstash_map_config() +# +# Saves+changes and restores the value (or unset-ness) of CMAKE_MAP_IMPORTED_CONFIG_${config}. +# Re-entrant calls OK - this does actually "push" and "pop" +# +# stash_common_map_config() and unstash_common_map_config() +# +# Calls stash_map_config/unstash_map_config for each configuration with sensible +# defaults based on the platform. +# +# Original Author: +# 2015, 2017 Ryan Pavlik +# http://ryanpavlik.com +# +# Copyright Sensics, Inc. 2015, 2017. +# 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) + +macro(stash_map_config config) + string(TOUPPER "${config}" smc_config) + string(TOUPPER "${ARGN}" smc_new) + # Re-entrancy protection - push an entry onto a list + list(APPEND smc_IN_MAP_CONFIG_STASH_${smc_config} yes) + list(LENGTH smc_IN_MAP_CONFIG_STASH_${smc_config} smc_IN_MAP_CONFIG_STASH_LEN) + + # Actually perform the saving and replacement of CMAKE_MAP_IMPORTED_CONFIG_${config} + set(smc_var smc_OLD_CMAKE_MAP_IMPORTED_CONFIG_${smc_config}_${smc_IN_MAP_CONFIG_STASH_LEN}) + message(STATUS "Stashing to ${smc_var}") + if(DEFINED CMAKE_MAP_IMPORTED_CONFIG_${smc_config}) + set(${smc_var} ${CMAKE_MAP_IMPORTED_CONFIG_${smc_config}}) + else() + unset(${smc_var}) + endif() + set(CMAKE_MAP_IMPORTED_CONFIG_${smc_config} ${smc_new}) +endmacro() + +macro(unstash_map_config config) + string(TOUPPER "${config}" smc_config) + if(NOT DEFINED smc_IN_MAP_CONFIG_STASH_${smc_config}) + # Nobody actually called the matching stash... + return() + endif() + # Get stack size so we know which entries to restore. + list(LENGTH smc_IN_MAP_CONFIG_STASH_${smc_config} smc_IN_MAP_CONFIG_STASH_LEN) + # Other half of re-entrancy protection - pop an entry off a list + list(REMOVE_AT smc_IN_MAP_CONFIG_STASH_${smc_config} -1) + + # Restoration of CMAKE_MAP_IMPORTED_CONFIG_${config} + set(smc_var smc_OLD_CMAKE_MAP_IMPORTED_CONFIG_${smc_config}_${smc_IN_MAP_CONFIG_STASH_LEN}) + if(DEFINED ${smc_var}) + set(CMAKE_MAP_IMPORTED_CONFIG_${smc_config} ${${smc_var}}) + unset(${smc_var}) + else() + unset(CMAKE_MAP_IMPORTED_CONFIG_${smc_config}) + endif() +endmacro() + +macro(stash_common_map_config) + if(MSVC) + # Can't do this - different runtimes, incompatible ABI, etc. + set(smc_DEBUG_FALLBACK) + stash_map_config(DEBUG DEBUG) + else() + set(smc_DEBUG_FALLBACK DEBUG) + stash_map_config(DEBUG DEBUG RELWITHDEBINFO RELEASE MINSIZEREL NONE) + endif() + stash_map_config(RELEASE RELEASE RELWITHDEBINFO MINSIZEREL NONE ${smc_DEBUG_FALLBACK}) + stash_map_config(RELWITHDEBINFO RELWITHDEBINFO RELEASE MINSIZEREL NONE ${smc_DEBUG_FALLBACK}) + stash_map_config(MINSIZEREL MINSIZEREL RELEASE RELWITHDEBINFO NONE ${smc_DEBUG_FALLBACK}) + stash_map_config(NONE NONE RELEASE RELWITHDEBINFO MINSIZEREL ${smc_DEBUG_FALLBACK}) +endmacro() + +macro(unstash_common_map_config) + unstash_map_config(DEBUG) + unstash_map_config(RELEASE) + unstash_map_config(RELWITHDEBINFO) + unstash_map_config(MINSIZEREL) + unstash_map_config(NONE) +endmacro() diff --git a/lib/wiiuse/cmake/TCHARWorkaround.cmake b/lib/wiiuse/cmake/TCHARWorkaround.cmake new file mode 100644 index 000000000..3edcd6a76 --- /dev/null +++ b/lib/wiiuse/cmake/TCHARWorkaround.cmake @@ -0,0 +1,38 @@ +# - Script to compile Win32-developed sources using tchar without modifying the code +# Requires that ${CMAKE_SOURCE_DIR}/cmake/workarounds/tchar/ be present. +# +# TCHAR_WORKAROUND, automatically set to on when not on win32 +# TCHAR_INCLUDE_DIR, location of our fake tchar.h file +# +# 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) + option(TCHAR_WORKAROUND "Work around missing tchar error" on) +else() + option(TCHAR_WORKAROUND "Work around missing tchar error" off) +endif() + +mark_as_advanced(TCHAR_WORKAROUND) + +if(TCHAR_WORKAROUND) + find_path(TCHAR_INCLUDE_DIR + tchar.h + PATHS + ${CMAKE_SOURCE_DIR}/cmake/workarounds/tchar/ + ./workarounds/tchar/ + PATH_SUFFIXES + workarounds/ + workarounds/tchar/) + if(TCHAR_INCLUDE_DIR) + include_directories(${TCHAR_INCLUDE_DIR}) + mark_as_advanced(TCHAR_INCLUDE_DIR) + endif() +endif() diff --git a/lib/wiiuse/cmake/UseBackportedModules.cmake b/lib/wiiuse/cmake/UseBackportedModules.cmake new file mode 100644 index 000000000..7ad3baac3 --- /dev/null +++ b/lib/wiiuse/cmake/UseBackportedModules.cmake @@ -0,0 +1,114 @@ +# - Do a version-dependent check and auto-include backported modules dirs +# +# Name your module directories cmake-*-modules where * is the full +# (maj.min.patch) version number that they came from. You can use +# subdirectories within those directories, if you like - all directories +# inside of a cmake-*-modules dir for a newer version of CMake that what +# we're running, that contain one or more .cmake files, will be appended +# to the CMAKE_MODULE_PATH. +# +# When backporting modules, be sure to test them and follow copyright +# instructions (usually updating copyright notices) +# +# Requires these CMake modules: +# 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 CMAKE_VERSION) # defined in >=2.6.3 + set(_cmver + "${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}") +else() + set(_cmver "${CMAKE_VERSION}") +endif() + +include(CleanDirectoryList) + +# No debugging output please +set(USE_BACKPORTED_MODULES_VERBOSE NO) + +get_filename_component(_moddir ${CMAKE_CURRENT_LIST_FILE} PATH) +file(GLOB _globbed "${_moddir}/cmake-*-modules") + +if(USE_BACKPORTED_MODULES_VERBOSE) + message(STATUS + "UseBackportedModules: Detected use of CMake version ${_cmver}") + message(STATUS "Checking these base directories: ${_globbed}") +endif() + +foreach(_dir ${_globbed}) + string(REGEX + MATCH + "cmake-[0-9].[0-9].[0-9]-modules" + _dirname + "${_dir}") + string(REGEX + REPLACE + "cmake-([0-9].[0-9].[0-9])-modules" + "\\1" + _ver + "${_dirname}") + string(REGEX + REPLACE + "cmake-([0-9]).([0-9]).([0-9])-modules" + "\\1_\\2_\\3" + _ver_clean + "${_dirname}") + + if(USE_BACKPORTED_MODULES_VERBOSE) + message(STATUS "${_dir}: ${_ver} ${_ver_clean}") + endif() + + if("${_cmver}" VERSION_LESS "${_ver}") + list(APPEND _upgradever "${_ver_clean}") + file(GLOB_RECURSE _modules "${_dir}/*.cmake") + + foreach(_mod ${_modules}) + get_filename_component(_path "${_mod}" PATH) + list(APPEND _paths_${_ver_clean} "${_path}") + endforeach() + + endif() +endforeach() + + +# Autoinclude files from oldest version to newest version +if(_upgradever) + set(_save_cmake_module_path ${CMAKE_MODULE_PATH}) + list(REMOVE_DUPLICATES _upgradever) + list(SORT _upgradever) + foreach(_ver_clean ${_upgradever}) + clean_directory_list(_paths_${_ver_clean}) + foreach(_dir ${_paths_${_ver_clean}}) + set(CMAKE_MODULE_PATH ${_dir} ${_save_cmake_module_path}) + include("${_dir}/autoinclude.cmake" OPTIONAL RESULT_VARIABLE _result) + if(USE_BACKPORTED_MODULES_VERBOSE) + message(STATUS "${_dir} - Autoincluded: ${_result}") + endif() + endforeach() + endforeach() + set(CMAKE_MODULE_PATH ${_save_cmake_module_path}) +endif() + +# Add the module path from newest version to oldest version +set(_added_module_path) +if(_upgradever) + list(REVERSE _upgradever) + foreach(_ver_clean ${_upgradever}) + list(APPEND _added_module_path ${_paths_${_ver_clean}}) + endforeach() +endif() + +list(APPEND CMAKE_MODULE_PATH ${_added_module_path}) + +if(USE_BACKPORTED_MODULES_VERBOSE) + message(STATUS "New module path: ${CMAKE_MODULE_PATH}") +endif() diff --git a/lib/wiiuse/cmake/UseFolders.cmake b/lib/wiiuse/cmake/UseFolders.cmake new file mode 100644 index 000000000..4fd5dfb17 --- /dev/null +++ b/lib/wiiuse/cmake/UseFolders.cmake @@ -0,0 +1,34 @@ +# - Contains a function to sensibly and easily enable the "USE_FOLDERS" global property +# without burning people using old MSVC Express Editions. +# +# use_folders([option_name]) - Creates an option (default name if you don't pass +# one: BUILD_WITH_PROJECT_FOLDERS) that controls the USE_FOLDERS global property. +# It has intelligently-set defaults that err on the side of caution (disabling) +# on old MSVC versions, since solutions generated with USE_FOLDERS set to ON +# cannot be used in some older MSVC Express Editions, so it's explicit opt-in there. +# +# Original Author: +# 2015 Ryan Pavlik +# http://academic.cleardefinition.com +# +# Copyright Sensics, Inc. 2015. +# 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) + +function(use_folders) + set(_option_name BUILD_WITH_PROJECT_FOLDERS) + if(ARGV0) + set(_option_name ${ARGV0}) + endif() + # Nitpicky TODO: This unnecessarily defaults to project folders off when using + # an older toolset in a newer IDE... + if(MSVC_IDE AND MSVC_VERSION LESS 1600) + # VS 2012 Express and newer has folder support... + option(${_option_name} "Enable project folders in the IDE. May only work in non-Express Editions!" OFF) + else() + option(${_option_name} "Enable project folders in the IDE." ON) + endif() + set_property(GLOBAL PROPERTY + USE_FOLDERS ${${_option_name}}) +endfunction() \ No newline at end of file diff --git a/lib/wiiuse/cmake/UseMarkdown.cmake b/lib/wiiuse/cmake/UseMarkdown.cmake new file mode 100644 index 000000000..3853167ea --- /dev/null +++ b/lib/wiiuse/cmake/UseMarkdown.cmake @@ -0,0 +1,116 @@ +# - Convert markdown source files to HTML as a custom target +# +# include(UseMarkdown) +# add_markdown_target( [...] [RENAME ]) +# Relative paths for the destination directory are considered with +# with respect to CMAKE_CURRENT_BINARY_DIR. The RENAME argument is only +# valid with a single markdown file as input. +# +# +# install_markdown_target( [extra arguments to INSTALL(FILES ...) ]) +# +# +# Requires CMake 2.6 or newer (uses the 'function' command) +# +# Original Author: +# 2011 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2011-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) + +if(__add_markdown_target) + return() +endif() +set(__add_markdown_target YES) + +define_property(TARGET + PROPERTY + MARKDOWN_TARGET_OUTPUTS + BRIEF_DOCS + "Markdown target outputs" + FULL_DOCS + "Output files of a target created by add_markdown_target") + +function(add_markdown_target _target _dest) + + if(NOT ARGN) + message(WARNING + "In add_markdown_target call for target ${_target}, no source files were specified!") + return() + endif() + + find_package(Markdown QUIET) + if(NOT MARKDOWN_EXECUTABLE) + message(FATAL_ERROR "Can't find a markdown conversion tool!") + endif() + + set(NEW_NAME) + list(FIND ARGN "RENAME" _renameloc) + if(_renameloc GREATER -1) + list(LENGTH ARGN _len) + if(NOT _len EQUAL 3) + message(FATAL_ERROR + "Specifying RENAME requires 1 input file and 1 output name!") + endif() + list(GET ARGN 2 NEW_NAME) + list(GET ARGN 0 ARGN) + endif() + + set(ALLFILES) + set(SOURCES) + foreach(fn ${ARGN}) + # Produce an absolute path to the input file + if(IS_ABSOLUTE "${fn}") + get_filename_component(fullpath "${fn}" ABSOLUTE) + get_filename_component(fn "${fn}" NAME) + else() + get_filename_component(fullpath + "${CMAKE_CURRENT_SOURCE_DIR}/${fn}" + ABSOLUTE) + endif() + get_filename_component(fn_noext "${fn}" NAME_WE) + + # Clean up output file name + if(NEW_NAME) + get_filename_component(absout "${_dest}/${NEW_NAME}" ABSOLUTE) + else() + get_filename_component(absout "${_dest}/${fn_noext}.html" ABSOLUTE) + endif() + + add_custom_command(OUTPUT "${absout}" + COMMAND + ${CMAKE_COMMAND} + ARGS -E make_directory "${_dest}" + COMMAND + ${MARKDOWN_EXECUTABLE} + ARGS "${fullpath}" > "${absout}" + MAIN_DEPENDENCY "${fullpath}" + VERBATIM + COMMENT "Converting Markdown ${fn} to HTML in ${absout}...") + list(APPEND SOURCES "${fullpath}") + list(APPEND ALLFILES "${absout}") + endforeach() + + # Custom target depending on all the file copy commands + add_custom_target(${_target} + ALL + SOURCES ${SOURCES} + DEPENDS ${ALLFILES}) + set_property(TARGET ${_target} PROPERTY MARKDOWN_TARGET_OUTPUTS "${ALLFILES}") +endfunction() + +function(install_markdown_target _target) + get_target_property(_mtoutputs ${_target} MARKDOWN_TARGET_OUTPUTS) + if(NOT _mtoutputs) + message(WARNING + "install_markdown_target called on a target not created with add_markdown_target!") + return() + endif() + + # Forward the call to install + install(FILES ${_mtoutputs} ${ARGN}) +endfunction() diff --git a/lib/wiiuse/cmake/UseTR1.cmake b/lib/wiiuse/cmake/UseTR1.cmake new file mode 100644 index 000000000..c7f020a66 --- /dev/null +++ b/lib/wiiuse/cmake/UseTR1.cmake @@ -0,0 +1,28 @@ +# - Use settings to enable access to C++ TR1 +# +# This calls include_directories and link_directories as needed to +# permit TR1 support. +# +# 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(__use_tr1) + return() +endif() +set(__use_tr1 YES) + + +if(TR1_INCLUDE_DIRS) + include_directories(${TR1_INCLUDE_DIRS}) +endif() + +if(TR1_LIBRARY_DIRS) + link_directories(${TR1_LIBRARY_DIRS}) +endif() diff --git a/lib/wiiuse/cmake/WarningDev.cmake b/lib/wiiuse/cmake/WarningDev.cmake new file mode 100644 index 000000000..851b5f5e8 --- /dev/null +++ b/lib/wiiuse/cmake/WarningDev.cmake @@ -0,0 +1,24 @@ +# - Print a developer warning, using author_warning if we have cmake 2.8 +# +# warning_dev("your desired message") +# +# Original Author: +# 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) + +function(warning_dev _yourmsg) + if("1.${CMAKE_VERSION}" VERSION_LESS "1.2.8.0") + # CMake version <2.8.0 + message(STATUS + "The following is a developer warning - end users may ignore it") + message(STATUS "Dev Warning: ${_yourmsg}") + else() + message(AUTHOR_WARNING "${_yourmsg}") + endif() +endfunction() diff --git a/lib/wiiuse/cmake/cmake-2.8.0-modules/features/SelectLibraryConfigurations.cmake b/lib/wiiuse/cmake/cmake-2.8.0-modules/features/SelectLibraryConfigurations.cmake new file mode 100644 index 000000000..ee1220ccd --- /dev/null +++ b/lib/wiiuse/cmake/cmake-2.8.0-modules/features/SelectLibraryConfigurations.cmake @@ -0,0 +1,108 @@ +# select_library_configurations( basename ) +# +# This macro takes a library base name as an argument, and will choose good +# values for basename_LIBRARY, basename_LIBRARIES, basename_LIBRARY_DEBUG, and +# basename_LIBRARY_RELEASE depending on what has been found and set. If only +# basename_LIBRARY_RELEASE is defined, basename_LIBRARY, basename_LIBRARY_DEBUG, +# and basename_LIBRARY_RELEASE will be set to the release value. If only +# basename_LIBRARY_DEBUG is defined, then basename_LIBRARY, +# basename_LIBRARY_DEBUG and basename_LIBRARY_RELEASE will take the debug value. +# +# If the generator supports configuration types, then basename_LIBRARY and +# basename_LIBRARIES will be set with debug and optimized flags specifying the +# library to be used for the given configuration. If no build type has been set +# or the generator in use does not support configuration types, then +# basename_LIBRARY and basename_LIBRARIES will take only the release values. + +#============================================================================= +# Copyright 2009 Kitware, Inc. +# Copyright 2009 Will Dicharry +# Copyright 2005-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# 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. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= +# This macro was adapted from the FindQt4 CMake module and is maintained by Will +# Dicharry . + +# Utility macro to check if one variable exists while another doesn't, and set +# one that doesn't exist to the one that exists. +macro( _set_library_name basename GOOD BAD ) + if( ${basename}_LIBRARY_${GOOD} AND NOT ${basename}_LIBRARY_${BAD} ) + set( ${basename}_LIBRARY_${BAD} ${${basename}_LIBRARY_${GOOD}} ) + set( ${basename}_LIBRARY ${${basename}_LIBRARY_${GOOD}} ) + set( ${basename}_LIBRARIES ${${basename}_LIBRARY_${GOOD}} ) + endif( ${basename}_LIBRARY_${GOOD} AND NOT ${basename}_LIBRARY_${BAD} ) +endmacro( _set_library_name ) + +macro( select_library_configurations basename ) + # if only the release version was found, set the debug to be the release + # version. + _set_library_name( ${basename} RELEASE DEBUG ) + # if only the debug version was found, set the release value to be the + # debug value. + _set_library_name( ${basename} DEBUG RELEASE ) + if (${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE ) + # if the generator supports configuration types or CMAKE_BUILD_TYPE + # is set, then set optimized and debug options. + if( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE ) + set( ${basename}_LIBRARY + optimized ${${basename}_LIBRARY_RELEASE} + debug ${${basename}_LIBRARY_DEBUG} ) + set( ${basename}_LIBRARIES + optimized ${${basename}_LIBRARY_RELEASE} + debug ${${basename}_LIBRARY_DEBUG} ) + else( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE ) + # If there are no configuration types or build type, just use + # the release version + set( ${basename}_LIBRARY ${${basename}_LIBRARY_RELEASE} ) + set( ${basename}_LIBRARIES ${${basename}_LIBRARY_RELEASE} ) + endif( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE ) + endif( ${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE ) + + set( ${basename}_LIBRARY ${${basename}_LIBRARY} CACHE FILEPATH + "The ${basename} library" ) + + if( ${basename}_LIBRARY ) + set( ${basename}_FOUND TRUE ) + endif( ${basename}_LIBRARY ) + + mark_as_advanced( ${basename}_LIBRARY + ${basename}_LIBRARY_RELEASE + ${basename}_LIBRARY_DEBUG + ) +endmacro( select_library_configurations ) + diff --git a/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindOpenSceneGraph.cmake b/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindOpenSceneGraph.cmake new file mode 100644 index 000000000..a86d8edb1 --- /dev/null +++ b/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindOpenSceneGraph.cmake @@ -0,0 +1,273 @@ +# - Find OpenSceneGraph +# This module searches for the OpenSceneGraph core "osg" library as well as +# OpenThreads, and whatever additional COMPONENTS (nodekits) that you specify. +# See http://www.openscenegraph.org +# +# NOTE: To use this module effectively you must either require CMake >= 2.6.3 +# with cmake_minimum_required(VERSION 2.6.3) or download and place +# FindOpenThreads.cmake, Findosg_functions.cmake, Findosg.cmake, +# and Find.cmake files into your CMAKE_MODULE_PATH. +# +#================================== +# +# This module accepts the following variables (note mixed case) +# +# OpenSceneGraph_DEBUG - Enable debugging output +# +# OpenSceneGraph_MARK_AS_ADVANCED - Mark cache variables as advanced +# automatically +# +# The following environment variables are also respected for finding the OSG +# and it's various components. CMAKE_PREFIX_PATH can also be used for this +# (see find_library() CMake documentation). +# +# _DIR (where MODULE is of the form "OSGVOLUME" and there is a FindosgVolume.cmake file) +# OSG_DIR +# OSGDIR +# OSG_ROOT +# +# This module defines the following output variables: +# +# OPENSCENEGRAPH_FOUND - Was the OSG and all of the specified components found? +# +# OPENSCENEGRAPH_VERSION - The version of the OSG which was found +# +# OPENSCENEGRAPH_INCLUDE_DIRS - Where to find the headers +# +# OPENSCENEGRAPH_LIBRARIES - The OSG libraries +# +#================================== +# Example Usage: +# +# find_package(OpenSceneGraph 2.0.0 REQUIRED osgDB osgUtil) +# # libOpenThreads & libosg automatically searched +# include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS}) +# +# add_executable(foo foo.cc) +# target_link_libraries(foo ${OPENSCENEGRAPH_LIBRARIES}) +# + +#============================================================================= +# Copyright 2009 Kitware, Inc. +# Copyright 2009 Philip Lowman +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# 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. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# +# Naming convention: +# Local variables of the form _osg_foo +# Input variables of the form OpenSceneGraph_FOO +# Output variables of the form OPENSCENEGRAPH_FOO +# + +include(Findosg_functions) + +set(_osg_modules_to_process) +foreach(_osg_component ${OpenSceneGraph_FIND_COMPONENTS}) + list(APPEND _osg_modules_to_process ${_osg_component}) +endforeach() +list(APPEND _osg_modules_to_process "osg" "OpenThreads") +list(REMOVE_DUPLICATES _osg_modules_to_process) + +if(OpenSceneGraph_DEBUG) + message("[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] " + "Components = ${_osg_modules_to_process}") +endif() + +# +# First we need to find and parse osg/Version +# +OSG_FIND_PATH(OSG osg/Version) +if(OpenSceneGraph_MARK_AS_ADVANCED) + OSG_MARK_AS_ADVANCED(OSG) +endif() + +# Try to ascertain the version... +if(OSG_INCLUDE_DIR) + if(OpenSceneGraph_DEBUG) + message("[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] " + "Detected OSG_INCLUDE_DIR = ${OSG_INCLUDE_DIR}") + endif() + + set(_osg_Version_file "${OSG_INCLUDE_DIR}/osg/Version") + if("${OSG_INCLUDE_DIR}" MATCHES "\\.framework$" AND NOT EXISTS "${_osg_Version_file}") + set(_osg_Version_file "${OSG_INCLUDE_DIR}/Headers/Version") + endif() + + if(EXISTS "${_osg_Version_file}") + file(READ "${_osg_Version_file}" _osg_Version_contents) + else() + set(_osg_Version_contents "unknown") + endif() + + string(REGEX MATCH ".*#define OSG_VERSION_MAJOR[ \t]+[0-9]+.*" + _osg_old_defines "${_osg_Version_contents}") + string(REGEX MATCH ".*#define OPENSCENEGRAPH_MAJOR_VERSION[ \t]+[0-9]+.*" + _osg_new_defines "${_osg_Version_contents}") + if(_osg_old_defines) + string(REGEX REPLACE ".*#define OSG_VERSION_MAJOR[ \t]+([0-9]+).*" + "\\1" _osg_VERSION_MAJOR ${_osg_Version_contents}) + string(REGEX REPLACE ".*#define OSG_VERSION_MINOR[ \t]+([0-9]+).*" + "\\1" _osg_VERSION_MINOR ${_osg_Version_contents}) + string(REGEX REPLACE ".*#define OSG_VERSION_PATCH[ \t]+([0-9]+).*" + "\\1" _osg_VERSION_PATCH ${_osg_Version_contents}) + elseif(_osg_new_defines) + string(REGEX REPLACE ".*#define OPENSCENEGRAPH_MAJOR_VERSION[ \t]+([0-9]+).*" + "\\1" _osg_VERSION_MAJOR ${_osg_Version_contents}) + string(REGEX REPLACE ".*#define OPENSCENEGRAPH_MINOR_VERSION[ \t]+([0-9]+).*" + "\\1" _osg_VERSION_MINOR ${_osg_Version_contents}) + string(REGEX REPLACE ".*#define OPENSCENEGRAPH_PATCH_VERSION[ \t]+([0-9]+).*" + "\\1" _osg_VERSION_PATCH ${_osg_Version_contents}) + else() + message("[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] " + "Failed to parse version number, please report this as a bug") + endif() + + set(OPENSCENEGRAPH_VERSION "${_osg_VERSION_MAJOR}.${_osg_VERSION_MINOR}.${_osg_VERSION_PATCH}" + CACHE INTERNAL "The version of OSG which was detected") + if(OpenSceneGraph_DEBUG) + message("[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] " + "Detected version ${OPENSCENEGRAPH_VERSION}") + endif() +endif() + +# +# Version checking +# +if(OpenSceneGraph_FIND_VERSION AND OPENSCENEGRAPH_VERSION) + if(OpenSceneGraph_FIND_VERSION_EXACT) + if(NOT OPENSCENEGRAPH_VERSION VERSION_EQUAL ${OpenSceneGraph_FIND_VERSION}) + set(_osg_version_not_exact TRUE) + endif() + else() + # version is too low + if(NOT OPENSCENEGRAPH_VERSION VERSION_EQUAL ${OpenSceneGraph_FIND_VERSION} AND + NOT OPENSCENEGRAPH_VERSION VERSION_GREATER ${OpenSceneGraph_FIND_VERSION}) + set(_osg_version_not_high_enough TRUE) + endif() + endif() +endif() + +set(_osg_quiet) +if(OpenSceneGraph_FIND_QUIETLY) + set(_osg_quiet "QUIET") +endif() +# +# Here we call FIND_PACKAGE() on all of the components +# +foreach(_osg_module ${_osg_modules_to_process}) + if(OpenSceneGraph_DEBUG) + message("[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] " + "Calling find_package(${_osg_module} ${_osg_required} ${_osg_quiet})") + endif() + find_package(${_osg_module} ${_osg_quiet}) + + string(TOUPPER ${_osg_module} _osg_module_UC) + list(APPEND OPENSCENEGRAPH_INCLUDE_DIR ${${_osg_module_UC}_INCLUDE_DIR}) + list(APPEND OPENSCENEGRAPH_LIBRARIES ${${_osg_module_UC}_LIBRARIES}) + + if(OpenSceneGraph_MARK_AS_ADVANCED) + OSG_MARK_AS_ADVANCED(${_osg_module}) + endif() +endforeach() + +if(OPENSCENEGRAPH_INCLUDE_DIR) + list(REMOVE_DUPLICATES OPENSCENEGRAPH_INCLUDE_DIR) +endif() + +# +# Inform the users with an error message based on +# what version they have vs. what version was +# required. +# +if(OpenSceneGraph_FIND_REQUIRED) + set(_osg_version_output_type FATAL_ERROR) +else() + set(_osg_version_output_type STATUS) +endif() +if(_osg_version_not_high_enough) + set(_osg_EPIC_FAIL TRUE) + if(NOT OpenSceneGraph_FIND_QUIETLY) + message(${_osg_version_output_type} + "ERROR: Version ${OpenSceneGraph_FIND_VERSION} or higher of the OSG " + "is required. Version ${OPENSCENEGRAPH_VERSION} was found.") + endif() +elseif(_osg_version_not_exact) + set(_osg_EPIC_FAIL TRUE) + if(NOT OpenSceneGraph_FIND_QUIETLY) + message(${_osg_version_output_type} + "ERROR: Version ${OpenSceneGraph_FIND_VERSION} of the OSG is required " + "(exactly), version ${OPENSCENEGRAPH_VERSION} was found.") + endif() +else() + + # + # Check each module to see if it's found + # + if(OpenSceneGraph_FIND_REQUIRED) + set(_osg_missing_message) + foreach(_osg_module ${_osg_modules_to_process}) + string(TOUPPER ${_osg_module} _osg_module_UC) + if(NOT ${_osg_module_UC}_FOUND) + set(_osg_missing_nodekit_fail true) + set(_osg_missing_message "${_osg_missing_message} ${_osg_module}") + endif() + endforeach() + + if(_osg_missing_nodekit_fail) + message(FATAL_ERROR "ERROR: Missing the following osg " + "libraries: ${_osg_missing_message}.\n" + "Consider using CMAKE_PREFIX_PATH or the OSG_DIR " + "environment variable. See the " + "${CMAKE_CURRENT_LIST_FILE} for more details.") + endif() + endif() + + include(FindPackageHandleStandardArgs) + FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenSceneGraph DEFAULT_MSG OPENSCENEGRAPH_LIBRARIES OPENSCENEGRAPH_INCLUDE_DIR) +endif() + +if(_osg_EPIC_FAIL) + # Zero out everything, we didn't meet version requirements + set(OPENSCENEGRAPH_FOUND FALSE) + set(OPENSCENEGRAPH_LIBRARIES) + set(OPENSCENEGRAPH_INCLUDE_DIR) +endif() + +set(OPENSCENEGRAPH_INCLUDE_DIRS ${OPENSCENEGRAPH_INCLUDE_DIR}) + diff --git a/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindOpenThreads.cmake b/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindOpenThreads.cmake new file mode 100644 index 000000000..b94688921 --- /dev/null +++ b/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindOpenThreads.cmake @@ -0,0 +1,150 @@ +# OpenThreads is a C++ based threading library. Its largest userbase +# seems to OpenSceneGraph so you might notice I accept OSGDIR as an +# environment path. +# I consider this part of the Findosg* suite used to find OpenSceneGraph +# components. +# Each component is separate and you must opt in to each module. +# +# Locate OpenThreads +# This module defines +# OPENTHREADS_LIBRARY +# OPENTHREADS_FOUND, if false, do not try to link to OpenThreads +# OPENTHREADS_INCLUDE_DIR, where to find the headers +# +# $OPENTHREADS_DIR is an environment variable that would +# correspond to the ./configure --prefix=$OPENTHREADS_DIR +# used in building osg. +# +# Created by Eric Wing. + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# 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. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# Header files are presumed to be included like +# #include + +# To make it easier for one-step automated configuration/builds, +# we leverage environmental paths. This is preferable +# to the -DVAR=value switches because it insulates the +# users from changes we may make in this script. +# It also offers a little more flexibility than setting +# the CMAKE_*_PATH since we can target specific components. +# However, the default CMake behavior will search system paths +# before anything else. This is problematic in the cases +# where you have an older (stable) version installed, but +# are trying to build a newer version. +# CMake doesn't offer a nice way to globally control this behavior +# so we have to do a nasty "double FIND_" in this module. +# The first FIND disables the CMAKE_ search paths and only checks +# the environmental paths. +# If nothing is found, then the second find will search the +# standard install paths. +# Explicit -DVAR=value arguments should still be able to override everything. + +find_path(OPENTHREADS_INCLUDE_DIR OpenThreads/Thread + HINTS + # enough environment variables? + $ENV{OPENTHREADS_INCLUDE_DIR} + $ENV{OPENTHREADS_DIR} + $ENV{OSG_INCLUDE_DIR} + $ENV{OSG_DIR} + $ENV{OSGDIR} + $ENV{OpenThreads_ROOT} + $ENV{OSG_ROOT} + PATHS + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt + /usr/freeware + PATH_SUFFIXES include +) + + +find_library(OPENTHREADS_LIBRARY + NAMES OpenThreads OpenThreadsWin32 + HINTS + $ENV{OPENTHREADS_LIBRARY_DIR} + $ENV{OPENTHREADS_DIR} + $ENV{OSG_LIBRARY_DIR} + $ENV{OSG_DIR} + $ENV{OSGDIR} + $ENV{OpenThreads_ROOT} + $ENV{OSG_ROOT} + PATHS + /sw + /opt/local + /opt/csw + /opt + /usr/freeware + PATH_SUFFIXES lib64 lib +) + +find_library(OPENTHREADS_LIBRARY_DEBUG + NAMES OpenThreadsd OpenThreadsWin32d + HINTS + $ENV{OPENTHREADS_DEBUG_LIBRARY_DIR} + $ENV{OPENTHREADS_LIBRARY_DIR} + $ENV{OPENTHREADS_DIR} + $ENV{OSG_LIBRARY_DIR} + $ENV{OSG_DIR} + $ENV{OSGDIR} + $ENV{OpenThreads_ROOT} + $ENV{OSG_ROOT} + PATHS + /sw + /opt/local + /opt/csw + /opt + /usr/freeware + PATH_SUFFIXES lib64 lib +) + +if(OPENTHREADS_LIBRARY_DEBUG) + set(OPENTHREADS_LIBRARIES + optimized ${OPENTHREADS_LIBRARY} + debug ${OPENTHREADS_LIBRARY_DEBUG}) +else() + set(OPENTHREADS_LIBRARIES ${OPENTHREADS_LIBRARY}) +endif() + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenThreads DEFAULT_MSG + OPENTHREADS_LIBRARY OPENTHREADS_INCLUDE_DIR) diff --git a/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/Findosg.cmake b/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/Findosg.cmake new file mode 100644 index 000000000..b9591a21f --- /dev/null +++ b/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/Findosg.cmake @@ -0,0 +1,81 @@ +# +# NOTE: It is highly recommended that you use the new FindOpenSceneGraph.cmake +# introduced in CMake 2.6.3 and not use this Find module directly. +# +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osg +# This module defines +# +# OSG_FOUND - Was the Osg found? +# OSG_INCLUDE_DIR - Where to find the headers +# OSG_LIBRARIES - The libraries to link against for the OSG (use this) +# +# OSG_LIBRARY - The OSG library +# OSG_LIBRARY_DEBUG - The OSG debug library +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# 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. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# Header files are presumed to be included like +# #include +# #include + +include(Findosg_functions) +OSG_FIND_PATH (OSG osg/PositionAttitudeTransform) +OSG_FIND_LIBRARY(OSG osg) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osg DEFAULT_MSG OSG_LIBRARY OSG_INCLUDE_DIR) diff --git a/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgAnimation.cmake b/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgAnimation.cmake new file mode 100644 index 000000000..57bd5d805 --- /dev/null +++ b/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgAnimation.cmake @@ -0,0 +1,78 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgAnimation +# This module defines +# +# OSGANIMATION_FOUND - Was osgAnimation found? +# OSGANIMATION_INCLUDE_DIR - Where to find the headers +# OSGANIMATION_LIBRARIES - The libraries to link against for the OSG (use this) +# +# OSGANIMATION_LIBRARY - The OSG library +# OSGANIMATION_LIBRARY_DEBUG - The OSG debug library +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# 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. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# Header files are presumed to be included like +# #include +# #include + +include(Findosg_functions) +OSG_FIND_PATH (OSGANIMATION osgAnimation/Animation) +OSG_FIND_LIBRARY(OSGANIMATION osgAnimation) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgAnimation DEFAULT_MSG + OSGANIMATION_LIBRARY OSGANIMATION_INCLUDE_DIR) diff --git a/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgDB.cmake b/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgDB.cmake new file mode 100644 index 000000000..990089670 --- /dev/null +++ b/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgDB.cmake @@ -0,0 +1,78 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgDB +# This module defines +# +# OSGDB_FOUND - Was osgDB found? +# OSGDB_INCLUDE_DIR - Where to find the headers +# OSGDB_LIBRARIES - The libraries to link against for the osgDB (use this) +# +# OSGDB_LIBRARY - The osgDB library +# OSGDB_LIBRARY_DEBUG - The osgDB debug library +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# 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. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# Header files are presumed to be included like +# #include +# #include + +include(Findosg_functions) +OSG_FIND_PATH (OSGDB osgDB/DatabasePager) +OSG_FIND_LIBRARY(OSGDB osgDB) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgDB DEFAULT_MSG + OSGDB_LIBRARY OSGDB_INCLUDE_DIR) diff --git a/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgFX.cmake b/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgFX.cmake new file mode 100644 index 000000000..8fb222549 --- /dev/null +++ b/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgFX.cmake @@ -0,0 +1,78 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgFX +# This module defines +# +# OSGFX_FOUND - Was osgFX found? +# OSGFX_INCLUDE_DIR - Where to find the headers +# OSGFX_LIBRARIES - The libraries to link against for the osgFX (use this) +# +# OSGFX_LIBRARY - The osgFX library +# OSGFX_LIBRARY_DEBUG - The osgFX debug library +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# 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. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# Header files are presumed to be included like +# #include +# #include + +include(Findosg_functions) +OSG_FIND_PATH (OSGFX osgFX/BumpMapping) +OSG_FIND_LIBRARY(OSGFX osgFX) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgFX DEFAULT_MSG + OSGFX_LIBRARY OSGFX_INCLUDE_DIR) diff --git a/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgGA.cmake b/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgGA.cmake new file mode 100644 index 000000000..1e0f06e27 --- /dev/null +++ b/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgGA.cmake @@ -0,0 +1,78 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgGA +# This module defines +# +# OSGGA_FOUND - Was osgGA found? +# OSGGA_INCLUDE_DIR - Where to find the headers +# OSGGA_LIBRARIES - The libraries to link against for the osgGA (use this) +# +# OSGGA_LIBRARY - The osgGA library +# OSGGA_LIBRARY_DEBUG - The osgGA debug library +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# 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. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# Header files are presumed to be included like +# #include +# #include + +include(Findosg_functions) +OSG_FIND_PATH (OSGGA osgGA/FlightManipulator) +OSG_FIND_LIBRARY(OSGGA osgGA) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgGA DEFAULT_MSG + OSGGA_LIBRARY OSGGA_INCLUDE_DIR) diff --git a/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgIntrospection.cmake b/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgIntrospection.cmake new file mode 100644 index 000000000..0ebb45f2e --- /dev/null +++ b/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgIntrospection.cmake @@ -0,0 +1,78 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgINTROSPECTION +# This module defines +# +# OSGINTROSPECTION_FOUND - Was osgIntrospection found? +# OSGINTROSPECTION_INCLUDE_DIR - Where to find the headers +# OSGINTROSPECTION_LIBRARIES - The libraries to link for osgIntrospection (use this) +# +# OSGINTROSPECTION_LIBRARY - The osgIntrospection library +# OSGINTROSPECTION_LIBRARY_DEBUG - The osgIntrospection debug library +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# 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. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# Header files are presumed to be included like +# #include +# #include + +include(Findosg_functions) +OSG_FIND_PATH (OSGINTROSPECTION osgIntrospection/Reflection) +OSG_FIND_LIBRARY(OSGINTROSPECTION osgIntrospection) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgIntrospection DEFAULT_MSG + OSGINTROSPECTION_LIBRARY OSGINTROSPECTION_INCLUDE_DIR) diff --git a/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgManipulator.cmake b/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgManipulator.cmake new file mode 100644 index 000000000..b2362aab6 --- /dev/null +++ b/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgManipulator.cmake @@ -0,0 +1,78 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgManipulator +# This module defines +# +# OSGMANIPULATOR_FOUND - Was osgManipulator found? +# OSGMANIPULATOR_INCLUDE_DIR - Where to find the headers +# OSGMANIPULATOR_LIBRARIES - The libraries to link for osgManipulator (use this) +# +# OSGMANIPULATOR_LIBRARY - The osgManipulator library +# OSGMANIPULATOR_LIBRARY_DEBUG - The osgManipulator debug library +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# 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. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# Header files are presumed to be included like +# #include +# #include + +include(Findosg_functions) +OSG_FIND_PATH (OSGMANIPULATOR osgManipulator/TrackballDragger) +OSG_FIND_LIBRARY(OSGMANIPULATOR osgManipulator) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgManipulator DEFAULT_MSG + OSGMANIPULATOR_LIBRARY OSGMANIPULATOR_INCLUDE_DIR) diff --git a/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgParticle.cmake b/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgParticle.cmake new file mode 100644 index 000000000..c668739ba --- /dev/null +++ b/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgParticle.cmake @@ -0,0 +1,78 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgParticle +# This module defines +# +# OSGPARTICLE_FOUND - Was osgParticle found? +# OSGPARTICLE_INCLUDE_DIR - Where to find the headers +# OSGPARTICLE_LIBRARIES - The libraries to link for osgParticle (use this) +# +# OSGPARTICLE_LIBRARY - The osgParticle library +# OSGPARTICLE_LIBRARY_DEBUG - The osgParticle debug library +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# 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. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# Header files are presumed to be included like +# #include +# #include + +include(Findosg_functions) +OSG_FIND_PATH (OSGPARTICLE osgParticle/FireEffect) +OSG_FIND_LIBRARY(OSGPARTICLE osgParticle) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgParticle DEFAULT_MSG + OSGPARTICLE_LIBRARY OSGPARTICLE_INCLUDE_DIR) diff --git a/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgProducer.cmake b/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgProducer.cmake new file mode 100644 index 000000000..dd28b1634 --- /dev/null +++ b/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgProducer.cmake @@ -0,0 +1,78 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgProducer +# This module defines +# +# OSGPRODUCER_FOUND - Was osgProducer found? +# OSGPRODUCER_INCLUDE_DIR - Where to find the headers +# OSGPRODUCER_LIBRARIES - The libraries to link for osgProducer (use this) +# +# OSGPRODUCER_LIBRARY - The osgProducer library +# OSGPRODUCER_LIBRARY_DEBUG - The osgProducer debug library +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# 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. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# Header files are presumed to be included like +# #include +# #include + +include(Findosg_functions) +OSG_FIND_PATH (OSGPRODUCER osgProducer/OsgSceneHandler) +OSG_FIND_LIBRARY(OSGPRODUCER osgProducer) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgProducer DEFAULT_MSG + OSGPRODUCER_LIBRARY OSGPRODUCER_INCLUDE_DIR) diff --git a/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgShadow.cmake b/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgShadow.cmake new file mode 100644 index 000000000..60da582a7 --- /dev/null +++ b/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgShadow.cmake @@ -0,0 +1,78 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgShadow +# This module defines +# +# OSGSHADOW_FOUND - Was osgShadow found? +# OSGSHADOW_INCLUDE_DIR - Where to find the headers +# OSGSHADOW_LIBRARIES - The libraries to link for osgShadow (use this) +# +# OSGSHADOW_LIBRARY - The osgShadow library +# OSGSHADOW_LIBRARY_DEBUG - The osgShadow debug library +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# 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. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# Header files are presumed to be included like +# #include +# #include + +include(Findosg_functions) +OSG_FIND_PATH (OSGSHADOW osgShadow/ShadowTexture) +OSG_FIND_LIBRARY(OSGSHADOW osgShadow) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgShadow DEFAULT_MSG + OSGSHADOW_LIBRARY OSGSHADOW_INCLUDE_DIR) diff --git a/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgSim.cmake b/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgSim.cmake new file mode 100644 index 000000000..14c390983 --- /dev/null +++ b/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgSim.cmake @@ -0,0 +1,78 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgSim +# This module defines +# +# OSGSIM_FOUND - Was osgSim found? +# OSGSIM_INCLUDE_DIR - Where to find the headers +# OSGSIM_LIBRARIES - The libraries to link for osgSim (use this) +# +# OSGSIM_LIBRARY - The osgSim library +# OSGSIM_LIBRARY_DEBUG - The osgSim debug library +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# 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. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# Header files are presumed to be included like +# #include +# #include + +include(Findosg_functions) +OSG_FIND_PATH (OSGSIM osgSim/ImpostorSprite) +OSG_FIND_LIBRARY(OSGSIM osgSim) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgSim DEFAULT_MSG + OSGSIM_LIBRARY OSGSIM_INCLUDE_DIR) diff --git a/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgTerrain.cmake b/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgTerrain.cmake new file mode 100644 index 000000000..20cf56901 --- /dev/null +++ b/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgTerrain.cmake @@ -0,0 +1,78 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgTerrain +# This module defines +# +# OSGTERRAIN_FOUND - Was osgTerrain found? +# OSGTERRAIN_INCLUDE_DIR - Where to find the headers +# OSGTERRAIN_LIBRARIES - The libraries to link for osgTerrain (use this) +# +# OSGTERRAIN_LIBRARY - The osgTerrain library +# OSGTERRAIN_LIBRARY_DEBUG - The osgTerrain debug library +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# 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. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# Header files are presumed to be included like +# #include +# #include + +include(Findosg_functions) +OSG_FIND_PATH (OSGTERRAIN osgTerrain/Terrain) +OSG_FIND_LIBRARY(OSGTERRAIN osgTerrain) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgTerrain DEFAULT_MSG + OSGTERRAIN_LIBRARY OSGTERRAIN_INCLUDE_DIR) diff --git a/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgText.cmake b/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgText.cmake new file mode 100644 index 000000000..81f9740ab --- /dev/null +++ b/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgText.cmake @@ -0,0 +1,78 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgText +# This module defines +# +# OSGTEXT_FOUND - Was osgText found? +# OSGTEXT_INCLUDE_DIR - Where to find the headers +# OSGTEXT_LIBRARIES - The libraries to link for osgText (use this) +# +# OSGTEXT_LIBRARY - The osgText library +# OSGTEXT_LIBRARY_DEBUG - The osgText debug library +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# 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. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# Header files are presumed to be included like +# #include +# #include + +include(Findosg_functions) +OSG_FIND_PATH (OSGTEXT osgText/Text) +OSG_FIND_LIBRARY(OSGTEXT osgText) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgText DEFAULT_MSG + OSGTEXT_LIBRARY OSGTEXT_INCLUDE_DIR) diff --git a/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgUtil.cmake b/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgUtil.cmake new file mode 100644 index 000000000..088409640 --- /dev/null +++ b/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgUtil.cmake @@ -0,0 +1,78 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgUtil +# This module defines +# +# OSGUTIL_FOUND - Was osgUtil found? +# OSGUTIL_INCLUDE_DIR - Where to find the headers +# OSGUTIL_LIBRARIES - The libraries to link for osgUtil (use this) +# +# OSGUTIL_LIBRARY - The osgUtil library +# OSGUTIL_LIBRARY_DEBUG - The osgUtil debug library +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# 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. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# Header files are presumed to be included like +# #include +# #include + +include(Findosg_functions) +OSG_FIND_PATH (OSGUTIL osgUtil/SceneView) +OSG_FIND_LIBRARY(OSGUTIL osgUtil) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgUtil DEFAULT_MSG + OSGUTIL_LIBRARY OSGUTIL_INCLUDE_DIR) diff --git a/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgViewer.cmake b/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgViewer.cmake new file mode 100644 index 000000000..04df41334 --- /dev/null +++ b/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgViewer.cmake @@ -0,0 +1,78 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgViewer +# This module defines +# +# OSGVIEWER_FOUND - Was osgViewer found? +# OSGVIEWER_INCLUDE_DIR - Where to find the headers +# OSGVIEWER_LIBRARIES - The libraries to link for osgViewer (use this) +# +# OSGVIEWER_LIBRARY - The osgViewer library +# OSGVIEWER_LIBRARY_DEBUG - The osgViewer debug library +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# 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. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# Header files are presumed to be included like +# #include +# #include + +include(Findosg_functions) +OSG_FIND_PATH (OSGVIEWER osgViewer/Viewer) +OSG_FIND_LIBRARY(OSGVIEWER osgViewer) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgViewer DEFAULT_MSG + OSGVIEWER_LIBRARY OSGVIEWER_INCLUDE_DIR) diff --git a/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgVolume.cmake b/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgVolume.cmake new file mode 100644 index 000000000..6c666c47b --- /dev/null +++ b/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgVolume.cmake @@ -0,0 +1,78 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgVolume +# This module defines +# +# OSGVOLUME_FOUND - Was osgVolume found? +# OSGVOLUME_INCLUDE_DIR - Where to find the headers +# OSGVOLUME_LIBRARIES - The libraries to link for osgVolume (use this) +# +# OSGVOLUME_LIBRARY - The osgVolume library +# OSGVOLUME_LIBRARY_DEBUG - The osgVolume debug library +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# 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. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# Header files are presumed to be included like +# #include +# #include + +include(Findosg_functions) +OSG_FIND_PATH (OSGVOLUME osgVolume/Volume) +OSG_FIND_LIBRARY(OSGVOLUME osgVolume) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgVolume DEFAULT_MSG + OSGVOLUME_LIBRARY OSGVOLUME_INCLUDE_DIR) diff --git a/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgWidget.cmake b/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgWidget.cmake new file mode 100644 index 000000000..227bbce40 --- /dev/null +++ b/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/FindosgWidget.cmake @@ -0,0 +1,78 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgWidget +# This module defines +# +# OSGWIDGET_FOUND - Was osgWidget found? +# OSGWIDGET_INCLUDE_DIR - Where to find the headers +# OSGWIDGET_LIBRARIES - The libraries to link for osgWidget (use this) +# +# OSGWIDGET_LIBRARY - The osgWidget library +# OSGWIDGET_LIBRARY_DEBUG - The osgWidget debug library +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# FindosgWidget.cmake tweaked from Findosg* suite as created by Eric Wing. + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# 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. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# Header files are presumed to be included like +# #include +# #include + +include(Findosg_functions) +OSG_FIND_PATH (OSGWIDGET osgWidget/Widget) +OSG_FIND_LIBRARY(OSGWIDGET osgWidget) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgWidget DEFAULT_MSG + OSGWIDGET_LIBRARY OSGWIDGET_INCLUDE_DIR) diff --git a/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/Findosg_functions.cmake b/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/Findosg_functions.cmake new file mode 100644 index 000000000..19f180350 --- /dev/null +++ b/lib/wiiuse/cmake/cmake-2.8.0-modules/osg/Findosg_functions.cmake @@ -0,0 +1,132 @@ +# +# This CMake file contains two macros to assist with searching for OSG +# libraries and nodekits. +# + +#============================================================================= +# Copyright 2009 Kitware, Inc. +# Copyright 2009 Philip Lowman +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# 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. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# +# OSG_FIND_PATH +# +function(OSG_FIND_PATH module header) + string(TOUPPER ${module} module_uc) + + # Try the user's environment request before anything else. + find_path(${module_uc}_INCLUDE_DIR ${header} + HINTS + $ENV{${module_uc}_DIR} + $ENV{OSG_DIR} + $ENV{OSGDIR} + $ENV{OSG_ROOT} + PATH_SUFFIXES include + PATHS + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt + /usr/freeware + ) +endfunction(OSG_FIND_PATH module header) + + +# +# OSG_FIND_LIBRARY +# +function(OSG_FIND_LIBRARY module library) + string(TOUPPER ${module} module_uc) + + find_library(${module_uc}_LIBRARY + NAMES ${library} + HINTS + $ENV{${module_uc}_DIR} + $ENV{OSG_DIR} + $ENV{OSGDIR} + $ENV{OSG_ROOT} + PATH_SUFFIXES lib64 lib + PATHS + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt + /usr/freeware + ) + + find_library(${module_uc}_LIBRARY_DEBUG + NAMES ${library}d + HINTS + $ENV{${module_uc}_DIR} + $ENV{OSG_DIR} + $ENV{OSGDIR} + $ENV{OSG_ROOT} + PATH_SUFFIXES lib64 lib + PATHS + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt + /usr/freeware + ) + + if(NOT ${module_uc}_LIBRARY_DEBUG) + # They don't have a debug library + set(${module_uc}_LIBRARY_DEBUG ${${module_uc}_LIBRARY} PARENT_SCOPE) + set(${module_uc}_LIBRARIES ${${module_uc}_LIBRARY} PARENT_SCOPE) + else() + # They really have a FOO_LIBRARY_DEBUG + set(${module_uc}_LIBRARIES + optimized ${${module_uc}_LIBRARY} + debug ${${module_uc}_LIBRARY_DEBUG} + PARENT_SCOPE + ) + endif() +endfunction(OSG_FIND_LIBRARY module library) + +# +# OSG_MARK_AS_ADVANCED +# Just a convenience function for calling MARK_AS_ADVANCED +# +function(OSG_MARK_AS_ADVANCED _module) + string(TOUPPER ${_module} _module_UC) + mark_as_advanced(${_module_UC}_INCLUDE_DIR) + mark_as_advanced(${_module_UC}_LIBRARY) + mark_as_advanced(${_module_UC}_LIBRARY_DEBUG) +endfunction() diff --git a/lib/wiiuse/cmake/cmake-2.8.1-modules/patchctestbug10149/CTest.cmake b/lib/wiiuse/cmake/cmake-2.8.1-modules/patchctestbug10149/CTest.cmake new file mode 100644 index 000000000..0c5aaf4e0 --- /dev/null +++ b/lib/wiiuse/cmake/cmake-2.8.1-modules/patchctestbug10149/CTest.cmake @@ -0,0 +1,363 @@ +# - Configure a project for testing with CTest/CDash +# Include this module in the top CMakeLists.txt file of a project to +# enable testing with CTest and dashboard submissions to CDash: +# project(MyProject) +# ... +# include(CTest) +# The module automatically creates a BUILD_TESTING option that selects +# whether to enable testing support (ON by default). After including +# the module, use code like +# if(BUILD_TESTING) +# # ... CMake code to create tests ... +# endif() +# to creating tests when testing is enabled. +# +# To enable submissions to a CDash server, create a CTestConfig.cmake +# file at the top of the project with content such as +# set(CTEST_PROJECT_NAME "MyProject") +# set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC") +# set(CTEST_DROP_METHOD "http") +# set(CTEST_DROP_SITE "my.cdash.org") +# set(CTEST_DROP_LOCATION "/submit.php?project=MyProject") +# set(CTEST_DROP_SITE_CDASH TRUE) +# (the CDash server can provide the file to a project administrator +# who configures 'MyProject'). +# Settings in the config file are shared by both this CTest module and +# the CTest command-line tool's dashboard script mode (ctest -S). +# +# While building a project for submission to CDash, CTest scans the +# build output for errors and warnings and reports them with +# surrounding context from the build log. This generic approach works +# for all build tools, but does not give details about the command +# invocation that produced a given problem. One may get more detailed +# reports by adding +# set(CTEST_USE_LAUNCHERS 1) +# to the CTestConfig.cmake file. When this option is enabled, the +# CTest module tells CMake's Makefile generators to invoke every +# command in the generated build system through a CTest launcher +# program. (Currently the CTEST_USE_LAUNCHERS option is ignored on +# non-Makefile generators.) During a manual build each launcher +# transparently runs the command it wraps. During a CTest-driven +# build for submission to CDash each launcher reports detailed +# information when its command fails or warns. +# (Setting CTEST_USE_LAUNCHERS in CTestConfig.cmake is convenient, but +# also adds the launcher overhead even for manual builds. One may +# instead set it in a CTest dashboard script and add it to the CMake +# cache for the build tree.) + +#============================================================================= +# Copyright 2005-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# 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. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +option(BUILD_TESTING "Build the testing tree." ON) + +# function to turn generator name into a version string +# like vs7 vs71 vs8 vs9 +function(get_vs_version_string generator var) + string(REGEX + REPLACE + "Visual Studio ([0-9][0-9]?)($|.*)" + "\\1" + NUMBER + "${generator}") + if("${generator}" MATCHES "Visual Studio 7 .NET 2003") + set(ver_string "vs71") + else() + set(ver_string "vs${NUMBER}") + endif() + set(${var} ${ver_string} PARENT_SCOPE) +endfunction() + +if(BUILD_TESTING) + # Setup some auxilary macros + macro(set_if_not_set var val) + if(NOT DEFINED "${var}") + set("${var}" "${val}") + endif() + endmacro() + + macro(set_if_set var val) + if(NOT "${val}" MATCHES "^$") + set("${var}" "${val}") + endif() + endmacro() + + macro(set_if_set_and_not_set var val) + if(NOT "${val}" MATCHES "^$") + set_if_not_set("${var}" "${val}") + endif() + endmacro() + + # Make sure testing is enabled + enable_testing() + + if(EXISTS "${PROJECT_SOURCE_DIR}/CTestConfig.cmake") + include("${PROJECT_SOURCE_DIR}/CTestConfig.cmake") + set_if_set_and_not_set(NIGHTLY_START_TIME + "${CTEST_NIGHTLY_START_TIME}") + set_if_set_and_not_set(DROP_METHOD "${CTEST_DROP_METHOD}") + set_if_set_and_not_set(DROP_SITE "${CTEST_DROP_SITE}") + set_if_set_and_not_set(DROP_SITE_USER "${CTEST_DROP_SITE_USER}") + set_if_set_and_not_set(DROP_SITE_PASSWORD + "${CTEST_DROP_SITE_PASWORD}") + set_if_set_and_not_set(DROP_SITE_MODE "${CTEST_DROP_SITE_MODE}") + set_if_set_and_not_set(DROP_LOCATION "${CTEST_DROP_LOCATION}") + set_if_set_and_not_set(TRIGGER_SITE "${CTEST_TRIGGER_SITE}") + set_if_set_and_not_set(UPDATE_TYPE "${CTEST_UPDATE_TYPE}") + endif() + + # the project can have a DartConfig.cmake file + if(EXISTS "${PROJECT_SOURCE_DIR}/DartConfig.cmake") + include("${PROJECT_SOURCE_DIR}/DartConfig.cmake") + else() + # Dashboard is opened for submissions for a 24 hour period starting at + # the specified NIGHTLY_START_TIME. Time is specified in 24 hour format. + set_if_not_set(NIGHTLY_START_TIME "00:00:00 EDT") + set_if_not_set(DROP_METHOD "http") + set_if_not_set(COMPRESS_SUBMISSION ON) + endif() + set_if_not_set(NIGHTLY_START_TIME "00:00:00 EDT") + + if(NOT UPDATE_TYPE) + if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CVS") + set(UPDATE_TYPE cvs) + elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.svn") + set(UPDATE_TYPE svn) + elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.bzr") + set(UPDATE_TYPE bzr) + elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.hg") + set(UPDATE_TYPE hg) + elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git") + set(UPDATE_TYPE git) + endif() + endif() + + if(NOT UPDATE_TYPE) + if(NOT __CTEST_UPDATE_TYPE_COMPLAINED) + set(__CTEST_UPDATE_TYPE_COMPLAINED + 1 + CACHE + INTERNAL + "Already complained about update type.") + message(STATUS + "CTest cannot determine repository type. Please set UPDATE_TYPE to cvs, svn, bzr, hg, or git. CTest update will not work.") + endif() + endif() + + string(TOLOWER "${UPDATE_TYPE}" _update_type) + if("${_update_type}" STREQUAL "cvs") + find_program(CVSCOMMAND cvs) + set(CVS_UPDATE_OPTIONS + "-d -A -P" + CACHE + STRING + "Options passed to the cvs update command.") + set(UPDATE_COMMAND "${CVSCOMMAND}") + set(UPDATE_OPTIONS "${CVS_UPDATE_OPTIONS}") + + elseif("${_update_type}" STREQUAL "svn") + find_program(SVNCOMMAND svn) + set(UPDATE_COMMAND "${SVNCOMMAND}") + set(UPDATE_OPTIONS "${SVN_UPDATE_OPTIONS}") + + elseif("${_update_type}" STREQUAL "bzr") + find_program(BZRCOMMAND bzr) + set(UPDATE_COMMAND "${BZRCOMMAND}") + set(UPDATE_OPTIONS "${BZR_UPDATE_OPTIONS}") + + elseif("${_update_type}" STREQUAL "hg") + find_program(HGCOMMAND hg) + set(UPDATE_COMMAND "${HGCOMMAND}") + set(UPDATE_OPTIONS "${HG_UPDATE_OPTIONS}") + + elseif("${_update_type}" STREQUAL "git") + find_program(GITCOMMAND git) + set(UPDATE_COMMAND "${GITCOMMAND}") + set(UPDATE_OPTIONS "${GIT_UPDATE_OPTIONS}") + endif() + + set(DART_TESTING_TIMEOUT + 1500 + CACHE + STRING + "Maximum time allowed before CTest will kill the test.") + + find_program(MEMORYCHECK_COMMAND + NAMES + purify + valgrind + boundscheck + PATHS + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Rational Software\\Purify\\Setup;InstallFolder]" + DOC + "Path to the memory checking command, used for memory error detection.") + find_program(SLURM_SBATCH_COMMAND + sbatch + DOC + "Path to the SLURM sbatch executable") + find_program(SLURM_SRUN_COMMAND + srun + DOC + "Path to the SLURM srun executable") + set(MEMORYCHECK_SUPPRESSIONS_FILE + "" + CACHE + FILEPATH + "File that contains suppressions for the memory checker") + find_program(SCPCOMMAND + scp + DOC + "Path to scp command, used by CTest for submitting results to a Dart server") + find_program(COVERAGE_COMMAND + gcov + DOC + "Path to the coverage program that CTest uses for performing coverage inspection") + + # set the site name + site_name(SITE) + # set the build name + if(NOT BUILDNAME) + set(DART_COMPILER "${CMAKE_CXX_COMPILER}") + + if(NOT DART_COMPILER) + set(DART_COMPILER "${CMAKE_C_COMPILER}") + endif() + + if(NOT DART_COMPILER) + set(DART_COMPILER "unknown") + endif() + + if(WIN32) + set(DART_NAME_COMPONENT "NAME_WE") + else() + set(DART_NAME_COMPONENT "NAME") + endif() + + if(NOT BUILD_NAME_SYSTEM_NAME) + set(BUILD_NAME_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}") + endif() + + if(WIN32) + set(BUILD_NAME_SYSTEM_NAME "Win32") + endif() + + if(UNIX OR BORLAND) + get_filename_component(DART_CXX_NAME + "${CMAKE_CXX_COMPILER}" + ${DART_NAME_COMPONENT}) + else() + get_filename_component(DART_CXX_NAME + "${CMAKE_BUILD_TOOL}" + ${DART_NAME_COMPONENT}) + endif() + + if(DART_CXX_NAME MATCHES "msdev") + set(DART_CXX_NAME "vs60") + endif() + + if(DART_CXX_NAME MATCHES "devenv") + get_vs_version_string("${CMAKE_GENERATOR}" DART_CXX_NAME) + endif() + + set(BUILDNAME "${BUILD_NAME_SYSTEM_NAME}-${DART_CXX_NAME}") + endif() + + # the build command + build_command(MAKECOMMAND CONFIGURATION "\${CTEST_CONFIGURATION_TYPE}") + set(MAKECOMMAND + ${MAKECOMMAND} + CACHE + STRING + "Command to build the project") + + # the default build configuration the ctest build handler will use + # if there is no -C arg given to ctest: + set(DEFAULT_CTEST_CONFIGURATION_TYPE "$ENV{CMAKE_CONFIG_TYPE}") + if(DEFAULT_CTEST_CONFIGURATION_TYPE STREQUAL "") + set(DEFAULT_CTEST_CONFIGURATION_TYPE "Release") + endif() + + if(NOT "${CMAKE_GENERATOR}" MATCHES "Make") + set(CTEST_USE_LAUNCHERS 0) + endif() + + if(CTEST_USE_LAUNCHERS) + set(CTEST_LAUNCH_COMPILE + "\"${CMAKE_CTEST_COMMAND}\" --launch --target-name --build-dir --output --source --language --") + set(CTEST_LAUNCH_LINK + "\"${CMAKE_CTEST_COMMAND}\" --launch --target-name --build-dir --output --target-type --language --") + set(CTEST_LAUNCH_CUSTOM + "\"${CMAKE_CTEST_COMMAND}\" --launch --target-name --build-dir --output --") + set_property(GLOBAL + PROPERTY + RULE_LAUNCH_COMPILE + "${CTEST_LAUNCH_COMPILE}") + set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CTEST_LAUNCH_LINK}") + set_property(GLOBAL + PROPERTY + RULE_LAUNCH_CUSTOM + "${CTEST_LAUNCH_CUSTOM}") + endif() + + mark_as_advanced(COVERAGE_COMMAND + CVSCOMMAND + SVNCOMMAND + BZRCOMMAND + HGCOMMAND + GITCOMMAND + CVS_UPDATE_OPTIONS + SVN_UPDATE_OPTIONS + BZR_UPDATE_OPTIONS + HG_UPDATE_OPTIONS + GIT_UPDATE_OPTIONS + MAKECOMMAND + MEMORYCHECK_COMMAND + MEMORYCHECK_SUPPRESSIONS_FILE + PURIFYCOMMAND + SCPCOMMAND + SLURM_SBATCH_COMMAND + SLURM_SRUN_COMMAND + SITE) + + if(NOT RUN_FROM_DART) + set(RUN_FROM_CTEST_OR_DART 1) + include(CTestTargets) + set(RUN_FROM_CTEST_OR_DART) + endif() +endif() diff --git a/lib/wiiuse/cmake/cmake-2.8.1-modules/patchctestbug10149/CTestScriptMode.cmake b/lib/wiiuse/cmake/cmake-2.8.1-modules/patchctestbug10149/CTestScriptMode.cmake new file mode 100644 index 000000000..e6ab6341b --- /dev/null +++ b/lib/wiiuse/cmake/cmake-2.8.1-modules/patchctestbug10149/CTestScriptMode.cmake @@ -0,0 +1,51 @@ +# This file is read by ctest in script mode (-S) + +#============================================================================= +# Copyright 2009 Kitware, Inc. +# Copyright 2009 Alexander Neundorf +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# 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. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# Determine the current system, so this information can be used +# in ctest scripts +include(CMakeDetermineSystem) + +# Also load the system specific file, which sets up e.g. the search paths. +# This makes the FIND_XXX() calls work much better +include(CMakeSystemSpecificInformation) + diff --git a/lib/wiiuse/cmake/cmake-2.8.1-modules/patchctestbug10149/CTestTargets.cmake b/lib/wiiuse/cmake/cmake-2.8.1-modules/patchctestbug10149/CTestTargets.cmake new file mode 100644 index 000000000..a964a039f --- /dev/null +++ b/lib/wiiuse/cmake/cmake-2.8.1-modules/patchctestbug10149/CTestTargets.cmake @@ -0,0 +1,131 @@ + +#============================================================================= +# Copyright 2005-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# 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. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +if(NOT RUN_FROM_CTEST_OR_DART) + message(FATAL_ERROR "Do not incldue CTestTargets.cmake directly") +endif() + +# make directories in the binary tree +file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/Testing/Temporary) +get_filename_component(CMAKE_HOST_PATH ${CMAKE_COMMAND} PATH) +set(CMAKE_TARGET_PATH ${EXECUTABLE_OUTPUT_PATH}) +find_program(CMAKE_CTEST_COMMAND + ctest + ${CMAKE_HOST_PATH} + ${CMAKE_TARGET_PATH}) +mark_as_advanced(CMAKE_CTEST_COMMAND) + +# Use CTest +# configure files + +if(CTEST_NEW_FORMAT) + configure_file(${CMAKE_ROOT}/Modules/DartConfiguration.tcl.in + ${PROJECT_BINARY_DIR}/CTestConfiguration.ini) +else() + configure_file(${CMAKE_ROOT}/Modules/DartConfiguration.tcl.in + ${PROJECT_BINARY_DIR}/DartConfiguration.tcl) +endif() + +# +# Section 3: +# +# Custom targets to perform dashboard builds and submissions. +# These should NOT need to be modified from project to project. +# + +set(__conf_types "") +if(CMAKE_CONFIGURATION_TYPES) + # We need to pass the configuration type on the test command line. + set(__conf_types -C "${CMAKE_CFG_INTDIR}") +endif() + +# Add convenience targets. Do this at most once in case of nested +# projects. +define_property(GLOBAL PROPERTY CTEST_TARGETS_ADDED + BRIEF_DOCS "Internal property used by CTestTargets module." + FULL_DOCS "Set by the CTestTargets module to track addition of testing targets.") + +get_property(_CTEST_TARGETS_ADDED GLOBAL PROPERTY CTEST_TARGETS_ADDED) +if(NOT _CTEST_TARGETS_ADDED) + set_property(GLOBAL PROPERTY CTEST_TARGETS_ADDED 1) + + # For all generators add basic testing targets. + foreach(mode Experimental Nightly Continuous NightlyMemoryCheck) + add_custom_target(${mode} + ${CMAKE_CTEST_COMMAND} + ${__conf_types} + -D + ${mode}) + set_property(TARGET ${mode} PROPERTY RULE_LAUNCH_CUSTOM "") + endforeach() + + # For Makefile generators add more granular targets. + if("${CMAKE_GENERATOR}" MATCHES Make) + # Make targets for Experimental builds + foreach(mode Nightly Experimental Continuous) + foreach(testtype + Start + Update + Configure + Build + Test + Coverage + MemCheck + Submit) # missing purify + + add_custom_target(${mode}${testtype} + ${CMAKE_CTEST_COMMAND} + ${__conf_types} + -D + ${mode}${testtype}) + set_property(TARGET + ${mode}${testtype} + PROPERTY + RULE_LAUNCH_CUSTOM + "") + endforeach() + endforeach() + endif() # makefile generators + +endif() diff --git a/lib/wiiuse/cmake/cmake-2.8.12-modules/CMakePackageConfigHelpers.cmake b/lib/wiiuse/cmake/cmake-2.8.12-modules/CMakePackageConfigHelpers.cmake new file mode 100644 index 000000000..6ad4aba8a --- /dev/null +++ b/lib/wiiuse/cmake/cmake-2.8.12-modules/CMakePackageConfigHelpers.cmake @@ -0,0 +1,358 @@ +#.rst: +# CMakePackageConfigHelpers +# ------------------------- +# +# CONFIGURE_PACKAGE_CONFIG_FILE(), WRITE_BASIC_PACKAGE_VERSION_FILE() +# +# +# +# :: +# +# CONFIGURE_PACKAGE_CONFIG_FILE( INSTALL_DESTINATION +# [PATH_VARS ... ] +# [NO_SET_AND_CHECK_MACRO] +# [NO_CHECK_REQUIRED_COMPONENTS_MACRO] +# [NO_FIND_DEPENDENCY_MACRO]) +# +# +# +# CONFIGURE_PACKAGE_CONFIG_FILE() should be used instead of the plain +# configure_file() command when creating the Config.cmake or +# -config.cmake file for installing a project or library. It +# helps making the resulting package relocatable by avoiding hardcoded +# paths in the installed Config.cmake file. +# +# In a FooConfig.cmake file there may be code like this to make the +# install destinations know to the using project: +# +# :: +# +# set(FOO_INCLUDE_DIR "@CMAKE_INSTALL_FULL_INCLUDEDIR@" ) +# set(FOO_DATA_DIR "@CMAKE_INSTALL_PREFIX@/@RELATIVE_DATA_INSTALL_DIR@" ) +# set(FOO_ICONS_DIR "@CMAKE_INSTALL_PREFIX@/share/icons" ) +# ...logic to determine installedPrefix from the own location... +# set(FOO_CONFIG_DIR "${installedPrefix}/@CONFIG_INSTALL_DIR@" ) +# +# All 4 options shown above are not sufficient, since the first 3 +# hardcode the absolute directory locations, and the 4th case works only +# if the logic to determine the installedPrefix is correct, and if +# CONFIG_INSTALL_DIR contains a relative path, which in general cannot +# be guaranteed. This has the effect that the resulting FooConfig.cmake +# file would work poorly under Windows and OSX, where users are used to +# choose the install location of a binary package at install time, +# independent from how CMAKE_INSTALL_PREFIX was set at build/cmake time. +# +# Using CONFIGURE_PACKAGE_CONFIG_FILE() helps. If used correctly, it +# makes the resulting FooConfig.cmake file relocatable. Usage: +# +# :: +# +# 1. write a FooConfig.cmake.in file as you are used to +# 2. insert a line containing only the string "@PACKAGE_INIT@" +# 3. instead of set(FOO_DIR "@SOME_INSTALL_DIR@"), use set(FOO_DIR "@PACKAGE_SOME_INSTALL_DIR@") +# (this must be after the @PACKAGE_INIT@ line) +# 4. instead of using the normal configure_file(), use CONFIGURE_PACKAGE_CONFIG_FILE() +# +# +# +# The and arguments are the input and output file, the +# same way as in configure_file(). +# +# The given to INSTALL_DESTINATION must be the destination where +# the FooConfig.cmake file will be installed to. This can either be a +# relative or absolute path, both work. +# +# The variables to given as PATH_VARS are the variables +# which contain install destinations. For each of them the macro will +# create a helper variable PACKAGE_. These helper variables +# must be used in the FooConfig.cmake.in file for setting the installed +# location. They are calculated by CONFIGURE_PACKAGE_CONFIG_FILE() so +# that they are always relative to the installed location of the +# package. This works both for relative and also for absolute +# locations. For absolute locations it works only if the absolute +# location is a subdirectory of CMAKE_INSTALL_PREFIX. +# +# By default configure_package_config_file() also generates two helper +# macros, set_and_check() and check_required_components() into the +# FooConfig.cmake file. +# +# set_and_check() should be used instead of the normal set() command for +# setting directories and file locations. Additionally to setting the +# variable it also checks that the referenced file or directory actually +# exists and fails with a FATAL_ERROR otherwise. This makes sure that +# the created FooConfig.cmake file does not contain wrong references. +# When using the NO_SET_AND_CHECK_MACRO, this macro is not generated +# into the FooConfig.cmake file. +# +# check_required_components() should be called at the end +# of the FooConfig.cmake file if the package supports components. This +# macro checks whether all requested, non-optional components have been +# found, and if this is not the case, sets the Foo_FOUND variable to +# FALSE, so that the package is considered to be not found. It does +# that by testing the Foo__FOUND variables for all requested +# required components. When using the NO_CHECK_REQUIRED_COMPONENTS +# option, this macro is not generated into the FooConfig.cmake file. +# +# For an example see below the documentation for +# WRITE_BASIC_PACKAGE_VERSION_FILE(). +# +# +# +# :: +# +# WRITE_BASIC_PACKAGE_VERSION_FILE( filename VERSION major.minor.patch COMPATIBILITY (AnyNewerVersion|SameMajorVersion|ExactVersion) ) +# +# +# +# Writes a file for use as ConfigVersion.cmake file to +# . See the documentation of find_package() for details on +# this. +# +# :: +# +# filename is the output filename, it should be in the build tree. +# major.minor.patch is the version number of the project to be installed +# +# The COMPATIBILITY mode AnyNewerVersion means that the installed +# package version will be considered compatible if it is newer or +# exactly the same as the requested version. This mode should be used +# for packages which are fully backward compatible, also across major +# versions. If SameMajorVersion is used instead, then the behaviour +# differs from AnyNewerVersion in that the major version number must be +# the same as requested, e.g. version 2.0 will not be considered +# compatible if 1.0 is requested. This mode should be used for packages +# which guarantee backward compatibility within the same major version. +# If ExactVersion is used, then the package is only considered +# compatible if the requested version matches exactly its own version +# number (not considering the tweak version). For example, version +# 1.2.3 of a package is only considered compatible to requested version +# 1.2.3. This mode is for packages without compatibility guarantees. +# If your project has more elaborated version matching rules, you will +# need to write your own custom ConfigVersion.cmake file instead of +# using this macro. +# +# Internally, this macro executes configure_file() to create the +# resulting version file. Depending on the COMPATIBLITY, either the +# file BasicConfigVersion-SameMajorVersion.cmake.in or +# BasicConfigVersion-AnyNewerVersion.cmake.in is used. Please note that +# these two files are internal to CMake and you should not call +# configure_file() on them yourself, but they can be used as starting +# point to create more sophisticted custom ConfigVersion.cmake files. +# +# +# +# Example using both configure_package_config_file() and +# write_basic_package_version_file(): CMakeLists.txt: +# +# :: +# +# set(INCLUDE_INSTALL_DIR include/ ... CACHE ) +# set(LIB_INSTALL_DIR lib/ ... CACHE ) +# set(SYSCONFIG_INSTALL_DIR etc/foo/ ... CACHE ) +# ... +# include(CMakePackageConfigHelpers) +# configure_package_config_file(FooConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake +# INSTALL_DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake +# PATH_VARS INCLUDE_INSTALL_DIR SYSCONFIG_INSTALL_DIR) +# write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake +# VERSION 1.2.3 +# COMPATIBILITY SameMajorVersion ) +# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake +# DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake ) +# +# +# +# With a FooConfig.cmake.in: +# +# :: +# +# set(FOO_VERSION x.y.z) +# ... +# @PACKAGE_INIT@ +# ... +# set_and_check(FOO_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@") +# set_and_check(FOO_SYSCONFIG_DIR "@PACKAGE_SYSCONFIG_INSTALL_DIR@") +# +# +# +# :: +# +# check_required_components(Foo) + + +#============================================================================= +# Copyright 2012 Alexander Neundorf +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# 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. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +include(CMakeParseArguments) + +include(WriteBasicConfigVersionFile) + +macro(WRITE_BASIC_PACKAGE_VERSION_FILE) + write_basic_config_version_file(${ARGN}) +endmacro() + + +function(CONFIGURE_PACKAGE_CONFIG_FILE _inputFile _outputFile) + set(options NO_SET_AND_CHECK_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO NO_FIND_DEPENDENCY_MACRO) + set(oneValueArgs INSTALL_DESTINATION ) + set(multiValueArgs PATH_VARS ) + + cmake_parse_arguments(CCF "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if(CCF_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "Unknown keywords given to CONFIGURE_PACKAGE_CONFIG_FILE(): \"${CCF_UNPARSED_ARGUMENTS}\"") + endif() + + if(NOT CCF_INSTALL_DESTINATION) + message(FATAL_ERROR "No INSTALL_DESTINATION given to CONFIGURE_PACKAGE_CONFIG_FILE()") + endif() + + if(IS_ABSOLUTE "${CCF_INSTALL_DESTINATION}") + set(absInstallDir "${CCF_INSTALL_DESTINATION}") + else() + set(absInstallDir "${CMAKE_INSTALL_PREFIX}/${CCF_INSTALL_DESTINATION}") + endif() + + file(RELATIVE_PATH PACKAGE_RELATIVE_PATH "${absInstallDir}" "${CMAKE_INSTALL_PREFIX}" ) + + foreach(var ${CCF_PATH_VARS}) + if(NOT DEFINED ${var}) + message(FATAL_ERROR "Variable ${var} does not exist") + else() + if(IS_ABSOLUTE "${${var}}") + string(REPLACE "${CMAKE_INSTALL_PREFIX}" "\${PACKAGE_PREFIX_DIR}" + PACKAGE_${var} "${${var}}") + else() + set(PACKAGE_${var} "\${PACKAGE_PREFIX_DIR}/${${var}}") + endif() + endif() + endforeach() + + get_filename_component(inputFileName "${_inputFile}" NAME) + + set(PACKAGE_INIT " +####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() ####### +####### Any changes to this file will be overwritten by the next CMake run #### +####### The input file was ${inputFileName} ######## + +get_filename_component(PACKAGE_PREFIX_DIR \"\${CMAKE_CURRENT_LIST_DIR}/${PACKAGE_RELATIVE_PATH}\" ABSOLUTE) +") + + if("${absInstallDir}" MATCHES "^(/usr)?/lib(64)?/.+") + # Handle "/usr move" symlinks created by some Linux distros. + set(PACKAGE_INIT "${PACKAGE_INIT} +# Use original install prefix when loaded through a \"/usr move\" +# cross-prefix symbolic link such as /lib -> /usr/lib. +get_filename_component(_realCurr \"\${CMAKE_CURRENT_LIST_DIR}\" REALPATH) +get_filename_component(_realOrig \"${absInstallDir}\" REALPATH) +if(_realCurr STREQUAL _realOrig) + set(PACKAGE_PREFIX_DIR \"${CMAKE_INSTALL_PREFIX}\") +endif() +unset(_realOrig) +unset(_realCurr) +") + endif() + + if(NOT CCF_NO_SET_AND_CHECK_MACRO) + set(PACKAGE_INIT "${PACKAGE_INIT} +macro(set_and_check _var _file) + set(\${_var} \"\${_file}\") + if(NOT EXISTS \"\${_file}\") + message(FATAL_ERROR \"File or directory \${_file} referenced by variable \${_var} does not exist !\") + endif() +endmacro() +") + endif() + + + if(NOT CCF_NO_CHECK_REQUIRED_COMPONENTS_MACRO) + set(PACKAGE_INIT "${PACKAGE_INIT} +macro(check_required_components _NAME) + foreach(comp \${\${_NAME}_FIND_COMPONENTS}) + if(NOT \${_NAME}_\${comp}_FOUND) + if(\${_NAME}_FIND_REQUIRED_\${comp}) + set(\${_NAME}_FOUND FALSE) + endif() + endif() + endforeach() +endmacro() +") + endif() + + if(NOT CCF_NO_FIND_DEPENDENCY_MACRO) + set(PACKAGE_INIT "${PACKAGE_INIT} +macro(find_dependency dep) + if (NOT \${dep}_FOUND) + if (\${ARGV1}) + set(version \${ARGV1}) + endif() + set(exact_arg) + if(\${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION_EXACT) + set(exact_arg EXACT) + endif() + set(quiet_arg) + if(\${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) + set(quiet_arg QUIET) + endif() + set(required_arg) + if(\${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED) + set(required_arg REQUIRED) + endif() + + find_package(\${dep} \${version} \${exact_arg} \${quiet_arg} \${required_arg}) + if (NOT \${dep}_FOUND) + set(\${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE \"\${CMAKE_FIND_PACKAGE_NAME} could not be found because dependency \${dep} could not be found.\") + set(\${CMAKE_FIND_PACKAGE_NAME}_FOUND False) + return() + endif() + set(required_arg) + set(quiet_arg) + set(exact_arg) + endif() +endmacro() +") + endif() + + set(PACKAGE_INIT "${PACKAGE_INIT} +####################################################################################") + + configure_file("${_inputFile}" "${_outputFile}" @ONLY) + +endfunction() diff --git a/lib/wiiuse/cmake/cmake-2.8.12-modules/CMakeParseArguments.cmake b/lib/wiiuse/cmake/cmake-2.8.12-modules/CMakeParseArguments.cmake new file mode 100644 index 000000000..3c8002272 --- /dev/null +++ b/lib/wiiuse/cmake/cmake-2.8.12-modules/CMakeParseArguments.cmake @@ -0,0 +1,187 @@ +#.rst: +# CMakeParseArguments +# ------------------- +# +# +# +# CMAKE_PARSE_ARGUMENTS( +# args...) +# +# CMAKE_PARSE_ARGUMENTS() is intended to be used in macros or functions +# for parsing the arguments given to that macro or function. It +# processes the arguments and defines a set of variables which hold the +# values of the respective options. +# +# The argument contains all options for the respective macro, +# i.e. keywords which can be used when calling the macro without any +# value following, like e.g. the OPTIONAL keyword of the install() +# command. +# +# The argument contains all keywords for this macro +# which are followed by one value, like e.g. DESTINATION keyword of the +# install() command. +# +# The argument contains all keywords for this +# macro which can be followed by more than one value, like e.g. the +# TARGETS or FILES keywords of the install() command. +# +# When done, CMAKE_PARSE_ARGUMENTS() will have defined for each of the +# keywords listed in , and +# a variable composed of the given +# followed by "_" and the name of the respective keyword. These +# variables will then hold the respective value from the argument list. +# For the keywords this will be TRUE or FALSE. +# +# All remaining arguments are collected in a variable +# _UNPARSED_ARGUMENTS, this can be checked afterwards to see +# whether your macro was called with unrecognized parameters. +# +# As an example here a my_install() macro, which takes similar arguments +# as the real install() command: +# +# :: +# +# function(MY_INSTALL) +# set(options OPTIONAL FAST) +# set(oneValueArgs DESTINATION RENAME) +# set(multiValueArgs TARGETS CONFIGURATIONS) +# cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) +# ... +# +# +# +# Assume my_install() has been called like this: +# +# :: +# +# my_install(TARGETS foo bar DESTINATION bin OPTIONAL blub) +# +# +# +# After the cmake_parse_arguments() call the macro will have set the +# following variables: +# +# :: +# +# MY_INSTALL_OPTIONAL = TRUE +# MY_INSTALL_FAST = FALSE (this option was not used when calling my_install() +# MY_INSTALL_DESTINATION = "bin" +# MY_INSTALL_RENAME = "" (was not used) +# MY_INSTALL_TARGETS = "foo;bar" +# MY_INSTALL_CONFIGURATIONS = "" (was not used) +# MY_INSTALL_UNPARSED_ARGUMENTS = "blub" (no value expected after "OPTIONAL" +# +# +# +# You can then continue and process these variables. +# +# Keywords terminate lists of values, e.g. if directly after a +# one_value_keyword another recognized keyword follows, this is +# interpreted as the beginning of the new option. E.g. +# my_install(TARGETS foo DESTINATION OPTIONAL) would result in +# MY_INSTALL_DESTINATION set to "OPTIONAL", but MY_INSTALL_DESTINATION +# would be empty and MY_INSTALL_OPTIONAL would be set to TRUE therefor. + +#============================================================================= +# Copyright 2010 Alexander Neundorf +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# 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. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + + +if(__CMAKE_PARSE_ARGUMENTS_INCLUDED) + return() +endif() +set(__CMAKE_PARSE_ARGUMENTS_INCLUDED TRUE) + + +function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgNames) + # first set all result variables to empty/FALSE + foreach(arg_name ${_singleArgNames} ${_multiArgNames}) + set(${prefix}_${arg_name}) + endforeach() + + foreach(option ${_optionNames}) + set(${prefix}_${option} FALSE) + endforeach() + + set(${prefix}_UNPARSED_ARGUMENTS) + + set(insideValues FALSE) + set(currentArgName) + + # now iterate over all arguments and fill the result variables + foreach(currentArg ${ARGN}) + list(FIND _optionNames "${currentArg}" optionIndex) # ... then this marks the end of the arguments belonging to this keyword + list(FIND _singleArgNames "${currentArg}" singleArgIndex) # ... then this marks the end of the arguments belonging to this keyword + list(FIND _multiArgNames "${currentArg}" multiArgIndex) # ... then this marks the end of the arguments belonging to this keyword + + if(${optionIndex} EQUAL -1 AND ${singleArgIndex} EQUAL -1 AND ${multiArgIndex} EQUAL -1) + if(insideValues) + if("${insideValues}" STREQUAL "SINGLE") + set(${prefix}_${currentArgName} ${currentArg}) + set(insideValues FALSE) + elseif("${insideValues}" STREQUAL "MULTI") + list(APPEND ${prefix}_${currentArgName} ${currentArg}) + endif() + else() + list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg}) + endif() + else() + if(NOT ${optionIndex} EQUAL -1) + set(${prefix}_${currentArg} TRUE) + set(insideValues FALSE) + elseif(NOT ${singleArgIndex} EQUAL -1) + set(currentArgName ${currentArg}) + set(${prefix}_${currentArgName}) + set(insideValues "SINGLE") + elseif(NOT ${multiArgIndex} EQUAL -1) + set(currentArgName ${currentArg}) + set(${prefix}_${currentArgName}) + set(insideValues "MULTI") + endif() + endif() + + endforeach() + + # propagate the result variables to the caller: + foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames}) + set(${prefix}_${arg_name} ${${prefix}_${arg_name}} PARENT_SCOPE) + endforeach() + set(${prefix}_UNPARSED_ARGUMENTS ${${prefix}_UNPARSED_ARGUMENTS} PARENT_SCOPE) + +endfunction() diff --git a/lib/wiiuse/cmake/cmake-2.8.3-modules/FixWinInstallPrefix.cmake b/lib/wiiuse/cmake/cmake-2.8.3-modules/FixWinInstallPrefix.cmake new file mode 100644 index 000000000..ceb180baa --- /dev/null +++ b/lib/wiiuse/cmake/cmake-2.8.3-modules/FixWinInstallPrefix.cmake @@ -0,0 +1,78 @@ +# - Automatically fix CMAKE_INSTALL_PREFIX to be bit-appropriate on Win +# +# This is a workaround for CMake bug #9992 in <2.8.3 - see +# http://public.kitware.com/Bug/view.php?id=9992 +# +# It runs automatically when included on a Windows build (passes if(WIN32)) - +# include after setting your project name (and your module search path, +# obviously) +# +# 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) + # caution - ENV{ProgramFiles} on Win64 is adjusted to point to the arch + # of the running executable which, since CMake is 32-bit on Windows as + # I write this, will always be = $ENV{ProgramFiles(x86)}. + # Thus, we only use this environment variable if we are on a 32 machine + + # 32-bit dir on win32, useless to us on win64 + file(TO_CMAKE_PATH "$ENV{ProgramFiles}" _PROG_FILES) + + # 32-bit dir: only set on win64 + set(_PF86 "ProgramFiles(x86)") + file(TO_CMAKE_PATH "$ENV{${_PF86}}" _PROG_FILES_X86) + + # 64-bit dir: only set on win64 + file(TO_CMAKE_PATH "$ENV{ProgramW6432}" _PROG_FILES_W6432) + + if(CMAKE_SIZEOF_VOID_P MATCHES "8") + # 64-bit build on win64 + set(_PROGFILESDIR "${_PROG_FILES_W6432}") + else() + if(_PROG_FILES_W6432) + # 32-bit build on win64 + set(_PROGFILESDIR "${_PROG_FILES_X86}") + else() + # 32-bit build on win32 + set(_PROGFILESDIR "${_PROG_FILES}") + endif() + endif() + + if(NOT FIXWININSTALLPREFIX_PREFIX) + set(_needsfix yes) + elseif(NOT + "${FIXWININSTALLPREFIX_PREFIX}" + STREQUAL + "${CMAKE_INSTALL_PREFIX}") + set(_needsfix yes) + else() + set(_needsfix) + endif() + + if(_needsfix) + if("${CMAKE_INSTALL_PREFIX}" + STREQUAL + "${_PROG_FILES}/${CMAKE_PROJECT_NAME}") + # The user didn't change this yet - it's the potentially broken default + set(CMAKE_INSTALL_PREFIX + "${_PROGFILESDIR}/${CMAKE_PROJECT_NAME}" + CACHE + PATH + "Where to install the project - has been adjusted by FixWinInstallPrefix" + FORCE) + endif() + set(FIXWININSTALLPREFIX_PREFIX + "${CMAKE_INSTALL_PREFIX}" + CACHE + INTERNAL + "We've fixed the prefix.") + endif() +endif() diff --git a/lib/wiiuse/cmake/cmake-2.8.3-modules/autoinclude.cmake b/lib/wiiuse/cmake/cmake-2.8.3-modules/autoinclude.cmake new file mode 100644 index 000000000..64d8f62b9 --- /dev/null +++ b/lib/wiiuse/cmake/cmake-2.8.3-modules/autoinclude.cmake @@ -0,0 +1,13 @@ +# - Autoinclude these policies automatically +# +# 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) + +include(FixWinInstallPrefix) diff --git a/lib/wiiuse/cmake/cmake-2.8.4-modules/ImproveEclipseGCCErrors.cmake b/lib/wiiuse/cmake/cmake-2.8.4-modules/ImproveEclipseGCCErrors.cmake new file mode 100644 index 000000000..2f7f3170d --- /dev/null +++ b/lib/wiiuse/cmake/cmake-2.8.4-modules/ImproveEclipseGCCErrors.cmake @@ -0,0 +1,19 @@ +# - Add a GCC flag so that the errors are more suitable to parsing by Eclipse +# +# include(ImproveEclipseGCCErrors) +# +# +# 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("${CMAKE_GENERATOR}" MATCHES "Eclipse" AND CMAKE_COMPILER_IS_GNUCXX) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fmessage-length=0") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmessage-length=0") +endif() diff --git a/lib/wiiuse/cmake/cmake-2.8.4-modules/autoinclude.cmake b/lib/wiiuse/cmake/cmake-2.8.4-modules/autoinclude.cmake new file mode 100644 index 000000000..2c98e2499 --- /dev/null +++ b/lib/wiiuse/cmake/cmake-2.8.4-modules/autoinclude.cmake @@ -0,0 +1,13 @@ +# - Autoinclude these policies automatically +# +# 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) + +include(ImproveEclipseGCCErrors) diff --git a/lib/wiiuse/cmake/cmake-2.8.4-modules/boost/FindBoost.cmake b/lib/wiiuse/cmake/cmake-2.8.4-modules/boost/FindBoost.cmake new file mode 100644 index 000000000..9dbfb8023 --- /dev/null +++ b/lib/wiiuse/cmake/cmake-2.8.4-modules/boost/FindBoost.cmake @@ -0,0 +1,1171 @@ +# - Try to find Boost include dirs and libraries +# Usage of this module as follows: +# +# NOTE: Take note of the Boost_ADDITIONAL_VERSIONS variable below. +# Due to Boost naming conventions and limitations in CMake this find +# module is NOT future safe with respect to Boost version numbers, +# and may break. +# +# == Using Header-Only libraries from within Boost: == +# +# find_package( Boost 1.36.0 ) +# if(Boost_FOUND) +# include_directories(${Boost_INCLUDE_DIRS}) +# add_executable(foo foo.cc) +# endif() +# +# +# == Using actual libraries from within Boost: == +# +# set(Boost_USE_STATIC_LIBS ON) +# set(Boost_USE_MULTITHREADED ON) +# set(Boost_USE_STATIC_RUNTIME OFF) +# find_package( Boost 1.36.0 COMPONENTS date_time filesystem system ... ) +# +# if(Boost_FOUND) +# include_directories(${Boost_INCLUDE_DIRS}) +# add_executable(foo foo.cc) +# target_link_libraries(foo ${Boost_LIBRARIES}) +# endif() +# +# +# The components list needs to contain actual names of boost libraries only, +# such as "date_time" for "libboost_date_time". If you're using parts of +# Boost that contain header files only (e.g. foreach) you do not need to +# specify COMPONENTS. +# +# You should provide a minimum version number that should be used. If you provide this +# version number and specify the REQUIRED attribute, this module will fail if it +# can't find the specified or a later version. If you specify a version number this is +# automatically put into the considered list of version numbers and thus doesn't need +# to be specified in the Boost_ADDITIONAL_VERSIONS variable (see below). +# +# NOTE for Visual Studio Users: +# Automatic linking is used on MSVC & Borland compilers by default when +# #including things in Boost. It's important to note that setting +# Boost_USE_STATIC_LIBS to OFF is NOT enough to get you dynamic linking, +# should you need this feature. Automatic linking typically uses static +# libraries with a few exceptions (Boost.Python is one). +# +# Please see the section below near Boost_LIB_DIAGNOSTIC_DEFINITIONS for +# more details. Adding a TARGET_LINK_LIBRARIES() as shown in the example +# above appears to cause VS to link dynamically if Boost_USE_STATIC_LIBS +# gets set to OFF. It is suggested you avoid automatic linking since it +# will make your application less portable. +# +# =========== The mess that is Boost_ADDITIONAL_VERSIONS (sorry?) ============ +# +# OK, so the Boost_ADDITIONAL_VERSIONS variable can be used to specify a list of +# boost version numbers that should be taken into account when searching +# for Boost. Unfortunately boost puts the version number into the +# actual filename for the libraries, so this variable will certainly be needed +# in the future when new Boost versions are released. +# +# Currently this module searches for the following version numbers: +# 1.33, 1.33.0, 1.33.1, 1.34, 1.34.0, 1.34.1, 1.35, 1.35.0, 1.35.1, +# 1.36, 1.36.0, 1.36.1, 1.37, 1.37.0, 1.38, 1.38.0, 1.39, 1.39.0, +# 1.40, 1.40.0, 1.41, 1.41.0, 1.42, 1.42.0, 1.43, 1.43.0, 1.44, 1.44.0, +# 1.45, 1.45.0, 1.46, 1.46.0 +# +# NOTE: If you add a new major 1.x version in Boost_ADDITIONAL_VERSIONS you should +# add both 1.x and 1.x.0 as shown above. Official Boost include directories +# omit the 3rd version number from include paths if it is 0 although not all +# binary Boost releases do so. +# +# SET(Boost_ADDITIONAL_VERSIONS "1.78" "1.78.0" "1.79" "1.79.0") +# +# ===================================== ============= ======================== +# +# Variables used by this module, they can change the default behaviour and +# need to be set before calling find_package: +# +# Boost_USE_MULTITHREADED Can be set to OFF to use the non-multithreaded +# boost libraries. If not specified, defaults +# to ON. +# +# Boost_USE_STATIC_LIBS Can be set to ON to force the use of the static +# boost libraries. Defaults to OFF. +# +# Boost_NO_SYSTEM_PATHS Set to TRUE to suppress searching in system +# paths (or other locations outside of BOOST_ROOT +# or BOOST_INCLUDEDIR). Useful when specifying +# BOOST_ROOT. Defaults to OFF. +# [Since CMake 2.8.3] +# +# Boost_USE_STATIC_RUNTIME If enabled, searches for boost libraries +# linked against a static C++ standard library +# ('s' ABI tag). This option should be set to +# ON or OFF because the default behavior +# if not specified is platform dependent +# for backwards compatibility. +# [Since CMake 2.8.3] +# +# Boost_USE_DEBUG_PYTHON If enabled, searches for boost libraries +# compiled against a special debug build of +# Python ('y' ABI tag). Defaults to OFF. +# [Since CMake 2.8.3] +# +# Boost_USE_STLPORT If enabled, searches for boost libraries +# compiled against the STLPort standard +# library ('p' ABI tag). Defaults to OFF. +# [Since CMake 2.8.3] +# +# Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS +# If enabled, searches for boost libraries +# compiled against the deprecated STLPort +# "native iostreams" feature ('n' ABI tag). +# Defaults to OFF. +# [Since CMake 2.8.3] +# +# Other Variables used by this module which you may want to set. +# +# Boost_ADDITIONAL_VERSIONS A list of version numbers to use for searching +# the boost include directory. Please see +# the documentation above regarding this +# annoying, but necessary variable :( +# +# Boost_DEBUG Set this to TRUE to enable debugging output +# of FindBoost.cmake if you are having problems. +# Please enable this before filing any bug +# reports. +# +# Boost_DETAILED_FAILURE_MSG FindBoost doesn't output detailed information +# about why it failed or how to fix the problem +# unless this is set to TRUE or the REQUIRED +# keyword is specified in find_package(). +# [Since CMake 2.8.0] +# +# Boost_COMPILER Set this to the compiler suffix used by Boost +# (e.g. "-gcc43") if FindBoost has problems finding +# the proper Boost installation +# +# Boost_THREADAPI When building boost.thread, sometimes the name of the +# library contains an additional "pthread" or "win32" +# string known as the threadapi. This can happen when +# compiling against pthreads on Windows or win32 threads +# on Cygwin. You may specify this variable and if set +# when FindBoost searches for the Boost threading library +# it will first try to match the threadapi you specify. +# For Example: libboost_thread_win32-mgw45-mt-1_43.a +# might be found if you specified "win32" here before +# falling back on libboost_thread-mgw45-mt-1_43.a. +# [Since CMake 2.8.3] +# +# Boost_REALPATH Resolves symbolic links for discovered boost libraries +# to assist with packaging. For example, instead of +# Boost_SYSTEM_LIBRARY_RELEASE being resolved to +# "/usr/lib/libboost_system.so" it would be +# "/usr/lib/libboost_system.so.1.42.0" instead. +# This does not affect linking and should not be +# enabled unless the user needs this information. +# [Since CMake 2.8.3] +# + + +# +# These last three variables are available also as environment variables: +# +# BOOST_ROOT or BOOSTROOT The preferred installation prefix for searching for +# Boost. Set this if the module has problems finding +# the proper Boost installation. To prevent falling +# back on the system paths, set Boost_NO_SYSTEM_PATHS +# to true. +# +# BOOST_INCLUDEDIR Set this to the include directory of Boost, if the +# module has problems finding the proper Boost installation +# +# BOOST_LIBRARYDIR Set this to the lib directory of Boost, if the +# module has problems finding the proper Boost installation +# +# Variables defined by this module: +# +# Boost_FOUND System has Boost, this means the include dir was +# found, as well as all the libraries specified in +# the COMPONENTS list. +# +# Boost_INCLUDE_DIRS Boost include directories: not cached +# +# Boost_INCLUDE_DIR This is almost the same as above, but this one is +# cached and may be modified by advanced users +# +# Boost_LIBRARIES Link to these to use the Boost libraries that you +# specified: not cached +# +# Boost_LIBRARY_DIRS The path to where the Boost library files are. +# +# Boost_VERSION The version number of the boost libraries that +# have been found, same as in version.hpp from Boost +# +# Boost_LIB_VERSION The version number in filename form as +# it's appended to the library filenames +# +# Boost_MAJOR_VERSION major version number of boost +# Boost_MINOR_VERSION minor version number of boost +# Boost_SUBMINOR_VERSION subminor version number of boost +# +# Boost_LIB_DIAGNOSTIC_DEFINITIONS [WIN32 Only] You can call +# add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS}) +# to have diagnostic information about Boost's +# automatic linking outputted during compilation time. +# +# For each component you specify in find_package(), the following (UPPER-CASE) +# variables are set. You can use these variables if you would like to pick and +# choose components for your targets instead of just using Boost_LIBRARIES. +# +# Boost_${COMPONENT}_FOUND True IF the Boost library "component" was found. +# +# Boost_${COMPONENT}_LIBRARY Contains the libraries for the specified Boost +# "component" (includes debug and optimized keywords +# when needed). + +#============================================================================= +# Copyright 2006-2009 Kitware, Inc. +# Copyright 2006-2008 Andreas Schneider +# Copyright 2007 Wengo +# Copyright 2007 Mike Jackson +# Copyright 2008 Andreas Pakulat +# Copyright 2008-2010 Philip Lowman +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# 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. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +#------------------------------------------------------------------------------- +# FindBoost functions & macros +# +############################################ +# +# Check the existence of the libraries. +# +############################################ +# This macro was taken directly from the FindQt4.cmake file that is included +# with the CMake distribution. This is NOT my work. All work was done by the +# original authors of the FindQt4.cmake file. Only minor modifications were +# made to remove references to Qt and make this file more generally applicable +# And ELSE/ENDIF pairs were removed for readability. +######################################################################### + +MACRO (_Boost_ADJUST_LIB_VARS basename) + IF (Boost_INCLUDE_DIR ) + IF (Boost_${basename}_LIBRARY_DEBUG AND Boost_${basename}_LIBRARY_RELEASE) + # if the generator supports configuration types then set + # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value + IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) + SET(Boost_${basename}_LIBRARY optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG}) + ELSE() + # if there are no configuration types and CMAKE_BUILD_TYPE has no value + # then just use the release libraries + SET(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE} ) + ENDIF() + # FIXME: This probably should be set for both cases + SET(Boost_${basename}_LIBRARIES optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG}) + ENDIF() + + # if only the release version was found, set the debug variable also to the release version + IF (Boost_${basename}_LIBRARY_RELEASE AND NOT Boost_${basename}_LIBRARY_DEBUG) + SET(Boost_${basename}_LIBRARY_DEBUG ${Boost_${basename}_LIBRARY_RELEASE}) + SET(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE}) + SET(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_RELEASE}) + ENDIF() + + # if only the debug version was found, set the release variable also to the debug version + IF (Boost_${basename}_LIBRARY_DEBUG AND NOT Boost_${basename}_LIBRARY_RELEASE) + SET(Boost_${basename}_LIBRARY_RELEASE ${Boost_${basename}_LIBRARY_DEBUG}) + SET(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_DEBUG}) + SET(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_DEBUG}) + ENDIF() + + IF (Boost_${basename}_LIBRARY) + set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY} CACHE FILEPATH "The Boost ${basename} library") + + # Remove superfluous "debug" / "optimized" keywords from + # Boost_LIBRARY_DIRS + FOREACH(_boost_my_lib ${Boost_${basename}_LIBRARY}) + GET_FILENAME_COMPONENT(_boost_my_lib_path "${_boost_my_lib}" PATH) + LIST(APPEND Boost_LIBRARY_DIRS ${_boost_my_lib_path}) + ENDFOREACH() + LIST(REMOVE_DUPLICATES Boost_LIBRARY_DIRS) + + set(Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIRS} CACHE FILEPATH "Boost library directory") + SET(Boost_${basename}_FOUND ON CACHE INTERNAL "Whether the Boost ${basename} library found") + ENDIF(Boost_${basename}_LIBRARY) + + ENDIF (Boost_INCLUDE_DIR ) + # Make variables changeble to the advanced user + MARK_AS_ADVANCED( + Boost_${basename}_LIBRARY + Boost_${basename}_LIBRARY_RELEASE + Boost_${basename}_LIBRARY_DEBUG + ) +ENDMACRO (_Boost_ADJUST_LIB_VARS) + +#------------------------------------------------------------------------------- + +# +# Runs compiler with "-dumpversion" and parses major/minor +# version with a regex. +# +FUNCTION(_Boost_COMPILER_DUMPVERSION _OUTPUT_VERSION) + + EXEC_PROGRAM(${CMAKE_CXX_COMPILER} + ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion + OUTPUT_VARIABLE _boost_COMPILER_VERSION + ) + STRING(REGEX REPLACE "([0-9])\\.([0-9])(\\.[0-9])?" "\\1\\2" + _boost_COMPILER_VERSION ${_boost_COMPILER_VERSION}) + + SET(${_OUTPUT_VERSION} ${_boost_COMPILER_VERSION} PARENT_SCOPE) +ENDFUNCTION() + +# +# A convenience function for marking desired components +# as found or not +# +function(_Boost_MARK_COMPONENTS_FOUND _yes_or_no) + foreach(COMPONENT ${Boost_FIND_COMPONENTS}) + string(TOUPPER ${COMPONENT} UPPERCOMPONENT) + set(Boost_${UPPERCOMPONENT}_FOUND ${_yes_or_no} CACHE INTERNAL "Whether the Boost ${COMPONENT} library found" FORCE) + endforeach() +endfunction() + +# +# Take a list of libraries with "thread" in it +# and prepend duplicates with "thread_${Boost_THREADAPI}" +# at the front of the list +# +function(_Boost_PREPEND_LIST_WITH_THREADAPI _output) + set(_orig_libnames ${ARGN}) + string(REPLACE "thread" "thread_${Boost_THREADAPI}" _threadapi_libnames ${_orig_libnames}) + set(${_output} ${_threadapi_libnames} ${_orig_libnames} PARENT_SCOPE) +endfunction() + +# +# If a library is found, replace its cache entry with its REALPATH +# +function(_Boost_SWAP_WITH_REALPATH _library _docstring) + if(${_library}) + get_filename_component(_boost_filepathreal ${${_library}} REALPATH) + unset(${_library} CACHE) + set(${_library} ${_boost_filepathreal} CACHE FILEPATH "${_docstring}") + endif() +endfunction() + +# +# End functions/macros +# +#------------------------------------------------------------------------------- + + + + +IF(NOT DEFINED Boost_USE_MULTITHREADED) + SET(Boost_USE_MULTITHREADED TRUE) +ENDIF() + +if(Boost_FIND_VERSION_EXACT) + # The version may appear in a directory with or without the patch + # level, even when the patch level is non-zero. + set(_boost_TEST_VERSIONS + "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}.${Boost_FIND_VERSION_PATCH}" + "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}") +else(Boost_FIND_VERSION_EXACT) + # The user has not requested an exact version. Among known + # versions, find those that are acceptable to the user request. + set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS} + "1.46.0" "1.46" "1.45.0" "1.45" "1.44.0" "1.44" "1.43.0" "1.43" "1.42.0" "1.42" + "1.41.0" "1.41" "1.40.0" "1.40" "1.39.0" "1.39" "1.38.0" "1.38" "1.37.0" "1.37" + "1.36.1" "1.36.0" "1.36" "1.35.1" "1.35.0" "1.35" "1.34.1" "1.34.0" + "1.34" "1.33.1" "1.33.0" "1.33") + set(_boost_TEST_VERSIONS) + if(Boost_FIND_VERSION) + set(_Boost_FIND_VERSION_SHORT "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}") + # Select acceptable versions. + foreach(version ${_Boost_KNOWN_VERSIONS}) + if(NOT "${version}" VERSION_LESS "${Boost_FIND_VERSION}") + # This version is high enough. + list(APPEND _boost_TEST_VERSIONS "${version}") + elseif("${version}.99" VERSION_EQUAL "${_Boost_FIND_VERSION_SHORT}.99") + # This version is a short-form for the requested version with + # the patch level dropped. + list(APPEND _boost_TEST_VERSIONS "${version}") + endif() + endforeach(version) + else(Boost_FIND_VERSION) + # Any version is acceptable. + set(_boost_TEST_VERSIONS "${_Boost_KNOWN_VERSIONS}") + endif(Boost_FIND_VERSION) +endif(Boost_FIND_VERSION_EXACT) + +# The reason that we failed to find Boost. This will be set to a +# user-friendly message when we fail to find some necessary piece of +# Boost. +set(Boost_ERROR_REASON) + +SET( _boost_IN_CACHE TRUE) +IF(Boost_INCLUDE_DIR) + + # On versions < 1.35, remove the System library from the considered list + # since it wasn't added until 1.35. + if(Boost_VERSION AND Boost_FIND_COMPONENTS) + if(Boost_VERSION LESS 103500) + list(REMOVE_ITEM Boost_FIND_COMPONENTS system) + endif() + endif() + + FOREACH(COMPONENT ${Boost_FIND_COMPONENTS}) + STRING(TOUPPER ${COMPONENT} COMPONENT) + IF(NOT Boost_${COMPONENT}_FOUND) + SET( _boost_IN_CACHE FALSE) + ENDIF(NOT Boost_${COMPONENT}_FOUND) + ENDFOREACH(COMPONENT) +ELSE(Boost_INCLUDE_DIR) + SET( _boost_IN_CACHE FALSE) +ENDIF(Boost_INCLUDE_DIR) + +IF (_boost_IN_CACHE) + # in cache already + SET(Boost_FOUND TRUE) + FOREACH(COMPONENT ${Boost_FIND_COMPONENTS}) + STRING(TOUPPER ${COMPONENT} COMPONENT) + _Boost_ADJUST_LIB_VARS( ${COMPONENT} ) + SET(Boost_LIBRARIES ${Boost_LIBRARIES} ${Boost_${COMPONENT}_LIBRARY}) + ENDFOREACH(COMPONENT) + SET(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIR}) + IF(Boost_VERSION AND NOT "${Boost_VERSION}" STREQUAL "0") + MATH(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000") + MATH(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000") + MATH(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100") + ENDIF(Boost_VERSION AND NOT "${Boost_VERSION}" STREQUAL "0") + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "boost ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION} " + "is already in the cache. To view debugging messages, please clear the cache.") + endif() +ELSE (_boost_IN_CACHE) + # Need to search for boost + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Boost not in cache") + # Output some of their choices + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Boost_USE_MULTITHREADED = ${Boost_USE_MULTITHREADED}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Boost_USE_STATIC_LIBS = ${Boost_USE_STATIC_LIBS}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Boost_USE_STATIC_RUNTIME = ${Boost_USE_STATIC_RUNTIME}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Boost_ADDITIONAL_VERSIONS = ${Boost_ADDITIONAL_VERSIONS}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Boost_NO_SYSTEM_PATHS = ${Boost_NO_SYSTEM_PATHS}") + endif() + + IF(WIN32) + # In windows, automatic linking is performed, so you do not have + # to specify the libraries. If you are linking to a dynamic + # runtime, then you can choose to link to either a static or a + # dynamic Boost library, the default is to do a static link. You + # can alter this for a specific library "whatever" by defining + # BOOST_WHATEVER_DYN_LINK to force Boost library "whatever" to be + # linked dynamically. Alternatively you can force all Boost + # libraries to dynamic link by defining BOOST_ALL_DYN_LINK. + + # This feature can be disabled for Boost library "whatever" by + # defining BOOST_WHATEVER_NO_LIB, or for all of Boost by defining + # BOOST_ALL_NO_LIB. + + # If you want to observe which libraries are being linked against + # then defining BOOST_LIB_DIAGNOSTIC will cause the auto-linking + # code to emit a #pragma message each time a library is selected + # for linking. + SET(Boost_LIB_DIAGNOSTIC_DEFINITIONS + "-DBOOST_LIB_DIAGNOSTIC" CACHE STRING "Boost diagnostic define") + ENDIF(WIN32) + + set(_boost_INCLUDE_SEARCH_DIRS_SYSTEM + C:/boost/include + C:/boost + "$ENV{ProgramFiles}/boost/include" + "$ENV{ProgramFiles}/boost" + /sw/local/include + ) + + # If Boost_ROOT was defined, gently correct the user + if(Boost_ROOT) + message("WARNING: Boost_ROOT was set which is incorrect and is being ignored. " + "You need to use BOOST_ROOT instead. " + "Also, we suggest setting Boost_NO_SYSTEM_PATHS.") + endif() + + # If BOOST_ROOT was defined in the environment, use it. + if (NOT BOOST_ROOT AND NOT $ENV{BOOST_ROOT} STREQUAL "") + set(BOOST_ROOT $ENV{BOOST_ROOT}) + endif(NOT BOOST_ROOT AND NOT $ENV{BOOST_ROOT} STREQUAL "") + + # If BOOSTROOT was defined in the environment, use it. + if (NOT BOOST_ROOT AND NOT $ENV{BOOSTROOT} STREQUAL "") + set(BOOST_ROOT $ENV{BOOSTROOT}) + endif(NOT BOOST_ROOT AND NOT $ENV{BOOSTROOT} STREQUAL "") + + # If BOOST_INCLUDEDIR was defined in the environment, use it. + IF( NOT $ENV{BOOST_INCLUDEDIR} STREQUAL "" ) + set(BOOST_INCLUDEDIR $ENV{BOOST_INCLUDEDIR}) + ENDIF( NOT $ENV{BOOST_INCLUDEDIR} STREQUAL "" ) + + # If BOOST_LIBRARYDIR was defined in the environment, use it. + IF( NOT $ENV{BOOST_LIBRARYDIR} STREQUAL "" ) + set(BOOST_LIBRARYDIR $ENV{BOOST_LIBRARYDIR}) + ENDIF( NOT $ENV{BOOST_LIBRARYDIR} STREQUAL "" ) + + IF( BOOST_ROOT ) + file(TO_CMAKE_PATH ${BOOST_ROOT} BOOST_ROOT) + ENDIF( BOOST_ROOT ) + + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Declared as CMake or Environmental Variables:") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + " BOOST_ROOT = ${BOOST_ROOT}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + " BOOST_INCLUDEDIR = ${BOOST_INCLUDEDIR}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + " BOOST_LIBRARYDIR = ${BOOST_LIBRARYDIR}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}") + endif() + + if( Boost_NO_SYSTEM_PATHS) + set(_boost_FIND_OPTIONS NO_CMAKE_SYSTEM_PATH) + else() + set(_boost_INCLUDE_SEARCH_DIRS ${_boost_INCLUDE_SEARCH_DIRS_SYSTEM}) + endif() + + if( BOOST_ROOT ) + set(_boost_INCLUDE_SEARCH_DIRS + ${BOOST_ROOT}/include + ${BOOST_ROOT} + ${_boost_INCLUDE_SEARCH_DIRS}) + endif() + + # prepend BOOST_INCLUDEDIR to search path if specified + if( BOOST_INCLUDEDIR ) + file(TO_CMAKE_PATH ${BOOST_INCLUDEDIR} BOOST_INCLUDEDIR) + set(_boost_INCLUDE_SEARCH_DIRS + ${BOOST_INCLUDEDIR} ${_boost_INCLUDE_SEARCH_DIRS}) + endif( BOOST_INCLUDEDIR ) + + # ------------------------------------------------------------------------ + # Search for Boost include DIR + # ------------------------------------------------------------------------ + # Try to find Boost by stepping backwards through the Boost versions + # we know about. + IF( NOT Boost_INCLUDE_DIR ) + # Build a list of path suffixes for each version. + SET(_boost_PATH_SUFFIXES) + FOREACH(_boost_VER ${_boost_TEST_VERSIONS}) + # Add in a path suffix, based on the required version, ideally + # we could read this from version.hpp, but for that to work we'd + # need to know the include dir already + set(_boost_BOOSTIFIED_VERSION) + + # Transform 1.35 => 1_35 and 1.36.0 => 1_36_0 + IF(_boost_VER MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+") + STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1_\\2_\\3" + _boost_BOOSTIFIED_VERSION ${_boost_VER}) + ELSEIF(_boost_VER MATCHES "[0-9]+\\.[0-9]+") + STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)" "\\1_\\2" + _boost_BOOSTIFIED_VERSION ${_boost_VER}) + ENDIF() + + list(APPEND _boost_PATH_SUFFIXES "boost-${_boost_BOOSTIFIED_VERSION}") + list(APPEND _boost_PATH_SUFFIXES "boost_${_boost_BOOSTIFIED_VERSION}") + + ENDFOREACH(_boost_VER) + + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Include debugging info:") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + " _boost_INCLUDE_SEARCH_DIRS = ${_boost_INCLUDE_SEARCH_DIRS}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + " _boost_PATH_SUFFIXES = ${_boost_PATH_SUFFIXES}") + endif() + + # Look for a standard boost header file. + FIND_PATH(Boost_INCLUDE_DIR + NAMES boost/config.hpp + HINTS ${_boost_INCLUDE_SEARCH_DIRS} + PATH_SUFFIXES ${_boost_PATH_SUFFIXES} + ${_boost_FIND_OPTIONS} + ) + ENDIF( NOT Boost_INCLUDE_DIR ) + + # ------------------------------------------------------------------------ + # Extract version information from version.hpp + # ------------------------------------------------------------------------ + + IF(Boost_INCLUDE_DIR) + # Extract Boost_VERSION and Boost_LIB_VERSION from version.hpp + # Read the whole file: + # + SET(BOOST_VERSION 0) + SET(BOOST_LIB_VERSION "") + FILE(READ "${Boost_INCLUDE_DIR}/boost/version.hpp" _boost_VERSION_HPP_CONTENTS) + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "location of version.hpp: ${Boost_INCLUDE_DIR}/boost/version.hpp") + endif() + + STRING(REGEX REPLACE ".*#define BOOST_VERSION ([0-9]+).*" "\\1" Boost_VERSION "${_boost_VERSION_HPP_CONTENTS}") + STRING(REGEX REPLACE ".*#define BOOST_LIB_VERSION \"([0-9_]+)\".*" "\\1" Boost_LIB_VERSION "${_boost_VERSION_HPP_CONTENTS}") + + SET(Boost_LIB_VERSION ${Boost_LIB_VERSION} CACHE INTERNAL "The library version string for boost libraries") + SET(Boost_VERSION ${Boost_VERSION} CACHE INTERNAL "The version number for boost libraries") + + IF(NOT "${Boost_VERSION}" STREQUAL "0") + MATH(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000") + MATH(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000") + MATH(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100") + + set(Boost_ERROR_REASON + "${Boost_ERROR_REASON}Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}\nBoost include path: ${Boost_INCLUDE_DIR}") + ENDIF(NOT "${Boost_VERSION}" STREQUAL "0") + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "version.hpp reveals boost " + "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}") + endif() + ELSE(Boost_INCLUDE_DIR) + set(Boost_ERROR_REASON + "${Boost_ERROR_REASON}Unable to find the Boost header files. Please set BOOST_ROOT to the root directory containing Boost or BOOST_INCLUDEDIR to the directory containing Boost's headers.") + ENDIF(Boost_INCLUDE_DIR) + + # ------------------------------------------------------------------------ + # Suffix initialization and compiler suffix detection. + # ------------------------------------------------------------------------ + + # Setting some more suffixes for the library + SET (Boost_LIB_PREFIX "") + if ( WIN32 AND Boost_USE_STATIC_LIBS AND NOT CYGWIN) + SET (Boost_LIB_PREFIX "lib") + endif() + + if (Boost_COMPILER) + set(_boost_COMPILER ${Boost_COMPILER}) + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "using user-specified Boost_COMPILER = ${_boost_COMPILER}") + endif() + else(Boost_COMPILER) + # Attempt to guess the compiler suffix + # NOTE: this is not perfect yet, if you experience any issues + # please report them and use the Boost_COMPILER variable + # to work around the problems. + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" + OR "${CMAKE_CXX_COMPILER}" MATCHES "icl" + OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc") + if(WIN32) + set (_boost_COMPILER "-iw") + else() + set (_boost_COMPILER "-il") + endif() + elseif (MSVC90) + SET (_boost_COMPILER "-vc90") + elseif (MSVC10) + SET (_boost_COMPILER "-vc100") + elseif (MSVC80) + SET (_boost_COMPILER "-vc80") + elseif (MSVC71) + SET (_boost_COMPILER "-vc71") + elseif (MSVC70) # Good luck! + SET (_boost_COMPILER "-vc7") # yes, this is correct + elseif (MSVC60) # Good luck! + SET (_boost_COMPILER "-vc6") # yes, this is correct + elseif (BORLAND) + SET (_boost_COMPILER "-bcb") + elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "SunPro") + set(_boost_COMPILER "-sw") + elseif (MINGW) + if(${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.34) + SET(_boost_COMPILER "-mgw") # no GCC version encoding prior to 1.34 + else() + _Boost_COMPILER_DUMPVERSION(_boost_COMPILER_VERSION) + SET (_boost_COMPILER "-mgw${_boost_COMPILER_VERSION}") + endif() + elseif (UNIX) + if (CMAKE_COMPILER_IS_GNUCXX) + if(${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.34) + SET(_boost_COMPILER "-gcc") # no GCC version encoding prior to 1.34 + else() + _Boost_COMPILER_DUMPVERSION(_boost_COMPILER_VERSION) + # Determine which version of GCC we have. + IF(APPLE) + IF(Boost_MINOR_VERSION) + IF(${Boost_MINOR_VERSION} GREATER 35) + # In Boost 1.36.0 and newer, the mangled compiler name used + # on Mac OS X/Darwin is "xgcc". + SET(_boost_COMPILER "-xgcc${_boost_COMPILER_VERSION}") + ELSE(${Boost_MINOR_VERSION} GREATER 35) + # In Boost <= 1.35.0, there is no mangled compiler name for + # the Mac OS X/Darwin version of GCC. + SET(_boost_COMPILER "") + ENDIF(${Boost_MINOR_VERSION} GREATER 35) + ELSE(Boost_MINOR_VERSION) + # We don't know the Boost version, so assume it's + # pre-1.36.0. + SET(_boost_COMPILER "") + ENDIF(Boost_MINOR_VERSION) + ELSE() + SET (_boost_COMPILER "-gcc${_boost_COMPILER_VERSION}") + ENDIF() + endif() + endif (CMAKE_COMPILER_IS_GNUCXX) + endif() + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "guessed _boost_COMPILER = ${_boost_COMPILER}") + endif() + endif(Boost_COMPILER) + + set (_boost_MULTITHREADED "-mt") + if( NOT Boost_USE_MULTITHREADED ) + set (_boost_MULTITHREADED "") + endif() + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "_boost_MULTITHREADED = ${_boost_MULTITHREADED}") + endif() + + #====================== + # Systematically build up the Boost ABI tag + # http://boost.org/doc/libs/1_41_0/more/getting_started/windows.html#library-naming + set( _boost_RELEASE_ABI_TAG "-") + set( _boost_DEBUG_ABI_TAG "-") + # Key Use this library when: + # s linking statically to the C++ standard library and + # compiler runtime support libraries. + if(Boost_USE_STATIC_RUNTIME) + set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}s") + set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}s") + endif() + # g using debug versions of the standard and runtime + # support libraries + if(WIN32) + if(MSVC OR "${CMAKE_CXX_COMPILER}" MATCHES "icl" + OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc") + set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}g") + endif() + endif() + # y using special debug build of python + if(Boost_USE_DEBUG_PYTHON) + set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}y") + endif() + # d using a debug version of your code + set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}d") + # p using the STLport standard library rather than the + # default one supplied with your compiler + if(Boost_USE_STLPORT) + set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}p") + set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}p") + endif() + # n using the STLport deprecated "native iostreams" feature + if(Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS) + set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}n") + set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}n") + endif() + + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "_boost_RELEASE_ABI_TAG = ${_boost_RELEASE_ABI_TAG}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "_boost_DEBUG_ABI_TAG = ${_boost_DEBUG_ABI_TAG}") + endif() + + # ------------------------------------------------------------------------ + # Begin finding boost libraries + # ------------------------------------------------------------------------ + + if(BOOST_ROOT) + set(_boost_LIBRARY_SEARCH_DIRS_ALWAYS + ${BOOST_ROOT}/lib + ${BOOST_ROOT}/stage/lib) + endif() + set(_boost_LIBRARY_SEARCH_DIRS_ALWAYS + ${_boost_LIBRARY_SEARCH_DIRS_ALWAYS} + ${Boost_INCLUDE_DIR}/lib + ${Boost_INCLUDE_DIR}/../lib + ${Boost_INCLUDE_DIR}/stage/lib + ) + set(_boost_LIBRARY_SEARCH_DIRS_SYSTEM + C:/boost/lib + C:/boost + "$ENV{ProgramFiles}/boost/boost_${Boost_MAJOR_VERSION}_${Boost_MINOR_VERSION}_${Boost_SUBMINOR_VERSION}/lib" + "$ENV{ProgramFiles}/boost/boost_${Boost_MAJOR_VERSION}_${Boost_MINOR_VERSION}/lib" + "$ENV{ProgramFiles}/boost/lib" + "$ENV{ProgramFiles}/boost" + /sw/local/lib + ) + set(_boost_LIBRARY_SEARCH_DIRS ${_boost_LIBRARY_SEARCH_DIRS_ALWAYS}) + if( Boost_NO_SYSTEM_PATHS ) + set(_boost_FIND_OPTIONS NO_CMAKE_SYSTEM_PATH) + else() + list(APPEND _boost_LIBRARY_SEARCH_DIRS ${_boost_LIBRARY_SEARCH_DIRS_SYSTEM}) + endif() + + # prepend BOOST_LIBRARYDIR to search path if specified + if( BOOST_LIBRARYDIR ) + file(TO_CMAKE_PATH ${BOOST_LIBRARYDIR} BOOST_LIBRARYDIR) + set(_boost_LIBRARY_SEARCH_DIRS + ${BOOST_LIBRARYDIR} ${_boost_LIBRARY_SEARCH_DIRS}) + endif() + + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "_boost_LIBRARY_SEARCH_DIRS = ${_boost_LIBRARY_SEARCH_DIRS}") + endif() + + # Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES + if( Boost_USE_STATIC_LIBS ) + set( _boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) + if(WIN32) + set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) + else() + set(CMAKE_FIND_LIBRARY_SUFFIXES .a ) + endif() + endif() + + # We want to use the tag inline below without risking double dashes + if(_boost_RELEASE_ABI_TAG) + if(${_boost_RELEASE_ABI_TAG} STREQUAL "-") + set(_boost_RELEASE_ABI_TAG "") + endif() + endif() + if(_boost_DEBUG_ABI_TAG) + if(${_boost_DEBUG_ABI_TAG} STREQUAL "-") + set(_boost_DEBUG_ABI_TAG "") + endif() + endif() + + # The previous behavior of FindBoost when Boost_USE_STATIC_LIBS was enabled + # on WIN32 was to: + # 1. Search for static libs compiled against a SHARED C++ standard runtime library (use if found) + # 2. Search for static libs compiled against a STATIC C++ standard runtime library (use if found) + # We maintain this behavior since changing it could break people's builds. + # To disable the ambiguous behavior, the user need only + # set Boost_USE_STATIC_RUNTIME either ON or OFF. + set(_boost_STATIC_RUNTIME_WORKAROUND false) + if(WIN32 AND Boost_USE_STATIC_LIBS) + if(NOT DEFINED Boost_USE_STATIC_RUNTIME) + set(_boost_STATIC_RUNTIME_WORKAROUND true) + endif() + endif() + + + foreach(COMPONENT ${Boost_FIND_COMPONENTS}) + string(TOUPPER ${COMPONENT} UPPERCOMPONENT) + set( Boost_${UPPERCOMPONENT}_LIBRARY "Boost_${UPPERCOMPONENT}_LIBRARY-NOTFOUND" ) + set( Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE-NOTFOUND" ) + set( Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG "Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG-NOTFOUND") + + set( _boost_docstring_release "Boost ${COMPONENT} library (release)") + set( _boost_docstring_debug "Boost ${COMPONENT} library (debug)") + + # + # Find RELEASE libraries + # + set(_boost_RELEASE_NAMES + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG} + ${Boost_LIB_PREFIX}boost_${COMPONENT} ) + if(_boost_STATIC_RUNTIME_WORKAROUND) + set(_boost_RELEASE_STATIC_ABI_TAG "-s${_boost_RELEASE_ABI_TAG}") + list(APPEND _boost_RELEASE_NAMES + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} ) + endif() + if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread") + _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_RELEASE_NAMES ${_boost_RELEASE_NAMES}) + endif() + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Searching for ${UPPERCOMPONENT}_LIBRARY_RELEASE: ${_boost_RELEASE_NAMES}") + endif() + find_library(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE + NAMES ${_boost_RELEASE_NAMES} + HINTS ${_boost_LIBRARY_SEARCH_DIRS} + ${_boost_FIND_OPTIONS} + DOC "${_boost_docstring_release}" + ) + + # + # Find DEBUG libraries + # + set(_boost_DEBUG_NAMES + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED} + ${Boost_LIB_PREFIX}boost_${COMPONENT} ) + if(_boost_STATIC_RUNTIME_WORKAROUND) + set(_boost_DEBUG_STATIC_ABI_TAG "-s${_boost_DEBUG_ABI_TAG}") + list(APPEND _boost_DEBUG_NAMES + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} ) + endif() + if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread") + _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_DEBUG_NAMES ${_boost_DEBUG_NAMES}) + endif() + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Searching for ${UPPERCOMPONENT}_LIBRARY_DEBUG: ${_boost_DEBUG_NAMES}") + endif() + find_library(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG + NAMES ${_boost_DEBUG_NAMES} + HINTS ${_boost_LIBRARY_SEARCH_DIRS} + ${_boost_FIND_OPTIONS} + DOC "${_boost_docstring_debug}" + ) + + if(Boost_REALPATH) + _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "${_boost_docstring_release}") + _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG "${_boost_docstring_debug}" ) + endif() + + _Boost_ADJUST_LIB_VARS(${UPPERCOMPONENT}) + + endforeach(COMPONENT) + + # Restore the original find library ordering + if( Boost_USE_STATIC_LIBS ) + set(CMAKE_FIND_LIBRARY_SUFFIXES ${_boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) + endif() + # ------------------------------------------------------------------------ + # End finding boost libraries + # ------------------------------------------------------------------------ + + SET(Boost_INCLUDE_DIRS + ${Boost_INCLUDE_DIR} + ) + + SET(Boost_FOUND FALSE) + IF(Boost_INCLUDE_DIR) + SET( Boost_FOUND TRUE ) + + # Check the version of Boost against the requested version. + if (Boost_FIND_VERSION AND NOT Boost_FIND_VERSION_MINOR) + message(SEND_ERROR "When requesting a specific version of Boost, you must provide at least the major and minor version numbers, e.g., 1.34") + endif (Boost_FIND_VERSION AND NOT Boost_FIND_VERSION_MINOR) + if(Boost_MAJOR_VERSION LESS "${Boost_FIND_VERSION_MAJOR}" ) + set( Boost_FOUND FALSE ) + set(_Boost_VERSION_AGE "old") + elseif(Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" ) + if(Boost_MINOR_VERSION LESS "${Boost_FIND_VERSION_MINOR}" ) + set( Boost_FOUND FALSE ) + set(_Boost_VERSION_AGE "old") + elseif(Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" ) + if( Boost_FIND_VERSION_PATCH AND Boost_SUBMINOR_VERSION LESS "${Boost_FIND_VERSION_PATCH}" ) + set( Boost_FOUND FALSE ) + set(_Boost_VERSION_AGE "old") + endif( Boost_FIND_VERSION_PATCH AND Boost_SUBMINOR_VERSION LESS "${Boost_FIND_VERSION_PATCH}" ) + endif( Boost_MINOR_VERSION LESS "${Boost_FIND_VERSION_MINOR}" ) + endif( Boost_MAJOR_VERSION LESS "${Boost_FIND_VERSION_MAJOR}" ) + + if (NOT Boost_FOUND) + _Boost_MARK_COMPONENTS_FOUND(OFF) + endif() + + if (Boost_FOUND AND Boost_FIND_VERSION_EXACT) + # If the user requested an exact version of Boost, check + # that. We already know that the Boost version we have is >= the + # requested version. + set(_Boost_VERSION_AGE "new") + + # If the user didn't specify a patchlevel, it's 0. + if (NOT Boost_FIND_VERSION_PATCH) + set(Boost_FIND_VERSION_PATCH 0) + endif (NOT Boost_FIND_VERSION_PATCH) + + # We'll set Boost_FOUND true again if we have an exact version match. + set(Boost_FOUND FALSE) + _Boost_MARK_COMPONENTS_FOUND(OFF) + if(Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" ) + if(Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" ) + if(Boost_SUBMINOR_VERSION EQUAL "${Boost_FIND_VERSION_PATCH}" ) + set( Boost_FOUND TRUE ) + _Boost_MARK_COMPONENTS_FOUND(ON) + endif(Boost_SUBMINOR_VERSION EQUAL "${Boost_FIND_VERSION_PATCH}" ) + endif( Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" ) + endif( Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" ) + endif (Boost_FOUND AND Boost_FIND_VERSION_EXACT) + + if(NOT Boost_FOUND) + # State that we found a version of Boost that is too new or too old. + set(Boost_ERROR_REASON + "${Boost_ERROR_REASON}\nDetected version of Boost is too ${_Boost_VERSION_AGE}. Requested version was ${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}") + if (Boost_FIND_VERSION_PATCH) + set(Boost_ERROR_REASON + "${Boost_ERROR_REASON}.${Boost_FIND_VERSION_PATCH}") + endif (Boost_FIND_VERSION_PATCH) + if (NOT Boost_FIND_VERSION_EXACT) + set(Boost_ERROR_REASON "${Boost_ERROR_REASON} (or newer)") + endif (NOT Boost_FIND_VERSION_EXACT) + set(Boost_ERROR_REASON "${Boost_ERROR_REASON}.") + endif (NOT Boost_FOUND) + + # Always check for missing components + set(_boost_CHECKED_COMPONENT FALSE) + set(_Boost_MISSING_COMPONENTS "") + foreach(COMPONENT ${Boost_FIND_COMPONENTS}) + string(TOUPPER ${COMPONENT} COMPONENT) + set(_boost_CHECKED_COMPONENT TRUE) + if(NOT Boost_${COMPONENT}_FOUND) + string(TOLOWER ${COMPONENT} COMPONENT) + list(APPEND _Boost_MISSING_COMPONENTS ${COMPONENT}) + set( Boost_FOUND FALSE) + endif(NOT Boost_${COMPONENT}_FOUND) + endforeach(COMPONENT) + + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] Boost_FOUND = ${Boost_FOUND}") + endif() + + if (_Boost_MISSING_COMPONENTS) + # We were unable to find some libraries, so generate a sensible + # error message that lists the libraries we were unable to find. + set(Boost_ERROR_REASON + "${Boost_ERROR_REASON}\nThe following Boost libraries could not be found:\n") + foreach(COMPONENT ${_Boost_MISSING_COMPONENTS}) + set(Boost_ERROR_REASON + "${Boost_ERROR_REASON} boost_${COMPONENT}\n") + endforeach(COMPONENT) + + list(LENGTH Boost_FIND_COMPONENTS Boost_NUM_COMPONENTS_WANTED) + list(LENGTH _Boost_MISSING_COMPONENTS Boost_NUM_MISSING_COMPONENTS) + if (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS}) + set(Boost_ERROR_REASON + "${Boost_ERROR_REASON}No Boost libraries were found. You may need to set Boost_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.") + else (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS}) + set(Boost_ERROR_REASON + "${Boost_ERROR_REASON}Some (but not all) of the required Boost libraries were found. You may need to install these additional Boost libraries. Alternatively, set Boost_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.") + endif (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS}) + endif (_Boost_MISSING_COMPONENTS) + + IF( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT ) + # Compatibility Code for backwards compatibility with CMake + # 2.4's FindBoost module. + + # Look for the boost library path. + # Note that the user may not have installed any libraries + # so it is quite possible the Boost_LIBRARY_PATH may not exist. + SET(_boost_LIB_DIR ${Boost_INCLUDE_DIR}) + + IF("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+") + GET_FILENAME_COMPONENT(_boost_LIB_DIR ${_boost_LIB_DIR} PATH) + ENDIF ("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+") + + IF("${_boost_LIB_DIR}" MATCHES "/include$") + # Strip off the trailing "/include" in the path. + GET_FILENAME_COMPONENT(_boost_LIB_DIR ${_boost_LIB_DIR} PATH) + ENDIF("${_boost_LIB_DIR}" MATCHES "/include$") + + IF(EXISTS "${_boost_LIB_DIR}/lib") + SET (_boost_LIB_DIR ${_boost_LIB_DIR}/lib) + ELSE(EXISTS "${_boost_LIB_DIR}/lib") + IF(EXISTS "${_boost_LIB_DIR}/stage/lib") + SET(_boost_LIB_DIR ${_boost_LIB_DIR}/stage/lib) + ELSE(EXISTS "${_boost_LIB_DIR}/stage/lib") + SET(_boost_LIB_DIR "") + ENDIF(EXISTS "${_boost_LIB_DIR}/stage/lib") + ENDIF(EXISTS "${_boost_LIB_DIR}/lib") + + IF(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}") + SET(Boost_LIBRARY_DIRS ${_boost_LIB_DIR} CACHE FILEPATH "Boost library directory") + ENDIF(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}") + + ENDIF( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT ) + + ELSE(Boost_INCLUDE_DIR) + SET( Boost_FOUND FALSE) + ENDIF(Boost_INCLUDE_DIR) + + IF (Boost_FOUND) + IF (NOT Boost_FIND_QUIETLY) + MESSAGE(STATUS "Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}") + if(Boost_FIND_COMPONENTS) + message(STATUS "Found the following Boost libraries:") + endif() + ENDIF(NOT Boost_FIND_QUIETLY) + FOREACH ( COMPONENT ${Boost_FIND_COMPONENTS} ) + STRING( TOUPPER ${COMPONENT} UPPERCOMPONENT ) + IF ( Boost_${UPPERCOMPONENT}_FOUND ) + IF (NOT Boost_FIND_QUIETLY) + MESSAGE (STATUS " ${COMPONENT}") + ENDIF(NOT Boost_FIND_QUIETLY) + SET(Boost_LIBRARIES ${Boost_LIBRARIES} ${Boost_${UPPERCOMPONENT}_LIBRARY}) + ENDIF ( Boost_${UPPERCOMPONENT}_FOUND ) + ENDFOREACH(COMPONENT) + else() + if(Boost_FIND_REQUIRED) + message(SEND_ERROR "Unable to find the requested Boost libraries.\n${Boost_ERROR_REASON}") + else() + if(NOT Boost_FIND_QUIETLY) + # we opt not to automatically output Boost_ERROR_REASON here as + # it could be quite lengthy and somewhat imposing in it's requests + # Since Boost is not always a required dependency we'll leave this + # up to the end-user. + if(Boost_DEBUG OR Boost_DETAILED_FAILURE_MSG) + message(STATUS "Could NOT find Boost\n${Boost_ERROR_REASON}") + else() + message(STATUS "Could NOT find Boost") + endif() + endif() + endif(Boost_FIND_REQUIRED) + endif() + + # show the Boost_INCLUDE_DIRS AND Boost_LIBRARIES variables only in the advanced view + MARK_AS_ADVANCED(Boost_INCLUDE_DIR + Boost_INCLUDE_DIRS + Boost_LIBRARY_DIRS + ) +ENDIF(_boost_IN_CACHE) diff --git a/lib/wiiuse/cmake/cmake-3.2.0-modules/FindGit.cmake b/lib/wiiuse/cmake/cmake-3.2.0-modules/FindGit.cmake new file mode 100644 index 000000000..207b424bb --- /dev/null +++ b/lib/wiiuse/cmake/cmake-3.2.0-modules/FindGit.cmake @@ -0,0 +1,106 @@ +#.rst: +# FindGit +# ------- +# +# +# +# The module defines the following variables: +# +# :: +# +# GIT_EXECUTABLE - path to git command line client +# GIT_FOUND - true if the command line client was found +# GIT_VERSION_STRING - the version of git found (since CMake 2.8.8) +# +# Example usage: +# +# :: +# +# find_package(Git) +# if(GIT_FOUND) +# message("git found: ${GIT_EXECUTABLE}") +# endif() + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2012 Rolf Eike Beer +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# 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. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# Look for 'git' or 'eg' (easy git) +# +set(git_names git eg) + +# Prefer .cmd variants on Windows unless running in a Makefile +# in the MSYS shell. +# +if(WIN32) + if(NOT CMAKE_GENERATOR MATCHES "MSYS") + set(git_names git.cmd git eg.cmd eg) + # GitHub search path for Windows + set(github_path "$ENV{LOCALAPPDATA}/Github/PortableGit*/bin") + file(GLOB github_path "${github_path}") + endif() +endif() + +find_program(GIT_EXECUTABLE + NAMES ${git_names} + PATHS ${github_path} + PATH_SUFFIXES Git/cmd Git/bin + DOC "git command line client" + ) +mark_as_advanced(GIT_EXECUTABLE) + +if(GIT_EXECUTABLE) + execute_process(COMMAND ${GIT_EXECUTABLE} --version + OUTPUT_VARIABLE git_version + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + if (git_version MATCHES "^git version [0-9]") + string(REPLACE "git version " "" GIT_VERSION_STRING "${git_version}") + endif() + unset(git_version) +endif() + +# Handle the QUIETLY and REQUIRED arguments and set GIT_FOUND to TRUE if +# all listed variables are TRUE + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Git + REQUIRED_VARS GIT_EXECUTABLE + VERSION_VAR GIT_VERSION_STRING) diff --git a/lib/wiiuse/cmake/cmake-3.3.0-modules/WriteCompilerDetectionHeader.cmake b/lib/wiiuse/cmake/cmake-3.3.0-modules/WriteCompilerDetectionHeader.cmake new file mode 100644 index 000000000..b40d824b1 --- /dev/null +++ b/lib/wiiuse/cmake/cmake-3.3.0-modules/WriteCompilerDetectionHeader.cmake @@ -0,0 +1,692 @@ +#.rst: +# WriteCompilerDetectionHeader +# ---------------------------- +# +# This module provides the function write_compiler_detection_header(). +# +# The ``WRITE_COMPILER_DETECTION_HEADER`` function can be used to generate +# a file suitable for preprocessor inclusion which contains macros to be +# used in source code:: +# +# write_compiler_detection_header( +# FILE +# PREFIX +# [OUTPUT_FILES_VAR OUTPUT_DIR ] +# COMPILERS [...] +# FEATURES [...] +# [VERSION ] +# [PROLOG ] +# [EPILOG ] +# ) +# +# The ``write_compiler_detection_header`` function generates the +# file ```` with macros which all have the prefix ````. +# +# By default, all content is written directly to the ````. The +# ``OUTPUT_FILES_VAR`` may be specified to cause the compiler-specific +# content to be written to separate files. The separate files are then +# available in the ```` and may be consumed by the caller +# for installation for example. The ``OUTPUT_DIR`` specifies a relative +# path from the main ```` to the compiler-specific files. For example: +# +# .. code-block:: cmake +# +# write_compiler_detection_header( +# FILE climbingstats_compiler_detection.h +# PREFIX ClimbingStats +# OUTPUT_FILES_VAR support_files +# OUTPUT_DIR compilers +# COMPILERS GNU Clang MSVC +# FEATURES cxx_variadic_templates +# ) +# install(FILES +# ${CMAKE_CURRENT_BINARY_DIR}/climbingstats_compiler_detection.h +# DESTINATION include +# ) +# install(FILES +# ${support_files} +# DESTINATION include/compilers +# ) +# +# +# ``VERSION`` may be used to specify the API version to be generated. +# Future versions of CMake may introduce alternative APIs. A given +# API is selected by any ```` value greater than or equal +# to the version of CMake that introduced the given API and less +# than the version of CMake that introduced its succeeding API. +# The value of the :variable:`CMAKE_MINIMUM_REQUIRED_VERSION` +# variable is used if no explicit version is specified. +# (As of CMake version |release| there is only one API version.) +# +# ``PROLOG`` may be specified as text content to write at the start of the +# header. ``EPILOG`` may be specified as text content to write at the end +# of the header +# +# At least one ```` and one ```` must be listed. Compilers +# which are known to CMake, but not specified are detected and a preprocessor +# ``#error`` is generated for them. A preprocessor macro matching +# ``_COMPILER_IS_`` is generated for each compiler +# known to CMake to contain the value ``0`` or ``1``. +# +# Possible compiler identifiers are documented with the +# :variable:`CMAKE__COMPILER_ID` variable. +# Available features in this version of CMake are listed in the +# :prop_gbl:`CMAKE_C_KNOWN_FEATURES` and +# :prop_gbl:`CMAKE_CXX_KNOWN_FEATURES` global properties. +# +# See the :manual:`cmake-compile-features(7)` manual for information on +# compile features. +# +# Feature Test Macros +# =================== +# +# For each compiler, a preprocessor macro is generated matching +# ``_COMPILER_IS_`` which has the content either ``0`` +# or ``1``, depending on the compiler in use. Preprocessor macros for +# compiler version components are generated matching +# ``_COMPILER_VERSION_MAJOR`` ``_COMPILER_VERSION_MINOR`` +# and ``_COMPILER_VERSION_PATCH`` containing decimal values +# for the corresponding compiler version components, if defined. +# +# A preprocessor test is generated based on the compiler version +# denoting whether each feature is enabled. A preprocessor macro +# matching ``_COMPILER_``, where ```` is the +# upper-case ```` name, is generated to contain the value +# ``0`` or ``1`` depending on whether the compiler in use supports the +# feature: +# +# .. code-block:: cmake +# +# write_compiler_detection_header( +# FILE climbingstats_compiler_detection.h +# PREFIX ClimbingStats +# COMPILERS GNU Clang AppleClang MSVC +# FEATURES cxx_variadic_templates +# ) +# +# .. code-block:: c++ +# +# #if ClimbingStats_COMPILER_CXX_VARIADIC_TEMPLATES +# template +# void someInterface(T t...) { /* ... */ } +# #else +# // Compatibility versions +# template +# void someInterface(T1 t1) { /* ... */ } +# template +# void someInterface(T1 t1, T2 t2) { /* ... */ } +# template +# void someInterface(T1 t1, T2 t2, T3 t3) { /* ... */ } +# #endif +# +# Symbol Macros +# ============= +# +# Some additional symbol-defines are created for particular features for +# use as symbols which may be conditionally defined empty: +# +# .. code-block:: c++ +# +# class MyClass ClimbingStats_FINAL +# { +# ClimbingStats_CONSTEXPR int someInterface() { return 42; } +# }; +# +# The ``ClimbingStats_FINAL`` macro will expand to ``final`` if the +# compiler (and its flags) support the ``cxx_final`` feature, and the +# ``ClimbingStats_CONSTEXPR`` macro will expand to ``constexpr`` +# if ``cxx_constexpr`` is supported. +# +# The following features generate corresponding symbol defines: +# +# ========================== =================================== ================= +# Feature Define Symbol +# ========================== =================================== ================= +# ``c_restrict`` ``_RESTRICT`` ``restrict`` +# ``cxx_constexpr`` ``_CONSTEXPR`` ``constexpr`` +# ``cxx_deleted_functions`` ``_DELETED_FUNCTION`` ``= delete`` +# ``cxx_extern_templates`` ``_EXTERN_TEMPLATE`` ``extern`` +# ``cxx_final`` ``_FINAL`` ``final`` +# ``cxx_noexcept`` ``_NOEXCEPT`` ``noexcept`` +# ``cxx_noexcept`` ``_NOEXCEPT_EXPR(X)`` ``noexcept(X)`` +# ``cxx_override`` ``_OVERRIDE`` ``override`` +# ========================== =================================== ================= +# +# Compatibility Implementation Macros +# =================================== +# +# Some features are suitable for wrapping in a macro with a backward +# compatibility implementation if the compiler does not support the feature. +# +# When the ``cxx_static_assert`` feature is not provided by the compiler, +# a compatibility implementation is available via the +# ``_STATIC_ASSERT(COND)`` and +# ``_STATIC_ASSERT_MSG(COND, MSG)`` function-like macros. The macros +# expand to ``static_assert`` where that compiler feature is available, and +# to a compatibility implementation otherwise. In the first form, the +# condition is stringified in the message field of ``static_assert``. In +# the second form, the message ``MSG`` is passed to the message field of +# ``static_assert``, or ignored if using the backward compatibility +# implementation. +# +# The ``cxx_attribute_deprecated`` feature provides a macro definition +# ``_DEPRECATED``, which expands to either the standard +# ``[[deprecated]]`` attribute or a compiler-specific decorator such +# as ``__attribute__((__deprecated__))`` used by GNU compilers. +# +# The ``cxx_alignas`` feature provides a macro definition +# ``_ALIGNAS`` which expands to either the standard ``alignas`` +# decorator or a compiler-specific decorator such as +# ``__attribute__ ((__aligned__))`` used by GNU compilers. +# +# The ``cxx_alignof`` feature provides a macro definition +# ``_ALIGNOF`` which expands to either the standard ``alignof`` +# decorator or a compiler-specific decorator such as ``__alignof__`` +# used by GNU compilers. +# +# ============================= ================================ ===================== +# Feature Define Symbol +# ============================= ================================ ===================== +# ``cxx_alignas`` ``_ALIGNAS`` ``alignas`` +# ``cxx_alignof`` ``_ALIGNOF`` ``alignof`` +# ``cxx_nullptr`` ``_NULLPTR`` ``nullptr`` +# ``cxx_static_assert`` ``_STATIC_ASSERT`` ``static_assert`` +# ``cxx_static_assert`` ``_STATIC_ASSERT_MSG`` ``static_assert`` +# ``cxx_attribute_deprecated`` ``_DEPRECATED`` ``[[deprecated]]`` +# ``cxx_attribute_deprecated`` ``_DEPRECATED_MSG`` ``[[deprecated]]`` +# ``cxx_thread_local`` ``_THREAD_LOCAL`` ``thread_local`` +# ============================= ================================ ===================== +# +# A use-case which arises with such deprecation macros is the deprecation +# of an entire library. In that case, all public API in the library may +# be decorated with the ``_DEPRECATED`` macro. This results in +# very noisy build output when building the library itself, so the macro +# may be may be defined to empty in that case when building the deprecated +# library: +# +# .. code-block:: cmake +# +# add_library(compat_support ${srcs}) +# target_compile_definitions(compat_support +# PRIVATE +# CompatSupport_DEPRECATED= +# ) + +#============================================================================= +# Copyright 2014 Stephen Kelly +# +# 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. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + + +include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/CMakeCompilerIdDetection.cmake) + +function(_load_compiler_variables CompilerId lang) + include("${CMAKE_ROOT}/Modules/Compiler/${CompilerId}-${lang}-FeatureTests.cmake" OPTIONAL) + set(_cmake_oldestSupported_${CompilerId} ${_cmake_oldestSupported} PARENT_SCOPE) + foreach(feature ${ARGN}) + set(_cmake_feature_test_${CompilerId}_${feature} ${_cmake_feature_test_${feature}} PARENT_SCOPE) + endforeach() + include("${CMAKE_ROOT}/Modules/Compiler/${CompilerId}-${lang}-DetermineCompiler.cmake" OPTIONAL + RESULT_VARIABLE determinedCompiler) + if (NOT determinedCompiler) + include("${CMAKE_ROOT}/Modules/Compiler/${CompilerId}-DetermineCompiler.cmake" OPTIONAL) + endif() + set(_compiler_id_version_compute_${CompilerId} ${_compiler_id_version_compute} PARENT_SCOPE) +endfunction() + +function(write_compiler_detection_header + file_keyword file_arg + prefix_keyword prefix_arg + ) + if (NOT "x${file_keyword}" STREQUAL "xFILE") + message(FATAL_ERROR "write_compiler_detection_header: FILE parameter missing.") + endif() + if (NOT "x${prefix_keyword}" STREQUAL "xPREFIX") + message(FATAL_ERROR "write_compiler_detection_header: PREFIX parameter missing.") + endif() + set(options) + set(oneValueArgs VERSION EPILOG PROLOG OUTPUT_FILES_VAR OUTPUT_DIR) + set(multiValueArgs COMPILERS FEATURES) + cmake_parse_arguments(_WCD "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if (NOT _WCD_COMPILERS) + message(FATAL_ERROR "Invalid arguments. write_compiler_detection_header requires at least one compiler.") + endif() + if (NOT _WCD_FEATURES) + message(FATAL_ERROR "Invalid arguments. write_compiler_detection_header requires at least one feature.") + endif() + + if(_WCD_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "Unparsed arguments: ${_WCD_UNPARSED_ARGUMENTS}") + endif() + + if (prefix_arg STREQUAL "") + message(FATAL_ERROR "A prefix must be specified") + endif() + string(MAKE_C_IDENTIFIER ${prefix_arg} cleaned_prefix) + if (NOT prefix_arg STREQUAL cleaned_prefix) + message(FATAL_ERROR "The prefix must be a valid C identifier.") + endif() + + if(NOT _WCD_VERSION) + set(_WCD_VERSION ${CMAKE_MINIMUM_REQUIRED_VERSION}) + endif() + set(_min_version 3.1.0) # Version which introduced this function + if (_WCD_VERSION VERSION_LESS _min_version) + set(err "VERSION compatibility for write_compiler_detection_header is set to ${_WCD_VERSION}, which is too low.") + set(err "${err} It must be set to at least ${_min_version}. ") + set(err "${err} Either set the VERSION parameter to the write_compiler_detection_header function, or update") + set(err "${err} your minimum required CMake version with the cmake_minimum_required command.") + message(FATAL_ERROR "${err}") + endif() + + if(_WCD_OUTPUT_FILES_VAR) + if(NOT _WCD_OUTPUT_DIR) + message(FATAL_ERROR "If OUTPUT_FILES_VAR is specified, then OUTPUT_DIR must also be specified.") + endif() + endif() + if(_WCD_OUTPUT_DIR) + if(NOT _WCD_OUTPUT_FILES_VAR) + message(FATAL_ERROR "If OUTPUT_DIR is specified, then OUTPUT_FILES_VAR must also be specified.") + endif() + get_filename_component(main_file_dir ${file_arg} DIRECTORY) + if (NOT IS_ABSOLUTE ${main_file_dir}) + set(main_file_dir "${CMAKE_CURRENT_BINARY_DIR}/${main_file_dir}") + endif() + if (NOT IS_ABSOLUTE ${_WCD_OUTPUT_DIR}) + set(_WCD_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/${_WCD_OUTPUT_DIR}") + endif() + get_filename_component(out_file_dir ${_WCD_OUTPUT_DIR} ABSOLUTE) + string(FIND ${out_file_dir} ${main_file_dir} idx) + if (NOT idx EQUAL 0) + message(FATAL_ERROR "The compiler-specific output directory must be within the same directory as the main file.") + endif() + + if (main_file_dir STREQUAL out_file_dir) + unset(_WCD_OUTPUT_DIR) + else() + string(REPLACE "${main_file_dir}/" "" _WCD_OUTPUT_DIR "${out_file_dir}/") + endif() + endif() + + set(compilers + GNU + Clang + AppleClang + MSVC + SunPro + ) + + set(_hex_compilers ADSP Borland Embarcadero SunPro) + + foreach(_comp ${_WCD_COMPILERS}) + list(FIND compilers ${_comp} idx) + if (idx EQUAL -1) + message(FATAL_ERROR "Unsupported compiler ${_comp}.") + endif() + if (NOT _need_hex_conversion) + list(FIND _hex_compilers ${_comp} idx) + if (NOT idx EQUAL -1) + set(_need_hex_conversion TRUE) + endif() + endif() + endforeach() + + set(file_content " +// This is a generated file. Do not edit! + +#ifndef ${prefix_arg}_COMPILER_DETECTION_H +#define ${prefix_arg}_COMPILER_DETECTION_H +") + + if (_WCD_PROLOG) + set(file_content "${file_content}\n${_WCD_PROLOG}\n") + endif() + + if (_need_hex_conversion) + set(file_content "${file_content} +#define ${prefix_arg}_DEC(X) (X) +#define ${prefix_arg}_HEX(X) ( \\ + ((X)>>28 & 0xF) * 10000000 + \\ + ((X)>>24 & 0xF) * 1000000 + \\ + ((X)>>20 & 0xF) * 100000 + \\ + ((X)>>16 & 0xF) * 10000 + \\ + ((X)>>12 & 0xF) * 1000 + \\ + ((X)>>8 & 0xF) * 100 + \\ + ((X)>>4 & 0xF) * 10 + \\ + ((X) & 0xF) \\ + )\n") + endif() + + foreach(feature ${_WCD_FEATURES}) + if (feature MATCHES "^cxx_") + list(APPEND _langs CXX) + list(APPEND CXX_features ${feature}) + elseif (feature MATCHES "^c_") + list(APPEND _langs C) + list(APPEND C_features ${feature}) + else() + message(FATAL_ERROR "Unsupported feature ${feature}.") + endif() + endforeach() + list(REMOVE_DUPLICATES _langs) + + if(_WCD_OUTPUT_FILES_VAR) + get_filename_component(main_file_name ${file_arg} NAME) + set(compiler_file_content_ +"#ifndef ${prefix_arg}_COMPILER_DETECTION_H +# error This file may only be included from ${main_file_name} +#endif\n") + endif() + + foreach(_lang ${_langs}) + set(target_compilers) + foreach(compiler ${_WCD_COMPILERS}) + _load_compiler_variables(${compiler} ${_lang} ${${_lang}_features}) + if(_cmake_oldestSupported_${compiler}) + list(APPEND target_compilers ${compiler}) + endif() + endforeach() + + get_property(known_features GLOBAL PROPERTY CMAKE_${_lang}_KNOWN_FEATURES) + foreach(feature ${${_lang}_features}) + list(FIND known_features ${feature} idx) + if (idx EQUAL -1) + message(FATAL_ERROR "Unsupported feature ${feature}.") + endif() + endforeach() + + if(_lang STREQUAL CXX) + set(file_content "${file_content}\n#ifdef __cplusplus\n") + else() + set(file_content "${file_content}\n#ifndef __cplusplus\n") + endif() + + compiler_id_detection(ID_CONTENT ${_lang} PREFIX ${prefix_arg}_ + ID_DEFINE + ) + + set(file_content "${file_content}${ID_CONTENT}\n") + + set(pp_if "if") + foreach(compiler ${target_compilers}) + set(file_content "${file_content}\n# ${pp_if} ${prefix_arg}_COMPILER_IS_${compiler}\n") + + if(_WCD_OUTPUT_FILES_VAR) + set(compile_file_name "${_WCD_OUTPUT_DIR}${prefix_arg}_COMPILER_INFO_${compiler}_${_lang}.h") + set(file_content "${file_content}\n# include \"${compile_file_name}\"\n") + endif() + + if(_WCD_OUTPUT_FILES_VAR) + set(compiler_file_content compiler_file_content_${compiler}_${_lang}) + else() + set(compiler_file_content file_content) + endif() + + set(${compiler_file_content} "${${compiler_file_content}} +# if !(${_cmake_oldestSupported_${compiler}}) +# error Unsupported compiler version +# endif\n") + + set(PREFIX ${prefix_arg}_) + if (_need_hex_conversion) + set(MACRO_DEC ${prefix_arg}_DEC) + set(MACRO_HEX ${prefix_arg}_HEX) + else() + set(MACRO_DEC) + set(MACRO_HEX) + endif() + string(CONFIGURE "${_compiler_id_version_compute_${compiler}}" VERSION_BLOCK @ONLY) + set(${compiler_file_content} "${${compiler_file_content}}${VERSION_BLOCK}\n") + set(PREFIX) + set(MACRO_DEC) + set(MACRO_HEX) + + set(pp_if "elif") + foreach(feature ${${_lang}_features}) + string(TOUPPER ${feature} feature_upper) + set(feature_PP "COMPILER_${feature_upper}") + set(_define_item "\n# define ${prefix_arg}_${feature_PP} 0\n") + if (_cmake_feature_test_${compiler}_${feature} STREQUAL "1") + set(_define_item "\n# define ${prefix_arg}_${feature_PP} 1\n") + elseif (_cmake_feature_test_${compiler}_${feature}) + set(_define_item "\n# define ${prefix_arg}_${feature_PP} 0\n") + set(_define_item "\n# if ${_cmake_feature_test_${compiler}_${feature}}\n# define ${prefix_arg}_${feature_PP} 1\n# else${_define_item}# endif\n") + endif() + set(${compiler_file_content} "${${compiler_file_content}}${_define_item}") + endforeach() + endforeach() + if(pp_if STREQUAL "elif") + set(file_content "${file_content} +# else +# error Unsupported compiler +# endif\n") + endif() + foreach(feature ${${_lang}_features}) + string(TOUPPER ${feature} feature_upper) + set(feature_PP "COMPILER_${feature_upper}") + set(def_name ${prefix_arg}_${feature_PP}) + if (feature STREQUAL c_restrict) + set(def_value "${prefix_arg}_RESTRICT") + set(file_content "${file_content} +# if ${def_name} +# define ${def_value} restrict +# else +# define ${def_value} +# endif +\n") + endif() + if (feature STREQUAL cxx_constexpr) + set(def_value "${prefix_arg}_CONSTEXPR") + set(file_content "${file_content} +# if ${def_name} +# define ${def_value} constexpr +# else +# define ${def_value} +# endif +\n") + endif() + if (feature STREQUAL cxx_final) + set(def_value "${prefix_arg}_FINAL") + set(file_content "${file_content} +# if ${def_name} +# define ${def_value} final +# else +# define ${def_value} +# endif +\n") + endif() + if (feature STREQUAL cxx_override) + set(def_value "${prefix_arg}_OVERRIDE") + set(file_content "${file_content} +# if ${def_name} +# define ${def_value} override +# else +# define ${def_value} +# endif +\n") + endif() + if (feature STREQUAL cxx_static_assert) + set(def_value "${prefix_arg}_STATIC_ASSERT(X)") + set(def_value_msg "${prefix_arg}_STATIC_ASSERT_MSG(X, MSG)") + set(static_assert_struct "template struct ${prefix_arg}StaticAssert;\ntemplate<> struct ${prefix_arg}StaticAssert{};\n") + set(def_standard "# define ${def_value} static_assert(X, #X)\n# define ${def_value_msg} static_assert(X, MSG)") + set(def_alternative "${static_assert_struct}# define ${def_value} sizeof(${prefix_arg}StaticAssert)\n# define ${def_value_msg} sizeof(${prefix_arg}StaticAssert)") + set(file_content "${file_content}# if ${def_name}\n${def_standard}\n# else\n${def_alternative}\n# endif\n\n") + endif() + if (feature STREQUAL cxx_alignas) + set(def_value "${prefix_arg}_ALIGNAS(X)") + set(file_content "${file_content} +# if ${def_name} +# define ${def_value} alignas(X) +# elif ${prefix_arg}_COMPILER_IS_GNU || ${prefix_arg}_COMPILER_IS_Clang || ${prefix_arg}_COMPILER_IS_AppleClang +# define ${def_value} __attribute__ ((__aligned__(X))) +# elif ${prefix_arg}_COMPILER_IS_MSVC +# define ${def_value} __declspec(align(X)) +# else +# define ${def_value} +# endif +\n") + endif() + if (feature STREQUAL cxx_alignof) + set(def_value "${prefix_arg}_ALIGNOF(X)") + set(file_content "${file_content} +# if ${def_name} +# define ${def_value} alignof(X) +# elif ${prefix_arg}_COMPILER_IS_GNU || ${prefix_arg}_COMPILER_IS_Clang || ${prefix_arg}_COMPILER_IS_AppleClang +# define ${def_value} __alignof__(X) +# elif ${prefix_arg}_COMPILER_IS_MSVC +# define ${def_value} __alignof(X) +# endif +\n") + endif() + if (feature STREQUAL cxx_deleted_functions) + set(def_value "${prefix_arg}_DELETED_FUNCTION") + set(file_content "${file_content} +# if ${def_name} +# define ${def_value} = delete +# else +# define ${def_value} +# endif +\n") + endif() + if (feature STREQUAL cxx_extern_templates) + set(def_value "${prefix_arg}_EXTERN_TEMPLATE") + set(file_content "${file_content} +# if ${def_name} +# define ${def_value} extern +# else +# define ${def_value} +# endif +\n") + endif() + if (feature STREQUAL cxx_noexcept) + set(def_value "${prefix_arg}_NOEXCEPT") + set(file_content "${file_content} +# if ${def_name} +# define ${def_value} noexcept +# define ${def_value}_EXPR(X) noexcept(X) +# else +# define ${def_value} +# define ${def_value}_EXPR(X) +# endif +\n") + endif() + if (feature STREQUAL cxx_nullptr) + set(def_value "${prefix_arg}_NULLPTR") + set(file_content "${file_content} +# if ${def_name} +# define ${def_value} nullptr +# else +# define ${def_value} 0 +# endif +\n") + endif() + if (feature STREQUAL cxx_thread_local) + set(def_value "${prefix_arg}_THREAD_LOCAL") + set(file_content "${file_content} +# if ${def_name} +# define ${def_value} thread_local +# elif ${prefix_arg}_COMPILER_IS_GNU || ${prefix_arg}_COMPILER_IS_Clang || ${prefix_arg}_COMPILER_IS_AppleClang +# define ${def_value} __thread +# elif ${prefix_arg}_COMPILER_IS_MSVC +# define ${def_value} __declspec(thread) +# else +// ${def_value} not defined for this configuration. +# endif +\n") + endif() + if (feature STREQUAL cxx_attribute_deprecated) + set(def_name ${prefix_arg}_${feature_PP}) + set(def_value "${prefix_arg}_DEPRECATED") + set(file_content "${file_content} +# ifndef ${def_value} +# if ${def_name} +# define ${def_value} [[deprecated]] +# define ${def_value}_MSG(MSG) [[deprecated(MSG)]] +# elif ${prefix_arg}_COMPILER_IS_GNU || ${prefix_arg}_COMPILER_IS_Clang +# define ${def_value} __attribute__((__deprecated__)) +# define ${def_value}_MSG(MSG) __attribute__((__deprecated__(MSG))) +# elif ${prefix_arg}_COMPILER_IS_MSVC +# define ${def_value} __declspec(deprecated) +# define ${def_value}_MSG(MSG) __declspec(deprecated(MSG)) +# else +# define ${def_value} +# define ${def_value}_MSG(MSG) +# endif +# endif +\n") + endif() + endforeach() + + set(file_content "${file_content}#endif\n") + + endforeach() + + if(_WCD_OUTPUT_FILES_VAR) + foreach(compiler ${_WCD_COMPILERS}) + foreach(_lang ${_langs}) + if(compiler_file_content_${compiler}_${_lang}) + set(CMAKE_CONFIGURABLE_FILE_CONTENT "${compiler_file_content_}") + set(CMAKE_CONFIGURABLE_FILE_CONTENT "${CMAKE_CONFIGURABLE_FILE_CONTENT}${compiler_file_content_${compiler}_${_lang}}") + + set(compile_file_name "${_WCD_OUTPUT_DIR}${prefix_arg}_COMPILER_INFO_${compiler}_${_lang}.h") + set(full_path "${main_file_dir}/${compile_file_name}") + list(APPEND ${_WCD_OUTPUT_FILES_VAR} ${full_path}) + configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in" + "${full_path}" + @ONLY + ) + endif() + endforeach() + endforeach() + set(${_WCD_OUTPUT_FILES_VAR} ${${_WCD_OUTPUT_FILES_VAR}} PARENT_SCOPE) + endif() + + if (_WCD_EPILOG) + set(file_content "${file_content}\n${_WCD_EPILOG}\n") + endif() + set(file_content "${file_content}\n#endif") + + set(CMAKE_CONFIGURABLE_FILE_CONTENT ${file_content}) + configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in" + "${file_arg}" + @ONLY + ) +endfunction() diff --git a/lib/wiiuse/cmake/cmake-4.0.0-modules/RequireOutOfSourceBuild.cmake b/lib/wiiuse/cmake/cmake-4.0.0-modules/RequireOutOfSourceBuild.cmake new file mode 100644 index 000000000..9b27970b5 --- /dev/null +++ b/lib/wiiuse/cmake/cmake-4.0.0-modules/RequireOutOfSourceBuild.cmake @@ -0,0 +1,44 @@ +# - Issue an error if the source tree is in or equal to the build tree +# +# include(RequireOutOfSourceBuild) +# +# +# 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) + +get_filename_component(_src "${CMAKE_SOURCE_DIR}" ABSOLUTE) +get_filename_component(_cur_src "${CMAKE_CURRENT_SOURCE_DIR}" ABSOLUTE) +get_filename_component(_bin "${CMAKE_BINARY_DIR}" ABSOLUTE) + +string(LENGTH "${_src}" _src_len) +string(LENGTH "${_cur_src}" _cur_src_len) +string(LENGTH "${_bin}" _bin_len) + +set(_test) + +if(NOT "${_bin_len}" GREATER "${_src_len}") + list(APPEND _test _src) + #message(STATUS "Checking ${_src}") +endif() + +if(NOT "${_bin_len}" GREATER "${_cur_src_len}") + list(APPEND _test _cur_src) + #message(STATUS "Checking ${_cur_src}") +endif() + +foreach(_var ${_test}) + string(SUBSTRING "${${_var}}" 0 ${_bin_len} _chopped) + #message(STATUS "comparing ${_bin} and ${_chopped}") + if("${_bin}" STREQUAL "${_chopped}") + get_filename_component(_parent "${CMAKE_SOURCE_DIR}/.." ABSOLUTE) + message(FATAL_ERROR + "You must set a binary directory that is different from your source directory. You might consider ${CMAKE_SOURCE_DIR}/build or ${_parent}/build-${CMAKE_PROJECT_NAME}") + endif() +endforeach() diff --git a/lib/wiiuse/cmake/cmake-4.0.0-modules/autoinclude.cmake b/lib/wiiuse/cmake/cmake-4.0.0-modules/autoinclude.cmake new file mode 100644 index 000000000..e9206ee08 --- /dev/null +++ b/lib/wiiuse/cmake/cmake-4.0.0-modules/autoinclude.cmake @@ -0,0 +1,13 @@ +# - Autoinclude these policies automatically +# +# 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) + +include(RequireOutOfSourceBuild) diff --git a/lib/wiiuse/cmake/cmake-4.0.0-modules/from-ITK-3.18.0/FindFFTW.cmake b/lib/wiiuse/cmake/cmake-4.0.0-modules/from-ITK-3.18.0/FindFFTW.cmake new file mode 100644 index 000000000..906906ec8 --- /dev/null +++ b/lib/wiiuse/cmake/cmake-4.0.0-modules/from-ITK-3.18.0/FindFFTW.cmake @@ -0,0 +1,68 @@ +## FFTW can be compiled and subsequently linked against +## various data types. +## There is a single set of include files, and then muttiple libraries, +## One for each type. I.e. libfftw.a-->double, libfftwf.a-->float + +## The following logic belongs in the individual package +## MARK_AS_ADVANCED(USE_FFTWD) +## OPTION(USE_FFTWD "Use double precision FFTW if found" ON) +## MARK_AS_ADVANCED(USE_FFTWF) +## OPTION(USE_FFTWF "Use single precision FFTW if found" ON) + +IF(USE_FFTWD OR USE_FFTWF) + + SET(FFTW_INC_SEARCHPATH + /sw/include + /usr/include + /usr/local/include + /usr/include/fftw + /usr/local/include/fftw + ) + + FIND_PATH(FFTW_INCLUDE_PATH fftw3.h ${FFTW_INC_SEARCHPATH}) + + IF(FFTW_INCLUDE_PATH) + SET(FFTW_INCLUDE ${FFTW_INCLUDE_PATH}) + ENDIF (FFTW_INCLUDE_PATH) + + IF(FFTW_INCLUDE) + INCLUDE_DIRECTORIES( ${FFTW_INCLUDE}) + ENDIF(FFTW_INCLUDE) + + GET_FILENAME_COMPONENT(FFTW_INSTALL_BASE_PATH ${FFTW_INCLUDE_PATH} PATH) + + SET(FFTW_LIB_SEARCHPATH + ${FFTW_INSTALL_BASE_PATH}/lib + /usr/lib/fftw + /usr/local/lib/fftw + ) + + IF(USE_FFTWD) + MARK_AS_ADVANCED(FFTWD_LIB) +# OPTION(FFTWD_LIB "The full path to the fftw3 library (including the library)" ) + FIND_LIBRARY(FFTWD_LIB fftw3 ${FFTW_LIB_SEARCHPATH}) #Double Precision Lib + FIND_LIBRARY(FFTWD_THREADS_LIB fftw3_threads ${FFTW_LIB_SEARCHPATH}) #Double Precision Lib only if compiled with threads support + + IF(FFTWD_LIB) + SET(FFTWD_FOUND 1) + IF(FFTWD_THREADS_LIB) + SET(FFTWD_LIB ${FFTWD_LIB} ${FFTWD_THREADS_LIB} ) + ENDIF(FFTWD_THREADS_LIB) + ENDIF(FFTWD_LIB) + ENDIF(USE_FFTWD) + + IF(USE_FFTWF) + MARK_AS_ADVANCED(FFTWF_LIB) +# OPTION(FFTWF_LIB "The full path to the fftw3f library (including the library)" ) + FIND_LIBRARY(FFTWF_LIB fftw3f ${FFTW_LIB_SEARCHPATH}) #Single Precision Lib + FIND_LIBRARY(FFTWF_THREADS_LIB fftw3f_threads ${FFTW_LIB_SEARCHPATH}) #Single Precision Lib only if compiled with threads support + + IF(FFTWF_LIB) + SET(FFTWF_FOUND 1) + IF(FFTWF_THREADS_LIB) + SET(FFTWF_LIB ${FFTWF_LIB} ${FFTWF_THREADS_LIB} ) + ENDIF(FFTWF_THREADS_LIB) + ENDIF(FFTWF_LIB) + ENDIF(USE_FFTWF) + +ENDIF(USE_FFTWD OR USE_FFTWF) diff --git a/lib/wiiuse/cmake/export-to-directory.sh b/lib/wiiuse/cmake/export-to-directory.sh new file mode 100755 index 000000000..1736e5c02 --- /dev/null +++ b/lib/wiiuse/cmake/export-to-directory.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +src="$(dirname $(readlink -f $0))" + +if [ "x$1" = "x-f" ]; then + dst="$(readlink -mn $2)/" + args="-f" +else + dst="$(readlink -mn $1)/" + args="$2" +fi + +echo "Exporting the modules from '$src' to '$dst'" + +mkdir -p $dst +( + cd "$src" + git checkout-index -a $args "--prefix=$dst" +) + +echo "Done!" + diff --git a/lib/wiiuse/cmake/ghost-fake-stl/alloc.h b/lib/wiiuse/cmake/ghost-fake-stl/alloc.h new file mode 100644 index 000000000..cc8883f51 --- /dev/null +++ b/lib/wiiuse/cmake/ghost-fake-stl/alloc.h @@ -0,0 +1,14 @@ +/** @file + @brief Fake header to allow GHOST 4.09 use with MSVC 2005 + + @date 2012 + + @author + Ryan Pavlik + and + http://academic.cleardefinition.com/ + Iowa State University Virtual Reality Applications Center + Human-Computer Interaction Graduate Program +*/ + +#pragma once diff --git a/lib/wiiuse/cmake/ghost-fake-stl/hash_map.h b/lib/wiiuse/cmake/ghost-fake-stl/hash_map.h new file mode 100644 index 000000000..fcf3f0d0b --- /dev/null +++ b/lib/wiiuse/cmake/ghost-fake-stl/hash_map.h @@ -0,0 +1,28 @@ +/** @file + @brief Fake header to allow GHOST 4.09 use with MSVC 2005 + + @date 2012 + + @author + Ryan Pavlik + and + http://academic.cleardefinition.com/ + Iowa State University Virtual Reality Applications Center + Human-Computer Interaction Graduate Program +*/ + +#pragma once + +#include +//using stdext::hash_map; + +template +class hash; +template +class equal_to; + +template +class hash_map; + +template +class hash_map, equal_to > : public stdext::hash_map {}; diff --git a/lib/wiiuse/cmake/ghost-fake-stl/iostream.h b/lib/wiiuse/cmake/ghost-fake-stl/iostream.h new file mode 100644 index 000000000..7d7195fd2 --- /dev/null +++ b/lib/wiiuse/cmake/ghost-fake-stl/iostream.h @@ -0,0 +1,20 @@ +/** @file + @brief Fake header to allow GHOST 4.09 use with MSVC 2005 + + @date 2010 + + @author + Ryan Pavlik + and + http://academic.cleardefinition.com/ + Iowa State University Virtual Reality Applications Center + Human-Computer Interaction Graduate Program +*/ + +#pragma once + +#include +using std::istream; +using std::ostream; +using std::cerr; +using std::endl; \ No newline at end of file diff --git a/lib/wiiuse/cmake/ghost-fake-stl/list.h b/lib/wiiuse/cmake/ghost-fake-stl/list.h new file mode 100644 index 000000000..a8b3fc24d --- /dev/null +++ b/lib/wiiuse/cmake/ghost-fake-stl/list.h @@ -0,0 +1,20 @@ +/** @file + @brief Fake header to allow GHOST 4.09 use with MSVC 2005 + + @date 2010 + + @author + Ryan Pavlik + and + http://academic.cleardefinition.com/ + Iowa State University Virtual Reality Applications Center + Human-Computer Interaction Graduate Program +*/ + +#pragma once + +#include +using std::list; + +// Disable dll export that depends on the SGI STL implementation +#undef GHOST_EXTRA_TEMPLATE_DECLARATIONS \ No newline at end of file diff --git a/lib/wiiuse/cmake/ghost-fake-stl/pair.h b/lib/wiiuse/cmake/ghost-fake-stl/pair.h new file mode 100644 index 000000000..af793b553 --- /dev/null +++ b/lib/wiiuse/cmake/ghost-fake-stl/pair.h @@ -0,0 +1,17 @@ +/** @file + @brief Fake header to allow GHOST 4.09 use with MSVC 2005 + + @date 2012 + + @author + Ryan Pavlik + and + http://academic.cleardefinition.com/ + Iowa State University Virtual Reality Applications Center + Human-Computer Interaction Graduate Program +*/ + +#pragma once + +#include +using std::pair; diff --git a/lib/wiiuse/cmake/ghost-fake-stl/set.h b/lib/wiiuse/cmake/ghost-fake-stl/set.h new file mode 100644 index 000000000..880696135 --- /dev/null +++ b/lib/wiiuse/cmake/ghost-fake-stl/set.h @@ -0,0 +1,19 @@ +/** @file + @brief Fake header to allow GHOST 4.09 use with MSVC 2005 + + @date 2010 + + @author + Ryan Pavlik + and + http://academic.cleardefinition.com/ + Iowa State University Virtual Reality Applications Center + Human-Computer Interaction Graduate Program +*/ + +#pragma once + +#include +#include +using std::set; +using std::less; \ No newline at end of file diff --git a/lib/wiiuse/cmake/ghost-fake-stl/vector.h b/lib/wiiuse/cmake/ghost-fake-stl/vector.h new file mode 100644 index 000000000..659db2d68 --- /dev/null +++ b/lib/wiiuse/cmake/ghost-fake-stl/vector.h @@ -0,0 +1,20 @@ +/** @file + @brief Fake header to allow GHOST 4.09 use with MSVC 2005 + + @date 2010 + + @author + Ryan Pavlik + and + http://academic.cleardefinition.com/ + Iowa State University Virtual Reality Applications Center + Human-Computer Interaction Graduate Program +*/ + +#pragma once + +#include +using std::vector; + +// Disable dll export that depends on the SGI STL implementation +#undef GHOST_EXTRA_TEMPLATE_DECLARATIONS \ No newline at end of file diff --git a/lib/wiiuse/cmake/launcher-templates/genericlauncher.cmd.in b/lib/wiiuse/cmake/launcher-templates/genericlauncher.cmd.in new file mode 100644 index 000000000..9a19bbc7a --- /dev/null +++ b/lib/wiiuse/cmake/launcher-templates/genericlauncher.cmd.in @@ -0,0 +1,14 @@ +cd @USERFILE_WORKING_DIRECTORY@ +@USERFILE_ENV_COMMANDS@ + +IF NOT [x%1]==[x--debugger] GOTO SkipDebuggingMess + +ECHO Need to ditch the debugger! +SHIFT /1 +%1 %2 %3 %4 %5 %6 %7 %8 %9 +GOTO EOF + +:SkipDebuggingMess +%* + +:EOF \ No newline at end of file diff --git a/lib/wiiuse/cmake/launcher-templates/genericlauncher.sh.in b/lib/wiiuse/cmake/launcher-templates/genericlauncher.sh.in new file mode 100644 index 000000000..18720517a --- /dev/null +++ b/lib/wiiuse/cmake/launcher-templates/genericlauncher.sh.in @@ -0,0 +1,18 @@ +#!/bin/sh +bindir=$(pwd) +cd @USERFILE_WORKING_DIRECTORY@ +@USERFILE_ENV_COMMANDS@ +if test "x$1" = "x--debugger"; then + shift + cmd="$1" + shift + if test "x@LAUNCHERS_GOT_GDB@" = "xYES"; then + echo "r $@" > $bindir/gdbscript + echo "bt" >> $bindir/gdbscript + @GDB_COMMAND@ -batch -command=$bindir/gdbscript @LAUNCHERS_GDB_ARG@ $cmd + else + $cmd $@ + fi +else + $@ +fi diff --git a/lib/wiiuse/cmake/launcher-templates/launcher.env.cmd.in b/lib/wiiuse/cmake/launcher-templates/launcher.env.cmd.in new file mode 100644 index 000000000..72a24e67e --- /dev/null +++ b/lib/wiiuse/cmake/launcher-templates/launcher.env.cmd.in @@ -0,0 +1 @@ +set @_arg@ diff --git a/lib/wiiuse/cmake/launcher-templates/launcher.env.sh.in b/lib/wiiuse/cmake/launcher-templates/launcher.env.sh.in new file mode 100644 index 000000000..428cffffb --- /dev/null +++ b/lib/wiiuse/cmake/launcher-templates/launcher.env.sh.in @@ -0,0 +1 @@ +export @_arg@ diff --git a/lib/wiiuse/cmake/launcher-templates/perconfig.vcproj.user.in b/lib/wiiuse/cmake/launcher-templates/perconfig.vcproj.user.in new file mode 100644 index 000000000..95cacecff --- /dev/null +++ b/lib/wiiuse/cmake/launcher-templates/perconfig.vcproj.user.in @@ -0,0 +1,28 @@ + + + diff --git a/lib/wiiuse/cmake/launcher-templates/perconfig.vcxproj.user.in b/lib/wiiuse/cmake/launcher-templates/perconfig.vcxproj.user.in new file mode 100644 index 000000000..ef0237999 --- /dev/null +++ b/lib/wiiuse/cmake/launcher-templates/perconfig.vcxproj.user.in @@ -0,0 +1,7 @@ + + @USERFILE_ENVIRONMENT@ + WindowsLocalDebugger + ${USERFILE_@USERFILE_CONFIGNAME@_COMMAND} + @USERFILE_COMMAND_ARGUMENTS@ + @USERFILE_WORKING_DIRECTORY@ + diff --git a/lib/wiiuse/cmake/launcher-templates/targetlauncher.cmd.in b/lib/wiiuse/cmake/launcher-templates/targetlauncher.cmd.in new file mode 100644 index 000000000..c5715d679 --- /dev/null +++ b/lib/wiiuse/cmake/launcher-templates/targetlauncher.cmd.in @@ -0,0 +1,8 @@ +cd @USERFILE_WORKING_DIRECTORY@ +@USERFILE_ENV_COMMANDS@ +if [%1]==[--debugger] ( + SHIFT +) + +"@USERFILE_COMMAND@" @LAUNCHERSCRIPT_COMMAND_ARGUMENTS@ +pause diff --git a/lib/wiiuse/cmake/launcher-templates/targetlauncher.sh.in b/lib/wiiuse/cmake/launcher-templates/targetlauncher.sh.in new file mode 100644 index 000000000..b4b6d7309 --- /dev/null +++ b/lib/wiiuse/cmake/launcher-templates/targetlauncher.sh.in @@ -0,0 +1,16 @@ +#!/bin/sh +bindir=$(pwd) +cd @USERFILE_WORKING_DIRECTORY@ +@USERFILE_ENV_COMMANDS@ +if test "x$1" = "x--debugger"; then + shift + if test "x@LAUNCHERS_GOT_GDB@" = "xYES"; then + echo "r @LAUNCHERSCRIPT_COMMAND_ARGUMENTS@" > $bindir/gdbscript + echo "bt" >> $bindir/gdbscript + @GDB_COMMAND@ -batch -command=$bindir/gdbscript @LAUNCHERS_GDB_ARG@ @USERFILE_COMMAND@ + else + "@USERFILE_COMMAND@" @LAUNCHERSCRIPT_COMMAND_ARGUMENTS@ + fi +else + "@USERFILE_COMMAND@" @LAUNCHERSCRIPT_COMMAND_ARGUMENTS@ +fi diff --git a/lib/wiiuse/cmake/launcher-templates/vcproj.user.in b/lib/wiiuse/cmake/launcher-templates/vcproj.user.in new file mode 100644 index 000000000..117473d70 --- /dev/null +++ b/lib/wiiuse/cmake/launcher-templates/vcproj.user.in @@ -0,0 +1,10 @@ + + + +@USERFILE_CONFIGSECTIONS@ + + diff --git a/lib/wiiuse/cmake/launcher-templates/vcxproj.user.in b/lib/wiiuse/cmake/launcher-templates/vcxproj.user.in new file mode 100644 index 000000000..f3e423835 --- /dev/null +++ b/lib/wiiuse/cmake/launcher-templates/vcxproj.user.in @@ -0,0 +1,4 @@ + + +@USERFILE_CONFIGSECTIONS@ + diff --git a/lib/wiiuse/cmake/module-docs/AllModuleDependencies.dot b/lib/wiiuse/cmake/module-docs/AllModuleDependencies.dot new file mode 100644 index 000000000..9110002e6 --- /dev/null +++ b/lib/wiiuse/cmake/module-docs/AllModuleDependencies.dot @@ -0,0 +1,72 @@ +digraph { + size="7.5,10" + nodesep = .25 + ranksep = 1.0 + label = "Dependencies of CMake Modules - All require CMake 2.6 or newer"; + + subgraph cluster_upstream { + label = "Included with upstream 2.8.0 or cmake-2.8.0-modules"; + SelectLibraryConfigurations; + FindBoost; + FindOpenSceneGraph -> { FindOpenThreads; FindosgALL [label = "Findosg*"]; } + } + + // Directories + PackageMacosxDirectory [label = "cmake/package/macosx/"]; + workaroundsTcharDirectory [label = "cmake/workarounds/tchar/"]; + cmakeUpstreamModulesDirectories [label = "cmake/cmake-*-modules/"]; + + // other Modules + BundleOSGRuntime; + BundleVRJ22Runtime; + CheckMacHIDAPI; + CheckVersion; + CleanDirectoryList; + CleanLibraryList; + CreateMSVCUserFiles -> { ListFilter; ProgramFilesGlob; CleanDirectoryList; } + FixWinInstallPrefix; + GetCompilerInfoString; + GetForceIncludeDefinitions; + ListCombinations; + ListFilter; + MakeVRJugglerAppBundle -> PackageMacosxDirectory; + PrefixListGlob; + ProgramFilesGlob -> { PrefixListGlob; CleanDirectoryList;} + SearchProgramFilesForOpenSceneGraph -> { ProgramFilesGlob; ListFilter; PrefixListGlob; CleanDirectoryList; } + + + subgraph cluster_findmodules { + label = "find_package Find Modules"; + + subgraph cluster_vrjuggler22 { + label = "VR Juggler 2.2 suite: All require CleanLibraryList and CleanDirectoryList, and recommend FindFlagpoll"; + FindTweek12 -> FindVPR20; + FindJCCL12 -> FindVPR20; + FindGadgeteer12 -> { FindJCCL12; FindVPR20; } + FindSonix12 -> FindVPR20; + FindVRJ22 -> { FindJCCL12; FindGadgeteer12; FindSonix12; FindVPR20; } + FindVRJOGL22 -> FindVRJ22; + FindVRJuggler22 -> FindVRJOGL22; + } -> {FindFlagpoll; CleanLibraryList; CleanDirectoryList;} + FindVPR20 -> { FindBoost; FindCPPDOM; } + FindGadgeteer12 -> FindGMTL; + FindSonix12 -> FindGMTL; + //cluster_vrjuggler22 -> {FindFlagpoll; CleanLibraryList;} + BundleVRJ22Runtime -> FindVRJuggler22; + + FindGLUI; + FindGPM; + FindJtTk -> { ListCombinations; CheckVersion; PrefixListGlob; ProgramFilesGlob; } + FindMacHID -> CheckMacHIDAPI; + FindOpenHaptics -> { SelectLibraryConfigurations; CleanDirectoryList; CleanLibraryList; ListCombinations; ProgramFilesGlob; } + FindParasolid -> { ListCombinations; CheckVersion; ProgramFilesGlob; } + Findquatlib; + FindVPS -> { SelectLibraryConfigurations; ListCombinations; CheckVersion; ListFilter; } + FindWiiUse; + } + + + + TCHARWorkaround -> workaroundsTcharDirectory; + UseBackportedModules -> cmakeUpstreamModulesDirectories; +} diff --git a/lib/wiiuse/cmake/module-docs/AllModuleDependencies.jpg b/lib/wiiuse/cmake/module-docs/AllModuleDependencies.jpg new file mode 100644 index 000000000..16de0c175 Binary files /dev/null and b/lib/wiiuse/cmake/module-docs/AllModuleDependencies.jpg differ diff --git a/lib/wiiuse/cmake/module-docs/AllModuleDependencies.pdf b/lib/wiiuse/cmake/module-docs/AllModuleDependencies.pdf new file mode 100644 index 000000000..622287234 Binary files /dev/null and b/lib/wiiuse/cmake/module-docs/AllModuleDependencies.pdf differ diff --git a/lib/wiiuse/cmake/module-docs/AllModuleDependencies.png b/lib/wiiuse/cmake/module-docs/AllModuleDependencies.png new file mode 100644 index 000000000..23deadbc1 Binary files /dev/null and b/lib/wiiuse/cmake/module-docs/AllModuleDependencies.png differ diff --git a/lib/wiiuse/cmake/module-docs/Example-FindMyPackage-UsingImportedTargets.cmake b/lib/wiiuse/cmake/module-docs/Example-FindMyPackage-UsingImportedTargets.cmake new file mode 100644 index 000000000..23ac10b2b --- /dev/null +++ b/lib/wiiuse/cmake/module-docs/Example-FindMyPackage-UsingImportedTargets.cmake @@ -0,0 +1,193 @@ +# - try to find MyPackage library +# +# Example-FindMyPackage-UsingImportedTargets.cmake +# +# This module does the same thing as Example-FindMyPackage.cmake +# except that rather than passing along full path names for libraries, +# it creates imported targets. The end result is roughly the same to +# the end-user. Please see that other file for the full documentation +# of the example. +# +# Note that if you're going to be installing target export files, this +# is probably what you should prefer. See cmake mailing list archives. +# +# Start of what would be a minimal module documentation block: +# +# Cache Variables: (not for direct use in CMakeLists.txt) +# MYPACKAGE_ROOT +# MYPACKAGE_LIBRARY +# MYPACKAGE_INCLUDE_DIR +# MYPACKAGE_a_LIBRARY +# MYPACKAGE_a_INCLUDE_DIR +# MYPACKAGE_b_LIBRARY +# MYPACKAGE_b_INCLUDE_DIR +# MYPACKAGE_c_LIBRARY +# MYPACKAGE_c_INCLUDE_DIR +# +# Non-cache variables you might use in your CMakeLists.txt: +# MYPACKAGE_FOUND +# +# MYPACKAGE_LIBRARIES +# MYPACKAGE_INCLUDE_DIRS +# MYPACKAGE_LINKER_FLAGS +# +# MYPACKAGE_a_LIBRARIES +# MYPACKAGE_a_INCLUDE_DIRS +# MYPACKAGE_a_LINKER_FLAGS +# +# MYPACKAGE_b_LIBRARIES +# MYPACKAGE_b_INCLUDE_DIRS +# MYPACKAGE_b_LINKER_FLAGS +# +# MYPACKAGE_c_LIBRARIES +# MYPACKAGE_c_INCLUDE_DIRS +# MYPACKAGE_c_LINKER_FLAGS +# +# Use this module this way: +# find_package(MyPackage) +# include_directories(${MYPACKAGE_INCLUDE_DIRS}) +# add_executable(myapp ${SOURCES}) +# target_link_libraries(myapp ${MYPACKAGE_LIBRARIES}) +# set_property(TARGET myapp PROPERTY LINK_FLAGS ${MYPACKAGE_LINKER_FLAGS}) +# +# Requires these CMake modules: +# FindPackageHandleStandardArgs (CMake standard module) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC + +set(MYPACKAGE_ROOT + "${MYPACKAGE_ROOT}" + CACHE + PATH + "Root directory to look in") + +find_library(MYPACKAGE_LIBRARY + NAMES + mypackagecore + PATHS + "${MYPACKAGE_ROOT}" + PATH_SUFFIXES + lib) + +find_path(MYPACKAGE_INCLUDE_DIR + NAMES + mypackage/mypackage.h + PATHS + "${MYPACKAGE_ROOT}" + PATH_SUFFIXES + include) + +# Assuming that the components are named libmypackagea, libmypackageb, etc +foreach(lib a b c) + find_library(MYPACKAGE_${lib}_LIBRARY + NAMES + mypackage${lib} + PATHS + "${MYPACKAGE_ROOT}" + PATH_SUFFIXES + lib) + + find_path(MYPACKAGE_${lib}_INCLUDE_DIR + NAMES + mypackage/${lib}/${lib}.h + PATHS + "${MYPACKAGE_ROOT}" + PATH_SUFFIXES + include) + +endforeach() + +# see /usr/share/cmake-2.x/Modules/FindBLAS.cmake for the variables this will define +if(NOT BLAS_FOUND) + find_package(BLAS QUIETLY) +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(MyPackage + DEFAULT_MSG + MYPACKAGE_LIBRARY + MYPACKAGE_INCLUDE_DIR + MYPACKAGE_a_LIBRARY + MYPACKAGE_a_INCLUDE_DIR + MYPACKAGE_b_LIBRARY + MYPACKAGE_b_INCLUDE_DIR + MYPACKAGE_c_LIBRARY + MYPACKAGE_c_INCLUDE_DIR + BLAS_FOUND) + +if(MYPACKAGE_FOUND) + # Set variables containing libraries and their dependencies + # Always use the plural form for the variables defined by other find modules: + # they might have dependencies too! + + add_library(mypackage_c IMPORTED) + set_target_properties(mypackage_c + PROPERTIES + IMPORTED_LOCATION + ${MYPACKAGE_c_LIBRARY} + IMPORTED_LINK_INTERFACE_LIBRARIES + ${BLAS_LIBRARIES}) + set(MYPACKAGE_c_LIBRARIES mypackage_c) + set(MYPACKAGE_c_INCLUDE_DIRS ${MYPACKAGE_c_INCLUDE_DIR}) # No include dir for BLAS? + set(MYPACKAGE_c_LINKER_FLAGS ${BLAS_LINKER_FLAGS}) + + add_library(mypackage_b IMPORTED) + set_target_properties(mypackage_b + PROPERTIES + IMPORTED_LOCATION + ${MYPACKAGE_b_LIBRARY} + IMPORTED_LINK_INTERFACE_LIBRARIES + ${MYPACKAGE_c_LIBRARIES}) + set(MYPACKAGE_b_LIBRARIES mypackage_b) + set(MYPACKAGE_b_INCLUDE_DIRS + ${MYPACKAGE_b_INCLUDE_DIR} + ${MYPACKAGE_c_INCLUDE_DIRS}) + set(MYPACKAGE_b_LINKER_FLAGS ${MYPACKAGE_c_LINKER_FLAGS}) + + add_library(mypackage_a IMPORTED) + set_target_properties(mypackage_a + PROPERTIES + IMPORTED_LOCATION + ${MYPACKAGE_a_LIBRARY} + IMPORTED_LINK_INTERFACE_LIBRARIES + ${MYPACKAGE_b_LIBRARIES}) + set(MYPACKAGE_a_LIBRARIES mypackage_a) + set(MYPACKAGE_a_INCLUDE_DIRS + ${MYPACKAGE_a_INCLUDE_DIR} + ${MYPACKAGE_b_INCLUDE_DIRS}) + set(MYPACKAGE_a_LINKER_FLAGS ${MYPACKAGE_b_LINKER_FLAGS}) + + add_library(mypackage_core IMPORTED) + set_target_properties(mypackage_core + PROPERTIES + IMPORTED_LOCATION + ${MYPACKAGE_LIBRARY} + IMPORTED_LINK_INTERFACE_LIBRARIES + ${MYPACKAGE_a_LIBRARIES}) + set(MYPACKAGE_LIBRARIES mypackage_core) + set(MYPACKAGE_INCLUDE_DIRS + ${MYPACKAGE_INCLUDE_DIR} + ${MYPACKAGE_a_INCLUDE_DIRS}) + set(MYPACKAGE_LINKER_FLAGS ${MYPACKAGE_a_LINKER_FLAGS}) + +endif() + +mark_as_advanced(MYPACKAGE_LIBRARY + MYPACKAGE_INCLUDE_DIR + MYPACKAGE_a_LIBRARY + MYPACKAGE_a_INCLUDE_DIR + MYPACKAGE_b_LIBRARY + MYPACKAGE_b_INCLUDE_DIR + MYPACKAGE_c_LIBRARY + MYPACKAGE_c_INCLUDE_DIR) + +if(MYPACKAGE_FOUND) + mark_as_advanced(MYPACKAGE_ROOT) +endif() + +# End of Example-FindMyPackage-UsingImportedTargets.cmake diff --git a/lib/wiiuse/cmake/module-docs/Example-FindMyPackage.cmake b/lib/wiiuse/cmake/module-docs/Example-FindMyPackage.cmake new file mode 100644 index 000000000..cdf3bfcad --- /dev/null +++ b/lib/wiiuse/cmake/module-docs/Example-FindMyPackage.cmake @@ -0,0 +1,189 @@ +# - try to find MyPackage library +# +# Example-FindMyPackage.cmake +# +# This example is for a fairly in-depth library that has four +# internal dependencies as well as an external dependency. +# The dependency tree is described below, in graphviz/dot format, and you +# can remove the #'s from the following lines and run it through graphviz, +# with this command: dot dependencies.dot -O -Tpdf +# +# --- start of dependencies.dot --- +# digraph { +# BLAS; +# subgraph cluster_mypackage { +# label = "Components that are part of MyPackage"; +# libmypackagecore -> libmypackagea; +# libmypackagea -> libmypackageb; +# libmypackageb -> libmypackagec; +# libmypackagec -> BLAS; +# } +# } +# --- end of dependencies.dot --- +# +# Because our imaginary component "c" requires BLAS and BLAS needs some +# linker flags, MYPACKAGE_..._LINKER_FLAGS joins the usual group of +# _LIBRARY/_LIBRARIES and _INCLUDE_DIR/_INCLUDE_DIRS variables. If +# you don't use a library like that, you don't need to include the +# lines dealing with that group of variables. +# +# Most library aren't nearly this complex - but some are, and many +# have some parts of the complexity handled here. +# +# Start of what would be a minimal module documentation block: +# +# Cache Variables: (not for direct use in CMakeLists.txt) +# MYPACKAGE_ROOT +# MYPACKAGE_LIBRARY +# MYPACKAGE_INCLUDE_DIR +# MYPACKAGE_a_LIBRARY +# MYPACKAGE_a_INCLUDE_DIR +# MYPACKAGE_b_LIBRARY +# MYPACKAGE_b_INCLUDE_DIR +# MYPACKAGE_c_LIBRARY +# MYPACKAGE_c_INCLUDE_DIR +# +# Non-cache variables you might use in your CMakeLists.txt: +# MYPACKAGE_FOUND +# +# MYPACKAGE_LIBRARIES +# MYPACKAGE_INCLUDE_DIRS +# MYPACKAGE_LINKER_FLAGS +# +# MYPACKAGE_a_LIBRARIES +# MYPACKAGE_a_INCLUDE_DIRS +# MYPACKAGE_a_LINKER_FLAGS +# +# MYPACKAGE_b_LIBRARIES +# MYPACKAGE_b_INCLUDE_DIRS +# MYPACKAGE_b_LINKER_FLAGS +# +# MYPACKAGE_c_LIBRARIES +# MYPACKAGE_c_INCLUDE_DIRS +# MYPACKAGE_c_LINKER_FLAGS +# +# Use this module this way: +# find_package(MyPackage) +# include_directories(${MYPACKAGE_INCLUDE_DIRS}) +# add_executable(myapp ${SOURCES}) +# target_link_libraries(myapp ${MYPACKAGE_LIBRARIES}) +# set_property(TARGET myapp PROPERTY LINK_FLAGS ${MYPACKAGE_LINKER_FLAGS}) +# +# Requires these CMake modules: +# FindPackageHandleStandardArgs (CMake standard module) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC + +set(MYPACKAGE_ROOT + "${MYPACKAGE_ROOT}" + CACHE + PATH + "Root directory to look in") + +find_library(MYPACKAGE_LIBRARY + NAMES + mypackagecore + PATHS + "${MYPACKAGE_ROOT}" + PATH_SUFFIXES + lib) + +find_path(MYPACKAGE_INCLUDE_DIR + NAMES + mypackage/mypackage.h + PATHS + "${MYPACKAGE_ROOT}" + PATH_SUFFIXES + include) + +# Assuming that the components are named libmypackagea, libmypackageb, etc +foreach(lib a b c) + find_library(MYPACKAGE_${lib}_LIBRARY + NAMES + mypackage${lib} + PATHS + "${MYPACKAGE_ROOT}" + PATH_SUFFIXES + lib) + + find_path(MYPACKAGE_${lib}_INCLUDE_DIR + NAMES + mypackage/${lib}/${lib}.h + PATHS + "${MYPACKAGE_ROOT}" + PATH_SUFFIXES + include) + +endforeach() + +# Searching for dependencies here - always quiet. +# see /usr/share/cmake-2.x/Modules/FindBLAS.cmake for the variables this will define +if(NOT BLAS_FOUND) + find_package(BLAS QUIETLY) +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(MyPackage + DEFAULT_MSG + MYPACKAGE_LIBRARY + MYPACKAGE_INCLUDE_DIR + MYPACKAGE_a_LIBRARY + MYPACKAGE_a_INCLUDE_DIR + MYPACKAGE_b_LIBRARY + MYPACKAGE_b_INCLUDE_DIR + MYPACKAGE_c_LIBRARY + MYPACKAGE_c_INCLUDE_DIR + BLAS_FOUND) + +if(MYPACKAGE_FOUND) + # Set variables containing libraries and their dependencies + # Always use the plural form for the variables defined by other find modules: + # they might have dependencies too! + + set(MYPACKAGE_c_LIBRARIES ${MYPACKAGE_c_LIBRARY} ${BLAS_LIBRARIES}) + set(MYPACKAGE_c_INCLUDE_DIRS ${MYPACKAGE_c_INCLUDE_DIR}) # No include dir for BLAS? + set(MYPACKAGE_c_LINKER_FLAGS ${BLAS_LINKER_FLAGS}) + + set(MYPACKAGE_b_LIBRARIES + ${MYPACKAGE_b_LIBRARY} + ${MYPACKAGE_c_LIBRARIES}) + set(MYPACKAGE_b_INCLUDE_DIRS + ${MYPACKAGE_b_INCLUDE_DIR} + ${MYPACKAGE_c_INCLUDE_DIRS}) + set(MYPACKAGE_b_LINKER_FLAGS ${MYPACKAGE_c_LINKER_FLAGS}) + + set(MYPACKAGE_a_LIBRARIES + ${MYPACKAGE_a_LIBRARY} + ${MYPACKAGE_b_LIBRARIES}) + set(MYPACKAGE_a_INCLUDE_DIRS + ${MYPACKAGE_a_INCLUDE_DIR} + ${MYPACKAGE_b_INCLUDE_DIRS}) + set(MYPACKAGE_a_LINKER_FLAGS ${MYPACKAGE_b_LINKER_FLAGS}) + + set(MYPACKAGE_LIBRARIES ${MYPACKAGE_LIBRARY} ${MYPACKAGE_a_LIBRARIES}) + set(MYPACKAGE_INCLUDE_DIRS + ${MYPACKAGE_INCLUDE_DIR} + ${MYPACKAGE_a_INCLUDE_DIRS}) + set(MYPACKAGE_LINKER_FLAGS ${MYPACKAGE_a_LINKER_FLAGS}) + +endif() + +mark_as_advanced(MYPACKAGE_LIBRARY + MYPACKAGE_INCLUDE_DIR + MYPACKAGE_a_LIBRARY + MYPACKAGE_a_INCLUDE_DIR + MYPACKAGE_b_LIBRARY + MYPACKAGE_b_INCLUDE_DIR + MYPACKAGE_c_LIBRARY + MYPACKAGE_c_INCLUDE_DIR) + +if(MYPACKAGE_FOUND) + mark_as_advanced(MYPACKAGE_ROOT) +endif() + +# End of Example-FindMyPackage.cmake diff --git a/lib/wiiuse/cmake/module-docs/Example-FindMySimplePackage.cmake b/lib/wiiuse/cmake/module-docs/Example-FindMySimplePackage.cmake new file mode 100644 index 000000000..678b8684e --- /dev/null +++ b/lib/wiiuse/cmake/module-docs/Example-FindMySimplePackage.cmake @@ -0,0 +1,101 @@ +# - try to find MySimplePackage library +# +# Example-MySimplePackage.cmake +# +# This example is for a pretty simple library but that is still fairly +# common in its complexity. +# +# Cache Variables: (probably not for direct use in your scripts) +# MYSIMPLEPACKAGE_INCLUDE_DIR +# MYSIMPLEPACKAGE_LIBRARY +# +# Non-cache variables you might use in your CMakeLists.txt: +# MYSIMPLEPACKAGE_FOUND +# MYSIMPLEPACKAGE_INCLUDE_DIRS +# MYSIMPLEPACKAGE_LIBRARIES +# MYSIMPLEPACKAGE_RUNTIME_LIBRARIES - aka the dll for installing +# MYSIMPLEPACKAGE_RUNTIME_LIBRARY_DIRS +# +# 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) + +set(MYSIMPLEPACKAGE_ROOT_DIR + "${MYSIMPLEPACKAGE_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(MYSIMPLEPACKAGE_LIBRARY + NAMES + mysimplepackage + PATHS + "${MYSIMPLEPACKAGE_ROOT_DIR}" + PATH_SUFFIXES + "${_LIBSUFFIXES}") + +# Might want to look close to the library first for the includes. +get_filename_component(_libdir "${MYSIMPLEPACKAGE_LIBRARY}" PATH) + +find_path(MYSIMPLEPACKAGE_INCLUDE_DIR + NAMES + mysimplepackage.h + HINTS + "${_libdir}" # the library I based this on was sometimes bundled right next to its include + "${_libdir}/.." + PATHS + "${MYSIMPLEPACKAGE_ROOT_DIR}" + PATH_SUFFIXES + include/) + +# There's a DLL to distribute on Windows - find where it is. +set(_deps_check) +if(WIN32) + find_file(MYSIMPLEPACKAGE_RUNTIME_LIBRARY + NAMES + mysimplepackage.dll + HINTS + "${_libdir}") + set(MYSIMPLEPACKAGE_RUNTIME_LIBRARIES + "${MYSIMPLEPACKAGE_RUNTIME_LIBRARY}") + get_filename_component(MYSIMPLEPACKAGE_RUNTIME_LIBRARY_DIRS + "${MYSIMPLEPACKAGE_RUNTIME_LIBRARY}" + PATH) + list(APPEND _deps_check MYSIMPLEPACKAGE_RUNTIME_LIBRARY) +else() + get_filename_component(MYSIMPLEPACKAGE_RUNTIME_LIBRARY_DIRS + "${MYSIMPLEPACKAGE_LIBRARY}" + PATH) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(MySimplePackage + DEFAULT_MSG + MYSIMPLEPACKAGE_LIBRARY + MYSIMPLEPACKAGE_INCLUDE_DIR + ${_deps_check}) + +if(MYSIMPLEPACKAGE_FOUND) + set(MYSIMPLEPACKAGE_LIBRARIES "${MYSIMPLEPACKAGE_LIBRARY}") + set(MYSIMPLEPACKAGE_INCLUDE_DIRS "${MYSIMPLEPACKAGE_INCLUDE_DIR}") + mark_as_advanced(MYSIMPLEPACKAGE_ROOT_DIR) +endif() + +mark_as_advanced(MYSIMPLEPACKAGE_INCLUDE_DIR + MYSIMPLEPACKAGE_LIBRARY + MYSIMPLEPACKAGE_RUNTIME_LIBRARY) diff --git a/lib/wiiuse/cmake/module-help.html b/lib/wiiuse/cmake/module-help.html new file mode 100644 index 000000000..e051192bd --- /dev/null +++ b/lib/wiiuse/cmake/module-help.html @@ -0,0 +1,1818 @@ + + +module-help - cmake +

Master Index CMake 2.8.11.1

+ +

Introduction

+

module-help - Reference of available CMake custom modules.

+ +

Description

+

The "cmake" executable is the CMake command-line interface. It may be used to configure projects in scripts. Project configuration settings may be specified on the command line with the -D option. The -i option will cause cmake to interactively prompt for such settings.

+ +

CMake is a cross-platform build system generator. Projects specify their build process with platform-independent CMake listfiles included in each directory of a source tree with the name CMakeLists.txt. Users build a project by using CMake to generate a build system for a native tool on their platform.

+ +

Custom CMake Modules

+ +

The following modules are also available for CMake. They can be used with INCLUDE(ModuleName).

+ +
  Custom CMake Modules - Additional Modules for CMake.
+ +

This is the documentation for additional modules and scripts for CMake. Using these modules you can check the computer system for installed software packages, features of the compiler and the existance of headers to name just a few.

+ +
    +
  • + AboutTheseModules: Dummy module containing information about these modules for the HELP file
    +

    This file documents a snapshot of the cmake-modules available from http://github.com/rpavlik/cmake-modules/ The latest version of these modules can always be found there. Additionally, you can find instructions on how to integrate these modules into your own project either in the README.markdown file in this directory, or on the GitHub page listed above (scroll to the bottom to see the README rendered attractively).

    +

    In short: Modules of the form "FindSomeName.cmake" are considered to be "find modules", and are intended to be used indirectly by calling find_package, not by calling include. Thus, you'll want to do something like:

    +
      find_package(SomeName)
    +

    They define a number of variables allowing you to use whatever software they search for, such as include directories and libraries. A few also define some functions for your use.

    +

    All other modules provide functionality, either immediately upon including them, or by defining functions that perform some task of varying utility that you can use any time after including them. Note that if a module has the filename, for example, cmake/BoostTestTargets.cmake, you only need to call:

    +
      include(BoostTestTargets)
    +


    +

    For more information, see the documentation for individual modules, the cmake-modules github page, and/or the upstream CMake documentation at http://www.cmake.org/cmake/help/cmake-2-8-docs.html

    +


    +

    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)

    + +
  • +
  • + BoostTestTargets: Add tests using boost::test
    +


    +

    Add this line to your test files in place of including a basic boost test header:

    +
      #include <BoostTestTargetConfig.h>
    +


    +

    If you cannot do that and must use the included form for a given test, include the line

    +
      // OVERRIDE_BOOST_TEST_INCLUDED_WARNING
    +

    in the same file with the boost test include.

    +
      include(BoostTestTargets)
    add_boost_test(<testdriver_name> SOURCES <source1> [<more sources...>]
    [FAIL_REGULAR_EXPRESSION <additional fail regex>]
    [LAUNCHER <generic launcher script>]
    [LIBRARIES <library> [<library>...]]
    [RESOURCES <resource> [<resource>...]]
    [TESTS <testcasename> [<testcasename>...]])
    +


    +
      If for some reason you need access to the executable target created,
    it can be found in ${${testdriver_name}_TARGET_NAME} as specified when
    you called add_boost_test
    +


    +

    Requires CMake 2.6 or newer (uses the 'function' command)

    +

    Requires: GetForceIncludeDefinitions CopyResourcesToBuildTree

    +

    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)

    + +
  • +
  • + BundleOSGPlugins: Provide access to the OpenSceneGraph runtime files for bundling in
    +

    an installation or package.

    +

    Sets these variables:

    +
      - OSGDB_PLUGINS_RELEASE
    - OSGDB_PLUGINS_DEBUG
    - OSGWRAPPER_PLUGINS_RELEASE
    - OSGWRAPPER_PLUGINS_DEBUG
    - OSG_RUNTIME_LIBRARY_DIR
    - OSG_PATH_TO_PLUGINS
    +


    +

    Creates this function:

    +
      - install_osg_plugins( {varNameForOutputFilenames} )
    +


    +

    Requires these CMake modules:

    +
      no additional modules required
    +


    +

    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)

    + +
  • +
  • + BundleOSGRuntime: Include the OpenSceneGraph runtime files in an installation or built package.
    +


    +
      OSGRUNTIME_BUNDLE - Set to "yes" to enable this behavior
    OSGRUNTIME_zlib1dll - Must be set to the location of zlib1.dll on Windows
    OSGRUNTIME_zlib1ddll - Can be set to the location of zlib1d.dll (debug) on Windows.
    If set, will be installed.
    +


    +

    Requires these CMake modules:

    +
      no additional modules required
    +


    +

    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)

    + +
  • +
  • + BundleVRJ22Runtime: Include the VR Juggler runtime files in an installation or built package.
    +


    +
      VRJUGGLERRUNTIME_BUNDLE
    VRJUGGLERRUNTIME_BUNDLE_DEBUG - set to yes to include debug dll's as well
    +


    +

    Requires these CMake modules:

    +
      FindVRJuggler22 and its dependencies
    +


    +

    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)

    + +
  • +
  • + BundleVRJ30Runtime: Include the VR Juggler runtime files in an installation or built package.
    +


    +
      VRJUGGLERRUNTIME_BUNDLE
    VRJUGGLERRUNTIME_BUNDLE_DEBUG - set to yes to include debug dll's as well
    +


    +

    Requires these CMake modules:

    +
      FindVRJuggler22 and its dependencies
    +


    +

    Original Author: 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net> http://academic.cleardefinition.com Iowa State University HCI Graduate Program/VRAC Updated for VR Juggler 3.0 by: Brandon Newendorp <brandon@newendorp.com>

    + +
  • +
  • + CheckMacHIDAPI: Script to check if the signature for a mac HID callback uses UInt32 or uint32_t
    +

    Requires that the associated CPP file be present: CheckMacHIDAPI.cpp.

    +

    MACOSX_HID_UINT32T, set according to the results of our test.

    +

    Use add_definitions(-DMACOSX_HID_UINT32T=${MACOSX_HID_UINT32T}) in your listfile and the following prototype for the function you'd like to register using setInterruptReportHandlerCallback:

    +
      void ReaderReportCallback(
    void *target,
    IOReturn result,
    void *refcon,
    void *sender,
    MACOSX_HID_UINT32T size
    )
    +


    +

    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)

    + +
  • +
  • + CheckVersion: Utility function for Find modules considering multiple possible versions
    +


    +

    Requires these CMake modules:

    +
      no additional modules required
    +


    +

    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)

    + +
  • +
  • + CleanDirectoryList: Removes duplicate entries and non-directories from a provided list
    +


    +
      clean_directory_list(<listvar> [<additional list items>...])
    +


    +

    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)

    + +
  • +
  • + CleanLibraryList: A smarter replacement for list(REMOVE_DUPLICATES) for library lists
    +


    +

    Note that, in the case of cyclic link dependencies, you _do_ actually need a library in a list multiple times. So, only use this function when you know that the dependency graph is acyclic.

    +
      clean_library_list(<listvar> [<additional list items>...]) - where
    listvar is the name of a destination variable, and also possibly a source, and
    it is followed by any number (including 0) of additional libraries to append
    to the list before processing.
    +


    +

    Removes duplicates from the list, leaving only the last instance, while preserving the meaning of the "optimized", "debug", and "general" labeling. (Libraries listed as general are listed in the result instead as optimized and debug)

    +

    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)

    + +
  • +
  • + CopyResourcesToBuildTree: Copy the resources your app needs to the build tree.
    +


    +
      copy_resources_to_build_tree(<target_name>)
    +


    +

    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)

    + +
  • +
  • + CppcheckTargets: Run cppcheck on c++ source files as a custom target and a test
    +


    +
      include(CppcheckTargets)
    add_cppcheck(<target-name> [UNUSED_FUNCTIONS] [STYLE] [POSSIBLE_ERROR] [FAIL_ON_WARNINGS]) -
    Create a target to check a target's sources with cppcheck and the indicated options
    add_cppcheck_sources(<target-name> [UNUSED_FUNCTIONS] [STYLE] [POSSIBLE_ERROR] [FAIL_ON_WARNINGS]) -
    Create a target to check standalone sources with cppcheck and the indicated options
    +


    +

    Requires these CMake modules:

    +
      Findcppcheck
    +


    +

    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)

    + +
  • +
  • + CreateDashboardScripts: Create ctest -S scripts to use to run dashboard builds
    +


    +
      include(CreateDashboardScripts)
    create_dashboard_scripts([<initialcachetemplatefilename>])
    +


    +

    If you need additional settings to persist from the "parent" CMake instance to the initial cache created by the dashboard script, you may pass a filename which will be configured into the initial cache.

    +

    In the resulting DASHBOARDSCRIPT_BASE_DIRECTORY, an end-user may optionally create a file named

    +
      CustomInitialCache.${DASHBOARDSCRIPT_SCRIPT_NAME}
    +

    (by default, CustomInitialCache.go.cmake) containing set commands that use the CACHE option, to set up additional site-local cache variable values.

    +

    Requires these CMake modules:

    +
      GetCompilerInfoString
    +


    +

    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)

    + +
  • +
  • + CreateImportedTarget: A smarter replacement for list(REMOVE_DUPLICATES) for library lists
    +


    +
      create_imported_target(<libname> [SHARED|STATIC|MODULE] [<library dependency>...]) - where
    ${libname}_LIBRARIES is set to this library's paths.
    +


    +

    Removes duplicates from the list then sorts while preserving "optimized", "debug", and "general" labeling

    +

    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)

    + +
  • +
  • + CreateLaunchers: Create launchers to set working directory, env. vars, etc.
    +


    +
      include(CreateLaunchers) - to make these available
    guess_runtime_library_dirs(<outputvarname> [<extralibrary> ...])
    create_default_target_launcher(<targetname>
    [ARGS <args...>]
    [FORWARD_ARGS]
    [RUNTIME_LIBRARY_DIRS <dir...>]
    [WORKING_DIRECTORY <dir>]
    [ENVIRONMENT <VAR=value> [<VAR=value>...]])
    +


    +
      create_target_launcher(<targetname>
    [ARGS <args...>]
    [FORWARD_ARGS]
    [RUNTIME_LIBRARY_DIRS <dir...>]
    [WORKING_DIRECTORY <dir>]
    [ENVIRONMENT <VAR=value> [<VAR=value>...]])
    +


    +
      create_generic_launcher(<launchername>
    [RUNTIME_LIBRARY_DIRS <dir...>]
    [WORKING_DIRECTORY <dir>]
    [ENVIRONMENT <VAR=value> [<VAR=value>...]])
    - sets GENERIC_LAUNCHER_COMMAND and GENERIC_LAUNCHER_FAIL_REGULAR_EXPRESSION
    +


    +

    Requires these CMake modules:

    +
      ListFilter
    ProgramFilesGlob
    CleanDirectoryList
    +


    +

    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)

    + +
  • +
  • + DoxygenTargets: Run doxygen on source files as a custom target
    +


    +
      include(DoxygenTargets)
    add_doxygen(<doxyfile> [OUTPUT_DIRECTORY <outputdir>]
    [INSTALL_DESTINATION <installdir>
    [INSTALL_COMPONENT <installcomponent>]
    [INSTALL_PDF_NAME <installpdfname>] ]
    [DOC_TARGET <targetname>]
    [PROJECT_NUMBER <versionnumber>]
    [NO_WARNINGS]
    [NO_PDF])
    +


    +

    Requires these CMake modules:

    +
      FindDoxygen
    +


    +

    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)

    + +
  • +
  • + EnableExtraCompilerWarnings: Add flags to compile with extra warnings
    +


    +
      enable_extra_compiler_warnings(<targetname>)
    globally_enable_extra_compiler_warnings() - to modify CMAKE_CXX_FLAGS, etc
    to change for all targets declared after the command, instead of per-command
    +


    +


    +

    Original Author: 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)

    + +
  • +
  • + EnableProfiling: Add flags to compile with profiling support - currently only for GCC
    +


    +
      enable_profiling(<targetname>)
    globally_enable_profiling() - to modify CMAKE_CXX_FLAGS, etc
    to change for all targets declared after the command, instead of per-command
    +


    +


    +

    Original Author: 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)

    + +
  • +
  • + FileCopyTargets: Add a target for files that just need to be copied
    +


    +
      include(FileCopyTargets)
    add_file_copy_target(<target_name> <directory to copy to> <filename> [<filename>...])
    Creates a custom target that copies the files to a directory, if needed.
    Relative paths for the destination directory are considered with
    with respect to CMAKE_CURRENT_BINARY_DIR
    You can use this target in all the usual ways, including
    add_dependencies(some_other_target this_target) to specify that another
    target depends on this.
    +


    +
      install_file_copy_target(<target_name> [arguments to INSTALL(PROGRAMS ...) ])
    Works just the same as INSTALL(PROGRAMS ...) because it wraps it to install
    the files you specified in add_file_copy_target
    +


    +


    +

    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)

    + +
  • +
  • + FindALUT: try to find the OpenAL ALUT library
    +


    +

    Users may optionally supply:

    +
      ALUT_ROOT_DIR - a prefix to start searching.
    +


    +

    Cache Variables: (probably not for direct use in your scripts)

    +
      ALUT_INCLUDE_DIR
    ALUT_LIBRARY
    +


    +

    Non-cache variables you might use in your CMakeLists.txt:

    +
      ALUT_FOUND
    ALUT_INCLUDE_DIRS
    ALUT_LIBRARIES
    ALUT_WORKAROUND_INCLUDE_DIRS - add these to your include path with
    include_directories(${ALUT_WORKAROUND_INCLUDE_DIRS} ${ALUT_INCLUDE_DIRS})
    so you can always #include <AL/al.h> and #include <AL/alut.h> even on
    Mac where the paths might differ.
    +


    +

    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)

    + +
  • +
  • + FindAdrienne: try to find Adrienne Electronics Corporation timecode card library
    +


    +

    SDK available from the manufacturer: http://www.adrielec.com/

    +

    Cache Variables: (probably not for direct use in your scripts)

    +
      ADRIENNE_INCLUDE_DIR
    ADRIENNE_LIBRARY
    ADRIENNE_RUNTIME_LIBRARY
    ADRIENNE_INCLUDE_FILE
    +


    +

    Variables you might use in your CMakeLists.txt:

    +
      ADRIENNE_FOUND
    ADRIENNE_INCLUDE_DIRS
    ADRIENNE_LIBRARIES
    ADRIENNE_RUNTIME_LIBRARIES - the AEC_NTTC.dll file
    ADRIENNE_RUNTIME_LIBRARY_DIRS
    +


    +
      ADRIENNE_INCLUDE_FILENAME - this is probably AEC_NTTC.h, but it might also
    be AECINTTC.H.
    +


    +
      ADRIENNE_INCLUDE_HAS_EXTERN_C - Some (most) versions of the header already
    wrap their definitions in extern "C" { }, but some do not.
    +


    +
      ADRIENNE_DEFINITIONS - defines a quoted ADRIENNE_INCLUDE_FILENAME as above,
    so you can write a line like #include ADRIENNE_INCLUDE_FILENAME
    Also defines ADRIENNE_BEFORE_INCLUDE and ADRIENNE_AFTER_INCLUDE to handle
    adding extern "C" { and } if the header file doesn't do so itself.
    +


    +

    Variables that might be set by the user in the gui/command line to help find the library:

    +
      ADRIENNE_ROOT_DIR - root of an Adrienne CD, disk, or extracted/copied contents
    thereof.
    +


    +

    Requires these CMake modules:

    +
      FindPackageHandleStandardArgs (known included with CMake >=2.6.2)
    +


    +

    Original Author: 2012 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net> http://academic.cleardefinition.com Iowa State University HCI Graduate Program/VRAC

    +

    Copyright Iowa State University 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)

    + +
  • +
  • + FindBluez: 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)

    + +
  • +
  • + FindCPPDOM: try to find CPPDOM library
    +

    Optionally uses Flagpoll and FindFlagpoll.cmake

    +
      CPPDOM_LIBRARY_DIR, library search path
    CPPDOM_INCLUDE_DIR, include search path
    CPPDOM_LIBRARY, the library to link against
    CPPDOM_CXX_FLAGS
    CPPDOM_FOUND, If false, do not try to use this library.
    +


    +

    Useful configuration variables you might want to add to your cache:

    +
      CPPDOM_ROOT_DIR - A directory prefix to search
    (a path that contains include/ as a subdirectory)
    CPPDOM_ADDITIONAL_VERSIONS - Additional versions (outside of 0.7.8 to 1.2.0)
    to use when constructing search names and paths
    +


    +

    This script will use Flagpoll, if found, to provide hints to the location of this library, but does not use the compiler flags returned by Flagpoll directly.

    +

    VR Juggler requires this package, so this Find script takes that into account when determining where to search for the desired files. The VJ_BASE_DIR environment variable is searched (preferentially) when searching for this package, so most sane VR Juggler build environments should "just work." Note that you need to manually re-run CMake if you change this environment variable, because it cannot auto-detect this change and trigger an automatic re-run.

    +

    Original Author: 2009-2012 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net> 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)

    + +
  • +
  • + FindDCubed: try to find DCUBED library
    +


    +
      DCUBED_LIBRARY_DIR, library search path
    DCUBED_INCLUDE_DIR, include search path
    DCUBED_{component}_LIBRARY, the library to link against
    DCUBED_ENVIRONMENT
    DCUBED_FOUND, If false, do not try to use this library.
    +


    +

    Plural versions refer to this library and its dependencies, and are recommended to be used instead, unless you have a good reason.

    +

    Useful configuration variables you might want to add to your cache:

    +
      DCUBED_ROOT_DIR - A directory prefix to search
    (a path that contains include/ as a subdirectory)
    +


    +

    2009-2010 Ryan Pavlik <rpavlik@iastate.edu> 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)

    + +
  • +
  • + FindDirectInput: try to find DirectInput library (part of DirectX SDK)
    +


    +

    Cache Variables: (probably not for direct use in your scripts)

    +
      DIRECTINPUT_DXGUID_LIBRARY
    DIRECTINPUT_DXERR_LIBRARY
    DIRECTINPUT_DINPUT_LIBRARY
    DIRECTINPUT_INCLUDE_DIR
    +


    +

    Non-cache variables you should use in your CMakeLists.txt:

    +
      DIRECTINPUT_LIBRARIES
    DIRECTINPUT_INCLUDE_DIRS
    DIRECTINPUT_FOUND - if this is not true, do not attempt to use this library
    +


    +

    Requires these CMake modules:

    +
      FindPackageHandleStandardArgs (known included with CMake >=2.6.2)
    +


    +

    Original Author: 2011 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net> http://academic.cleardefinition.com Iowa State University HCI Graduate Program/VRAC

    +

    Copyright Iowa State University 2011. 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)

    + +
  • +
  • + FindDirectShow: Find Microsoft DirectShow sample files, library, and headers.
    +


    +
      DIRECTSHOW_INCLUDE_DIRS - where to find needed include file
    DIRECTSHOW_BASECLASS_DIR- Directory containing the DirectShow baseclass sample code.
    DIRECTSHOW_FOUND - True if DirectShow found.
    +


    +

    Requires these CMake modules:

    +
      FindPackageHandleStandardArgs (known included with CMake >=2.6.2)
    +


    +

    Initially in VRPN - Distributed under the Boost Software License, Version 1.0.

    +

    Almost entirely re-written by: 2012 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net> http://academic.cleardefinition.com Iowa State University HCI Graduate Program/VRAC

    +

    Copyright Iowa State University 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)

    + +
  • +
  • + FindDirectX: try to find part of DirectX SDK
    +


    +

    Cache Variables: (probably not for direct use in your scripts)

    +
      DIRECTX_INCLUDE_DIR
    +


    +

    Variables you should use in your CMakeLists.txt:

    +
      DIRECTX_DXGUID_LIBRARY
    DIRECTX_DXERR_LIBRARY
    DIRECTX_DINPUT_LIBRARY
    DIRECTX_DINPUT_INCLUDE_DIR
    DIRECTX_D3D9_LIBRARY
    DIRECTX_D3DXOF_LIBRARY
    DIRECTX_D3DX9_LIBRARIES
    DIRECTX_INCLUDE_DIRS
    DIRECTX_FOUND - if this is not true, do not attempt to use this library
    +


    +

    Requires these CMake modules:

    +
      FindPackageHandleStandardArgs (known included with CMake >=2.6.2)
    SelectLibraryConfigurations
    +


    +

    Original Author: 2012 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net> http://academic.cleardefinition.com Iowa State University HCI Graduate Program/VRAC

    +

    Copyright Iowa State University 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)

    + +
  • +
  • + FindFlagpoll: try to find Flagpoll application, and offer package-finding services
    +
      FLAGPOLL, the executable: if not defined, do not try to use Flagpoll.
    +


    +

    Useful configuration variables you might want to add to your cache:

    +
      FLAGPOLL_ROOT_DIR  - A directory prefix to search for the app
    (a path that contains bin/ as a subdirectory)
    +


    +

    VR Juggler requires this package, so this Find script takes that into account when determining where to search for the desired files. The VJ_BASE_DIR environment variable is searched (preferentially) when searching for this package, so most sane VR Juggler build environments should "just work." Note that you need to manually re-run CMake if you change this environment variable, because it cannot auto-detect this change and trigger an automatic re-run.

    +

    You can use Flagpoll to provide directories to use as HINTS for find_* These are the provided macros:

    +
      flagpoll_get_include_dirs
    flagpoll_get_library_dirs
    flagpoll_get_library_names
    flagpoll_get_extra_libs
    +

    All take the name of the desired package, optionally NO_DEPS to pass --no-deps to Flagpoll, and return yourpkgname_FLAGPOLL_INCLUDE_DIRS(etc. for the other macros).

    +

    Example usage: flagpoll_get_include_dirs(vpr NO_DEPS) find_path(VPR20_INCLUDE_DIRS vpr/vpr.h

    +
       	  HINTS  ${vpr_FLAGPOLL_INCLUDE_DIRS})
    +


    +

    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)

    + +
  • +
  • + FindGDB: Try to find GDB
    +


    +

    Once done, this will define:

    +
      GDB_FOUND - system has GDB
    GDB_COMMAND - the command to run
    GDB_VERSION - version
    GDB_HAS_RETURN_CHILD_RESULT - if the --return-child-result flag is supported
    +


    +

    Useful configuration variables you might want to add to your cache:

    +
      GDB_ROOT_DIR - A directory prefix to search
    +


    +

    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)

    + +
  • +
  • + FindGHOST: try to find Sensable GHOST library and include files
    +
      GHOST_INCLUDE_DIRS, where to find GL/glut.h, etc.
    GHOST_LIBRARIES, the libraries to link against
    GHOST_FOUND, If false, do not try to use GLUT.
    GHOST_RUNTIME_LIBRARY_DIRS, path to DLL on Windows for runtime use.
    +


    +

    Requires these CMake modules:

    +
      no additional modules required
    +


    +

    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)

    + +
  • +
  • + FindGLUI: Try to find GLUI (GL User Interface)
    +

    Requires OpenGL and GLUT - searches for them using find_package Once done, this will define

    +

    GLUI_INCLUDE_DIR, where to find GL/glui.h (or GLUI/glui.h on mac) GLUI_LIBRARY, the libraries to link against GLUI_FOUND, If false, do not try to use GLUI.

    +

    Plural versions refer to this library and its dependencies, and are recommended to be used instead, unless you have a good reason.

    +

    Useful configuration variables you might want to add to your cache:

    +
       GLUI_ROOT_DIR - A directory prefix to search
    (usually a path that contains include/ as a subdirectory)
    +


    +

    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)

    + +
  • +
  • + FindGLUT: try to find glut library and include files
    +
      GLUT_INCLUDE_DIRS, where to find GL/glut.h, etc.
    GLUT_LIBRARIES, the libraries to link against
    GLUT_FOUND, If false, do not try to use GLUT.
    GLUT_RUNTIME_LIBRARY_DIRS, path to DLL on Windows for runtime use.
    GLUT_RUNTIME_LIBRARY, dll on Windows, for installation purposes
    +


    +

    Also defined, but not for general use are:

    +
      GLUT_INCLUDE_DIR, where to find GL/glut.h, etc.
    GLUT_glut_LIBRARY = the full path to the glut library.
    + +
  • +
  • + FindGMTL: Try to find GMTL
    +

    Optionally uses Flagpoll and FindFlagpoll.cmake Once done, this will define

    +
      GMTL_FOUND - system has GMTL
    GMTL_INCLUDE_DIR - the GMTL include directory
    +


    +

    Useful configuration variables you might want to add to your cache:

    +
      GMTL_ROOT_DIR - A directory prefix to search
    (a path that contains include/ as a subdirectory)
    GMTL_ADDITIONAL_VERSIONS - Additional versions (outside of 0.5.1 to 0.7.0)
    to use when constructing search names and paths
    +


    +

    This script will use Flagpoll, if found, to provide hints to the location of this library, but does not use the compiler flags returned by Flagpoll directly.

    +

    VR Juggler requires this package, so this Find script takes that into account when determining where to search for the desired files. The VJ_BASE_DIR environment variable is searched (preferentially) when searching for this package, so most sane VR Juggler build environments should "just work." Note that you need to manually re-run CMake if you change this environment variable, because it cannot auto-detect this change and trigger an automatic re-run.

    +

    Original Author: 2009-2012 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net> 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)

    + +
  • +
  • + FindGPM: try to find GPM library
    +


    +

    Cache Variables: (probably not for direct use in your scripts)

    +
      GPM_INCLUDE_DIR
    GPM_LIBRARY
    +


    +

    Non-cache variables you might use in your CMakeLists.txt:

    +
      GPM_FOUND
    GPM_INCLUDE_DIRS
    GPM_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)

    + +
  • +
  • + FindGadgeteer12: try to find Gadgeteer 1.2 library
    +

    Requires JCCL 1.2 and VPR 2.0 (thus FindJCCL12.cmake and FindVPR20.cmake) Requires X11 if not on Mac or Windows. Optionally uses Flagpoll and FindFlagpoll.cmake

    +

    This library is a part of VR Juggler 2.2 - you probably want to use find_package(VRJuggler22) instead, for an easy interface to this and related scripts. See FindVRJuggler22.cmake for more information.

    +
      GADGETEER12_LIBRARY_DIR, library search path
    GADGETEER12_INCLUDE_DIR, include search path
    GADGETEER12_LIBRARY, the library to link against
    GADGETEER12_FOUND, If false, do not try to use this library.
    +


    +

    Plural versions refer to this library and its dependencies, and are recommended to be used instead, unless you have a good reason.

    +

    Useful configuration variables you might want to add to your cache:

    +
      GADGETEER12_ROOT_DIR - A directory prefix to search
    (a path that contains include/ as a subdirectory)
    +


    +

    This script will use Flagpoll, if found, to provide hints to the location of this library, but does not use the compiler flags returned by Flagpoll directly.

    +

    The VJ_BASE_DIR environment variable is also searched (preferentially) when searching for this component, so most sane build environments should "just work." Note that you need to manually re-run CMake if you change this environment variable, because it cannot auto-detect this change and trigger an automatic re-run.

    +

    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)

    + +
  • +
  • + FindGadgeteer20: try to find Gadgeteer 2.0 library
    +

    Requires JCCL 1.4 and VPR 2.2 (thus FindJCCL14.cmake and FindVPR22.cmake) Requires X11 if not on Mac or Windows. Optionally uses Flagpoll and FindFlagpoll.cmake

    +

    This library is a part of VR Juggler 3.0 - you probably want to use find_package(VRJuggler30) instead, for an easy interface to this and related scripts. See FindVRJuggler30.cmake for more information.

    +
      GADGETEER20_LIBRARY_DIR, library search path
    GADGETEER20_INCLUDE_DIR, include search path
    GADGETEER20_LIBRARY, the library to link against
    GADGETEER20_FOUND, If false, do not try to use this library.
    +


    +

    Plural versions refer to this library and its dependencies, and are recommended to be used instead, unless you have a good reason.

    +

    Useful configuration variables you might want to add to your cache:

    +
      GADGETEER20_ROOT_DIR - A directory prefix to search
    (a path that contains include/ as a subdirectory)
    +


    +

    This script will use Flagpoll, if found, to provide hints to the location of this library, but does not use the compiler flags returned by Flagpoll directly.

    +

    The VJ_BASE_DIR environment variable is also searched (preferentially) when searching for this component, so most sane build environments should "just work." Note that you need to manually re-run CMake if you change this environment variable, because it cannot auto-detect this change and trigger an automatic re-run.

    +

    Original Author: 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net> http://academic.cleardefinition.com Iowa State University HCI Graduate Program/VRAC Updated for VR Juggler 3.0 by: Brandon Newendorp <brandon@newendorp.com>

    + +
  • +
  • + FindGlove5DT: try to find Glove5DT libraries
    +


    +

    Cache Variables: (probably not for direct use in your scripts)

    +
      GLOVE5DT_INCLUDE_DIR
    GLOVE5DT_LIBRARY
    GLOVE5DT_LIBRARY_RELEASE
    GLOVE5DT_LIBRARY_DEBUG
    GLOVE5DT_RUNTIME_LIBRARY_RELEASE
    GLOVE5DT_RUNTIME_LIBRARY_DEBUG
    +


    +

    Non-cache variables you might use in your CMakeLists.txt:

    +
      GLOVE5DT_FOUND
    GLOVE5DT_INCLUDE_DIRS
    GLOVE5DT_LIBRARIES
    GLOVE5DT_RUNTIME_LIBRARY_DIRS
    +


    +

    Requires these CMake modules:

    +
      CleanDirectoryList
    CleanLibraryList
    ListCombinations
    ProgramFilesGlob
    SelectLibraryConfigurations (included with CMake >=2.8.0)
    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)

    + +
  • +
  • + FindHIDAPI: try to find HIDAPI library
    +

    from http://www.signal11.us/oss/hidapi/

    +

    Cache Variables: (probably not for direct use in your scripts)

    +
      HIDAPI_INCLUDE_DIR
    HIDAPI_LIBRARY
    +


    +

    Non-cache variables you might use in your CMakeLists.txt:

    +
      HIDAPI_FOUND
    HIDAPI_INCLUDE_DIRS
    HIDAPI_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)

    + +
  • +
  • + FindIDLJ: try to find Java's IDLJ Interface Definition Language compiler.
    +


    +

    Ideally used with CMake 2.8.5 or newer for Java support using FindJava.cmake and UseJava.cmake

    +

    Variables:

    +
      Java_IDLJ_COMMAND, executable for idlj
    IDLJ_FOUND, If false, do not try to use this
    +


    +

    Function:

    +
      java_idlj(varname idlfile [extra idlj args]) - Generates
    the Java source files from the IDL file you indicate, and
    appends filenames suitable to add to a add_jar() call to the
    variable you specified.
    +


    +

    Because the files generated from an IDL file are not entirely predictable, java_idlj runs idlj in the cmake step, rather than the build step, and triggers a CMake re-run when an idl file is modified. Already up-to-date generated source is not re-generated, however.

    +

    Files are generated in a directory created specifically for the particular IDL file and the particular call, in the build directory - there should be no worries about overwriting files or picking up too much with the wildcard.

    +

    You may wish to add the IDL file to your list of sources if you want it to appear in your IDE, but it is not necessary.

    +

    Original Author: 2012 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net> http://academic.cleardefinition.com Iowa State University HCI Graduate Program/VRAC

    +

    Copyright Iowa State University 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)

    + +
  • +
  • + FindInterSense: try to find InterSense library
    +


    +

    Cache Variables: (probably not for direct use in your scripts)

    +
      INTERSENSE_INCLUDE_DIR
    INTERSENSE_ISENSEC_DIR - location of the isense.c "import library" substitute.
    INTERSENSE_LIBRARY
    +


    +

    Non-cache variables you might use in your CMakeLists.txt:

    +
      INTERSENSE_FOUND
    INTERSENSE_INCLUDE_DIRS
    INTERSENSE_LIBRARIES
    +


    +

    Requires these CMake modules:

    +
      FindPackageHandleStandardArgs (known included with CMake >=2.6.2)
    +


    +

    Author: 2013 Eric Marsh <bits@wemarsh.com> http://wemarsh.com/ Kognitiv Neuroinformatik, Universität Bremen

    +

    (building on Ryan Pavlik's templates)

    +

    2013 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net> http://academic.cleardefinition.com Iowa State University HCI Graduate Program/VRAC

    +

    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)

    + +
  • +
  • + FindJCCL12: try to find JCCL 1.2 library
    +

    Requires VPR 2.0 (thus FindVPR20.cmake) Optionally uses Flagpoll and FindFlagpoll.cmake

    +

    This library is a part of VR Juggler 2.2 - you probably want to use find_package(VRJuggler22) instead, for an easy interface to this and related scripts. See FindVRJuggler22.cmake for more information.

    +
      JCCL12_LIBRARY_DIR, library search path
    JCCL12_INCLUDE_DIR, include search path
    JCCL12_LIBRARY, the library to link against
    JCCL12_FOUND, If false, do not try to use this library.
    +


    +

    Plural versions refer to this library and its dependencies, and are recommended to be used instead, unless you have a good reason.

    +

    Useful configuration variables you might want to add to your cache:

    +
      JCCL12_ROOT_DIR - A directory prefix to search
    (a path that contains include/ as a subdirectory)
    +


    +

    This script will use Flagpoll, if found, to provide hints to the location of this library, but does not use the compiler flags returned by Flagpoll directly.

    +

    The VJ_BASE_DIR environment variable is also searched (preferentially) when searching for this component, so most sane build environments should "just work." Note that you need to manually re-run CMake if you change this environment variable, because it cannot auto-detect this change and trigger an automatic re-run.

    +

    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)

    + +
  • +
  • + FindJCCL14: try to find JCCL 1.4 library
    +

    Requires VPR 2.2 (thus FindVPR22.cmake) Optionally uses Flagpoll and FindFlagpoll.cmake

    +

    This library is a part of VR Juggler 3.0 - you probably want to use find_package(VRJuggler30) instead, for an easy interface to this and related scripts. See FindVRJuggler30.cmake for more information.

    +
      JCCL14_LIBRARY_DIR, library search path
    JCCL14_INCLUDE_DIR, include search path
    JCCL14_LIBRARY, the library to link against
    JCCL14_FOUND, If false, do not try to use this library.
    +


    +

    Plural versions refer to this library and its dependencies, and are recommended to be used instead, unless you have a good reason.

    +

    Useful configuration variables you might want to add to your cache:

    +
      JCCL14_ROOT_DIR - A directory prefix to search
    (a path that contains include/ as a subdirectory)
    +


    +

    This script will use Flagpoll, if found, to provide hints to the location of this library, but does not use the compiler flags returned by Flagpoll directly.

    +

    The VJ_BASE_DIR environment variable is also searched (preferentially) when searching for this component, so most sane build environments should "just work." Note that you need to manually re-run CMake if you change this environment variable, because it cannot auto-detect this change and trigger an automatic re-run.

    +

    Original Author: 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net> http://academic.cleardefinition.com Iowa State University HCI Graduate Program/VRAC Updated for VR Juggler 3.0 by: Brandon Newendorp <brandon@newendorp.com>

    + +
  • +
  • + FindJtTk: try to find JTTK library
    +


    +
      JTTK_LIBRARY_DIRS, library search path
    JTTK_INCLUDE_DIRS, include search path
    JTTK_{component}_LIBRARY, the library to link against
    JTTK_ENVIRONMENT, environment variables to set
    JTTK_RUNTIME_LIBRARY_DIRS
    JTTK_FOUND, If false, do not try to use this library.
    +


    +

    If you have license issues, you might run this command on each JtTk-using target:

    +
      jttk_stamp_binary(<targetname>)
    +


    +

    Plural versions refer to this library and its dependencies, and are recommended to be used instead, unless you have a good reason.

    +

    Useful configuration variables you might want to add to your cache:

    +
      JTTK_ROOT_DIR - A directory prefix to search
    (a path that contains include/ as a subdirectory)
    +


    +

    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)

    + +
  • +
  • + FindLAPACKLibs: Try to find LAPACK and BLAS libraries
    +

    Once done, this will define

    +
      LAPACKLIBS_LIBRARIES, all libraries to link against
    LAPACKLIBS_FOUND, If false, do not try to use LAPACK library features.
    +


    +

    Users may wish to set:

    +
      LAPACKLIBS_ROOT_DIR, location to start searching for LAPACK libraries
    +


    +

    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)

    + +
  • +
  • + FindLibusb1: try to find libusb-1 library
    +


    +

    Cache Variables: (probably not for direct use in your scripts)

    +
      LIBUSB1_LIBRARY
    LIBUSB1_INCLUDE_DIR
    +


    +

    Non-cache variables you should use in your CMakeLists.txt:

    +
      LIBUSB1_LIBRARIES
    LIBUSB1_INCLUDE_DIRS
    LIBUSB1_FOUND - if this is not true, do not attempt to use this library
    +


    +

    Requires these CMake modules:

    +
      ProgramFilesGlob
    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)

    + +
  • +
  • + FindLuabind: try to find Luabind
    +


    +

    Users may optionally supply:

    +
      LUABIND_ROOT_DIR - a prefix to start searching
    +


    +

    Non-cache variables you might use in your CMakeLists.txt:

    +
      LUABIND_FOUND
    LUABIND_DEFINITIONS
    LUABIND_INCLUDE_DIRS
    LUABIND_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)

    + +
  • +
  • + FindLyX: Try to find LyX, and define some custom commands to export from LyX
    +


    +

    Once done, this will define:

    +
      LYX_FOUND - system has LyX
    LYX_COMMAND - the command to run
    +


    +

    and the following new functions:

    +
      lyx_export(<format> <extension-without-leading-dot> <output-variable>
    INPUT <lyx-file> [...]
    [OUTPUT_TO_SOURCE_DIR]
    [ EXTRA_DEPS <bibtex-or-other-file> [...] ]) - the base function
    +


    +

    These shortcut functions all have the same syntax:

    +
      lyx_export_to_XXX(<output-variable>
    INPUT <lyx-file> [...]
    [OUTPUT_TO_SOURCE_DIR]
    [ EXTRA_DEPS <bibtex-or-other-file> [...] ])
    +


    +

    Available shortcuts:

    +
      lyx_export_to_docbook_xml
    lyx_export_to_docbook
    lyx_export_to_pdf
    lyx_export_to_pdf_via_pdflatex
    lyx_export_to_pdf_via_dvi
    +


    +

    Useful configuration variables you might want to add to your cache:

    +
      LYX_ROOT_DIR - A directory prefix to search
    +


    +

    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)

    + +
  • +
  • + FindMacHID: try to find Mac HID frameworks
    +


    +

    Cache Variables: (probably not for direct use in your scripts)

    +
      MACHID_CoreFoundation_LIBRARY
    MACHID_CoreFoundation_INCLUDE_DIR
    MACHID_IOKit_LIBRARY
    MACHID_IOKit_INCLUDE_DIR
    MACOSX_HID_UINT32T (from CheckMacHIDAPI)
    +


    +

    Non-cache variables you should use in your CMakeLists.txt:

    +
      MACHID_DEFINITIONS
    MACHID_LIBRARIES
    MACHID_INCLUDE_DIRS
    MACHID_FOUND - if this is not true, do not attempt to use this library
    +


    +

    Requires these CMake modules:

    +
      CheckMacHIDAPI
    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)

    + +
  • +
  • + FindMarkdown: try to find Markdown tool
    +


    +

    Cache Variables:

    +
      MARKDOWN_EXECUTABLE
    +


    +

    Non-cache variables you might use in your CMakeLists.txt:

    +
      MARKDOWN_FOUND
    +


    +

    Requires these CMake modules:

    +
      FindPackageHandleStandardArgs (known included with CMake >=2.6.2)
    +


    +

    Original Author: 2011 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net> http://academic.cleardefinition.com Iowa State University HCI Graduate Program/VRAC

    +

    Copyright Iowa State University 2011. 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)

    + +
  • +
  • + FindOpenCV: ------------------------------
    +

    See http://sourceforge.net/projects/opencvlibrary/

    +

    The following variable is optionally searched for defaults

    +
      OPENCV_ROOT_DIR:            Base directory of OpenCv tree to use.
    +


    +
      OPENCV_NEW_LIBRARY_NAMES   Set to YES before searching if you want to
    +

    The following are set after configuration is done:

    +
      OPENCV_FOUND
    OPENCV_INCLUDE_DIRS
    OPENCV_LIBRARIES
    +


    +

    2004/05 Jan Woetzel, Friso, Daniel Grest 2006/01 complete rewrite by Jan Woetzel 2006/09 2nd rewrite introducing ROOT_DIR and PATH_SUFFIXES

    +
       to handle multiple installed versions gracefully by Jan Woetzel
    +

    2010/02 Ryan Pavlik (Iowa State University) - partial rewrite to standardize

    +

    tested with:

    +

    www.mip.informatik.uni-kiel.de/~jw academic.cleardefinition.com

    + +
  • +
  • + FindOpenHaptics: try to find OpenHaptics libraries
    +


    +

    Cache Variables: (probably not for direct use in your scripts)

    +
      HDAPI_INCLUDE_DIR
    HDAPI_LIBRARY
    HDAPI_LIBRARY_RELEASE
    HDAPI_LIBRARY_DEBUG
    HDAPI_HDU_INCLUDE_DIR
    HDAPI_HDU_LIBRARY
    HDAPI_HDU_LIBRARY_RELEASE
    HDAPI_HDU_LIBRARY_DEBUG
    HLAPI_INCLUDE_DIR
    HLAPI_LIBRARY
    HLAPI_LIBRARY_RELEASE
    HLAPI_LIBRARY_DEBUG
    HLAPI_HLU_INCLUDE_DIR
    HLAPI_HLU_LIBRARY
    HLAPI_HLU_LIBRARY_RELEASE
    HLAPI_HLU_LIBRARY_DEBUG
    +


    +

    Non-cache variables you might use in your CMakeLists.txt:

    +
      OPENHAPTICS_FOUND
    HDAPI_INCLUDE_DIRS
    HDAPI_LIBRARIES
    HDAPI_HDU_INCLUDE_DIRS
    HDAPI_HDU_LIBRARIES
    HLAPI_INCLUDE_DIRS
    HLAPI_LIBRARIES
    HLAPI_HLU_INCLUDE_DIRS
    HLAPI_HLU_LIBRARIES
    OPENHAPTICS_LIBRARIES - includes HD, HDU, HL, HLU
    OPENHAPTICS_RUNTIME_LIBRARY_DIRS
    OPENHAPTICS_ENVIRONMENT
    OPENHAPTICS_LIBRARY_DIRS
    OPENHAPTICS_INCLUDE_DIRS
    +


    +

    Requires these CMake modules:

    +
      CleanDirectoryList
    CleanLibraryList
    ListCombinations
    ProgramFilesGlob
    SelectLibraryConfigurations (included with CMake >=2.8.0)
    FindPackageHandleStandardArgs (known included with CMake >=2.6.2)
    CMake 2.6.3 (uses "unset")
    +


    +

    Original Author: 2009-2012 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)

    + +
  • +
  • + FindParasolid: try to find PARASOLID library
    +

    Important note: If you are also using JtTk, do your

    +
      find_package(JtTk)
    +

    first, to avoid runtime PK_* errors!

    +
      PARASOLID_LIBRARY_DIR, library search path
    PARASOLID_INCLUDE_DIR, include search path
    PARASOLID_{component}_LIBRARY, the library to link against
    PARASOLID_FOUND, If false, do not try to use this library.
    +


    +

    Plural versions refer to this library and its dependencies, and are recommended to be used instead, unless you have a good reason.

    +

    Requires these CMake modules:

    +
      CheckVersion
    ListCombinations
    ProgramFilesGlob
    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)

    + +
  • +
  • + FindPerformer: try to find the OpenGL Performer library
    +


    +

    Users may optionally supply:

    +
      PERFORMER_ROOT_DIR - a prefix to start searching.
    +


    +

    Cache Variables: (probably not for direct use in your scripts)

    +
      PERFORMER_INCLUDE_DIR
    PERFORMER_LIBRARY
    PERFORMER_PFUI_LIBRARY - doesn't get included in PERFORMER_LIBRARIES
    PERFORMER_PFDU_UTIL_LIBRARY - doesn't get included in PERFORMER_LIBRARIES
    PERFORMER_PFV_LIBRARY - doesn't get included in PERFORMER_LIBRARIES
    +


    +

    Non-cache variables you might use in your CMakeLists.txt:

    +
      PERFORMER_FOUND
    PERFORMER_INCLUDE_DIRS
    PERFORMER_LIBRARIES
    PERFORMER_RUNTIME_LIBRARY_DIRS
    +


    +

    Requires these CMake modules:

    +
      FindPackageHandleStandardArgs (known included with CMake >=2.6.2)
    +


    +

    Original Author: 2012 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net> http://academic.cleardefinition.com Iowa State University HCI Graduate Program/VRAC

    +

    Copyright Iowa State University 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)

    + +
  • +
  • + FindPerlModules: try to find perl modules, passed as COMPONENTS
    +


    +

    Non-cache variable you might use in your CMakeLists.txt:

    +
      PERLMODULES_FOUND
    +


    +

    Requires these CMake modules:

    +
      FindPackageHandleStandardArgs (known included with CMake >=2.6.2)
    +


    +

    Original Author: 2012 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net> http://academic.cleardefinition.com Iowa State University HCI Graduate Program/VRAC

    +

    Copyright Iowa State University 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)

    + +
  • +
  • + FindQVRPN: try to find QVRPN library
    +


    +

    Of course, you may also just choose to make QVRPN a submodule of your project itself.

    +

    Cache Variables:

    +
      QVRPN_LIBRARY
    QVRPN_INCLUDE_DIR
    +


    +

    Non-cache variables you might use in your CMakeLists.txt:

    +
      QVRPN_FOUND
    QVRPN_LIBRARIES
    QVRPN_INCLUDE_DIRS
    +


    +

    QVRPN_ROOT_DIR is searched preferentially for these files

    +

    Requires these CMake modules:

    +
      FindPackageHandleStandardArgs (known included with CMake >=2.6.2)
    +


    +

    Refactored from FindVRPN.cmake by: Juan Sebastian Casallas <casallas@iastate.edu>

    +

    FindVRPN.cmake 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-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)

    + +
  • +
  • + FindSonix12: try to find Sonix 1.2 library
    +

    Requires VPR 2.0 and GMTL (thus FindVPR20.cmake and FindGMTL.cmake) Optionally uses Flagpoll and FindFlagpoll.cmake

    +

    This library is a part of VR Juggler 2.2 - you probably want to use find_package(VRJuggler22) instead, for an easy interface to this and related scripts. See FindVRJuggler22.cmake for more information.

    +
      SONIX12_LIBRARY_DIR, library search path
    SONIX12_INCLUDE_DIR, include search path
    SONIX12_LIBRARY, the library to link against
    SONIX12_FOUND, If false, do not try to use this library.
    +


    +

    Plural versions refer to this library and its dependencies, and are recommended to be used instead, unless you have a good reason.

    +

    Useful configuration variables you might want to add to your cache:

    +
      SONIX12_ROOT_DIR - A directory prefix to search
    (a path that contains include/ as a subdirectory)
    +


    +

    This script will use Flagpoll, if found, to provide hints to the location of this library, but does not use the compiler flags returned by Flagpoll directly.

    +

    The VJ_BASE_DIR environment variable is also searched (preferentially) when searching for this component, so most sane build environments should "just work." Note that you need to manually re-run CMake if you change this environment variable, because it cannot auto-detect this change and trigger an automatic re-run.

    +

    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)

    + +
  • +
  • + FindSonix14: try to find Sonix 1.4 library
    +

    Requires VPR 2.2 and GMTL (thus FindVPR22.cmake and FindGMTL.cmake) Optionally uses Flagpoll and FindFlagpoll.cmake

    +

    This library is a part of VR Juggler 3.0 - you probably want to use find_package(VRJuggler30) instead, for an easy interface to this and related scripts. See FindVRJuggler30.cmake for more information.

    +
      SONIX14_LIBRARY_DIR, library search path
    SONIX14_INCLUDE_DIR, include search path
    SONIX14_LIBRARY, the library to link against
    SONIX14_FOUND, If false, do not try to use this library.
    +


    +

    Plural versions refer to this library and its dependencies, and are recommended to be used instead, unless you have a good reason.

    +

    Useful configuration variables you might want to add to your cache:

    +
      SONIX14_ROOT_DIR - A directory prefix to search
    (a path that contains include/ as a subdirectory)
    +


    +

    This script will use Flagpoll, if found, to provide hints to the location of this library, but does not use the compiler flags returned by Flagpoll directly.

    +

    The VJ_BASE_DIR environment variable is also searched (preferentially) when searching for this component, so most sane build environments should "just work." Note that you need to manually re-run CMake if you change this environment variable, because it cannot auto-detect this change and trigger an automatic re-run.

    +

    Original Author: 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net> http://academic.cleardefinition.com Iowa State University HCI Graduate Program/VRAC Updated for VR Juggler 3.0 by: Brandon Newendorp <brandon@newendorp.com>

    + +
  • +
  • + FindTR1: Try to find C++ TR1 headers and libraries
    +

    Once done, this will define

    +
      TR1_USE_FILE, which you may "include" in your CMake file to be able
    to use TR1 features transparently
    TR1_INCLUDE_DIRS, any directories needed to access TR1 headers
    TR1_LIBRARY_DIRS, any directories needed to access (auto-link) TR1 libraries
    TR1_FOUND, If false, do not try to use TR1 features.
    +


    +

    If TR1 features are not built-in, we will try to use Boost to substitute for them.

    +

    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)

    + +
  • +
  • + FindTooN: try to find TooN headers
    +


    +

    Users may optionally supply:

    +
      TOON_ROOT_DIR - a prefix to start searching for the toon headers.
    +


    +

    Cache Variables: (probably not for direct use in your scripts)

    +
      TOON_INCLUDE_DIR
    +


    +

    Non-cache variables you might use in your CMakeLists.txt:

    +
      TOON_FOUND
    TOON_INCLUDE_DIRS
    TOON_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)

    + +
  • +
  • + FindTooNtag: try to find tag algorithm library (built on TooN)
    +


    +

    Users may optionally supply:

    +
      TAG_ROOT_DIR - a prefix to start searching for the toon headers.
    +


    +

    Cache Variables: (probably not for direct use in your scripts)

    +
      TAG_INCLUDE_DIR
    TAG_LIBRARY
    +


    +

    Non-cache variables you might use in your CMakeLists.txt:

    +
      TOONTAG_FOUND
    TOONTAG_INCLUDE_DIRS
    TOONTAG_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)

    + +
  • +
  • + FindTweek12: try to find Tweek 1.2 library
    +

    Requires VPR 2.0 (thus FindVPR20.cmake) Optionally uses Flagpoll and FindFlagpoll.cmake

    +

    This library is a part of VR Juggler 2.2 - you probably want to use find_package(VRJuggler22) instead, for an easy interface to this and related scripts. See FindVRJuggler22.cmake for more information.

    +
      TWEEK12_LIBRARY_DIR, library search path
    TWEEK12_INCLUDE_DIR, include search path
    TWEEK12_LIBRARY, the library to link against
    TWEEK12_FOUND, If false, do not try to use this library.
    +


    +

    Plural versions refer to this library and its dependencies, and are recommended to be used instead, unless you have a good reason.

    +

    Useful configuration variables you might want to add to your cache:

    +
      TWEEK12_ROOT_DIR - A directory prefix to search
    (a path that contains include/ as a subdirectory)
    +


    +

    This script will use Flagpoll, if found, to provide hints to the location of this library, but does not use the compiler flags returned by Flagpoll directly.

    +

    The VJ_BASE_DIR environment variable is also searched (preferentially) when searching for this component, so most sane build environments should "just work." Note that you need to manually re-run CMake if you change this environment variable, because it cannot auto-detect this change and trigger an automatic re-run.

    +

    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)

    + +
  • +
  • + FindTweek14: try to find Tweek 1.4 library
    +

    Requires VPR 2.2 (thus FindVPR22.cmake) Optionally uses Flagpoll and FindFlagpoll.cmake

    +

    This library is a part of VR Juggler 3.0 - you probably want to use find_package(VRJuggler30) instead, for an easy interface to this and related scripts. See FindVRJuggler30.cmake for more information.

    +
      TWEEK14_LIBRARY_DIR, library search path
    TWEEK14_INCLUDE_DIR, include search path
    TWEEK14_LIBRARY, the library to link against
    TWEEK14_FOUND, If false, do not try to use this library.
    +


    +

    Plural versions refer to this library and its dependencies, and are recommended to be used instead, unless you have a good reason.

    +

    Useful configuration variables you might want to add to your cache:

    +
      TWEEK14_ROOT_DIR - A directory prefix to search
    (a path that contains include/ as a subdirectory)
    +


    +

    This script will use Flagpoll, if found, to provide hints to the location of this library, but does not use the compiler flags returned by Flagpoll directly.

    +

    The VJ_BASE_DIR environment variable is also searched (preferentially) when searching for this component, so most sane build environments should "just work." Note that you need to manually re-run CMake if you change this environment variable, because it cannot auto-detect this change and trigger an automatic re-run.

    +

    Original Author: 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net> http://academic.cleardefinition.com Iowa State University HCI Graduate Program/VRAC Updated for VR Juggler 3.0 by: Brandon Newendorp <brandon@newendorp.com>

    + +
  • +
  • + FindVPR20: try to find VPR 2.0 library
    +

    Requires Boost 1.33.1 or greater (including filesystem and signals libraries) (and thus FindBoost.cmake from 2.8rc3 or newer, preferably) Requires NSPR4 (and PLC4) on Windows Requires pthreads on Unix (Mac or Linux) Requires libuuid on Linux Optionally uses Flagpoll and FindFlagpoll.cmake

    +

    This library is a part of VR Juggler 2.2 - you probably want to use find_package(VRJuggler22) instead, for an easy interface to this and related scripts. See FindVRJuggler22.cmake for more information.

    +
      VPR20_LIBRARY_DIR, library search path
    VPR20_INCLUDE_DIR, include search path
    VPR20_LIBRARY, the library to link against
    VPR20_FOUND, If false, do not try to use this library.
    +


    +

    Plural versions refer to this library and its dependencies, and are recommended to be used instead, unless you have a good reason.

    +

    Useful configuration variables you might want to add to your cache:

    +
      VPR20_ROOT_DIR - A directory prefix to search
    (a path that contains include/ as a subdirectory)
    +


    +

    This script will use Flagpoll, if found, to provide hints to the location of this library, but does not use the compiler flags returned by Flagpoll directly.

    +

    The VJ_BASE_DIR environment variable is also searched (preferentially) when searching for this component, so most sane build environments should "just work." Note that you need to manually re-run CMake if you change this environment variable, because it cannot auto-detect this change and trigger an automatic re-run.

    +

    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)

    + +
  • +
  • + FindVPR22: try to find VPR 2.2 library
    +

    Requires Boost 1.33.1 or greater (including filesystem and signals libraries) (and thus FindBoost.cmake from 2.8rc3 or newer, preferably) Requires NSPR4 (and PLC4) on Windows Requires pthreads on Unix (Mac or Linux) Requires libuuid on Linux Optionally uses Flagpoll and FindFlagpoll.cmake

    +

    This library is a part of VR Juggler 3.0 - you probably want to use find_package(VRJuggler30) instead, for an easy interface to this and related scripts. See FindVRJuggler30.cmake for more information.

    +
      VPR22_LIBRARY_DIR, library search path
    VPR22_INCLUDE_DIR, include search path
    VPR22_LIBRARY, the library to link against
    VPR22_FOUND, If false, do not try to use this library.
    +


    +

    Plural versions refer to this library and its dependencies, and are recommended to be used instead, unless you have a good reason.

    +

    Useful configuration variables you might want to add to your cache:

    +
      VPR22_ROOT_DIR - A directory prefix to search
    (a path that contains include/ as a subdirectory)
    +


    +

    This script will use Flagpoll, if found, to provide hints to the location of this library, but does not use the compiler flags returned by Flagpoll directly.

    +

    The VJ_BASE_DIR environment variable is also searched (preferentially) when searching for this component, so most sane build environments should "just work." Note that you need to manually re-run CMake if you change this environment variable, because it cannot auto-detect this change and trigger an automatic re-run.

    +

    Original Author: 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net> http://academic.cleardefinition.com Iowa State University HCI Graduate Program/VRAC Updated for VR Juggler 3.0 by: Brandon Newendorp <brandon@newendorp.com>

    + +
  • +
  • + FindVPS: try to find VPS library
    +


    +
      VPS_LIBRARY_DIR, library search path
    VPS_INCLUDE_DIR, include search path
    VPS_{component}_LIBRARY, the library to link against
    VPS_FOUND, If false, do not try to use this library.
    +


    +

    Plural versions refer to this library and its dependencies, and are recommended to be used instead, unless you have a good reason.

    +

    Useful configuration variables you might want to add to your cache:

    +
      VPS_ROOT_DIR - A directory prefix to search
    (a path that contains include/ as a subdirectory)
    +


    +

    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)

    + +
  • +
  • + FindVRJ22: try to find VR Juggler 2.2 core library
    +

    Requires JCCL 1.2, Gadgeteer 1.2, VPR 2.0, and Sonix 1.2 (thus FindJCCL12.cmake, FindGadgeteer12.cmake, FindVPR20.cmake, and FindSonix12.cmake) Requires X11 if not on Mac or Windows. Optionally uses Flagpoll and FindFlagpoll.cmake

    +

    This library is a part of VR Juggler 2.2 - you probably want to use find_package(VRJuggler22) instead, for an easy interface to this and related scripts. See FindVRJuggler22.cmake for more information.

    +
      VRJ22_LIBRARY_DIR, library search path
    VRJ22_INCLUDE_DIR, include search path
    VRJ22_LIBRARY, the library to link against
    VRJ22_FOUND, If false, do not try to use this library.
    +


    +

    Plural versions refer to this library and its dependencies, and are recommended to be used instead, unless you have a good reason.

    +

    Useful configuration variables you might want to add to your cache:

    +
      VRJ22_ROOT_DIR - A directory prefix to search
    (a path that contains include/ as a subdirectory)
    +


    +

    This script will use Flagpoll, if found, to provide hints to the location of this library, but does not use the compiler flags returned by Flagpoll directly.

    +

    The VJ_BASE_DIR environment variable is also searched (preferentially) when searching for this component, so most sane build environments should "just work." Note that you need to manually re-run CMake if you change this environment variable, because it cannot auto-detect this change and trigger an automatic re-run.

    +

    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)

    + +
  • +
  • + FindVRJ30: try to find VR Juggler 3.0 core library
    +

    Requires JCCL 1.4, Gadgeteer 1.4, VPR 2.2, and Sonix 1.4 (thus FindJCCL14.cmake, FindGadgeteer20.cmake, FindVPR22.cmake, and FindSonix14.cmake) Requires X11 if not on Mac or Windows. Optionally uses Flagpoll and FindFlagpoll.cmake

    +

    This library is a part of VR Juggler 3.0 - you probably want to use find_package(VRJuggler30) instead, for an easy interface to this and related scripts. See FindVRJuggler30.cmake for more information.

    +
      VRJ30_LIBRARY_DIR, library search path
    VRJ30_INCLUDE_DIR, include search path
    VRJ30_LIBRARY, the library to link against
    VRJ30_FOUND, If false, do not try to use this library.
    +


    +

    Plural versions refer to this library and its dependencies, and are recommended to be used instead, unless you have a good reason.

    +

    Useful configuration variables you might want to add to your cache:

    +
      VRJ30_ROOT_DIR - A directory prefix to search
    (a path that contains include/ as a subdirectory)
    +


    +

    This script will use Flagpoll, if found, to provide hints to the location of this library, but does not use the compiler flags returned by Flagpoll directly.

    +

    The VJ_BASE_DIR environment variable is also searched (preferentially) when searching for this component, so most sane build environments should "just work." Note that you need to manually re-run CMake if you change this environment variable, because it cannot auto-detect this change and trigger an automatic re-run.

    +

    Original Author: 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net> http://academic.cleardefinition.com Iowa State University HCI Graduate Program/VRAC Updated for VR Juggler 3.0 by: Brandon Newendorp <brandon@newendorp.com>

    +

    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)

    + +
  • +
  • + FindVRJOGL22: try to find VRJuggler 2.2 OpenGL library
    +

    Requires VRJ core 2.2 (thus FindVRJ22.cmake) Requires OpenGL. Optionally uses Flagpoll and FindFlagpoll.cmake

    +

    This library is a part of VR Juggler 2.2 - you probably want to use find_package(VRJuggler22) instead, for an easy interface to this and related scripts. See FindVRJuggler22.cmake for more information.

    +
      VRJOGL22_LIBRARY_DIR, library search path
    VRJOGL22_INCLUDE_DIRS, include search path for dependencies
    VRJOGL22_LIBRARY, the library to link against
    VRJOGL22_FOUND, If false, do not try to use this library.
    +


    +

    Plural versions refer to this library and its dependencies, and are recommended to be used instead, unless you have a good reason.

    +

    Useful configuration variables you might want to add to your cache:

    +
      VRJOGL22_ROOT_DIR - A directory prefix to search
    (a path that contains include/ as a subdirectory)
    +


    +

    This script will use Flagpoll, if found, to provide hints to the location of this library, but does not use the compiler flags returned by Flagpoll directly.

    +

    The VJ_BASE_DIR environment variable is also searched (preferentially) when searching for this component, so most sane build environments should "just work." Note that you need to manually re-run CMake if you change this environment variable, because it cannot auto-detect this change and trigger an automatic re-run.

    +

    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)

    + +
  • +
  • + FindVRJOGL30: try to find VRJuggler 3.0 OpenGL library
    +

    Requires VRJ core 3.0 (thus FindVRJ30.cmake) Requires OpenGL. Optionally uses Flagpoll and FindFlagpoll.cmake

    +

    This library is a part of VR Juggler 3.0 - you probably want to use find_package(VRJuggler30) instead, for an easy interface to this and related scripts. See FindVRJuggler30.cmake for more information.

    +
      VRJOGL30_LIBRARY_DIR, library search path
    VRJOGL30_INCLUDE_DIRS, include search path for dependencies
    VRJOGL30_LIBRARY, the library to link against
    VRJOGL30_FOUND, If false, do not try to use this library.
    +


    +

    Plural versions refer to this library and its dependencies, and are recommended to be used instead, unless you have a good reason.

    +

    Useful configuration variables you might want to add to your cache:

    +
      VRJOGL30_ROOT_DIR - A directory prefix to search
    (a path that contains include/ as a subdirectory)
    +


    +

    This script will use Flagpoll, if found, to provide hints to the location of this library, but does not use the compiler flags returned by Flagpoll directly.

    +

    The VJ_BASE_DIR environment variable is also searched (preferentially) when searching for this component, so most sane build environments should "just work." Note that you need to manually re-run CMake if you change this environment variable, because it cannot auto-detect this change and trigger an automatic re-run.

    +

    Original Author: 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net> http://academic.cleardefinition.com Iowa State University HCI Graduate Program/VRAC Updated for VR Juggler 3.0 by: Brandon Newendorp <brandon@newendorp.com>

    + +
  • +
  • + FindVRJuggler: try to find VR Juggler-related packages (combined finder)
    +
      VRJUGGLER_INCLUDE_DIRS, include search paths
    VRJUGGLER_LIBRARIES, the libraries to link against
    VRJUGGLER_ENVIRONMENT
    VRJUGGLER_RUNTIME_LIBRARY_DIRS
    VRJUGGLER_CXX_FLAGS
    VRJUGGLER_DEFINITIONS
    VRJUGGLER_FOUND, If false, do not try to use VR Juggler.
    +


    +

    Components available to search for (uses "VRJOGL" by default):

    +
      VRJOGL
    VRJ
    Gadgeteer
    JCCL
    VPR
    Sonix
    Tweek
    +


    +

    Additionally, a full setup requires these packages and their Find_.cmake scripts

    +
      CPPDOM
    GMTL
    +


    +

    Optionally uses Flagpoll (and FindFlagpoll.cmake)

    +

    Notes on components:

    +
      - All components automatically include their dependencies.
    - If you do not specify a component, VRJOGL (the OpenGL view manager)
    will be used by default.
    - Capitalization of component names does not matter, but it's best to
    pretend it does and use the above capitalization.
    - Since this script calls find_package for your requested components and
    their dependencies, you can use any of the variables specified in those
    files in addition to the "summary" ones listed here, for more finely
    controlled building and linking.
    +


    +

    This CMake script requires all of the Find*.cmake scripts for the components listed above, as it is only a "meta-script" designed to make using those scripts more developer-friendly.

    +

    Useful configuration variables you might want to add to your cache:

    +
      (CAPS COMPONENT NAME)_ROOT_DIR - A directory prefix to search
    (a path that contains include/ as a subdirectory)
    +


    +

    The VJ_BASE_DIR environment variable is also searched (preferentially) when seeking any of the above components, as well as Flagpoll, CPPDOM, and Boost (from within VPR), so most sane build environments should "just work."

    +

    IMPORTANT: Note that you need to manually re-run CMake if you change this environment variable, because it cannot auto-detect this change and trigger an automatic re-run.

    +

    Original Author: 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net> http://academic.cleardefinition.com Iowa State University HCI Graduate Program/VRAC Updated for VR Juggler 3.0 by: Brandon Newendorp <brandon@newendorp.com>

    +

    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)

    + +
  • +
  • + FindVRJuggler22: try to find VRJuggler 2.2-related packages (main finder)
    +
      VRJUGGLER22_LIBRARY_DIRS, library search paths
    VRJUGGLER22_INCLUDE_DIRS, include search paths
    VRJUGGLER22_LIBRARIES, the libraries to link against
    VRJUGGLER22_ENVIRONMENT
    VRJUGGLER22_RUNTIME_LIBRARY_DIRS
    VRJUGGLER22_CXX_FLAGS
    VRJUGGLER22_DEFINITIONS
    VRJUGGLER22_FOUND, If false, do not try to use VR Juggler 2.2.
    +


    +

    Components available to search for (uses "VRJOGL22" by default):

    +
      VRJOGL22
    VRJ22
    Gadgeteer12
    JCCL12
    VPR20
    Sonix12
    Tweek12
    +


    +

    Additionally, a full setup requires these packages and their Find_.cmake scripts

    +
      CPPDOM
    GMTL
    +


    +

    Optionally uses Flagpoll (and FindFlagpoll.cmake)

    +

    Notes on components:

    +
      - All components automatically include their dependencies.
    - You can search for the name above with or without the version suffix.
    - If you do not specify a component, VRJOGL22(the OpenGL view manager)
    will be used by default.
    - Capitalization of component names does not matter, but it's best to
    pretend it does and use the above capitalization.
    - Since this script calls find_package for your requested components and
    their dependencies, you can use any of the variables specified in those
    files in addition to the "summary" ones listed here, for more finely
    controlled building and linking.
    +


    +

    This CMake script requires all of the Find*.cmake scripts for the components listed above, as it is only a "meta-script" designed to make using those scripts more developer-friendly.

    +

    Useful configuration variables you might want to add to your cache:

    +
      (CAPS COMPONENT NAME)_ROOT_DIR - A directory prefix to search
    (a path that contains include/ as a subdirectory)
    +


    +

    The VJ_BASE_DIR environment variable is also searched (preferentially) when seeking any of the above components, as well as Flagpoll, CPPDOM, and Boost (from within VPR20), so most sane build environments should "just work."

    +

    IMPORTANT: Note that you need to manually re-run CMake if you change this environment variable, because it cannot auto-detect this change and trigger an automatic re-run.

    +

    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)

    + +
  • +
  • + FindVRJuggler30: try to find VRJuggler 3.0-related packages (main finder)
    +
      VRJUGGLER30_LIBRARY_DIRS, library search paths
    VRJUGGLER30_INCLUDE_DIRS, include search paths
    VRJUGGLER30_LIBRARIES, the libraries to link against
    VRJUGGLER30_ENVIRONMENT
    VRJUGGLER30_RUNTIME_LIBRARY_DIRS
    VRJUGGLER30_CXX_FLAGS
    VRJUGGLER30_DEFINITIONS
    VRJUGGLER30_FOUND, If false, do not try to use VR Juggler 3.0.
    +


    +

    Components available to search for (uses "VRJOGL30" by default):

    +
      VRJOGL30
    VRJ30
    Gadgeteer20
    JCCL14
    VPR22
    Sonix14
    Tweek14
    +


    +

    Additionally, a full setup requires these packages and their Find_.cmake scripts

    +
      CPPDOM
    GMTL
    +


    +

    Optionally uses Flagpoll (and FindFlagpoll.cmake)

    +

    Notes on components:

    +
      - All components automatically include their dependencies.
    - You can search for the name above with or without the version suffix.
    - If you do not specify a component, VRJOGL30(the OpenGL view manager)
    will be used by default.
    - Capitalization of component names does not matter, but it's best to
    pretend it does and use the above capitalization.
    - Since this script calls find_package for your requested components and
    their dependencies, you can use any of the variables specified in those
    files in addition to the "summary" ones listed here, for more finely
    controlled building and linking.
    +


    +

    This CMake script requires all of the Find*.cmake scripts for the components listed above, as it is only a "meta-script" designed to make using those scripts more developer-friendly.

    +

    Useful configuration variables you might want to add to your cache:

    +
      (CAPS COMPONENT NAME)_ROOT_DIR - A directory prefix to search
    (a path that contains include/ as a subdirectory)
    +


    +

    The VJ_BASE_DIR environment variable is also searched (preferentially) when seeking any of the above components, as well as Flagpoll, CPPDOM, and Boost (from within VPR22), so most sane build environments should "just work."

    +

    IMPORTANT: Note that you need to manually re-run CMake if you change this environment variable, because it cannot auto-detect this change and trigger an automatic re-run.

    +

    Original Author: 2009-2011 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net> http://academic.cleardefinition.com Iowa State University HCI Graduate Program/VRAC Updated for VR Juggler 3.0 by: Brandon Newendorp <brandon@newendorp.com> and Ryan Pavlik

    +

    Copyright Iowa State University 2009-2011. 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)

    + +
  • +
  • + FindVRPN: try to find VRPN library
    +


    +

    Cache Variables:

    +
      VRPN_LIBRARY
    VRPN_SERVER_LIBRARY
    VRPN_INCLUDE_DIR
    +


    +

    Non-cache variables you might use in your CMakeLists.txt:

    +
      VRPN_FOUND
    VRPN_SERVER_LIBRARIES - server libraries
    VRPN_LIBRARIES - client libraries
    VRPN_CLIENT_DEFINITIONS - definitions if you only use the client library
    VRPN_DEFINITIONS - Client-only definition if all we found was the client library.
    VRPN_INCLUDE_DIRS
    +


    +

    VRPN_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 <rpavlik@iastate.edu> <abiryan@ryand.net> 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)

    + +
  • +
  • + FindViewPoint: try to find Arrington Research ViewPoint EyeTracker SDK
    +


    +

    Cache Variables: (probably not for direct use in your scripts)

    +
      VIEWPOINT_INCLUDE_DIR
    VIEWPOINT_LIBRARY
    VIEWPOINT_RUNTIME_LIBRARY
    +


    +

    Non-cache variables you might use in your CMakeLists.txt:

    +
      VIEWPOINT_FOUND
    VIEWPOINT_INCLUDE_DIRS
    VIEWPOINT_LIBRARIES
    VIEWPOINT_RUNTIME_LIBRARIES - aka the dll for installing
    VIEWPOINT_RUNTIME_LIBRARY_DIRS
    +


    +

    Requires these CMake modules:

    +
      FindPackageHandleStandardArgs (known included with CMake >=2.6.2)
    +


    +

    Original Author: 2012 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net> http://academic.cleardefinition.com Iowa State University HCI Graduate Program/VRAC

    +

    Copyright Iowa State University 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)

    + +
  • +
  • + FindVirtuoseAPI: try to find Haption VirtuoseAPI library and include files
    +


    +
      VIRTUOSEAPI_INCLUDE_DIRS, where to find headers
    VIRTUOSEAPI_LIBRARIES, the libraries to link against
    VIRTUOSEAPI_FOUND, If false, do not try to use this library
    VIRTUOSEAPI_RUNTIME_LIBRARY_DIRS, path to DLL/SO for runtime use.
    VIRTUOSEAPI_RUNTIME_LIBRARIES, runtime libraries you might want to install
    + +
  • +
  • + FindVirtuoseVPP: try to find Haption VirtuoseAPI C++ wrapper include files
    +


    +

    Use of this header depends on the VirtuoseAPI, so we search for that too.

    +
      VIRTUOSEVPP_INCLUDE_DIRS, where to find headers
    VIRTUOSEVPP_LIBRARIES, the libraries to link against
    VIRTUOSEVPP_FOUND, If false, do not try to use this library
    VIRTUOSEVPP_RUNTIME_LIBRARY_DIRS, path to DLL/SO for runtime use.
    VIRTUOSEAPI_RUNTIME_LIBRARIES, runtime libraries you might want to install
    + +
  • +
  • + FindWiiSCAAT: try to find the Wii SCAAT library
    +


    +

    Users may optionally supply:

    +
      WIISCAAT_ROOT_DIR - a prefix to start searching for the headers.
    +


    +

    Cache Variables: (probably not for direct use in your scripts)

    +
      WIISCAAT_INCLUDE_DIR
    WIISCAAT_LIBRARY
    +


    +

    Non-cache variables you might use in your CMakeLists.txt:

    +
      WIISCAAT_FOUND
    WIISCAAT_INCLUDE_DIRS
    WIISCAAT_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)

    + +
  • +
  • + FindWiiUse: try to find WiiUse library
    +


    +

    Cache Variables: (probably not for direct use in your scripts)

    +
      WIIUSE_INCLUDE_DIR
    WIIUSE_LIBRARY
    +


    +

    Non-cache variables you might use in your CMakeLists.txt:

    +
      WIIUSE_FOUND
    WIIUSE_INCLUDE_DIRS
    WIIUSE_LIBRARIES
    WIIUSE_RUNTIME_LIBRARIES - aka the dll for installing
    WIIUSE_RUNTIME_LIBRARY_DIRS
    +


    +

    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)

    + +
  • +
  • + FindWinHID: 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)

    + +
  • +
  • + FindWindowsSDK: Find the Windows SDK aka Platform SDK
    +


    +

    Variables:

    +
      WINDOWSSDK_FOUND - if any version of the windows or platform SDK was found that is usable with the current version of visual studio
    WINDOWSSDK_LATEST_DIR
    WINDOWSSDK_LATEST_NAME
    WINDOWSSDK_FOUND_PREFERENCE - if we found an entry indicating a "preferred" SDK listed for this visual studio version
    WINDOWSSDK_PREFERRED_DIR
    WINDOWSSDK_PREFERRED_NAME
    +


    +
      WINDOWSSDK_DIRS - contains no duplicates, ordered most recent first.
    WINDOWSSDK_PREFERRED_FIRST_DIRS - contains no duplicates, ordered with preferred first, followed by the rest in descending recency
    +


    +

    Functions:

    +
      windowssdk_name_lookup(<directory> <output variable>) - Find the name corresponding with the SDK directory you pass in, or
    NOTFOUND if not recognized. Your directory must be one of WINDOWSSDK_DIRS for this to work.
    +


    +

    Requires these CMake modules:

    +
      FindPackageHandleStandardArgs (known included with CMake >=2.6.2)
    +


    +

    Original Author: 2012 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net> http://academic.cleardefinition.com Iowa State University HCI Graduate Program/VRAC

    +

    Copyright Iowa State University 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)

    + +
  • +
  • + Findargp: try to find the argp library/component of glibc
    +


    +

    Users may optionally supply:

    +
      ARGP_ROOT_DIR - a prefix to start searching.
    +


    +

    Cache Variables: (probably not for direct use in your scripts)

    +
      ARGP_INCLUDE_DIR
    ARGP_LIBRARY, only defined if linking to an extra library is required
    +


    +

    Non-cache variables you might use in your CMakeLists.txt:

    +
      ARGP_FOUND
    ARGP_INCLUDE_DIRS
    ARGP_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)

    + +
  • +
  • + Findcppcheck: try to find cppcheck tool
    +


    +

    Cache Variables:

    +
      CPPCHECK_EXECUTABLE
    +


    +

    Non-cache variables you might use in your CMakeLists.txt:

    +
      CPPCHECK_FOUND
    CPPCHECK_POSSIBLEERROR_ARG
    CPPCHECK_UNUSEDFUNC_ARG
    CPPCHECK_STYLE_ARG
    CPPCHECK_QUIET_ARG
    CPPCHECK_INCLUDEPATH_ARG
    CPPCHECK_FAIL_REGULAR_EXPRESSION
    CPPCHECK_WARN_REGULAR_EXPRESSION
    CPPCHECK_MARK_AS_ADVANCED - whether to mark our vars as advanced even
    if we don't find this program.
    +


    +

    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)

    + +
  • +
  • + Findcppunit: try to find cppunit library
    +


    +

    Cache Variables: (probably not for direct use in your scripts)

    +
      CPPUNIT_INCLUDE_DIR
    CPPUNIT_LIBRARY
    +


    +

    Non-cache variables you might use in your CMakeLists.txt:

    +
      CPPUNIT_FOUND
    CPPUNIT_INCLUDE_DIRS
    CPPUNIT_LIBRARIES
    +


    +

    Requires these CMake modules:

    +
      SelectLibraryConfigurations (included with CMake >= 2.8.0)
    FindPackageHandleStandardArgs (known included with CMake >=2.6.2)
    +


    +

    Original Author: 2009-2011 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net> http://academic.cleardefinition.com Iowa State University HCI Graduate Program/VRAC

    +

    Copyright Iowa State University 2009-2011. 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)

    + +
  • +
  • + Findcutil: find NVIDIA CUDA and source for the cutil library, building cutil if needed.
    +


    +
      CUTIL_LIBRARIES - Libraries to link against to use CUTIL
    CUTIL_INCLUDE_DIRS - Include directories to add before building a CUTIL app.
    +


    +

    Functions:

    +
      install_cutil({RUNTIME_LIBRARY_DESTINATION}) - Install the CUTIL shared lib if created.
    +


    +

    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)

    + +
  • +
  • + Finddb2pdf: Try to find db2pdf, and define a custom command to turn docbook into pdf
    +


    +

    Once done, this will define:

    +
      DB2PDF_FOUND - system has LyX
    DB2PDF_COMMAND - the command to run
    +


    +

    and the following function:

    +
      docbook_to_pdf(<output-variable> <docbook files>)
    +


    +

    Useful configuration variables you might want to add to your cache:

    +
      DB2PDF_ROOT_DIR - A directory prefix to search
    +


    +

    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)

    + +
  • +
  • + FindosgLua: try to find osgLua
    +


    +

    Users may optionally supply:

    +
      OSGLUA_ROOT_DIR - a prefix to start searching
    +


    +

    Non-cache variables you might use in your CMakeLists.txt:

    +
      OSGLUA_FOUND
    OSGLUA_INCLUDE_DIRS
    OSGLUA_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)

    + +
  • +
  • + Findquatlib: Find quatlib
    +

    Find the quatlib headers and libraries.

    +
      QUATLIB_INCLUDE_DIRS - where to find quat.h
    QUATLIB_LIBRARIES - List of libraries when using quatlib.
    QUATLIB_FOUND - True if quatlib found.
    +


    +

    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)

    + +
  • +
  • + GetCPUDetails: Set a number of variables to indicate things about the current CPU and OS
    +


    +
      CPU_COUNT
    CPU_INTEL
    CPU_EXE_64BIT
    CPU_EXE_32BIT
    CPU_HAS_SSE
    CPU_HAS_SSE2
    CPU_HAS_SSE3
    CPU_HAS_SSSE3
    CPU_HAS_SSE4_1
    CPU_HAS_SSE4_2
    +


    +

    Requires these CMake modules:

    +
      no additional modules required
    +


    +

    Original Author: 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)

    + +
  • +
  • + GetCompilerInfoString: Utility function to return a human-useful-only string ID'ing the compiler
    +


    +
      get_compiler_info_string(<resultvar>)
    +


    +

    and some helper functions:

    +
      get_gcc_version(<resultvar>)
    get_vs_short_version_string(<generator> <resultvar>)
    +


    +

    You might consider using it when setting up CTest options, for example:

    +
      include(GetCompilerInfoString)
    get_compiler_info_string(COMPILERID)
    set(CTEST_BUILD_NAME "${CMAKE_SYSTEM}-${CMAKE_SYSTEM_PROCESSOR}-${COMPILERID}")
    +


    +

    Requires these CMake modules:

    +
      no additional modules required
    +


    +

    Original Author: 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)

    +

    Some functions based on cmake-2.8.0 modules FindBoost.cmake and CTest.cmake ============================================================================= Copyright 2006-2009 Kitware, Inc. Copyright 2006-2008 Andreas Schneider <mail@cynapses.org> Copyright 2007 Wengo Copyright 2007 Mike Jackson Copyright 2008 Andreas Pakulat <apaku@gmx.de> Copyright 2008-2009 Philip Lowman <philip@yhbt.com> Copyright 2010 Iowa State University (Ryan Pavlik <abiryan@ryand.net>)

    +

    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. ============================================================================= CMake - Cross Platform Makefile Generator Copyright 2000-2009 Kitware, Inc., Insight Software Consortium All rights reserved.

    +

    Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

    +

    * Redistributions of source code must retain the above copyright

    +
       notice, this list of conditions and the following disclaimer.
    +


    +

    * Redistributions in binary form must reproduce the above copyright

    +
       notice, this list of conditions and the following disclaimer in the
    documentation and/or other materials provided with the distribution.
    +


    +

    * Neither the names of Kitware, Inc., the Insight Software Consortium,

    +
       nor the names of their contributors may be used to endorse or promote
    products derived from this software without specific prior written
    permission.
    +


    +

    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. =============================================================================

    + +
  • +
  • + GetDirectoryList: Returns a list of the parent directories of all files passed
    +


    +
      get_directory_list(<listvar> <file path> [<additional file paths>...])
    +


    +

    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)

    + +
  • +
  • + GetFileList: Returns a list of the file names of all files passed
    +


    +
      get_file_list(<listvar> <file path> [<additional file paths>...])
    +


    +

    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)

    + +
  • +
  • + GetForceIncludeDefinitions: Get the platform-appropriate flags to add to force inclusion of a file
    +


    +

    The most common use of this is to use a generated config.h-type file placed out of the source tree in all files.

    +
      get_force_include_definitions(var forcedincludefiles...) -
    where var is the name of your desired output variable, and everything
    else is a source file to forcibly include.
    a list item to be filtered.
    +


    +

    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)

    + +
  • +
  • + GetGitRevisionDescription: 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> [<additional arguments to git describe> ...])
    +


    +

    Returns the refspec and sha hash of the current head revision

    +
      git_describe(<var> [<additional 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> [<additional 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)

    + +
  • +
  • + GetSubprojectStatus: Returns whether the current project is on its own or within another project's build
    +


    +
      get_subproject_status(<resultvar>) - resultvar will be YES if we are
    included in another project, or NO if we are being built separately
    +


    +

    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)

    + +
  • +
  • + Licensing: Building a licensing description file
    +


    +

    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)

    + +
  • +
  • + ListCombinations: Combine lists of prefixes and suffixes in all combinations
    +


    +
      list_combinations(var PREFIXES listitems... SUFFIXES listitems...) -
    where var is the name of your desired output variable and PREFIXES
    and SUFFIXES are special arguments that indicate the start of your
    list of prefixes or suffixes respectively.
    +


    +

    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)

    + +
  • +
  • + ListFilter: List filtering functions
    +


    +
      list_filter(var regex listitems...) - where var is the name of
    your desired output variable, regex is the regex whose matching items
    WILL be put in the output variable, and everything else is considered
    a list item to be filtered.
    +


    +
      list_filter_out(var regex listitems...) - where var is the name of
    your desired output variable, regex is the regex whose matching items
    will NOT be put in the output variable, and everything else is considered
    a list item to be filtered.
    +


    +

    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)

    + +
  • +
  • + LuaTargets: Copy/parse lua source files as a custom target
    +


    +
      include(LuaTargets)
    add_lua_target(<target_name> <directory to copy to> [<luafile> <luafile>])
    Relative paths for the destination directory are considered with
    with respect to CMAKE_CURRENT_BINARY_DIR
    +


    +
      install_lua_target(<target_name> [arguments to INSTALL(PROGRAMS ...) ])
    +


    +

    Set this variable to specify location of luac, if it is not a target:

    +
      LUA_TARGET_LUAC_EXECUTABLE
    +


    +

    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)

    + +
  • +
  • + MSVCMultipleProcessCompile: Compile with multiple processes on MSVC
    +


    +
      include(MSVCMultipleProcessCompile)
    +


    +

    Requires these CMake modules:

    +
      ListCombinations.cmake
    +


    +

    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)

    + +
  • +
  • + MSVCStaticRuntime: Modify compile flags to use the static runtimes of MSVC
    +


    +
      include(MSVCStaticRuntime)
    +


    +

    Requires these CMake modules:

    +
      ListCombinations.cmake
    +


    +

    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)

    + +
  • +
  • + MSVCVerboseLinking: Add appropriate linker flags to show link details on Visual Studio
    +


    +
      include(MSVCVerboseLinking) - to add the flags automaticlly if applicable
    +


    +

    Be sure to include this module _BEFORE_ adding your targets, or the targets won't pick up the updated flags.

    +

    Requires these CMake modules:

    +
      - none
    +


    +

    Original Author: 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)

    + +
  • +
  • + OptionRequires: Add an option that depends on one or more variables being true.
    +


    +
      option_requires(<option_name> <description> <variable_name> [<variable_name>...])
    +


    +

    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)

    + +
  • +
  • + PrefixListGlob: For each given prefix in a list, glob using the prefix+pattern
    +


    +


    +

    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)

    + +
  • +
  • + ProgramFilesGlob: Find bit-appropriate program files directories matching a given pattern
    +


    +

    Requires these CMake modules:

    +
      CleanDirectoryList
    PrefixListGlob
    +


    +

    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)

    + +
  • +
  • + ResetConfigurations: Re-set the available configurations to just RelWithDebInfo, Release, and Debug
    +


    +

    Requires these CMake modules:

    +
      no additional modules required
    +


    +

    Original Author: 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)

    + +
  • +
  • + SearchProgramFilesForOpenSceneGraph: Use some smarts to try to find OpenSceneGraph in the Program Files dirs
    +


    +

    Also uses the OSGHOME environment variable as OSG_DIR, if it's found.

    +

    Usage:

    +
      include(SearchProgramFilesForOpenSceneGraph OPTIONAL)
    +


    +

    Requires these CMake modules:

    +
      ListFilter
    ProgramFilesGlob
    +


    +

    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)

    + +
  • +
  • + SetDefaultBuildType: Set a developer-chosen default build type
    +


    +

    Requires these CMake modules:

    +
      no additional modules required
    +


    +

    Original Author: 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)

    + +
  • +
  • + SplitLibraryList: Given a list of libraries with OPTIMIZED, DEBUG, etc.
    +


    +
      split_library_list(_generalvar _releasevar _debugvar)
    +


    +

    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)

    + +
  • +
  • + StampSourcesWithVersion: It will only attempt a substitution within the first C-style comment block
    +


    +

    To set up your source code for proper stamping, start your file with a Doxygen-style comment block, starting with /* and ending with */ On a line by itself, with unimportant whitespace, add the standard Doxygen "version" command:

    +
      @version xxx
    +

    or

    +
      \version xxx
    +


    +

    To make sure it works, please do actually put xxx as the current version: when you save, add one of the command below to your cmake build, and run cmake, it should replace xxx with the current version. (It replaces anything between the end of the whitespace after \version and the end of the line with the version that you pass in your build script, so put nothing else on that line!)

    +

    For <version>, I recommend passing the value of a CMake variable like

    +
      ${CPACK_PACKAGE_VERSION}
    +

    Remember, reduced duplication of information means reduced errors!

    +

    WARNING! This does edit your source directory, but will only execute if the (hidden/advanced, default OFF) variable ENABLE_VERSION_STAMPING is on.

    +

    Additionally, it tries to be very careful: of your code (that is, the first /* */), but only if // is not found first

    +
      stamp_target_with_version(<version> <target_name> [HEADERS_ONLY | <source>...]) -
    If no source file is specified, all will be processed.
    +


    +
      stamp_sources_with_version(<version> <source> [<source> ...]) -
    Use for files not directly associated with a target.
    +


    +

    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)

    + +
  • +
  • + TCHARWorkaround: Script to compile Win32-developed sources using tchar without modifying the code
    +

    Requires that ${CMAKE_SOURCE_DIR}/cmake/workarounds/tchar/ be present.

    +

    TCHAR_WORKAROUND, automatically set to on when not on win32 TCHAR_INCLUDE_DIR, location of our fake tchar.h file

    +

    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)

    + +
  • +
  • + UseBackportedModules: Do a version-dependent check and auto-include backported modules dirs
    +


    +

    Name your module directories cmake-*-modules where * is the full (maj.min.patch) version number that they came from. You can use subdirectories within those directories, if you like - all directories inside of a cmake-*-modules dir for a newer version of CMake that what we're running, that contain one or more .cmake files, will be appended to the CMAKE_MODULE_PATH.

    +

    When backporting modules, be sure to test them and follow copyright instructions (usually updating copyright notices)

    +

    Requires these CMake modules:

    +
      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)

    + +
  • +
  • + UseMarkdown: Convert markdown source files to HTML as a custom target
    +


    +
      include(UseMarkdown)
    add_markdown_target(<target_name> <directory to copy to> <markdownfile> [<markdownfile>...] [RENAME <newname>])
    Relative paths for the destination directory are considered with
    with respect to CMAKE_CURRENT_BINARY_DIR. The RENAME argument is only
    valid with a single markdown file as input.
    +


    +


    +
      install_markdown_target(<target_name> [extra arguments to INSTALL(FILES ...) ])
    +


    +


    +

    Requires CMake 2.6 or newer (uses the 'function' command)

    +

    Original Author: 2011 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net> http://academic.cleardefinition.com Iowa State University HCI Graduate Program/VRAC

    +

    Copyright Iowa State University 2011-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)

    + +
  • +
  • + UseTR1: Use settings to enable access to C++ TR1
    +


    +

    This calls include_directories and link_directories as needed to permit TR1 support.

    +

    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)

    + +
  • +
  • + WarningDev: Print a developer warning, using author_warning if we have cmake 2.8
    +


    +
      warning_dev("your desired message")
    +


    +

    Original Author: 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)

    + +
  • +
+

See Also

+ +

.B ccmake(1), cpack(1), ctest(1), cmakecommands(1), cmakecompat(1), cmakemodules(1), cmakeprops(1), cmakevars(1)

+ +

The following resources are available to get help using CMake:

+ + + diff --git a/lib/wiiuse/cmake/module-help.txt b/lib/wiiuse/cmake/module-help.txt new file mode 100644 index 000000000..0a219f088 --- /dev/null +++ b/lib/wiiuse/cmake/module-help.txt @@ -0,0 +1,4042 @@ +cmake version 2.8.11.1 +------------------------------------------------------------------------------ +Introduction + +module-help - Reference of available CMake custom modules. + +------------------------------------------------------------------------------ +Description + +The "cmake" executable is the CMake command-line interface. It may be used +to configure projects in scripts. Project configuration settings may be +specified on the command line with the -D option. The -i option will cause +cmake to interactively prompt for such settings. + +CMake is a cross-platform build system generator. Projects specify their +build process with platform-independent CMake listfiles included in each +directory of a source tree with the name CMakeLists.txt. Users build a +project by using CMake to generate a build system for a native tool on their +platform. + +------------------------------------------------------------------------------ +Custom CMake Modules + +The following modules are also available for CMake. They can be used with +INCLUDE(ModuleName). + + Custom CMake Modules - Additional Modules for CMake. + +This is the documentation for additional modules and scripts for CMake. +Using these modules you can check the computer system for installed software +packages, features of the compiler and the existance of headers to name just +a few. + + AboutTheseModules + Dummy module containing information about these modules for the HELP + file + + This file documents a snapshot of the cmake-modules available from + http://github.com/rpavlik/cmake-modules/ The latest version of these + modules can always be found there. Additionally, you can find + instructions on how to integrate these modules into your own project + either in the README.markdown file in this directory, or on the GitHub + page listed above (scroll to the bottom to see the README rendered + attractively). + + In short: Modules of the form "FindSomeName.cmake" are considered to + be "find modules", and are intended to be used indirectly by calling + find_package, not by calling include. Thus, you'll want to do + something like: + + find_package(SomeName) + + They define a number of variables allowing you to use whatever + software they search for, such as include directories and libraries. + A few also define some functions for your use. + + All other modules provide functionality, either immediately upon + including them, or by defining functions that perform some task of + varying utility that you can use any time after including them. Note + that if a module has the filename, for example, + cmake/BoostTestTargets.cmake, you only need to call: + + include(BoostTestTargets) + + + + For more information, see the documentation for individual modules, + the cmake-modules github page, and/or the upstream CMake documentation + at http://www.cmake.org/cmake/help/cmake-2-8-docs.html + + + + 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) + + BoostTestTargets + Add tests using boost::test + + + + Add this line to your test files in place of including a basic boost + test header: + + #include + + + + If you cannot do that and must use the included form for a given test, + include the line + + // OVERRIDE_BOOST_TEST_INCLUDED_WARNING + + in the same file with the boost test include. + + include(BoostTestTargets) + add_boost_test( SOURCES [] + [FAIL_REGULAR_EXPRESSION ] + [LAUNCHER ] + [LIBRARIES [...]] + [RESOURCES [...]] + [TESTS [...]]) + + + + If for some reason you need access to the executable target created, + it can be found in ${${testdriver_name}_TARGET_NAME} as specified when + you called add_boost_test + + + + Requires CMake 2.6 or newer (uses the 'function' command) + + Requires: GetForceIncludeDefinitions CopyResourcesToBuildTree + + 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) + + BundleOSGPlugins + Provide access to the OpenSceneGraph runtime files for bundling in + + an installation or package. + + Sets these variables: + + - OSGDB_PLUGINS_RELEASE + - OSGDB_PLUGINS_DEBUG + - OSGWRAPPER_PLUGINS_RELEASE + - OSGWRAPPER_PLUGINS_DEBUG + - OSG_RUNTIME_LIBRARY_DIR + - OSG_PATH_TO_PLUGINS + + + + Creates this function: + + - install_osg_plugins( {varNameForOutputFilenames} ) + + + + Requires these CMake modules: + + no additional modules required + + + + 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) + + BundleOSGRuntime + Include the OpenSceneGraph runtime files in an installation or built + package. + + + + OSGRUNTIME_BUNDLE - Set to "yes" to enable this behavior + OSGRUNTIME_zlib1dll - Must be set to the location of zlib1.dll on Windows + OSGRUNTIME_zlib1ddll - Can be set to the location of zlib1d.dll (debug) on Windows. + If set, will be installed. + + + + Requires these CMake modules: + + no additional modules required + + + + 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) + + BundleVRJ22Runtime + Include the VR Juggler runtime files in an installation or built + package. + + + + VRJUGGLERRUNTIME_BUNDLE + VRJUGGLERRUNTIME_BUNDLE_DEBUG - set to yes to include debug dll's as well + + + + Requires these CMake modules: + + FindVRJuggler22 and its dependencies + + + + 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) + + BundleVRJ30Runtime + Include the VR Juggler runtime files in an installation or built + package. + + + + VRJUGGLERRUNTIME_BUNDLE + VRJUGGLERRUNTIME_BUNDLE_DEBUG - set to yes to include debug dll's as well + + + + Requires these CMake modules: + + FindVRJuggler22 and its dependencies + + + + Original Author: 2009-2010 Ryan Pavlik + http://academic.cleardefinition.com Iowa State + University HCI Graduate Program/VRAC Updated for VR Juggler 3.0 by: + Brandon Newendorp + + CheckMacHIDAPI + Script to check if the signature for a mac HID callback uses UInt32 or + uint32_t + + Requires that the associated CPP file be present: CheckMacHIDAPI.cpp. + + MACOSX_HID_UINT32T, set according to the results of our test. + + Use add_definitions(-DMACOSX_HID_UINT32T=${MACOSX_HID_UINT32T}) in + your listfile and the following prototype for the function you'd like + to register using setInterruptReportHandlerCallback: + + void ReaderReportCallback( + void *target, + IOReturn result, + void *refcon, + void *sender, + MACOSX_HID_UINT32T size + ) + + + + 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) + + CheckVersion + Utility function for Find modules considering multiple possible + versions + + + + Requires these CMake modules: + + no additional modules required + + + + 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) + + CleanDirectoryList + Removes duplicate entries and non-directories from a provided list + + + + clean_directory_list( [...]) + + + + 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) + + CleanLibraryList + A smarter replacement for list(REMOVE_DUPLICATES) for library lists + + + + Note that, in the case of cyclic link dependencies, you _do_ actually + need a library in a list multiple times. So, only use this function + when you know that the dependency graph is acyclic. + + clean_library_list( [...]) - where + listvar is the name of a destination variable, and also possibly a source, and + it is followed by any number (including 0) of additional libraries to append + to the list before processing. + + + + Removes duplicates from the list, leaving only the last instance, + while preserving the meaning of the "optimized", "debug", and + "general" labeling. (Libraries listed as general are listed in the + result instead as optimized and debug) + + 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) + + CopyResourcesToBuildTree + Copy the resources your app needs to the build tree. + + + + copy_resources_to_build_tree() + + + + 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) + + CppcheckTargets + Run cppcheck on c++ source files as a custom target and a test + + + + include(CppcheckTargets) + add_cppcheck( [UNUSED_FUNCTIONS] [STYLE] [POSSIBLE_ERROR] [FAIL_ON_WARNINGS]) - + Create a target to check a target's sources with cppcheck and the indicated options + add_cppcheck_sources( [UNUSED_FUNCTIONS] [STYLE] [POSSIBLE_ERROR] [FAIL_ON_WARNINGS]) - + Create a target to check standalone sources with cppcheck and the indicated options + + + + Requires these CMake modules: + + Findcppcheck + + + + 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) + + CreateDashboardScripts + Create ctest -S scripts to use to run dashboard builds + + + + include(CreateDashboardScripts) + create_dashboard_scripts([]) + + + + If you need additional settings to persist from the "parent" CMake + instance to the initial cache created by the dashboard script, you may + pass a filename which will be configured into the initial cache. + + In the resulting DASHBOARDSCRIPT_BASE_DIRECTORY, an end-user may + optionally create a file named + + CustomInitialCache.${DASHBOARDSCRIPT_SCRIPT_NAME} + + (by default, CustomInitialCache.go.cmake) containing set commands that + use the CACHE option, to set up additional site-local cache variable + values. + + Requires these CMake modules: + + GetCompilerInfoString + + + + 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) + + CreateImportedTarget + A smarter replacement for list(REMOVE_DUPLICATES) for library lists + + + + create_imported_target( [SHARED|STATIC|MODULE] [...]) - where + ${libname}_LIBRARIES is set to this library's paths. + + + + Removes duplicates from the list then sorts while preserving + "optimized", "debug", and "general" labeling + + 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) + + CreateLaunchers + Create launchers to set working directory, env. vars, etc. + + + + include(CreateLaunchers) - to make these available + guess_runtime_library_dirs( [ ...]) + create_default_target_launcher( + [ARGS ] + [FORWARD_ARGS] + [RUNTIME_LIBRARY_DIRS ] + [WORKING_DIRECTORY ] + [ENVIRONMENT [...]]) + + + + create_target_launcher( + [ARGS ] + [FORWARD_ARGS] + [RUNTIME_LIBRARY_DIRS ] + [WORKING_DIRECTORY ] + [ENVIRONMENT [...]]) + + + + create_generic_launcher( + [RUNTIME_LIBRARY_DIRS ] + [WORKING_DIRECTORY ] + [ENVIRONMENT [...]]) + - sets GENERIC_LAUNCHER_COMMAND and GENERIC_LAUNCHER_FAIL_REGULAR_EXPRESSION + + + + Requires these CMake modules: + + ListFilter + ProgramFilesGlob + CleanDirectoryList + + + + 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) + + DoxygenTargets + Run doxygen on source files as a custom target + + + + include(DoxygenTargets) + add_doxygen( [OUTPUT_DIRECTORY ] + [INSTALL_DESTINATION + [INSTALL_COMPONENT ] + [INSTALL_PDF_NAME ] ] + [DOC_TARGET ] + [PROJECT_NUMBER ] + [NO_WARNINGS] + [NO_PDF]) + + + + Requires these CMake modules: + + FindDoxygen + + + + 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) + + EnableExtraCompilerWarnings + Add flags to compile with extra warnings + + + + enable_extra_compiler_warnings() + globally_enable_extra_compiler_warnings() - to modify CMAKE_CXX_FLAGS, etc + to change for all targets declared after the command, instead of per-command + + + + + + Original Author: 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) + + EnableProfiling + Add flags to compile with profiling support - currently only for GCC + + + + enable_profiling() + globally_enable_profiling() - to modify CMAKE_CXX_FLAGS, etc + to change for all targets declared after the command, instead of per-command + + + + + + Original Author: 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) + + FileCopyTargets + Add a target for files that just need to be copied + + + + include(FileCopyTargets) + add_file_copy_target( [...]) + Creates a custom target that copies the files to a directory, if needed. + Relative paths for the destination directory are considered with + with respect to CMAKE_CURRENT_BINARY_DIR + You can use this target in all the usual ways, including + add_dependencies(some_other_target this_target) to specify that another + target depends on this. + + + + install_file_copy_target( [arguments to INSTALL(PROGRAMS ...) ]) + Works just the same as INSTALL(PROGRAMS ...) because it wraps it to install + the files you specified in add_file_copy_target + + + + + + 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) + + FindALUT + try to find the OpenAL ALUT library + + + + Users may optionally supply: + + ALUT_ROOT_DIR - a prefix to start searching. + + + + Cache Variables: (probably not for direct use in your scripts) + + ALUT_INCLUDE_DIR + ALUT_LIBRARY + + + + Non-cache variables you might use in your CMakeLists.txt: + + ALUT_FOUND + ALUT_INCLUDE_DIRS + ALUT_LIBRARIES + ALUT_WORKAROUND_INCLUDE_DIRS - add these to your include path with + include_directories(${ALUT_WORKAROUND_INCLUDE_DIRS} ${ALUT_INCLUDE_DIRS}) + so you can always #include and #include even on + Mac where the paths might differ. + + + + 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) + + FindAdrienne + try to find Adrienne Electronics Corporation timecode card library + + + + SDK available from the manufacturer: http://www.adrielec.com/ + + Cache Variables: (probably not for direct use in your scripts) + + ADRIENNE_INCLUDE_DIR + ADRIENNE_LIBRARY + ADRIENNE_RUNTIME_LIBRARY + ADRIENNE_INCLUDE_FILE + + + + Variables you might use in your CMakeLists.txt: + + ADRIENNE_FOUND + ADRIENNE_INCLUDE_DIRS + ADRIENNE_LIBRARIES + ADRIENNE_RUNTIME_LIBRARIES - the AEC_NTTC.dll file + ADRIENNE_RUNTIME_LIBRARY_DIRS + + + + ADRIENNE_INCLUDE_FILENAME - this is probably AEC_NTTC.h, but it might also + be AECINTTC.H. + + + + ADRIENNE_INCLUDE_HAS_EXTERN_C - Some (most) versions of the header already + wrap their definitions in extern "C" { }, but some do not. + + + + ADRIENNE_DEFINITIONS - defines a quoted ADRIENNE_INCLUDE_FILENAME as above, + so you can write a line like #include ADRIENNE_INCLUDE_FILENAME + Also defines ADRIENNE_BEFORE_INCLUDE and ADRIENNE_AFTER_INCLUDE to handle + adding extern "C" { and } if the header file doesn't do so itself. + + + + Variables that might be set by the user in the gui/command line to + help find the library: + + ADRIENNE_ROOT_DIR - root of an Adrienne CD, disk, or extracted/copied contents + thereof. + + + + Requires these CMake modules: + + FindPackageHandleStandardArgs (known included with CMake >=2.6.2) + + + + Original Author: 2012 Ryan Pavlik + http://academic.cleardefinition.com Iowa State + University HCI Graduate Program/VRAC + + Copyright Iowa State University 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) + + FindBluez + 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) + + FindCPPDOM + try to find CPPDOM library + + Optionally uses Flagpoll and FindFlagpoll.cmake + + CPPDOM_LIBRARY_DIR, library search path + CPPDOM_INCLUDE_DIR, include search path + CPPDOM_LIBRARY, the library to link against + CPPDOM_CXX_FLAGS + CPPDOM_FOUND, If false, do not try to use this library. + + + + Useful configuration variables you might want to add to your cache: + + CPPDOM_ROOT_DIR - A directory prefix to search + (a path that contains include/ as a subdirectory) + CPPDOM_ADDITIONAL_VERSIONS - Additional versions (outside of 0.7.8 to 1.2.0) + to use when constructing search names and paths + + + + This script will use Flagpoll, if found, to provide hints to the + location of this library, but does not use the compiler flags returned + by Flagpoll directly. + + VR Juggler requires this package, so this Find script takes that into + account when determining where to search for the desired files. The + VJ_BASE_DIR environment variable is searched (preferentially) when + searching for this package, so most sane VR Juggler build environments + should "just work." Note that you need to manually re-run CMake if you + change this environment variable, because it cannot auto-detect this + change and trigger an automatic re-run. + + Original Author: 2009-2012 Ryan Pavlik + 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) + + FindDCubed + try to find DCUBED library + + + + DCUBED_LIBRARY_DIR, library search path + DCUBED_INCLUDE_DIR, include search path + DCUBED_{component}_LIBRARY, the library to link against + DCUBED_ENVIRONMENT + DCUBED_FOUND, If false, do not try to use this library. + + + + Plural versions refer to this library and its dependencies, and are + recommended to be used instead, unless you have a good reason. + + Useful configuration variables you might want to add to your cache: + + DCUBED_ROOT_DIR - A directory prefix to search + (a path that contains include/ as a subdirectory) + + + + 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) + + FindDirectInput + try to find DirectInput library (part of DirectX SDK) + + + + Cache Variables: (probably not for direct use in your scripts) + + DIRECTINPUT_DXGUID_LIBRARY + DIRECTINPUT_DXERR_LIBRARY + DIRECTINPUT_DINPUT_LIBRARY + DIRECTINPUT_INCLUDE_DIR + + + + Non-cache variables you should use in your CMakeLists.txt: + + DIRECTINPUT_LIBRARIES + DIRECTINPUT_INCLUDE_DIRS + DIRECTINPUT_FOUND - if this is not true, do not attempt to use this library + + + + Requires these CMake modules: + + FindPackageHandleStandardArgs (known included with CMake >=2.6.2) + + + + Original Author: 2011 Ryan Pavlik + http://academic.cleardefinition.com Iowa State + University HCI Graduate Program/VRAC + + Copyright Iowa State University 2011. 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) + + FindDirectShow + Find Microsoft DirectShow sample files, library, and headers. + + + + DIRECTSHOW_INCLUDE_DIRS - where to find needed include file + DIRECTSHOW_BASECLASS_DIR- Directory containing the DirectShow baseclass sample code. + DIRECTSHOW_FOUND - True if DirectShow found. + + + + Requires these CMake modules: + + FindPackageHandleStandardArgs (known included with CMake >=2.6.2) + + + + Initially in VRPN - Distributed under the Boost Software License, + Version 1.0. + + Almost entirely re-written by: 2012 Ryan Pavlik + http://academic.cleardefinition.com Iowa State + University HCI Graduate Program/VRAC + + Copyright Iowa State University 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) + + FindDirectX + try to find part of DirectX SDK + + + + Cache Variables: (probably not for direct use in your scripts) + + DIRECTX_INCLUDE_DIR + + + + Variables you should use in your CMakeLists.txt: + + DIRECTX_DXGUID_LIBRARY + DIRECTX_DXERR_LIBRARY + DIRECTX_DINPUT_LIBRARY + DIRECTX_DINPUT_INCLUDE_DIR + DIRECTX_D3D9_LIBRARY + DIRECTX_D3DXOF_LIBRARY + DIRECTX_D3DX9_LIBRARIES + DIRECTX_INCLUDE_DIRS + DIRECTX_FOUND - if this is not true, do not attempt to use this library + + + + Requires these CMake modules: + + FindPackageHandleStandardArgs (known included with CMake >=2.6.2) + SelectLibraryConfigurations + + + + Original Author: 2012 Ryan Pavlik + http://academic.cleardefinition.com Iowa State + University HCI Graduate Program/VRAC + + Copyright Iowa State University 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) + + FindFlagpoll + try to find Flagpoll application, and offer package-finding services + + FLAGPOLL, the executable: if not defined, do not try to use Flagpoll. + + + + Useful configuration variables you might want to add to your cache: + + FLAGPOLL_ROOT_DIR - A directory prefix to search for the app + (a path that contains bin/ as a subdirectory) + + + + VR Juggler requires this package, so this Find script takes that into + account when determining where to search for the desired files. The + VJ_BASE_DIR environment variable is searched (preferentially) when + searching for this package, so most sane VR Juggler build environments + should "just work." Note that you need to manually re-run CMake if you + change this environment variable, because it cannot auto-detect this + change and trigger an automatic re-run. + + You can use Flagpoll to provide directories to use as HINTS for find_* + These are the provided macros: + + flagpoll_get_include_dirs + flagpoll_get_library_dirs + flagpoll_get_library_names + flagpoll_get_extra_libs + + All take the name of the desired package, optionally NO_DEPS to pass + --no-deps to Flagpoll, and return + yourpkgname_FLAGPOLL_INCLUDE_DIRS(etc. for the other macros). + + Example usage: flagpoll_get_include_dirs(vpr NO_DEPS) + find_path(VPR20_INCLUDE_DIRS vpr/vpr.h + + HINTS ${vpr_FLAGPOLL_INCLUDE_DIRS}) + + + + 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) + + FindGDB + Try to find GDB + + + + Once done, this will define: + + GDB_FOUND - system has GDB + GDB_COMMAND - the command to run + GDB_VERSION - version + GDB_HAS_RETURN_CHILD_RESULT - if the --return-child-result flag is supported + + + + Useful configuration variables you might want to add to your cache: + + GDB_ROOT_DIR - A directory prefix to search + + + + 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) + + FindGHOST + try to find Sensable GHOST library and include files + + GHOST_INCLUDE_DIRS, where to find GL/glut.h, etc. + GHOST_LIBRARIES, the libraries to link against + GHOST_FOUND, If false, do not try to use GLUT. + GHOST_RUNTIME_LIBRARY_DIRS, path to DLL on Windows for runtime use. + + + + Requires these CMake modules: + + no additional modules required + + + + 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) + + FindGLUI + Try to find GLUI (GL User Interface) + + Requires OpenGL and GLUT - searches for them using find_package Once + done, this will define + + GLUI_INCLUDE_DIR, where to find GL/glui.h (or GLUI/glui.h on mac) + GLUI_LIBRARY, the libraries to link against GLUI_FOUND, If false, do + not try to use GLUI. + + Plural versions refer to this library and its dependencies, and are + recommended to be used instead, unless you have a good reason. + + Useful configuration variables you might want to add to your cache: + + GLUI_ROOT_DIR - A directory prefix to search + (usually a path that contains include/ as a subdirectory) + + + + 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) + + FindGLUT + try to find glut library and include files + + GLUT_INCLUDE_DIRS, where to find GL/glut.h, etc. + GLUT_LIBRARIES, the libraries to link against + GLUT_FOUND, If false, do not try to use GLUT. + GLUT_RUNTIME_LIBRARY_DIRS, path to DLL on Windows for runtime use. + GLUT_RUNTIME_LIBRARY, dll on Windows, for installation purposes + + + + Also defined, but not for general use are: + + GLUT_INCLUDE_DIR, where to find GL/glut.h, etc. + GLUT_glut_LIBRARY = the full path to the glut library. + + + FindGMTL + Try to find GMTL + + Optionally uses Flagpoll and FindFlagpoll.cmake Once done, this will + define + + GMTL_FOUND - system has GMTL + GMTL_INCLUDE_DIR - the GMTL include directory + + + + Useful configuration variables you might want to add to your cache: + + GMTL_ROOT_DIR - A directory prefix to search + (a path that contains include/ as a subdirectory) + GMTL_ADDITIONAL_VERSIONS - Additional versions (outside of 0.5.1 to 0.7.0) + to use when constructing search names and paths + + + + This script will use Flagpoll, if found, to provide hints to the + location of this library, but does not use the compiler flags returned + by Flagpoll directly. + + VR Juggler requires this package, so this Find script takes that into + account when determining where to search for the desired files. The + VJ_BASE_DIR environment variable is searched (preferentially) when + searching for this package, so most sane VR Juggler build environments + should "just work." Note that you need to manually re-run CMake if you + change this environment variable, because it cannot auto-detect this + change and trigger an automatic re-run. + + Original Author: 2009-2012 Ryan Pavlik + 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) + + FindGPM + try to find GPM library + + + + Cache Variables: (probably not for direct use in your scripts) + + GPM_INCLUDE_DIR + GPM_LIBRARY + + + + Non-cache variables you might use in your CMakeLists.txt: + + GPM_FOUND + GPM_INCLUDE_DIRS + GPM_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) + + FindGadgeteer12 + try to find Gadgeteer 1.2 library + + Requires JCCL 1.2 and VPR 2.0 (thus FindJCCL12.cmake and + FindVPR20.cmake) Requires X11 if not on Mac or Windows. Optionally + uses Flagpoll and FindFlagpoll.cmake + + This library is a part of VR Juggler 2.2 - you probably want to use + find_package(VRJuggler22) instead, for an easy interface to this and + related scripts. See FindVRJuggler22.cmake for more information. + + GADGETEER12_LIBRARY_DIR, library search path + GADGETEER12_INCLUDE_DIR, include search path + GADGETEER12_LIBRARY, the library to link against + GADGETEER12_FOUND, If false, do not try to use this library. + + + + Plural versions refer to this library and its dependencies, and are + recommended to be used instead, unless you have a good reason. + + Useful configuration variables you might want to add to your cache: + + GADGETEER12_ROOT_DIR - A directory prefix to search + (a path that contains include/ as a subdirectory) + + + + This script will use Flagpoll, if found, to provide hints to the + location of this library, but does not use the compiler flags returned + by Flagpoll directly. + + The VJ_BASE_DIR environment variable is also searched (preferentially) + when searching for this component, so most sane build environments + should "just work." Note that you need to manually re-run CMake if you + change this environment variable, because it cannot auto-detect this + change and trigger an automatic re-run. + + 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) + + FindGadgeteer20 + try to find Gadgeteer 2.0 library + + Requires JCCL 1.4 and VPR 2.2 (thus FindJCCL14.cmake and + FindVPR22.cmake) Requires X11 if not on Mac or Windows. Optionally + uses Flagpoll and FindFlagpoll.cmake + + This library is a part of VR Juggler 3.0 - you probably want to use + find_package(VRJuggler30) instead, for an easy interface to this and + related scripts. See FindVRJuggler30.cmake for more information. + + GADGETEER20_LIBRARY_DIR, library search path + GADGETEER20_INCLUDE_DIR, include search path + GADGETEER20_LIBRARY, the library to link against + GADGETEER20_FOUND, If false, do not try to use this library. + + + + Plural versions refer to this library and its dependencies, and are + recommended to be used instead, unless you have a good reason. + + Useful configuration variables you might want to add to your cache: + + GADGETEER20_ROOT_DIR - A directory prefix to search + (a path that contains include/ as a subdirectory) + + + + This script will use Flagpoll, if found, to provide hints to the + location of this library, but does not use the compiler flags returned + by Flagpoll directly. + + The VJ_BASE_DIR environment variable is also searched (preferentially) + when searching for this component, so most sane build environments + should "just work." Note that you need to manually re-run CMake if you + change this environment variable, because it cannot auto-detect this + change and trigger an automatic re-run. + + Original Author: 2009-2010 Ryan Pavlik + http://academic.cleardefinition.com Iowa State + University HCI Graduate Program/VRAC Updated for VR Juggler 3.0 by: + Brandon Newendorp + + FindGlove5DT + try to find Glove5DT libraries + + + + Cache Variables: (probably not for direct use in your scripts) + + GLOVE5DT_INCLUDE_DIR + GLOVE5DT_LIBRARY + GLOVE5DT_LIBRARY_RELEASE + GLOVE5DT_LIBRARY_DEBUG + GLOVE5DT_RUNTIME_LIBRARY_RELEASE + GLOVE5DT_RUNTIME_LIBRARY_DEBUG + + + + Non-cache variables you might use in your CMakeLists.txt: + + GLOVE5DT_FOUND + GLOVE5DT_INCLUDE_DIRS + GLOVE5DT_LIBRARIES + GLOVE5DT_RUNTIME_LIBRARY_DIRS + + + + Requires these CMake modules: + + CleanDirectoryList + CleanLibraryList + ListCombinations + ProgramFilesGlob + SelectLibraryConfigurations (included with CMake >=2.8.0) + 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) + + FindHIDAPI + try to find HIDAPI library + + from http://www.signal11.us/oss/hidapi/ + + Cache Variables: (probably not for direct use in your scripts) + + HIDAPI_INCLUDE_DIR + HIDAPI_LIBRARY + + + + Non-cache variables you might use in your CMakeLists.txt: + + HIDAPI_FOUND + HIDAPI_INCLUDE_DIRS + HIDAPI_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) + + FindIDLJ + try to find Java's IDLJ Interface Definition Language compiler. + + + + Ideally used with CMake 2.8.5 or newer for Java support using + FindJava.cmake and UseJava.cmake + + Variables: + + Java_IDLJ_COMMAND, executable for idlj + IDLJ_FOUND, If false, do not try to use this + + + + Function: + + java_idlj(varname idlfile [extra idlj args]) - Generates + the Java source files from the IDL file you indicate, and + appends filenames suitable to add to a add_jar() call to the + variable you specified. + + + + Because the files generated from an IDL file are not entirely + predictable, java_idlj runs idlj in the cmake step, rather than the + build step, and triggers a CMake re-run when an idl file is modified. + Already up-to-date generated source is not re-generated, however. + + Files are generated in a directory created specifically for the + particular IDL file and the particular call, in the build directory - + there should be no worries about overwriting files or picking up too + much with the wildcard. + + You may wish to add the IDL file to your list of sources if you want + it to appear in your IDE, but it is not necessary. + + Original Author: 2012 Ryan Pavlik + http://academic.cleardefinition.com Iowa State + University HCI Graduate Program/VRAC + + Copyright Iowa State University 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) + + FindInterSense + try to find InterSense library + + + + Cache Variables: (probably not for direct use in your scripts) + + INTERSENSE_INCLUDE_DIR + INTERSENSE_ISENSEC_DIR - location of the isense.c "import library" substitute. + INTERSENSE_LIBRARY + + + + Non-cache variables you might use in your CMakeLists.txt: + + INTERSENSE_FOUND + INTERSENSE_INCLUDE_DIRS + INTERSENSE_LIBRARIES + + + + Requires these CMake modules: + + FindPackageHandleStandardArgs (known included with CMake >=2.6.2) + + + + Author: 2013 Eric Marsh http://wemarsh.com/ + Kognitiv Neuroinformatik, Universität Bremen + + (building on Ryan Pavlik's templates) + + 2013 Ryan Pavlik + http://academic.cleardefinition.com Iowa State University HCI Graduate + Program/VRAC + + 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) + + FindJCCL12 + try to find JCCL 1.2 library + + Requires VPR 2.0 (thus FindVPR20.cmake) Optionally uses Flagpoll and + FindFlagpoll.cmake + + This library is a part of VR Juggler 2.2 - you probably want to use + find_package(VRJuggler22) instead, for an easy interface to this and + related scripts. See FindVRJuggler22.cmake for more information. + + JCCL12_LIBRARY_DIR, library search path + JCCL12_INCLUDE_DIR, include search path + JCCL12_LIBRARY, the library to link against + JCCL12_FOUND, If false, do not try to use this library. + + + + Plural versions refer to this library and its dependencies, and are + recommended to be used instead, unless you have a good reason. + + Useful configuration variables you might want to add to your cache: + + JCCL12_ROOT_DIR - A directory prefix to search + (a path that contains include/ as a subdirectory) + + + + This script will use Flagpoll, if found, to provide hints to the + location of this library, but does not use the compiler flags returned + by Flagpoll directly. + + The VJ_BASE_DIR environment variable is also searched (preferentially) + when searching for this component, so most sane build environments + should "just work." Note that you need to manually re-run CMake if you + change this environment variable, because it cannot auto-detect this + change and trigger an automatic re-run. + + 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) + + FindJCCL14 + try to find JCCL 1.4 library + + Requires VPR 2.2 (thus FindVPR22.cmake) Optionally uses Flagpoll and + FindFlagpoll.cmake + + This library is a part of VR Juggler 3.0 - you probably want to use + find_package(VRJuggler30) instead, for an easy interface to this and + related scripts. See FindVRJuggler30.cmake for more information. + + JCCL14_LIBRARY_DIR, library search path + JCCL14_INCLUDE_DIR, include search path + JCCL14_LIBRARY, the library to link against + JCCL14_FOUND, If false, do not try to use this library. + + + + Plural versions refer to this library and its dependencies, and are + recommended to be used instead, unless you have a good reason. + + Useful configuration variables you might want to add to your cache: + + JCCL14_ROOT_DIR - A directory prefix to search + (a path that contains include/ as a subdirectory) + + + + This script will use Flagpoll, if found, to provide hints to the + location of this library, but does not use the compiler flags returned + by Flagpoll directly. + + The VJ_BASE_DIR environment variable is also searched (preferentially) + when searching for this component, so most sane build environments + should "just work." Note that you need to manually re-run CMake if you + change this environment variable, because it cannot auto-detect this + change and trigger an automatic re-run. + + Original Author: 2009-2010 Ryan Pavlik + http://academic.cleardefinition.com Iowa State + University HCI Graduate Program/VRAC Updated for VR Juggler 3.0 by: + Brandon Newendorp + + FindJtTk + try to find JTTK library + + + + JTTK_LIBRARY_DIRS, library search path + JTTK_INCLUDE_DIRS, include search path + JTTK_{component}_LIBRARY, the library to link against + JTTK_ENVIRONMENT, environment variables to set + JTTK_RUNTIME_LIBRARY_DIRS + JTTK_FOUND, If false, do not try to use this library. + + + + If you have license issues, you might run this command on each + JtTk-using target: + + jttk_stamp_binary() + + + + Plural versions refer to this library and its dependencies, and are + recommended to be used instead, unless you have a good reason. + + Useful configuration variables you might want to add to your cache: + + JTTK_ROOT_DIR - A directory prefix to search + (a path that contains include/ as a subdirectory) + + + + 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) + + FindLAPACKLibs + Try to find LAPACK and BLAS libraries + + Once done, this will define + + LAPACKLIBS_LIBRARIES, all libraries to link against + LAPACKLIBS_FOUND, If false, do not try to use LAPACK library features. + + + + Users may wish to set: + + LAPACKLIBS_ROOT_DIR, location to start searching for LAPACK libraries + + + + 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) + + FindLibusb1 + try to find libusb-1 library + + + + Cache Variables: (probably not for direct use in your scripts) + + LIBUSB1_LIBRARY + LIBUSB1_INCLUDE_DIR + + + + Non-cache variables you should use in your CMakeLists.txt: + + LIBUSB1_LIBRARIES + LIBUSB1_INCLUDE_DIRS + LIBUSB1_FOUND - if this is not true, do not attempt to use this library + + + + Requires these CMake modules: + + ProgramFilesGlob + 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) + + FindLuabind + try to find Luabind + + + + Users may optionally supply: + + LUABIND_ROOT_DIR - a prefix to start searching + + + + Non-cache variables you might use in your CMakeLists.txt: + + LUABIND_FOUND + LUABIND_DEFINITIONS + LUABIND_INCLUDE_DIRS + LUABIND_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) + + FindLyX + Try to find LyX, and define some custom commands to export from LyX + + + + Once done, this will define: + + LYX_FOUND - system has LyX + LYX_COMMAND - the command to run + + + + and the following new functions: + + lyx_export( + INPUT [...] + [OUTPUT_TO_SOURCE_DIR] + [ EXTRA_DEPS [...] ]) - the base function + + + + These shortcut functions all have the same syntax: + + lyx_export_to_XXX( + INPUT [...] + [OUTPUT_TO_SOURCE_DIR] + [ EXTRA_DEPS [...] ]) + + + + Available shortcuts: + + lyx_export_to_docbook_xml + lyx_export_to_docbook + lyx_export_to_pdf + lyx_export_to_pdf_via_pdflatex + lyx_export_to_pdf_via_dvi + + + + Useful configuration variables you might want to add to your cache: + + LYX_ROOT_DIR - A directory prefix to search + + + + 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) + + FindMacHID + try to find Mac HID frameworks + + + + Cache Variables: (probably not for direct use in your scripts) + + MACHID_CoreFoundation_LIBRARY + MACHID_CoreFoundation_INCLUDE_DIR + MACHID_IOKit_LIBRARY + MACHID_IOKit_INCLUDE_DIR + MACOSX_HID_UINT32T (from CheckMacHIDAPI) + + + + Non-cache variables you should use in your CMakeLists.txt: + + MACHID_DEFINITIONS + MACHID_LIBRARIES + MACHID_INCLUDE_DIRS + MACHID_FOUND - if this is not true, do not attempt to use this library + + + + Requires these CMake modules: + + CheckMacHIDAPI + 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) + + FindMarkdown + try to find Markdown tool + + + + Cache Variables: + + MARKDOWN_EXECUTABLE + + + + Non-cache variables you might use in your CMakeLists.txt: + + MARKDOWN_FOUND + + + + Requires these CMake modules: + + FindPackageHandleStandardArgs (known included with CMake >=2.6.2) + + + + Original Author: 2011 Ryan Pavlik + http://academic.cleardefinition.com Iowa State + University HCI Graduate Program/VRAC + + Copyright Iowa State University 2011. 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) + + FindOpenCV + ------------------------------ + + See http://sourceforge.net/projects/opencvlibrary/ + + The following variable is optionally searched for defaults + + OPENCV_ROOT_DIR: Base directory of OpenCv tree to use. + + + + OPENCV_NEW_LIBRARY_NAMES Set to YES before searching if you want to + + The following are set after configuration is done: + + OPENCV_FOUND + OPENCV_INCLUDE_DIRS + OPENCV_LIBRARIES + + + + 2004/05 Jan Woetzel, Friso, Daniel Grest 2006/01 complete rewrite by + Jan Woetzel 2006/09 2nd rewrite introducing ROOT_DIR and PATH_SUFFIXES + + to handle multiple installed versions gracefully by Jan Woetzel + + 2010/02 Ryan Pavlik (Iowa State University) - partial rewrite to + standardize + + tested with: + + www.mip.informatik.uni-kiel.de/~jw academic.cleardefinition.com + + FindOpenHaptics + try to find OpenHaptics libraries + + + + Cache Variables: (probably not for direct use in your scripts) + + HDAPI_INCLUDE_DIR + HDAPI_LIBRARY + HDAPI_LIBRARY_RELEASE + HDAPI_LIBRARY_DEBUG + HDAPI_HDU_INCLUDE_DIR + HDAPI_HDU_LIBRARY + HDAPI_HDU_LIBRARY_RELEASE + HDAPI_HDU_LIBRARY_DEBUG + HLAPI_INCLUDE_DIR + HLAPI_LIBRARY + HLAPI_LIBRARY_RELEASE + HLAPI_LIBRARY_DEBUG + HLAPI_HLU_INCLUDE_DIR + HLAPI_HLU_LIBRARY + HLAPI_HLU_LIBRARY_RELEASE + HLAPI_HLU_LIBRARY_DEBUG + + + + Non-cache variables you might use in your CMakeLists.txt: + + OPENHAPTICS_FOUND + HDAPI_INCLUDE_DIRS + HDAPI_LIBRARIES + HDAPI_HDU_INCLUDE_DIRS + HDAPI_HDU_LIBRARIES + HLAPI_INCLUDE_DIRS + HLAPI_LIBRARIES + HLAPI_HLU_INCLUDE_DIRS + HLAPI_HLU_LIBRARIES + OPENHAPTICS_LIBRARIES - includes HD, HDU, HL, HLU + OPENHAPTICS_RUNTIME_LIBRARY_DIRS + OPENHAPTICS_ENVIRONMENT + OPENHAPTICS_LIBRARY_DIRS + OPENHAPTICS_INCLUDE_DIRS + + + + Requires these CMake modules: + + CleanDirectoryList + CleanLibraryList + ListCombinations + ProgramFilesGlob + SelectLibraryConfigurations (included with CMake >=2.8.0) + FindPackageHandleStandardArgs (known included with CMake >=2.6.2) + CMake 2.6.3 (uses "unset") + + + + Original Author: 2009-2012 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) + + FindParasolid + try to find PARASOLID library + + Important note: If you are also using JtTk, do your + + find_package(JtTk) + + first, to avoid runtime PK_* errors! + + PARASOLID_LIBRARY_DIR, library search path + PARASOLID_INCLUDE_DIR, include search path + PARASOLID_{component}_LIBRARY, the library to link against + PARASOLID_FOUND, If false, do not try to use this library. + + + + Plural versions refer to this library and its dependencies, and are + recommended to be used instead, unless you have a good reason. + + Requires these CMake modules: + + CheckVersion + ListCombinations + ProgramFilesGlob + 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) + + FindPerformer + try to find the OpenGL Performer library + + + + Users may optionally supply: + + PERFORMER_ROOT_DIR - a prefix to start searching. + + + + Cache Variables: (probably not for direct use in your scripts) + + PERFORMER_INCLUDE_DIR + PERFORMER_LIBRARY + PERFORMER_PFUI_LIBRARY - doesn't get included in PERFORMER_LIBRARIES + PERFORMER_PFDU_UTIL_LIBRARY - doesn't get included in PERFORMER_LIBRARIES + PERFORMER_PFV_LIBRARY - doesn't get included in PERFORMER_LIBRARIES + + + + Non-cache variables you might use in your CMakeLists.txt: + + PERFORMER_FOUND + PERFORMER_INCLUDE_DIRS + PERFORMER_LIBRARIES + PERFORMER_RUNTIME_LIBRARY_DIRS + + + + Requires these CMake modules: + + FindPackageHandleStandardArgs (known included with CMake >=2.6.2) + + + + Original Author: 2012 Ryan Pavlik + http://academic.cleardefinition.com Iowa State + University HCI Graduate Program/VRAC + + Copyright Iowa State University 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) + + FindPerlModules + try to find perl modules, passed as COMPONENTS + + + + Non-cache variable you might use in your CMakeLists.txt: + + PERLMODULES_FOUND + + + + Requires these CMake modules: + + FindPackageHandleStandardArgs (known included with CMake >=2.6.2) + + + + Original Author: 2012 Ryan Pavlik + http://academic.cleardefinition.com Iowa State + University HCI Graduate Program/VRAC + + Copyright Iowa State University 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) + + FindQVRPN + try to find QVRPN library + + + + Of course, you may also just choose to make QVRPN a submodule of your + project itself. + + Cache Variables: + + QVRPN_LIBRARY + QVRPN_INCLUDE_DIR + + + + Non-cache variables you might use in your CMakeLists.txt: + + QVRPN_FOUND + QVRPN_LIBRARIES + QVRPN_INCLUDE_DIRS + + + + QVRPN_ROOT_DIR is searched preferentially for these files + + Requires these CMake modules: + + FindPackageHandleStandardArgs (known included with CMake >=2.6.2) + + + + Refactored from FindVRPN.cmake by: Juan Sebastian Casallas + + + FindVRPN.cmake Original Author: 2009-2010 Ryan Pavlik + + 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) + + FindSonix12 + try to find Sonix 1.2 library + + Requires VPR 2.0 and GMTL (thus FindVPR20.cmake and FindGMTL.cmake) + Optionally uses Flagpoll and FindFlagpoll.cmake + + This library is a part of VR Juggler 2.2 - you probably want to use + find_package(VRJuggler22) instead, for an easy interface to this and + related scripts. See FindVRJuggler22.cmake for more information. + + SONIX12_LIBRARY_DIR, library search path + SONIX12_INCLUDE_DIR, include search path + SONIX12_LIBRARY, the library to link against + SONIX12_FOUND, If false, do not try to use this library. + + + + Plural versions refer to this library and its dependencies, and are + recommended to be used instead, unless you have a good reason. + + Useful configuration variables you might want to add to your cache: + + SONIX12_ROOT_DIR - A directory prefix to search + (a path that contains include/ as a subdirectory) + + + + This script will use Flagpoll, if found, to provide hints to the + location of this library, but does not use the compiler flags returned + by Flagpoll directly. + + The VJ_BASE_DIR environment variable is also searched (preferentially) + when searching for this component, so most sane build environments + should "just work." Note that you need to manually re-run CMake if you + change this environment variable, because it cannot auto-detect this + change and trigger an automatic re-run. + + 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) + + FindSonix14 + try to find Sonix 1.4 library + + Requires VPR 2.2 and GMTL (thus FindVPR22.cmake and FindGMTL.cmake) + Optionally uses Flagpoll and FindFlagpoll.cmake + + This library is a part of VR Juggler 3.0 - you probably want to use + find_package(VRJuggler30) instead, for an easy interface to this and + related scripts. See FindVRJuggler30.cmake for more information. + + SONIX14_LIBRARY_DIR, library search path + SONIX14_INCLUDE_DIR, include search path + SONIX14_LIBRARY, the library to link against + SONIX14_FOUND, If false, do not try to use this library. + + + + Plural versions refer to this library and its dependencies, and are + recommended to be used instead, unless you have a good reason. + + Useful configuration variables you might want to add to your cache: + + SONIX14_ROOT_DIR - A directory prefix to search + (a path that contains include/ as a subdirectory) + + + + This script will use Flagpoll, if found, to provide hints to the + location of this library, but does not use the compiler flags returned + by Flagpoll directly. + + The VJ_BASE_DIR environment variable is also searched (preferentially) + when searching for this component, so most sane build environments + should "just work." Note that you need to manually re-run CMake if you + change this environment variable, because it cannot auto-detect this + change and trigger an automatic re-run. + + Original Author: 2009-2010 Ryan Pavlik + http://academic.cleardefinition.com Iowa State + University HCI Graduate Program/VRAC Updated for VR Juggler 3.0 by: + Brandon Newendorp + + FindTR1 + Try to find C++ TR1 headers and libraries + + Once done, this will define + + TR1_USE_FILE, which you may "include" in your CMake file to be able + to use TR1 features transparently + TR1_INCLUDE_DIRS, any directories needed to access TR1 headers + TR1_LIBRARY_DIRS, any directories needed to access (auto-link) TR1 libraries + TR1_FOUND, If false, do not try to use TR1 features. + + + + If TR1 features are not built-in, we will try to use Boost to + substitute for them. + + 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) + + FindTooN + try to find TooN headers + + + + Users may optionally supply: + + TOON_ROOT_DIR - a prefix to start searching for the toon headers. + + + + Cache Variables: (probably not for direct use in your scripts) + + TOON_INCLUDE_DIR + + + + Non-cache variables you might use in your CMakeLists.txt: + + TOON_FOUND + TOON_INCLUDE_DIRS + TOON_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) + + FindTooNtag + try to find tag algorithm library (built on TooN) + + + + Users may optionally supply: + + TAG_ROOT_DIR - a prefix to start searching for the toon headers. + + + + Cache Variables: (probably not for direct use in your scripts) + + TAG_INCLUDE_DIR + TAG_LIBRARY + + + + Non-cache variables you might use in your CMakeLists.txt: + + TOONTAG_FOUND + TOONTAG_INCLUDE_DIRS + TOONTAG_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) + + FindTweek12 + try to find Tweek 1.2 library + + Requires VPR 2.0 (thus FindVPR20.cmake) Optionally uses Flagpoll and + FindFlagpoll.cmake + + This library is a part of VR Juggler 2.2 - you probably want to use + find_package(VRJuggler22) instead, for an easy interface to this and + related scripts. See FindVRJuggler22.cmake for more information. + + TWEEK12_LIBRARY_DIR, library search path + TWEEK12_INCLUDE_DIR, include search path + TWEEK12_LIBRARY, the library to link against + TWEEK12_FOUND, If false, do not try to use this library. + + + + Plural versions refer to this library and its dependencies, and are + recommended to be used instead, unless you have a good reason. + + Useful configuration variables you might want to add to your cache: + + TWEEK12_ROOT_DIR - A directory prefix to search + (a path that contains include/ as a subdirectory) + + + + This script will use Flagpoll, if found, to provide hints to the + location of this library, but does not use the compiler flags returned + by Flagpoll directly. + + The VJ_BASE_DIR environment variable is also searched (preferentially) + when searching for this component, so most sane build environments + should "just work." Note that you need to manually re-run CMake if you + change this environment variable, because it cannot auto-detect this + change and trigger an automatic re-run. + + 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) + + FindTweek14 + try to find Tweek 1.4 library + + Requires VPR 2.2 (thus FindVPR22.cmake) Optionally uses Flagpoll and + FindFlagpoll.cmake + + This library is a part of VR Juggler 3.0 - you probably want to use + find_package(VRJuggler30) instead, for an easy interface to this and + related scripts. See FindVRJuggler30.cmake for more information. + + TWEEK14_LIBRARY_DIR, library search path + TWEEK14_INCLUDE_DIR, include search path + TWEEK14_LIBRARY, the library to link against + TWEEK14_FOUND, If false, do not try to use this library. + + + + Plural versions refer to this library and its dependencies, and are + recommended to be used instead, unless you have a good reason. + + Useful configuration variables you might want to add to your cache: + + TWEEK14_ROOT_DIR - A directory prefix to search + (a path that contains include/ as a subdirectory) + + + + This script will use Flagpoll, if found, to provide hints to the + location of this library, but does not use the compiler flags returned + by Flagpoll directly. + + The VJ_BASE_DIR environment variable is also searched (preferentially) + when searching for this component, so most sane build environments + should "just work." Note that you need to manually re-run CMake if you + change this environment variable, because it cannot auto-detect this + change and trigger an automatic re-run. + + Original Author: 2009-2010 Ryan Pavlik + http://academic.cleardefinition.com Iowa State + University HCI Graduate Program/VRAC Updated for VR Juggler 3.0 by: + Brandon Newendorp + + FindVPR20 + try to find VPR 2.0 library + + Requires Boost 1.33.1 or greater (including filesystem and signals + libraries) (and thus FindBoost.cmake from 2.8rc3 or newer, preferably) + Requires NSPR4 (and PLC4) on Windows Requires pthreads on Unix (Mac or + Linux) Requires libuuid on Linux Optionally uses Flagpoll and + FindFlagpoll.cmake + + This library is a part of VR Juggler 2.2 - you probably want to use + find_package(VRJuggler22) instead, for an easy interface to this and + related scripts. See FindVRJuggler22.cmake for more information. + + VPR20_LIBRARY_DIR, library search path + VPR20_INCLUDE_DIR, include search path + VPR20_LIBRARY, the library to link against + VPR20_FOUND, If false, do not try to use this library. + + + + Plural versions refer to this library and its dependencies, and are + recommended to be used instead, unless you have a good reason. + + Useful configuration variables you might want to add to your cache: + + VPR20_ROOT_DIR - A directory prefix to search + (a path that contains include/ as a subdirectory) + + + + This script will use Flagpoll, if found, to provide hints to the + location of this library, but does not use the compiler flags returned + by Flagpoll directly. + + The VJ_BASE_DIR environment variable is also searched (preferentially) + when searching for this component, so most sane build environments + should "just work." Note that you need to manually re-run CMake if you + change this environment variable, because it cannot auto-detect this + change and trigger an automatic re-run. + + 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) + + FindVPR22 + try to find VPR 2.2 library + + Requires Boost 1.33.1 or greater (including filesystem and signals + libraries) (and thus FindBoost.cmake from 2.8rc3 or newer, preferably) + Requires NSPR4 (and PLC4) on Windows Requires pthreads on Unix (Mac or + Linux) Requires libuuid on Linux Optionally uses Flagpoll and + FindFlagpoll.cmake + + This library is a part of VR Juggler 3.0 - you probably want to use + find_package(VRJuggler30) instead, for an easy interface to this and + related scripts. See FindVRJuggler30.cmake for more information. + + VPR22_LIBRARY_DIR, library search path + VPR22_INCLUDE_DIR, include search path + VPR22_LIBRARY, the library to link against + VPR22_FOUND, If false, do not try to use this library. + + + + Plural versions refer to this library and its dependencies, and are + recommended to be used instead, unless you have a good reason. + + Useful configuration variables you might want to add to your cache: + + VPR22_ROOT_DIR - A directory prefix to search + (a path that contains include/ as a subdirectory) + + + + This script will use Flagpoll, if found, to provide hints to the + location of this library, but does not use the compiler flags returned + by Flagpoll directly. + + The VJ_BASE_DIR environment variable is also searched (preferentially) + when searching for this component, so most sane build environments + should "just work." Note that you need to manually re-run CMake if you + change this environment variable, because it cannot auto-detect this + change and trigger an automatic re-run. + + Original Author: 2009-2010 Ryan Pavlik + http://academic.cleardefinition.com Iowa State + University HCI Graduate Program/VRAC Updated for VR Juggler 3.0 by: + Brandon Newendorp + + FindVPS + try to find VPS library + + + + VPS_LIBRARY_DIR, library search path + VPS_INCLUDE_DIR, include search path + VPS_{component}_LIBRARY, the library to link against + VPS_FOUND, If false, do not try to use this library. + + + + Plural versions refer to this library and its dependencies, and are + recommended to be used instead, unless you have a good reason. + + Useful configuration variables you might want to add to your cache: + + VPS_ROOT_DIR - A directory prefix to search + (a path that contains include/ as a subdirectory) + + + + 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) + + FindVRJ22 + try to find VR Juggler 2.2 core library + + Requires JCCL 1.2, Gadgeteer 1.2, VPR 2.0, and Sonix 1.2 (thus + FindJCCL12.cmake, FindGadgeteer12.cmake, FindVPR20.cmake, and + FindSonix12.cmake) Requires X11 if not on Mac or Windows. Optionally + uses Flagpoll and FindFlagpoll.cmake + + This library is a part of VR Juggler 2.2 - you probably want to use + find_package(VRJuggler22) instead, for an easy interface to this and + related scripts. See FindVRJuggler22.cmake for more information. + + VRJ22_LIBRARY_DIR, library search path + VRJ22_INCLUDE_DIR, include search path + VRJ22_LIBRARY, the library to link against + VRJ22_FOUND, If false, do not try to use this library. + + + + Plural versions refer to this library and its dependencies, and are + recommended to be used instead, unless you have a good reason. + + Useful configuration variables you might want to add to your cache: + + VRJ22_ROOT_DIR - A directory prefix to search + (a path that contains include/ as a subdirectory) + + + + This script will use Flagpoll, if found, to provide hints to the + location of this library, but does not use the compiler flags returned + by Flagpoll directly. + + The VJ_BASE_DIR environment variable is also searched (preferentially) + when searching for this component, so most sane build environments + should "just work." Note that you need to manually re-run CMake if you + change this environment variable, because it cannot auto-detect this + change and trigger an automatic re-run. + + 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) + + FindVRJ30 + try to find VR Juggler 3.0 core library + + Requires JCCL 1.4, Gadgeteer 1.4, VPR 2.2, and Sonix 1.4 (thus + FindJCCL14.cmake, FindGadgeteer20.cmake, FindVPR22.cmake, and + FindSonix14.cmake) Requires X11 if not on Mac or Windows. Optionally + uses Flagpoll and FindFlagpoll.cmake + + This library is a part of VR Juggler 3.0 - you probably want to use + find_package(VRJuggler30) instead, for an easy interface to this and + related scripts. See FindVRJuggler30.cmake for more information. + + VRJ30_LIBRARY_DIR, library search path + VRJ30_INCLUDE_DIR, include search path + VRJ30_LIBRARY, the library to link against + VRJ30_FOUND, If false, do not try to use this library. + + + + Plural versions refer to this library and its dependencies, and are + recommended to be used instead, unless you have a good reason. + + Useful configuration variables you might want to add to your cache: + + VRJ30_ROOT_DIR - A directory prefix to search + (a path that contains include/ as a subdirectory) + + + + This script will use Flagpoll, if found, to provide hints to the + location of this library, but does not use the compiler flags returned + by Flagpoll directly. + + The VJ_BASE_DIR environment variable is also searched (preferentially) + when searching for this component, so most sane build environments + should "just work." Note that you need to manually re-run CMake if you + change this environment variable, because it cannot auto-detect this + change and trigger an automatic re-run. + + Original Author: 2009-2010 Ryan Pavlik + http://academic.cleardefinition.com Iowa State + University HCI Graduate Program/VRAC Updated for VR Juggler 3.0 by: + Brandon Newendorp + + 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) + + FindVRJOGL22 + try to find VRJuggler 2.2 OpenGL library + + Requires VRJ core 2.2 (thus FindVRJ22.cmake) Requires OpenGL. + Optionally uses Flagpoll and FindFlagpoll.cmake + + This library is a part of VR Juggler 2.2 - you probably want to use + find_package(VRJuggler22) instead, for an easy interface to this and + related scripts. See FindVRJuggler22.cmake for more information. + + VRJOGL22_LIBRARY_DIR, library search path + VRJOGL22_INCLUDE_DIRS, include search path for dependencies + VRJOGL22_LIBRARY, the library to link against + VRJOGL22_FOUND, If false, do not try to use this library. + + + + Plural versions refer to this library and its dependencies, and are + recommended to be used instead, unless you have a good reason. + + Useful configuration variables you might want to add to your cache: + + VRJOGL22_ROOT_DIR - A directory prefix to search + (a path that contains include/ as a subdirectory) + + + + This script will use Flagpoll, if found, to provide hints to the + location of this library, but does not use the compiler flags returned + by Flagpoll directly. + + The VJ_BASE_DIR environment variable is also searched (preferentially) + when searching for this component, so most sane build environments + should "just work." Note that you need to manually re-run CMake if you + change this environment variable, because it cannot auto-detect this + change and trigger an automatic re-run. + + 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) + + FindVRJOGL30 + try to find VRJuggler 3.0 OpenGL library + + Requires VRJ core 3.0 (thus FindVRJ30.cmake) Requires OpenGL. + Optionally uses Flagpoll and FindFlagpoll.cmake + + This library is a part of VR Juggler 3.0 - you probably want to use + find_package(VRJuggler30) instead, for an easy interface to this and + related scripts. See FindVRJuggler30.cmake for more information. + + VRJOGL30_LIBRARY_DIR, library search path + VRJOGL30_INCLUDE_DIRS, include search path for dependencies + VRJOGL30_LIBRARY, the library to link against + VRJOGL30_FOUND, If false, do not try to use this library. + + + + Plural versions refer to this library and its dependencies, and are + recommended to be used instead, unless you have a good reason. + + Useful configuration variables you might want to add to your cache: + + VRJOGL30_ROOT_DIR - A directory prefix to search + (a path that contains include/ as a subdirectory) + + + + This script will use Flagpoll, if found, to provide hints to the + location of this library, but does not use the compiler flags returned + by Flagpoll directly. + + The VJ_BASE_DIR environment variable is also searched (preferentially) + when searching for this component, so most sane build environments + should "just work." Note that you need to manually re-run CMake if you + change this environment variable, because it cannot auto-detect this + change and trigger an automatic re-run. + + Original Author: 2009-2010 Ryan Pavlik + http://academic.cleardefinition.com Iowa State + University HCI Graduate Program/VRAC Updated for VR Juggler 3.0 by: + Brandon Newendorp + + FindVRJuggler + try to find VR Juggler-related packages (combined finder) + + VRJUGGLER_INCLUDE_DIRS, include search paths + VRJUGGLER_LIBRARIES, the libraries to link against + VRJUGGLER_ENVIRONMENT + VRJUGGLER_RUNTIME_LIBRARY_DIRS + VRJUGGLER_CXX_FLAGS + VRJUGGLER_DEFINITIONS + VRJUGGLER_FOUND, If false, do not try to use VR Juggler. + + + + Components available to search for (uses "VRJOGL" by default): + + VRJOGL + VRJ + Gadgeteer + JCCL + VPR + Sonix + Tweek + + + + Additionally, a full setup requires these packages and their + Find_.cmake scripts + + CPPDOM + GMTL + + + + Optionally uses Flagpoll (and FindFlagpoll.cmake) + + Notes on components: + + - All components automatically include their dependencies. + - If you do not specify a component, VRJOGL (the OpenGL view manager) + will be used by default. + - Capitalization of component names does not matter, but it's best to + pretend it does and use the above capitalization. + - Since this script calls find_package for your requested components and + their dependencies, you can use any of the variables specified in those + files in addition to the "summary" ones listed here, for more finely + controlled building and linking. + + + + This CMake script requires all of the Find*.cmake scripts for the + components listed above, as it is only a "meta-script" designed to + make using those scripts more developer-friendly. + + Useful configuration variables you might want to add to your cache: + + (CAPS COMPONENT NAME)_ROOT_DIR - A directory prefix to search + (a path that contains include/ as a subdirectory) + + + + The VJ_BASE_DIR environment variable is also searched (preferentially) + when seeking any of the above components, as well as Flagpoll, CPPDOM, + and Boost (from within VPR), so most sane build environments should + "just work." + + IMPORTANT: Note that you need to manually re-run CMake if you change + this environment variable, because it cannot auto-detect this change + and trigger an automatic re-run. + + Original Author: 2009-2010 Ryan Pavlik + http://academic.cleardefinition.com Iowa State + University HCI Graduate Program/VRAC Updated for VR Juggler 3.0 by: + Brandon Newendorp + + 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) + + FindVRJuggler22 + try to find VRJuggler 2.2-related packages (main finder) + + VRJUGGLER22_LIBRARY_DIRS, library search paths + VRJUGGLER22_INCLUDE_DIRS, include search paths + VRJUGGLER22_LIBRARIES, the libraries to link against + VRJUGGLER22_ENVIRONMENT + VRJUGGLER22_RUNTIME_LIBRARY_DIRS + VRJUGGLER22_CXX_FLAGS + VRJUGGLER22_DEFINITIONS + VRJUGGLER22_FOUND, If false, do not try to use VR Juggler 2.2. + + + + Components available to search for (uses "VRJOGL22" by default): + + VRJOGL22 + VRJ22 + Gadgeteer12 + JCCL12 + VPR20 + Sonix12 + Tweek12 + + + + Additionally, a full setup requires these packages and their + Find_.cmake scripts + + CPPDOM + GMTL + + + + Optionally uses Flagpoll (and FindFlagpoll.cmake) + + Notes on components: + + - All components automatically include their dependencies. + - You can search for the name above with or without the version suffix. + - If you do not specify a component, VRJOGL22(the OpenGL view manager) + will be used by default. + - Capitalization of component names does not matter, but it's best to + pretend it does and use the above capitalization. + - Since this script calls find_package for your requested components and + their dependencies, you can use any of the variables specified in those + files in addition to the "summary" ones listed here, for more finely + controlled building and linking. + + + + This CMake script requires all of the Find*.cmake scripts for the + components listed above, as it is only a "meta-script" designed to + make using those scripts more developer-friendly. + + Useful configuration variables you might want to add to your cache: + + (CAPS COMPONENT NAME)_ROOT_DIR - A directory prefix to search + (a path that contains include/ as a subdirectory) + + + + The VJ_BASE_DIR environment variable is also searched (preferentially) + when seeking any of the above components, as well as Flagpoll, CPPDOM, + and Boost (from within VPR20), so most sane build environments should + "just work." + + IMPORTANT: Note that you need to manually re-run CMake if you change + this environment variable, because it cannot auto-detect this change + and trigger an automatic re-run. + + 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) + + FindVRJuggler30 + try to find VRJuggler 3.0-related packages (main finder) + + VRJUGGLER30_LIBRARY_DIRS, library search paths + VRJUGGLER30_INCLUDE_DIRS, include search paths + VRJUGGLER30_LIBRARIES, the libraries to link against + VRJUGGLER30_ENVIRONMENT + VRJUGGLER30_RUNTIME_LIBRARY_DIRS + VRJUGGLER30_CXX_FLAGS + VRJUGGLER30_DEFINITIONS + VRJUGGLER30_FOUND, If false, do not try to use VR Juggler 3.0. + + + + Components available to search for (uses "VRJOGL30" by default): + + VRJOGL30 + VRJ30 + Gadgeteer20 + JCCL14 + VPR22 + Sonix14 + Tweek14 + + + + Additionally, a full setup requires these packages and their + Find_.cmake scripts + + CPPDOM + GMTL + + + + Optionally uses Flagpoll (and FindFlagpoll.cmake) + + Notes on components: + + - All components automatically include their dependencies. + - You can search for the name above with or without the version suffix. + - If you do not specify a component, VRJOGL30(the OpenGL view manager) + will be used by default. + - Capitalization of component names does not matter, but it's best to + pretend it does and use the above capitalization. + - Since this script calls find_package for your requested components and + their dependencies, you can use any of the variables specified in those + files in addition to the "summary" ones listed here, for more finely + controlled building and linking. + + + + This CMake script requires all of the Find*.cmake scripts for the + components listed above, as it is only a "meta-script" designed to + make using those scripts more developer-friendly. + + Useful configuration variables you might want to add to your cache: + + (CAPS COMPONENT NAME)_ROOT_DIR - A directory prefix to search + (a path that contains include/ as a subdirectory) + + + + The VJ_BASE_DIR environment variable is also searched (preferentially) + when seeking any of the above components, as well as Flagpoll, CPPDOM, + and Boost (from within VPR22), so most sane build environments should + "just work." + + IMPORTANT: Note that you need to manually re-run CMake if you change + this environment variable, because it cannot auto-detect this change + and trigger an automatic re-run. + + Original Author: 2009-2011 Ryan Pavlik + http://academic.cleardefinition.com Iowa State + University HCI Graduate Program/VRAC Updated for VR Juggler 3.0 by: + Brandon Newendorp and Ryan Pavlik + + Copyright Iowa State University 2009-2011. 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) + + FindVRPN + try to find VRPN library + + + + Cache Variables: + + VRPN_LIBRARY + VRPN_SERVER_LIBRARY + VRPN_INCLUDE_DIR + + + + Non-cache variables you might use in your CMakeLists.txt: + + VRPN_FOUND + VRPN_SERVER_LIBRARIES - server libraries + VRPN_LIBRARIES - client libraries + VRPN_CLIENT_DEFINITIONS - definitions if you only use the client library + VRPN_DEFINITIONS - Client-only definition if all we found was the client library. + VRPN_INCLUDE_DIRS + + + + VRPN_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 + 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) + + FindViewPoint + try to find Arrington Research ViewPoint EyeTracker SDK + + + + Cache Variables: (probably not for direct use in your scripts) + + VIEWPOINT_INCLUDE_DIR + VIEWPOINT_LIBRARY + VIEWPOINT_RUNTIME_LIBRARY + + + + Non-cache variables you might use in your CMakeLists.txt: + + VIEWPOINT_FOUND + VIEWPOINT_INCLUDE_DIRS + VIEWPOINT_LIBRARIES + VIEWPOINT_RUNTIME_LIBRARIES - aka the dll for installing + VIEWPOINT_RUNTIME_LIBRARY_DIRS + + + + Requires these CMake modules: + + FindPackageHandleStandardArgs (known included with CMake >=2.6.2) + + + + Original Author: 2012 Ryan Pavlik + http://academic.cleardefinition.com Iowa State + University HCI Graduate Program/VRAC + + Copyright Iowa State University 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) + + FindVirtuoseAPI + try to find Haption VirtuoseAPI library and include files + + + + VIRTUOSEAPI_INCLUDE_DIRS, where to find headers + VIRTUOSEAPI_LIBRARIES, the libraries to link against + VIRTUOSEAPI_FOUND, If false, do not try to use this library + VIRTUOSEAPI_RUNTIME_LIBRARY_DIRS, path to DLL/SO for runtime use. + VIRTUOSEAPI_RUNTIME_LIBRARIES, runtime libraries you might want to install + + + FindVirtuoseVPP + try to find Haption VirtuoseAPI C++ wrapper include files + + + + Use of this header depends on the VirtuoseAPI, so we search for that + too. + + VIRTUOSEVPP_INCLUDE_DIRS, where to find headers + VIRTUOSEVPP_LIBRARIES, the libraries to link against + VIRTUOSEVPP_FOUND, If false, do not try to use this library + VIRTUOSEVPP_RUNTIME_LIBRARY_DIRS, path to DLL/SO for runtime use. + VIRTUOSEAPI_RUNTIME_LIBRARIES, runtime libraries you might want to install + + + FindWiiSCAAT + try to find the Wii SCAAT library + + + + Users may optionally supply: + + WIISCAAT_ROOT_DIR - a prefix to start searching for the headers. + + + + Cache Variables: (probably not for direct use in your scripts) + + WIISCAAT_INCLUDE_DIR + WIISCAAT_LIBRARY + + + + Non-cache variables you might use in your CMakeLists.txt: + + WIISCAAT_FOUND + WIISCAAT_INCLUDE_DIRS + WIISCAAT_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) + + FindWiiUse + try to find WiiUse library + + + + Cache Variables: (probably not for direct use in your scripts) + + WIIUSE_INCLUDE_DIR + WIIUSE_LIBRARY + + + + Non-cache variables you might use in your CMakeLists.txt: + + WIIUSE_FOUND + WIIUSE_INCLUDE_DIRS + WIIUSE_LIBRARIES + WIIUSE_RUNTIME_LIBRARIES - aka the dll for installing + WIIUSE_RUNTIME_LIBRARY_DIRS + + + + 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) + + FindWinHID + 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) + + FindWindowsSDK + Find the Windows SDK aka Platform SDK + + + + Variables: + + WINDOWSSDK_FOUND - if any version of the windows or platform SDK was found that is usable with the current version of visual studio + WINDOWSSDK_LATEST_DIR + WINDOWSSDK_LATEST_NAME + WINDOWSSDK_FOUND_PREFERENCE - if we found an entry indicating a "preferred" SDK listed for this visual studio version + WINDOWSSDK_PREFERRED_DIR + WINDOWSSDK_PREFERRED_NAME + + + + WINDOWSSDK_DIRS - contains no duplicates, ordered most recent first. + WINDOWSSDK_PREFERRED_FIRST_DIRS - contains no duplicates, ordered with preferred first, followed by the rest in descending recency + + + + Functions: + + windowssdk_name_lookup( ) - Find the name corresponding with the SDK directory you pass in, or + NOTFOUND if not recognized. Your directory must be one of WINDOWSSDK_DIRS for this to work. + + + + Requires these CMake modules: + + FindPackageHandleStandardArgs (known included with CMake >=2.6.2) + + + + Original Author: 2012 Ryan Pavlik + http://academic.cleardefinition.com Iowa State + University HCI Graduate Program/VRAC + + Copyright Iowa State University 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) + + Findargp + try to find the argp library/component of glibc + + + + Users may optionally supply: + + ARGP_ROOT_DIR - a prefix to start searching. + + + + Cache Variables: (probably not for direct use in your scripts) + + ARGP_INCLUDE_DIR + ARGP_LIBRARY, only defined if linking to an extra library is required + + + + Non-cache variables you might use in your CMakeLists.txt: + + ARGP_FOUND + ARGP_INCLUDE_DIRS + ARGP_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) + + Findcppcheck + try to find cppcheck tool + + + + Cache Variables: + + CPPCHECK_EXECUTABLE + + + + Non-cache variables you might use in your CMakeLists.txt: + + CPPCHECK_FOUND + CPPCHECK_POSSIBLEERROR_ARG + CPPCHECK_UNUSEDFUNC_ARG + CPPCHECK_STYLE_ARG + CPPCHECK_QUIET_ARG + CPPCHECK_INCLUDEPATH_ARG + CPPCHECK_FAIL_REGULAR_EXPRESSION + CPPCHECK_WARN_REGULAR_EXPRESSION + CPPCHECK_MARK_AS_ADVANCED - whether to mark our vars as advanced even + if we don't find this program. + + + + 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) + + Findcppunit + try to find cppunit library + + + + Cache Variables: (probably not for direct use in your scripts) + + CPPUNIT_INCLUDE_DIR + CPPUNIT_LIBRARY + + + + Non-cache variables you might use in your CMakeLists.txt: + + CPPUNIT_FOUND + CPPUNIT_INCLUDE_DIRS + CPPUNIT_LIBRARIES + + + + Requires these CMake modules: + + SelectLibraryConfigurations (included with CMake >= 2.8.0) + FindPackageHandleStandardArgs (known included with CMake >=2.6.2) + + + + Original Author: 2009-2011 Ryan Pavlik + http://academic.cleardefinition.com Iowa State + University HCI Graduate Program/VRAC + + Copyright Iowa State University 2009-2011. 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) + + Findcutil + find NVIDIA CUDA and source for the cutil library, building cutil if + needed. + + + + CUTIL_LIBRARIES - Libraries to link against to use CUTIL + CUTIL_INCLUDE_DIRS - Include directories to add before building a CUTIL app. + + + + Functions: + + install_cutil({RUNTIME_LIBRARY_DESTINATION}) - Install the CUTIL shared lib if created. + + + + 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) + + Finddb2pdf + Try to find db2pdf, and define a custom command to turn docbook into + pdf + + + + Once done, this will define: + + DB2PDF_FOUND - system has LyX + DB2PDF_COMMAND - the command to run + + + + and the following function: + + docbook_to_pdf( ) + + + + Useful configuration variables you might want to add to your cache: + + DB2PDF_ROOT_DIR - A directory prefix to search + + + + 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) + + FindosgLua + try to find osgLua + + + + Users may optionally supply: + + OSGLUA_ROOT_DIR - a prefix to start searching + + + + Non-cache variables you might use in your CMakeLists.txt: + + OSGLUA_FOUND + OSGLUA_INCLUDE_DIRS + OSGLUA_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) + + Findquatlib + Find quatlib + + Find the quatlib headers and libraries. + + QUATLIB_INCLUDE_DIRS - where to find quat.h + QUATLIB_LIBRARIES - List of libraries when using quatlib. + QUATLIB_FOUND - True if quatlib found. + + + + 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) + + GetCPUDetails + Set a number of variables to indicate things about the current CPU and + OS + + + CPU_COUNT + CPU_INTEL + CPU_EXE_64BIT + CPU_EXE_32BIT + CPU_HAS_SSE + CPU_HAS_SSE2 + CPU_HAS_SSE3 + CPU_HAS_SSSE3 + CPU_HAS_SSE4_1 + CPU_HAS_SSE4_2 + + + + Requires these CMake modules: + + no additional modules required + + + + Original Author: 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) + + + GetCompilerInfoString + Utility function to return a human-useful-only string ID'ing the + compiler + + + + get_compiler_info_string() + + + + and some helper functions: + + get_gcc_version() + get_vs_short_version_string( ) + + + + You might consider using it when setting up CTest options, for + example: + + include(GetCompilerInfoString) + get_compiler_info_string(COMPILERID) + set(CTEST_BUILD_NAME "${CMAKE_SYSTEM}-${CMAKE_SYSTEM_PROCESSOR}-${COMPILERID}") + + + + Requires these CMake modules: + + no additional modules required + + + + Original Author: 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) + + Some functions based on cmake-2.8.0 modules FindBoost.cmake and + CTest.cmake + ============================================================================= + Copyright 2006-2009 Kitware, Inc. Copyright 2006-2008 Andreas + Schneider Copyright 2007 Wengo Copyright 2007 Mike + Jackson Copyright 2008 Andreas Pakulat Copyright + 2008-2009 Philip Lowman Copyright 2010 Iowa State + University (Ryan Pavlik ) + + 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. + ============================================================================= + CMake - Cross Platform Makefile Generator Copyright 2000-2009 Kitware, + Inc., Insight Software Consortium All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + + notice, this list of conditions and the following disclaimer. + + + + * Redistributions in binary form must reproduce the above copyright + + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + + + * Neither the names of Kitware, Inc., the Insight Software Consortium, + + nor the names of their contributors may be used to endorse or promote + products derived from this software without specific prior written + permission. + + + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ============================================================================= + + GetDirectoryList + Returns a list of the parent directories of all files passed + + + + get_directory_list( [...]) + + + + 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) + + GetFileList + Returns a list of the file names of all files passed + + + + get_file_list( [...]) + + + + 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) + + GetForceIncludeDefinitions + Get the platform-appropriate flags to add to force inclusion of a file + + + + The most common use of this is to use a generated config.h-type file + placed out of the source tree in all files. + + get_force_include_definitions(var forcedincludefiles...) - + where var is the name of your desired output variable, and everything + else is a source file to forcibly include. + a list item to be filtered. + + + + 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) + + GetGitRevisionDescription + 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) + + GetSubprojectStatus + Returns whether the current project is on its own or within another + project's build + + + + get_subproject_status() - resultvar will be YES if we are + included in another project, or NO if we are being built separately + + + + 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) + + Licensing + Building a licensing description file + + + + 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) + + ListCombinations + Combine lists of prefixes and suffixes in all combinations + + + + list_combinations(var PREFIXES listitems... SUFFIXES listitems...) - + where var is the name of your desired output variable and PREFIXES + and SUFFIXES are special arguments that indicate the start of your + list of prefixes or suffixes respectively. + + + + 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) + + ListFilter + List filtering functions + + + + list_filter(var regex listitems...) - where var is the name of + your desired output variable, regex is the regex whose matching items + WILL be put in the output variable, and everything else is considered + a list item to be filtered. + + + + list_filter_out(var regex listitems...) - where var is the name of + your desired output variable, regex is the regex whose matching items + will NOT be put in the output variable, and everything else is considered + a list item to be filtered. + + + + 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) + + LuaTargets + Copy/parse lua source files as a custom target + + + + include(LuaTargets) + add_lua_target( [ ]) + Relative paths for the destination directory are considered with + with respect to CMAKE_CURRENT_BINARY_DIR + + + + install_lua_target( [arguments to INSTALL(PROGRAMS ...) ]) + + + + Set this variable to specify location of luac, if it is not a target: + + LUA_TARGET_LUAC_EXECUTABLE + + + + 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) + + MSVCMultipleProcessCompile + Compile with multiple processes on MSVC + + + + include(MSVCMultipleProcessCompile) + + + + Requires these CMake modules: + + ListCombinations.cmake + + + + 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) + + MSVCStaticRuntime + Modify compile flags to use the static runtimes of MSVC + + + + include(MSVCStaticRuntime) + + + + Requires these CMake modules: + + ListCombinations.cmake + + + + 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) + + MSVCVerboseLinking + Add appropriate linker flags to show link details on Visual Studio + + + + include(MSVCVerboseLinking) - to add the flags automaticlly if applicable + + + + Be sure to include this module _BEFORE_ adding your targets, or the + targets won't pick up the updated flags. + + Requires these CMake modules: + + - none + + + + Original Author: 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) + + OptionRequires + Add an option that depends on one or more variables being true. + + + + option_requires( [...]) + + + + 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) + + PrefixListGlob + For each given prefix in a list, glob using the prefix+pattern + + + + + + 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) + + ProgramFilesGlob + Find bit-appropriate program files directories matching a given + pattern + + + + Requires these CMake modules: + + CleanDirectoryList + PrefixListGlob + + + + 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) + + ResetConfigurations + Re-set the available configurations to just RelWithDebInfo, Release, + and Debug + + + + Requires these CMake modules: + + no additional modules required + + + + Original Author: 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) + + + SearchProgramFilesForOpenSceneGraph + Use some smarts to try to find OpenSceneGraph in the Program Files + dirs + + + + Also uses the OSGHOME environment variable as OSG_DIR, if it's found. + + Usage: + + include(SearchProgramFilesForOpenSceneGraph OPTIONAL) + + + + Requires these CMake modules: + + ListFilter + ProgramFilesGlob + + + + 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) + + SetDefaultBuildType + Set a developer-chosen default build type + + + + Requires these CMake modules: + + no additional modules required + + + + Original Author: 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) + + + SplitLibraryList + Given a list of libraries with OPTIMIZED, DEBUG, etc. + + + + split_library_list(_generalvar _releasevar _debugvar) + + + + 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) + + StampSourcesWithVersion + It will only attempt a substitution within the first C-style comment + block + + + + To set up your source code for proper stamping, start your file with a + Doxygen-style comment block, starting with /* and ending with */ On a + line by itself, with unimportant whitespace, add the standard Doxygen + "version" command: + + @version xxx + + or + + \version xxx + + + + To make sure it works, please do actually put xxx as the current + version: when you save, add one of the command below to your cmake + build, and run cmake, it should replace xxx with the current version. + (It replaces anything between the end of the whitespace after \version + and the end of the line with the version that you pass in your build + script, so put nothing else on that line!) + + For , I recommend passing the value of a CMake variable like + + ${CPACK_PACKAGE_VERSION} + + Remember, reduced duplication of information means reduced errors! + + WARNING! This does edit your source directory, but will only execute + if the (hidden/advanced, default OFF) variable ENABLE_VERSION_STAMPING + is on. + + Additionally, it tries to be very careful: of your code (that is, the + first /* */), but only if // is not found first + + stamp_target_with_version( [HEADERS_ONLY | ...]) - + If no source file is specified, all will be processed. + + + + stamp_sources_with_version( [ ...]) - + Use for files not directly associated with a target. + + + + 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) + + TCHARWorkaround + Script to compile Win32-developed sources using tchar without + modifying the code + + Requires that ${CMAKE_SOURCE_DIR}/cmake/workarounds/tchar/ be present. + + TCHAR_WORKAROUND, automatically set to on when not on win32 + TCHAR_INCLUDE_DIR, location of our fake tchar.h file + + 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) + + UseBackportedModules + Do a version-dependent check and auto-include backported modules dirs + + + + Name your module directories cmake-*-modules where * is the full + (maj.min.patch) version number that they came from. You can use + subdirectories within those directories, if you like - all directories + inside of a cmake-*-modules dir for a newer version of CMake that what + we're running, that contain one or more .cmake files, will be appended + to the CMAKE_MODULE_PATH. + + When backporting modules, be sure to test them and follow copyright + instructions (usually updating copyright notices) + + Requires these CMake modules: + + 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) + + UseMarkdown + Convert markdown source files to HTML as a custom target + + + + include(UseMarkdown) + add_markdown_target( [...] [RENAME ]) + Relative paths for the destination directory are considered with + with respect to CMAKE_CURRENT_BINARY_DIR. The RENAME argument is only + valid with a single markdown file as input. + + + + + + install_markdown_target( [extra arguments to INSTALL(FILES ...) ]) + + + + + + Requires CMake 2.6 or newer (uses the 'function' command) + + Original Author: 2011 Ryan Pavlik + http://academic.cleardefinition.com Iowa State + University HCI Graduate Program/VRAC + + Copyright Iowa State University 2011-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) + + UseTR1 + Use settings to enable access to C++ TR1 + + + + This calls include_directories and link_directories as needed to + permit TR1 support. + + 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) + + WarningDev + Print a developer warning, using author_warning if we have cmake 2.8 + + + + warning_dev("your desired message") + + + + Original Author: 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) + +------------------------------------------------------------------------------ +See Also + +.B ccmake(1), cpack(1), ctest(1), cmakecommands(1), cmakecompat(1), +cmakemodules(1), cmakeprops(1), cmakevars(1) + +The following resources are available to get help using CMake: + + Home Page + http://www.cmake.org + + The primary starting point for learning about CMake. + + Frequently Asked Questions + http://www.cmake.org/Wiki/CMake_FAQ + + A Wiki is provided containing answers to frequently asked questions. + + Online Documentation + http://www.cmake.org/HTML/Documentation.html + + Links to available documentation may be found on this web page. + + Mailing List + http://www.cmake.org/HTML/MailingLists.html + + For help and discussion about using cmake, a mailing list is provided + at cmake@cmake.org. The list is member-post-only but one may sign up + on the CMake web page. Please first read the full documentation at + http://www.cmake.org before posting questions to the list. + diff --git a/lib/wiiuse/cmake/nested_targets/DCubed/CMakeLists.txt b/lib/wiiuse/cmake/nested_targets/DCubed/CMakeLists.txt new file mode 100644 index 000000000..c25267e3c --- /dev/null +++ b/lib/wiiuse/cmake/nested_targets/DCubed/CMakeLists.txt @@ -0,0 +1,31 @@ +# - Build the DCubed wrapper libraries as a part of your solution. +# +# 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) + + +include_directories("${DCUBED_CORE_INCLUDE_DIR}/d3e_inc" "${DCUBED_WRAPPER_INCLUDE_DIR}") + +include_directories(${PARASOLID_INCLUDE_DIRS}) +if(MSVC) + add_definitions(/D_CRT_SECURE_NO_DEPRECATE /arch:SSE2 /openmp /D_AFXDLL /DNDEBUG) +endif() +if(WIN32) + add_definitions(/DDCM_NT /DWIN32 /D_WINDOWS) +endif() +add_definitions(/DD3EW_DUMMY_HLM) + +if(DCUBED_WRAPPER_d3ew_scene_LIBRARY STREQUAL "dcubed_wrapper_d3ew_scene_nested_target") + add_subdirectory(d3ew_scene) +endif() + +if(DCUBED_WRAPPER_d3ew_p_LIBRARY STREQUAL "dcubed_wrapper_d3ew_p_nested_target") + add_subdirectory(d3ew_p) +endif() diff --git a/lib/wiiuse/cmake/nested_targets/DCubed/d3ew_p/CMakeLists.txt b/lib/wiiuse/cmake/nested_targets/DCubed/d3ew_p/CMakeLists.txt new file mode 100644 index 000000000..c86c52712 --- /dev/null +++ b/lib/wiiuse/cmake/nested_targets/DCubed/d3ew_p/CMakeLists.txt @@ -0,0 +1,41 @@ +# - Build the DCubed wrapper library d3ew_p as a part of your solution. +# +# 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) + + +set(SOURCES) +foreach(filename d3ew_p.rc + p_dll.cpp + p_dll.hxx + p_dump.cpp + p_frustrum.cpp + p_gate.cpp + p_gate.hxx + p_lib.cpp + p_modeller.cpp + p_new.hxx + p_rollmark.cpp + p_utils.cpp + p_utils.hxx + res_defs.hxx) + list(APPEND SOURCES "${DCUBED_WRAPPER_INCLUDE_DIR}/d3ew_p/${filename}") +endforeach() +add_library(dcubed_wrapper_d3ew_p_nested_target + STATIC + EXCLUDE_FROM_ALL + ${SOURCES}) +target_link_libraries(dcubed_wrapper_d3ew_p_nested_target ${DCUBED_LIBRARIES} ${PARASOLID_LIBRARIES} "${DCUBED_WRAPPER_d3ew_scene_LIBRARY}") + +set_property(TARGET + dcubed_wrapper_d3ew_p_nested_target + PROPERTY + PROJECT_LABEL + "DCubed d3ew_p Wrapper Library") diff --git a/lib/wiiuse/cmake/nested_targets/DCubed/d3ew_scene/CMakeLists.txt b/lib/wiiuse/cmake/nested_targets/DCubed/d3ew_scene/CMakeLists.txt new file mode 100644 index 000000000..1f881b978 --- /dev/null +++ b/lib/wiiuse/cmake/nested_targets/DCubed/d3ew_scene/CMakeLists.txt @@ -0,0 +1,68 @@ +# - Build the DCubed wrapper library d3ew_scene as a part of your solution. +# +# 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) + + +set(SOURCES) +foreach(filename ansi.hxx + body.hxx + d3ew_clap_data.cpp + d3ew_clap_data.hxx + d3ew_new.hxx + d3ew_stack.cpp + d3ew_stack.hxx + debload.hxx + edge.cpp + edge.hxx + ehlc_timer.cpp + ehlc_timer.hxx + face.cpp + face.hxx + frustum.cpp + frustum.hxx + hldeb.hxx + hljournal.hxx + hlm_cdm_dummies.cpp + hltable.hxx + hltabledef.hxx + journalw.cpp + journalw.hxx + modeller.cpp + modeller.hxx + nowarn.hxx + scene.cpp + scene.hxx + scene_build.cpp + scene_edge.cpp + scene_face.cpp + scene_misc.cpp + scene_node.cpp + scene_node.hxx + scene_table.cpp + scene_table.hxx + secure_c.hxx + segment.cpp + segment.hxx + table_dec.hxx + wrapper.cpp + wrapper_new.cpp) + list(APPEND SOURCES "${DCUBED_WRAPPER_INCLUDE_DIR}/d3ew_scene/${filename}") +endforeach() +add_library(dcubed_wrapper_d3ew_scene_nested_target + STATIC + EXCLUDE_FROM_ALL + ${SOURCES}) + +set_property(TARGET + dcubed_wrapper_d3ew_scene_nested_target + PROPERTY + PROJECT_LABEL + "DCubed d3ew_scene Wrapper Library") diff --git a/lib/wiiuse/cmake/nested_targets/OpenHaptics/CMakeLists.txt b/lib/wiiuse/cmake/nested_targets/OpenHaptics/CMakeLists.txt new file mode 100644 index 000000000..f46daa391 --- /dev/null +++ b/lib/wiiuse/cmake/nested_targets/OpenHaptics/CMakeLists.txt @@ -0,0 +1,95 @@ +# - Build the OpenHaptics utility libraries as a part of your solution. +# +# 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) + # Work around bug in library at least <= 3.10 + add_definitions(-DWIN32) +endif() +include_directories("${HDAPI_HDU_INCLUDE_DIR}" + "${HDAPI_INCLUDE_DIR}" + "${HLAPI_HLU_INCLUDE_DIR}" + "${HLAPI_INCLUDE_DIR}") + +if(HDAPI_HDU_LIBRARY STREQUAL "openhaptics_hdu_nested_target") + add_library(openhaptics_hdu_nested_target + STATIC + EXCLUDE_FROM_ALL + "${HDAPI_HDU_INCLUDE_DIR}/HDU/hduBoundBox.h" + "${HDAPI_HDU_INCLUDE_DIR}/HDU/hduError.h" + "${HDAPI_HDU_INCLUDE_DIR}/HDU/hduGenericMatrix.h" + "${HDAPI_HDU_INCLUDE_DIR}/HDU/hdu.h" + "${HDAPI_HDU_INCLUDE_DIR}/HDU/hduHapticDevice.h" + "${HDAPI_HDU_INCLUDE_DIR}/HDU/hduLine.h" + "${HDAPI_HDU_INCLUDE_DIR}/HDU/hduLineSegment.h" + "${HDAPI_HDU_INCLUDE_DIR}/HDU/hduMath.h" + "${HDAPI_HDU_INCLUDE_DIR}/HDU/hduMatrix.h" + "${HDAPI_HDU_INCLUDE_DIR}/HDU/hduPlane.h" + "${HDAPI_HDU_INCLUDE_DIR}/HDU/hduQuaternion.h" + "${HDAPI_HDU_INCLUDE_DIR}/HDU/hduRecord.h" + "${HDAPI_HDU_INCLUDE_DIR}/HDU/hduVector.h" + "${HDAPI_HDU_SOURCE_DIR}/hdu.cpp" + "${HDAPI_HDU_SOURCE_DIR}/hduAfx.cpp" + "${HDAPI_HDU_SOURCE_DIR}/hduAfx.h" + "${HDAPI_HDU_SOURCE_DIR}/hduDecompose.cpp" + "${HDAPI_HDU_SOURCE_DIR}/hduDecompose.h" + "${HDAPI_HDU_SOURCE_DIR}/hduError.cpp" + "${HDAPI_HDU_SOURCE_DIR}/hduHapticDevice.cpp" + "${HDAPI_HDU_SOURCE_DIR}/hduLine.cpp" + "${HDAPI_HDU_SOURCE_DIR}/hduLineSegment.cpp" + "${HDAPI_HDU_SOURCE_DIR}/hduMatrix.cpp" + "${HDAPI_HDU_SOURCE_DIR}/hduPlane.cpp" + "${HDAPI_HDU_SOURCE_DIR}/hduQuaternion.cpp" + "${HDAPI_HDU_SOURCE_DIR}/hduRecord.cpp") + target_link_libraries(openhaptics_hdu_nested_target ${HDAPI_LIBRARY}) + set_property(TARGET + openhaptics_hdu_nested_target + PROPERTY + PROJECT_LABEL + "OpenHaptics HDU Library") + + if(MSVC) + # Disable warnings - no sense in warning about Sensable's potential bugs. + set_property(TARGET + openhaptics_hdu_nested_target + PROPERTY + COMPILE_FLAGS + "/wd4189 /wd4701") + endif() +endif() + + +if(HLAPI_HLU_LIBRARY STREQUAL "openhaptics_hlu_nested_target") + add_library(openhaptics_hlu_nested_target + STATIC + EXCLUDE_FROM_ALL + "${HLAPI_HLU_INCLUDE_DIR}/HLU/hlu.h" + "${HLAPI_HLU_SOURCE_DIR}/hlu.cpp" + "${HLAPI_HLU_SOURCE_DIR}/hluAfx.cpp" + "${HLAPI_HLU_SOURCE_DIR}/hluAfx.h") + target_link_libraries(openhaptics_hlu_nested_target ${HLAPI_LIBRARY} ${HDAPI_LIBRARY}) + + set_property(TARGET + openhaptics_hlu_nested_target + PROPERTY + PROJECT_LABEL + "OpenHaptics HLU Library") + + if(MSVC) + # Disable warnings - no sense in warning about Sensable's potential bugs. + set_property(TARGET + openhaptics_hlu_nested_target + APPEND + PROPERTY + COMPILE_FLAGS + /wd4189) + endif() +endif() diff --git a/lib/wiiuse/cmake/nested_targets/Parasolid/CMakeLists.txt b/lib/wiiuse/cmake/nested_targets/Parasolid/CMakeLists.txt new file mode 100644 index 000000000..3dfc51e68 --- /dev/null +++ b/lib/wiiuse/cmake/nested_targets/Parasolid/CMakeLists.txt @@ -0,0 +1,73 @@ +# - Build the Parasolid utility libraries as a part of your solution. +# +# 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(PARASOLID_fg_LIBRARY STREQUAL "parasolid_fg_nested_target") + get_filename_component(_fgdir "${PARASOLID_FG_C}" PATH) + include_directories("${_fgdir}") + add_library(parasolid_fg_nested_target + STATIC + EXCLUDE_FROM_ALL + "${PARASOLID_FG_C}") + + set_property(TARGET + parasolid_fg_nested_target + PROPERTY + COMPILE_DEFINITIONS + _CRT_SECURE_NO_DEPRECATE) + if(MSVC) + set_property(TARGET + parasolid_fg_nested_target + PROPERTY + COMPILE_FLAGS + "/Gs /GF /GS- /fp:fast") + endif() + + set_property(TARGET + parasolid_fg_nested_target + PROPERTY + PROJECT_LABEL + "Parasolid Foreign Geometry Example Library") + +endif() + + +if(PARASOLID_frustrum_LIBRARY + STREQUAL + "parasolid_frustrum_nested_target") + get_filename_component(_frustrumdir "${PARASOLID_FRUSTRUM_C}" PATH) + include_directories("${_frustrumdir}") + add_library(parasolid_frustrum_nested_target + STATIC + EXCLUDE_FROM_ALL + "${PARASOLID_FRUSTRUM_C}") + + set_property(TARGET + parasolid_frustrum_nested_target + PROPERTY + COMPILE_DEFINITIONS + _CRT_SECURE_NO_DEPRECATE) + if(MSVC) + set_property(TARGET + parasolid_frustrum_nested_target + PROPERTY + COMPILE_FLAGS + "/Gs /GF /GS- /fp:fast") + endif() + + set_property(TARGET + parasolid_frustrum_nested_target + PROPERTY + PROJECT_LABEL + "Parasolid Frustrum Example Library") + +endif() diff --git a/lib/wiiuse/cmake/nested_targets/cutil/CMakeLists.txt b/lib/wiiuse/cmake/nested_targets/cutil/CMakeLists.txt new file mode 100644 index 000000000..2f2711492 --- /dev/null +++ b/lib/wiiuse/cmake/nested_targets/cutil/CMakeLists.txt @@ -0,0 +1,41 @@ +# CMake cross-platform build system +# 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) + + +### +# Build the project +### + +include_directories("${CUTIL_ROOT_DIR}/inc") +set(SOURCES + "${CUTIL_ROOT_DIR}/src/bank_checker.cpp" + "${CUTIL_ROOT_DIR}/src/cmd_arg_reader.cpp" + "${CUTIL_ROOT_DIR}/src/cutil.cpp" + "${CUTIL_ROOT_DIR}/src/stopwatch.cpp" + "${CUTIL_ROOT_DIR}/src/multithreading.cpp") + +if(WIN32) + list(APPEND SOURCES + "${CUDA_SDK_ROOT_DIR}/C/common/src/stopwatch_win.cpp") + add_definitions(-DWIN32 -D_WINDOWS -DBUILD_DLL) + set(TYPE SHARED) + +else() + list(APPEND SOURCES + "${CUTIL_ROOT_DIR}/src/stopwatch_linux.cpp") + set(TYPE STATIC) + +endif() + +cuda_add_library(cutil ${TYPE} EXCLUDE_FROM_ALL ${SOURCES}) + +set(CUTIL_INCLUDE_DIRS "${CUTIL_ROOT_DIR}/inc" "${CUDA_INCLUDE_DIRS}" PARENT_SCOPE) +set(CUTIL_LIBRARIES cutil PARENT_SCOPE) + diff --git a/lib/wiiuse/cmake/package-licensing/Boost.cmake b/lib/wiiuse/cmake/package-licensing/Boost.cmake new file mode 100644 index 000000000..22e7d86ee --- /dev/null +++ b/lib/wiiuse/cmake/package-licensing/Boost.cmake @@ -0,0 +1,13 @@ +# 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) + +add_permissive_license(Boost + "Based in part on the work of the Boost project. Boost is distributed under the Boost Software License, Version 1.0. See copy at http://www.boost.org/LICENSE_1_0.txt" + "") diff --git a/lib/wiiuse/cmake/package-licensing/Eigen.cmake b/lib/wiiuse/cmake/package-licensing/Eigen.cmake new file mode 100644 index 000000000..538d787ed --- /dev/null +++ b/lib/wiiuse/cmake/package-licensing/Eigen.cmake @@ -0,0 +1,13 @@ +# 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) + +add_permissive_license(Eigen + "Based in part on the work of the Eigen project. Eigen is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.\nEigen is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details." + "") diff --git a/lib/wiiuse/cmake/package-licensing/FLTK.cmake b/lib/wiiuse/cmake/package-licensing/FLTK.cmake new file mode 100644 index 000000000..21d71687c --- /dev/null +++ b/lib/wiiuse/cmake/package-licensing/FLTK.cmake @@ -0,0 +1,14 @@ +# 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) + +add_permissive_license(FLTK + "Based in part on the work of the FLTK project, available under the terms of the FLTK License (GNU Library General Public LIcense with exceptions). FLTK is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\n\nFLTK is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details." + "") +add_permissive_license(FLTK "Based in part on the work of the FLTK project, available under the terms of the FLTK License (GNU Library General Public LIcense with exceptions). FLTK is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\n\nFLTK is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details." "") \ No newline at end of file diff --git a/lib/wiiuse/cmake/package-licensing/Lua.cmake b/lib/wiiuse/cmake/package-licensing/Lua.cmake new file mode 100644 index 000000000..b15f51b3e --- /dev/null +++ b/lib/wiiuse/cmake/package-licensing/Lua.cmake @@ -0,0 +1,14 @@ +# 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) + +add_permissive_license(Lua + "Based in part on the work of the Lua project, Copyright 1994-2008 Lua.org, PUC-Rio. Lua is licensed under the terms of the MIT license, reproduced at http://www.lua.org/license.html#5" + "") + diff --git a/lib/wiiuse/cmake/package-licensing/LuaBind.cmake b/lib/wiiuse/cmake/package-licensing/LuaBind.cmake new file mode 100644 index 000000000..342e7a419 --- /dev/null +++ b/lib/wiiuse/cmake/package-licensing/LuaBind.cmake @@ -0,0 +1,15 @@ +# 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) + +add_permissive_license(LuaBind + "Based in part on the work of the LuaBind project. LuaBind is licensed under the terms of the MIT license, reproduced at http://www.lua.org/license.html#5" + "") + +include("package-licensing/Boost") diff --git a/lib/wiiuse/cmake/package-licensing/OpenHapticsAcademicEdition.cmake b/lib/wiiuse/cmake/package-licensing/OpenHapticsAcademicEdition.cmake new file mode 100644 index 000000000..5a06521d5 --- /dev/null +++ b/lib/wiiuse/cmake/package-licensing/OpenHapticsAcademicEdition.cmake @@ -0,0 +1,15 @@ +# 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) + +add_proprietary_license(OpenHapticsAE + "Based in part on the Sensable OpenHaptics Toolkit Academic Edition as licensed to Iowa State University. NOT FOR REDISTRIBUTION." + "") + +add_redistribution_warning("NOT FOR REDISTRIBUTION - OpenHaptics Toolkit Academic Edition licensed to Iowa State University.") diff --git a/lib/wiiuse/cmake/package-licensing/OpenSceneGraph.cmake b/lib/wiiuse/cmake/package-licensing/OpenSceneGraph.cmake new file mode 100644 index 000000000..c4fa29be1 --- /dev/null +++ b/lib/wiiuse/cmake/package-licensing/OpenSceneGraph.cmake @@ -0,0 +1,13 @@ +# 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) + +add_permissive_license(OpenSceneGraph + "Based in part on the work of the OpenSceneGraph project. OpenSceneGraph is open source and may be redistributed and/or modified under the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or (at your option) any later version. The full license is on the openscenegraph.org website.\n\nOpenSceneGraph is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the OpenSceneGraph Public License for more details." + "") diff --git a/lib/wiiuse/cmake/package-licensing/PhysicalModelingUtils.cmake b/lib/wiiuse/cmake/package-licensing/PhysicalModelingUtils.cmake new file mode 100644 index 000000000..edda38f0c --- /dev/null +++ b/lib/wiiuse/cmake/package-licensing/PhysicalModelingUtils.cmake @@ -0,0 +1,13 @@ +# 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) + +add_permissive_license(PhysicalModelingUtils + "Based in part on the work of the PhysicalModelingUtils project, Copyright 2009-2010 Iowa State University. PhysicalModelingUtils is distributed under the Boost Software License, Version 1.0. See copy at http://www.boost.org/LICENSE_1_0.txt" + "") diff --git a/lib/wiiuse/cmake/package-licensing/Qt-LGPL.cmake b/lib/wiiuse/cmake/package-licensing/Qt-LGPL.cmake new file mode 100644 index 000000000..db4d78d32 --- /dev/null +++ b/lib/wiiuse/cmake/package-licensing/Qt-LGPL.cmake @@ -0,0 +1,13 @@ +# 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) + +add_permissive_license(Qt + "Based in part on the work of the Qt GUI Toolkit project. The Qt GUI Toolkit is Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). You may use, distribute and copy the Qt GUI Toolkit under the terms of GNU Lesser General Public License version 2.1, as published by the Free Software Foundation." + "") diff --git a/lib/wiiuse/cmake/package-licensing/VPS.cmake b/lib/wiiuse/cmake/package-licensing/VPS.cmake new file mode 100644 index 000000000..4a2b1ca85 --- /dev/null +++ b/lib/wiiuse/cmake/package-licensing/VPS.cmake @@ -0,0 +1,15 @@ +# 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) + +add_proprietary_license(VPS + "Based in part on Voxmap PointShell(TM) software from Boeing, licensed to Iowa State University. NOT FOR REDISTRIBUTION." + "") + +add_redistribution_warning("NOT FOR REDISTRIBUTION - Voxmap PointShell(TM) software licensed only to Iowa State University.") diff --git a/lib/wiiuse/cmake/package-licensing/VRJuggLua.cmake b/lib/wiiuse/cmake/package-licensing/VRJuggLua.cmake new file mode 100644 index 000000000..d2da335cc --- /dev/null +++ b/lib/wiiuse/cmake/package-licensing/VRJuggLua.cmake @@ -0,0 +1,19 @@ +# Original Author: +# 2009-2012 Ryan Pavlik +# 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) + +add_permissive_license("VR JuggLua" + "Based in part on VR JuggLua, Copyright 2010-2012 Iowa State University. VR JuggLua is distributed under the Boost Software License, Version 1.0. See copy at http://www.boost.org/LICENSE_1_0.txt" + "") +include("package-licensing/VRJuggler") +include("package-licensing/OpenSceneGraph") +include("package-licensing/Lua") +include("package-licensing/LuaBind") +include("package-licensing/osgLua") +include("package-licensing/Boost") diff --git a/lib/wiiuse/cmake/package-licensing/VRJuggler.cmake b/lib/wiiuse/cmake/package-licensing/VRJuggler.cmake new file mode 100644 index 000000000..f015ef351 --- /dev/null +++ b/lib/wiiuse/cmake/package-licensing/VRJuggler.cmake @@ -0,0 +1,15 @@ +# 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) + +add_permissive_license("VR Juggler" + "Based in part on the work of the VR Juggler project. VR Juggler is Copyright 1998-2010 Iowa State University. VR Juggler is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\n\nVR Juggler is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details." + "") + +include("package-licensing/Boost") diff --git a/lib/wiiuse/cmake/package-licensing/VirtuoseAPI.cmake b/lib/wiiuse/cmake/package-licensing/VirtuoseAPI.cmake new file mode 100644 index 000000000..fe7d5c653 --- /dev/null +++ b/lib/wiiuse/cmake/package-licensing/VirtuoseAPI.cmake @@ -0,0 +1,14 @@ +# 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) + +add_proprietary_license(VirtuoseAPI + "Based in part on the Haption VirtuoseAPI." + "") +add_redistribution_warning("Redistribution of the VirtuoseAPI may be restricted.") diff --git a/lib/wiiuse/cmake/package-licensing/osgLua.cmake b/lib/wiiuse/cmake/package-licensing/osgLua.cmake new file mode 100644 index 000000000..04780e130 --- /dev/null +++ b/lib/wiiuse/cmake/package-licensing/osgLua.cmake @@ -0,0 +1,16 @@ +# 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) + +add_permissive_license(osgLua + "Based in part on the work of the osgLua project. osgLua is open source and may be redistributed and/or modified under the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or (at your option) any later version. The full license is on the openscenegraph.org website.\n\nosgLua is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the OpenSceneGraph Public License for more details." + "") + +include("package-licensing/OpenSceneGraph") +include("package-licensing/Lua") diff --git a/lib/wiiuse/cmake/package/fixupbundle.cmake.in b/lib/wiiuse/cmake/package/fixupbundle.cmake.in new file mode 100644 index 000000000..1936f380b --- /dev/null +++ b/lib/wiiuse/cmake/package/fixupbundle.cmake.in @@ -0,0 +1,56 @@ +# - Configurable script to fix up a VR Juggler bundle +# +# 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) + +function(gp_resolve_item_override _context _item _exepath _dirs _resolved_item _resolved) + if(NOT ${_resolved}) + set(ri "ri-NOTFOUND") + if("${_item}" MATCHES "@executable_path") + get_filename_component(itemname "${_item}" NAME) + message(STATUS "Was incompletely embedded, now looking for ${itemname}") + find_file(ri "${itemname}" ${_exepath} ${_dirs} NO_DEFAULT_PATH) + find_file(ri "${itemname}" ${_exepath} ${_dirs} /usr/lib) + if(ri) + get_filename_component(ri "${ri}" REALPATH) + message(STATUS "override info: 'find_file' on filename '${itemname} in exepath/dirs (${ri})") + set(${_resolved} 1 PARENT_SCOPE) + set(${_resolved_item} "${ri}" PARENT_SCOPE) + set(ri "ri-NOTFOUND") + endif() + endif() + endif() + +endfunction() + + +set(CMAKE_MODULE_PATH @CMAKE_MODULE_PATH@) + +include(BundleUtilities) +set(IS_XCODE @IS_XCODE@) +if(IS_XCODE) + set(APP "$ENV{TARGET_BUILD_DIR}/@_target@.app") +else() + set(APP "@TARGET_LOCATION@") +endif() +#set(APP "@_target@") + +set(BUNDLE_LIBS_INPUT "@BUNDLE_LIBS@") +foreach(lib ${BUNDLE_LIBS_INPUT}) + if(IS_ABSOLUTE "${lib}") + list(APPEND BUNDLE_LIBS "${lib}") + message(STATUS " ${lib}") + else() + message(STATUS "* ${CMAKE_INSTALL_PREFIX}/${lib}") + list(APPEND BUNDLE_LIBS "${CMAKE_INSTALL_PREFIX}/${lib}") + endif() +endforeach() + +fixup_bundle("${CMAKE_INSTALL_PREFIX}/${APP}" "${BUNDLE_LIBS}" "@BUNDLE_LIB_DIRS@") \ No newline at end of file diff --git a/lib/wiiuse/cmake/package/macosx/VRJuggler22BundleInfo.plist.in b/lib/wiiuse/cmake/package/macosx/VRJuggler22BundleInfo.plist.in new file mode 100644 index 000000000..161c82366 --- /dev/null +++ b/lib/wiiuse/cmake/package/macosx/VRJuggler22BundleInfo.plist.in @@ -0,0 +1,38 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${MACOSX_BUNDLE_EXECUTABLE_NAME} + CFBundleGetInfoString + ${MACOSX_BUNDLE_INFO_STRING} + CFBundleIconFile + ${MACOSX_BUNDLE_ICON_FILE} + CFBundleIdentifier + ${MACOSX_BUNDLE_GUI_IDENTIFIER} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleLongVersionString + ${MACOSX_BUNDLE_LONG_VERSION_STRING} + CFBundleName + ${MACOSX_BUNDLE_BUNDLE_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + ${MACOSX_BUNDLE_SHORT_VERSION_STRING} + CFBundleSignature + ???? + CFBundleVersion + ${MACOSX_BUNDLE_BUNDLE_VERSION} + CSResourcesFileMapped + + NSHumanReadableCopyright + ${MACOSX_BUNDLE_COPYRIGHT} + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/lib/wiiuse/cmake/package/macosx/VRJuggler30BundleInfo.plist.in b/lib/wiiuse/cmake/package/macosx/VRJuggler30BundleInfo.plist.in new file mode 100644 index 000000000..161c82366 --- /dev/null +++ b/lib/wiiuse/cmake/package/macosx/VRJuggler30BundleInfo.plist.in @@ -0,0 +1,38 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${MACOSX_BUNDLE_EXECUTABLE_NAME} + CFBundleGetInfoString + ${MACOSX_BUNDLE_INFO_STRING} + CFBundleIconFile + ${MACOSX_BUNDLE_ICON_FILE} + CFBundleIdentifier + ${MACOSX_BUNDLE_GUI_IDENTIFIER} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleLongVersionString + ${MACOSX_BUNDLE_LONG_VERSION_STRING} + CFBundleName + ${MACOSX_BUNDLE_BUNDLE_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + ${MACOSX_BUNDLE_SHORT_VERSION_STRING} + CFBundleSignature + ???? + CFBundleVersion + ${MACOSX_BUNDLE_BUNDLE_VERSION} + CSResourcesFileMapped + + NSHumanReadableCopyright + ${MACOSX_BUNDLE_COPYRIGHT} + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/lib/wiiuse/cmake/update-help.sh b/lib/wiiuse/cmake/update-help.sh new file mode 100755 index 000000000..0611b7519 --- /dev/null +++ b/lib/wiiuse/cmake/update-help.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +src="$(dirname $(readlink -f $0))" +: ${CMAKE:=$(which cmake)} +$CMAKE "-DCMAKE_MODULE_PATH=$src" --help-custom-modules "$src/module-help.html" +$CMAKE "-DCMAKE_MODULE_PATH=$src" --help-custom-modules "$src/module-help.txt" + diff --git a/lib/wiiuse/cmake/workarounds/mac-alut-framework/AL/alut.h b/lib/wiiuse/cmake/workarounds/mac-alut-framework/AL/alut.h new file mode 100644 index 000000000..8e5b93925 --- /dev/null +++ b/lib/wiiuse/cmake/workarounds/mac-alut-framework/AL/alut.h @@ -0,0 +1 @@ +#include diff --git a/lib/wiiuse/cmake/workarounds/mac-gl/GL/gl.h b/lib/wiiuse/cmake/workarounds/mac-gl/GL/gl.h new file mode 100644 index 000000000..1cbb3cd93 --- /dev/null +++ b/lib/wiiuse/cmake/workarounds/mac-gl/GL/gl.h @@ -0,0 +1 @@ +#include diff --git a/lib/wiiuse/cmake/workarounds/mac-gl/GL/glui.h b/lib/wiiuse/cmake/workarounds/mac-gl/GL/glui.h new file mode 100644 index 000000000..f6a993a2f --- /dev/null +++ b/lib/wiiuse/cmake/workarounds/mac-gl/GL/glui.h @@ -0,0 +1 @@ +#include diff --git a/lib/wiiuse/cmake/workarounds/mac-gl/GL/glut.h b/lib/wiiuse/cmake/workarounds/mac-gl/GL/glut.h new file mode 100644 index 000000000..d3182a29d --- /dev/null +++ b/lib/wiiuse/cmake/workarounds/mac-gl/GL/glut.h @@ -0,0 +1 @@ +#include diff --git a/lib/wiiuse/cmake/workarounds/mac-openal/AL/al.h b/lib/wiiuse/cmake/workarounds/mac-openal/AL/al.h new file mode 100644 index 000000000..b032a6360 --- /dev/null +++ b/lib/wiiuse/cmake/workarounds/mac-openal/AL/al.h @@ -0,0 +1 @@ +#include diff --git a/lib/wiiuse/cmake/workarounds/mac-openal/AL/alc.h b/lib/wiiuse/cmake/workarounds/mac-openal/AL/alc.h new file mode 100644 index 000000000..8ddbddcc5 --- /dev/null +++ b/lib/wiiuse/cmake/workarounds/mac-openal/AL/alc.h @@ -0,0 +1 @@ +#include diff --git a/lib/wiiuse/cmake/workarounds/tchar/tchar.h b/lib/wiiuse/cmake/workarounds/tchar/tchar.h new file mode 100644 index 000000000..aff036b8d --- /dev/null +++ b/lib/wiiuse/cmake/workarounds/tchar/tchar.h @@ -0,0 +1,2 @@ +#define _tmain main +#define _TCHAR char \ No newline at end of file diff --git a/lib/wiiuse/definitions.h b/lib/wiiuse/definitions.h deleted file mode 100644 index 527ea00d0..000000000 --- a/lib/wiiuse/definitions.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * wiiuse - * - * Written By: - * Michael Laforest < para > - * Email: < thepara (--AT--) g m a i l [--DOT--] com > - * - * Copyright 2006-2007 - * - * This file is part of wiiuse. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * $Header$ - * - */ - -/** - * @file - * @brief General definitions. - */ - -#ifndef DEFINITIONS_H_INCLUDED -#define DEFINITIONS_H_INCLUDED - -/* this is wiiuse - used to distinguish from third party programs using wiiuse.h */ -#include -#include "definitions_os.h" -/** @addtogroup internal_general */ -/** @{ */ - -#define WIIMOTE_PI 3.14159265f - -/* #define WITH_WIIUSE_DEBUG */ - -extern FILE* logtarget[]; - -#define OUTF_ERROR logtarget[0] -#define OUTF_WARNING logtarget[1] -#define OUTF_INFO logtarget[2] -#define OUTF_DEBUG logtarget[3] - -/* Error output macros */ -#define WIIUSE_ERROR(fmt, ...) do { if (OUTF_ERROR) fprintf(OUTF_ERROR, "[ERROR] " fmt "\n", ##__VA_ARGS__); } while(0) - -/* Warning output macros */ -#define WIIUSE_WARNING(fmt, ...) do { if (OUTF_WARNING) fprintf(OUTF_WARNING, "[WARNING] " fmt "\n", ##__VA_ARGS__); } while(0) - -/* Information output macros */ -#define WIIUSE_INFO(fmt, ...) do { if (OUTF_INFO) fprintf(OUTF_INFO, "[INFO] " fmt "\n", ##__VA_ARGS__); } while(0) - -#ifdef WITH_WIIUSE_DEBUG - #ifdef WIIUSE_WIN32 - #define WIIUSE_DEBUG(fmt, ...) do { \ - if (OUTF_DEBUG) { \ - char* file = __FILE__; \ - int i = strlen(file) - 1; \ - for (; i && (file[i] != '\\'); --i); \ - fprintf(OUTF_DEBUG, "[DEBUG] %s:%i: " fmt "\n", file+i+1, __LINE__, ##__VA_ARGS__); \ - } \ - } while (0) - #else - #define WIIUSE_DEBUG(fmt, ...) do { if (OUTF_DEBUG) fprintf(OUTF_DEBUG, "[DEBUG] " __FILE__ ":%i: " fmt "\n", __LINE__, ##__VA_ARGS__); } while (0) - #endif -#else - #define WIIUSE_DEBUG(fmt, ...) -#endif - -/* Convert between radians and degrees */ -#define RAD_TO_DEGREE(r) ((r * 180.0f) / WIIMOTE_PI) -#define DEGREE_TO_RAD(d) (d * (WIIMOTE_PI / 180.0f)) - -#define absf(x) ((x >= 0) ? (x) : (x * -1.0f)) -#define diff_f(x, y) ((x >= y) ? (absf(x - y)) : (absf(y - x))) - -#define WCONST - - -/** @} */ - -#endif /* DEFINITIONS_H_INCLUDED */ diff --git a/lib/wiiuse/devtools/commentchanger b/lib/wiiuse/devtools/commentchanger new file mode 100755 index 000000000..5a771de10 --- /dev/null +++ b/lib/wiiuse/devtools/commentchanger @@ -0,0 +1,13 @@ +#!/bin/sh +# Simple script to change C++-style // comments to C style ones. +# Puts one space after (and if not present, before) the contents of the comment +# Not suitable for unattended use - inspect results before staging and committing. +# 2011 Ryan Pavlik + +# Handle comments with text before them. Explicitly excludes :// to not +# recklessly mangle license headers with URLs in them. +sed -i -r 's_([^:/])//[ ]?(.*)$_\1/* \2 */_' $@ + +# Handle comments that start at the beginning of the line. +sed -i -r 's_^//[ ]?(.*)$_/* \1 */_' $@ + diff --git a/lib/wiiuse/dynamics.c b/lib/wiiuse/dynamics.c deleted file mode 100644 index 76ac2028f..000000000 --- a/lib/wiiuse/dynamics.c +++ /dev/null @@ -1,227 +0,0 @@ -/* - * wiiuse - * - * Written By: - * Michael Laforest < para > - * Email: < thepara (--AT--) g m a i l [--DOT--] com > - * - * Copyright 2006-2007 - * - * This file is part of wiiuse. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * $Header$ - * - */ - -/** - * @file - * @brief Handles the dynamics of the wiimote. - * - * The file includes functions that handle the dynamics - * of the wiimote. Such dynamics include orientation and - * motion sensing. - */ - -#include "dynamics.h" - -#include /* for atan2f, atanf, sqrt */ -#include /* for abs */ - - -/** - * @brief Calculate the roll, pitch, yaw. - * - * @param ac An accelerometer (accel_t) structure. - * @param accel [in] Pointer to a vec3b_t structure that holds the raw acceleration data. - * @param orient [out] Pointer to a orient_t structure that will hold the orientation data. - * @param rorient [out] Pointer to a orient_t structure that will hold the non-smoothed orientation data. - * @param smooth If smoothing should be performed on the angles calculated. 1 to enable, 0 to disable. - * - * Given the raw acceleration data from the accelerometer struct, calculate - * the orientation of the device and set it in the \a orient parameter. - */ -void calculate_orientation(struct accel_t* ac, struct vec3b_t* accel, struct orient_t* orient, int smooth) { - float xg, yg, zg; - float x, y, z; - - /* - * roll - use atan(z / x) [ ranges from -180 to 180 ] - * pitch - use atan(z / y) [ ranges from -180 to 180 ] - * yaw - impossible to tell without IR - */ - - /* yaw - set to 0, IR will take care of it if it's enabled */ - orient->yaw = 0.0f; - - /* find out how much it has to move to be 1g */ - xg = (float)ac->cal_g.x; - yg = (float)ac->cal_g.y; - zg = (float)ac->cal_g.z; - - /* find out how much it actually moved and normalize to +/- 1g */ - x = ((float)accel->x - (float)ac->cal_zero.x) / xg; - y = ((float)accel->y - (float)ac->cal_zero.y) / yg; - z = ((float)accel->z - (float)ac->cal_zero.z) / zg; - - /* make sure x,y,z are between -1 and 1 for the tan functions */ - if (x < -1.0f) { - x = -1.0f; - } else if (x > 1.0f) { - x = 1.0f; - } - if (y < -1.0f) { - y = -1.0f; - } else if (y > 1.0f) { - y = 1.0f; - } - if (z < -1.0f) { - z = -1.0f; - } else if (z > 1.0f) { - z = 1.0f; - } - - /* if it is over 1g then it is probably accelerating and not reliable */ - if (abs(accel->x - ac->cal_zero.x) <= ac->cal_g.x) { - /* roll */ - x = RAD_TO_DEGREE(atan2f(x, z)); - - orient->roll = x; - orient->a_roll = x; - } - - if (abs(accel->y - ac->cal_zero.y) <= ac->cal_g.y) { - /* pitch */ - y = RAD_TO_DEGREE(atan2f(y, z)); - - orient->pitch = y; - orient->a_pitch = y; - } - - /* smooth the angles if enabled */ - if (smooth) { - apply_smoothing(ac, orient, SMOOTH_ROLL); - apply_smoothing(ac, orient, SMOOTH_PITCH); - } -} - - -/** - * @brief Calculate the gravity forces on each axis. - * - * @param ac An accelerometer (accel_t) structure. - * @param accel [in] Pointer to a vec3b_t structure that holds the raw acceleration data. - * @param gforce [out] Pointer to a gforce_t structure that will hold the gravity force data. - */ -void calculate_gforce(struct accel_t* ac, struct vec3b_t* accel, struct gforce_t* gforce) { - float xg, yg, zg; - - /* find out how much it has to move to be 1g */ - xg = (float)ac->cal_g.x; - yg = (float)ac->cal_g.y; - zg = (float)ac->cal_g.z; - - /* find out how much it actually moved and normalize to +/- 1g */ - gforce->x = ((float)accel->x - (float)ac->cal_zero.x) / xg; - gforce->y = ((float)accel->y - (float)ac->cal_zero.y) / yg; - gforce->z = ((float)accel->z - (float)ac->cal_zero.z) / zg; -} - -static float applyCalibration(float inval, float minval, float maxval, float centerval) { - float ret; - /* We don't use the exact ranges but the ranges + 1 in case we get bad calibration data - avoid div0 */ - if (inval == centerval) { - ret = 0; - } else if (inval < centerval) { - ret = (inval - centerval) / (centerval - minval + 1); - } else { - ret = (inval - centerval) / (maxval - centerval + 1); - } - return ret; -} - -/** - * @brief Calculate the angle and magnitude of a joystick. - * - * @param js [out] Pointer to a joystick_t structure. - * @param x The raw x-axis value. - * @param y The raw y-axis value. - */ -void calc_joystick_state(struct joystick_t* js, float x, float y) { - float rx, ry, ang; - - /* - * Since the joystick center may not be exactly: - * (min + max) / 2 - * Then the range from the min to the center and the center to the max - * may be different. - * Because of this, depending on if the current x or y value is greater - * or less than the associated axis center value, it needs to be interpolated - * between the center and the minimum or maxmimum rather than between - * the minimum and maximum. - * - * So we have something like this: - * (x min) [-1] ---------*------ [0] (x center) [0] -------- [1] (x max) - * Where the * is the current x value. - * The range is therefore -1 to 1, 0 being the exact center rather than - * the middle of min and max. - */ - rx = applyCalibration(x, js->min.x, js->max.x, js->center.x); - ry = applyCalibration(y, js->min.y, js->max.y, js->center.y); - /* calculate the joystick angle and magnitude */ - ang = RAD_TO_DEGREE(atan2f(ry, rx)); - js->ang = ang + 180.0f; - js->mag = sqrtf((rx * rx) + (ry * ry)); -} - - -void apply_smoothing(struct accel_t* ac, struct orient_t* orient, int type) { - switch (type) { - case SMOOTH_ROLL: { - /* it's possible last iteration was nan or inf, so set it to 0 if that happened */ - if (isnan(ac->st_roll) || isinf(ac->st_roll)) { - ac->st_roll = 0.0f; - } - - /* - * If the sign changes (which will happen if going from -180 to 180) - * or from (-1 to 1) then don't smooth, just use the new angle. - */ - if (((ac->st_roll < 0) && (orient->roll > 0)) || ((ac->st_roll > 0) && (orient->roll < 0))) { - ac->st_roll = orient->roll; - } else { - orient->roll = ac->st_roll + (ac->st_alpha * (orient->a_roll - ac->st_roll)); - ac->st_roll = orient->roll; - } - - return; - } - - case SMOOTH_PITCH: { - if (isnan(ac->st_pitch) || isinf(ac->st_pitch)) { - ac->st_pitch = 0.0f; - } - - if (((ac->st_pitch < 0) && (orient->pitch > 0)) || ((ac->st_pitch > 0) && (orient->pitch < 0))) { - ac->st_pitch = orient->pitch; - } else { - orient->pitch = ac->st_pitch + (ac->st_alpha * (orient->a_pitch - ac->st_pitch)); - ac->st_pitch = orient->pitch; - } - - return; - } - } -} diff --git a/lib/wiiuse/events.c b/lib/wiiuse/events.c deleted file mode 100644 index cc7b2c1af..000000000 --- a/lib/wiiuse/events.c +++ /dev/null @@ -1,991 +0,0 @@ -/* - * wiiuse - * - * Written By: - * Michael Laforest < para > - * Email: < thepara (--AT--) g m a i l [--DOT--] com > - * - * Copyright 2006-2007 - * - * This file is part of wiiuse. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * $Header$ - * - */ - -/** - * @file - * @brief Handles wiimote events. - * - * The file includes functions that handle the events - * that are sent from the wiimote to us. - */ - -#include "wiiuse_internal.h" -#include "events.h" - -#include "classic.h" /* for classic_ctrl_disconnected, etc */ -#include "dynamics.h" /* for calculate_gforce, etc */ -#include "guitar_hero_3.h" /* for guitar_hero_3_disconnected, etc */ -#include "ir.h" /* for calculate_basic_ir, etc */ -#include "nunchuk.h" /* for nunchuk_disconnected, etc */ -#include "wiiboard.h" /* for wii_board_disconnected, etc */ -#include "motion_plus.h" /* for motion_plus_disconnected, etc */ - -#include "os.h" /* for wiiuse_os_poll */ - -#include /* for printf, perror */ -#include /* for free, malloc */ -#include /* for memcpy, memset */ - -static void event_data_read(struct wiimote_t* wm, byte* msg); -static void event_data_write(struct wiimote_t *wm, byte *msg); -static void event_status(struct wiimote_t* wm, byte* msg); -static void handle_expansion(struct wiimote_t* wm, byte* msg); - -static void save_state(struct wiimote_t* wm); -static int state_changed(struct wiimote_t* wm); - -/** - * @brief Poll the wiimotes for any events. - * - * @param wm An array of pointers to wiimote_t structures. - * @param wiimotes The number of wiimote_t structures in the \a wm array. - * - * @return Returns number of wiimotes that an event has occurred on. - * - * It is necessary to poll the wiimote devices for events - * that occur. If an event occurs on a particular wiimote, - * the event variable will be set. - */ -int wiiuse_poll(struct wiimote_t** wm, int wiimotes) { - return wiiuse_os_poll(wm, wiimotes); -} - -int wiiuse_update(struct wiimote_t** wiimotes, int nwiimotes, wiiuse_update_cb callback) { - int evnt = 0; - if (wiiuse_poll(wiimotes, nwiimotes)) { - static struct wiimote_callback_data_t s; - int i = 0; - for (; i < nwiimotes; ++i) { - switch (wiimotes[i]->event) { - case WIIUSE_NONE: - break; - default: - /* this could be: WIIUSE_EVENT, WIIUSE_STATUS, WIIUSE_CONNECT, etc.. */ - s.uid = wiimotes[i]->unid; - s.leds = wiimotes[i]->leds; - s.battery_level = wiimotes[i]->battery_level; - s.accel = wiimotes[i]->accel; - s.orient = wiimotes[i]->orient; - s.gforce = wiimotes[i]->gforce; - s.ir = wiimotes[i]->ir; - s.buttons = wiimotes[i]->btns; - s.buttons_held = wiimotes[i]->btns_held; - s.buttons_released = wiimotes[i]->btns_released; - s.event = wiimotes[i]->event; - s.state = wiimotes[i]->state; - s.expansion = wiimotes[i]->exp; - callback(&s); - evnt++; - break; - } - } - } - return evnt; -} - -/** - * @brief Called on a cycle where no significant change occurs. - * - * @param wm Pointer to a wiimote_t structure. - */ -void idle_cycle(struct wiimote_t* wm) { - /* - * Smooth the angles. - * - * This is done to make sure that on every cycle the orientation - * angles are smoothed. Normally when an event occurs the angles - * are updated and smoothed, but if no packet comes in then the - * angles remain the same. This means the angle wiiuse reports - * is still an old value. Smoothing needs to be applied in this - * case in order for the angle it reports to converge to the true - * angle of the device. - */ - if (WIIUSE_USING_ACC(wm) && WIIMOTE_IS_FLAG_SET(wm, WIIUSE_SMOOTHING)) { - apply_smoothing(&wm->accel_calib, &wm->orient, SMOOTH_ROLL); - apply_smoothing(&wm->accel_calib, &wm->orient, SMOOTH_PITCH); - } - - /* clear out any old read requests */ - clear_dirty_reads(wm); -} - - -/** - * @brief Clear out all old 'dirty' read requests. - * - * @param wm Pointer to a wiimote_t structure. - */ -void clear_dirty_reads(struct wiimote_t* wm) { - struct read_req_t* req = wm->read_req; - - while (req && req->dirty) { - WIIUSE_DEBUG("Cleared old read request for address: %x", req->addr); - - wm->read_req = req->next; - free(req); - req = wm->read_req; - } -} - -/** - * @brief Handle accel data in a wiimote message. - * - * @param wm Pointer to a wiimote_t structure. - * @param msg The message specified in the event packet. - */ -static void handle_wm_accel(struct wiimote_t* wm, byte* msg) { - wm->accel.x = msg[2]; - wm->accel.y = msg[3]; - wm->accel.z = msg[4]; - - /* calculate the remote orientation */ - calculate_orientation(&wm->accel_calib, &wm->accel, &wm->orient, WIIMOTE_IS_FLAG_SET(wm, WIIUSE_SMOOTHING)); - - /* calculate the gforces on each axis */ - calculate_gforce(&wm->accel_calib, &wm->accel, &wm->gforce); -} - - -/** - * @brief Analyze the event that occurred on a wiimote. - * - * @param wm Pointer to a wiimote_t structure. - * @param event The event that occurred. - * @param msg The message specified in the event packet. - * - * Pass the event to the registered event callback. - */ -void propagate_event(struct wiimote_t* wm, byte event, byte* msg) { - save_state(wm); - - switch (event) { - case WM_RPT_BTN: { - /* button */ - wiiuse_pressed_buttons(wm, msg); - break; - } - case WM_RPT_BTN_ACC: { - /* button - motion */ - wiiuse_pressed_buttons(wm, msg); - - handle_wm_accel(wm, msg); - - break; - } - case WM_RPT_READ: { - /* data read */ - event_data_read(wm, msg); - - /* yeah buttons may be pressed, but this wasn't an "event" */ - return; - } - case WM_RPT_CTRL_STATUS: { - /* controller status */ - event_status(wm, msg); - - /* don't execute the event callback */ - return; - } - case WM_RPT_BTN_EXP: { - /* button - expansion */ - wiiuse_pressed_buttons(wm, msg); - handle_expansion(wm, msg + 2); - - break; - } - case WM_RPT_BTN_ACC_EXP: { - /* button - motion - expansion */ - wiiuse_pressed_buttons(wm, msg); - - handle_wm_accel(wm, msg); - - handle_expansion(wm, msg + 5); - - break; - } - case WM_RPT_BTN_ACC_IR: { - /* button - motion - ir */ - wiiuse_pressed_buttons(wm, msg); - - handle_wm_accel(wm, msg); - - /* ir */ - calculate_extended_ir(wm, msg + 5); - - break; - } - case WM_RPT_BTN_IR_EXP: { - /* button - ir - expansion */ - wiiuse_pressed_buttons(wm, msg); - handle_expansion(wm, msg + 12); - - /* ir */ - calculate_basic_ir(wm, msg + 2); - - break; - } - case WM_RPT_BTN_ACC_IR_EXP: { - /* button - motion - ir - expansion */ - wiiuse_pressed_buttons(wm, msg); - - handle_wm_accel(wm, msg); - - handle_expansion(wm, msg + 15); - - /* ir */ - calculate_basic_ir(wm, msg + 5); - - break; - } - case WM_RPT_WRITE: { - event_data_write(wm, msg); - break; - } - default: { - WIIUSE_WARNING("Unknown event, can not handle it [Code 0x%x].", event); - return; - } - } - - /* was there an event? */ - if (state_changed(wm)) { - wm->event = WIIUSE_EVENT; - } -} - - -/** - * @brief Find what buttons are pressed. - * - * @param wm Pointer to a wiimote_t structure. - * @param msg The message specified in the event packet. - */ -void wiiuse_pressed_buttons(struct wiimote_t* wm, byte* msg) { - int16_t now; - - /* convert from big endian */ - now = from_big_endian_uint16_t(msg) & WIIMOTE_BUTTON_ALL; - - /* pressed now & were pressed, then held */ - wm->btns_held = (now & wm->btns); - - /* were pressed or were held & not pressed now, then released */ - wm->btns_released = ((wm->btns | wm->btns_held) & ~now); - - /* buttons pressed now */ - wm->btns = now; -} - - -/** - * @brief Received a data packet from a read request. - * - * @param wm Pointer to a wiimote_t structure. - * @param msg The message specified in the event packet. - * - * Data from the wiimote comes in packets. If the requested - * data segment size is bigger than one packet can hold then - * several packets will be received. These packets are first - * reassembled into one, then the registered callback function - * that handles data reads is invoked. - */ -static void event_data_read(struct wiimote_t* wm, byte* msg) { - /* we must always assume the packet received is from the most recent request */ - byte err; - byte len; - uint16_t offset; - struct read_req_t* req = wm->read_req; - - wiiuse_pressed_buttons(wm, msg); - - /* find the next non-dirty request */ - while (req && req->dirty) { - req = req->next; - } - - /* if we don't have a request out then we didn't ask for this packet */ - if (!req) { - WIIUSE_WARNING("Received data packet when no request was made."); - return; - } - - err = msg[2] & 0x0F; - - if (err == 0x08) { - WIIUSE_WARNING("Unable to read data - address does not exist."); - } else if (err == 0x07) { - WIIUSE_WARNING("Unable to read data - address is for write-only registers."); - } else if (err) { - WIIUSE_WARNING("Unable to read data - unknown error code %x.", err); - } - - if (err) { - /* this request errored out, so skip it and go to the next one */ - - /* delete this request */ - wm->read_req = req->next; - free(req); - - /* if another request exists send it to the wiimote */ - if (wm->read_req) { - wiiuse_send_next_pending_read_request(wm); - } - - return; - } - - len = ((msg[2] & 0xF0) >> 4) + 1; - offset = from_big_endian_uint16_t(msg + 3); - req->addr = (req->addr & 0xFFFF); - - req->wait -= len; - if (req->wait >= req->size) - /* this should never happen */ - { - req->wait = 0; - } - - WIIUSE_DEBUG("Received read packet:"); - WIIUSE_DEBUG(" Packet read offset: %i bytes", offset); - WIIUSE_DEBUG(" Request read offset: %i bytes", req->addr); - WIIUSE_DEBUG(" Read offset into buf: %i bytes", offset - req->addr); - WIIUSE_DEBUG(" Read data size: %i bytes", len); - WIIUSE_DEBUG(" Still need: %i bytes", req->wait); - - /* reconstruct this part of the data */ - memcpy((req->buf + offset - req->addr), (msg + 5), len); - -#ifdef WITH_WIIUSE_DEBUG - { - int i = 0; - printf("Read: "); - for (; i < req->size - req->wait; ++i) { - printf("%x ", req->buf[i]); - } - printf("\n"); - } -#endif - - /* if all data has been received, execute the read event callback or generate event */ - if (!req->wait) { - if (req->cb) { - /* this was a callback, so invoke it now */ - req->cb(wm, req->buf, req->size); - - /* delete this request */ - wm->read_req = req->next; - free(req); - } else { - /* - * This should generate an event. - * We need to leave the event in the array so the client - * can access it still. We'll flag is as being 'dirty' - * and give the client one cycle to use it. Next event - * we will remove it from the list. - */ - wm->event = WIIUSE_READ_DATA; - req->dirty = 1; - } - - /* if another request exists send it to the wiimote */ - if (wm->read_req) { - wiiuse_send_next_pending_read_request(wm); - } - } -} - - -static void event_data_write(struct wiimote_t *wm, byte *msg) { - - struct data_req_t* req = wm->data_req; - - wiiuse_pressed_buttons(wm, msg); - - /* if we don't have a request out then we didn't ask for this packet */ - if (!req) { - WIIUSE_WARNING("Transmitting data packet when no request was made."); - return; - } - if (!(req->state == REQ_SENT)) { - WIIUSE_WARNING("Transmission is not necessary"); - /* delete this request */ - wm->data_req = req->next; - free(req); - return; - } - - - req->state = REQ_DONE; - - if (req->cb) { - /* this was a callback, so invoke it now */ - req->cb(wm, NULL, 0); - /* delete this request */ - wm->data_req = req->next; - free(req); - } else { - /* - * This should generate an event. - * We need to leave the event in the array so the client - * can access it still. We'll flag is as being 'REQ_DONE' - * and give the client one cycle to use it. Next event - * we will remove it from the list. - */ - wm->event = WIIUSE_WRITE_DATA; - - } - /* if another request exists send it to the wiimote */ - if (wm->data_req) { - wiiuse_send_next_pending_write_request(wm); - } -} - -/** - * @brief Read the controller status. - * - * @param wm Pointer to a wiimote_t structure. - * @param msg The message specified in the event packet. - * - * Read the controller status and execute the registered status callback. - */ -static void event_status(struct wiimote_t* wm, byte* msg) { - int led[4] = {0, 0, 0, 0}; - int attachment = 0; - int ir = 0; - int exp_changed = 0; - struct data_req_t* req = wm->data_req; - - /* initial handshake is not finished yet, ignore this */ - if (WIIMOTE_IS_SET(wm, WIIMOTE_STATE_HANDSHAKE)) { - return; - } - - /* - * An event occurred. - * This event can be overwritten by a more specific - * event type during a handshake or expansion removal. - */ - wm->event = WIIUSE_STATUS; - - wiiuse_pressed_buttons(wm, msg); - - /* find what LEDs are lit */ - if (msg[2] & WM_CTRL_STATUS_BYTE1_LED_1) { - led[0] = 1; - } - if (msg[2] & WM_CTRL_STATUS_BYTE1_LED_2) { - led[1] = 1; - } - if (msg[2] & WM_CTRL_STATUS_BYTE1_LED_3) { - led[2] = 1; - } - if (msg[2] & WM_CTRL_STATUS_BYTE1_LED_4) { - led[3] = 1; - } - - /* probe for Motion+ */ - if (!WIIMOTE_IS_SET(wm, WIIMOTE_STATE_MPLUS_PRESENT)) { - wiiuse_probe_motion_plus(wm); - } - - /* is an attachment connected to the expansion port? */ - if ((msg[2] & WM_CTRL_STATUS_BYTE1_ATTACHMENT) == WM_CTRL_STATUS_BYTE1_ATTACHMENT) { - WIIUSE_DEBUG("Attachment detected!"); - attachment = 1; - } - - /* is the speaker enabled? */ - if ((msg[2] & WM_CTRL_STATUS_BYTE1_SPEAKER_ENABLED) == WM_CTRL_STATUS_BYTE1_SPEAKER_ENABLED) { - WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_SPEAKER); - } - - /* is IR sensing enabled? */ - if ((msg[2] & WM_CTRL_STATUS_BYTE1_IR_ENABLED) == WM_CTRL_STATUS_BYTE1_IR_ENABLED) { - ir = 1; - } - - /* find the battery level and normalize between 0 and 1 */ - wm->battery_level = (msg[5] / (float)WM_MAX_BATTERY_CODE); - - /* expansion port */ - if (attachment && !WIIMOTE_IS_SET(wm, WIIMOTE_STATE_EXP) && !WIIMOTE_IS_SET(wm, WIIMOTE_STATE_EXP_HANDSHAKE)) { - /* send the initialization code for the attachment */ - handshake_expansion(wm, NULL, 0); - exp_changed = 1; - } else if (!attachment && WIIMOTE_IS_SET(wm, WIIMOTE_STATE_EXP)) { - /* attachment removed */ - disable_expansion(wm); - exp_changed = 1; - } - -#ifdef WIIUSE_WIN32 - if (!attachment) { - WIIUSE_DEBUG("Setting timeout to normal %i ms.", wm->normal_timeout); - wm->timeout = wm->normal_timeout; - } -#endif - - /* - * From now on the remote will only send status packets. - * We need to send a WIIMOTE_CMD_REPORT_TYPE packet to - * reenable other incoming reports. - */ - if (exp_changed && WIIMOTE_IS_SET(wm, WIIMOTE_STATE_IR)) { - /* - * Since the expansion status changed IR needs to - * be reset for the new IR report mode. - */ - WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_IR); - wiiuse_set_ir(wm, 1); - } else { - wiiuse_set_report_type(wm); - return; - } - - /* handling new Tx for changed exp */ - if (!req) { - return; - } - if (!(req->state == REQ_SENT)) { - return; - } - wm->data_req = req->next; - req->state = REQ_DONE; - /* if(req->cb!=NULL) req->cb(wm,msg,6); */ - free(req); -} - - -/** - * @brief Handle data from the expansion. - * - * @param wm A pointer to a wiimote_t structure. - * @param msg The message specified in the event packet for the expansion. - */ -static void handle_expansion(struct wiimote_t* wm, byte* msg) { - switch (wm->exp.type) { - case EXP_NUNCHUK: - nunchuk_event(&wm->exp.nunchuk, msg); - break; - case EXP_CLASSIC: - classic_ctrl_event(&wm->exp.classic, msg); - break; - case EXP_GUITAR_HERO_3: - guitar_hero_3_event(&wm->exp.gh3, msg); - break; - case EXP_WII_BOARD: - wii_board_event(&wm->exp.wb, msg); - break; - case EXP_MOTION_PLUS: - case EXP_MOTION_PLUS_CLASSIC: - case EXP_MOTION_PLUS_NUNCHUK: - motion_plus_event(&wm->exp.mp, wm->exp.type, msg); - break; - default: - break; - } -} - - -/** - * @brief Handle the handshake data from the expansion device. - * - * @param wm A pointer to a wiimote_t structure. - * @param data The data read in from the device. - * @param len The length of the data block, in bytes. - * - * Tries to determine what kind of expansion was attached - * and invoke the correct handshake function. - * - * If the data is NULL then this function will try to start - * a handshake with the expansion. - */ -void handshake_expansion(struct wiimote_t* wm, byte* data, uint16_t len) { - int id; - byte val = 0; - byte buf = 0x00; - byte* handshake_buf; - int gotIt = 0; - WIIUSE_DEBUG("handshake_expansion with state %d", wm->expansion_state); - - switch (wm->expansion_state) { - /* These two initialization writes disable the encryption */ - case 0: - wm->expansion_state = 1; - /* increase the timeout until the handshake completes */ -#ifdef WIIUSE_WIN32 - WIIUSE_DEBUG("write 0x55 - Setting timeout to expansion %i ms.", wm->exp_timeout); - wm->timeout = wm->exp_timeout; -#endif - buf = 0x55; - wiiuse_write_data_cb(wm, WM_EXP_MEM_ENABLE1, &buf, 1, handshake_expansion); - break; - case 1: - wm->expansion_state = 2; - /* increase the timeout until the handshake completes */ -#ifdef WIIUSE_WIN32 - WIIUSE_DEBUG("write 0x00 - Setting timeout to expansion %i ms.", wm->exp_timeout); - wm->timeout = wm->exp_timeout; -#endif - val = 0x00; - wiiuse_write_data_cb(wm, WM_EXP_MEM_ENABLE2, &buf, 1, handshake_expansion); - break; - case 2: - wm->expansion_state = 3; - /* get the calibration data */ - if (WIIMOTE_IS_SET(wm, WIIMOTE_STATE_EXP)) { - disable_expansion(wm); - } - handshake_buf = malloc(EXP_HANDSHAKE_LEN * sizeof(byte)); - /* tell the wiimote to send expansion data */ - WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_EXP); - wiiuse_read_data_cb(wm, handshake_expansion, handshake_buf, WM_EXP_MEM_CALIBR, EXP_HANDSHAKE_LEN); - break; - case 3: - if (!data || !len) { - WIIUSE_DEBUG("no handshake data received from expansion"); - disable_expansion(wm); - return; - } - wm->expansion_state = 0; - id = from_big_endian_uint32_t(data + 220); - switch (id) { - case EXP_ID_CODE_NUNCHUK: - if (nunchuk_handshake(wm, &wm->exp.nunchuk, data, len)) { - wm->event = WIIUSE_NUNCHUK_INSERTED; - gotIt = 1; - } - break; - - case EXP_ID_CODE_CLASSIC_CONTROLLER: - if (classic_ctrl_handshake(wm, &wm->exp.classic, data, len)) { - wm->event = WIIUSE_CLASSIC_CTRL_INSERTED; - gotIt = 1; - } - break; - - case EXP_ID_CODE_GUITAR: - if (guitar_hero_3_handshake(wm, &wm->exp.gh3, data, len)) { - wm->event = WIIUSE_GUITAR_HERO_3_CTRL_INSERTED; - gotIt = 1; - } - break; - - case EXP_ID_CODE_MOTION_PLUS: - case EXP_ID_CODE_MOTION_PLUS_CLASSIC: - case EXP_ID_CODE_MOTION_PLUS_NUNCHUK: - /* wiiuse_motion_plus_handshake(wm, data, len); */ - wm->event = WIIUSE_MOTION_PLUS_ACTIVATED; - gotIt = 1; - break; - - case EXP_ID_CODE_WII_BOARD: - if (wii_board_handshake(wm, &wm->exp.wb, data, len)) { - wm->event = WIIUSE_WII_BOARD_CTRL_INSERTED; - gotIt = 1; - } - break; - - default: - WIIUSE_WARNING("Unknown expansion type. Code: 0x%x", id); - break; - } - free(data); - if (gotIt) { - WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_EXP_HANDSHAKE); - WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_EXP); - } else { - WIIUSE_WARNING("Could not handshake with expansion id: 0x%x", id); - } - wiiuse_set_ir_mode(wm); - wiiuse_status(wm); - break; - } -} - - - -/** - * @brief Disable the expansion device if it was enabled. - * - * @param wm A pointer to a wiimote_t structure. - * @param data The data read in from the device. - * @param len The length of the data block, in bytes. - * - * If the data is NULL then this function will try to start - * a handshake with the expansion. - */ -void disable_expansion(struct wiimote_t* wm) { - WIIUSE_DEBUG("Disabling expansion"); - if (!WIIMOTE_IS_SET(wm, WIIMOTE_STATE_EXP)) { - return; - } - - /* tell the associated module the expansion was removed */ - switch (wm->exp.type) { - case EXP_NUNCHUK: - nunchuk_disconnected(&wm->exp.nunchuk); - wm->event = WIIUSE_NUNCHUK_REMOVED; - break; - case EXP_CLASSIC: - classic_ctrl_disconnected(&wm->exp.classic); - wm->event = WIIUSE_CLASSIC_CTRL_REMOVED; - break; - case EXP_GUITAR_HERO_3: - guitar_hero_3_disconnected(&wm->exp.gh3); - wm->event = WIIUSE_GUITAR_HERO_3_CTRL_REMOVED; - break; - case EXP_WII_BOARD: - wii_board_disconnected(&wm->exp.wb); - wm->event = WIIUSE_WII_BOARD_CTRL_REMOVED; - break; - case EXP_MOTION_PLUS: - case EXP_MOTION_PLUS_CLASSIC: - case EXP_MOTION_PLUS_NUNCHUK: - motion_plus_disconnected(&wm->exp.mp); - wm->event = WIIUSE_MOTION_PLUS_REMOVED; - break; - default: - break; - } - - WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_EXP); - wm->exp.type = EXP_NONE; - wm->expansion_state = 0; -} - - -/** - * @brief Save important state data. - * @param wm A pointer to a wiimote_t structure. - */ -static void save_state(struct wiimote_t* wm) { - /* wiimote */ - wm->lstate.btns = wm->btns; - wm->lstate.accel = wm->accel; - - /* ir */ - if (WIIUSE_USING_IR(wm)) { - wm->lstate.ir_ax = wm->ir.ax; - wm->lstate.ir_ay = wm->ir.ay; - wm->lstate.ir_distance = wm->ir.distance; - } - - /* expansion */ - switch (wm->exp.type) { - case EXP_NUNCHUK: - wm->lstate.exp_ljs_ang = wm->exp.nunchuk.js.ang; - wm->lstate.exp_ljs_mag = wm->exp.nunchuk.js.mag; - wm->lstate.exp_btns = wm->exp.nunchuk.btns; - wm->lstate.exp_accel = wm->exp.nunchuk.accel; - break; - - case EXP_CLASSIC: - wm->lstate.exp_ljs_ang = wm->exp.classic.ljs.ang; - wm->lstate.exp_ljs_mag = wm->exp.classic.ljs.mag; - wm->lstate.exp_rjs_ang = wm->exp.classic.rjs.ang; - wm->lstate.exp_rjs_mag = wm->exp.classic.rjs.mag; - wm->lstate.exp_r_shoulder = wm->exp.classic.r_shoulder; - wm->lstate.exp_l_shoulder = wm->exp.classic.l_shoulder; - wm->lstate.exp_btns = wm->exp.classic.btns; - break; - - case EXP_GUITAR_HERO_3: - wm->lstate.exp_ljs_ang = wm->exp.gh3.js.ang; - wm->lstate.exp_ljs_mag = wm->exp.gh3.js.mag; - wm->lstate.exp_r_shoulder = wm->exp.gh3.whammy_bar; - wm->lstate.exp_btns = wm->exp.gh3.btns; - break; - - case EXP_WII_BOARD: - wm->lstate.exp_wb_rtr = wm->exp.wb.rtr; - wm->lstate.exp_wb_rtl = wm->exp.wb.rtl; - wm->lstate.exp_wb_rbr = wm->exp.wb.rbr; - wm->lstate.exp_wb_rbl = wm->exp.wb.rbl; - break; - - case EXP_MOTION_PLUS: - case EXP_MOTION_PLUS_CLASSIC: - case EXP_MOTION_PLUS_NUNCHUK: { - wm->lstate.drx = wm->exp.mp.raw_gyro.pitch; - wm->lstate.dry = wm->exp.mp.raw_gyro.roll; - wm->lstate.drz = wm->exp.mp.raw_gyro.yaw; - - if (wm->exp.type == EXP_MOTION_PLUS_CLASSIC) { - wm->lstate.exp_ljs_ang = wm->exp.classic.ljs.ang; - wm->lstate.exp_ljs_mag = wm->exp.classic.ljs.mag; - wm->lstate.exp_rjs_ang = wm->exp.classic.rjs.ang; - wm->lstate.exp_rjs_mag = wm->exp.classic.rjs.mag; - wm->lstate.exp_r_shoulder = wm->exp.classic.r_shoulder; - wm->lstate.exp_l_shoulder = wm->exp.classic.l_shoulder; - wm->lstate.exp_btns = wm->exp.classic.btns; - } else { - wm->lstate.exp_ljs_ang = wm->exp.nunchuk.js.ang; - wm->lstate.exp_ljs_mag = wm->exp.nunchuk.js.mag; - wm->lstate.exp_btns = wm->exp.nunchuk.btns; - wm->lstate.exp_accel = wm->exp.nunchuk.accel; - } - - break; - } - - case EXP_NONE: - break; - } -} - - -/** - * @brief Determine if the current state differs significantly from the previous. - * @param wm A pointer to a wiimote_t structure. - * @return 1 if a significant change occurred, 0 if not. - */ -static int state_changed(struct wiimote_t* wm) { -#define STATE_CHANGED(a, b) if (a != b) return 1 - -#define CROSS_THRESH(last, now, thresh) \ - do { \ - if (WIIMOTE_IS_FLAG_SET(wm, WIIUSE_ORIENT_THRESH)) { \ - if ((diff_f(last.roll, now.roll) >= thresh) || \ - (diff_f(last.pitch, now.pitch) >= thresh) || \ - (diff_f(last.yaw, now.yaw) >= thresh)) \ - { \ - last = now; \ - return 1; \ - } \ - } else { \ - if (last.roll != now.roll) return 1; \ - if (last.pitch != now.pitch) return 1; \ - if (last.yaw != now.yaw) return 1; \ - } \ - } while (0) - -#define CROSS_THRESH_XYZ(last, now, thresh) \ - do { \ - if (WIIMOTE_IS_FLAG_SET(wm, WIIUSE_ORIENT_THRESH)) { \ - if ((diff_f(last.x, now.x) >= thresh) || \ - (diff_f(last.y, now.y) >= thresh) || \ - (diff_f(last.z, now.z) >= thresh)) \ - { \ - last = now; \ - return 1; \ - } \ - } else { \ - if (last.x != now.x) return 1; \ - if (last.y != now.y) return 1; \ - if (last.z != now.z) return 1; \ - } \ - } while (0) - - /* ir */ - if (WIIUSE_USING_IR(wm)) { - STATE_CHANGED(wm->lstate.ir_ax, wm->ir.ax); - STATE_CHANGED(wm->lstate.ir_ay, wm->ir.ay); - STATE_CHANGED(wm->lstate.ir_distance, wm->ir.distance); - } - - /* accelerometer */ - if (WIIUSE_USING_ACC(wm)) { - /* raw accelerometer */ - CROSS_THRESH_XYZ(wm->lstate.accel, wm->accel, wm->accel_threshold); - - /* orientation */ - CROSS_THRESH(wm->lstate.orient, wm->orient, wm->orient_threshold); - } - - /* expansion */ - switch (wm->exp.type) { - case EXP_NUNCHUK: { - STATE_CHANGED(wm->lstate.exp_ljs_ang, wm->exp.nunchuk.js.ang); - STATE_CHANGED(wm->lstate.exp_ljs_mag, wm->exp.nunchuk.js.mag); - STATE_CHANGED(wm->lstate.exp_btns, wm->exp.nunchuk.btns); - - CROSS_THRESH(wm->lstate.exp_orient, wm->exp.nunchuk.orient, wm->exp.nunchuk.orient_threshold); - CROSS_THRESH_XYZ(wm->lstate.exp_accel, wm->exp.nunchuk.accel, wm->exp.nunchuk.accel_threshold); - break; - } - case EXP_CLASSIC: { - STATE_CHANGED(wm->lstate.exp_ljs_ang, wm->exp.classic.ljs.ang); - STATE_CHANGED(wm->lstate.exp_ljs_mag, wm->exp.classic.ljs.mag); - STATE_CHANGED(wm->lstate.exp_rjs_ang, wm->exp.classic.rjs.ang); - STATE_CHANGED(wm->lstate.exp_rjs_mag, wm->exp.classic.rjs.mag); - STATE_CHANGED(wm->lstate.exp_r_shoulder, wm->exp.classic.r_shoulder); - STATE_CHANGED(wm->lstate.exp_l_shoulder, wm->exp.classic.l_shoulder); - STATE_CHANGED(wm->lstate.exp_btns, wm->exp.classic.btns); - break; - } - case EXP_GUITAR_HERO_3: { - STATE_CHANGED(wm->lstate.exp_ljs_ang, wm->exp.gh3.js.ang); - STATE_CHANGED(wm->lstate.exp_ljs_mag, wm->exp.gh3.js.mag); - STATE_CHANGED(wm->lstate.exp_r_shoulder, wm->exp.gh3.whammy_bar); - STATE_CHANGED(wm->lstate.exp_btns, wm->exp.gh3.btns); - break; - } - case EXP_WII_BOARD: { - STATE_CHANGED(wm->lstate.exp_wb_rtr, wm->exp.wb.tr); - STATE_CHANGED(wm->lstate.exp_wb_rtl, wm->exp.wb.tl); - STATE_CHANGED(wm->lstate.exp_wb_rbr, wm->exp.wb.br); - STATE_CHANGED(wm->lstate.exp_wb_rbl, wm->exp.wb.bl); - break; - } - - case EXP_MOTION_PLUS: - case EXP_MOTION_PLUS_CLASSIC: - case EXP_MOTION_PLUS_NUNCHUK: { - STATE_CHANGED(wm->lstate.drx, wm->exp.mp.raw_gyro.pitch); - STATE_CHANGED(wm->lstate.dry, wm->exp.mp.raw_gyro.roll); - STATE_CHANGED(wm->lstate.drz, wm->exp.mp.raw_gyro.yaw); - - if (wm->exp.type == EXP_MOTION_PLUS_CLASSIC) { - STATE_CHANGED(wm->lstate.exp_ljs_ang, wm->exp.classic.ljs.ang); - STATE_CHANGED(wm->lstate.exp_ljs_mag, wm->exp.classic.ljs.mag); - STATE_CHANGED(wm->lstate.exp_rjs_ang, wm->exp.classic.rjs.ang); - STATE_CHANGED(wm->lstate.exp_rjs_mag, wm->exp.classic.rjs.mag); - STATE_CHANGED(wm->lstate.exp_r_shoulder, wm->exp.classic.r_shoulder); - STATE_CHANGED(wm->lstate.exp_l_shoulder, wm->exp.classic.l_shoulder); - STATE_CHANGED(wm->lstate.exp_btns, wm->exp.classic.btns); - } else { - STATE_CHANGED(wm->lstate.exp_ljs_ang, wm->exp.nunchuk.js.ang); - STATE_CHANGED(wm->lstate.exp_ljs_mag, wm->exp.nunchuk.js.mag); - STATE_CHANGED(wm->lstate.exp_btns, wm->exp.nunchuk.btns); - - CROSS_THRESH(wm->lstate.exp_orient, wm->exp.nunchuk.orient, wm->exp.nunchuk.orient_threshold); - CROSS_THRESH_XYZ(wm->lstate.exp_accel, wm->exp.nunchuk.accel, wm->exp.nunchuk.accel_threshold); - } - - break; - } - case EXP_NONE: { - break; - } - } - - STATE_CHANGED(wm->lstate.btns, wm->btns); - - return 0; -} diff --git a/lib/wiiuse/example-sdl/CMakeLists.txt b/lib/wiiuse/example-sdl/CMakeLists.txt new file mode 100644 index 000000000..a7cb4dec0 --- /dev/null +++ b/lib/wiiuse/example-sdl/CMakeLists.txt @@ -0,0 +1,14 @@ +find_package(SDL) +find_package(OpenGL) +find_package(GLUT) + +if(SDL_FOUND AND OPENGL_FOUND AND GLUT_FOUND) + include_directories(../src ${SDL_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR} ${GLUT_INCLUDE_DIRS}) + add_executable(wiiuseexample-sdl sdl.c) + target_link_libraries(wiiuseexample-sdl wiiuse ${SDL_LIBRARY} ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES}) + + if(INSTALL_EXAMPLES) + install(TARGETS wiiuseexample-sdl + RUNTIME DESTINATION bin COMPONENT examples) + endif() +endif() diff --git a/lib/wiiuse/example-sdl/sdl.c b/lib/wiiuse/example-sdl/sdl.c new file mode 100644 index 000000000..97a9470c0 --- /dev/null +++ b/lib/wiiuse/example-sdl/sdl.c @@ -0,0 +1,464 @@ +/* + * Written By: + * Michael Laforest < para > + * Email: < thepara (--AT--) g m a i l [--DOT--] com > + * + * Copyright 2006-2007 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * $Header$ + */ + +#include + +#include /* for SDL_Init, SDL_Quit */ +#include /* for SDL_GetError */ +#include /* for SDL_Event, SDL_PollEvent, etc */ +#include /* for SDL_GL_SetAttribute, etc */ + +#ifndef WIIUSE_MAC + #include /* for glVertex3f, GLfloat, etc */ + #include /* for gluLookAt, gluOrtho2D, etc */ + #include /* for glutSolidTeapot */ +#else + /* Mac doesn't use the same folders for OpenGL/GLUT includes */ + #include /* for glVertex3f, GLfloat, etc */ + #include /* for gluLookAt, gluOrtho2D, etc */ + #include /* for glutSolidTeapot */ +#endif + +#ifndef WIIUSE_WIN32 + #include /* for timeval, gettimeofday */ + #include /* for time */ + #include /* for usleep */ +#else + #include +#endif + +#include /* for printf */ + +#define PI 3.14159265358979323846 +#define PI_DIV_180 0.017453292519943296 +#define deg PI_DIV_180 + +#define MAX_WIIMOTES 2 + +GLint width = 1024, height = 768; +GLfloat backColor[4] = {1.0, 1.0, 1.0, 1.0}; + +wiimote** wiimotes = NULL; + +int last_dots[4][2] = {{0}}; +int xcoord = 0; +int ycoord = 0; + +#ifdef WIN32 +DWORD last_render; +#else +struct timeval last_render; +int last_sec = 0; +int fps = 0; +#endif + +enum render_mode_t { + IR = 1, + TEAPOT +}; +enum render_mode_t render_mode = IR; + +/* light information */ +struct light_t { + GLfloat position[4]; + GLfloat spotDirection[3]; + GLfloat ambient[4]; + GLfloat diffuse[4]; + GLfloat specular[4]; + GLfloat spotCutoff; + GLfloat spotExponent; + GLfloat spotAttenuation[3]; /* [0] = constant, [1] = linear, [2] = quadratic */ +}; +struct light_t light = { + { 1.0, 1.0, -2.0, 1.0 }, + { -1.0, -1.0, 2.0 }, + { 0.0, 0.0, 0.0, 1.0 }, + { 1.0, 1.0, 1.0, 1.0 }, + { 1.0, 1.0, 1.0, 1.0 }, + 180.0, 0.0, + { 1.0, 0.0, 0.0 } +}; + +/* material information */ +struct material_t { + GLfloat ambient[4]; + GLfloat diffuse[4]; + GLfloat specular[4]; + GLfloat emission[4]; + GLfloat shininess; +}; +struct material_t red_plastic = { + { 0.3, 0.0, 0.0, 1.0 }, + { 0.3, 0.0, 0.0, 1.0 }, + { 0.8, 0.6, 0.6, 1.0 }, + { 0.0, 0.0, 0.0, 1.0 }, + 32.0 +}; + + +void handle_event(struct wiimote_t* wm); +void display(); +void update_light(GLenum l, struct light_t* lptr); +void set_material(struct material_t* mptr); +void resize_window(GLint new_width, GLint new_height); + +void handle_event(struct wiimote_t* wm) { + if (IS_JUST_PRESSED(wm, WIIMOTE_BUTTON_PLUS)) { + wiiuse_motion_sensing(wm, 1); + } + if (IS_JUST_PRESSED(wm, WIIMOTE_BUTTON_MINUS)) { + wiiuse_motion_sensing(wm, 0); + } + + if (IS_JUST_PRESSED(wm, WIIMOTE_BUTTON_UP)) { + wiiuse_set_ir(wm, 1); + } + if (IS_JUST_PRESSED(wm, WIIMOTE_BUTTON_DOWN)) { + wiiuse_set_ir(wm, 0); + } + + if (IS_JUST_PRESSED(wm, WIIMOTE_BUTTON_B)) { + wiiuse_toggle_rumble(wm); + } + + if (IS_JUST_PRESSED(wm, WIIMOTE_BUTTON_ONE)) { + int level; + WIIUSE_GET_IR_SENSITIVITY(wm, &level); + wiiuse_set_ir_sensitivity(wm, level + 1); + } + if (IS_JUST_PRESSED(wm, WIIMOTE_BUTTON_TWO)) { + int level; + WIIUSE_GET_IR_SENSITIVITY(wm, &level); + wiiuse_set_ir_sensitivity(wm, level - 1); + } + +#if 0 + if (IS_JUST_PRESSED(wm, WIIMOTE_BUTTON_A)) { + if (render_mode == IR) { + render_mode = TEAPOT; + } else { + render_mode = IR; + } + resize_window(width, height); + } +#endif +} + +#define DRAW_TRIANGLE(x, y, z, s) do { \ + glVertex3f(x, y-s, z); \ + glVertex3f(x+s, y+s, z); \ + glVertex3f(x-s, y+s, z); \ + } while (0) + +int can_render() { + /* quick fps limit to ~60fps -- not too fancy, could be better */ +#ifdef WIN32 + if (GetTickCount() < (last_render + 16)) { + return 0; + } + last_render = GetTickCount(); + return 1; +#else + struct timeval now; + long elapsed_usec = 0; + + gettimeofday(&now, NULL); + + if (now.tv_usec > 1000000) { + now.tv_usec -= 1000000; + ++now.tv_sec; + } + + if (now.tv_sec > last_render.tv_sec) { + elapsed_usec = ((now.tv_sec - last_render.tv_sec) * 1000000); + } + + if (now.tv_usec > last_render.tv_usec) { + elapsed_usec += now.tv_usec - last_render.tv_usec; + } else { + elapsed_usec += last_render.tv_usec - now.tv_usec; + } + + if (time(NULL) > last_sec) { + printf("fps: %i\n", fps); + fps = 0; + last_sec = time(NULL); + } + + if (elapsed_usec < 16000) { + return 0; + } + + last_render = now; + ++fps; + + return 1; +#endif +} + +void display() { + int i, wm; + float size = 5; + + if (!can_render()) { + return; + } + + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + if (render_mode == IR) { + /* draw the IR stuff */ + + glDisable(GL_LIGHTING); + + glBegin(GL_TRIANGLES); + /* green center */ + glColor3f(0.0, 1.0, 0.0); + DRAW_TRIANGLE(width / 2, height / 2, 0, size); + glEnd(); + + for (wm = 0; wm < MAX_WIIMOTES; ++wm) { + glBegin(GL_TRIANGLES); + /* red ir */ + glColor3f(1.0, 0.0, 0.0); + for (i = 0; i < 4; ++i) { + if (wiimotes[wm]->ir.dot[i].visible) { + DRAW_TRIANGLE(wiimotes[wm]->ir.dot[i].rx, wiimotes[wm]->ir.dot[i].ry, 0, size); + } + } + + /* yellow corrected ir */ + glColor3f(1.0, 1.0, 0.0); + for (i = 0; i < 4; ++i) { + if (wiimotes[wm]->ir.dot[i].visible) { + DRAW_TRIANGLE(wiimotes[wm]->ir.dot[i].x, wiimotes[wm]->ir.dot[i].y, 0, size); + } + } + + /* blue cursor */ + glColor3f(0.0, 0.0, 1.0); + DRAW_TRIANGLE(wiimotes[wm]->ir.x, wiimotes[wm]->ir.y - size, 0, size); + glEnd(); + } + } else { + /* draw the teapot */ + gluLookAt(0.0, 0.0, -5.0, + 0.0, 0.0, 0.0, + 0.0, 1.0, 0.0); + + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + update_light(GL_LIGHT0, &light); + set_material(&red_plastic); + + glRotatef(wiimotes[0]->orient.roll, 0.0f, 0.0f, 1.0f); + glRotatef(wiimotes[0]->orient.pitch, 1.0f, 0.0f, 0.0f); + + + glutSolidTeapot(1); + } + + SDL_GL_SwapBuffers(); +} + + +void update_light(GLenum l, struct light_t* lptr) { + glLightfv(l, GL_POSITION, lptr->position); + glLightfv(l, GL_DIFFUSE, lptr->diffuse); + glLightfv(l, GL_SPECULAR, lptr->specular); + glLightfv(l, GL_AMBIENT, lptr->ambient); + glLightfv(l, GL_SPOT_DIRECTION, lptr->spotDirection); + glLightf(l, GL_SPOT_CUTOFF, lptr->spotCutoff); + glLightf(l, GL_SPOT_EXPONENT, lptr->spotExponent); + glLightf(l, GL_CONSTANT_ATTENUATION, lptr->spotAttenuation[0]); + glLightf(l, GL_LINEAR_ATTENUATION, lptr->spotAttenuation[1]); + glLightf(l, GL_QUADRATIC_ATTENUATION, lptr->spotAttenuation[2]); +} + + +void set_material(struct material_t* mptr) { + glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, mptr->ambient); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, mptr->diffuse); + glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, mptr->specular); + glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, mptr->shininess); + glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, mptr->emission); +} + + +void resize_window(GLint new_width, GLint new_height) { + int wm; + + width = new_width; + height = new_height; + + if (new_height == 0) { + new_height = 1; + } + + SDL_SetVideoMode(width, height, 16, SDL_RESIZABLE | SDL_OPENGL); + + glViewport(0, 0, new_width, new_height); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + + if (render_mode == IR) { + gluOrtho2D(0, width, height, 0); + } else { + gluPerspective(60.0f, (float)new_width / (float)new_height, 0.1f, 100.0f); + } + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + width = new_width; + height = new_height; + + for (wm = 0; wm < MAX_WIIMOTES; ++wm) { + wiiuse_set_ir_vres(wiimotes[wm], width, height); + } +} + +#ifndef WIN32 +int main(int argc, char** argv) { +#else +int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { +#endif + int found, connected; + int wm; + + /* printf("wiiuse version = %s\n", wiiuse_version()); */ + + wiimotes = wiiuse_init(MAX_WIIMOTES); + found = wiiuse_find(wiimotes, MAX_WIIMOTES, 5); + if (!found) { + return 0; + } + connected = wiiuse_connect(wiimotes, MAX_WIIMOTES); + if (connected) { + printf("Connected to %i wiimotes (of %i found).\n", connected, found); + } else { + printf("Failed to connect to any wiimote.\n"); + return 0; + } + wiiuse_set_leds(wiimotes[0], WIIMOTE_LED_1 | WIIMOTE_LED_4); + wiiuse_set_leds(wiimotes[1], WIIMOTE_LED_2 | WIIMOTE_LED_4); + wiiuse_rumble(wiimotes[0], 1); + +#ifndef WIN32 + usleep(200000); +#else + Sleep(200); +#endif + + wiiuse_rumble(wiimotes[0], 0); + + /* enable IR and motion sensing for all wiimotes */ + for (wm = 0; wm < MAX_WIIMOTES; ++wm) { + wiiuse_motion_sensing(wiimotes[wm], 1); + wiiuse_set_ir(wiimotes[wm], 1); + } + + if (SDL_Init(SDL_INIT_VIDEO) < 0) { + printf("Failed to initialize SDL: %s\n", SDL_GetError()); + return 0; + } + + SDL_WM_SetCaption("wiiuse SDL IR Example", "wiiuse SDL IR Example"); + + SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); + SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); + + /* set window size */ + width = wiimotes[0]->ir.vres[0]; + height = wiimotes[0]->ir.vres[1]; + SDL_SetVideoMode(width, height, 16, SDL_RESIZABLE | SDL_OPENGL); + + for (wm = 0; wm < MAX_WIIMOTES; ++wm) { + wiiuse_set_ir_vres(wiimotes[wm], width, height); + } + + /* set OpenGL stuff */ + glEnable(GL_DEPTH_TEST); + glEnable(GL_LIGHTING); + glEnable(GL_NORMALIZE); + glEnable(GL_BLEND); + + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glDepthFunc(GL_LEQUAL); + glClearColor(0, 0, 0, 0); + + /* set the size of the window */ + resize_window(width, height); + + display(); + +#ifdef WIN32 + last_render = GetTickCount(); +#endif + + while (1) { + SDL_Event event; + + if (SDL_PollEvent(&event)) { + switch (event.type) { + case SDL_VIDEORESIZE: { + /* resize the window */ + resize_window(event.resize.w, event.resize.h); + break; + } + case SDL_QUIT: { + /* shutdown */ + SDL_Quit(); + wiiuse_cleanup(wiimotes, MAX_WIIMOTES); + return 0; + } + default: { + } + } + } + + if (wiiuse_poll(wiimotes, MAX_WIIMOTES)) { + /* + * This happens if something happened on any wiimote. + * So go through each one and check if anything happened. + */ + int i = 0; + for (; i < MAX_WIIMOTES; ++i) { + switch (wiimotes[i]->event) { + case WIIUSE_EVENT: + /* a generic event occurred */ + handle_event(wiimotes[i]); + break; + + default: + break; + } + } + } + + display(); + } +} diff --git a/lib/wiiuse/example/CMakeLists.txt b/lib/wiiuse/example/CMakeLists.txt new file mode 100644 index 000000000..40f256a78 --- /dev/null +++ b/lib/wiiuse/example/CMakeLists.txt @@ -0,0 +1,8 @@ +include_directories(../src) +add_executable(wiiuseexample example.c) +target_link_libraries(wiiuseexample wiiuse) + +if(INSTALL_EXAMPLES) + install(TARGETS wiiuseexample + RUNTIME DESTINATION bin COMPONENT examples) +endif() \ No newline at end of file diff --git a/lib/wiiuse/example/example.c b/lib/wiiuse/example/example.c new file mode 100644 index 000000000..abecce988 --- /dev/null +++ b/lib/wiiuse/example/example.c @@ -0,0 +1,587 @@ +/* + * wiiuse + * + * Written By: + * Michael Laforest < para > + * Email: < thepara (--AT--) g m a i l [--DOT--] com > + * + * Copyright 2006-2007 + * + * This file is part of wiiuse. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * $Header$ + * + */ + +/** + * @file + * + * @brief Example using the wiiuse API. + * + * This file is an example of how to use the wiiuse library. + */ + +#include /* for printf */ + +#include "wiiuse.h" /* for wiimote_t, classic_ctrl_t, etc */ + +#ifndef WIIUSE_WIN32 +#include /* for usleep */ +#endif + +#define MAX_WIIMOTES 4 + + +/** + * @brief Callback that handles an event. + * + * @param wm Pointer to a wiimote_t structure. + * + * This function is called automatically by the wiiuse library when an + * event occurs on the specified wiimote. + */ +void handle_event(struct wiimote_t* wm) { + printf("\n\n--- EVENT [id %i] ---\n", wm->unid); + + /* if a button is pressed, report it */ + if (IS_PRESSED(wm, WIIMOTE_BUTTON_A)) { + printf("A pressed\n"); + } + if (IS_PRESSED(wm, WIIMOTE_BUTTON_B)) { + printf("B pressed\n"); + } + if (IS_PRESSED(wm, WIIMOTE_BUTTON_UP)) { + printf("UP pressed\n"); + } + if (IS_PRESSED(wm, WIIMOTE_BUTTON_DOWN)) { + printf("DOWN pressed\n"); + } + if (IS_PRESSED(wm, WIIMOTE_BUTTON_LEFT)) { + printf("LEFT pressed\n"); + } + if (IS_PRESSED(wm, WIIMOTE_BUTTON_RIGHT)) { + printf("RIGHT pressed\n"); + } + if (IS_PRESSED(wm, WIIMOTE_BUTTON_MINUS)) { + printf("MINUS pressed\n"); + } + if (IS_PRESSED(wm, WIIMOTE_BUTTON_PLUS)) { + printf("PLUS pressed\n"); + } + if (IS_PRESSED(wm, WIIMOTE_BUTTON_ONE)) { + printf("ONE pressed\n"); + } + if (IS_PRESSED(wm, WIIMOTE_BUTTON_TWO)) { + printf("TWO pressed\n"); + } + if (IS_PRESSED(wm, WIIMOTE_BUTTON_HOME)) { + printf("HOME pressed\n"); + } + + /* + * Pressing minus will tell the wiimote we are no longer interested in movement. + * This is useful because it saves battery power. + */ + if (IS_JUST_PRESSED(wm, WIIMOTE_BUTTON_MINUS)) { + wiiuse_motion_sensing(wm, 0); + } + + /* + * Pressing plus will tell the wiimote we are interested in movement. + */ + if (IS_JUST_PRESSED(wm, WIIMOTE_BUTTON_PLUS)) { + wiiuse_motion_sensing(wm, 1); + } + + /* + * Pressing B will toggle the rumble + * + * if B is pressed but is not held, toggle the rumble + */ + if (IS_JUST_PRESSED(wm, WIIMOTE_BUTTON_B)) { + wiiuse_toggle_rumble(wm); + } + + if (IS_JUST_PRESSED(wm, WIIMOTE_BUTTON_UP)) { + wiiuse_set_ir(wm, 1); + } + if (IS_JUST_PRESSED(wm, WIIMOTE_BUTTON_DOWN)) { + wiiuse_set_ir(wm, 0); + } + + /* + * Motion+ support + */ + if (IS_JUST_PRESSED(wm, WIIMOTE_BUTTON_ONE)) { + if (WIIUSE_USING_EXP(wm)) { + wiiuse_set_motion_plus(wm, 2); // nunchuck pass-through + } else { + wiiuse_set_motion_plus(wm, 1); // standalone + } + } + + if (IS_JUST_PRESSED(wm, WIIMOTE_BUTTON_TWO)) { + wiiuse_set_motion_plus(wm, 0); // off + } + + /* if the accelerometer is turned on then print angles */ + if (WIIUSE_USING_ACC(wm)) { + printf("wiimote roll = %f [%f]\n", wm->orient.roll, wm->orient.a_roll); + printf("wiimote pitch = %f [%f]\n", wm->orient.pitch, wm->orient.a_pitch); + printf("wiimote yaw = %f\n", wm->orient.yaw); + } + + /* + * If IR tracking is enabled then print the coordinates + * on the virtual screen that the wiimote is pointing to. + * + * Also make sure that we see at least 1 dot. + */ + if (WIIUSE_USING_IR(wm)) { + int i = 0; + + /* go through each of the 4 possible IR sources */ + for (; i < 4; ++i) { + /* check if the source is visible */ + if (wm->ir.dot[i].visible) { + printf("IR source %i: (%u, %u)\n", i, wm->ir.dot[i].x, wm->ir.dot[i].y); + } + } + + printf("IR cursor: (%u, %u)\n", wm->ir.x, wm->ir.y); + printf("IR z distance: %f\n", wm->ir.z); + } + + /* show events specific to supported expansions */ + if (wm->exp.type == EXP_NUNCHUK || wm->exp.type == EXP_MOTION_PLUS_NUNCHUK) { + /* nunchuk */ + struct nunchuk_t* nc = (nunchuk_t*)&wm->exp.nunchuk; + + if (IS_PRESSED(nc, NUNCHUK_BUTTON_C)) { + printf("Nunchuk: C pressed\n"); + } + if (IS_PRESSED(nc, NUNCHUK_BUTTON_Z)) { + printf("Nunchuk: Z pressed\n"); + } + + printf("nunchuk roll = %f\n", nc->orient.roll); + printf("nunchuk pitch = %f\n", nc->orient.pitch); + printf("nunchuk yaw = %f\n", nc->orient.yaw); + + printf("nunchuk joystick angle: %f\n", nc->js.ang); + printf("nunchuk joystick magnitude: %f\n", nc->js.mag); + + printf("nunchuk joystick vals: %f, %f\n", nc->js.x, nc->js.y); + printf("nunchuk joystick calibration (min, center, max): x: %i, %i, %i y: %i, %i, %i\n", + nc->js.min.x, + nc->js.center.x, + nc->js.max.x, + nc->js.min.y, + nc->js.center.y, + nc->js.max.y); + } else if (wm->exp.type == EXP_CLASSIC) { + /* classic controller */ + struct classic_ctrl_t* cc = (classic_ctrl_t*)&wm->exp.classic; + + if (IS_PRESSED(cc, CLASSIC_CTRL_BUTTON_ZL)) { + printf("Classic: ZL pressed\n"); + } + if (IS_PRESSED(cc, CLASSIC_CTRL_BUTTON_B)) { + printf("Classic: B pressed\n"); + } + if (IS_PRESSED(cc, CLASSIC_CTRL_BUTTON_Y)) { + printf("Classic: Y pressed\n"); + } + if (IS_PRESSED(cc, CLASSIC_CTRL_BUTTON_A)) { + printf("Classic: A pressed\n"); + } + if (IS_PRESSED(cc, CLASSIC_CTRL_BUTTON_X)) { + printf("Classic: X pressed\n"); + } + if (IS_PRESSED(cc, CLASSIC_CTRL_BUTTON_ZR)) { + printf("Classic: ZR pressed\n"); + } + if (IS_PRESSED(cc, CLASSIC_CTRL_BUTTON_LEFT)) { + printf("Classic: LEFT pressed\n"); + } + if (IS_PRESSED(cc, CLASSIC_CTRL_BUTTON_UP)) { + printf("Classic: UP pressed\n"); + } + if (IS_PRESSED(cc, CLASSIC_CTRL_BUTTON_RIGHT)) { + printf("Classic: RIGHT pressed\n"); + } + if (IS_PRESSED(cc, CLASSIC_CTRL_BUTTON_DOWN)) { + printf("Classic: DOWN pressed\n"); + } + if (IS_PRESSED(cc, CLASSIC_CTRL_BUTTON_FULL_L)) { + printf("Classic: FULL L pressed\n"); + } + if (IS_PRESSED(cc, CLASSIC_CTRL_BUTTON_MINUS)) { + printf("Classic: MINUS pressed\n"); + } + if (IS_PRESSED(cc, CLASSIC_CTRL_BUTTON_HOME)) { + printf("Classic: HOME pressed\n"); + } + if (IS_PRESSED(cc, CLASSIC_CTRL_BUTTON_PLUS)) { + printf("Classic: PLUS pressed\n"); + } + if (IS_PRESSED(cc, CLASSIC_CTRL_BUTTON_FULL_R)) { + printf("Classic: FULL R pressed\n"); + } + + printf("classic L button pressed: %f\n", cc->l_shoulder); + printf("classic R button pressed: %f\n", cc->r_shoulder); + printf("classic left joystick angle: %f\n", cc->ljs.ang); + printf("classic left joystick magnitude: %f\n", cc->ljs.mag); + printf("classic right joystick angle: %f\n", cc->rjs.ang); + printf("classic right joystick magnitude: %f\n", cc->rjs.mag); + } else if (wm->exp.type == EXP_GUITAR_HERO_3) { + /* guitar hero 3 guitar */ + struct guitar_hero_3_t* gh3 = (guitar_hero_3_t*)&wm->exp.gh3; + + if (IS_PRESSED(gh3, GUITAR_HERO_3_BUTTON_STRUM_UP)) { + printf("Guitar: Strum Up pressed\n"); + } + if (IS_PRESSED(gh3, GUITAR_HERO_3_BUTTON_STRUM_DOWN)) { + printf("Guitar: Strum Down pressed\n"); + } + if (IS_PRESSED(gh3, GUITAR_HERO_3_BUTTON_YELLOW)) { + printf("Guitar: Yellow pressed\n"); + } + if (IS_PRESSED(gh3, GUITAR_HERO_3_BUTTON_GREEN)) { + printf("Guitar: Green pressed\n"); + } + if (IS_PRESSED(gh3, GUITAR_HERO_3_BUTTON_BLUE)) { + printf("Guitar: Blue pressed\n"); + } + if (IS_PRESSED(gh3, GUITAR_HERO_3_BUTTON_RED)) { + printf("Guitar: Red pressed\n"); + } + if (IS_PRESSED(gh3, GUITAR_HERO_3_BUTTON_ORANGE)) { + printf("Guitar: Orange pressed\n"); + } + if (IS_PRESSED(gh3, GUITAR_HERO_3_BUTTON_PLUS)) { + printf("Guitar: Plus pressed\n"); + } + if (IS_PRESSED(gh3, GUITAR_HERO_3_BUTTON_MINUS)) { + printf("Guitar: Minus pressed\n"); + } + + printf("Guitar whammy bar: %f\n", gh3->whammy_bar); + printf("Guitar joystick angle: %f\n", gh3->js.ang); + printf("Guitar joystick magnitude: %f\n", gh3->js.mag); + } else if (wm->exp.type == EXP_WII_BOARD) { + /* wii balance board */ + struct wii_board_t* wb = (wii_board_t*)&wm->exp.wb; + float total = wb->tl + wb->tr + wb->bl + wb->br; + float x = ((wb->tr + wb->br) / total) * 2 - 1; + float y = ((wb->tl + wb->tr) / total) * 2 - 1; + printf("Weight: %f kg @ (%f, %f)\n", total, x, y); + printf("Interpolated weight: TL:%f TR:%f BL:%f BR:%f\n", wb->tl, wb->tr, wb->bl, wb->br); + printf("Raw: TL:%d TR:%d BL:%d BR:%d\n", wb->rtl, wb->rtr, wb->rbl, wb->rbr); + } + + if (wm->exp.type == EXP_MOTION_PLUS || + wm->exp.type == EXP_MOTION_PLUS_NUNCHUK) { + printf("Motion+ angular rates (deg/sec): pitch:%03.2f roll:%03.2f yaw:%03.2f\n", + wm->exp.mp.angle_rate_gyro.pitch, + wm->exp.mp.angle_rate_gyro.roll, + wm->exp.mp.angle_rate_gyro.yaw); + } +} + +/** + * @brief Callback that handles a read event. + * + * @param wm Pointer to a wiimote_t structure. + * @param data Pointer to the filled data block. + * @param len Length in bytes of the data block. + * + * This function is called automatically by the wiiuse library when + * the wiimote has returned the full data requested by a previous + * call to wiiuse_read_data(). + * + * You can read data on the wiimote, such as Mii data, if + * you know the offset address and the length. + * + * The \a data pointer was specified on the call to wiiuse_read_data(). + * At the time of this function being called, it is not safe to deallocate + * this buffer. + */ +void handle_read(struct wiimote_t* wm, byte* data, unsigned short len) { + int i = 0; + + printf("\n\n--- DATA READ [wiimote id %i] ---\n", wm->unid); + printf("finished read of size %i\n", len); + for (; i < len; ++i) { + if (!(i % 16)) { + printf("\n"); + } + printf("%x ", data[i]); + } + printf("\n\n"); +} + + +/** + * @brief Callback that handles a controller status event. + * + * @param wm Pointer to a wiimote_t structure. + * @param attachment Is there an attachment? (1 for yes, 0 for no) + * @param speaker Is the speaker enabled? (1 for yes, 0 for no) + * @param ir Is the IR support enabled? (1 for yes, 0 for no) + * @param led What LEDs are lit. + * @param battery_level Battery level, between 0.0 (0%) and 1.0 (100%). + * + * This occurs when either the controller status changed + * or the controller status was requested explicitly by + * wiiuse_status(). + * + * One reason the status can change is if the nunchuk was + * inserted or removed from the expansion port. + */ +void handle_ctrl_status(struct wiimote_t* wm) { + printf("\n\n--- CONTROLLER STATUS [wiimote id %i] ---\n", wm->unid); + + printf("attachment: %i\n", wm->exp.type); + printf("speaker: %i\n", WIIUSE_USING_SPEAKER(wm)); + printf("ir: %i\n", WIIUSE_USING_IR(wm)); + printf("leds: %i %i %i %i\n", WIIUSE_IS_LED_SET(wm, 1), WIIUSE_IS_LED_SET(wm, 2), WIIUSE_IS_LED_SET(wm, 3), WIIUSE_IS_LED_SET(wm, 4)); + printf("battery: %f %%\n", wm->battery_level); +} + + +/** + * @brief Callback that handles a disconnection event. + * + * @param wm Pointer to a wiimote_t structure. + * + * This can happen if the POWER button is pressed, or + * if the connection is interrupted. + */ +void handle_disconnect(wiimote* wm) { + printf("\n\n--- DISCONNECTED [wiimote id %i] ---\n", wm->unid); +} + + +void test(struct wiimote_t* wm, byte* data, unsigned short len) { + printf("test: %i [%x %x %x %x]\n", len, data[0], data[1], data[2], data[3]); +} + +short any_wiimote_connected(wiimote** wm, int wiimotes) { + int i; + if (!wm) { + return 0; + } + + for (i = 0; i < wiimotes; i++) { + if (wm[i] && WIIMOTE_IS_CONNECTED(wm[i])) { + return 1; + } + } + + return 0; +} + + +/** + * @brief main() + * + * Connect to up to two wiimotes and print any events + * that occur on either device. + */ +int main(int argc, char** argv) { + wiimote** wiimotes; + int found, connected; + + /* + * Initialize an array of wiimote objects. + * + * The parameter is the number of wiimotes I want to create. + */ + wiimotes = wiiuse_init(MAX_WIIMOTES); + + /* + * Find wiimote devices + * + * Now we need to find some wiimotes. + * Give the function the wiimote array we created, and tell it there + * are MAX_WIIMOTES wiimotes we are interested in. + * + * Set the timeout to be 5 seconds. + * + * This will return the number of actual wiimotes that are in discovery mode. + */ + found = wiiuse_find(wiimotes, MAX_WIIMOTES, 5); + if (!found) { + printf("No wiimotes found.\n"); + return 0; + } + + /* + * Connect to the wiimotes + * + * Now that we found some wiimotes, connect to them. + * Give the function the wiimote array and the number + * of wiimote devices we found. + * + * This will return the number of established connections to the found wiimotes. + */ + connected = wiiuse_connect(wiimotes, MAX_WIIMOTES); + if (connected) { + printf("Connected to %i wiimotes (of %i found).\n", connected, found); + } else { + printf("Failed to connect to any wiimote.\n"); + return 0; + } + + /* + * Now set the LEDs and rumble for a second so it's easy + * to tell which wiimotes are connected (just like the wii does). + */ + wiiuse_set_leds(wiimotes[0], WIIMOTE_LED_1); + wiiuse_set_leds(wiimotes[1], WIIMOTE_LED_2); + wiiuse_set_leds(wiimotes[2], WIIMOTE_LED_3); + wiiuse_set_leds(wiimotes[3], WIIMOTE_LED_4); + wiiuse_rumble(wiimotes[0], 1); + wiiuse_rumble(wiimotes[1], 1); + +#ifndef WIIUSE_WIN32 + usleep(200000); +#else + Sleep(200); +#endif + + wiiuse_rumble(wiimotes[0], 0); + wiiuse_rumble(wiimotes[1], 0); + + printf("\nControls:\n"); + printf("\tB toggles rumble.\n"); + printf("\t+ to start Wiimote accelerometer reporting, - to stop\n"); + printf("\tUP to start IR camera (sensor bar mode), DOWN to stop.\n"); + printf("\t1 to start Motion+ reporting, 2 to stop.\n"); + printf("\n\n"); + + /* + * Maybe I'm interested in the battery power of the 0th + * wiimote. This should be WIIMOTE_ID_1 but to be sure + * you can get the wiimote associated with WIIMOTE_ID_1 + * using the wiiuse_get_by_id() function. + * + * A status request will return other things too, like + * if any expansions are plugged into the wiimote or + * what LEDs are lit. + */ + /* wiiuse_status(wiimotes[0]); */ + + /* + * This is the main loop + * + * wiiuse_poll() needs to be called with the wiimote array + * and the number of wiimote structures in that array + * (it doesn't matter if some of those wiimotes are not used + * or are not connected). + * + * This function will set the event flag for each wiimote + * when the wiimote has things to report. + */ + while (any_wiimote_connected(wiimotes, MAX_WIIMOTES)) { + if (wiiuse_poll(wiimotes, MAX_WIIMOTES)) { + /* + * This happens if something happened on any wiimote. + * So go through each one and check if anything happened. + */ + int i = 0; + for (; i < MAX_WIIMOTES; ++i) { + switch (wiimotes[i]->event) { + case WIIUSE_EVENT: + /* a generic event occurred */ + handle_event(wiimotes[i]); + break; + + case WIIUSE_STATUS: + /* a status event occurred */ + handle_ctrl_status(wiimotes[i]); + break; + + case WIIUSE_DISCONNECT: + case WIIUSE_UNEXPECTED_DISCONNECT: + /* the wiimote disconnected */ + handle_disconnect(wiimotes[i]); + break; + + case WIIUSE_READ_DATA: + /* + * Data we requested to read was returned. + * Take a look at wiimotes[i]->read_req + * for the data. + */ + break; + + case WIIUSE_NUNCHUK_INSERTED: + /* + * a nunchuk was inserted + * This is a good place to set any nunchuk specific + * threshold values. By default they are the same + * as the wiimote. + */ + /* wiiuse_set_nunchuk_orient_threshold((struct nunchuk_t*)&wiimotes[i]->exp.nunchuk, 90.0f); */ + /* wiiuse_set_nunchuk_accel_threshold((struct nunchuk_t*)&wiimotes[i]->exp.nunchuk, 100); */ + printf("Nunchuk inserted.\n"); + break; + + case WIIUSE_CLASSIC_CTRL_INSERTED: + printf("Classic controller inserted.\n"); + break; + + case WIIUSE_WII_BOARD_CTRL_INSERTED: + printf("Balance board controller inserted.\n"); + break; + + case WIIUSE_GUITAR_HERO_3_CTRL_INSERTED: + /* some expansion was inserted */ + handle_ctrl_status(wiimotes[i]); + printf("Guitar Hero 3 controller inserted.\n"); + break; + + case WIIUSE_MOTION_PLUS_ACTIVATED: + printf("Motion+ was activated\n"); + break; + + case WIIUSE_NUNCHUK_REMOVED: + case WIIUSE_CLASSIC_CTRL_REMOVED: + case WIIUSE_GUITAR_HERO_3_CTRL_REMOVED: + case WIIUSE_WII_BOARD_CTRL_REMOVED: + case WIIUSE_MOTION_PLUS_REMOVED: + /* some expansion was removed */ + handle_ctrl_status(wiimotes[i]); + printf("An expansion was removed.\n"); + break; + + default: + break; + } + } + } + } + + /* + * Disconnect the wiimotes + */ + wiiuse_cleanup(wiimotes, MAX_WIIMOTES); + + return 0; +} diff --git a/lib/wiiuse/guitar_hero_3.c b/lib/wiiuse/guitar_hero_3.c deleted file mode 100644 index 5bdc58adb..000000000 --- a/lib/wiiuse/guitar_hero_3.c +++ /dev/null @@ -1,160 +0,0 @@ -/* - * wiiuse - * - * Written By: - * Michael Laforest < para > - * Email: < thepara (--AT--) g m a i l [--DOT--] com > - * - * Copyright 2006-2007 - * - * This file is part of wiiuse. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * $Header$ - * - */ - -/** - * @file - * @brief Guitar Hero 3 expansion device. - */ - -#include "guitar_hero_3.h" - -#include "dynamics.h" /* for calc_joystick_state */ -#include "events.h" /* for handshake_expansion */ - -#include /* for malloc */ -#include /* for memset */ - -static void guitar_hero_3_pressed_buttons(struct guitar_hero_3_t* gh3, short now); - -/** - * @brief Handle the handshake data from the guitar. - * - * @param cc A pointer to a classic_ctrl_t structure. - * @param data The data read in from the device. - * @param len The length of the data block, in bytes. - * - * @return Returns 1 if handshake was successful, 0 if not. - */ -int guitar_hero_3_handshake(struct wiimote_t* wm, struct guitar_hero_3_t* gh3, byte* data, unsigned short len) { - - /* - * The good fellows that made the Guitar Hero 3 controller - * failed to factory calibrate the devices. There is no - * calibration data on the device. - */ - - gh3->btns = 0; - gh3->btns_held = 0; - gh3->btns_released = 0; - gh3->whammy_bar = 0.0f; - - /* - TODO: If we're not using anything from calibration data, why are we - even bothering here? - */ - if (data[0] == 0xFF) { - /* - * Sometimes the data returned here is not correct. - * This might happen because the wiimote is lagging - * behind our initialization sequence. - * To fix this just request the handshake again. - * - * Other times it's just the first 16 bytes are 0xFF, - * but since the next 16 bytes are the same, just use - * those. - */ - if (data[16] == 0xFF) { - /* get the calibration data */ - byte* handshake_buf = malloc(EXP_HANDSHAKE_LEN * sizeof(byte)); - - WIIUSE_DEBUG("Guitar Hero 3 handshake appears invalid, trying again."); - wiiuse_read_data_cb(wm, handshake_expansion, handshake_buf, WM_EXP_MEM_CALIBR, EXP_HANDSHAKE_LEN); - - return 0; - } else { - data += 16; - } - } - - /* joystick stuff */ - gh3->js.max.x = GUITAR_HERO_3_JS_MAX_X; - gh3->js.min.x = GUITAR_HERO_3_JS_MIN_X; - gh3->js.center.x = GUITAR_HERO_3_JS_CENTER_X; - gh3->js.max.y = GUITAR_HERO_3_JS_MAX_Y; - gh3->js.min.y = GUITAR_HERO_3_JS_MIN_Y; - gh3->js.center.y = GUITAR_HERO_3_JS_CENTER_Y; - - /* handshake done */ - wm->exp.type = EXP_GUITAR_HERO_3; - -#ifdef WIIUSE_WIN32 - wm->timeout = WIIMOTE_DEFAULT_TIMEOUT; -#endif - - return 1; -} - - -/** - * @brief The guitar disconnected. - * - * @param cc A pointer to a classic_ctrl_t structure. - */ -void guitar_hero_3_disconnected(struct guitar_hero_3_t* gh3) { - memset(gh3, 0, sizeof(struct guitar_hero_3_t)); -} - - - -/** - * @brief Handle guitar event. - * - * @param cc A pointer to a classic_ctrl_t structure. - * @param msg The message specified in the event packet. - */ -void guitar_hero_3_event(struct guitar_hero_3_t* gh3, byte* msg) { - - guitar_hero_3_pressed_buttons(gh3, from_big_endian_uint16_t(msg + 4)); - - /* whammy bar */ - gh3->whammy_bar = (msg[3] - GUITAR_HERO_3_WHAMMY_BAR_MIN) / (float)(GUITAR_HERO_3_WHAMMY_BAR_MAX - GUITAR_HERO_3_WHAMMY_BAR_MIN); - - /* joy stick */ - calc_joystick_state(&gh3->js, msg[0], msg[1]); -} - - -/** - * @brief Find what buttons are pressed. - * - * @param cc A pointer to a classic_ctrl_t structure. - * @param msg The message byte specified in the event packet. - */ -static void guitar_hero_3_pressed_buttons(struct guitar_hero_3_t* gh3, short now) { - /* message is inverted (0 is active, 1 is inactive) */ - now = ~now & GUITAR_HERO_3_BUTTON_ALL; - - /* pressed now & were pressed, then held */ - gh3->btns_held = (now & gh3->btns); - - /* were pressed or were held & not pressed now, then released */ - gh3->btns_released = ((gh3->btns | gh3->btns_held) & ~now); - - /* buttons pressed now */ - gh3->btns = now; -} diff --git a/lib/wiiuse/io.c b/lib/wiiuse/io.c deleted file mode 100644 index aa1a8adfe..000000000 --- a/lib/wiiuse/io.c +++ /dev/null @@ -1,367 +0,0 @@ -/* - * wiiuse - * - * Written By: - * Michael Laforest < para > - * Email: < thepara (--AT--) g m a i l [--DOT--] com > - * - * Copyright 2006-2007 - * - * This file is part of wiiuse. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * $Header$ - * - */ - -/** - * @file - * @brief Handles device I/O (non-OS specific). - */ - -#include "io.h" -#include "ir.h" /* for wiiuse_set_ir_mode */ -#include "wiiuse_internal.h" - -#include "os.h" /* for wiiuse_os_* */ - -#include /* for free, malloc */ - -/** - * @brief Find a wiimote or wiimotes. - * - * @param wm An array of wiimote_t structures. - * @param max_wiimotes The number of wiimote structures in \a wm. - * @param timeout The number of seconds before the search times out. - * - * @return The number of wiimotes found. - * - * @see wiiuse_connect() - * @see wiiuse_os_find() - * - * This function will only look for wiimote devices. \n - * When a device is found the address in the structures will be set. \n - * You can then call wiiuse_connect() to connect to the found \n - * devices. - * - * This function only delegates to the platform-specific implementation - * wiiuse_os_find. - * - * This function is declared in wiiuse.h - */ -int wiiuse_find(struct wiimote_t** wm, int max_wiimotes, int timeout) { - return wiiuse_os_find(wm, max_wiimotes, timeout); -} - -/** - * @brief Connect to a wiimote or wiimotes once an address is known. - * - * @param wm An array of wiimote_t structures. - * @param wiimotes The number of wiimote structures in \a wm. - * - * @return The number of wiimotes that successfully connected. - * - * @see wiiuse_find() - * @see wiiuse_disconnect() - * @see wiiuse_os_connect() - * - * Connect to a number of wiimotes when the address is already set - * in the wiimote_t structures. These addresses are normally set - * by the wiiuse_find() function, but can also be set manually. - * - * This function only delegates to the platform-specific implementation - * wiiuse_os_connect. - * - * This function is declared in wiiuse.h - */ -int wiiuse_connect(struct wiimote_t** wm, int wiimotes) { - return wiiuse_os_connect(wm, wiimotes); -} - -/** - * @brief Disconnect a wiimote. - * - * @param wm Pointer to a wiimote_t structure. - * - * @see wiiuse_connect() - * @see wiiuse_os_disconnect() - * - * Note that this will not free the wiimote structure. - * - * This function only delegates to the platform-specific implementation - * wiiuse_os_disconnect. - * - * This function is declared in wiiuse.h - */ -void wiiuse_disconnect(struct wiimote_t* wm) { - wiiuse_os_disconnect(wm); -} - -/** -* @brief Wait until specified report arrives and return it -* -* @param wm Pointer to a wiimote_t structure. -* @param buffer Pre-allocated memory to store the received data -* @param bufferLength size of buffer in bytes -* -* Synchronous/blocking, this function will not return until it receives the specified -* report from the Wiimote. -* -*/ -void wiiuse_wait_report(struct wiimote_t *wm, int report, byte *buffer, int bufferLength) { - for (;;) { - if (wiiuse_os_read(wm, buffer, bufferLength) > 0) { - if (buffer[0] == report) { - break; - } else { - WIIUSE_DEBUG("(id %i) dropping report 0x%x, waiting for 0x%x", wm->unid, buffer[0], report); - } - } - } -} - -/** -* @brief Read memory/register data synchronously -* -* @param wm Pointer to a wiimote_t structure. -* @param memory If set to non-zero, reads EEPROM, otherwise registers -* @param addr Address offset to read from -* @param size How many bytes to read -* @param data Pre-allocated memory to store the received data -* -* Synchronous/blocking read, this function will not return until it receives the specified -* amount of data from the Wiimote. -* -*/ -void wiiuse_read_data_sync(struct wiimote_t *wm, byte memory, unsigned addr, unsigned short size, byte *data) { - byte pkt[6]; - byte buf[MAX_PAYLOAD]; - unsigned n_full_reports; - unsigned last_report; - byte *output; - unsigned int i; - - /* - * address in big endian first, the leading byte will - * be overwritten (only 3 bytes are sent) - */ - to_big_endian_uint32_t(pkt, addr); - - /* read from registers or memory */ - pkt[0] = (memory != 0) ? 0x00 : 0x04; - - /* length in big endian */ - to_big_endian_uint16_t(pkt + 4, size); - - /* send */ - wiiuse_send(wm, WM_CMD_READ_DATA, pkt, sizeof(pkt)); - - /* calculate how many 16B packets we have to get back */ - n_full_reports = size / 16; - last_report = size % 16; - output = data; - - for (i = 0; i < n_full_reports; ++i) { - wiiuse_wait_report(wm, WM_RPT_READ, buf, MAX_PAYLOAD); - memmove(output, buf + 6, 16); - output += 16; - } - - /* read the last incomplete packet */ - if (last_report) { - wiiuse_wait_report(wm, WM_RPT_READ, buf, MAX_PAYLOAD); - memmove(output, buf + 6, last_report); - } -} - -/** - * @brief Get initialization data from the wiimote. - * - * @param wm Pointer to a wiimote_t structure. - * @param data unused - * @param len unused - * - * When first called for a wiimote_t structure, a request - * is sent to the wiimote for initialization information. - * This includes factory set accelerometer data. - * The handshake will be concluded when the wiimote responds - * with this data. - */ - -#ifdef WIIUSE_SYNC_HANDSHAKE - -void wiiuse_handshake(struct wiimote_t* wm, byte* data, uint16_t len) { - /* send request to wiimote for accelerometer calibration */ - byte buf[MAX_PAYLOAD]; - - /* step 0 - Reset wiimote */ - { - //wiiuse_set_leds(wm, WIIMOTE_LED_NONE); - - WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_HANDSHAKE); - WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_CONNECTED); - WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_ACC); - WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_IR); - WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_RUMBLE); - WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_EXP); - WIIMOTE_DISABLE_FLAG(wm, WIIUSE_CONTINUOUS); - - wiiuse_set_report_type(wm); - wiiuse_millisleep(500); - - WIIUSE_DEBUG("Wiimote reset!\n"); - } - - /* step 1 - calibration of accelerometers */ - if(wm->type != WIIUSE_WIIMOTE_MOTION_PLUS_INSIDE) // MotionPlus Inside wiimotes don't answer to that - { - struct accel_t* accel = &wm->accel_calib; - - wiiuse_read_data_sync(wm, 1, WM_MEM_OFFSET_CALIBRATION, 8, buf); - - /* received read data */ - accel->cal_zero.x = buf[0]; - accel->cal_zero.y = buf[1]; - accel->cal_zero.z = buf[2]; - - accel->cal_g.x = buf[4] - accel->cal_zero.x; - accel->cal_g.y = buf[5] - accel->cal_zero.y; - accel->cal_g.z = buf[6] - accel->cal_zero.z; - - WIIUSE_DEBUG("Calibrated wiimote acc\n"); - } - - /* step 2 - re-enable IR and ask for status */ - { - WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_HANDSHAKE_COMPLETE); - WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_HANDSHAKE); - - /* now enable IR if it was set before the handshake completed */ - if (WIIMOTE_IS_SET(wm, WIIMOTE_STATE_IR)) { - WIIUSE_DEBUG("Handshake finished, enabling IR."); - WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_IR); - wiiuse_set_ir(wm, 1); - } - - WIIUSE_DEBUG("Asking for status ...\n"); - wm->event = WIIUSE_CONNECT; - wiiuse_status(wm); - } -} - -#else - -static void wiiuse_disable_motion_plus1(struct wiimote_t *wm, byte *data, unsigned short len); -static void wiiuse_disable_motion_plus2(struct wiimote_t *wm, byte *data, unsigned short len); - -void wiiuse_handshake(struct wiimote_t* wm, byte* data, uint16_t len) { - if (!wm) { - return; - } - - switch (wm->handshake_state) { - case 0: { - byte* buf; - - /* continuous reporting off, report to buttons only */ - WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_HANDSHAKE); - wiiuse_set_leds(wm, WIIMOTE_LED_NONE); - - WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_ACC); - WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_IR); - WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_RUMBLE); - WIIMOTE_DISABLE_FLAG(wm, WIIUSE_CONTINUOUS); - - wiiuse_set_report_type(wm); - - /* send request to wiimote for accelerometer calibration */ - buf = (byte*)malloc(sizeof(byte) * 8); - wiiuse_read_data_cb(wm, wiiuse_handshake, buf, WM_MEM_OFFSET_CALIBRATION, 7); - wm->handshake_state++; - - wiiuse_set_leds(wm, WIIMOTE_LED_NONE); - - break; - } - - case 1: { - struct read_req_t* req = wm->read_req; - struct accel_t* accel = &wm->accel_calib; - byte val; - - /* received read data */ - accel->cal_zero.x = req->buf[0]; - accel->cal_zero.y = req->buf[1]; - accel->cal_zero.z = req->buf[2]; - - accel->cal_g.x = req->buf[4] - accel->cal_zero.x; - accel->cal_g.y = req->buf[5] - accel->cal_zero.y; - accel->cal_g.z = req->buf[6] - accel->cal_zero.z; - - /* done with the buffer */ - free(req->buf); - - /* handshake is done */ - WIIUSE_DEBUG("Handshake finished. Calibration: Idle: X=%x Y=%x Z=%x\t+1g: X=%x Y=%x Z=%x", - accel->cal_zero.x, accel->cal_zero.y, accel->cal_zero.z, - accel->cal_g.x, accel->cal_g.y, accel->cal_g.z); - - /* M+ off */ - val = 0x55; - wiiuse_write_data_cb(wm, WM_EXP_MEM_ENABLE1, &val, 1, wiiuse_disable_motion_plus1); - - break; - } - - case 2: { - /* request the status of the wiimote to check for any expansion */ - WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_HANDSHAKE); - WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_HANDSHAKE_COMPLETE); - wm->handshake_state++; - - /* now enable IR if it was set before the handshake completed */ - if (WIIMOTE_IS_SET(wm, WIIMOTE_STATE_IR)) { - WIIUSE_DEBUG("Handshake finished, enabling IR."); - WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_IR); - wiiuse_set_ir(wm, 1); - } - - wm->event = WIIUSE_CONNECT; - wiiuse_status(wm); - - break; - } - - default: { - break; - } - } -} - -static void wiiuse_disable_motion_plus1(struct wiimote_t *wm, byte *data, unsigned short len) { - byte val = 0x00; - wiiuse_write_data_cb(wm, WM_EXP_MEM_ENABLE1, &val, 1, wiiuse_disable_motion_plus2); -} - -static void wiiuse_disable_motion_plus2(struct wiimote_t *wm, byte *data, unsigned short len) { - WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_EXP_FAILED); - WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_EXP_HANDSHAKE); - wiiuse_set_ir_mode(wm); - - wm->handshake_state++; - wiiuse_handshake(wm, NULL, 0); -} - -#endif diff --git a/lib/wiiuse/ir.c b/lib/wiiuse/ir.c deleted file mode 100644 index 17c0d672e..000000000 --- a/lib/wiiuse/ir.c +++ /dev/null @@ -1,793 +0,0 @@ -/* - * wiiuse - * - * Written By: - * Michael Laforest < para > - * Email: < thepara (--AT--) g m a i l [--DOT--] com > - * - * Copyright 2006-2007 - * - * This file is part of wiiuse. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * $Header$ - * - */ - -/** - * @file - * @brief Handles IR data. - */ - -#include "ir.h" - -#include /* for atanf, cos, sin, sqrt */ - -static int get_ir_sens(struct wiimote_t* wm, const byte** block1, const byte** block2); -static void interpret_ir_data(struct wiimote_t* wm); -static void fix_rotated_ir_dots(struct ir_dot_t* dot, float ang); -static void get_ir_dot_avg(struct ir_dot_t* dot, int* x, int* y); -static void reorder_ir_dots(struct ir_dot_t* dot); -static float ir_distance(struct ir_dot_t* dot); -static int ir_correct_for_bounds(int* x, int* y, enum aspect_t aspect, int offset_x, int offset_y); -static void ir_convert_to_vres(int* x, int* y, enum aspect_t aspect, int vx, int vy); - - -/* ir block data */ -static const byte WM_IR_BLOCK1_LEVEL1[] = "\x02\x00\x00\x71\x01\x00\x64\x00\xfe"; -static const byte WM_IR_BLOCK2_LEVEL1[] = "\xfd\x05"; -static const byte WM_IR_BLOCK1_LEVEL2[] = "\x02\x00\x00\x71\x01\x00\x96\x00\xb4"; -static const byte WM_IR_BLOCK2_LEVEL2[] = "\xb3\x04"; -static const byte WM_IR_BLOCK1_LEVEL3[] = "\x02\x00\x00\x71\x01\x00\xaa\x00\x64"; -static const byte WM_IR_BLOCK2_LEVEL3[] = "\x63\x03"; -static const byte WM_IR_BLOCK1_LEVEL4[] = "\x02\x00\x00\x71\x01\x00\xc8\x00\x36"; -static const byte WM_IR_BLOCK2_LEVEL4[] = "\x35\x03"; -static const byte WM_IR_BLOCK1_LEVEL5[] = "\x07\x00\x00\x71\x01\x00\x72\x00\x20"; -static const byte WM_IR_BLOCK2_LEVEL5[] = "\x1f\x03"; - -void wiiuse_set_ir_mode(struct wiimote_t *wm) { - byte buf = 0x00; - - if (!wm) { - return; - } - if (!WIIMOTE_IS_SET(wm, WIIMOTE_STATE_IR)) { - return; - } - - if (WIIMOTE_IS_SET(wm, WIIMOTE_STATE_EXP)) { - buf = WM_IR_TYPE_BASIC; - } else { - buf = WM_IR_TYPE_EXTENDED; - } - wiiuse_write_data(wm, WM_REG_IR_MODENUM, &buf, 1); -} -/** - * @brief Set if the wiimote should track IR targets. - * - * @param wm Pointer to a wiimote_t structure. - * @param status 1 to enable, 0 to disable. - */ -void wiiuse_set_ir(struct wiimote_t* wm, int status) { - byte buf; - const byte* block1 = NULL; - const byte* block2 = NULL; - int ir_level; - - if (!wm) { - return; - } - - /* - * Wait for the handshake to finish first. - * When it handshake finishes and sees that - * IR is enabled, it will call this function - * again to actually enable IR. - */ - if (!WIIMOTE_IS_SET(wm, WIIMOTE_STATE_HANDSHAKE_COMPLETE)) { - if (status) { - WIIUSE_DEBUG("Tried to enable IR, will wait until handshake finishes."); - WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_IR); - } /* else ignoring request to turn off, since it's turned off by default */ - return; - } - - /* - * Check to make sure a sensitivity setting is selected. - */ - ir_level = get_ir_sens(wm, &block1, &block2); - if (!ir_level) { - WIIUSE_ERROR("No IR sensitivity setting selected."); - return; - } - - if (status) { - /* if already enabled then stop */ - if (WIIMOTE_IS_SET(wm, WIIMOTE_STATE_IR)) { - return; - } - WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_IR); - } else { - /* if already disabled then stop */ - if (!WIIMOTE_IS_SET(wm, WIIMOTE_STATE_IR)) { - return; - } - WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_IR); - } - - /* set camera 1 and 2 */ - buf = (status ? 0x04 : 0x00); - wiiuse_send(wm, WM_CMD_IR, &buf, 1); - wiiuse_send(wm, WM_CMD_IR_2, &buf, 1); - - if (!status) { - WIIUSE_DEBUG("Disabled IR cameras for wiimote id %i.", wm->unid); - wiiuse_set_report_type(wm); - return; - } - - /* enable IR, set sensitivity */ - buf = 0x08; - wiiuse_write_data(wm, WM_REG_IR, &buf, 1); - - /* wait for the wiimote to catch up */ - wiiuse_millisleep(50); - - /* write sensitivity blocks */ - wiiuse_write_data(wm, WM_REG_IR_BLOCK1, (byte*)block1, 9); - wiiuse_write_data(wm, WM_REG_IR_BLOCK2, (byte*)block2, 2); - - /* set the IR mode */ - if (WIIMOTE_IS_SET(wm, WIIMOTE_STATE_EXP)) { - buf = WM_IR_TYPE_BASIC; - } else { - buf = WM_IR_TYPE_EXTENDED; - } - wiiuse_write_data(wm, WM_REG_IR_MODENUM, &buf, 1); - - wiiuse_millisleep(50); - - /* set the wiimote report type */ - wiiuse_set_report_type(wm); - - WIIUSE_DEBUG("Enabled IR camera for wiimote id %i (sensitivity level %i).", wm->unid, ir_level); -} - - -/** - * @brief Get the IR sensitivity settings. - * - * @param wm Pointer to a wiimote_t structure. - * @param block1 [out] Pointer to where block1 will be set. - * @param block2 [out] Pointer to where block2 will be set. - * - * @return Returns the sensitivity level. - */ -static int get_ir_sens(struct wiimote_t* wm, const byte** block1, const byte** block2) { - if (WIIMOTE_IS_SET(wm, WIIMOTE_STATE_IR_SENS_LVL1)) { - *block1 = WM_IR_BLOCK1_LEVEL1; - *block2 = WM_IR_BLOCK2_LEVEL1; - return 1; - } else if (WIIMOTE_IS_SET(wm, WIIMOTE_STATE_IR_SENS_LVL2)) { - *block1 = WM_IR_BLOCK1_LEVEL2; - *block2 = WM_IR_BLOCK2_LEVEL2; - return 2; - } else if (WIIMOTE_IS_SET(wm, WIIMOTE_STATE_IR_SENS_LVL3)) { - *block1 = WM_IR_BLOCK1_LEVEL3; - *block2 = WM_IR_BLOCK2_LEVEL3; - return 3; - } else if (WIIMOTE_IS_SET(wm, WIIMOTE_STATE_IR_SENS_LVL4)) { - *block1 = WM_IR_BLOCK1_LEVEL4; - *block2 = WM_IR_BLOCK2_LEVEL4; - return 4; - } else if (WIIMOTE_IS_SET(wm, WIIMOTE_STATE_IR_SENS_LVL5)) { - *block1 = WM_IR_BLOCK1_LEVEL5; - *block2 = WM_IR_BLOCK2_LEVEL5; - return 5; - } - - *block1 = NULL; - *block2 = NULL; - return 0; -} - - -/** - * @brief Set the virtual screen resolution for IR tracking. - * - * @param wm Pointer to a wiimote_t structure. - * @param status 1 to enable, 0 to disable. - */ -void wiiuse_set_ir_vres(struct wiimote_t* wm, unsigned int x, unsigned int y) { - if (!wm) { - return; - } - - wm->ir.vres[0] = (x - 1); - wm->ir.vres[1] = (y - 1); -} - - -/** - * @brief Set the XY position for the IR cursor. - * - * @param wm Pointer to a wiimote_t structure. - */ -void wiiuse_set_ir_position(struct wiimote_t* wm, enum ir_position_t pos) { - if (!wm) { - return; - } - - wm->ir.pos = pos; - - switch (pos) { - - case WIIUSE_IR_ABOVE: - wm->ir.offset[0] = 0; - - if (wm->ir.aspect == WIIUSE_ASPECT_16_9) { - wm->ir.offset[1] = WM_ASPECT_16_9_Y / 2 - 70; - } else if (wm->ir.aspect == WIIUSE_ASPECT_4_3) { - wm->ir.offset[1] = WM_ASPECT_4_3_Y / 2 - 100; - } - - return; - - case WIIUSE_IR_BELOW: - wm->ir.offset[0] = 0; - - if (wm->ir.aspect == WIIUSE_ASPECT_16_9) { - wm->ir.offset[1] = -WM_ASPECT_16_9_Y / 2 + 100; - } else if (wm->ir.aspect == WIIUSE_ASPECT_4_3) { - wm->ir.offset[1] = -WM_ASPECT_4_3_Y / 2 + 70; - } - - return; - - default: - return; - }; -} - - -/** - * @brief Set the aspect ratio of the TV/monitor. - * - * @param wm Pointer to a wiimote_t structure. - * @param aspect Either WIIUSE_ASPECT_16_9 or WIIUSE_ASPECT_4_3 - */ -void wiiuse_set_aspect_ratio(struct wiimote_t* wm, enum aspect_t aspect) { - if (!wm) { - return; - } - - wm->ir.aspect = aspect; - - if (aspect == WIIUSE_ASPECT_4_3) { - wm->ir.vres[0] = WM_ASPECT_4_3_X; - wm->ir.vres[1] = WM_ASPECT_4_3_Y; - } else { - wm->ir.vres[0] = WM_ASPECT_16_9_X; - wm->ir.vres[1] = WM_ASPECT_16_9_Y; - } - - /* reset the position offsets */ - wiiuse_set_ir_position(wm, wm->ir.pos); -} - - -/** - * @brief Set the IR sensitivity. - * - * @param wm Pointer to a wiimote_t structure. - * @param level 1-5, same as Wii system sensitivity setting. - * - * If the level is < 1, then level will be set to 1. - * If the level is > 5, then level will be set to 5. - */ -void wiiuse_set_ir_sensitivity(struct wiimote_t* wm, int level) { - const byte* block1 = NULL; - const byte* block2 = NULL; - - if (!wm) { - return; - } - - if (level > 5) { - level = 5; - } - if (level < 1) { - level = 1; - } - - WIIMOTE_DISABLE_STATE(wm, (WIIMOTE_STATE_IR_SENS_LVL1 | - WIIMOTE_STATE_IR_SENS_LVL2 | - WIIMOTE_STATE_IR_SENS_LVL3 | - WIIMOTE_STATE_IR_SENS_LVL4 | - WIIMOTE_STATE_IR_SENS_LVL5)); - - switch (level) { - case 1: - WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_IR_SENS_LVL1); - break; - case 2: - WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_IR_SENS_LVL2); - break; - case 3: - WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_IR_SENS_LVL3); - break; - case 4: - WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_IR_SENS_LVL4); - break; - case 5: - WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_IR_SENS_LVL5); - break; - default: - return; - } - - /* set the new sensitivity */ - get_ir_sens(wm, &block1, &block2); - - wiiuse_write_data(wm, WM_REG_IR_BLOCK1, block1, 9); - wiiuse_write_data(wm, WM_REG_IR_BLOCK2, block2, 2); - - WIIUSE_DEBUG("Set IR sensitivity to level %i (unid %i)", level, wm->unid); -} - - -/** - * @brief Calculate the data from the IR spots. Basic IR mode. - * - * @param wm Pointer to a wiimote_t structure. - * @param data Data returned by the wiimote for the IR spots. - */ -void calculate_basic_ir(struct wiimote_t* wm, byte* data) { - struct ir_dot_t* dot = wm->ir.dot; - int i; - - dot[0].rx = 1023 - (data[0] | ((data[2] & 0x30) << 4)); - dot[0].ry = data[1] | ((data[2] & 0xC0) << 2); - - dot[1].rx = 1023 - (data[3] | ((data[2] & 0x03) << 8)); - dot[1].ry = data[4] | ((data[2] & 0x0C) << 6); - - dot[2].rx = 1023 - (data[5] | ((data[7] & 0x30) << 4)); - dot[2].ry = data[6] | ((data[7] & 0xC0) << 2); - - dot[3].rx = 1023 - (data[8] | ((data[7] & 0x03) << 8)); - dot[3].ry = data[9] | ((data[7] & 0x0C) << 6); - - /* set each IR spot to visible if spot is in range */ - for (i = 0; i < 4; ++i) { - if (dot[i].ry == 1023) { - dot[i].visible = 0; - } else { - dot[i].visible = 1; - dot[i].size = 0; /* since we don't know the size, set it as 0 */ - } - } - - interpret_ir_data(wm); -} - - -/** - * @brief Calculate the data from the IR spots. Extended IR mode. - * - * @param wm Pointer to a wiimote_t structure. - * @param data Data returned by the wiimote for the IR spots. - */ -void calculate_extended_ir(struct wiimote_t* wm, byte* data) { - struct ir_dot_t* dot = wm->ir.dot; - int i; - - for (i = 0; i < 4; ++i) { - dot[i].rx = 1023 - (data[3 * i] | ((data[(3 * i) + 2] & 0x30) << 4)); - dot[i].ry = data[(3 * i) + 1] | ((data[(3 * i) + 2] & 0xC0) << 2); - - dot[i].size = data[(3 * i) + 2] & 0x0F; - - /* if in range set to visible */ - if (dot[i].ry == 1023) { - dot[i].visible = 0; - } else { - dot[i].visible = 1; - } - } - - interpret_ir_data(wm); -} - - -/** - * @brief Interpret IR data into more user friendly variables. - * - * @param wm Pointer to a wiimote_t structure. - */ -static void interpret_ir_data(struct wiimote_t* wm) { - struct ir_dot_t* dot = wm->ir.dot; - int i; - float roll = 0.0f; - int last_num_dots = wm->ir.num_dots; - - if (WIIMOTE_IS_SET(wm, WIIMOTE_STATE_ACC)) { - roll = wm->orient.roll; - } - - /* count visible dots */ - wm->ir.num_dots = 0; - for (i = 0; i < 4; ++i) { - if (dot[i].visible) { - wm->ir.num_dots++; - } - } - - switch (wm->ir.num_dots) { - case 0: { - wm->ir.state = 0; - - /* reset the dot ordering */ - for (i = 0; i < 4; ++i) { - dot[i].order = 0; - } - - wm->ir.x = 0; - wm->ir.y = 0; - wm->ir.z = 0.0f; - - return; - } - case 1: { - fix_rotated_ir_dots(wm->ir.dot, roll); - - if (wm->ir.state < 2) { - /* - * Only 1 known dot, so use just that. - */ - for (i = 0; i < 4; ++i) { - if (dot[i].visible) { - wm->ir.x = dot[i].x; - wm->ir.y = dot[i].y; - - wm->ir.ax = wm->ir.x; - wm->ir.ay = wm->ir.y; - - /* can't calculate yaw because we don't have the distance */ - /* wm->orient.yaw = calc_yaw(&wm->ir); */ - - ir_convert_to_vres(&wm->ir.x, &wm->ir.y, wm->ir.aspect, wm->ir.vres[0], wm->ir.vres[1]); - break; - } - } - } else { - /* - * Only see 1 dot but know theres 2. - * Try to estimate where the other one - * should be and use that. - */ - for (i = 0; i < 4; ++i) { - if (dot[i].visible) { - int ox = 0; - int x, y; - - if (dot[i].order == 1) - /* visible is the left dot - estimate where the right is */ - { - ox = (int32_t)(dot[i].x + wm->ir.distance); - } else if (dot[i].order == 2) - /* visible is the right dot - estimate where the left is */ - { - ox = (int32_t)(dot[i].x - wm->ir.distance); - } - - x = ((signed int)dot[i].x + ox) / 2; - y = dot[i].y; - - wm->ir.ax = x; - wm->ir.ay = y; - wm->orient.yaw = calc_yaw(&wm->ir); - - if (ir_correct_for_bounds(&x, &y, wm->ir.aspect, wm->ir.offset[0], wm->ir.offset[1])) { - ir_convert_to_vres(&x, &y, wm->ir.aspect, wm->ir.vres[0], wm->ir.vres[1]); - wm->ir.x = x; - wm->ir.y = y; - } - - break; - } - } - } - - break; - } - case 2: - case 3: - case 4: { - /* - * Two (or more) dots known and seen. - * Average them together to estimate the true location. - */ - int x, y; - wm->ir.state = 2; - - fix_rotated_ir_dots(wm->ir.dot, roll); - - /* if there is at least 1 new dot, reorder them all */ - if (wm->ir.num_dots > last_num_dots) { - reorder_ir_dots(dot); - wm->ir.x = 0; - wm->ir.y = 0; - } - - wm->ir.distance = ir_distance(dot); - wm->ir.z = 1023 - wm->ir.distance; - - get_ir_dot_avg(wm->ir.dot, &x, &y); - - wm->ir.ax = x; - wm->ir.ay = y; - wm->orient.yaw = calc_yaw(&wm->ir); - - if (ir_correct_for_bounds(&x, &y, wm->ir.aspect, wm->ir.offset[0], wm->ir.offset[1])) { - ir_convert_to_vres(&x, &y, wm->ir.aspect, wm->ir.vres[0], wm->ir.vres[1]); - wm->ir.x = x; - wm->ir.y = y; - } - - break; - } - default: { - break; - } - } - -#ifdef WITH_WIIUSE_DEBUG - { - int ir_level; - WIIUSE_GET_IR_SENSITIVITY(wm, &ir_level); - WIIUSE_DEBUG("IR sensitivity: %i", ir_level); - WIIUSE_DEBUG("IR visible dots: %i", wm->ir.num_dots); - for (i = 0; i < 4; ++i) - if (dot[i].visible) { - WIIUSE_DEBUG("IR[%i][order %i] (%.3i, %.3i) -> (%.3i, %.3i)", i, dot[i].order, dot[i].rx, dot[i].ry, dot[i].x, dot[i].y); - } - WIIUSE_DEBUG("IR[absolute]: (%i, %i)", wm->ir.x, wm->ir.y); - } -#endif -} - - - -/** - * @brief Fix the rotation of the IR dots. - * - * @param dot An array of 4 ir_dot_t objects. - * @param ang The roll angle to correct by (-180, 180) - * - * If there is roll then the dots are rotated - * around the origin and give a false cursor - * position. Correct for the roll. - * - * If the accelerometer is off then obviously - * this will not do anything and the cursor - * position may be inaccurate. - */ -static void fix_rotated_ir_dots(struct ir_dot_t* dot, float ang) { - float s, c; - int x, y; - int i; - - if (!ang) { - for (i = 0; i < 4; ++i) { - dot[i].x = dot[i].rx; - dot[i].y = dot[i].ry; - } - return; - } - - s = sinf(DEGREE_TO_RAD(ang)); - c = cosf(DEGREE_TO_RAD(ang)); - - /* - * [ cos(theta) -sin(theta) ][ ir->rx ] - * [ sin(theta) cos(theta) ][ ir->ry ] - */ - - for (i = 0; i < 4; ++i) { - if (!dot[i].visible) { - continue; - } - - x = dot[i].rx - (1024 / 2); - y = dot[i].ry - (768 / 2); - - dot[i].x = (uint32_t)((c * x) + (-s * y)); - dot[i].y = (uint32_t)((s * x) + (c * y)); - - dot[i].x += (1024 / 2); - dot[i].y += (768 / 2); - } -} - - -/** - * @brief Average IR dots. - * - * @param dot An array of 4 ir_dot_t objects. - * @param x [out] Average X - * @param y [out] Average Y - */ -static void get_ir_dot_avg(struct ir_dot_t* dot, int* x, int* y) { - int vis = 0, i = 0; - - *x = 0; - *y = 0; - - for (; i < 4; ++i) { - if (dot[i].visible) { - *x += dot[i].x; - *y += dot[i].y; - ++vis; - } - } - - *x /= vis; - *y /= vis; -} - - -/** - * @brief Reorder the IR dots. - * - * @param dot An array of 4 ir_dot_t objects. - */ -static void reorder_ir_dots(struct ir_dot_t* dot) { - int i, j, order; - - /* reset the dot ordering */ - for (i = 0; i < 4; ++i) { - dot[i].order = 0; - } - - for (order = 1; order < 5; ++order) { - i = 0; - - for (; !dot[i].visible || dot[i].order; ++i) - if (i >= 3) { - return; - } - - for (j = 0; j < 4; ++j) { - if (dot[j].visible && !dot[j].order && (dot[j].x < dot[i].x)) { - i = j; - } - } - - dot[i].order = order; - } -} - - -/** - * @brief Calculate the distance between the first 2 visible IR dots. - * - * @param dot An array of 4 ir_dot_t objects. - */ -static float ir_distance(struct ir_dot_t* dot) { - int i1, i2; - int xd, yd; - - for (i1 = 0; i1 < 4; ++i1) - if (dot[i1].visible) { - break; - } - if (i1 == 4) { - return 0.0f; - } - - for (i2 = i1 + 1; i2 < 4; ++i2) - if (dot[i2].visible) { - break; - } - if (i2 == 4) { - return 0.0f; - } - - xd = dot[i2].x - dot[i1].x; - yd = dot[i2].y - dot[i1].y; - - return sqrtf((float)(xd * xd + yd * yd)); -} - - -/** - * @brief Correct for the IR bounding box. - * - * @param x [out] The current X, it will be updated if valid. - * @param y [out] The current Y, it will be updated if valid. - * @param aspect Aspect ratio of the screen. - * @param offset_x The X offset of the bounding box. - * @param offset_y The Y offset of the bounding box. - * - * @return Returns 1 if the point is valid and was updated. - * - * Nintendo was smart with this bit. They sacrifice a little - * precision for a big increase in usability. - */ -static int ir_correct_for_bounds(int* x, int* y, enum aspect_t aspect, int offset_x, int offset_y) { - int x0, y0; - int xs, ys; - - if (aspect == WIIUSE_ASPECT_16_9) { - xs = WM_ASPECT_16_9_X; - ys = WM_ASPECT_16_9_Y; - } else { - xs = WM_ASPECT_4_3_X; - ys = WM_ASPECT_4_3_Y; - } - - x0 = ((1024 - xs) / 2) + offset_x; - y0 = ((768 - ys) / 2) + offset_y; - - if ((*x >= x0) - && (*x <= (x0 + xs)) - && (*y >= y0) - && (*y <= (y0 + ys))) { - *x -= offset_x; - *y -= offset_y; - - return 1; - } - - return 0; -} - - -/** - * @brief Interpolate the point to the user defined virtual screen resolution. - */ -static void ir_convert_to_vres(int* x, int* y, enum aspect_t aspect, int vx, int vy) { - int xs, ys; - - if (aspect == WIIUSE_ASPECT_16_9) { - xs = WM_ASPECT_16_9_X; - ys = WM_ASPECT_16_9_Y; - } else { - xs = WM_ASPECT_4_3_X; - ys = WM_ASPECT_4_3_Y; - } - - *x -= ((1024 - xs) / 2); - *y -= ((768 - ys) / 2); - - *x = (int)((*x / (float)xs) * vx); - *y = (int)((*y / (float)ys) * vy); -} - - -/** - * @brief Calculate yaw given the IR data. - * - * @param ir IR data structure. - */ -float calc_yaw(struct ir_t* ir) { - float x; - - x = (float)(ir->ax - 512); - x = x * (ir->z / 1024.0f); - - return RAD_TO_DEGREE(atanf(x / ir->z)); -} diff --git a/lib/wiiuse/motion_plus.c b/lib/wiiuse/motion_plus.c deleted file mode 100644 index 117832b16..000000000 --- a/lib/wiiuse/motion_plus.c +++ /dev/null @@ -1,338 +0,0 @@ -/* - * wiiuse - * - * Written By: - * Michal Wiedenbauer < shagkur > - * Dave Murphy < WinterMute > - * Hector Martin < marcan > - * Radu Andries - * - * Copyright 2009 - * - * This file is part of wiiuse and fWIIne. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * $Header$ - * - */ - -#include "motion_plus.h" - -#include "io.h" /* for wiiuse_read */ -#include "events.h" /* for disable_expansion */ -#include "ir.h" /* for wiiuse_set_ir_mode */ -#include "nunchuk.h" /* for nunchuk_pressed_buttons */ -#include "dynamics.h" /* for calc_joystick_state, etc */ - -#include /* for memset */ -#include /* for fabs */ - -static void wiiuse_calibrate_motion_plus(struct motion_plus_t *mp); -static void calculate_gyro_rates(struct motion_plus_t* mp); - - -void wiiuse_probe_motion_plus(struct wiimote_t *wm) { - byte buf[MAX_PAYLOAD]; - unsigned id; - - wiiuse_read_data_sync(wm, 0, WM_EXP_MOTION_PLUS_IDENT, 6, buf); - - /* check error code */ - if (buf[4] & 0x0f) { - WIIUSE_DEBUG("No Motion+ available, stopping probe."); - WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_MPLUS_PRESENT); - return; - } - - /* decode the id */ - id = from_big_endian_uint32_t(buf + 2); - - if (id != EXP_ID_CODE_INACTIVE_MOTION_PLUS && - id != EXP_ID_CODE_NLA_MOTION_PLUS && - id != EXP_ID_CODE_NLA_MOTION_PLUS_NUNCHUK && - id != EXP_ID_CODE_NLA_MOTION_PLUS_CLASSIC) { - /* we have read something weird */ - WIIUSE_DEBUG("Motion+ ID doesn't match, probably not connected."); - WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_MPLUS_PRESENT); - return; - } - - WIIUSE_DEBUG("Detected inactive Motion+!"); - WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_MPLUS_PRESENT); - - /* init M+ */ - buf[0] = 0x55; - wiiuse_write_data(wm, WM_EXP_MOTION_PLUS_INIT, buf, 1); - - /* Init whatever is hanging on the pass-through port */ - buf[0] = 0x55; - wiiuse_write_data(wm, WM_EXP_MEM_ENABLE1, buf, 1); - - buf[0] = 0x00; - wiiuse_write_data(wm, WM_EXP_MEM_ENABLE2, buf, 1); - - /* Init gyroscope data */ - wm->exp.mp.cal_gyro.roll = 0; - wm->exp.mp.cal_gyro.pitch = 0; - wm->exp.mp.cal_gyro.yaw = 0; - wm->exp.mp.orient.roll = 0.0; - wm->exp.mp.orient.pitch = 0.0; - wm->exp.mp.orient.yaw = 0.0; - wm->exp.mp.raw_gyro_threshold = 10; - - wm->exp.mp.nc = &(wm->exp.nunchuk); - wm->exp.mp.classic = &(wm->exp.classic); - wm->exp.nunchuk.flags = &wm->flags; - - wm->exp.mp.ext = 0; - - wiiuse_set_ir_mode(wm); - wiiuse_set_report_type(wm); -} - -void wiiuse_motion_plus_handshake(struct wiimote_t *wm, byte *data, unsigned short len) { - uint32_t val; - if (data == NULL) { - wiiuse_read_data_cb(wm, wiiuse_motion_plus_handshake, wm->motion_plus_id, WM_EXP_ID, 6); - } else { - WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_EXP_FAILED); - WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_EXP_HANDSHAKE); - WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_EXP); /* tell wiimote to include exp. data in reports */ - - val = from_big_endian_uint32_t(data + 2); - - if (val == EXP_ID_CODE_MOTION_PLUS || - val == EXP_ID_CODE_MOTION_PLUS_NUNCHUK || - val == EXP_ID_CODE_MOTION_PLUS_CLASSIC) { - /* handshake done */ - wm->event = WIIUSE_MOTION_PLUS_ACTIVATED; - - switch (val) { - case EXP_ID_CODE_MOTION_PLUS: - wm->exp.type = EXP_MOTION_PLUS; - break; - - case EXP_ID_CODE_MOTION_PLUS_NUNCHUK: - wm->exp.type = EXP_MOTION_PLUS_NUNCHUK; - break; - - case EXP_ID_CODE_MOTION_PLUS_CLASSIC: - wm->exp.type = EXP_MOTION_PLUS_CLASSIC; - break; - - default: - /* huh? */ - WIIUSE_WARNING("Unknown ID returned in Motion+ handshake %d\n", val); - wm->exp.type = EXP_MOTION_PLUS; - break; - } - - WIIUSE_DEBUG("Motion plus connected"); - - /* Init gyroscopes */ - wm->exp.mp.cal_gyro.roll = 0; - wm->exp.mp.cal_gyro.pitch = 0; - wm->exp.mp.cal_gyro.yaw = 0; - wm->exp.mp.orient.roll = 0.0; - wm->exp.mp.orient.pitch = 0.0; - wm->exp.mp.orient.yaw = 0.0; - wm->exp.mp.raw_gyro_threshold = 10; - - wm->exp.mp.nc = &(wm->exp.nunchuk); - wm->exp.mp.classic = &(wm->exp.classic); - wm->exp.nunchuk.flags = &wm->flags; - - wm->exp.mp.ext = 0; - - wiiuse_set_ir_mode(wm); - wiiuse_set_report_type(wm); - } - } -} - -static void wiiuse_set_motion_plus_clear2(struct wiimote_t *wm, byte *data, unsigned short len) { - WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_EXP_FAILED); - WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_EXP_HANDSHAKE); - wiiuse_set_ir_mode(wm); - wiiuse_status(wm); -} - -static void wiiuse_set_motion_plus_clear1(struct wiimote_t *wm, byte *data, unsigned short len) { - byte val = 0x00; - wiiuse_write_data_cb(wm, WM_EXP_MEM_ENABLE1, &val, 1, wiiuse_set_motion_plus_clear2); -} - -/** - * @brief Enable/disable Motion+ expansion - * - * @param wm Pointer to the wiimote with Motion+ - * @param status 0 - off, 1 - on, standalone, 2 - nunchuk pass-through - * - */ -void wiiuse_set_motion_plus(struct wiimote_t *wm, int status) { - byte val; - - if (!WIIMOTE_IS_SET(wm, WIIMOTE_STATE_MPLUS_PRESENT) || - WIIMOTE_IS_SET(wm, WIIMOTE_STATE_EXP_HANDSHAKE)) { - return; - } - - if (status) { - WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_EXP_HANDSHAKE); - val = (status == 1) ? 0x04 : 0x05; - wiiuse_write_data_cb(wm, WM_EXP_MOTION_PLUS_ENABLE, &val, 1, wiiuse_motion_plus_handshake); - } else { - disable_expansion(wm); - val = 0x55; - wiiuse_write_data_cb(wm, WM_EXP_MEM_ENABLE1, &val, 1, wiiuse_set_motion_plus_clear1); - } -} - -void motion_plus_disconnected(struct motion_plus_t* mp) { - WIIUSE_DEBUG("Motion plus disconnected"); - memset(mp, 0, sizeof(struct motion_plus_t)); -} - -void motion_plus_event(struct motion_plus_t* mp, int exp_type, byte* msg) { - /* - * Pass-through modes interleave data from the gyro - * with the expansion data. This extracts the tag - * determining which is which - */ - int isMPFrame = (1 << 1) & msg[5]; - mp->ext = msg[4] & 0x1; /* extension attached to pass-through port? */ - - if (mp->ext == 0 || isMPFrame) { /* reading gyro frame */ - /* Check if the gyroscope is in fast or slow mode (0 if rotating fast, 1 if slow or still) */ - mp->acc_mode = ((msg[4] & 0x2) << 1) | ((msg[3] & 0x1) << 1) | ((msg[3] & 0x2) >> 1); - - mp->raw_gyro.roll = ((msg[4] & 0xFC) << 6) | msg[1]; - mp->raw_gyro.pitch = ((msg[5] & 0xFC) << 6) | msg[2]; - mp->raw_gyro.yaw = ((msg[3] & 0xFC) << 6) | msg[0]; - - /* First calibration */ - if ((mp->raw_gyro.roll > 5000) && - (mp->raw_gyro.pitch > 5000) && - (mp->raw_gyro.yaw > 5000) && - (mp->raw_gyro.roll < 0x3fff) && - (mp->raw_gyro.pitch < 0x3fff) && - (mp->raw_gyro.yaw < 0x3fff) && - !(mp->cal_gyro.roll) && - !(mp->cal_gyro.pitch) && - !(mp->cal_gyro.yaw)) { - wiiuse_calibrate_motion_plus(mp); - } - - /* Calculate angular rates in deg/sec and performs some simple filtering */ - calculate_gyro_rates(mp); - } - - else { - /* expansion frame */ - if (exp_type == EXP_MOTION_PLUS_NUNCHUK) { - /* ok, this is nunchuck, re-encode it as regular nunchuck packet */ - - /* get button states */ - nunchuk_pressed_buttons(mp->nc, (msg[5] >> 2)); - - /* calculate joystick state */ - calc_joystick_state(&(mp->nc->js), msg[0], msg[1]); - - /* calculate orientation */ - mp->nc->accel.x = msg[2]; - mp->nc->accel.y = msg[3]; - mp->nc->accel.z = (msg[4] & 0xFE) | ((msg[5] >> 5) & 0x04); - - calculate_orientation(&(mp->nc->accel_calib), - &(mp->nc->accel), - &(mp->nc->orient), - NUNCHUK_IS_FLAG_SET(mp->nc, WIIUSE_SMOOTHING)); - - calculate_gforce(&(mp->nc->accel_calib), - &(mp->nc->accel), - &(mp->nc->gforce)); - - } - - else if (exp_type == EXP_MOTION_PLUS_CLASSIC) { - WIIUSE_ERROR("Classic controller pass-through is not implemented!\n"); - } - - else { - WIIUSE_ERROR("Unsupported mode passed to motion_plus_event() !\n"); - } - } -} - -/** - * @brief Calibrate the Motion Plus gyroscopes. - * - * @param mp Pointer to a motion_plus_t structure. - * - * This should be called only after receiving the first values - * from the Motion Plus. - */ -void wiiuse_calibrate_motion_plus(struct motion_plus_t *mp) { - mp->cal_gyro.roll = mp->raw_gyro.roll; - mp->cal_gyro.pitch = mp->raw_gyro.pitch; - mp->cal_gyro.yaw = mp->raw_gyro.yaw; - mp->orient.roll = 0.0; - mp->orient.pitch = 0.0; - mp->orient.yaw = 0.0; -} - -static void calculate_gyro_rates(struct motion_plus_t* mp) { - short int tmp_r, tmp_p, tmp_y; - float tmp_roll, tmp_pitch, tmp_yaw; - - /* We consider calibration data */ - tmp_r = mp->raw_gyro.roll - mp->cal_gyro.roll; - tmp_p = mp->raw_gyro.pitch - mp->cal_gyro.pitch; - tmp_y = mp->raw_gyro.yaw - mp->cal_gyro.yaw; - - /* We convert to degree/sec according to fast/slow mode */ - if (mp->acc_mode & 0x04) { - tmp_roll = (float)tmp_r / 20.0f; - } else { - tmp_roll = (float)tmp_r / 4.0f; - } - - if (mp->acc_mode & 0x02) { - tmp_pitch = (float)tmp_p / 20.0f; - } else { - tmp_pitch = (float)tmp_p / 4.0f; - } - - if (mp->acc_mode & 0x01) { - tmp_yaw = (float)tmp_y / 20.0f; - } else { - tmp_yaw = (float)tmp_y / 4.0f; - } - - /* Simple filtering */ - if (fabs(tmp_roll) < 0.5f) { - tmp_roll = 0.0f; - } - if (fabs(tmp_pitch) < 0.5f) { - tmp_pitch = 0.0f; - } - if (fabs(tmp_yaw) < 0.5f) { - tmp_yaw = 0.0f; - } - - mp->angle_rate_gyro.roll = tmp_roll; - mp->angle_rate_gyro.pitch = tmp_pitch; - mp->angle_rate_gyro.yaw = tmp_yaw; -} diff --git a/lib/wiiuse/nunchuk.c b/lib/wiiuse/nunchuk.c deleted file mode 100644 index 12ec0aa61..000000000 --- a/lib/wiiuse/nunchuk.c +++ /dev/null @@ -1,203 +0,0 @@ -/* - * wiiuse - * - * Written By: - * Michael Laforest < para > - * Email: < thepara (--AT--) g m a i l [--DOT--] com > - * - * Copyright 2006-2007 - * - * This file is part of wiiuse. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * $Header$ - * - */ - -/** - * @file - * @brief Nunchuk expansion device. - */ - - -#include "nunchuk.h" -#include "dynamics.h" /* for calc_joystick_state, etc */ -#include "events.h" /* for handshake_expansion */ - -#include /* for malloc */ -#include /* for memset */ - -/** - * @brief Handle the handshake data from the nunchuk. - * - * @param nc A pointer to a nunchuk_t structure. - * @param data The data read in from the device. - * @param len The length of the data block, in bytes. - * - * @return Returns 1 if handshake was successful, 0 if not. - */ -#define HANDSHAKE_BYTES_USED 14 -int nunchuk_handshake(struct wiimote_t* wm, struct nunchuk_t* nc, byte* data, unsigned short len) { - nc->btns = 0; - nc->btns_held = 0; - nc->btns_released = 0; - - /* set the smoothing to the same as the wiimote */ - nc->flags = &wm->flags; - nc->accel_calib.st_alpha = wm->accel_calib.st_alpha; - - if (data[0] == 0xFF || len < HANDSHAKE_BYTES_USED) { - /* - * Sometimes the data returned here is not correct. - * This might happen because the wiimote is lagging - * behind our initialization sequence. - * To fix this just request the handshake again. - * - * Other times it's just the first 16 bytes are 0xFF, - * but since the next 16 bytes are the same, just use - * those. - */ - if (len < 17 || len < HANDSHAKE_BYTES_USED + 16 || data[16] == 0xFF) { - /* get the calibration data */ - byte* handshake_buf = (byte *)malloc(EXP_HANDSHAKE_LEN * sizeof(byte)); - - WIIUSE_DEBUG("Nunchuk handshake appears invalid, trying again."); - wiiuse_read_data_cb(wm, handshake_expansion, handshake_buf, WM_EXP_MEM_CALIBR, EXP_HANDSHAKE_LEN); - - return 0; - } else { - data += 16; - } - } - - nc->accel_calib.cal_zero.x = data[0]; - nc->accel_calib.cal_zero.y = data[1]; - nc->accel_calib.cal_zero.z = data[2]; - nc->accel_calib.cal_g.x = data[4]; - nc->accel_calib.cal_g.y = data[5]; - nc->accel_calib.cal_g.z = data[6]; - nc->js.max.x = data[8]; - nc->js.min.x = data[9]; - nc->js.center.x = data[10]; - nc->js.max.y = data[11]; - nc->js.min.y = data[12]; - nc->js.center.y = data[13]; - WIIUSE_DEBUG("Nunchuk calibration X: min %x, max %x, center %x Y: min %x, max %x, center %x", - nc->js.min.x, nc->js.max.x, nc->js.center.x, - nc->js.min.y, nc->js.max.y, nc->js.center.y); - - /* default the thresholds to the same as the wiimote */ - nc->orient_threshold = wm->orient_threshold; - nc->accel_threshold = wm->accel_threshold; - - /* handshake done */ - wm->exp.type = EXP_NUNCHUK; - -#ifdef WIIUSE_WIN32 - wm->timeout = WIIMOTE_DEFAULT_TIMEOUT; -#endif - - return 1; -} - - -/** - * @brief The nunchuk disconnected. - * - * @param nc A pointer to a nunchuk_t structure. - */ -void nunchuk_disconnected(struct nunchuk_t* nc) { - memset(nc, 0, sizeof(struct nunchuk_t)); -} - - - -/** - * @brief Handle nunchuk event. - * - * @param nc A pointer to a nunchuk_t structure. - * @param msg The message specified in the event packet. - */ -void nunchuk_event(struct nunchuk_t* nc, byte* msg) { - - /* get button states */ - nunchuk_pressed_buttons(nc, msg[5]); - - /* calculate joystick state */ - calc_joystick_state(&nc->js, msg[0], msg[1]); - - /* calculate orientation */ - nc->accel.x = msg[2]; - nc->accel.y = msg[3]; - nc->accel.z = msg[4]; - - calculate_orientation(&nc->accel_calib, &nc->accel, &nc->orient, NUNCHUK_IS_FLAG_SET(nc, WIIUSE_SMOOTHING)); - calculate_gforce(&nc->accel_calib, &nc->accel, &nc->gforce); -} - - -/** - * @brief Find what buttons are pressed. - * - * @param nc Pointer to a nunchuk_t structure. - * @param msg The message byte specified in the event packet. - */ -void nunchuk_pressed_buttons(struct nunchuk_t* nc, byte now) { - /* message is inverted (0 is active, 1 is inactive) */ - now = ~now & NUNCHUK_BUTTON_ALL; - - /* pressed now & were pressed, then held */ - nc->btns_held = (now & nc->btns); - - /* were pressed or were held & not pressed now, then released */ - nc->btns_released = ((nc->btns | nc->btns_held) & ~now); - - /* buttons pressed now */ - nc->btns = now; -} - - -/** - * @brief Set the orientation event threshold for the nunchuk. - * - * @param wm Pointer to a wiimote_t structure with a nunchuk attached. - * @param threshold The decimal place that should be considered a significant change. - * - * See wiiuse_set_orient_threshold() for details. - */ -void wiiuse_set_nunchuk_orient_threshold(struct wiimote_t* wm, float threshold) { - if (!wm) { - return; - } - - wm->exp.nunchuk.orient_threshold = threshold; -} - - -/** - * @brief Set the accelerometer event threshold for the nunchuk. - * - * @param wm Pointer to a wiimote_t structure with a nunchuk attached. - * @param threshold The decimal place that should be considered a significant change. - * - * See wiiuse_set_orient_threshold() for details. - */ -void wiiuse_set_nunchuk_accel_threshold(struct wiimote_t* wm, int threshold) { - if (!wm) { - return; - } - - wm->exp.nunchuk.accel_threshold = threshold; -} diff --git a/lib/wiiuse/os_nix.c b/lib/wiiuse/os_nix.c deleted file mode 100644 index 63de90bbe..000000000 --- a/lib/wiiuse/os_nix.c +++ /dev/null @@ -1,405 +0,0 @@ -/* - * wiiuse - * - * Written By: - * Michael Laforest < para > - * Email: < thepara (--AT--) g m a i l [--DOT--] com > - * - * Copyright 2006-2007 - * - * This file is part of wiiuse. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * $Header$ - * - */ - -/** - * @file - * @brief Handles device I/O for *nix. - */ - -#include "io.h" -#include "events.h" -#include "os.h" - -#ifdef WIIUSE_BLUEZ - - -#include /* for ba2str, str2ba */ -#include /* for inquiry_info */ -#include /* for hci_get_route, hci_inquiry, etc */ -#include /* for sockaddr_l2 */ - -#include /* for perror */ -#include /* for memset */ -#include /* for connect, socket */ -#include /* for struct timeval */ -#include /* for close, write */ -#include -#include - -static int wiiuse_os_connect_single(struct wiimote_t* wm, char* address); - -int wiiuse_os_find(struct wiimote_t** wm, int max_wiimotes, int timeout) { - int device_id; - int device_sock; - inquiry_info scan_info_arr[128]; - inquiry_info* scan_info = scan_info_arr; - int found_devices; - int found_wiimotes; - int i = 0; - - /* reset all wiimote bluetooth device addresses */ - for (found_wiimotes = 0; found_wiimotes < max_wiimotes; ++found_wiimotes) { - /* bacpy(&(wm[found_wiimotes]->bdaddr), BDADDR_ANY); */ - memset(&(wm[found_wiimotes]->bdaddr), 0, sizeof(bdaddr_t)); - } - found_wiimotes = 0; - - /* get the id of the first bluetooth device. */ - device_id = hci_get_route(NULL); - if (device_id < 0) { - if (errno == ENODEV) { - WIIUSE_ERROR("Could not detect a Bluetooth adapter!"); - } else { - perror("hci_get_route"); - } - return 0; - } - - /* create a socket to the device */ - device_sock = hci_open_dev(device_id); - if (device_sock < 0) { - perror("hci_open_dev"); - return 0; - } - - memset(&scan_info_arr, 0, sizeof(scan_info_arr)); - - /* scan for bluetooth devices for 'timeout' seconds */ - found_devices = hci_inquiry(device_id, timeout, 128, NULL, &scan_info, IREQ_CACHE_FLUSH); - if (found_devices < 0) { - perror("hci_inquiry"); - return 0; - } - - WIIUSE_INFO("Found %i bluetooth device(s).", found_devices); - - /* display discovered devices */ - for (i = 0; (i < found_devices) && (found_wiimotes < max_wiimotes); ++i) { - bool is_wiimote_regular = (scan_info[i].dev_class[0] == WM_DEV_CLASS_0) && - (scan_info[i].dev_class[1] == WM_DEV_CLASS_1) && - (scan_info[i].dev_class[2] == WM_DEV_CLASS_2); - - bool is_wiimote_plus = (scan_info[i].dev_class[0] == WM_PLUS_DEV_CLASS_0) && - (scan_info[i].dev_class[1] == WM_PLUS_DEV_CLASS_1) && - (scan_info[i].dev_class[2] == WM_PLUS_DEV_CLASS_2); - if (is_wiimote_regular || is_wiimote_plus) { - /* found a device */ - ba2str(&scan_info[i].bdaddr, wm[found_wiimotes]->bdaddr_str); - - const char* str_type; - if(is_wiimote_regular) - { - wm[found_wiimotes]->type = WIIUSE_WIIMOTE_REGULAR; - str_type = " (regular wiimote)"; - } - else if(is_wiimote_plus) - { - wm[found_wiimotes]->type = WIIUSE_WIIMOTE_MOTION_PLUS_INSIDE; - str_type = " (motion plus inside)"; - } - - WIIUSE_INFO("Found wiimote (type: %s) (%s) [id %i].", str_type, wm[found_wiimotes]->bdaddr_str, wm[found_wiimotes]->unid); - - wm[found_wiimotes]->bdaddr = scan_info[i].bdaddr; - WIIMOTE_ENABLE_STATE(wm[found_wiimotes], WIIMOTE_STATE_DEV_FOUND); - ++found_wiimotes; - } - } - - close(device_sock); - return found_wiimotes; -} - - -/** - * @see wiiuse_connect() - * @see wiiuse_os_connect_single() - */ -int wiiuse_os_connect(struct wiimote_t** wm, int wiimotes) { - int connected = 0; - int i = 0; - - for (; i < wiimotes; ++i) { - if (!WIIMOTE_IS_SET(wm[i], WIIMOTE_STATE_DEV_FOUND)) - /* if the device address is not set, skip it */ - { - continue; - } - - if (wiiuse_os_connect_single(wm[i], NULL)) { - ++connected; - } - } - - return connected; -} - - -/** - * @brief Connect to a wiimote with a known address. - * - * @param wm Pointer to a wiimote_t structure. - * @param address The address of the device to connect to. - * If NULL, use the address in the struct set by wiiuse_os_find(). - * - * @return 1 on success, 0 on failure - */ -static int wiiuse_os_connect_single(struct wiimote_t* wm, char* address) { - struct sockaddr_l2 addr; - memset(&addr, 0, sizeof(addr)); - - if (!wm || WIIMOTE_IS_CONNECTED(wm)) { - return 0; - } - - addr.l2_family = AF_BLUETOOTH; - bdaddr_t *bdaddr = &wm->bdaddr; - if (address) - /* use provided address */ - { - str2ba(address, &addr.l2_bdaddr); - } else { - /** @todo this line doesn't make sense - bacmp(bdaddr, BDADDR_ANY);*/ - /* use address of device discovered */ - addr.l2_bdaddr = *bdaddr; - - } - - /* - * OUTPUT CHANNEL - */ - wm->out_sock = socket(AF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP); - if (wm->out_sock == -1) { - return 0; - } - - addr.l2_psm = htobs(WM_OUTPUT_CHANNEL); - - /* connect to wiimote */ - if (connect(wm->out_sock, (struct sockaddr*)&addr, sizeof(addr)) < 0) { - perror("connect() output sock"); - return 0; - } - - /* - * INPUT CHANNEL - */ - wm->in_sock = socket(AF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP); - if (wm->in_sock == -1) { - close(wm->out_sock); - wm->out_sock = -1; - return 0; - } - - addr.l2_psm = htobs(WM_INPUT_CHANNEL); - - /* connect to wiimote */ - if (connect(wm->in_sock, (struct sockaddr*)&addr, sizeof(addr)) < 0) { - perror("connect() interrupt sock"); - close(wm->out_sock); - wm->out_sock = -1; - return 0; - } - - WIIUSE_INFO("Connected to wiimote [id %i].", wm->unid); - - /* do the handshake */ - WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_CONNECTED); - wiiuse_handshake(wm, NULL, 0); - - wiiuse_set_report_type(wm); - - return 1; -} - -void wiiuse_os_disconnect(struct wiimote_t* wm) { - if (!wm || WIIMOTE_IS_CONNECTED(wm)) { - return; - } - - close(wm->out_sock); - close(wm->in_sock); - - wm->out_sock = -1; - wm->in_sock = -1; - wm->event = WIIUSE_NONE; - - WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_CONNECTED); - WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_HANDSHAKE); -} - - -int wiiuse_os_poll(struct wiimote_t** wm, int wiimotes) { - int evnt; - struct timeval tv; - fd_set fds; - int r; - int i; - byte read_buffer[MAX_PAYLOAD]; - int highest_fd = -1; - - evnt = 0; - if (!wm) { - return 0; - } - - /* block select() for 1/2000th of a second */ - tv.tv_sec = 0; - tv.tv_usec = 500; - - FD_ZERO(&fds); - - for (i = 0; i < wiimotes; ++i) { - /* only poll it if it is connected */ - if (WIIMOTE_IS_SET(wm[i], WIIMOTE_STATE_CONNECTED)) { - FD_SET(wm[i]->in_sock, &fds); - - /* find the highest fd of the connected wiimotes */ - if (wm[i]->in_sock > highest_fd) { - highest_fd = wm[i]->in_sock; - } - } - - wm[i]->event = WIIUSE_NONE; - } - - if (highest_fd == -1) - /* nothing to poll */ - { - return 0; - } - - if (select(highest_fd + 1, &fds, NULL, NULL, &tv) == -1) { - WIIUSE_ERROR("Unable to select() the wiimote interrupt socket(s)."); - perror("Error Details"); - return 0; - } - - /* check each socket for an event */ - for (i = 0; i < wiimotes; ++i) { - /* if this wiimote is not connected, skip it */ - if (!WIIMOTE_IS_CONNECTED(wm[i])) { - continue; - } - - if (FD_ISSET(wm[i]->in_sock, &fds)) { - /* clear out the event buffer */ - memset(read_buffer, 0, sizeof(read_buffer)); - - /* clear out any old read data */ - clear_dirty_reads(wm[i]); - - /* read the pending message into the buffer */ - r = wiiuse_os_read(wm[i], read_buffer, sizeof(read_buffer)); - if (r > 0) { - /* propagate the event */ - propagate_event(wm[i], read_buffer[0], read_buffer + 1); - evnt += (wm[i]->event != WIIUSE_NONE); - } - } else { - /* send out any waiting writes */ - wiiuse_send_next_pending_write_request(wm[i]); - idle_cycle(wm[i]); - } - } - - return evnt; -} - -int wiiuse_os_read(struct wiimote_t* wm, byte* buf, int len) { - int rc; - int i; - - rc = read(wm->in_sock, buf, len); - - if (rc == -1) { - /* error reading data */ - WIIUSE_ERROR("Receiving wiimote data (id %i).", wm->unid); - perror("Error Details"); - - if (errno == ENOTCONN) { - /* this can happen if the bluetooth dongle is disconnected */ - WIIUSE_ERROR("Bluetooth appears to be disconnected. Wiimote unid %i will be disconnected.", wm->unid); - wiiuse_os_disconnect(wm); - wiiuse_disconnected(wm); - } - } else if (rc == 0) { - /* remote disconnect */ - wiiuse_disconnected(wm); - } else { - /* read successful */ - /* on *nix we ignore the first byte */ - memmove(buf, buf + 1, len - 1); - - /* log the received data */ -#ifdef WITH_WIIUSE_DEBUG - { - int i; - printf("[DEBUG] (id %i) RECV: (%.2x) ", wm->unid, buf[0]); - for (i = 1; i < rc; i++) { - printf("%.2x ", buf[i]); - } - printf("\n"); - } -#endif - } - - return rc; -} - -int wiiuse_os_write(struct wiimote_t* wm, byte report_type, byte* buf, int len) { - int rc; - byte write_buffer[MAX_PAYLOAD]; - - write_buffer[0] = WM_SET_REPORT | WM_BT_OUTPUT; - write_buffer[1] = report_type; - memcpy(write_buffer + 2, buf, len); - rc = write(wm->out_sock, write_buffer, len + 2); - - if (rc < 0) { - wiiuse_disconnected(wm); - } - - return rc; -} - -void wiiuse_init_platform_fields(struct wiimote_t* wm) { - memset(&(wm->bdaddr), 0, sizeof(bdaddr_t)); /* = *BDADDR_ANY;*/ - wm->out_sock = -1; - wm->in_sock = -1; -} - -void wiiuse_cleanup_platform_fields(struct wiimote_t* wm) { - wm->out_sock = -1; - wm->in_sock = -1; -} - - - -#endif /* ifdef WIIUSE_BLUEZ */ diff --git a/lib/wiiuse/os_win.c b/lib/wiiuse/os_win.c deleted file mode 100644 index 108284dfe..000000000 --- a/lib/wiiuse/os_win.c +++ /dev/null @@ -1,317 +0,0 @@ -/* - * wiiuse - * - * Written By: - * Michael Laforest < para > - * Email: < thepara (--AT--) g m a i l [--DOT--] com > - * - * Copyright 2006-2007 - * - * This file is part of wiiuse. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * $Header$ - * - */ - -/** - * @file - * @brief Handles device I/O for Windows. - */ - - -#include "io.h" -#include "events.h" -#include "os.h" - -#ifdef WIIUSE_WIN32 -#include - -#include -#include - -int wiiuse_os_find(struct wiimote_t** wm, int max_wiimotes, int timeout) { - GUID device_id; - HANDLE dev; - HDEVINFO device_info; - int i, index; - DWORD len; - SP_DEVICE_INTERFACE_DATA device_data; - PSP_DEVICE_INTERFACE_DETAIL_DATA detail_data = NULL; - HIDD_ATTRIBUTES attr; - int found = 0; - - (void) timeout; /* unused */ - - device_data.cbSize = sizeof(device_data); - index = 0; - - /* get the device id */ - HidD_GetHidGuid(&device_id); - - /* get all hid devices connected */ - device_info = SetupDiGetClassDevs(&device_id, NULL, NULL, (DIGCF_DEVICEINTERFACE | DIGCF_PRESENT)); - - for (;; ++index) { - - if (detail_data) { - free(detail_data); - detail_data = NULL; - } - - /* query the next hid device info */ - if (!SetupDiEnumDeviceInterfaces(device_info, NULL, &device_id, index, &device_data)) { - break; - } - - /* get the size of the data block required */ - i = SetupDiGetDeviceInterfaceDetail(device_info, &device_data, NULL, 0, &len, NULL); - detail_data = (SP_DEVICE_INTERFACE_DETAIL_DATA_A*)malloc(len); - detail_data->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA); - - /* query the data for this device */ - if (!SetupDiGetDeviceInterfaceDetail(device_info, &device_data, detail_data, len, NULL, NULL)) { - continue; - } - - /* open the device */ - dev = CreateFile(detail_data->DevicePath, - (GENERIC_READ | GENERIC_WRITE), - (FILE_SHARE_READ | FILE_SHARE_WRITE), - NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL); - if (dev == INVALID_HANDLE_VALUE) { - continue; - } - - /* get device attributes */ - attr.Size = sizeof(attr); - i = HidD_GetAttributes(dev, &attr); - - if ((attr.VendorID == WM_VENDOR_ID) && (attr.ProductID == WM_PRODUCT_ID || attr.ProductID == WM_PLUS_PRODUCT_ID)) { - /* this is a wiimote */ - wm[found]->dev_handle = dev; - - if(attr.ProductID == WM_PLUS_PRODUCT_ID) - wm[found]->type = WIIUSE_WIIMOTE_MOTION_PLUS_INSIDE; - - wm[found]->hid_overlap.hEvent = CreateEvent(NULL, 1, 1, ""); - wm[found]->hid_overlap.Offset = 0; - wm[found]->hid_overlap.OffsetHigh = 0; - - WIIMOTE_ENABLE_STATE(wm[found], WIIMOTE_STATE_DEV_FOUND); - WIIMOTE_ENABLE_STATE(wm[found], WIIMOTE_STATE_CONNECTED); - - /* try to set the output report to see if the device is actually connected */ - if (!wiiuse_set_report_type(wm[found])) { - WIIMOTE_DISABLE_STATE(wm[found], WIIMOTE_STATE_CONNECTED); - continue; - } - - /* do the handshake */ - wiiuse_handshake(wm[found], NULL, 0); - - WIIUSE_INFO("Connected to wiimote [id %i].", wm[found]->unid); - - ++found; - if (found >= max_wiimotes) { - break; - } - } else { - /* not a wiimote */ - CloseHandle(dev); - } - } - - if (detail_data) { - free(detail_data); - } - - SetupDiDestroyDeviceInfoList(device_info); - - return found; -} - - -int wiiuse_os_connect(struct wiimote_t** wm, int wiimotes) { - int connected = 0; - int i = 0; - - for (; i < wiimotes; ++i) { - if (!wm[i]) { - continue; - } - if (WIIMOTE_IS_SET(wm[i], WIIMOTE_STATE_CONNECTED)) { - ++connected; - } - } - - return connected; -} - - -void wiiuse_os_disconnect(struct wiimote_t* wm) { - if (!wm || WIIMOTE_IS_CONNECTED(wm)) { - return; - } - - CloseHandle(wm->dev_handle); - wm->dev_handle = 0; - - ResetEvent(&wm->hid_overlap); - - wm->event = WIIUSE_NONE; - - WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_CONNECTED); - WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_HANDSHAKE); -} - - -int wiiuse_os_poll(struct wiimote_t** wm, int wiimotes) { - int i; - byte read_buffer[MAX_PAYLOAD]; - int evnt = 0; - - if (!wm) { - return 0; - } - - for (i = 0; i < wiimotes; ++i) { - wm[i]->event = WIIUSE_NONE; - - /* clear out the buffer */ - memset(read_buffer, 0, sizeof(read_buffer)); - /* read */ - if (wiiuse_os_read(wm[i], read_buffer, sizeof(read_buffer))) { - /* propagate the event */ - propagate_event(wm[i], read_buffer[0], read_buffer + 1); - evnt += (wm[i]->event != WIIUSE_NONE); - } else { - /* send out any waiting writes */ - wiiuse_send_next_pending_write_request(wm[i]); - idle_cycle(wm[i]); - } - } - - return evnt; -} - -int wiiuse_os_read(struct wiimote_t* wm, byte* buf, int len) { - DWORD b, r; - - if (!wm || !WIIMOTE_IS_CONNECTED(wm)) { - return 0; - } - - if (!ReadFile(wm->dev_handle, buf, len, &b, &wm->hid_overlap)) { - /* partial read */ - b = GetLastError(); - - if ((b == ERROR_HANDLE_EOF) || (b == ERROR_DEVICE_NOT_CONNECTED)) { - /* remote disconnect */ - wiiuse_disconnected(wm); - return 0; - } - - r = WaitForSingleObject(wm->hid_overlap.hEvent, wm->timeout); - if (r == WAIT_TIMEOUT) { - /* timeout - cancel and continue */ - - if (*buf) { - WIIUSE_WARNING("Packet ignored. This may indicate a problem (timeout is %i ms).", wm->timeout); - } - - CancelIo(wm->dev_handle); - ResetEvent(wm->hid_overlap.hEvent); - return 0; - } else if (r == WAIT_FAILED) { - WIIUSE_WARNING("A wait error occurred on reading from wiimote %i.", wm->unid); - return 0; - } - - if (!GetOverlappedResult(wm->dev_handle, &wm->hid_overlap, &b, 0)) { - return 0; - } - - /* log the received data */ -#ifdef WITH_WIIUSE_DEBUG - { - DWORD i; - printf("[DEBUG] (id %i) RECV: (%.2x) ", wm->unid, buf[0]); - for (i = 1; i < b; i++) { - printf("%.2x ", buf[i]); - } - printf("\n"); - } -#endif - } - - ResetEvent(wm->hid_overlap.hEvent); - return 1; -} - - -int wiiuse_os_write(struct wiimote_t* wm, byte report_type, byte* buf, int len) { - DWORD bytes; - int i; - byte write_buffer[MAX_PAYLOAD]; - - if (!wm || !WIIMOTE_IS_CONNECTED(wm)) { - return 0; - } - - write_buffer[0] = report_type; - memcpy(write_buffer + 1, buf, len); - - switch (wm->stack) { - case WIIUSE_STACK_UNKNOWN: { - /* try to auto-detect the stack type */ - if (i = WriteFile(wm->dev_handle, write_buffer, 22, &bytes, &wm->hid_overlap)) { - /* bluesoleil will always return 1 here, even if it's not connected */ - wm->stack = WIIUSE_STACK_BLUESOLEIL; - return i; - } - - if (i = HidD_SetOutputReport(wm->dev_handle, write_buffer, len + 1)) { - wm->stack = WIIUSE_STACK_MS; - return i; - } - - WIIUSE_ERROR("Unable to determine bluetooth stack type."); - return 0; - } - - case WIIUSE_STACK_MS: - return HidD_SetOutputReport(wm->dev_handle, write_buffer, len + 1); - - case WIIUSE_STACK_BLUESOLEIL: - return WriteFile(wm->dev_handle, write_buffer, 22, &bytes, &wm->hid_overlap); - } - - return 0; -} - -void wiiuse_init_platform_fields(struct wiimote_t* wm) { - wm->dev_handle = 0; - wm->stack = WIIUSE_STACK_UNKNOWN; - wm->normal_timeout = WIIMOTE_DEFAULT_TIMEOUT; - wm->exp_timeout = WIIMOTE_EXP_TIMEOUT; - wm->timeout = wm->normal_timeout; -} - -void wiiuse_cleanup_platform_fields(struct wiimote_t* wm) { - wm->dev_handle = 0; -} - -#endif /* ifdef WIIUSE_WIN32 */ diff --git a/lib/wiiuse/scripts/ci/common/script.sh b/lib/wiiuse/scripts/ci/common/script.sh new file mode 100755 index 000000000..1cf67c54f --- /dev/null +++ b/lib/wiiuse/scripts/ci/common/script.sh @@ -0,0 +1,8 @@ +#!/bin/bash +set -ev + +mkdir -p build +cd build +cmake .. +make +#make install diff --git a/lib/wiiuse/scripts/ci/linux/install.sh b/lib/wiiuse/scripts/ci/linux/install.sh new file mode 100644 index 000000000..cf250cbe6 --- /dev/null +++ b/lib/wiiuse/scripts/ci/linux/install.sh @@ -0,0 +1,9 @@ +#!/bin/bash +set -ev + +sudo apt-get update -qq + +sudo apt-get install cmake +sudo apt-get install libbluetooth-dev +sudo apt-get install libsdl-dev +sudo apt-get install freeglut3-dev diff --git a/lib/wiiuse/scripts/ci/osx/install.sh b/lib/wiiuse/scripts/ci/osx/install.sh new file mode 100644 index 000000000..7ee8aefcd --- /dev/null +++ b/lib/wiiuse/scripts/ci/osx/install.sh @@ -0,0 +1,6 @@ +#!/bin/bash +set -ev +unset -f cd # See https://github.com/travis-ci/travis-ci/issues/8703 + +brew update +brew ls --versions cmake && brew upgrade cmake || brew install cmake # Install or Update cmake (if required) diff --git a/lib/wiiuse/src/CMakeLists.txt b/lib/wiiuse/src/CMakeLists.txt new file mode 100644 index 000000000..7003fc8e3 --- /dev/null +++ b/lib/wiiuse/src/CMakeLists.txt @@ -0,0 +1,109 @@ +if(NOT MSVC) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") +endif() + +set(SOURCES + classic.c + dynamics.c + events.c + guitar_hero_3.c + io.c + ir.c + nunchuk.c + wiiuse.c + wiiboard.c + classic.h + definitions.h + definitions_os.h + dynamics.h + events.h + guitar_hero_3.h + motion_plus.h + motion_plus.c + io.h + ir.h + nunchuk.h + os.h + util.c + wiiuse_internal.h + wiiboard.h) +set(API + wiiuse.h) + +if(WIN32) + list(APPEND SOURCES os_win.c) + set(CMAKE_DEBUG_POSTFIX _debug) +elseif(APPLE) + set(MAC_OBJC_SOURCES + os_mac/os_mac.m + os_mac/os_mac_interface.m + os_mac/os_mac_find.m) + set(MAC_SOURCES + os_mac/os_mac.h + os_mac/os_mac.c + ${MAC_OBJC_SOURCES}) + list(APPEND SOURCES ${MAC_SOURCES}) + # make sure we use the gcc for Objective-C files as well so that the + # sysroot and deployment target arguments are correctly passed to the compiler + set_source_files_properties(${MAC_OBJC_SOURCES} PROPERTIES LANGUAGE C) +else() + list(APPEND SOURCES os_nix.c) +endif() + +if(MSVC) + list(APPEND API wiiuse_msvcstdint.h) +endif() + +add_definitions(-DWIIUSE_COMPILE_LIB) + +add_library(wiiuse ${WIIUSE_LIB_TYPE} ${SOURCES} ${API}) + +if(WIN32) + target_link_libraries(wiiuse ws2_32 setupapi ${WINHID_LIBRARIES}) +elseif(LINUX) + target_link_libraries(wiiuse m rt ${BLUEZ_LIBRARIES}) +elseif(APPLE) + # link libraries + find_library(IOBLUETOOTH_FRAMEWORK + NAMES + IOBluetooth) + find_library(COREFOUNDATION_FRAMEWORK + NAMES + CoreFoundation) + find_library(FOUNDATION_FRAMEWORK + NAMES + Foundation) + target_link_libraries(wiiuse ${IOBLUETOOTH_FRAMEWORK} ${COREFOUNDATION_FRAMEWORK} ${FOUNDATION_FRAMEWORK}) + + # do not link Objective-C runtime with clang + set_target_properties(wiiuse PROPERTIES XCODE_ATTRIBUTE_CLANG_LINK_OBJC_RUNTIME "NO") +endif() + +set_property(TARGET + wiiuse + PROPERTY + PUBLIC_HEADER + ${API}) + +set_property(TARGET wiiuse APPEND PROPERTY + COMPILE_DEFINITIONS $<$:WITH_WIIUSE_DEBUG> +) + +install(TARGETS wiiuse + RUNTIME DESTINATION bin + COMPONENT runtime + ARCHIVE + DESTINATION + ${CMAKE_INSTALL_LIBDIR} + COMPONENT + development + LIBRARY + DESTINATION + ${CMAKE_INSTALL_LIBDIR} + COMPONENT + runtime + PUBLIC_HEADER + DESTINATION + include + COMPONENT + development) diff --git a/lib/wiiuse/src/classic.c b/lib/wiiuse/src/classic.c new file mode 100644 index 000000000..bf2d75ca7 --- /dev/null +++ b/lib/wiiuse/src/classic.c @@ -0,0 +1,174 @@ +/* + * wiiuse + * + * Written By: + * Michael Laforest < para > + * Email: < thepara (--AT--) g m a i l [--DOT--] com > + * + * Copyright 2006-2007 + * + * This file is part of wiiuse. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * $Header$ + * + */ + +/** + * @file + * @brief Classic controller expansion device. + */ + +#include "classic.h" +#include "dynamics.h" /* for calc_joystick_state */ +#include "events.h" /* for handshake_expansion */ + +#include /* for malloc */ +#include /* for memset */ + +static void classic_ctrl_pressed_buttons(struct classic_ctrl_t *cc, short now); + +/** + * @brief Handle the handshake data from the classic controller. + * + * @param cc A pointer to a classic_ctrl_t structure. + * @param data The data read in from the device. + * @param len The length of the data block, in bytes. + * + * @return Returns 1 if handshake was successful, 0 if not. + */ +#define HANDSHAKE_BYTES_USED 12 +int classic_ctrl_handshake(struct wiimote_t *wm, struct classic_ctrl_t *cc, byte *data, unsigned short len) +{ + + cc->btns = 0; + cc->btns_held = 0; + cc->btns_released = 0; + cc->r_shoulder = 0; + cc->l_shoulder = 0; + + if (data[0] == 0xFF || len < HANDSHAKE_BYTES_USED) + { + /* + * Sometimes the data returned here is not correct. + * This might happen because the wiimote is lagging + * behind our initialization sequence. + * To fix this just request the handshake again. + * + * Other times it's just the first 16 bytes are 0xFF, + * but since the next 16 bytes are the same, just use + * those. + */ + if (len < 17 || len < HANDSHAKE_BYTES_USED + 16 || data[16] == 0xFF) + { + /* get the calibration data */ + byte *handshake_buf = (byte *)malloc(EXP_HANDSHAKE_LEN * sizeof(byte)); + + WIIUSE_DEBUG("Classic controller handshake appears invalid, trying again."); + wiiuse_read_data_cb(wm, handshake_expansion, handshake_buf, WM_EXP_MEM_CALIBR, EXP_HANDSHAKE_LEN); + + return 0; + } else + { + data += 16; + } + } + + /* joystick stuff */ + cc->ljs.max.x = data[0] / 4; + cc->ljs.min.x = data[1] / 4; + cc->ljs.center.x = data[2] / 4; + cc->ljs.max.y = data[3] / 4; + cc->ljs.min.y = data[4] / 4; + cc->ljs.center.y = data[5] / 4; + + cc->rjs.max.x = data[6] / 8; + cc->rjs.min.x = data[7] / 8; + cc->rjs.center.x = data[8] / 8; + cc->rjs.max.y = data[9] / 8; + cc->rjs.min.y = data[10] / 8; + cc->rjs.center.y = data[11] / 8; + + /* handshake done */ + wm->exp.type = EXP_CLASSIC; + +#ifdef WIIUSE_WIN32 + wm->timeout = WIIMOTE_DEFAULT_TIMEOUT; +#endif + + return 1; +} + +/** + * @brief The classic controller disconnected. + * + * @param cc A pointer to a classic_ctrl_t structure. + */ +void classic_ctrl_disconnected(struct classic_ctrl_t *cc) { memset(cc, 0, sizeof(struct classic_ctrl_t)); } + +/** + * @brief Handle classic controller event. + * + * @param cc A pointer to a classic_ctrl_t structure. + * @param msg The message specified in the event packet. + */ +void classic_ctrl_event(struct classic_ctrl_t *cc, byte *msg) +{ + int lx, ly, rx, ry; + byte l, r; + + classic_ctrl_pressed_buttons(cc, from_big_endian_uint16_t(msg + 4)); + + /* left/right buttons */ + l = (((msg[2] & 0x60) >> 2) | ((msg[3] & 0xE0) >> 5)); + r = (msg[3] & 0x1F); + + /* + * TODO - LR range hardcoded from 0x00 to 0x1F. + * This is probably in the calibration somewhere. + */ + cc->r_shoulder = ((float)r / 0x1F); + cc->l_shoulder = ((float)l / 0x1F); + + /* calculate joystick orientation */ + lx = (msg[0] & 0x3F); + ly = (msg[1] & 0x3F); + rx = ((msg[0] & 0xC0) >> 3) | ((msg[1] & 0xC0) >> 5) | ((msg[2] & 0x80) >> 7); + ry = (msg[2] & 0x1F); + + calc_joystick_state(&cc->ljs, (float)lx, (float)ly); + calc_joystick_state(&cc->rjs, (float)rx, (float)ry); +} + +/** + * @brief Find what buttons are pressed. + * + * @param cc A pointer to a classic_ctrl_t structure. + * @param msg The message byte specified in the event packet. + */ +static void classic_ctrl_pressed_buttons(struct classic_ctrl_t *cc, short now) +{ + /* message is inverted (0 is active, 1 is inactive) */ + now = ~now & CLASSIC_CTRL_BUTTON_ALL; + + /* pressed now & were pressed, then held */ + cc->btns_held = (now & cc->btns); + + /* were pressed or were held & not pressed now, then released */ + cc->btns_released = ((cc->btns | cc->btns_held) & ~now); + + /* buttons pressed now */ + cc->btns = now; +} diff --git a/lib/wiiuse/classic.h b/lib/wiiuse/src/classic.h similarity index 77% rename from lib/wiiuse/classic.h rename to lib/wiiuse/src/classic.h index e54337ac6..6b67bf234 100644 --- a/lib/wiiuse/classic.h +++ b/lib/wiiuse/src/classic.h @@ -40,14 +40,14 @@ extern "C" { #endif - /** @defgroup internal_classic Internal: Classic Controller */ - /** @{ */ - int classic_ctrl_handshake(struct wiimote_t* wm, struct classic_ctrl_t* cc, byte* data, unsigned short len); +/** @defgroup internal_classic Internal: Classic Controller */ +/** @{ */ +int classic_ctrl_handshake(struct wiimote_t *wm, struct classic_ctrl_t *cc, byte *data, unsigned short len); - void classic_ctrl_disconnected(struct classic_ctrl_t* cc); +void classic_ctrl_disconnected(struct classic_ctrl_t *cc); - void classic_ctrl_event(struct classic_ctrl_t* cc, byte* msg); - /** @} */ +void classic_ctrl_event(struct classic_ctrl_t *cc, byte *msg); +/** @} */ #ifdef __cplusplus } diff --git a/lib/wiiuse/src/definitions.h b/lib/wiiuse/src/definitions.h new file mode 100644 index 000000000..4e8e84e65 --- /dev/null +++ b/lib/wiiuse/src/definitions.h @@ -0,0 +1,113 @@ +/* + * wiiuse + * + * Written By: + * Michael Laforest < para > + * Email: < thepara (--AT--) g m a i l [--DOT--] com > + * + * Copyright 2006-2007 + * + * This file is part of wiiuse. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * $Header$ + * + */ + +/** + * @file + * @brief General definitions. + */ + +#ifndef DEFINITIONS_H_INCLUDED +#define DEFINITIONS_H_INCLUDED + +/* this is wiiuse - used to distinguish from third party programs using wiiuse.h */ +#include "definitions_os.h" +#include +/** @addtogroup internal_general */ +/** @{ */ + +#define WIIMOTE_PI 3.14159265f + +/* #define WITH_WIIUSE_DEBUG */ + +extern FILE *logtarget[]; + +#define OUTF_ERROR logtarget[0] +#define OUTF_WARNING logtarget[1] +#define OUTF_INFO logtarget[2] +#define OUTF_DEBUG logtarget[3] + +/* Error output macros */ +#define WIIUSE_ERROR(fmt, ...) \ + do \ + { \ + if (OUTF_ERROR) \ + fprintf(OUTF_ERROR, "[ERROR] " fmt "\n", ##__VA_ARGS__); \ + } while (0) + +/* Warning output macros */ +#define WIIUSE_WARNING(fmt, ...) \ + do \ + { \ + if (OUTF_WARNING) \ + fprintf(OUTF_WARNING, "[WARNING] " fmt "\n", ##__VA_ARGS__); \ + } while (0) + +/* Information output macros */ +#define WIIUSE_INFO(fmt, ...) \ + do \ + { \ + if (OUTF_INFO) \ + fprintf(OUTF_INFO, "[INFO] " fmt "\n", ##__VA_ARGS__); \ + } while (0) + +#ifdef WITH_WIIUSE_DEBUG +#ifdef WIIUSE_WIN32 +#define WIIUSE_DEBUG(fmt, ...) \ + do \ + { \ + if (OUTF_DEBUG) \ + { \ + char *file = __FILE__; \ + int i = strlen(file) - 1; \ + for (; i && (file[i] != '\\'); --i) \ + ; \ + fprintf(OUTF_DEBUG, "[DEBUG] %s:%i: " fmt "\n", file + i + 1, __LINE__, ##__VA_ARGS__); \ + } \ + } while (0) +#else +#define WIIUSE_DEBUG(fmt, ...) \ + do \ + { \ + if (OUTF_DEBUG) \ + fprintf(OUTF_DEBUG, "[DEBUG] " __FILE__ ":%i: " fmt "\n", __LINE__, ##__VA_ARGS__); \ + } while (0) +#endif +#else +#define WIIUSE_DEBUG(fmt, ...) +#endif + +/* Convert between radians and degrees */ +#define RAD_TO_DEGREE(r) ((r * 180.0f) / WIIMOTE_PI) +#define DEGREE_TO_RAD(d) (d * (WIIMOTE_PI / 180.0f)) + +#define absf(x) ((x >= 0) ? (x) : (x * -1.0f)) +#define diff_f(x, y) ((x >= y) ? (absf(x - y)) : (absf(y - x))) + +/** @} */ + +#endif /* DEFINITIONS_H_INCLUDED */ diff --git a/lib/wiiuse/definitions_os.h b/lib/wiiuse/src/definitions_os.h similarity index 79% rename from lib/wiiuse/definitions_os.h rename to lib/wiiuse/src/definitions_os.h index 00271c86f..c3a252d4d 100644 --- a/lib/wiiuse/definitions_os.h +++ b/lib/wiiuse/src/definitions_os.h @@ -26,7 +26,6 @@ * */ - /** * @file * @brief Operating system related definitions. @@ -40,18 +39,15 @@ #define DEFINITIONS_OS_H_INCLUDED #ifdef _MSC_VER - #include - /* windows with visual c */ - #include // For isnan etc, otherwise we get duplicated defines - +#include +#include +/* windows with old visual c doesn't have isXYZ macros */ #ifndef isnan - #define isnan(x) (_isnan(x)) +#define isnan(x) (_isnan(x)) #endif #ifndef isinf - #define isinf(x) (!_finite(x)) +#define isinf(x) (!_finite(x)) #endif - /* disable warnings I don't care about */ - /*#pragma warning(disable:4273) */ /* inconsistent dll linkage */ #endif #endif /* DEFINITIONS_OS_H_INCLUDED */ diff --git a/lib/wiiuse/src/dynamics.c b/lib/wiiuse/src/dynamics.c new file mode 100644 index 000000000..7bc4ea252 --- /dev/null +++ b/lib/wiiuse/src/dynamics.c @@ -0,0 +1,258 @@ +/* + * wiiuse + * + * Written By: + * Michael Laforest < para > + * Email: < thepara (--AT--) g m a i l [--DOT--] com > + * + * Copyright 2006-2007 + * + * This file is part of wiiuse. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * $Header$ + * + */ + +/** + * @file + * @brief Handles the dynamics of the wiimote. + * + * The file includes functions that handle the dynamics + * of the wiimote. Such dynamics include orientation and + * motion sensing. + */ + +#include "dynamics.h" + +#include /* for atan2f, atanf, sqrt */ +#include /* for abs */ + +/** + * @brief Calculate the roll, pitch, yaw. + * + * @param ac An accelerometer (accel_t) structure. + * @param accel [in] Pointer to a vec3b_t structure that holds the raw acceleration data. + * @param orient [out] Pointer to a orient_t structure that will hold the orientation data. + * @param rorient [out] Pointer to a orient_t structure that will hold the non-smoothed + *orientation data. + * @param smooth If smoothing should be performed on the angles calculated. 1 to enable, 0 to + *disable. + * + * Given the raw acceleration data from the accelerometer struct, calculate + * the orientation of the device and set it in the \a orient parameter. + */ +void calculate_orientation(struct accel_t *ac, struct vec3b_t *accel, struct orient_t *orient, int smooth) +{ + float xg, yg, zg; + float x, y, z; + + /* + * roll - use atan(z / x) [ ranges from -180 to 180 ] + * pitch - use atan(z / y) [ ranges from -180 to 180 ] + * yaw - impossible to tell without IR + */ + + /* yaw - set to 0, IR will take care of it if it's enabled */ + orient->yaw = 0.0f; + + /* find out how much it has to move to be 1g */ + xg = (float)ac->cal_g.x; + yg = (float)ac->cal_g.y; + zg = (float)ac->cal_g.z; + + /* find out how much it actually moved and normalize to +/- 1g */ + x = ((float)accel->x - (float)ac->cal_zero.x) / xg; + y = ((float)accel->y - (float)ac->cal_zero.y) / yg; + z = ((float)accel->z - (float)ac->cal_zero.z) / zg; + + /* make sure x,y,z are between -1 and 1 for the tan functions */ + if (x < -1.0f) + { + x = -1.0f; + } else if (x > 1.0f) + { + x = 1.0f; + } + if (y < -1.0f) + { + y = -1.0f; + } else if (y > 1.0f) + { + y = 1.0f; + } + if (z < -1.0f) + { + z = -1.0f; + } else if (z > 1.0f) + { + z = 1.0f; + } + + /* + If it is over 1g then it is probably accelerating and not reliable + Formulas from: http://husstechlabs.com/projects/atb1/using-the-accelerometer/ +*/ + + if (abs(accel->x - ac->cal_zero.x) <= ac->cal_g.x) + { + /* roll */ + float roll = RAD_TO_DEGREE(atan2f(x, z)); + + orient->roll = roll; + orient->a_roll = roll; + } + + if (abs(accel->y - ac->cal_zero.y) <= ac->cal_g.y) + { + /* pitch */ + float pitch = RAD_TO_DEGREE(atan2f(y, sqrtf(x * x + z * z))); + + orient->pitch = pitch; + orient->a_pitch = pitch; + } + + /* smooth the angles if enabled */ + if (smooth) + { + apply_smoothing(ac, orient, SMOOTH_ROLL); + apply_smoothing(ac, orient, SMOOTH_PITCH); + } +} + +/** + * @brief Calculate the gravity forces on each axis. + * + * @param ac An accelerometer (accel_t) structure. + * @param accel [in] Pointer to a vec3b_t structure that holds the raw acceleration data. + * @param gforce [out] Pointer to a gforce_t structure that will hold the gravity force data. + */ +void calculate_gforce(struct accel_t *ac, struct vec3b_t *accel, struct gforce_t *gforce) +{ + float xg, yg, zg; + + /* find out how much it has to move to be 1g */ + xg = (float)ac->cal_g.x; + yg = (float)ac->cal_g.y; + zg = (float)ac->cal_g.z; + + /* find out how much it actually moved and normalize to +/- 1g */ + gforce->x = ((float)accel->x - (float)ac->cal_zero.x) / xg; + gforce->y = ((float)accel->y - (float)ac->cal_zero.y) / yg; + gforce->z = ((float)accel->z - (float)ac->cal_zero.z) / zg; +} + +static float applyCalibration(float inval, float minval, float maxval, float centerval) +{ + float ret; + /* We don't use the exact ranges but the ranges + 1 in case we get bad calibration data - avoid div0 */ + if (inval == centerval) + { + ret = 0; + } else if (inval < centerval) + { + ret = (inval - minval) / (centerval - minval + 1.0f) - 1.0f; + } else + { + ret = (inval - centerval) / (maxval - centerval + 1.0f); + } + return ret; +} + +/** + * @brief Calculate the angle and magnitude of a joystick. + * + * @param js [out] Pointer to a joystick_t structure. + * @param x The raw x-axis value. + * @param y The raw y-axis value. + */ +void calc_joystick_state(struct joystick_t *js, float x, float y) +{ + float rx, ry, ang; + + /* + * Since the joystick center may not be exactly: + * (min + max) / 2 + * Then the range from the min to the center and the center to the max + * may be different. + * Because of this, depending on if the current x or y value is greater + * or less than the associated axis center value, it needs to be interpolated + * between the center and the minimum or maxmimum rather than between + * the minimum and maximum. + * + * So we have something like this: + * (x min) [-1] ---------*------ [0] (x center) [0] -------- [1] (x max) + * Where the * is the current x value. + * The range is therefore -1 to 1, 0 being the exact center rather than + * the middle of min and max. + */ + rx = applyCalibration(x, js->min.x, js->max.x, js->center.x); + ry = applyCalibration(y, js->min.y, js->max.y, js->center.y); + js->x = rx; + js->y = ry; + /* calculate the joystick angle and magnitude */ + ang = RAD_TO_DEGREE(atan2f(ry, rx)); + js->ang = ang + 180.0f; + js->mag = sqrtf((rx * rx) + (ry * ry)); +} + +void apply_smoothing(struct accel_t *ac, struct orient_t *orient, int type) +{ + switch (type) + { + case SMOOTH_ROLL: + { + /* it's possible last iteration was nan or inf, so set it to 0 if that happened */ + if (isnan(ac->st_roll) || isinf(ac->st_roll)) + { + ac->st_roll = 0.0f; + } + + /* + * If the sign changes (which will happen if going from -180 to 180) + * or from (-1 to 1) then don't smooth, just use the new angle. + */ + if (((ac->st_roll < 0) && (orient->roll > 0)) || ((ac->st_roll > 0) && (orient->roll < 0))) + { + ac->st_roll = orient->roll; + } else + { + orient->roll = ac->st_roll + (ac->st_alpha * (orient->a_roll - ac->st_roll)); + ac->st_roll = orient->roll; + } + + return; + } + + case SMOOTH_PITCH: + { + if (isnan(ac->st_pitch) || isinf(ac->st_pitch)) + { + ac->st_pitch = 0.0f; + } + + if (((ac->st_pitch < 0) && (orient->pitch > 0)) || ((ac->st_pitch > 0) && (orient->pitch < 0))) + { + ac->st_pitch = orient->pitch; + } else + { + orient->pitch = ac->st_pitch + (ac->st_alpha * (orient->a_pitch - ac->st_pitch)); + ac->st_pitch = orient->pitch; + } + + return; + } + } +} diff --git a/lib/wiiuse/dynamics.h b/lib/wiiuse/src/dynamics.h similarity index 74% rename from lib/wiiuse/dynamics.h rename to lib/wiiuse/src/dynamics.h index 5ef14e0e9..1fe663e6b 100644 --- a/lib/wiiuse/dynamics.h +++ b/lib/wiiuse/src/dynamics.h @@ -44,14 +44,14 @@ extern "C" { #endif - /** @defgroup internal_dynamics Internal: Dynamics Functions */ - /** @{ */ +/** @defgroup internal_dynamics Internal: Dynamics Functions */ +/** @{ */ - void calculate_orientation(struct accel_t* ac, struct vec3b_t* accel, struct orient_t* orient, int smooth); - void calculate_gforce(struct accel_t* ac, struct vec3b_t* accel, struct gforce_t* gforce); - void calc_joystick_state(struct joystick_t* js, float x, float y); - void apply_smoothing(struct accel_t* ac, struct orient_t* orient, int type); - /** @} */ +void calculate_orientation(struct accel_t *ac, struct vec3b_t *accel, struct orient_t *orient, int smooth); +void calculate_gforce(struct accel_t *ac, struct vec3b_t *accel, struct gforce_t *gforce); +void calc_joystick_state(struct joystick_t *js, float x, float y); +void apply_smoothing(struct accel_t *ac, struct orient_t *orient, int type); +/** @} */ #ifdef __cplusplus } diff --git a/lib/wiiuse/src/events.c b/lib/wiiuse/src/events.c new file mode 100644 index 000000000..1fab8e22f --- /dev/null +++ b/lib/wiiuse/src/events.c @@ -0,0 +1,1122 @@ +/* + * wiiuse + * + * Written By: + * Michael Laforest < para > + * Email: < thepara (--AT--) g m a i l [--DOT--] com > + * + * Copyright 2006-2007 + * + * This file is part of wiiuse. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * $Header$ + * + */ + +/** + * @file + * @brief Handles wiimote events. + * + * The file includes functions that handle the events + * that are sent from the wiimote to us. + */ + +#include "wiiuse_internal.h" +#include "events.h" + +#include "classic.h" /* for classic_ctrl_disconnected, etc */ +#include "dynamics.h" /* for calculate_gforce, etc */ +#include "guitar_hero_3.h" /* for guitar_hero_3_disconnected, etc */ +#include "io.h" /* for wiiuse_read_data_sync, etc */ +#include "ir.h" /* for calculate_basic_ir, etc */ +#include "motion_plus.h" /* for motion_plus_disconnected, etc */ +#include "nunchuk.h" /* for nunchuk_disconnected, etc */ +#include "wiiboard.h" /* for wii_board_disconnected, etc */ + +#include "os.h" /* for wiiuse_os_poll */ + +#include /* for printf, perror */ +#include /* for free, malloc */ +#include /* for memcpy, memset */ + +static void event_data_read(struct wiimote_t *wm, byte *msg); +static void event_data_write(struct wiimote_t *wm, byte *msg); +static void event_status(struct wiimote_t *wm, byte *msg); +static void handle_expansion(struct wiimote_t *wm, byte *msg); + +static void save_state(struct wiimote_t *wm); +static int state_changed(struct wiimote_t *wm); + +/** + * @brief Poll the wiimotes for any events. + * + * @param wm An array of pointers to wiimote_t structures. + * @param wiimotes The number of wiimote_t structures in the \a wm array. + * + * @return Returns number of wiimotes that an event has occurred on. + * + * It is necessary to poll the wiimote devices for events + * that occur. If an event occurs on a particular wiimote, + * the event variable will be set. + */ +int wiiuse_poll(struct wiimote_t **wm, int wiimotes) { return wiiuse_os_poll(wm, wiimotes); } + +int wiiuse_update(struct wiimote_t **wiimotes, int nwiimotes, wiiuse_update_cb callback) +{ + int evnt = 0; + if (wiiuse_poll(wiimotes, nwiimotes)) + { + static struct wiimote_callback_data_t s; + int i = 0; + for (; i < nwiimotes; ++i) + { + switch (wiimotes[i]->event) + { + case WIIUSE_NONE: + break; + default: + /* this could be: WIIUSE_EVENT, WIIUSE_STATUS, WIIUSE_CONNECT, etc.. */ + s.uid = wiimotes[i]->unid; + s.leds = wiimotes[i]->leds; + s.battery_level = wiimotes[i]->battery_level; + s.accel = wiimotes[i]->accel; + s.orient = wiimotes[i]->orient; + s.gforce = wiimotes[i]->gforce; + s.ir = wiimotes[i]->ir; + s.buttons = wiimotes[i]->btns; + s.buttons_held = wiimotes[i]->btns_held; + s.buttons_released = wiimotes[i]->btns_released; + s.event = wiimotes[i]->event; + s.state = wiimotes[i]->state; + s.expansion = wiimotes[i]->exp; + callback(&s); + evnt++; + break; + } + } + } + return evnt; +} + +/** + * @brief Called on a cycle where no significant change occurs. + * + * @param wm Pointer to a wiimote_t structure. + */ +void idle_cycle(struct wiimote_t *wm) +{ + /* + * Smooth the angles. + * + * This is done to make sure that on every cycle the orientation + * angles are smoothed. Normally when an event occurs the angles + * are updated and smoothed, but if no packet comes in then the + * angles remain the same. This means the angle wiiuse reports + * is still an old value. Smoothing needs to be applied in this + * case in order for the angle it reports to converge to the true + * angle of the device. + */ + if (WIIUSE_USING_ACC(wm) && WIIMOTE_IS_FLAG_SET(wm, WIIUSE_SMOOTHING)) + { + apply_smoothing(&wm->accel_calib, &wm->orient, SMOOTH_ROLL); + apply_smoothing(&wm->accel_calib, &wm->orient, SMOOTH_PITCH); + } + + /* clear out any old read requests */ + clear_dirty_reads(wm); +} + +/** + * @brief Clear out all old 'dirty' read requests. + * + * @param wm Pointer to a wiimote_t structure. + */ +void clear_dirty_reads(struct wiimote_t *wm) +{ + struct read_req_t *req = wm->read_req; + + while (req && req->dirty) + { + WIIUSE_DEBUG("Cleared old read request for address: %x", req->addr); + + wm->read_req = req->next; + free(req); + req = wm->read_req; + } +} + +/** + * @brief Handle accel data in a wiimote message. + * + * @param wm Pointer to a wiimote_t structure. + * @param msg The message specified in the event packet. + */ +static void handle_wm_accel(struct wiimote_t *wm, byte *msg) +{ + wm->accel.x = msg[2]; + wm->accel.y = msg[3]; + wm->accel.z = msg[4]; + + /* calculate the remote orientation */ + calculate_orientation(&wm->accel_calib, &wm->accel, &wm->orient, + WIIMOTE_IS_FLAG_SET(wm, WIIUSE_SMOOTHING)); + + /* calculate the gforces on each axis */ + calculate_gforce(&wm->accel_calib, &wm->accel, &wm->gforce); +} + +/** + * @brief Analyze the event that occurred on a wiimote. + * + * @param wm Pointer to a wiimote_t structure. + * @param event The event that occurred. + * @param msg The message specified in the event packet. + * + * Pass the event to the registered event callback. + */ +void propagate_event(struct wiimote_t *wm, byte event, byte *msg) +{ + save_state(wm); + + switch (event) + { + case WM_RPT_BTN: + { + /* button */ + wiiuse_pressed_buttons(wm, msg); + break; + } + case WM_RPT_BTN_ACC: + { + /* button - motion */ + wiiuse_pressed_buttons(wm, msg); + + handle_wm_accel(wm, msg); + + break; + } + case WM_RPT_READ: + { + /* data read */ + event_data_read(wm, msg); + + /* yeah buttons may be pressed, but this wasn't an "event" */ + return; + } + case WM_RPT_CTRL_STATUS: + { + /* controller status */ + event_status(wm, msg); + + /* don't execute the event callback */ + return; + } + case WM_RPT_BTN_EXP_8: + case WM_RPT_BTN_EXP: + { + /* button - expansion */ + wiiuse_pressed_buttons(wm, msg); + handle_expansion(wm, msg + 2); + + break; + } + case WM_RPT_BTN_ACC_EXP: + { + /* button - motion - expansion */ + wiiuse_pressed_buttons(wm, msg); + + handle_wm_accel(wm, msg); + + handle_expansion(wm, msg + 5); + + break; + } + case WM_RPT_BTN_ACC_IR: + { + /* button - motion - ir */ + wiiuse_pressed_buttons(wm, msg); + + handle_wm_accel(wm, msg); + + /* ir */ + calculate_extended_ir(wm, msg + 5); + + break; + } + case WM_RPT_BTN_IR_EXP: + { + /* button - ir - expansion */ + wiiuse_pressed_buttons(wm, msg); + handle_expansion(wm, msg + 12); + + /* ir */ + calculate_basic_ir(wm, msg + 2); + + break; + } + case WM_RPT_BTN_ACC_IR_EXP: + { + /* button - motion - ir - expansion */ + wiiuse_pressed_buttons(wm, msg); + + handle_wm_accel(wm, msg); + + handle_expansion(wm, msg + 15); + + /* ir */ + calculate_basic_ir(wm, msg + 5); + + break; + } + + /* + * FIXME: this gets triggered only when the Wiimote sends 0x22 + * Acknowledge output report, return function result. This is unfortunately sent only + * rarely, typically when there is an error (e.g. reading from an invalid address) and + * *must not* be relied on to call the write callbacks. The report can also appear unsolicited + * during synchronous handshake, where it would produce spurious error messages. That's why + * it is disabled. + */ + case WM_RPT_WRITE: + { + /* event_data_write(wm, msg); */ + break; + } + default: + { + WIIUSE_WARNING("Unknown event, can not handle it [Code 0x%x].", event); + return; + } + } + + /* was there an event? */ + if (state_changed(wm)) + { + wm->event = WIIUSE_EVENT; + } +} + +/** + * @brief Find what buttons are pressed. + * + * @param wm Pointer to a wiimote_t structure. + * @param msg The message specified in the event packet. + */ +void wiiuse_pressed_buttons(struct wiimote_t *wm, byte *msg) +{ + int16_t now; + + /* convert from big endian */ + now = from_big_endian_uint16_t(msg) & WIIMOTE_BUTTON_ALL; + + /* pressed now & were pressed, then held */ + wm->btns_held = (now & wm->btns); + + /* were pressed or were held & not pressed now, then released */ + wm->btns_released = ((wm->btns | wm->btns_held) & ~now); + + /* buttons pressed now */ + wm->btns = now; +} + +/** + * @brief Received a data packet from a read request. + * + * @param wm Pointer to a wiimote_t structure. + * @param msg The message specified in the event packet. + * + * Data from the wiimote comes in packets. If the requested + * data segment size is bigger than one packet can hold then + * several packets will be received. These packets are first + * reassembled into one, then the registered callback function + * that handles data reads is invoked. + */ +static void event_data_read(struct wiimote_t *wm, byte *msg) +{ + /* we must always assume the packet received is from the most recent request */ + byte err; + byte len; + uint16_t offset; + struct read_req_t *req = wm->read_req; + + wiiuse_pressed_buttons(wm, msg); + + /* find the next non-dirty request */ + while (req && req->dirty) + { + req = req->next; + } + + /* if we don't have a request out then we didn't ask for this packet */ + if (!req) + { + WIIUSE_WARNING("Received data packet when no request was made."); + return; + } + + err = msg[2] & 0x0F; + + if (err == 0x08) + { + WIIUSE_WARNING("Unable to read data - address does not exist."); + } else if (err == 0x07) + { + WIIUSE_WARNING("Unable to read data - address is for write-only registers."); + } else if (err) + { + WIIUSE_WARNING("Unable to read data - unknown error code %x.", err); + } + + if (err) + { + /* this request errored out, so skip it and go to the next one */ + + /* delete this request */ + wm->read_req = req->next; + free(req); + + /* if another request exists send it to the wiimote */ + if (wm->read_req) + { + wiiuse_send_next_pending_read_request(wm); + } + + return; + } + + len = ((msg[2] & 0xF0) >> 4) + 1; + offset = from_big_endian_uint16_t(msg + 3); + req->addr = (req->addr & 0xFFFF); + + req->wait -= len; + if (req->wait >= req->size) + /* this should never happen */ + { + req->wait = 0; + } + + WIIUSE_DEBUG("Received read packet:"); + WIIUSE_DEBUG(" Packet read offset: %i bytes", offset); + WIIUSE_DEBUG(" Request read offset: %i bytes", req->addr); + WIIUSE_DEBUG(" Read offset into buf: %i bytes", offset - req->addr); + WIIUSE_DEBUG(" Read data size: %i bytes", len); + WIIUSE_DEBUG(" Still need: %i bytes", req->wait); + + /* reconstruct this part of the data */ + memcpy((req->buf + offset - req->addr), (msg + 5), len); + +#ifdef WITH_WIIUSE_DEBUG + { + int i = 0; + printf("Read: "); + for (; i < req->size - req->wait; ++i) + { + printf("%x ", req->buf[i]); + } + printf("\n"); + } +#endif + + /* if all data has been received, execute the read event callback or generate event */ + if (!req->wait) + { + if (req->cb) + { + /* this was a callback, so invoke it now */ + req->cb(wm, req->buf, req->size); + + /* delete this request */ + wm->read_req = req->next; + free(req); + } else + { + /* + * This should generate an event. + * We need to leave the event in the array so the client + * can access it still. We'll flag is as being 'dirty' + * and give the client one cycle to use it. Next event + * we will remove it from the list. + */ + wm->event = WIIUSE_READ_DATA; + req->dirty = 1; + } + + /* if another request exists send it to the wiimote */ + if (wm->read_req) + { + wiiuse_send_next_pending_read_request(wm); + } + } +} + +static void event_data_write(struct wiimote_t *wm, byte *msg) +{ + + struct data_req_t *req = wm->data_req; + + wiiuse_pressed_buttons(wm, msg); + + /* if we don't have a request out then we didn't ask for this packet */ + if (!req) + { + WIIUSE_WARNING("Transmitting data packet when no request was made."); + return; + } + if (!(req->state == REQ_SENT)) + { + WIIUSE_WARNING("Transmission is not necessary"); + /* delete this request */ + wm->data_req = req->next; + free(req); + return; + } + + req->state = REQ_DONE; + + if (req->cb) + { + /* this was a callback, so invoke it now */ + req->cb(wm, NULL, 0); + /* delete this request */ + wm->data_req = req->next; + free(req); + } else + { + /* + * This should generate an event. + * We need to leave the event in the array so the client + * can access it still. We'll flag is as being 'REQ_DONE' + * and give the client one cycle to use it. Next event + * we will remove it from the list. + */ + wm->event = WIIUSE_WRITE_DATA; + } + /* if another request exists send it to the wiimote */ + if (wm->data_req) + { + wiiuse_send_next_pending_write_request(wm); + } +} + +/** + * @brief Read the controller status. + * + * @param wm Pointer to a wiimote_t structure. + * @param msg The message specified in the event packet. + * + * Read the controller status and execute the registered status callback. + */ +static void event_status(struct wiimote_t *wm, byte *msg) +{ + int led[4] = {0, 0, 0, 0}; + int attachment = 0; + int ir = 0; + int exp_changed = 0; + struct data_req_t *req = wm->data_req; + + /* initial handshake is not finished yet, ignore this */ + if (WIIMOTE_IS_SET(wm, WIIMOTE_STATE_HANDSHAKE) || !msg) + { + return; + } + + /* + * An event occurred. + * This event can be overwritten by a more specific + * event type during a handshake or expansion removal. + */ + wm->event = WIIUSE_STATUS; + + wiiuse_pressed_buttons(wm, msg); + + /* find what LEDs are lit */ + if (msg[2] & WM_CTRL_STATUS_BYTE1_LED_1) + { + led[0] = 1; + } + if (msg[2] & WM_CTRL_STATUS_BYTE1_LED_2) + { + led[1] = 1; + } + if (msg[2] & WM_CTRL_STATUS_BYTE1_LED_3) + { + led[2] = 1; + } + if (msg[2] & WM_CTRL_STATUS_BYTE1_LED_4) + { + led[3] = 1; + } + + /* probe for Motion+ */ + if (!WIIMOTE_IS_SET(wm, WIIMOTE_STATE_MPLUS_PRESENT)) + { + wiiuse_probe_motion_plus(wm); + } + + /* is an attachment connected to the expansion port? */ + if ((msg[2] & WM_CTRL_STATUS_BYTE1_ATTACHMENT) == WM_CTRL_STATUS_BYTE1_ATTACHMENT) + { + WIIUSE_DEBUG("Attachment detected!"); + attachment = 1; + } + + /* is the speaker enabled? */ + if ((msg[2] & WM_CTRL_STATUS_BYTE1_SPEAKER_ENABLED) == WM_CTRL_STATUS_BYTE1_SPEAKER_ENABLED) + { + WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_SPEAKER); + } + + /* is IR sensing enabled? */ + if ((msg[2] & WM_CTRL_STATUS_BYTE1_IR_ENABLED) == WM_CTRL_STATUS_BYTE1_IR_ENABLED) + { + ir = 1; + } + + /* find the battery level and normalize between 0 and 1 */ + wm->battery_level = (msg[5] / (float)WM_MAX_BATTERY_CODE); + + /* expansion port */ + if (attachment && !WIIMOTE_IS_SET(wm, WIIMOTE_STATE_EXP) + && !WIIMOTE_IS_SET(wm, WIIMOTE_STATE_EXP_HANDSHAKE)) + { + /* send the initialization code for the attachment */ + handshake_expansion(wm, NULL, 0); + exp_changed = 1; + } else if (!attachment && WIIMOTE_IS_SET(wm, WIIMOTE_STATE_EXP)) + { + /* attachment removed */ + disable_expansion(wm); + exp_changed = 1; + } + +#ifdef WIIUSE_WIN32 + if (!attachment) + { + WIIUSE_DEBUG("Setting timeout to normal %i ms.", wm->normal_timeout); + wm->timeout = wm->normal_timeout; + } +#endif + + /* + * From now on the remote will only send status packets. + * We need to send a WIIMOTE_CMD_REPORT_TYPE packet to + * reenable other incoming reports. + */ + if (exp_changed) + { + if (WIIMOTE_IS_SET(wm, WIIMOTE_STATE_IR)) + { + /* + * Since the expansion status changed IR needs to + * be reset for the new IR report mode. + */ + WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_IR); + wiiuse_set_ir(wm, 1); + } + } else + { + wiiuse_set_report_type(wm); + return; + } + + /* handling new Tx for changed exp */ + if (!req) + { + return; + } + if (!(req->state == REQ_SENT)) + { + return; + } + wm->data_req = req->next; + req->state = REQ_DONE; + /* if(req->cb!=NULL) req->cb(wm,msg,6); */ + free(req); +} + +/** + * @brief Handle data from the expansion. + * + * @param wm A pointer to a wiimote_t structure. + * @param msg The message specified in the event packet for the expansion. + */ +static void handle_expansion(struct wiimote_t *wm, byte *msg) +{ + switch (wm->exp.type) + { + case EXP_NUNCHUK: + nunchuk_event(&wm->exp.nunchuk, msg); + break; + case EXP_CLASSIC: + classic_ctrl_event(&wm->exp.classic, msg); + break; + case EXP_GUITAR_HERO_3: + guitar_hero_3_event(&wm->exp.gh3, msg); + break; + case EXP_WII_BOARD: + wii_board_event(&wm->exp.wb, msg); + break; + case EXP_MOTION_PLUS: + case EXP_MOTION_PLUS_CLASSIC: + case EXP_MOTION_PLUS_NUNCHUK: + motion_plus_event(&wm->exp.mp, wm->exp.type, msg); + break; + default: + break; + } +} + +/** + * @brief Handle the handshake data from the expansion device. + * + * @param wm A pointer to a wiimote_t structure. + * @param data The data read in from the device. + * @param len The length of the data block, in bytes. + * + * Tries to determine what kind of expansion was attached + * and invoke the correct handshake function. + * + * If the data is NULL then this function will try to start + * a handshake with the expansion. + */ +void handshake_expansion(struct wiimote_t *wm, byte *data, uint16_t len) +{ + uint32_t id; + byte val = 0; + byte buf = 0x00; + byte *handshake_buf; + int gotIt = 0; + + int attempt = 0; + int init_good = 0; + + /* + * KLUDGE + * Sometimes we get the expansion in "half-connected" state + * with an ID like 0xffffffff and invalid data - in such case retry, + * hoping that it will sort itself out + */ + + while (attempt < 10 && !init_good) + { + /* + * phase 1 - write 0x55 0x00 to init expansion without encryption + */ + + wm->expansion_state = 1; +#ifdef WIIUSE_WIN32 + /* increase the timeout until the handshake completes */ + WIIUSE_DEBUG("write 0x55 - Setting timeout to expansion %i ms.", wm->exp_timeout); + wm->timeout = wm->exp_timeout; +#endif + buf = 0x55; + wiiuse_write_data(wm, WM_EXP_MEM_ENABLE1, &buf, 1); + +#ifdef WIIUSE_WIN32 + /* increase the timeout until the handshake completes */ + WIIUSE_DEBUG("write 0x00 - Setting timeout to expansion %i ms.", wm->exp_timeout); + wm->timeout = wm->exp_timeout; +#endif + buf = 0x00; + wiiuse_write_data(wm, WM_EXP_MEM_ENABLE2, &buf, 1); + wiiuse_millisleep( + 500); /* delay to let the wiimote time to react, makes the handshake more reliable */ + + /* + * phase 2 - get expansion ID & calibration data + */ + wm->expansion_state = 2; + if (WIIMOTE_IS_SET(wm, WIIMOTE_STATE_EXP)) + disable_expansion(wm); + + handshake_buf = (byte *)malloc(EXP_HANDSHAKE_LEN * sizeof(byte)); + /* tell the wiimote to send expansion data */ + WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_EXP); + wiiuse_read_data_sync(wm, 0, WM_EXP_MEM_CALIBR, EXP_HANDSHAKE_LEN, handshake_buf); + + id = from_big_endian_uint32_t(handshake_buf + 220); + + /* + * Check whether we have detected expansion, sometimes we get the expansion in "half-connected" state + * with an ID like 0xffffffff and invalid data - in such case retry + */ + + if (id != 0xffffffff && id != 0x0) + { + init_good = 1; + } + + attempt++; + + wiiuse_millisleep(500); + } + + /* + * phase 3 - process the data, init the expansions + */ + wm->expansion_state = 0; + switch (id) + { + case EXP_ID_CODE_NUNCHUK: + if (nunchuk_handshake(wm, &wm->exp.nunchuk, handshake_buf, EXP_HANDSHAKE_LEN)) + { + wm->event = WIIUSE_NUNCHUK_INSERTED; + gotIt = 1; + } + break; + + case EXP_ID_CODE_CLASSIC_CONTROLLER: + if (classic_ctrl_handshake(wm, &wm->exp.classic, handshake_buf, EXP_HANDSHAKE_LEN)) + { + wm->event = WIIUSE_CLASSIC_CTRL_INSERTED; + gotIt = 1; + } + break; + + case EXP_ID_CODE_GUITAR: + if (guitar_hero_3_handshake(wm, &wm->exp.gh3, handshake_buf, EXP_HANDSHAKE_LEN)) + { + wm->event = WIIUSE_GUITAR_HERO_3_CTRL_INSERTED; + gotIt = 1; + } + break; + + case EXP_ID_CODE_MOTION_PLUS: + case EXP_ID_CODE_MOTION_PLUS_CLASSIC: + case EXP_ID_CODE_MOTION_PLUS_NUNCHUK: + wiiuse_motion_plus_handshake(wm, handshake_buf, EXP_HANDSHAKE_LEN); + wm->event = WIIUSE_MOTION_PLUS_ACTIVATED; + gotIt = 1; + break; + + case EXP_ID_CODE_WII_BOARD: + if (wii_board_handshake(wm, &wm->exp.wb, handshake_buf, EXP_HANDSHAKE_LEN)) + { + wm->event = WIIUSE_WII_BOARD_CTRL_INSERTED; + gotIt = 1; + } + break; + + default: + WIIUSE_WARNING("Unknown expansion type. Code: 0x%x", id); + break; + } + + free(handshake_buf); + + if (gotIt) + { + WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_EXP_HANDSHAKE); + WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_EXP); + } else + { + WIIUSE_WARNING("Could not handshake with expansion id: 0x%x", id); + } + + wiiuse_set_ir_mode(wm); + wiiuse_set_report_type(wm); +} + +/** + * @brief Disable the expansion device if it was enabled. + * + * @param wm A pointer to a wiimote_t structure. + * @param data The data read in from the device. + * @param len The length of the data block, in bytes. + * + * If the data is NULL then this function will try to start + * a handshake with the expansion. + */ +void disable_expansion(struct wiimote_t *wm) +{ + WIIUSE_DEBUG("Disabling expansion"); + if (!WIIMOTE_IS_SET(wm, WIIMOTE_STATE_EXP)) + { + return; + } + + /* tell the associated module the expansion was removed */ + switch (wm->exp.type) + { + case EXP_NUNCHUK: + nunchuk_disconnected(&wm->exp.nunchuk); + wm->event = WIIUSE_NUNCHUK_REMOVED; + break; + case EXP_CLASSIC: + classic_ctrl_disconnected(&wm->exp.classic); + wm->event = WIIUSE_CLASSIC_CTRL_REMOVED; + break; + case EXP_GUITAR_HERO_3: + guitar_hero_3_disconnected(&wm->exp.gh3); + wm->event = WIIUSE_GUITAR_HERO_3_CTRL_REMOVED; + break; + case EXP_WII_BOARD: + wii_board_disconnected(&wm->exp.wb); + wm->event = WIIUSE_WII_BOARD_CTRL_REMOVED; + break; + case EXP_MOTION_PLUS: + case EXP_MOTION_PLUS_CLASSIC: + case EXP_MOTION_PLUS_NUNCHUK: + motion_plus_disconnected(&wm->exp.mp); + wm->event = WIIUSE_MOTION_PLUS_REMOVED; + break; + default: + break; + } + + WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_EXP); + wm->exp.type = EXP_NONE; + wm->expansion_state = 0; +} + +/** + * @brief Save important state data. + * @param wm A pointer to a wiimote_t structure. + */ +static void save_state(struct wiimote_t *wm) +{ + /* wiimote */ + wm->lstate.btns = wm->btns; + wm->lstate.accel = wm->accel; + + /* ir */ + if (WIIUSE_USING_IR(wm)) + { + wm->lstate.ir_ax = wm->ir.ax; + wm->lstate.ir_ay = wm->ir.ay; + wm->lstate.ir_distance = wm->ir.distance; + } + + /* expansion */ + switch (wm->exp.type) + { + case EXP_NUNCHUK: + wm->lstate.exp_ljs_ang = wm->exp.nunchuk.js.ang; + wm->lstate.exp_ljs_mag = wm->exp.nunchuk.js.mag; + wm->lstate.exp_btns = wm->exp.nunchuk.btns; + wm->lstate.exp_accel = wm->exp.nunchuk.accel; + break; + + case EXP_CLASSIC: + wm->lstate.exp_ljs_ang = wm->exp.classic.ljs.ang; + wm->lstate.exp_ljs_mag = wm->exp.classic.ljs.mag; + wm->lstate.exp_rjs_ang = wm->exp.classic.rjs.ang; + wm->lstate.exp_rjs_mag = wm->exp.classic.rjs.mag; + wm->lstate.exp_r_shoulder = wm->exp.classic.r_shoulder; + wm->lstate.exp_l_shoulder = wm->exp.classic.l_shoulder; + wm->lstate.exp_btns = wm->exp.classic.btns; + break; + + case EXP_GUITAR_HERO_3: + wm->lstate.exp_ljs_ang = wm->exp.gh3.js.ang; + wm->lstate.exp_ljs_mag = wm->exp.gh3.js.mag; + wm->lstate.exp_r_shoulder = wm->exp.gh3.whammy_bar; + wm->lstate.exp_btns = wm->exp.gh3.btns; + break; + + case EXP_WII_BOARD: + wm->lstate.exp_wb_rtr = wm->exp.wb.rtr; + wm->lstate.exp_wb_rtl = wm->exp.wb.rtl; + wm->lstate.exp_wb_rbr = wm->exp.wb.rbr; + wm->lstate.exp_wb_rbl = wm->exp.wb.rbl; + break; + + case EXP_MOTION_PLUS: + case EXP_MOTION_PLUS_CLASSIC: + case EXP_MOTION_PLUS_NUNCHUK: + { + wm->lstate.drx = wm->exp.mp.raw_gyro.pitch; + wm->lstate.dry = wm->exp.mp.raw_gyro.roll; + wm->lstate.drz = wm->exp.mp.raw_gyro.yaw; + + if (wm->exp.type == EXP_MOTION_PLUS_CLASSIC) + { + wm->lstate.exp_ljs_ang = wm->exp.classic.ljs.ang; + wm->lstate.exp_ljs_mag = wm->exp.classic.ljs.mag; + wm->lstate.exp_rjs_ang = wm->exp.classic.rjs.ang; + wm->lstate.exp_rjs_mag = wm->exp.classic.rjs.mag; + wm->lstate.exp_r_shoulder = wm->exp.classic.r_shoulder; + wm->lstate.exp_l_shoulder = wm->exp.classic.l_shoulder; + wm->lstate.exp_btns = wm->exp.classic.btns; + } else + { + wm->lstate.exp_ljs_ang = wm->exp.nunchuk.js.ang; + wm->lstate.exp_ljs_mag = wm->exp.nunchuk.js.mag; + wm->lstate.exp_btns = wm->exp.nunchuk.btns; + wm->lstate.exp_accel = wm->exp.nunchuk.accel; + } + + break; + } + + case EXP_NONE: + break; + } +} + +/** + * @brief Determine if the current state differs significantly from the previous. + * @param wm A pointer to a wiimote_t structure. + * @return 1 if a significant change occurred, 0 if not. + */ +static int state_changed(struct wiimote_t *wm) +{ +#define STATE_CHANGED(a, b) \ + if (a != b) \ + return 1 + +#define CROSS_THRESH(last, now, thresh) \ + do \ + { \ + if (WIIMOTE_IS_FLAG_SET(wm, WIIUSE_ORIENT_THRESH)) \ + { \ + if ((diff_f(last.roll, now.roll) >= thresh) || (diff_f(last.pitch, now.pitch) >= thresh) \ + || (diff_f(last.yaw, now.yaw) >= thresh)) \ + { \ + last = now; \ + return 1; \ + } \ + } else \ + { \ + if (last.roll != now.roll) \ + return 1; \ + if (last.pitch != now.pitch) \ + return 1; \ + if (last.yaw != now.yaw) \ + return 1; \ + } \ + } while (0) + +#define CROSS_THRESH_XYZ(last, now, thresh) \ + do \ + { \ + if (WIIMOTE_IS_FLAG_SET(wm, WIIUSE_ORIENT_THRESH)) \ + { \ + if ((diff_f(last.x, now.x) >= thresh) || (diff_f(last.y, now.y) >= thresh) \ + || (diff_f(last.z, now.z) >= thresh)) \ + { \ + last = now; \ + return 1; \ + } \ + } else \ + { \ + if (last.x != now.x) \ + return 1; \ + if (last.y != now.y) \ + return 1; \ + if (last.z != now.z) \ + return 1; \ + } \ + } while (0) + + /* ir */ + if (WIIUSE_USING_IR(wm)) + { + STATE_CHANGED(wm->lstate.ir_ax, wm->ir.ax); + STATE_CHANGED(wm->lstate.ir_ay, wm->ir.ay); + STATE_CHANGED(wm->lstate.ir_distance, wm->ir.distance); + } + + /* accelerometer */ + if (WIIUSE_USING_ACC(wm)) + { + /* raw accelerometer */ + CROSS_THRESH_XYZ(wm->lstate.accel, wm->accel, wm->accel_threshold); + + /* orientation */ + CROSS_THRESH(wm->lstate.orient, wm->orient, wm->orient_threshold); + } + + /* expansion */ + switch (wm->exp.type) + { + case EXP_NUNCHUK: + { + STATE_CHANGED(wm->lstate.exp_ljs_ang, wm->exp.nunchuk.js.ang); + STATE_CHANGED(wm->lstate.exp_ljs_mag, wm->exp.nunchuk.js.mag); + STATE_CHANGED(wm->lstate.exp_btns, wm->exp.nunchuk.btns); + + CROSS_THRESH(wm->lstate.exp_orient, wm->exp.nunchuk.orient, wm->exp.nunchuk.orient_threshold); + CROSS_THRESH_XYZ(wm->lstate.exp_accel, wm->exp.nunchuk.accel, wm->exp.nunchuk.accel_threshold); + break; + } + case EXP_CLASSIC: + { + STATE_CHANGED(wm->lstate.exp_ljs_ang, wm->exp.classic.ljs.ang); + STATE_CHANGED(wm->lstate.exp_ljs_mag, wm->exp.classic.ljs.mag); + STATE_CHANGED(wm->lstate.exp_rjs_ang, wm->exp.classic.rjs.ang); + STATE_CHANGED(wm->lstate.exp_rjs_mag, wm->exp.classic.rjs.mag); + STATE_CHANGED(wm->lstate.exp_r_shoulder, wm->exp.classic.r_shoulder); + STATE_CHANGED(wm->lstate.exp_l_shoulder, wm->exp.classic.l_shoulder); + STATE_CHANGED(wm->lstate.exp_btns, wm->exp.classic.btns); + break; + } + case EXP_GUITAR_HERO_3: + { + STATE_CHANGED(wm->lstate.exp_ljs_ang, wm->exp.gh3.js.ang); + STATE_CHANGED(wm->lstate.exp_ljs_mag, wm->exp.gh3.js.mag); + STATE_CHANGED(wm->lstate.exp_r_shoulder, wm->exp.gh3.whammy_bar); + STATE_CHANGED(wm->lstate.exp_btns, wm->exp.gh3.btns); + break; + } + case EXP_WII_BOARD: + { + STATE_CHANGED(wm->lstate.exp_wb_rtr, wm->exp.wb.tr); + STATE_CHANGED(wm->lstate.exp_wb_rtl, wm->exp.wb.tl); + STATE_CHANGED(wm->lstate.exp_wb_rbr, wm->exp.wb.br); + STATE_CHANGED(wm->lstate.exp_wb_rbl, wm->exp.wb.bl); + break; + } + + case EXP_MOTION_PLUS: + case EXP_MOTION_PLUS_CLASSIC: + case EXP_MOTION_PLUS_NUNCHUK: + { + STATE_CHANGED(wm->lstate.drx, wm->exp.mp.raw_gyro.pitch); + STATE_CHANGED(wm->lstate.dry, wm->exp.mp.raw_gyro.roll); + STATE_CHANGED(wm->lstate.drz, wm->exp.mp.raw_gyro.yaw); + + if (wm->exp.type == EXP_MOTION_PLUS_CLASSIC) + { + STATE_CHANGED(wm->lstate.exp_ljs_ang, wm->exp.classic.ljs.ang); + STATE_CHANGED(wm->lstate.exp_ljs_mag, wm->exp.classic.ljs.mag); + STATE_CHANGED(wm->lstate.exp_rjs_ang, wm->exp.classic.rjs.ang); + STATE_CHANGED(wm->lstate.exp_rjs_mag, wm->exp.classic.rjs.mag); + STATE_CHANGED(wm->lstate.exp_r_shoulder, wm->exp.classic.r_shoulder); + STATE_CHANGED(wm->lstate.exp_l_shoulder, wm->exp.classic.l_shoulder); + STATE_CHANGED(wm->lstate.exp_btns, wm->exp.classic.btns); + } else + { + STATE_CHANGED(wm->lstate.exp_ljs_ang, wm->exp.nunchuk.js.ang); + STATE_CHANGED(wm->lstate.exp_ljs_mag, wm->exp.nunchuk.js.mag); + STATE_CHANGED(wm->lstate.exp_btns, wm->exp.nunchuk.btns); + + CROSS_THRESH(wm->lstate.exp_orient, wm->exp.nunchuk.orient, wm->exp.nunchuk.orient_threshold); + CROSS_THRESH_XYZ(wm->lstate.exp_accel, wm->exp.nunchuk.accel, wm->exp.nunchuk.accel_threshold); + } + + break; + } + case EXP_NONE: + { + break; + } + } + + STATE_CHANGED(wm->lstate.btns, wm->btns); + + return 0; +} diff --git a/lib/wiiuse/events.h b/lib/wiiuse/src/events.h similarity index 68% rename from lib/wiiuse/events.h rename to lib/wiiuse/src/events.h index 9300193e9..504803f52 100644 --- a/lib/wiiuse/events.h +++ b/lib/wiiuse/src/events.h @@ -37,28 +37,19 @@ #ifndef EVENTS_H_INCLUDED #define EVENTS_H_INCLUDED -#if defined(_MSC_VER) -/* MS compilers of pre-VC2010 versions don't have stdint.h - * and I can't get VC2010's stdint.h to compile nicely in - * WiiUse - */ - #include "wiiuse_msvcstdint.h" -#else - #include -#endif - +#include "wiiuse.h" /** @defgroup internal_events Internal: Event Utilities */ /** @{ */ -void wiiuse_pressed_buttons(struct wiimote_t* wm, byte* msg); +void wiiuse_pressed_buttons(struct wiimote_t *wm, byte *msg); -void handshake_expansion(struct wiimote_t* wm, byte* data, uint16_t len); -void disable_expansion(struct wiimote_t* wm); +void handshake_expansion(struct wiimote_t *wm, byte *data, uint16_t len); +void disable_expansion(struct wiimote_t *wm); -void propagate_event(struct wiimote_t* wm, byte event, byte* msg); -void idle_cycle(struct wiimote_t* wm); +void propagate_event(struct wiimote_t *wm, byte event, byte *msg); +void idle_cycle(struct wiimote_t *wm); -void clear_dirty_reads(struct wiimote_t* wm); +void clear_dirty_reads(struct wiimote_t *wm); /** @} */ #endif /* EVENTS_H_INCLUDED */ diff --git a/lib/wiiuse/src/guitar_hero_3.c b/lib/wiiuse/src/guitar_hero_3.c new file mode 100644 index 000000000..ae5bd40d0 --- /dev/null +++ b/lib/wiiuse/src/guitar_hero_3.c @@ -0,0 +1,164 @@ +/* + * wiiuse + * + * Written By: + * Michael Laforest < para > + * Email: < thepara (--AT--) g m a i l [--DOT--] com > + * + * Copyright 2006-2007 + * + * This file is part of wiiuse. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * $Header$ + * + */ + +/** + * @file + * @brief Guitar Hero 3 expansion device. + */ + +#include "guitar_hero_3.h" + +#include "dynamics.h" /* for calc_joystick_state */ +#include "events.h" /* for handshake_expansion */ + +#include /* for malloc */ +#include /* for memset */ + +static void guitar_hero_3_pressed_buttons(struct guitar_hero_3_t *gh3, short now); + +/** + * @brief Handle the handshake data from the guitar. + * + * @param cc A pointer to a classic_ctrl_t structure. + * @param data The data read in from the device. + * @param len The length of the data block, in bytes. + * + * @return Returns 1 if handshake was successful, 0 if not. + */ +int guitar_hero_3_handshake(struct wiimote_t *wm, struct guitar_hero_3_t *gh3, byte *data, unsigned short len) +{ + + /* + * The good fellows that made the Guitar Hero 3 controller + * failed to factory calibrate the devices. There is no + * calibration data on the device. + */ + + gh3->btns = 0; + gh3->btns_held = 0; + gh3->btns_released = 0; + gh3->whammy_bar = 0.0f; + + /* + TODO: If we're not using anything from calibration data, why are we + even bothering here? + */ + if (data[0] == 0xFF) + { + /* + * Sometimes the data returned here is not correct. + * This might happen because the wiimote is lagging + * behind our initialization sequence. + * To fix this just request the handshake again. + * + * Other times it's just the first 16 bytes are 0xFF, + * but since the next 16 bytes are the same, just use + * those. + */ + if (data[16] == 0xFF) + { + /* get the calibration data */ + byte *handshake_buf = (byte *)malloc(EXP_HANDSHAKE_LEN * sizeof(byte)); + + WIIUSE_DEBUG("Guitar Hero 3 handshake appears invalid, trying again."); + wiiuse_read_data_cb(wm, handshake_expansion, handshake_buf, WM_EXP_MEM_CALIBR, EXP_HANDSHAKE_LEN); + + return 0; + } else + { + data += 16; + } + } + + /* joystick stuff */ + gh3->js.max.x = GUITAR_HERO_3_JS_MAX_X; + gh3->js.min.x = GUITAR_HERO_3_JS_MIN_X; + gh3->js.center.x = GUITAR_HERO_3_JS_CENTER_X; + gh3->js.max.y = GUITAR_HERO_3_JS_MAX_Y; + gh3->js.min.y = GUITAR_HERO_3_JS_MIN_Y; + gh3->js.center.y = GUITAR_HERO_3_JS_CENTER_Y; + + /* handshake done */ + wm->exp.type = EXP_GUITAR_HERO_3; + +#ifdef WIIUSE_WIN32 + wm->timeout = WIIMOTE_DEFAULT_TIMEOUT; +#endif + + return 1; +} + +/** + * @brief The guitar disconnected. + * + * @param cc A pointer to a classic_ctrl_t structure. + */ +void guitar_hero_3_disconnected(struct guitar_hero_3_t *gh3) +{ + memset(gh3, 0, sizeof(struct guitar_hero_3_t)); +} + +/** + * @brief Handle guitar event. + * + * @param cc A pointer to a classic_ctrl_t structure. + * @param msg The message specified in the event packet. + */ +void guitar_hero_3_event(struct guitar_hero_3_t *gh3, byte *msg) +{ + + guitar_hero_3_pressed_buttons(gh3, from_big_endian_uint16_t(msg + 4)); + + /* whammy bar */ + gh3->whammy_bar = (msg[3] - GUITAR_HERO_3_WHAMMY_BAR_MIN) + / (float)(GUITAR_HERO_3_WHAMMY_BAR_MAX - GUITAR_HERO_3_WHAMMY_BAR_MIN); + + /* joy stick */ + calc_joystick_state(&gh3->js, msg[0], msg[1]); +} + +/** + * @brief Find what buttons are pressed. + * + * @param cc A pointer to a classic_ctrl_t structure. + * @param msg The message byte specified in the event packet. + */ +static void guitar_hero_3_pressed_buttons(struct guitar_hero_3_t *gh3, short now) +{ + /* message is inverted (0 is active, 1 is inactive) */ + now = ~now & GUITAR_HERO_3_BUTTON_ALL; + + /* pressed now & were pressed, then held */ + gh3->btns_held = (now & gh3->btns); + + /* were pressed or were held & not pressed now, then released */ + gh3->btns_released = ((gh3->btns | gh3->btns_held) & ~now); + + /* buttons pressed now */ + gh3->btns = now; +} diff --git a/lib/wiiuse/guitar_hero_3.h b/lib/wiiuse/src/guitar_hero_3.h similarity index 62% rename from lib/wiiuse/guitar_hero_3.h rename to lib/wiiuse/src/guitar_hero_3.h index b8ffa0703..86a5fcda2 100644 --- a/lib/wiiuse/guitar_hero_3.h +++ b/lib/wiiuse/src/guitar_hero_3.h @@ -36,28 +36,28 @@ #include "wiiuse_internal.h" -#define GUITAR_HERO_3_JS_MIN_X 0xC5 -#define GUITAR_HERO_3_JS_MAX_X 0xFC -#define GUITAR_HERO_3_JS_CENTER_X 0xE0 -#define GUITAR_HERO_3_JS_MIN_Y 0xC5 -#define GUITAR_HERO_3_JS_MAX_Y 0xFA -#define GUITAR_HERO_3_JS_CENTER_Y 0xE0 -#define GUITAR_HERO_3_WHAMMY_BAR_MIN 0xEF -#define GUITAR_HERO_3_WHAMMY_BAR_MAX 0xFA +#define GUITAR_HERO_3_JS_MIN_X 0xC5 +#define GUITAR_HERO_3_JS_MAX_X 0xFC +#define GUITAR_HERO_3_JS_CENTER_X 0xE0 +#define GUITAR_HERO_3_JS_MIN_Y 0xC5 +#define GUITAR_HERO_3_JS_MAX_Y 0xFA +#define GUITAR_HERO_3_JS_CENTER_Y 0xE0 +#define GUITAR_HERO_3_WHAMMY_BAR_MIN 0xEF +#define GUITAR_HERO_3_WHAMMY_BAR_MAX 0xFA #ifdef __cplusplus extern "C" { #endif +/** @defgroup internal_gh3 Internal: Guitar Hero 3 controller */ +/** @{ */ +int guitar_hero_3_handshake(struct wiimote_t *wm, struct guitar_hero_3_t *gh3, byte *data, + unsigned short len); - /** @defgroup internal_gh3 Internal: Guitar Hero 3 controller */ - /** @{ */ - int guitar_hero_3_handshake(struct wiimote_t* wm, struct guitar_hero_3_t* gh3, byte* data, unsigned short len); +void guitar_hero_3_disconnected(struct guitar_hero_3_t *gh3); - void guitar_hero_3_disconnected(struct guitar_hero_3_t* gh3); - - void guitar_hero_3_event(struct guitar_hero_3_t* gh3, byte* msg); - /** @} */ +void guitar_hero_3_event(struct guitar_hero_3_t *gh3, byte *msg); +/** @} */ #ifdef __cplusplus } diff --git a/lib/wiiuse/src/io.c b/lib/wiiuse/src/io.c new file mode 100644 index 000000000..d81fa999a --- /dev/null +++ b/lib/wiiuse/src/io.c @@ -0,0 +1,453 @@ +/* + * wiiuse + * + * Written By: + * Michael Laforest < para > + * Email: < thepara (--AT--) g m a i l [--DOT--] com > + * + * Copyright 2006-2007 + * + * This file is part of wiiuse. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * $Header$ + * + */ + +/** + * @file + * @brief Handles device I/O (non-OS specific). + */ + +#include "io.h" +#include "events.h" /* for propagate_event */ +#include "ir.h" /* for wiiuse_set_ir_mode */ +#include "wiiuse_internal.h" + +#include "os.h" /* for wiiuse_os_* */ + +#include /* for free, malloc */ + +/** + * @brief Find a wiimote or wiimotes. + * + * @param wm An array of wiimote_t structures. + * @param max_wiimotes The number of wiimote structures in \a wm. + * @param timeout The number of seconds before the search times out. + * + * @return The number of wiimotes found. + * + * @see wiiuse_connect() + * @see wiiuse_os_find() + * + * This function will only look for wiimote devices. \n + * When a device is found the address in the structures will be set. \n + * You can then call wiiuse_connect() to connect to the found \n + * devices. + * + * This function only delegates to the platform-specific implementation + * wiiuse_os_find. + * + * This function is declared in wiiuse.h + */ +int wiiuse_find(struct wiimote_t **wm, int max_wiimotes, int timeout) +{ + return wiiuse_os_find(wm, max_wiimotes, timeout); +} + +/** + * @brief Connect to a wiimote or wiimotes once an address is known. + * + * @param wm An array of wiimote_t structures. + * @param wiimotes The number of wiimote structures in \a wm. + * + * @return The number of wiimotes that successfully connected. + * + * @see wiiuse_find() + * @see wiiuse_disconnect() + * @see wiiuse_os_connect() + * + * Connect to a number of wiimotes when the address is already set + * in the wiimote_t structures. These addresses are normally set + * by the wiiuse_find() function, but can also be set manually. + * + * This function only delegates to the platform-specific implementation + * wiiuse_os_connect. + * + * This function is declared in wiiuse.h + */ +int wiiuse_connect(struct wiimote_t **wm, int wiimotes) { return wiiuse_os_connect(wm, wiimotes); } + +/** + * @brief Disconnect a wiimote. + * + * @param wm Pointer to a wiimote_t structure. + * + * @see wiiuse_connect() + * @see wiiuse_os_disconnect() + * + * Note that this will not free the wiimote structure. + * + * This function only delegates to the platform-specific implementation + * wiiuse_os_disconnect. + * + * This function is declared in wiiuse.h + */ +void wiiuse_disconnect(struct wiimote_t *wm) { wiiuse_os_disconnect(wm); } + +/** +* @brief Wait until specified report arrives and return it +* +* @param wm Pointer to a wiimote_t structure. +* @param buffer Pre-allocated memory to store the received data +* @param bufferLength size of buffer in bytes +* @param timeout_ms timeout in ms, 0 = wait forever +* +* Synchronous/blocking, this function will not return until it receives the specified +* report from the Wiimote or timeout occurs. +* +* Returns 1 on success, -1 on failure. +* +*/ +int wiiuse_wait_report(struct wiimote_t *wm, int report, byte *buffer, int bufferLength, + unsigned long timeout_ms) +{ + + int result = 1; + unsigned long elapsed = 0; + unsigned long start = wiiuse_os_ticks(); + + for (;;) + { + if (wiiuse_os_read(wm, buffer, bufferLength) > 0) + { + if (buffer[0] == report) + { + break; + } else + { + if (buffer[0] != 0x30) /* hack for chatty devices spamming the button report */ + { + WIIUSE_DEBUG("(id %i) dropping report 0x%x, waiting for 0x%x", wm->unid, buffer[0], + report); + } + } + } + + elapsed = wiiuse_os_ticks() - start; + if (elapsed > timeout_ms && timeout_ms > 0) + { + result = -1; + break; + } + } + + return result; +} + +/** +* @brief Read memory/register data synchronously +* +* @param wm Pointer to a wiimote_t structure. +* @param memory If set to non-zero, reads EEPROM, otherwise registers +* @param addr Address offset to read from +* @param size How many bytes to read +* @param data Pre-allocated memory to store the received data +* +* Synchronous/blocking read, this function will not return until it receives the specified +* amount of data from the Wiimote. +* +*/ +void wiiuse_read_data_sync(struct wiimote_t *wm, byte memory, unsigned addr, unsigned short size, byte *data) +{ + byte pkt[6]; + byte buf[MAX_PAYLOAD]; + unsigned n_full_reports; + unsigned last_report; + byte *output; + unsigned int i; + int done = 0; + + /* + * address in big endian first, the leading byte will + * be overwritten (only 3 bytes are sent) + */ + to_big_endian_uint32_t(pkt, addr); + + /* read from registers or memory */ + pkt[0] = (memory != 0) ? 0x00 : 0x04; + + /* length in big endian */ + to_big_endian_uint16_t(pkt + 4, size); + + done = 0; + while (!done) + { + /* send */ + wiiuse_send(wm, WM_CMD_READ_DATA, pkt, sizeof(pkt)); + + /* calculate how many 16B packets we have to get back */ + n_full_reports = size / 16; + last_report = size % 16; + output = data; + + for (i = 0; i < n_full_reports; ++i) + { + int rc = wiiuse_wait_report(wm, WM_RPT_READ, buf, MAX_PAYLOAD, WIIUSE_READ_TIMEOUT); + + if (rc < 0) + /* oops, time out, abort and retry */ + break; + + memmove(output, buf + 6, 16); + output += 16; + } + + /* read the last incomplete packet */ + if (last_report) + { + int rc = wiiuse_wait_report(wm, WM_RPT_READ, buf, MAX_PAYLOAD, WIIUSE_READ_TIMEOUT); + + if (rc) + done = 1; + + memmove(output, buf + 6, last_report); + } else + done = 1; + } +} + +/** + * @brief Get initialization data from the wiimote. + * + * @param wm Pointer to a wiimote_t structure. + * @param data unused + * @param len unused + * + * When first called for a wiimote_t structure, a request + * is sent to the wiimote for initialization information. + * This includes factory set accelerometer data. + * The handshake will be concluded when the wiimote responds + * with this data. + */ + +#ifdef WIIUSE_SYNC_HANDSHAKE + +void wiiuse_handshake(struct wiimote_t *wm, byte *data, uint16_t len) +{ + /* send request to wiimote for accelerometer calibration */ + byte buf[MAX_PAYLOAD]; + int i; + + /* step 0 - Reset wiimote */ + { + // wiiuse_set_leds(wm, WIIMOTE_LED_NONE); + + WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_HANDSHAKE); + WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_CONNECTED); + WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_ACC); + WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_IR); + WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_RUMBLE); + WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_EXP); + WIIMOTE_DISABLE_FLAG(wm, WIIUSE_CONTINUOUS); + + wiiuse_set_report_type(wm); + wiiuse_millisleep(500); + + /* + Ensure MP is off, because it will screw up the expansion handshake otherwise. + We cannot rely on the Wiimote having been powercycled between uses + because Windows/Mayflash Dolphin Bar and even Linux now allow pairing + it permanently - thus it remains on and connected between the application + starts and in an unknown state when we arrive here => problem. + + This won't affect regular expansions (Nunchuck) if MP is not present, + they get initialized twice in the worst case, which is harmless. + */ + + byte val = 0x55; + wiiuse_write_data(wm, WM_EXP_MEM_ENABLE1, &val, 1); + + WIIUSE_DEBUG("Wiimote reset!\n"); + } + + /* step 1 - calibration of accelerometers */ + { + struct accel_t *accel = &wm->accel_calib; + + wiiuse_read_data_sync(wm, 1, WM_MEM_OFFSET_CALIBRATION, 8, buf); + + /* received read data */ + accel->cal_zero.x = buf[0]; + accel->cal_zero.y = buf[1]; + accel->cal_zero.z = buf[2]; + + accel->cal_g.x = buf[4] - accel->cal_zero.x; + accel->cal_g.y = buf[5] - accel->cal_zero.y; + accel->cal_g.z = buf[6] - accel->cal_zero.z; + + WIIUSE_DEBUG("Calibrated wiimote acc\n"); + } + + /* step 2 - re-enable IR and ask for status */ + { + WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_HANDSHAKE_COMPLETE); + WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_HANDSHAKE); + + /* now enable IR if it was set before the handshake completed */ + if (WIIMOTE_IS_SET(wm, WIIMOTE_STATE_IR)) + { + WIIUSE_DEBUG("Handshake finished, enabling IR."); + WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_IR); + wiiuse_set_ir(wm, 1); + } + + /* + * try to ask for status 3 times, sometimes the first one gives bad data + * and doesn't show expansions + */ + for (i = 0; i < 3; ++i) + { + int rc = 0; + + WIIUSE_DEBUG("Asking for status, attempt %d ...\n", i); + wm->event = WIIUSE_CONNECT; + + wiiuse_status(wm); + rc = wiiuse_wait_report(wm, WM_RPT_CTRL_STATUS, buf, MAX_PAYLOAD, WIIUSE_READ_TIMEOUT); + + if (buf[3] != 0) + break; + + wiiuse_millisleep(500); + } + propagate_event(wm, WM_RPT_CTRL_STATUS, buf + 1); + } +} + +#else + +static void wiiuse_disable_motion_plus1(struct wiimote_t *wm, byte *data, unsigned short len); +static void wiiuse_disable_motion_plus2(struct wiimote_t *wm, byte *data, unsigned short len); + +void wiiuse_handshake(struct wiimote_t *wm, byte *data, uint16_t len) +{ + if (!wm) + { + return; + } + + switch (wm->handshake_state) + { + case 0: + { + byte *buf; + + /* continuous reporting off, report to buttons only */ + WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_HANDSHAKE); + wiiuse_set_leds(wm, WIIMOTE_LED_NONE); + + WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_ACC); + WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_IR); + WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_RUMBLE); + WIIMOTE_DISABLE_FLAG(wm, WIIUSE_CONTINUOUS); + + wiiuse_set_report_type(wm); + + /* send request to wiimote for accelerometer calibration */ + buf = (byte *)malloc(sizeof(byte) * 8); + wiiuse_read_data_cb(wm, wiiuse_handshake, buf, WM_MEM_OFFSET_CALIBRATION, 7); + wm->handshake_state++; + + wiiuse_set_leds(wm, WIIMOTE_LED_NONE); + + break; + } + + case 1: + { + struct read_req_t *req = wm->read_req; + struct accel_t *accel = &wm->accel_calib; + byte val; + + /* received read data */ + accel->cal_zero.x = req->buf[0]; + accel->cal_zero.y = req->buf[1]; + accel->cal_zero.z = req->buf[2]; + + accel->cal_g.x = req->buf[4] - accel->cal_zero.x; + accel->cal_g.y = req->buf[5] - accel->cal_zero.y; + accel->cal_g.z = req->buf[6] - accel->cal_zero.z; + + /* done with the buffer */ + free(req->buf); + + /* handshake is done */ + WIIUSE_DEBUG("Handshake finished. Calibration: Idle: X=%x Y=%x Z=%x\t+1g: X=%x Y=%x Z=%x", + accel->cal_zero.x, accel->cal_zero.y, accel->cal_zero.z, accel->cal_g.x, accel->cal_g.y, + accel->cal_g.z); + + /* M+ off */ + val = 0x55; + wiiuse_write_data_cb(wm, WM_EXP_MEM_ENABLE1, &val, 1, wiiuse_disable_motion_plus1); + + break; + } + + case 2: + { + /* request the status of the wiimote to check for any expansion */ + WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_HANDSHAKE); + WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_HANDSHAKE_COMPLETE); + wm->handshake_state++; + + /* now enable IR if it was set before the handshake completed */ + if (WIIMOTE_IS_SET(wm, WIIMOTE_STATE_IR)) + { + WIIUSE_DEBUG("Handshake finished, enabling IR."); + WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_IR); + wiiuse_set_ir(wm, 1); + } + + wm->event = WIIUSE_CONNECT; + wiiuse_status(wm); + + break; + } + + default: + { + break; + } + } +} + +static void wiiuse_disable_motion_plus1(struct wiimote_t *wm, byte *data, unsigned short len) +{ + byte val = 0x55; + wiiuse_write_data_cb(wm, WM_EXP_MEM_ENABLE1, &val, 1, wiiuse_disable_motion_plus2); +} + +static void wiiuse_disable_motion_plus2(struct wiimote_t *wm, byte *data, unsigned short len) +{ + WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_EXP_FAILED); + WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_EXP_HANDSHAKE); + wiiuse_set_ir_mode(wm); + + wm->handshake_state++; + wiiuse_handshake(wm, NULL, 0); +} + +#endif diff --git a/lib/wiiuse/io.h b/lib/wiiuse/src/io.h similarity index 73% rename from lib/wiiuse/io.h rename to lib/wiiuse/src/io.h index 0149cb05f..eef2f5fe3 100644 --- a/lib/wiiuse/io.h +++ b/lib/wiiuse/src/io.h @@ -40,13 +40,14 @@ extern "C" { #endif - /** @defgroup internal_io Internal: Device I/O */ - /** @{ */ - void wiiuse_handshake(struct wiimote_t* wm, byte* data, uint16_t len); +/** @defgroup internal_io Internal: Device I/O */ +/** @{ */ +void wiiuse_handshake(struct wiimote_t *wm, byte *data, uint16_t len); - void wiiuse_wait_report(struct wiimote_t *wm, int report, byte *buffer, int bufferLength); - void wiiuse_read_data_sync(struct wiimote_t *wm, byte memory, unsigned addr, unsigned short size, byte *data); - /** @} */ +int wiiuse_wait_report(struct wiimote_t *wm, int report, byte *buffer, int bufferLength, + unsigned long timeout_ms); +void wiiuse_read_data_sync(struct wiimote_t *wm, byte memory, unsigned addr, unsigned short size, byte *data); +/** @} */ #ifdef __cplusplus } diff --git a/lib/wiiuse/src/ir.c b/lib/wiiuse/src/ir.c new file mode 100644 index 000000000..59ffd0025 --- /dev/null +++ b/lib/wiiuse/src/ir.c @@ -0,0 +1,868 @@ +/* + * wiiuse + * + * Written By: + * Michael Laforest < para > + * Email: < thepara (--AT--) g m a i l [--DOT--] com > + * + * Copyright 2006-2007 + * + * This file is part of wiiuse. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * $Header$ + * + */ + +/** + * @file + * @brief Handles IR data. + */ + +#include "ir.h" + +#include /* for atanf, cos, sin, sqrt */ + +static int get_ir_sens(struct wiimote_t *wm, const byte **block1, const byte **block2); +static void interpret_ir_data(struct wiimote_t *wm); +static void fix_rotated_ir_dots(struct ir_dot_t *dot, float ang); +static void get_ir_dot_avg(struct ir_dot_t *dot, int *x, int *y); +static void reorder_ir_dots(struct ir_dot_t *dot); +static float ir_distance(struct ir_dot_t *dot); +static int ir_correct_for_bounds(int *x, int *y, enum aspect_t aspect, int offset_x, int offset_y); +static void ir_convert_to_vres(int *x, int *y, enum aspect_t aspect, int vx, int vy); + +/* ir block data */ +static const byte WM_IR_BLOCK1_LEVEL1[] = "\x02\x00\x00\x71\x01\x00\x64\x00\xfe"; +static const byte WM_IR_BLOCK2_LEVEL1[] = "\xfd\x05"; +static const byte WM_IR_BLOCK1_LEVEL2[] = "\x02\x00\x00\x71\x01\x00\x96\x00\xb4"; +static const byte WM_IR_BLOCK2_LEVEL2[] = "\xb3\x04"; +static const byte WM_IR_BLOCK1_LEVEL3[] = "\x02\x00\x00\x71\x01\x00\xaa\x00\x64"; +static const byte WM_IR_BLOCK2_LEVEL3[] = "\x63\x03"; +static const byte WM_IR_BLOCK1_LEVEL4[] = "\x02\x00\x00\x71\x01\x00\xc8\x00\x36"; +static const byte WM_IR_BLOCK2_LEVEL4[] = "\x35\x03"; +static const byte WM_IR_BLOCK1_LEVEL5[] = "\x07\x00\x00\x71\x01\x00\x72\x00\x20"; +static const byte WM_IR_BLOCK2_LEVEL5[] = "\x1f\x03"; + +void wiiuse_set_ir_mode(struct wiimote_t *wm) +{ + byte buf = 0x00; + + if (!wm) + { + return; + } + if (!WIIMOTE_IS_SET(wm, WIIMOTE_STATE_IR)) + { + return; + } + + if (WIIMOTE_IS_SET(wm, WIIMOTE_STATE_EXP)) + { + buf = WM_IR_TYPE_BASIC; + } else + { + buf = WM_IR_TYPE_EXTENDED; + } + wiiuse_write_data(wm, WM_REG_IR_MODENUM, &buf, 1); +} +/** + * @brief Set if the wiimote should track IR targets. + * + * @param wm Pointer to a wiimote_t structure. + * @param status 1 to enable, 0 to disable. + */ +void wiiuse_set_ir(struct wiimote_t *wm, int status) +{ + byte buf; + const byte *block1 = NULL; + const byte *block2 = NULL; + int ir_level; + + if (!wm) + { + return; + } + + /* + * Wait for the handshake to finish first. + * When it handshake finishes and sees that + * IR is enabled, it will call this function + * again to actually enable IR. + */ + if (!WIIMOTE_IS_SET(wm, WIIMOTE_STATE_HANDSHAKE_COMPLETE)) + { + if (status) + { + WIIUSE_DEBUG("Tried to enable IR, will wait until handshake finishes."); + WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_IR); + } /* else ignoring request to turn off, since it's turned off by default */ + return; + } + + /* + * Check to make sure a sensitivity setting is selected. + */ + ir_level = get_ir_sens(wm, &block1, &block2); + if (!ir_level) + { + WIIUSE_ERROR("No IR sensitivity setting selected."); + return; + } + + if (status) + { + /* if already enabled then stop */ + if (WIIMOTE_IS_SET(wm, WIIMOTE_STATE_IR)) + { + return; + } + WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_IR); + } else + { + /* if already disabled then stop */ + if (!WIIMOTE_IS_SET(wm, WIIMOTE_STATE_IR)) + { + return; + } + WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_IR); + } + + /* set camera 1 and 2 */ + buf = (status ? 0x04 : 0x00); + wiiuse_send(wm, WM_CMD_IR, &buf, 1); + wiiuse_send(wm, WM_CMD_IR_2, &buf, 1); + + if (!status) + { + WIIUSE_DEBUG("Disabled IR cameras for wiimote id %i.", wm->unid); + wiiuse_set_report_type(wm); + return; + } + + /* enable IR, set sensitivity */ + buf = 0x08; + wiiuse_write_data(wm, WM_REG_IR, &buf, 1); + + /* wait for the wiimote to catch up */ + wiiuse_millisleep(50); + + /* write sensitivity blocks */ + wiiuse_write_data(wm, WM_REG_IR_BLOCK1, (byte *)block1, 9); + wiiuse_write_data(wm, WM_REG_IR_BLOCK2, (byte *)block2, 2); + + /* set the IR mode */ + if (WIIMOTE_IS_SET(wm, WIIMOTE_STATE_EXP)) + { + buf = WM_IR_TYPE_BASIC; + } else + { + buf = WM_IR_TYPE_EXTENDED; + } + wiiuse_write_data(wm, WM_REG_IR_MODENUM, &buf, 1); + + wiiuse_millisleep(50); + + /* set the wiimote report type */ + wiiuse_set_report_type(wm); + + WIIUSE_DEBUG("Enabled IR camera for wiimote id %i (sensitivity level %i).", wm->unid, ir_level); +} + +/** + * @brief Get the IR sensitivity settings. + * + * @param wm Pointer to a wiimote_t structure. + * @param block1 [out] Pointer to where block1 will be set. + * @param block2 [out] Pointer to where block2 will be set. + * + * @return Returns the sensitivity level. + */ +static int get_ir_sens(struct wiimote_t *wm, const byte **block1, const byte **block2) +{ + if (WIIMOTE_IS_SET(wm, WIIMOTE_STATE_IR_SENS_LVL1)) + { + *block1 = WM_IR_BLOCK1_LEVEL1; + *block2 = WM_IR_BLOCK2_LEVEL1; + return 1; + } else if (WIIMOTE_IS_SET(wm, WIIMOTE_STATE_IR_SENS_LVL2)) + { + *block1 = WM_IR_BLOCK1_LEVEL2; + *block2 = WM_IR_BLOCK2_LEVEL2; + return 2; + } else if (WIIMOTE_IS_SET(wm, WIIMOTE_STATE_IR_SENS_LVL3)) + { + *block1 = WM_IR_BLOCK1_LEVEL3; + *block2 = WM_IR_BLOCK2_LEVEL3; + return 3; + } else if (WIIMOTE_IS_SET(wm, WIIMOTE_STATE_IR_SENS_LVL4)) + { + *block1 = WM_IR_BLOCK1_LEVEL4; + *block2 = WM_IR_BLOCK2_LEVEL4; + return 4; + } else if (WIIMOTE_IS_SET(wm, WIIMOTE_STATE_IR_SENS_LVL5)) + { + *block1 = WM_IR_BLOCK1_LEVEL5; + *block2 = WM_IR_BLOCK2_LEVEL5; + return 5; + } + + *block1 = NULL; + *block2 = NULL; + return 0; +} + +/** + * @brief Set the virtual screen resolution for IR tracking. + * + * @param wm Pointer to a wiimote_t structure. + * @param status 1 to enable, 0 to disable. + */ +void wiiuse_set_ir_vres(struct wiimote_t *wm, unsigned int x, unsigned int y) +{ + if (!wm) + { + return; + } + + wm->ir.vres[0] = (x - 1); + wm->ir.vres[1] = (y - 1); +} + +/** + * @brief Set the XY position for the IR cursor. + * + * @param wm Pointer to a wiimote_t structure. + */ +void wiiuse_set_ir_position(struct wiimote_t *wm, enum ir_position_t pos) +{ + if (!wm) + { + return; + } + + wm->ir.pos = pos; + + switch (pos) + { + + case WIIUSE_IR_ABOVE: + wm->ir.offset[0] = 0; + + if (wm->ir.aspect == WIIUSE_ASPECT_16_9) + { + wm->ir.offset[1] = WM_ASPECT_16_9_Y / 2 - 70; + } else if (wm->ir.aspect == WIIUSE_ASPECT_4_3) + { + wm->ir.offset[1] = WM_ASPECT_4_3_Y / 2 - 100; + } + + return; + + case WIIUSE_IR_BELOW: + wm->ir.offset[0] = 0; + + if (wm->ir.aspect == WIIUSE_ASPECT_16_9) + { + wm->ir.offset[1] = -WM_ASPECT_16_9_Y / 2 + 100; + } else if (wm->ir.aspect == WIIUSE_ASPECT_4_3) + { + wm->ir.offset[1] = -WM_ASPECT_4_3_Y / 2 + 70; + } + + return; + + default: + return; + }; +} + +/** + * @brief Set the aspect ratio of the TV/monitor. + * + * @param wm Pointer to a wiimote_t structure. + * @param aspect Either WIIUSE_ASPECT_16_9 or WIIUSE_ASPECT_4_3 + */ +void wiiuse_set_aspect_ratio(struct wiimote_t *wm, enum aspect_t aspect) +{ + if (!wm) + { + return; + } + + wm->ir.aspect = aspect; + + if (aspect == WIIUSE_ASPECT_4_3) + { + wm->ir.vres[0] = WM_ASPECT_4_3_X; + wm->ir.vres[1] = WM_ASPECT_4_3_Y; + } else + { + wm->ir.vres[0] = WM_ASPECT_16_9_X; + wm->ir.vres[1] = WM_ASPECT_16_9_Y; + } + + /* reset the position offsets */ + wiiuse_set_ir_position(wm, wm->ir.pos); +} + +/** + * @brief Set the IR sensitivity. + * + * @param wm Pointer to a wiimote_t structure. + * @param level 1-5, same as Wii system sensitivity setting. + * + * If the level is < 1, then level will be set to 1. + * If the level is > 5, then level will be set to 5. + */ +void wiiuse_set_ir_sensitivity(struct wiimote_t *wm, int level) +{ + const byte *block1 = NULL; + const byte *block2 = NULL; + + if (!wm) + { + return; + } + + if (level > 5) + { + level = 5; + } + if (level < 1) + { + level = 1; + } + + WIIMOTE_DISABLE_STATE(wm, (WIIMOTE_STATE_IR_SENS_LVL1 | WIIMOTE_STATE_IR_SENS_LVL2 + | WIIMOTE_STATE_IR_SENS_LVL3 | WIIMOTE_STATE_IR_SENS_LVL4 + | WIIMOTE_STATE_IR_SENS_LVL5)); + + switch (level) + { + case 1: + WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_IR_SENS_LVL1); + break; + case 2: + WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_IR_SENS_LVL2); + break; + case 3: + WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_IR_SENS_LVL3); + break; + case 4: + WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_IR_SENS_LVL4); + break; + case 5: + WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_IR_SENS_LVL5); + break; + default: + return; + } + + /* set the new sensitivity */ + get_ir_sens(wm, &block1, &block2); + + wiiuse_write_data(wm, WM_REG_IR_BLOCK1, block1, 9); + wiiuse_write_data(wm, WM_REG_IR_BLOCK2, block2, 2); + + WIIUSE_DEBUG("Set IR sensitivity to level %i (unid %i)", level, wm->unid); +} + +/** + * @brief Calculate the data from the IR spots. Basic IR mode. + * + * @param wm Pointer to a wiimote_t structure. + * @param data Data returned by the wiimote for the IR spots. + */ +void calculate_basic_ir(struct wiimote_t *wm, byte *data) +{ + struct ir_dot_t *dot = wm->ir.dot; + int i; + + dot[0].rx = 1023 - (data[0] | ((data[2] & 0x30) << 4)); + dot[0].ry = data[1] | ((data[2] & 0xC0) << 2); + + dot[1].rx = 1023 - (data[3] | ((data[2] & 0x03) << 8)); + dot[1].ry = data[4] | ((data[2] & 0x0C) << 6); + + dot[2].rx = 1023 - (data[5] | ((data[7] & 0x30) << 4)); + dot[2].ry = data[6] | ((data[7] & 0xC0) << 2); + + dot[3].rx = 1023 - (data[8] | ((data[7] & 0x03) << 8)); + dot[3].ry = data[9] | ((data[7] & 0x0C) << 6); + + /* set each IR spot to visible if spot is in range */ + for (i = 0; i < 4; ++i) + { + if (dot[i].ry == 1023) + { + dot[i].visible = 0; + } else + { + dot[i].visible = 1; + dot[i].size = 0; /* since we don't know the size, set it as 0 */ + } + } + + interpret_ir_data(wm); +} + +/** + * @brief Calculate the data from the IR spots. Extended IR mode. + * + * @param wm Pointer to a wiimote_t structure. + * @param data Data returned by the wiimote for the IR spots. + */ +void calculate_extended_ir(struct wiimote_t *wm, byte *data) +{ + struct ir_dot_t *dot = wm->ir.dot; + int i; + + for (i = 0; i < 4; ++i) + { + dot[i].rx = 1023 - (data[3 * i] | ((data[(3 * i) + 2] & 0x30) << 4)); + dot[i].ry = data[(3 * i) + 1] | ((data[(3 * i) + 2] & 0xC0) << 2); + + dot[i].size = data[(3 * i) + 2] & 0x0F; + + /* if in range set to visible */ + if (dot[i].ry == 1023) + { + dot[i].visible = 0; + } else + { + dot[i].visible = 1; + } + } + + interpret_ir_data(wm); +} + +/** + * @brief Interpret IR data into more user friendly variables. + * + * @param wm Pointer to a wiimote_t structure. + */ +static void interpret_ir_data(struct wiimote_t *wm) +{ + struct ir_dot_t *dot = wm->ir.dot; + int i; + float roll = 0.0f; + int last_num_dots = wm->ir.num_dots; + + if (WIIMOTE_IS_SET(wm, WIIMOTE_STATE_ACC)) + { + roll = wm->orient.roll; + } + + /* count visible dots */ + wm->ir.num_dots = 0; + for (i = 0; i < 4; ++i) + { + if (dot[i].visible) + { + wm->ir.num_dots++; + } + } + + switch (wm->ir.num_dots) + { + case 0: + { + wm->ir.state = 0; + + /* reset the dot ordering */ + for (i = 0; i < 4; ++i) + { + dot[i].order = 0; + } + + wm->ir.x = 0; + wm->ir.y = 0; + wm->ir.z = 0.0f; + + return; + } + case 1: + { + fix_rotated_ir_dots(wm->ir.dot, roll); + + if (wm->ir.state < 2) + { + /* + * Only 1 known dot, so use just that. + */ + for (i = 0; i < 4; ++i) + { + if (dot[i].visible) + { + wm->ir.x = dot[i].x; + wm->ir.y = dot[i].y; + + wm->ir.ax = wm->ir.x; + wm->ir.ay = wm->ir.y; + + /* can't calculate yaw because we don't have the distance */ + /* wm->orient.yaw = calc_yaw(&wm->ir); */ + + ir_convert_to_vres(&wm->ir.x, &wm->ir.y, wm->ir.aspect, wm->ir.vres[0], wm->ir.vres[1]); + break; + } + } + } else + { + /* + * Only see 1 dot but know theres 2. + * Try to estimate where the other one + * should be and use that. + */ + for (i = 0; i < 4; ++i) + { + if (dot[i].visible) + { + int ox = 0; + int x, y; + + if (dot[i].order == 1) + /* visible is the left dot - estimate where the right is */ + { + ox = (int32_t)(dot[i].x + wm->ir.distance); + } else if (dot[i].order == 2) + /* visible is the right dot - estimate where the left is */ + { + ox = (int32_t)(dot[i].x - wm->ir.distance); + } + + x = ((signed int)dot[i].x + ox) / 2; + y = dot[i].y; + + wm->ir.ax = x; + wm->ir.ay = y; + wm->orient.yaw = calc_yaw(&wm->ir); + + if (ir_correct_for_bounds(&x, &y, wm->ir.aspect, wm->ir.offset[0], wm->ir.offset[1])) + { + ir_convert_to_vres(&x, &y, wm->ir.aspect, wm->ir.vres[0], wm->ir.vres[1]); + wm->ir.x = x; + wm->ir.y = y; + } + + break; + } + } + } + + break; + } + case 2: + case 3: + case 4: + { + /* + * Two (or more) dots known and seen. + * Average them together to estimate the true location. + */ + int x, y; + wm->ir.state = 2; + + fix_rotated_ir_dots(wm->ir.dot, roll); + + /* if there is at least 1 new dot, reorder them all */ + if (wm->ir.num_dots > last_num_dots) + { + reorder_ir_dots(dot); + wm->ir.x = 0; + wm->ir.y = 0; + } + + wm->ir.distance = ir_distance(dot); + wm->ir.z = 1023 - wm->ir.distance; + + get_ir_dot_avg(wm->ir.dot, &x, &y); + + wm->ir.ax = x; + wm->ir.ay = y; + wm->orient.yaw = calc_yaw(&wm->ir); + + if (ir_correct_for_bounds(&x, &y, wm->ir.aspect, wm->ir.offset[0], wm->ir.offset[1])) + { + ir_convert_to_vres(&x, &y, wm->ir.aspect, wm->ir.vres[0], wm->ir.vres[1]); + wm->ir.x = x; + wm->ir.y = y; + } + + break; + } + default: + { + break; + } + } + +#ifdef WITH_WIIUSE_DEBUG + { + int ir_level; + WIIUSE_GET_IR_SENSITIVITY(wm, &ir_level); + WIIUSE_DEBUG("IR sensitivity: %i", ir_level); + WIIUSE_DEBUG("IR visible dots: %i", wm->ir.num_dots); + for (i = 0; i < 4; ++i) + if (dot[i].visible) + { + WIIUSE_DEBUG("IR[%i][order %i] (%.3i, %.3i) -> (%.3i, %.3i)", i, dot[i].order, dot[i].rx, + dot[i].ry, dot[i].x, dot[i].y); + } + WIIUSE_DEBUG("IR[absolute]: (%i, %i)", wm->ir.x, wm->ir.y); + } +#endif +} + +/** + * @brief Fix the rotation of the IR dots. + * + * @param dot An array of 4 ir_dot_t objects. + * @param ang The roll angle to correct by (-180, 180) + * + * If there is roll then the dots are rotated + * around the origin and give a false cursor + * position. Correct for the roll. + * + * If the accelerometer is off then obviously + * this will not do anything and the cursor + * position may be inaccurate. + */ +static void fix_rotated_ir_dots(struct ir_dot_t *dot, float ang) +{ + float s, c; + int x, y; + int i; + + if (!ang) + { + for (i = 0; i < 4; ++i) + { + dot[i].x = dot[i].rx; + dot[i].y = dot[i].ry; + } + return; + } + + s = sinf(DEGREE_TO_RAD(ang)); + c = cosf(DEGREE_TO_RAD(ang)); + + /* + * [ cos(theta) -sin(theta) ][ ir->rx ] + * [ sin(theta) cos(theta) ][ ir->ry ] + */ + + for (i = 0; i < 4; ++i) + { + if (!dot[i].visible) + { + continue; + } + + x = dot[i].rx - (1024 / 2); + y = dot[i].ry - (768 / 2); + + dot[i].x = (uint32_t)((c * x) + (-s * y)); + dot[i].y = (uint32_t)((s * x) + (c * y)); + + dot[i].x += (1024 / 2); + dot[i].y += (768 / 2); + } +} + +/** + * @brief Average IR dots. + * + * @param dot An array of 4 ir_dot_t objects. + * @param x [out] Average X + * @param y [out] Average Y + */ +static void get_ir_dot_avg(struct ir_dot_t *dot, int *x, int *y) +{ + int vis = 0, i = 0; + + *x = 0; + *y = 0; + + for (; i < 4; ++i) + { + if (dot[i].visible) + { + *x += dot[i].x; + *y += dot[i].y; + ++vis; + } + } + + *x /= vis; + *y /= vis; +} + +/** + * @brief Reorder the IR dots. + * + * @param dot An array of 4 ir_dot_t objects. + */ +static void reorder_ir_dots(struct ir_dot_t *dot) +{ + int i, j, order; + + /* reset the dot ordering */ + for (i = 0; i < 4; ++i) + { + dot[i].order = 0; + } + + for (order = 1; order < 5; ++order) + { + i = 0; + + for (; !dot[i].visible || dot[i].order; ++i) + if (i >= 3) + { + return; + } + + for (j = 0; j < 4; ++j) + { + if (dot[j].visible && !dot[j].order && (dot[j].x < dot[i].x)) + { + i = j; + } + } + + dot[i].order = order; + } +} + +/** + * @brief Calculate the distance between the first 2 visible IR dots. + * + * @param dot An array of 4 ir_dot_t objects. + */ +static float ir_distance(struct ir_dot_t *dot) +{ + int i1, i2; + int xd, yd; + + for (i1 = 0; i1 < 4; ++i1) + if (dot[i1].visible) + { + break; + } + if (i1 == 4) + { + return 0.0f; + } + + for (i2 = i1 + 1; i2 < 4; ++i2) + if (dot[i2].visible) + { + break; + } + if (i2 == 4) + { + return 0.0f; + } + + xd = dot[i2].x - dot[i1].x; + yd = dot[i2].y - dot[i1].y; + + return sqrtf((float)(xd * xd + yd * yd)); +} + +/** + * @brief Correct for the IR bounding box. + * + * @param x [out] The current X, it will be updated if valid. + * @param y [out] The current Y, it will be updated if valid. + * @param aspect Aspect ratio of the screen. + * @param offset_x The X offset of the bounding box. + * @param offset_y The Y offset of the bounding box. + * + * @return Returns 1 if the point is valid and was updated. + * + * Nintendo was smart with this bit. They sacrifice a little + * precision for a big increase in usability. + */ +static int ir_correct_for_bounds(int *x, int *y, enum aspect_t aspect, int offset_x, int offset_y) +{ + int x0, y0; + int xs, ys; + + if (aspect == WIIUSE_ASPECT_16_9) + { + xs = WM_ASPECT_16_9_X; + ys = WM_ASPECT_16_9_Y; + } else + { + xs = WM_ASPECT_4_3_X; + ys = WM_ASPECT_4_3_Y; + } + + x0 = ((1024 - xs) / 2) + offset_x; + y0 = ((768 - ys) / 2) + offset_y; + + if ((*x >= x0) && (*x <= (x0 + xs)) && (*y >= y0) && (*y <= (y0 + ys))) + { + *x -= offset_x; + *y -= offset_y; + + return 1; + } + + return 0; +} + +/** + * @brief Interpolate the point to the user defined virtual screen resolution. + */ +static void ir_convert_to_vres(int *x, int *y, enum aspect_t aspect, int vx, int vy) +{ + int xs, ys; + + if (aspect == WIIUSE_ASPECT_16_9) + { + xs = WM_ASPECT_16_9_X; + ys = WM_ASPECT_16_9_Y; + } else + { + xs = WM_ASPECT_4_3_X; + ys = WM_ASPECT_4_3_Y; + } + + *x -= ((1024 - xs) / 2); + *y -= ((768 - ys) / 2); + + *x = (int)((*x / (float)xs) * vx); + *y = (int)((*y / (float)ys) * vy); +} + +/** + * @brief Calculate yaw given the IR data. + * + * @param ir IR data structure. + */ +float calc_yaw(struct ir_t *ir) +{ + float x; + + x = (float)(ir->ax - 512); + x = x * (ir->z / 1024.0f); + + return RAD_TO_DEGREE(atanf(x / ir->z)); +} diff --git a/lib/wiiuse/ir.h b/lib/wiiuse/src/ir.h similarity index 76% rename from lib/wiiuse/ir.h rename to lib/wiiuse/src/ir.h index 7e3dbc503..265cd03b4 100644 --- a/lib/wiiuse/ir.h +++ b/lib/wiiuse/src/ir.h @@ -36,26 +36,23 @@ #include "wiiuse_internal.h" -#define WII_VRES_X 560 -#define WII_VRES_Y 340 +#define WII_VRES_X 560 +#define WII_VRES_Y 340 #ifdef __cplusplus extern "C" { #endif - - /** @defgroup internal_ir Internal: IR Sensor */ - /** @{ */ - void wiiuse_set_ir_mode(struct wiimote_t *wm); - void calculate_basic_ir(struct wiimote_t* wm, byte* data); - void calculate_extended_ir(struct wiimote_t* wm, byte* data); - float calc_yaw(struct ir_t* ir); - /** @} */ +/** @defgroup internal_ir Internal: IR Sensor */ +/** @{ */ +void wiiuse_set_ir_mode(struct wiimote_t *wm); +void calculate_basic_ir(struct wiimote_t *wm, byte *data); +void calculate_extended_ir(struct wiimote_t *wm, byte *data); +float calc_yaw(struct ir_t *ir); +/** @} */ #ifdef __cplusplus } #endif #endif /* IR_H_INCLUDED */ - - diff --git a/lib/wiiuse/src/motion_plus.c b/lib/wiiuse/src/motion_plus.c new file mode 100644 index 000000000..0f33ed312 --- /dev/null +++ b/lib/wiiuse/src/motion_plus.c @@ -0,0 +1,382 @@ +/* + * wiiuse + * + * Written By: + * Michal Wiedenbauer < shagkur > + * Dave Murphy < WinterMute > + * Hector Martin < marcan > + * Radu Andries + * + * Copyright 2009 + * + * This file is part of wiiuse and fWIIne. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * $Header$ + * + */ + +#include "motion_plus.h" + +#include "dynamics.h" /* for calc_joystick_state, etc */ +#include "events.h" /* for disable_expansion */ +#include "io.h" /* for wiiuse_read */ +#include "ir.h" /* for wiiuse_set_ir_mode */ +#include "nunchuk.h" /* for nunchuk_pressed_buttons */ + +#include /* for fabs */ +#include /* for memset */ + +static void wiiuse_calibrate_motion_plus(struct motion_plus_t *mp); +static void calculate_gyro_rates(struct motion_plus_t *mp); + +void wiiuse_probe_motion_plus(struct wiimote_t *wm) +{ + byte buf[MAX_PAYLOAD]; + unsigned id; + + wiiuse_read_data_sync(wm, 0, WM_EXP_MOTION_PLUS_IDENT, 6, buf); + + /* check error code */ + if ((buf[5] & 0x0f) == 0) + { + WIIUSE_DEBUG("No Motion+ available, stopping probe."); + WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_MPLUS_PRESENT); + return; + } + + /* decode the id */ + id = from_big_endian_uint32_t(buf + 2); + + if (id != EXP_ID_CODE_INACTIVE_MOTION_PLUS && id != EXP_ID_CODE_INACTIVE_MOTION_PLUS_BUILTIN + && id != EXP_ID_CODE_NLA_MOTION_PLUS && id != EXP_ID_CODE_NLA_MOTION_PLUS_NUNCHUK + && id != EXP_ID_CODE_NLA_MOTION_PLUS_CLASSIC) + { + /* we have read something weird */ + WIIUSE_DEBUG("Motion+ ID doesn't match, probably not connected."); + WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_MPLUS_PRESENT); + return; + } + + WIIUSE_DEBUG("Detected inactive Motion+!"); + WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_MPLUS_PRESENT); + + /* init M+ */ + buf[0] = 0x55; + wiiuse_write_data(wm, WM_EXP_MOTION_PLUS_INIT, buf, 1); + + /* Init whatever is hanging on the pass-through port */ + buf[0] = 0x55; + wiiuse_write_data(wm, WM_EXP_MEM_ENABLE1, buf, 1); + + buf[0] = 0x00; + wiiuse_write_data(wm, WM_EXP_MEM_ENABLE2, buf, 1); + + /* Init gyroscope data */ + wm->exp.mp.cal_gyro.roll = 0; + wm->exp.mp.cal_gyro.pitch = 0; + wm->exp.mp.cal_gyro.yaw = 0; + wm->exp.mp.orient.roll = 0.0; + wm->exp.mp.orient.pitch = 0.0; + wm->exp.mp.orient.yaw = 0.0; + wm->exp.mp.raw_gyro_threshold = 10; + + wm->exp.mp.nc = &(wm->exp.nunchuk); + wm->exp.mp.classic = &(wm->exp.classic); + wm->exp.nunchuk.flags = &wm->flags; + + wm->exp.mp.ext = 0; + + wiiuse_set_ir_mode(wm); + wiiuse_set_report_type(wm); +} + +void wiiuse_motion_plus_handshake(struct wiimote_t *wm, byte *data, unsigned short len) +{ + uint32_t val; + if (data == NULL) + { + wiiuse_read_data_cb(wm, wiiuse_motion_plus_handshake, wm->motion_plus_id, WM_EXP_ID, 6); + } else + { + WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_EXP_FAILED); + WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_EXP_HANDSHAKE); + WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_EXP); /* tell wiimote to include exp. data in reports */ + + val = from_big_endian_uint32_t(data + 2); + + if (val == EXP_ID_CODE_MOTION_PLUS || val == EXP_ID_CODE_MOTION_PLUS_NUNCHUK + || val == EXP_ID_CODE_MOTION_PLUS_CLASSIC) + { + /* handshake done */ + wm->event = WIIUSE_MOTION_PLUS_ACTIVATED; + + switch (val) + { + case EXP_ID_CODE_MOTION_PLUS: + wm->exp.type = EXP_MOTION_PLUS; + break; + + case EXP_ID_CODE_MOTION_PLUS_NUNCHUK: + wm->exp.type = EXP_MOTION_PLUS_NUNCHUK; + break; + + case EXP_ID_CODE_MOTION_PLUS_CLASSIC: + wm->exp.type = EXP_MOTION_PLUS_CLASSIC; + break; + + default: + /* huh? */ + WIIUSE_WARNING("Unknown ID returned in Motion+ handshake %d\n", val); + wm->exp.type = EXP_MOTION_PLUS; + break; + } + + WIIUSE_DEBUG("Motion plus connected"); + + /* Init gyroscopes */ + wm->exp.mp.cal_gyro.roll = 0; + wm->exp.mp.cal_gyro.pitch = 0; + wm->exp.mp.cal_gyro.yaw = 0; + wm->exp.mp.orient.roll = 0.0; + wm->exp.mp.orient.pitch = 0.0; + wm->exp.mp.orient.yaw = 0.0; + wm->exp.mp.raw_gyro_threshold = 10; + + wm->exp.mp.nc = &(wm->exp.nunchuk); + wm->exp.mp.classic = &(wm->exp.classic); + wm->exp.nunchuk.flags = &wm->flags; + + wm->exp.mp.ext = 0; + + wiiuse_set_ir_mode(wm); + wiiuse_set_report_type(wm); + } + } +} + +/** + * @brief Enable/disable Motion+ expansion + * + * @param wm Pointer to the wiimote with Motion+ + * @param status 0 - off, 1 - on, standalone, 2 - nunchuk pass-through + * + */ +void wiiuse_set_motion_plus(struct wiimote_t *wm, int status) +{ + byte buf[MAX_PAYLOAD]; + byte val; + int i; + + if (!WIIMOTE_IS_SET(wm, WIIMOTE_STATE_MPLUS_PRESENT) || WIIMOTE_IS_SET(wm, WIIMOTE_STATE_EXP_HANDSHAKE)) + { + return; + } + + if (status) + { + WIIUSE_DEBUG("Enabling Motion+\n"); + + WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_EXP_HANDSHAKE); + val = (status == 1) ? 0x04 : 0x05; + wiiuse_write_data(wm, WM_EXP_MOTION_PLUS_ENABLE, &val, 1); + + wiiuse_millisleep(500); /* wait for M+ switch over */ + wiiuse_motion_plus_handshake(wm, NULL, 0); + + } else + { + WIIUSE_DEBUG("Disabling Motion+\n"); + + disable_expansion(wm); + val = 0x55; + wiiuse_write_data(wm, WM_EXP_MEM_ENABLE1, &val, 1); + wiiuse_millisleep(500); /* wait for M+ switch over */ + + WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_EXP_FAILED); + WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_EXP_HANDSHAKE); + wiiuse_set_ir_mode(wm); + + /* + * try to ask for status 3 times, sometimes the first one(s) gives bad data + * and doesn't show expansions - likely because the device didn't settle yet + */ + for (i = 0; i < 3; ++i) + { + int rc = 0; + + WIIUSE_DEBUG("Asking for status, attempt %d ...\n", i); + wm->event = WIIUSE_CONNECT; + + do + { + wiiuse_status(wm); + rc = wiiuse_wait_report(wm, WM_RPT_CTRL_STATUS, buf, MAX_PAYLOAD, WIIUSE_READ_TIMEOUT); + } while (rc < 0); + + if (buf[3] != 0) + break; + + wiiuse_millisleep(500); + } + propagate_event(wm, WM_RPT_CTRL_STATUS, buf + 1); + } +} + +void motion_plus_disconnected(struct motion_plus_t *mp) +{ + WIIUSE_DEBUG("Motion plus disconnected"); + memset(mp, 0, sizeof(struct motion_plus_t)); +} + +void motion_plus_event(struct motion_plus_t *mp, int exp_type, byte *msg) +{ + /* + * Pass-through modes interleave data from the gyro + * with the expansion data. This extracts the tag + * determining which is which + */ + int isMPFrame = (1 << 1) & msg[5]; + mp->ext = msg[4] & 0x1; /* extension attached to pass-through port? */ + + if (mp->ext == 0 || isMPFrame) + { /* reading gyro frame */ + /* Check if the gyroscope is in fast or slow mode (0 if rotating fast, 1 if slow or still) */ + mp->acc_mode = ((msg[4] & 0x2) << 1) | ((msg[3] & 0x1) << 1) | ((msg[3] & 0x2) >> 1); + + mp->raw_gyro.roll = ((msg[4] & 0xFC) << 6) | msg[1]; + mp->raw_gyro.pitch = ((msg[5] & 0xFC) << 6) | msg[2]; + mp->raw_gyro.yaw = ((msg[3] & 0xFC) << 6) | msg[0]; + + /* First calibration */ + if ((mp->raw_gyro.roll > 5000) && (mp->raw_gyro.pitch > 5000) && (mp->raw_gyro.yaw > 5000) + && (mp->raw_gyro.roll < 0x3fff) && (mp->raw_gyro.pitch < 0x3fff) && (mp->raw_gyro.yaw < 0x3fff) + && !(mp->cal_gyro.roll) && !(mp->cal_gyro.pitch) && !(mp->cal_gyro.yaw)) + { + wiiuse_calibrate_motion_plus(mp); + } + + /* Calculate angular rates in deg/sec and performs some simple filtering */ + calculate_gyro_rates(mp); + } + + else + { + /* expansion frame */ + if (exp_type == EXP_MOTION_PLUS_NUNCHUK) + { + /* ok, this is nunchuck, re-encode it as regular nunchuck packet */ + + /* get button states */ + nunchuk_pressed_buttons(mp->nc, (msg[5] >> 2)); + + /* calculate joystick state */ + calc_joystick_state(&(mp->nc->js), msg[0], msg[1]); + + /* calculate orientation */ + mp->nc->accel.x = msg[2]; + mp->nc->accel.y = msg[3]; + mp->nc->accel.z = (msg[4] & 0xFE) | ((msg[5] >> 5) & 0x04); + + calculate_orientation(&(mp->nc->accel_calib), &(mp->nc->accel), &(mp->nc->orient), + NUNCHUK_IS_FLAG_SET(mp->nc, WIIUSE_SMOOTHING)); + + calculate_gforce(&(mp->nc->accel_calib), &(mp->nc->accel), &(mp->nc->gforce)); + + } + + else if (exp_type == EXP_MOTION_PLUS_CLASSIC) + { + WIIUSE_ERROR("Classic controller pass-through is not implemented!\n"); + } + + else + { + WIIUSE_ERROR("Unsupported mode passed to motion_plus_event() !\n"); + } + } +} + +/** + * @brief Calibrate the Motion Plus gyroscopes. + * + * @param mp Pointer to a motion_plus_t structure. + * + * This should be called only after receiving the first values + * from the Motion Plus. + */ +void wiiuse_calibrate_motion_plus(struct motion_plus_t *mp) +{ + mp->cal_gyro.roll = mp->raw_gyro.roll; + mp->cal_gyro.pitch = mp->raw_gyro.pitch; + mp->cal_gyro.yaw = mp->raw_gyro.yaw; + mp->orient.roll = 0.0; + mp->orient.pitch = 0.0; + mp->orient.yaw = 0.0; +} + +static void calculate_gyro_rates(struct motion_plus_t *mp) +{ + short int tmp_r, tmp_p, tmp_y; + float tmp_roll, tmp_pitch, tmp_yaw; + + /* We consider calibration data */ + tmp_r = mp->raw_gyro.roll - mp->cal_gyro.roll; + tmp_p = mp->raw_gyro.pitch - mp->cal_gyro.pitch; + tmp_y = mp->raw_gyro.yaw - mp->cal_gyro.yaw; + + /* We convert to degree/sec according to fast/slow mode */ + if (mp->acc_mode & 0x04) + { + tmp_roll = (float)tmp_r / 20.0f; + } else + { + tmp_roll = (float)tmp_r / 4.0f; + } + + if (mp->acc_mode & 0x02) + { + tmp_pitch = (float)tmp_p / 20.0f; + } else + { + tmp_pitch = (float)tmp_p / 4.0f; + } + + if (mp->acc_mode & 0x01) + { + tmp_yaw = (float)tmp_y / 20.0f; + } else + { + tmp_yaw = (float)tmp_y / 4.0f; + } + + /* Simple filtering */ + if (fabs(tmp_roll) < 0.5f) + { + tmp_roll = 0.0f; + } + if (fabs(tmp_pitch) < 0.5f) + { + tmp_pitch = 0.0f; + } + if (fabs(tmp_yaw) < 0.5f) + { + tmp_yaw = 0.0f; + } + + mp->angle_rate_gyro.roll = tmp_roll; + mp->angle_rate_gyro.pitch = tmp_pitch; + mp->angle_rate_gyro.yaw = tmp_yaw; +} diff --git a/lib/wiiuse/motion_plus.h b/lib/wiiuse/src/motion_plus.h similarity index 76% rename from lib/wiiuse/motion_plus.h rename to lib/wiiuse/src/motion_plus.h index 5aa7534d9..c6d877da8 100644 --- a/lib/wiiuse/motion_plus.h +++ b/lib/wiiuse/src/motion_plus.h @@ -41,17 +41,17 @@ extern "C" { #endif - /** @defgroup internal_mp Internal: MotionPlus */ - /** @{ */ - void motion_plus_disconnected(struct motion_plus_t* mp); +/** @defgroup internal_mp Internal: MotionPlus */ +/** @{ */ +void motion_plus_disconnected(struct motion_plus_t *mp); - void motion_plus_event(struct motion_plus_t* mp, int exp_type, byte* msg); +void motion_plus_event(struct motion_plus_t *mp, int exp_type, byte *msg); - void wiiuse_motion_plus_handshake(struct wiimote_t *wm, byte *data, unsigned short len); +void wiiuse_motion_plus_handshake(struct wiimote_t *wm, byte *data, unsigned short len); - void wiiuse_probe_motion_plus(struct wiimote_t *wm); +void wiiuse_probe_motion_plus(struct wiimote_t *wm); - /** @} */ +/** @} */ #ifdef __cplusplus } diff --git a/lib/wiiuse/src/nunchuk.c b/lib/wiiuse/src/nunchuk.c new file mode 100644 index 000000000..ca8c0577b --- /dev/null +++ b/lib/wiiuse/src/nunchuk.c @@ -0,0 +1,215 @@ +/* + * wiiuse + * + * Written By: + * Michael Laforest < para > + * Email: < thepara (--AT--) g m a i l [--DOT--] com > + * + * Copyright 2006-2007 + * + * This file is part of wiiuse. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * $Header$ + * + */ + +/** + * @file + * @brief Nunchuk expansion device. + */ + +#include "nunchuk.h" +#include "dynamics.h" /* for calc_joystick_state, etc */ +#include "events.h" /* for handshake_expansion */ + +#include /* for malloc */ +#include /* for memset */ + +/** + * @brief Handle the handshake data from the nunchuk. + * + * @param nc A pointer to a nunchuk_t structure. + * @param data The data read in from the device. + * @param len The length of the data block, in bytes. + * + * @return Returns 1 if handshake was successful, 0 if not. + */ +#define HANDSHAKE_BYTES_USED 14 +int nunchuk_handshake(struct wiimote_t *wm, struct nunchuk_t *nc, byte *data, unsigned short len) +{ + nc->btns = 0; + nc->btns_held = 0; + nc->btns_released = 0; + + /* set the smoothing to the same as the wiimote */ + nc->flags = &wm->flags; + nc->accel_calib.st_alpha = wm->accel_calib.st_alpha; + + if (data[0] == 0xFF || len < HANDSHAKE_BYTES_USED) + { + /* + * Sometimes the data returned here is not correct. + * This might happen because the wiimote is lagging + * behind our initialization sequence. + * To fix this just request the handshake again. + * + * Other times it's just the first 16 bytes are 0xFF, + * but since the next 16 bytes are the same, just use + * those. + */ + if (len < 17 || len < HANDSHAKE_BYTES_USED + 16 || data[16] == 0xFF) + { + /* get the calibration data */ + byte *handshake_buf = (byte *)malloc(EXP_HANDSHAKE_LEN * sizeof(byte)); + + WIIUSE_DEBUG("Nunchuk handshake appears invalid, trying again."); + wiiuse_read_data_cb(wm, handshake_expansion, handshake_buf, WM_EXP_MEM_CALIBR, EXP_HANDSHAKE_LEN); + + return 0; + } else + { + data += 16; + } + } + + nc->accel_calib.cal_zero.x = data[0]; + nc->accel_calib.cal_zero.y = data[1]; + nc->accel_calib.cal_zero.z = data[2]; + nc->accel_calib.cal_g.x = data[4]; + nc->accel_calib.cal_g.y = data[5]; + nc->accel_calib.cal_g.z = data[6]; + nc->js.max.x = data[8]; + nc->js.min.x = data[9]; + nc->js.center.x = data[10]; + nc->js.max.y = data[11]; + nc->js.min.y = data[12]; + nc->js.center.y = data[13]; + WIIUSE_DEBUG("Nunchuk calibration X: min %x, max %x, center %x Y: min %x, max %x, center %x", + nc->js.min.x, nc->js.max.x, nc->js.center.x, nc->js.min.y, nc->js.max.y, nc->js.center.y); + + /* If the calibration data makes no sense, fake it. */ + if (nc->js.max.x < nc->js.center.x) + { + nc->js.max.x = 255; + } + + if (nc->js.max.y < nc->js.center.y) + { + nc->js.max.y = 255; + } + + /* default the thresholds to the same as the wiimote */ + nc->orient_threshold = wm->orient_threshold; + nc->accel_threshold = wm->accel_threshold; + + /* handshake done */ + wm->exp.type = EXP_NUNCHUK; + +#ifdef WIIUSE_WIN32 + wm->timeout = WIIMOTE_DEFAULT_TIMEOUT; +#endif + + return 1; +} + +/** + * @brief The nunchuk disconnected. + * + * @param nc A pointer to a nunchuk_t structure. + */ +void nunchuk_disconnected(struct nunchuk_t *nc) { memset(nc, 0, sizeof(struct nunchuk_t)); } + +/** + * @brief Handle nunchuk event. + * + * @param nc A pointer to a nunchuk_t structure. + * @param msg The message specified in the event packet. + */ +void nunchuk_event(struct nunchuk_t *nc, byte *msg) +{ + + /* get button states */ + nunchuk_pressed_buttons(nc, msg[5]); + + /* calculate joystick state */ + calc_joystick_state(&nc->js, msg[0], msg[1]); + + /* calculate orientation */ + nc->accel.x = msg[2]; + nc->accel.y = msg[3]; + nc->accel.z = msg[4]; + + calculate_orientation(&nc->accel_calib, &nc->accel, &nc->orient, + NUNCHUK_IS_FLAG_SET(nc, WIIUSE_SMOOTHING)); + calculate_gforce(&nc->accel_calib, &nc->accel, &nc->gforce); +} + +/** + * @brief Find what buttons are pressed. + * + * @param nc Pointer to a nunchuk_t structure. + * @param msg The message byte specified in the event packet. + */ +void nunchuk_pressed_buttons(struct nunchuk_t *nc, byte now) +{ + /* message is inverted (0 is active, 1 is inactive) */ + now = ~now & NUNCHUK_BUTTON_ALL; + + /* pressed now & were pressed, then held */ + nc->btns_held = (now & nc->btns); + + /* were pressed or were held & not pressed now, then released */ + nc->btns_released = ((nc->btns | nc->btns_held) & ~now); + + /* buttons pressed now */ + nc->btns = now; +} + +/** + * @brief Set the orientation event threshold for the nunchuk. + * + * @param wm Pointer to a wiimote_t structure with a nunchuk attached. + * @param threshold The decimal place that should be considered a significant change. + * + * See wiiuse_set_orient_threshold() for details. + */ +void wiiuse_set_nunchuk_orient_threshold(struct wiimote_t *wm, float threshold) +{ + if (!wm) + { + return; + } + + wm->exp.nunchuk.orient_threshold = threshold; +} + +/** + * @brief Set the accelerometer event threshold for the nunchuk. + * + * @param wm Pointer to a wiimote_t structure with a nunchuk attached. + * @param threshold The decimal place that should be considered a significant change. + * + * See wiiuse_set_orient_threshold() for details. + */ +void wiiuse_set_nunchuk_accel_threshold(struct wiimote_t *wm, int threshold) +{ + if (!wm) + { + return; + } + + wm->exp.nunchuk.accel_threshold = threshold; +} diff --git a/lib/wiiuse/nunchuk.h b/lib/wiiuse/src/nunchuk.h similarity index 76% rename from lib/wiiuse/nunchuk.h rename to lib/wiiuse/src/nunchuk.h index 289a54627..dfa904e04 100644 --- a/lib/wiiuse/nunchuk.h +++ b/lib/wiiuse/src/nunchuk.h @@ -40,17 +40,16 @@ extern "C" { #endif +/** @defgroup internal_nunchuk Internal: Nunchuk */ +/** @{ */ +int nunchuk_handshake(struct wiimote_t *wm, struct nunchuk_t *nc, byte *data, unsigned short len); - /** @defgroup internal_nunchuk Internal: Nunchuk */ - /** @{ */ - int nunchuk_handshake(struct wiimote_t* wm, struct nunchuk_t* nc, byte* data, unsigned short len); +void nunchuk_disconnected(struct nunchuk_t *nc); - void nunchuk_disconnected(struct nunchuk_t* nc); +void nunchuk_event(struct nunchuk_t *nc, byte *msg); - void nunchuk_event(struct nunchuk_t* nc, byte* msg); - - void nunchuk_pressed_buttons(struct nunchuk_t* nc, byte now); - /** @} */ +void nunchuk_pressed_buttons(struct nunchuk_t *nc, byte now); +/** @} */ #ifdef __cplusplus } diff --git a/lib/wiiuse/os.h b/lib/wiiuse/src/os.h similarity index 61% rename from lib/wiiuse/os.h rename to lib/wiiuse/src/os.h index e77ebf921..e74d54e0f 100644 --- a/lib/wiiuse/os.h +++ b/lib/wiiuse/src/os.h @@ -40,22 +40,23 @@ extern "C" { #endif +/** @defgroup internal_io Internal: Platform-specific Device I/O */ +/** @{ */ +void wiiuse_init_platform_fields(struct wiimote_t *wm); +void wiiuse_cleanup_platform_fields(struct wiimote_t *wm); - /** @defgroup internal_io Internal: Platform-specific Device I/O */ - /** @{ */ - void wiiuse_init_platform_fields(struct wiimote_t* wm); - void wiiuse_cleanup_platform_fields(struct wiimote_t* wm); +int wiiuse_os_find(struct wiimote_t **wm, int max_wiimotes, int timeout); - int wiiuse_os_find(struct wiimote_t** wm, int max_wiimotes, int timeout); +int wiiuse_os_connect(struct wiimote_t **wm, int wiimotes); +void wiiuse_os_disconnect(struct wiimote_t *wm); - int wiiuse_os_connect(struct wiimote_t** wm, int wiimotes); - void wiiuse_os_disconnect(struct wiimote_t* wm); +int wiiuse_os_poll(struct wiimote_t **wm, int wiimotes); +/* buf[0] will be the report type, buf+1 the rest of the report */ +int wiiuse_os_read(struct wiimote_t *wm, byte *buf, int len); +int wiiuse_os_write(struct wiimote_t *wm, byte report_type, byte *buf, int len); - int wiiuse_os_poll(struct wiimote_t** wm, int wiimotes); - /* buf[0] will be the report type, buf+1 the rest of the report */ - int wiiuse_os_read(struct wiimote_t* wm, byte* buf, int len); - int wiiuse_os_write(struct wiimote_t* wm, byte report_type, byte* buf, int len); - /** @} */ +unsigned long wiiuse_os_ticks(); +/** @} */ #ifdef __cplusplus } diff --git a/lib/wiiuse/src/os_mac/os_mac.c b/lib/wiiuse/src/os_mac/os_mac.c new file mode 100644 index 000000000..e1d41de6e --- /dev/null +++ b/lib/wiiuse/src/os_mac/os_mac.c @@ -0,0 +1,48 @@ +/* + * wiiuse + * + * Written By: + * Michael Laforest < para > + * Email: < thepara (--AT--) g m a i l [--DOT--] com > + * + * Copyright 2006-2007 + * + * This file is part of wiiuse. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * $Header$ + * + */ + + +#include "../os.h" + +#ifdef __MACH__ + #include + #include +#endif + +unsigned long wiiuse_os_ticks() { + struct timespec ts; + clock_serv_t cclock; + mach_timespec_t mts; + host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock); + clock_get_time(cclock, &mts); + mach_port_deallocate(mach_task_self(), cclock); + ts.tv_sec = mts.tv_sec; + ts.tv_nsec = mts.tv_nsec; + unsigned long ms = 1000 * ts.tv_sec + ts.tv_nsec / 1e6; + return ms; +} diff --git a/lib/wiiuse/os_mac/os_mac.h b/lib/wiiuse/src/os_mac/os_mac.h similarity index 100% rename from lib/wiiuse/os_mac/os_mac.h rename to lib/wiiuse/src/os_mac/os_mac.h diff --git a/lib/wiiuse/os_mac/os_mac.m b/lib/wiiuse/src/os_mac/os_mac.m similarity index 100% rename from lib/wiiuse/os_mac/os_mac.m rename to lib/wiiuse/src/os_mac/os_mac.m diff --git a/lib/wiiuse/os_mac/os_mac_find.m b/lib/wiiuse/src/os_mac/os_mac_find.m similarity index 99% rename from lib/wiiuse/os_mac/os_mac_find.m rename to lib/wiiuse/src/os_mac/os_mac_find.m index 4107a3eff..4008a50d3 100644 --- a/lib/wiiuse/os_mac/os_mac_find.m +++ b/lib/wiiuse/src/os_mac/os_mac_find.m @@ -113,7 +113,7 @@ // refine search & set timeout [inquiry setSearchCriteria:kBluetoothServiceClassMajorAny majorDeviceClass:WM_DEV_MAJOR_CLASS - minorDeviceClass:WM_DEV_MINOR_CLASS]; + minorDeviceClass:kBluetoothDeviceClassMinorAny]; [inquiry setUpdateNewDeviceNames: NO]; if(timeout > 0) [inquiry setInquiryLength:timeout]; diff --git a/lib/wiiuse/os_mac/os_mac_interface.m b/lib/wiiuse/src/os_mac/os_mac_interface.m similarity index 100% rename from lib/wiiuse/os_mac/os_mac_interface.m rename to lib/wiiuse/src/os_mac/os_mac_interface.m diff --git a/lib/wiiuse/src/os_nix.c b/lib/wiiuse/src/os_nix.c new file mode 100644 index 000000000..8d69cbb0a --- /dev/null +++ b/lib/wiiuse/src/os_nix.c @@ -0,0 +1,461 @@ +/* + * wiiuse + * + * Written By: + * Michael Laforest < para > + * Email: < thepara (--AT--) g m a i l [--DOT--] com > + * + * Copyright 2006-2007 + * + * This file is part of wiiuse. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * $Header$ + * + */ + +/** + * @file + * @brief Handles device I/O for *nix. + */ + +#include "wiiuse_internal.h" /* for WM_RPT_CTRL_STATUS */ +#include "events.h" +#include "io.h" +#include "os.h" + +#ifdef WIIUSE_BLUEZ + +#include /* for ba2str, str2ba */ +#include /* for inquiry_info */ +#include /* for hci_get_route, hci_inquiry, etc */ +#include /* for sockaddr_l2 */ + +#include +#include +#include /* for perror */ +#include /* for memset */ +#include /* for connect, socket */ +#include /* for struct timeval */ +#include /* for clock_gettime */ +#include /* for close, write */ + +static int wiiuse_os_connect_single(struct wiimote_t *wm, char *address); + +int wiiuse_os_find(struct wiimote_t **wm, int max_wiimotes, int timeout) +{ + int device_id; + int device_sock; + inquiry_info scan_info_arr[128]; + inquiry_info *scan_info = scan_info_arr; + int found_devices; + int found_wiimotes; + int i = 0; + + /* reset all wiimote bluetooth device addresses */ + for (found_wiimotes = 0; found_wiimotes < max_wiimotes; ++found_wiimotes) + { + /* bacpy(&(wm[found_wiimotes]->bdaddr), BDADDR_ANY); */ + memset(&(wm[found_wiimotes]->bdaddr), 0, sizeof(bdaddr_t)); + } + found_wiimotes = 0; + + /* get the id of the first bluetooth device. */ + device_id = hci_get_route(NULL); + if (device_id < 0) + { + if (errno == ENODEV) + { + WIIUSE_ERROR("Could not detect a Bluetooth adapter!"); + } else + { + perror("hci_get_route"); + } + return 0; + } + + /* create a socket to the device */ + device_sock = hci_open_dev(device_id); + if (device_sock < 0) + { + perror("hci_open_dev"); + return 0; + } + + memset(&scan_info_arr, 0, sizeof(scan_info_arr)); + + /* scan for bluetooth devices for 'timeout' seconds */ + found_devices = hci_inquiry(device_id, timeout, 128, NULL, &scan_info, IREQ_CACHE_FLUSH); + if (found_devices < 0) + { + perror("hci_inquiry"); + close(device_sock); + return 0; + } + + WIIUSE_INFO("Found %i bluetooth device(s).", found_devices); + + /* display discovered devices */ + for (i = 0; (i < found_devices) && (found_wiimotes < max_wiimotes); ++i) + { + bool is_wiimote_regular = (scan_info[i].dev_class[0] == WM_DEV_CLASS_0) + && (scan_info[i].dev_class[1] == WM_DEV_CLASS_1) + && (scan_info[i].dev_class[2] == WM_DEV_CLASS_2); + + bool is_wiimote_plus = (scan_info[i].dev_class[0] == WM_PLUS_DEV_CLASS_0) + && (scan_info[i].dev_class[1] == WM_PLUS_DEV_CLASS_1) + && (scan_info[i].dev_class[2] == WM_PLUS_DEV_CLASS_2); + if (is_wiimote_regular || is_wiimote_plus) + { + /* found a device */ + ba2str(&scan_info[i].bdaddr, wm[found_wiimotes]->bdaddr_str); + + const char *str_type; + if (is_wiimote_regular) + { + wm[found_wiimotes]->type = WIIUSE_WIIMOTE_REGULAR; + str_type = " (regular wiimote)"; + } else if (is_wiimote_plus) + { + wm[found_wiimotes]->type = WIIUSE_WIIMOTE_MOTION_PLUS_INSIDE; + str_type = " (motion plus inside)"; + } + + WIIUSE_INFO("Found wiimote (type: %s) (%s) [id %i].", str_type, wm[found_wiimotes]->bdaddr_str, + wm[found_wiimotes]->unid); + + wm[found_wiimotes]->bdaddr = scan_info[i].bdaddr; + WIIMOTE_ENABLE_STATE(wm[found_wiimotes], WIIMOTE_STATE_DEV_FOUND); + ++found_wiimotes; + } + } + + close(device_sock); + return found_wiimotes; +} + +/** + * @see wiiuse_connect() + * @see wiiuse_os_connect_single() + */ +int wiiuse_os_connect(struct wiimote_t **wm, int wiimotes) +{ + int connected = 0; + int i = 0; + + for (; i < wiimotes; ++i) + { + if (!WIIMOTE_IS_SET(wm[i], WIIMOTE_STATE_DEV_FOUND)) + /* if the device address is not set, skip it */ + { + continue; + } + + if (wiiuse_os_connect_single(wm[i], NULL)) + { + ++connected; + } + } + + return connected; +} + +/** + * @brief Connect to a wiimote with a known address. + * + * @param wm Pointer to a wiimote_t structure. + * @param address The address of the device to connect to. + * If NULL, use the address in the struct set by wiiuse_os_find(). + * + * @return 1 on success, 0 on failure + */ +static int wiiuse_os_connect_single(struct wiimote_t *wm, char *address) +{ + struct sockaddr_l2 addr; + memset(&addr, 0, sizeof(addr)); + + if (!wm || WIIMOTE_IS_CONNECTED(wm)) + { + return 0; + } + + addr.l2_family = AF_BLUETOOTH; + bdaddr_t *bdaddr = &wm->bdaddr; + if (address) + /* use provided address */ + { + str2ba(address, &addr.l2_bdaddr); + } else + { + /** @todo this line doesn't make sense + bacmp(bdaddr, BDADDR_ANY);*/ + /* use address of device discovered */ + addr.l2_bdaddr = *bdaddr; + } + + /* + * OUTPUT CHANNEL + */ + wm->out_sock = socket(AF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP); + if (wm->out_sock == -1) + { + return 0; + } + + addr.l2_psm = htobs(WM_OUTPUT_CHANNEL); + + /* connect to wiimote */ + if (connect(wm->out_sock, (struct sockaddr *)&addr, sizeof(addr)) < 0) + { + perror("connect() output sock"); + return 0; + } + + /* + * INPUT CHANNEL + */ + wm->in_sock = socket(AF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP); + if (wm->in_sock == -1) + { + close(wm->out_sock); + wm->out_sock = -1; + return 0; + } + + addr.l2_psm = htobs(WM_INPUT_CHANNEL); + + /* connect to wiimote */ + if (connect(wm->in_sock, (struct sockaddr *)&addr, sizeof(addr)) < 0) + { + perror("connect() interrupt sock"); + close(wm->out_sock); + wm->out_sock = -1; + return 0; + } + + WIIUSE_INFO("Connected to wiimote [id %i].", wm->unid); + + /* do the handshake */ + WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_CONNECTED); + wiiuse_handshake(wm, NULL, 0); + + wiiuse_set_report_type(wm); + + return 1; +} + +void wiiuse_os_disconnect(struct wiimote_t *wm) +{ + if (!wm || WIIMOTE_IS_CONNECTED(wm)) + { + return; + } + + close(wm->out_sock); + close(wm->in_sock); + + wm->out_sock = -1; + wm->in_sock = -1; + wm->event = WIIUSE_NONE; + + WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_CONNECTED); + WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_HANDSHAKE); +} + +int wiiuse_os_poll(struct wiimote_t **wm, int wiimotes) +{ + int evnt; + struct timeval tv; + fd_set fds; + int r; + int i; + byte read_buffer[MAX_PAYLOAD]; + int highest_fd = -1; + + evnt = 0; + if (!wm) + { + return 0; + } + + /* block select() for 1/2000th of a second */ + tv.tv_sec = 0; + tv.tv_usec = 500; + + FD_ZERO(&fds); + + for (i = 0; i < wiimotes; ++i) + { + /* only poll it if it is connected */ + if (WIIMOTE_IS_SET(wm[i], WIIMOTE_STATE_CONNECTED)) + { + FD_SET(wm[i]->in_sock, &fds); + + /* find the highest fd of the connected wiimotes */ + if (wm[i]->in_sock > highest_fd) + { + highest_fd = wm[i]->in_sock; + } + } + + wm[i]->event = WIIUSE_NONE; + } + + if (highest_fd == -1) + /* nothing to poll */ + { + return 0; + } + + if (select(highest_fd + 1, &fds, NULL, NULL, &tv) == -1) + { + WIIUSE_ERROR("Unable to select() the wiimote interrupt socket(s)."); + perror("Error Details"); + return 0; + } + + /* check each socket for an event */ + for (i = 0; i < wiimotes; ++i) + { + /* if this wiimote is not connected, skip it */ + if (!WIIMOTE_IS_CONNECTED(wm[i])) + { + continue; + } + + if (FD_ISSET(wm[i]->in_sock, &fds)) + { + /* clear out the event buffer */ + memset(read_buffer, 0, sizeof(read_buffer)); + + /* clear out any old read data */ + clear_dirty_reads(wm[i]); + + /* read the pending message into the buffer */ + r = wiiuse_os_read(wm[i], read_buffer, sizeof(read_buffer)); + if (r > 0) + { + /* propagate the event */ + propagate_event(wm[i], read_buffer[0], read_buffer + 1); + evnt += (wm[i]->event != WIIUSE_NONE); + } else if (!WIIMOTE_IS_CONNECTED(wm[i])) + { + /* freshly disconnected */ + wm[i]->event = (r == 0) ? WIIUSE_DISCONNECT : WIIUSE_UNEXPECTED_DISCONNECT; + evnt++; + /* propagate the event: + Emit a controller-status type event. */ + propagate_event(wm[i], WM_RPT_CTRL_STATUS, 0); + } + } else + { + /* send out any waiting writes */ + wiiuse_send_next_pending_write_request(wm[i]); + idle_cycle(wm[i]); + } + } + + return evnt; +} + +int wiiuse_os_read(struct wiimote_t *wm, byte *buf, int len) +{ + int rc; + + rc = read(wm->in_sock, buf, len); + + if (rc == -1) + { + /* error reading data */ + WIIUSE_ERROR("Receiving wiimote data (id %i).", wm->unid); + perror("Error Details"); + + if (errno == ENOTCONN) + { + /* this can happen if the bluetooth dongle is disconnected */ + WIIUSE_ERROR("Bluetooth appears to be disconnected. Wiimote unid %i will be disconnected.", + wm->unid); + wiiuse_os_disconnect(wm); + wiiuse_disconnected(wm); + } + } else if (rc == 0) + { + /* remote disconnect */ + wiiuse_disconnected(wm); + } else + { + /* read successful */ + /* on *nix we ignore the first byte */ + memmove(buf, buf + 1, len - 1); + +/* log the received data */ +#ifdef WITH_WIIUSE_DEBUG + if (buf[0] != 0x30) + { /* hack for chatty Balance Boards that flood the logs with useless button reports */ + int i; + printf("[DEBUG] (id %i) RECV: (%.2x) ", wm->unid, buf[0]); + for (i = 1; i < rc; i++) + { + printf("%.2x ", buf[i]); + } + printf("\n"); + } +#endif + } + + return rc; +} + +int wiiuse_os_write(struct wiimote_t *wm, byte report_type, byte *buf, int len) +{ + int rc; + byte write_buffer[MAX_PAYLOAD]; + + write_buffer[0] = WM_SET_DATA | WM_BT_OUTPUT; + write_buffer[1] = report_type; + memcpy(write_buffer + 2, buf, len); + + rc = write(wm->in_sock, write_buffer, len + 2); + + if (rc < 0) + { + wiiuse_disconnected(wm); + } + + return rc; +} + +void wiiuse_init_platform_fields(struct wiimote_t *wm) +{ + memset(&(wm->bdaddr), 0, sizeof(bdaddr_t)); /* = *BDADDR_ANY;*/ + wm->out_sock = -1; + wm->in_sock = -1; +} + +void wiiuse_cleanup_platform_fields(struct wiimote_t *wm) +{ + wm->out_sock = -1; + wm->in_sock = -1; +} + +unsigned long wiiuse_os_ticks() +{ + struct timespec tp; + clock_gettime(CLOCK_REALTIME, &tp); + unsigned long ms = 1000 * tp.tv_sec + tp.tv_nsec / 1e6; + return ms; +} + +#endif /* ifdef WIIUSE_BLUEZ */ diff --git a/lib/wiiuse/src/os_win.c b/lib/wiiuse/src/os_win.c new file mode 100644 index 000000000..205ce9177 --- /dev/null +++ b/lib/wiiuse/src/os_win.c @@ -0,0 +1,440 @@ +/* + * wiiuse + * + * Written By: + * Michael Laforest < para > + * Email: < thepara (--AT--) g m a i l [--DOT--] com > + * + * Copyright 2006-2007 + * + * This file is part of wiiuse. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * $Header$ + * + */ + +/** + * @file + * @brief Handles device I/O for Windows. + */ + +#include + +#include "events.h" +#include "io.h" +#include "os.h" + +#ifdef WIIUSE_WIN32 +#include + +#include +#include + +#ifdef __MINGW32__ +/* this prototype is missing from the mingw headers so we must add it + or suffer linker errors. */ +#ifdef __cplusplus +extern "C" { +#endif +WINHIDSDI BOOL WINAPI HidD_SetOutputReport(HANDLE, PVOID, ULONG); +#ifdef __cplusplus +} +#endif +#endif + +static int clock_gettime(int X, struct timeval *tv); + +int wiiuse_os_find(struct wiimote_t **wm, int max_wiimotes, int timeout) +{ + GUID device_id; + HANDLE dev; + HDEVINFO device_info; + int i, index; + DWORD len; + SP_DEVICE_INTERFACE_DATA device_data; + PSP_DEVICE_INTERFACE_DETAIL_DATA detail_data = NULL; + HIDD_ATTRIBUTES attr; + int found = 0; + + (void)timeout; /* unused */ + + device_data.cbSize = sizeof(device_data); + index = 0; + + /* get the device id */ + HidD_GetHidGuid(&device_id); + + /* get all hid devices connected */ + device_info = SetupDiGetClassDevs(&device_id, NULL, NULL, (DIGCF_DEVICEINTERFACE | DIGCF_PRESENT)); + + for (;; ++index) + { + + if (detail_data) + { + free(detail_data); + detail_data = NULL; + } + + /* query the next hid device info */ + if (!SetupDiEnumDeviceInterfaces(device_info, NULL, &device_id, index, &device_data)) + { + break; + } + + /* get the size of the data block required */ + i = SetupDiGetDeviceInterfaceDetail(device_info, &device_data, NULL, 0, &len, NULL); + detail_data = (SP_DEVICE_INTERFACE_DETAIL_DATA_A *)malloc(len); + detail_data->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA); + + /* query the data for this device */ + if (!SetupDiGetDeviceInterfaceDetail(device_info, &device_data, detail_data, len, NULL, NULL)) + { + continue; + } + + /* open the device */ + dev = CreateFile(detail_data->DevicePath, (GENERIC_READ | GENERIC_WRITE), + (FILE_SHARE_READ | FILE_SHARE_WRITE), NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, + NULL); + if (dev == INVALID_HANDLE_VALUE) + { + continue; + } + + /* get device attributes */ + attr.Size = sizeof(attr); + i = HidD_GetAttributes(dev, &attr); + + if ((attr.VendorID == WM_VENDOR_ID) + && ((attr.ProductID == WM_PRODUCT_ID) || (attr.ProductID == WM_PRODUCT_ID_TR))) + { + /* this is a wiimote */ + wm[found]->dev_handle = dev; + + if (attr.ProductID == WM_PRODUCT_ID_TR) + wm[found]->type = WIIUSE_WIIMOTE_MOTION_PLUS_INSIDE; + + wm[found]->hid_overlap.hEvent = CreateEvent(NULL, 1, 1, ""); + wm[found]->hid_overlap.Offset = 0; + wm[found]->hid_overlap.OffsetHigh = 0; + + WIIMOTE_ENABLE_STATE(wm[found], WIIMOTE_STATE_DEV_FOUND); + WIIMOTE_ENABLE_STATE(wm[found], WIIMOTE_STATE_CONNECTED); + + /* try to set the output report to see if the device is actually connected */ + if (!wiiuse_set_report_type(wm[found])) + { + WIIMOTE_DISABLE_STATE(wm[found], WIIMOTE_STATE_CONNECTED); + continue; + } + + /* do the handshake */ + wiiuse_handshake(wm[found], NULL, 0); + + WIIUSE_INFO("Connected to wiimote [id %i].", wm[found]->unid); + + ++found; + if (found >= max_wiimotes) + { + break; + } + } else + { + /* not a wiimote */ + CloseHandle(dev); + } + } + + if (detail_data) + { + free(detail_data); + } + + SetupDiDestroyDeviceInfoList(device_info); + + return found; +} + +int wiiuse_os_connect(struct wiimote_t **wm, int wiimotes) +{ + int connected = 0; + int i = 0; + + for (; i < wiimotes; ++i) + { + if (!wm[i]) + { + continue; + } + if (WIIMOTE_IS_SET(wm[i], WIIMOTE_STATE_CONNECTED)) + { + ++connected; + } + } + + return connected; +} + +void wiiuse_os_disconnect(struct wiimote_t *wm) +{ + if (!wm || WIIMOTE_IS_CONNECTED(wm)) + { + return; + } + + CloseHandle(wm->dev_handle); + wm->dev_handle = 0; + + ResetEvent(&wm->hid_overlap); + + wm->event = WIIUSE_NONE; + + WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_CONNECTED); + WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_HANDSHAKE); +} + +int wiiuse_os_poll(struct wiimote_t **wm, int wiimotes) +{ + int i; + byte read_buffer[MAX_PAYLOAD]; + int evnt = 0; + + if (!wm) + { + return 0; + } + + for (i = 0; i < wiimotes; ++i) + { + wm[i]->event = WIIUSE_NONE; + + /* clear out the buffer */ + memset(read_buffer, 0, sizeof(read_buffer)); + /* read */ + if (wiiuse_os_read(wm[i], read_buffer, sizeof(read_buffer))) + { + /* propagate the event */ + propagate_event(wm[i], read_buffer[0], read_buffer + 1); + evnt += (wm[i]->event != WIIUSE_NONE); + } else + { + /* send out any waiting writes */ + wiiuse_send_next_pending_write_request(wm[i]); + idle_cycle(wm[i]); + } + } + + return evnt; +} + +int wiiuse_os_read(struct wiimote_t *wm, byte *buf, int len) +{ + DWORD b, r; + + if (!wm || !WIIMOTE_IS_CONNECTED(wm)) + { + return 0; + } + + if (!ReadFile(wm->dev_handle, buf, len, &b, &wm->hid_overlap)) + { + /* partial read */ + b = GetLastError(); + + if ((b == ERROR_HANDLE_EOF) || (b == ERROR_DEVICE_NOT_CONNECTED)) + { + /* remote disconnect */ + wiiuse_disconnected(wm); + return 0; + } + + r = WaitForSingleObject(wm->hid_overlap.hEvent, wm->timeout); + if (r == WAIT_TIMEOUT) + { + /* timeout - cancel and continue */ + + /* + if (*buf) { + WIIUSE_WARNING("Packet ignored. This may indicate a problem (timeout is %i + ms).", wm->timeout); + } + */ + + CancelIo(wm->dev_handle); + ResetEvent(wm->hid_overlap.hEvent); + return 0; + } else if (r == WAIT_FAILED) + { + WIIUSE_WARNING("A wait error occurred on reading from wiimote %i.", wm->unid); + return 0; + } + + if (!GetOverlappedResult(wm->dev_handle, &wm->hid_overlap, &b, 0)) + { + return 0; + } + +/* log the received data */ +#ifdef WITH_WIIUSE_DEBUG + { + DWORD i; + printf("[DEBUG] (id %i) RECV: (%.2x) ", wm->unid, buf[0]); + for (i = 1; i < b; i++) + { + printf("%.2x ", buf[i]); + } + printf("\n"); + } +#endif + } + + ResetEvent(wm->hid_overlap.hEvent); + return 1; +} + +int wiiuse_os_write(struct wiimote_t *wm, byte report_type, byte *buf, int len) +{ + DWORD bytes; + int i; + byte write_buffer[MAX_PAYLOAD]; + + if (!wm || !WIIMOTE_IS_CONNECTED(wm)) + { + return 0; + } + + write_buffer[0] = report_type; + memcpy(write_buffer + 1, buf, len); + + switch (wm->stack) + { + case WIIUSE_STACK_UNKNOWN: + { + /* try to auto-detect the stack type */ + if (i = WriteFile(wm->dev_handle, write_buffer, 22, &bytes, &wm->hid_overlap)) + { + /* bluesoleil will always return 1 here, even if it's not connected */ + wm->stack = WIIUSE_STACK_BLUESOLEIL; + return i; + } + + if (i = HidD_SetOutputReport(wm->dev_handle, write_buffer, len + 1)) + { + wm->stack = WIIUSE_STACK_MS; + return i; + } + + WIIUSE_ERROR("Unable to determine bluetooth stack type."); + return 0; + } + + case WIIUSE_STACK_MS: + return HidD_SetOutputReport(wm->dev_handle, write_buffer, len + 1); + + case WIIUSE_STACK_BLUESOLEIL: + return WriteFile(wm->dev_handle, write_buffer, 22, &bytes, &wm->hid_overlap); + } + + return 0; +} + +void wiiuse_init_platform_fields(struct wiimote_t *wm) +{ + wm->dev_handle = 0; + wm->stack = WIIUSE_STACK_UNKNOWN; + wm->normal_timeout = WIIMOTE_DEFAULT_TIMEOUT; + wm->exp_timeout = WIIMOTE_EXP_TIMEOUT; + wm->timeout = wm->normal_timeout; +} + +void wiiuse_cleanup_platform_fields(struct wiimote_t *wm) { wm->dev_handle = 0; } + +unsigned long wiiuse_os_ticks() +{ + unsigned long ms; + struct timeval tp; + + clock_gettime(0, &tp); + ms = (unsigned long)(1000 * tp.tv_sec + tp.tv_usec / 1e3); + return ms; +} + +/* code taken from http://stackoverflow.com/questions/5404277/porting-clock-gettime-to-windows/5404467#5404467 + */ +static LARGE_INTEGER getFILETIMEoffset() +{ + SYSTEMTIME s; + FILETIME f; + LARGE_INTEGER t; + + s.wYear = 1970; + s.wMonth = 1; + s.wDay = 1; + s.wHour = 0; + s.wMinute = 0; + s.wSecond = 0; + s.wMilliseconds = 0; + SystemTimeToFileTime(&s, &f); + t.QuadPart = f.dwHighDateTime; + t.QuadPart <<= 32; + t.QuadPart |= f.dwLowDateTime; + return (t); +} + +static int clock_gettime(int X, struct timeval *tv) +{ + LARGE_INTEGER t; + FILETIME f; + double microseconds; + static LARGE_INTEGER offset; + static double frequencyToMicroseconds; + static int initialized = 0; + static BOOL usePerformanceCounter = 0; + + if (!initialized) + { + LARGE_INTEGER performanceFrequency; + initialized = 1; + usePerformanceCounter = QueryPerformanceFrequency(&performanceFrequency); + if (usePerformanceCounter) + { + QueryPerformanceCounter(&offset); + frequencyToMicroseconds = (double)performanceFrequency.QuadPart / 1000000.; + } else + { + offset = getFILETIMEoffset(); + frequencyToMicroseconds = 10.; + } + } + if (usePerformanceCounter) + QueryPerformanceCounter(&t); + else + { + GetSystemTimeAsFileTime(&f); + t.QuadPart = f.dwHighDateTime; + t.QuadPart <<= 32; + t.QuadPart |= f.dwLowDateTime; + } + + t.QuadPart -= offset.QuadPart; + microseconds = (double)t.QuadPart / frequencyToMicroseconds; + t.QuadPart = (LONGLONG)microseconds; + tv->tv_sec = (long)t.QuadPart / 1000000; + tv->tv_usec = t.QuadPart % 1000000; + return (0); +} +#endif /* ifdef WIIUSE_WIN32 */ diff --git a/lib/wiiuse/util.c b/lib/wiiuse/src/util.c similarity index 81% rename from lib/wiiuse/util.c rename to lib/wiiuse/src/util.c index 4f6480e97..cf49100df 100644 --- a/lib/wiiuse/util.c +++ b/lib/wiiuse/src/util.c @@ -27,23 +27,18 @@ * @brief Provides platform-specific utility functions. */ - #include "wiiuse_internal.h" #ifdef WIIUSE_WIN32 #include -void wiiuse_millisleep(int durationMilliseconds) { - Sleep(durationMilliseconds); -} +void wiiuse_millisleep(int durationMilliseconds) { Sleep(durationMilliseconds); } #else /* not win32 - assuming posix */ -#include /* for usleep */ +#include /* for usleep */ -void wiiuse_millisleep(int durationMilliseconds) { - usleep(durationMilliseconds * 1000); -} +void wiiuse_millisleep(int durationMilliseconds) { usleep(durationMilliseconds * 1000); } #endif /* ifdef WIIUSE_WIN32 */ diff --git a/lib/wiiuse/src/wiiboard.c b/lib/wiiuse/src/wiiboard.c new file mode 100644 index 000000000..1c54938fe --- /dev/null +++ b/lib/wiiuse/src/wiiboard.c @@ -0,0 +1,166 @@ +/* + * wiiuse + * + * Written By: + * Michael Laforest < para > + * Email: < thepara (--AT--) g m a i l [--DOT--] com > + * + * Copyright 2006-2007 + * + * This file is part of wiiuse. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * $Header$ + * + */ + +/** + * @file + * @brief Wii Fit Balance Board device. + */ + +#include "wiiboard.h" +#include "io.h" + +#include /* for printf */ +#include /* for memset */ + +/** + * @brief Handle the handshake data from the wiiboard. + * + * @param wb A pointer to a wii_board_t structure. + * @param data The data read in from the device. + * @param len The length of the data block, in bytes. + * + * @return Returns 1 if handshake was successful, 0 if not. + */ + +int wii_board_handshake(struct wiimote_t *wm, struct wii_board_t *wb, byte *data, uint16_t len) +{ + byte *bufptr; + + /* + * read calibration + */ + wiiuse_read_data_sync(wm, 0, WM_EXP_MEM_CALIBR, EXP_HANDSHAKE_LEN, data); + +/* decode data */ +#ifdef WITH_WIIUSE_DEBUG + { + int i; + printf("DECRYPTED DATA WIIBOARD\n"); + for (i = 0; i < len; ++i) + { + if (i % 16 == 0) + { + if (i != 0) + { + printf("\n"); + } + + printf("%X: ", 0x4a40000 + 32 + i); + } + printf("%02X ", data[i]); + } + printf("\n"); + } +#endif + memset(wb, 0, sizeof(struct wii_board_t)); + + bufptr = data + 4; + wb->ctr[0] = unbuffer_big_endian_uint16_t(&bufptr); + wb->cbr[0] = unbuffer_big_endian_uint16_t(&bufptr); + wb->ctl[0] = unbuffer_big_endian_uint16_t(&bufptr); + wb->cbl[0] = unbuffer_big_endian_uint16_t(&bufptr); + + wb->ctr[1] = unbuffer_big_endian_uint16_t(&bufptr); + wb->cbr[1] = unbuffer_big_endian_uint16_t(&bufptr); + wb->ctl[1] = unbuffer_big_endian_uint16_t(&bufptr); + wb->cbl[1] = unbuffer_big_endian_uint16_t(&bufptr); + + wb->ctr[2] = unbuffer_big_endian_uint16_t(&bufptr); + wb->cbr[2] = unbuffer_big_endian_uint16_t(&bufptr); + wb->ctl[2] = unbuffer_big_endian_uint16_t(&bufptr); + wb->cbl[2] = unbuffer_big_endian_uint16_t(&bufptr); + + wb->use_alternate_report = 0; + + /* handshake done */ + wm->event = WIIUSE_WII_BOARD_CTRL_INSERTED; + wm->exp.type = EXP_WII_BOARD; + +#ifdef WIIUSE_WIN32 + wm->timeout = WIIMOTE_DEFAULT_TIMEOUT; +#endif + + return 1; +} + +/** + * @brief The wii board disconnected. + * + * @param cc A pointer to a wii_board_t structure. + */ +void wii_board_disconnected(struct wii_board_t *wb) { memset(wb, 0, sizeof(struct wii_board_t)); } + +static float do_interpolate(uint16_t raw, uint16_t cal[3]) +{ +#define WIIBOARD_MIDDLE_CALIB 17.0f + if (raw < cal[0]) + { + return 0.0f; + } else if (raw < cal[1]) + { + return ((float)(raw - cal[0]) * WIIBOARD_MIDDLE_CALIB) / (float)(cal[1] - cal[0]); + } else if (raw < cal[2]) + { + return ((float)(raw - cal[1]) * WIIBOARD_MIDDLE_CALIB) / (float)(cal[2] - cal[1]) + + WIIBOARD_MIDDLE_CALIB; + } else + { + return WIIBOARD_MIDDLE_CALIB * 2.0f; + } +} + +/** + * @brief Handle wii board event. + * + * @param wb A pointer to a wii_board_t structure. + * @param msg The message specified in the event packet. + */ +void wii_board_event(struct wii_board_t *wb, byte *msg) +{ + byte *bufPtr = msg; + + wb->rtr = unbuffer_big_endian_uint16_t(&bufPtr); + wb->rbr = unbuffer_big_endian_uint16_t(&bufPtr); + wb->rtl = unbuffer_big_endian_uint16_t(&bufPtr); + wb->rbl = unbuffer_big_endian_uint16_t(&bufPtr); + + /* + Interpolate values + Calculations borrowed from wiili.org - No names to mention sadly :( + http://www.wiili.org/index.php/Wii_Balance_Board_PC_Drivers page however! + */ + wb->tr = do_interpolate(wb->rtr, wb->ctr); + wb->tl = do_interpolate(wb->rtl, wb->ctl); + wb->br = do_interpolate(wb->rbr, wb->cbr); + wb->bl = do_interpolate(wb->rbl, wb->cbl); +} + +/** + @todo not implemented! +*/ +void wiiuse_set_wii_board_calib(struct wiimote_t *wm) {} diff --git a/lib/wiiuse/wiiboard.h b/lib/wiiuse/src/wiiboard.h similarity index 78% rename from lib/wiiuse/wiiboard.h rename to lib/wiiuse/src/wiiboard.h index e0d76167b..26d307ede 100644 --- a/lib/wiiuse/wiiboard.h +++ b/lib/wiiuse/src/wiiboard.h @@ -40,14 +40,14 @@ extern "C" { #endif - /** @defgroup internal_wiiboard Internal: Wii Balance Board */ - /** @{ */ - int wii_board_handshake(struct wiimote_t* wm, struct wii_board_t* wb, byte* data, uint16_t len); +/** @defgroup internal_wiiboard Internal: Wii Balance Board */ +/** @{ */ +int wii_board_handshake(struct wiimote_t *wm, struct wii_board_t *wb, byte *data, uint16_t len); - void wii_board_disconnected(struct wii_board_t* wb); +void wii_board_disconnected(struct wii_board_t *wb); - void wii_board_event(struct wii_board_t* wb, byte* msg); - /** @} */ +void wii_board_event(struct wii_board_t *wb, byte *msg); +/** @} */ #ifdef __cplusplus } #endif diff --git a/lib/wiiuse/src/wiiuse.c b/lib/wiiuse/src/wiiuse.c new file mode 100644 index 000000000..1e06280f1 --- /dev/null +++ b/lib/wiiuse/src/wiiuse.c @@ -0,0 +1,960 @@ +/* + * wiiuse + * + * Written By: + * Michael Laforest < para > + * Email: < thepara (--AT--) g m a i l [--DOT--] com > + * + * Copyright 2006-2007 + * + * This file is part of wiiuse. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * $Header$ + * + */ + +/** + * @file + * @brief General wiimote operations. + * + * The file includes functions that handle general + * tasks. Most of these are functions that are part + * of the API. + */ + +#include "io.h" /* for wiiuse_handshake, etc */ +#include "os.h" /* for wiiuse_os_* */ +#include "wiiuse_internal.h" + +#include /* for printf, FILE */ +#include /* for malloc, free */ +#include /* for memcpy, memset */ + +static int g_banner = 0; +static const char g_wiiuse_version_string[] = WIIUSE_VERSION; + +/** + * @brief Returns the version of the library. + */ +const char *wiiuse_version() { return g_wiiuse_version_string; } + +/** + * @brief Output FILE stream for each wiiuse_loglevel. + */ +FILE *logtarget[4]; + +/** + * @brief Specify an alternate FILE stream for a log level. + * + * @param loglevel The loglevel, for which the output should be set. + * + * @param logfile A valid, writeable FILE*, or 0, if output should be disabled. + * + * The default FILE* for all loglevels is stderr + */ +void wiiuse_set_output(enum wiiuse_loglevel loglevel, FILE *logfile) { logtarget[(int)loglevel] = logfile; } + +/** + * @brief Clean up wiimote_t array created by wiiuse_init() + */ +void wiiuse_cleanup(struct wiimote_t **wm, int wiimotes) +{ + int i = 0; + + if (!wm) + { + return; + } + + WIIUSE_INFO("wiiuse clean up..."); + + for (; i < wiimotes; ++i) + { + wiiuse_disconnect(wm[i]); + wiiuse_cleanup_platform_fields(wm[i]); + free(wm[i]); + } + + free(wm); + + return; +} + +/** + * @brief Initialize an array of wiimote structures. + * + * @param wiimotes Number of wiimote_t structures to create. + * + * @return An array of initialized wiimote_t structures. + * + * @see wiiuse_connect() + * + * The array returned by this function can be passed to various + * functions, including wiiuse_connect(). + */ +struct wiimote_t **wiiuse_init(int wiimotes) +{ + int i = 0; + struct wiimote_t **wm = NULL; + + /* + * Please do not remove this banner. + * GPL asks that you please leave output credits intact. + * Thank you. + * + * This banner is only displayed once so that if you need + * to call this function again it won't be intrusive. + * + * 2018: Replaced wiiuse.net with sourceforge project, since + * wiiuse.net is now abandoned and "parked". + */ + if (!g_banner) + { + printf("wiiuse v" WIIUSE_VERSION " loaded.\n" + " De-facto official fork at http://github.com/wiiuse/wiiuse\n" + " Original By: Michael Laforest \n"); + g_banner = 1; + } + + logtarget[0] = stderr; + logtarget[1] = stderr; + logtarget[2] = stderr; + logtarget[3] = stderr; + + if (!wiimotes) + { + return NULL; + } + + wm = (struct wiimote_t **)malloc(sizeof(struct wiimote_t *) * wiimotes); + + for (i = 0; i < wiimotes; ++i) + { + wm[i] = (struct wiimote_t *)malloc(sizeof(struct wiimote_t)); + memset(wm[i], 0, sizeof(struct wiimote_t)); + + wm[i]->unid = i + 1; + wiiuse_init_platform_fields(wm[i]); + + wm[i]->state = WIIMOTE_INIT_STATES; + wm[i]->flags = WIIUSE_INIT_FLAGS; + + wm[i]->event = WIIUSE_NONE; + + wm[i]->exp.type = EXP_NONE; + wm[i]->expansion_state = 0; + + wiiuse_set_aspect_ratio(wm[i], WIIUSE_ASPECT_4_3); + wiiuse_set_ir_position(wm[i], WIIUSE_IR_ABOVE); + + wm[i]->orient_threshold = 0.5f; + wm[i]->accel_threshold = 5; + + wm[i]->accel_calib.st_alpha = WIIUSE_DEFAULT_SMOOTH_ALPHA; + + wm[i]->type = WIIUSE_WIIMOTE_REGULAR; + } + + return wm; +} + +/** + * @brief The wiimote disconnected. + * + * @param wm Pointer to a wiimote_t structure. + */ +void wiiuse_disconnected(struct wiimote_t *wm) +{ + if (!wm) + { + return; + } + + WIIUSE_INFO("Wiimote disconnected [id %i].", wm->unid); + + /* disable the connected flag */ + WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_CONNECTED); + + /* reset a bunch of stuff */ + wm->leds = 0; + wm->state = WIIMOTE_INIT_STATES; + wm->read_req = NULL; +#ifndef WIIUSE_SYNC_HANDSHAKE + wm->handshake_state = 0; +#endif + wm->btns = 0; + wm->btns_held = 0; + wm->btns_released = 0; + + wm->event = WIIUSE_DISCONNECT; +} + +/** + * @brief Enable or disable the rumble. + * + * @param wm Pointer to a wiimote_t structure. + * @param status 1 to enable, 0 to disable. + */ +void wiiuse_rumble(struct wiimote_t *wm, int status) +{ + byte buf; + + if (!wm || !WIIMOTE_IS_CONNECTED(wm)) + { + return; + } + + /* make sure to keep the current lit leds */ + buf = wm->leds; + + if (status) + { + WIIUSE_DEBUG("Starting rumble..."); + WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_RUMBLE); + buf |= 0x01; + } else + { + WIIUSE_DEBUG("Stopping rumble..."); + WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_RUMBLE); + buf &= ~(0x01); + } + + /* preserve IR state */ + if (WIIMOTE_IS_SET(wm, WIIMOTE_STATE_IR)) + { + buf |= 0x04; + } + + wiiuse_send(wm, WM_CMD_RUMBLE, &buf, 1); +} + +/** + * @brief Toggle the state of the rumble. + * + * @param wm Pointer to a wiimote_t structure. + */ +void wiiuse_toggle_rumble(struct wiimote_t *wm) +{ + if (!wm) + { + return; + } + + wiiuse_rumble(wm, !WIIMOTE_IS_SET(wm, WIIMOTE_STATE_RUMBLE)); +} + +/** + * @brief Set the enabled LEDs. + * + * @param wm Pointer to a wiimote_t structure. + * @param leds What LEDs to enable. + * + * \a leds is a bitwise or of WIIMOTE_LED_1, WIIMOTE_LED_2, WIIMOTE_LED_3, or WIIMOTE_LED_4. + */ +void wiiuse_set_leds(struct wiimote_t *wm, int leds) +{ + byte buf; + + if (!wm || !WIIMOTE_IS_CONNECTED(wm)) + { + return; + } + + /* remove the lower 4 bits because they control rumble */ + wm->leds = (leds & 0xF0); + + /* make sure if the rumble is on that we keep it on */ + if (WIIMOTE_IS_SET(wm, WIIMOTE_STATE_RUMBLE)) + { + wm->leds |= 0x01; + } + + buf = wm->leds; + + wiiuse_send(wm, WM_CMD_LED, &buf, 1); +} + +/** + * @brief Set if the wiimote should report motion sensing. + * + * @param wm Pointer to a wiimote_t structure. + * @param status 1 to enable, 0 to disable. + * + * Since reporting motion sensing sends a lot of data, + * the wiimote saves power by not transmitting it + * by default. + */ +void wiiuse_motion_sensing(struct wiimote_t *wm, int status) +{ + if (status) + { + WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_ACC); + } else + { + WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_ACC); + } + + wiiuse_set_report_type(wm); +} + +/** + * @brief Set the report type based on the current wiimote state. + * + * @param wm Pointer to a wiimote_t structure. + * + * @return The report type sent. + * + * The wiimote reports formatted packets depending on the + * report type that was last requested. This function will + * update the type of report that should be sent based on + * the current state of the device. + */ +int wiiuse_set_report_type(struct wiimote_t *wm) +{ + + byte buf[2]; + int motion, exp, ir, balance_board; + + if (!wm || !WIIMOTE_IS_CONNECTED(wm)) + { + return 0; + } + + buf[0] = (WIIMOTE_IS_FLAG_SET(wm, WIIUSE_CONTINUOUS) ? 0x04 + : 0x00); /* set to 0x04 for continuous reporting */ + buf[1] = 0x00; + + /* if rumble is enabled, make sure we keep it */ + if (WIIMOTE_IS_SET(wm, WIIMOTE_STATE_RUMBLE)) + { + buf[0] |= 0x01; + } + + motion = WIIMOTE_IS_SET(wm, WIIMOTE_STATE_ACC); + exp = WIIMOTE_IS_SET(wm, WIIMOTE_STATE_EXP); + ir = WIIMOTE_IS_SET(wm, WIIMOTE_STATE_IR); + balance_board = exp && (wm->exp.type == EXP_WII_BOARD); + + if (motion && ir && exp) + { + buf[1] = WM_RPT_BTN_ACC_IR_EXP; + } else if (motion && exp) + { + buf[1] = WM_RPT_BTN_ACC_EXP; + } else if (motion && ir) + { + buf[1] = WM_RPT_BTN_ACC_IR; + } else if (ir && exp) + { + buf[1] = WM_RPT_BTN_IR_EXP; + } else if (ir) + { + buf[1] = WM_RPT_BTN_ACC_IR; + } else if (exp && balance_board) + { + if (wm->exp.wb.use_alternate_report) + buf[1] = WM_RPT_BTN_EXP_8; + else + buf[1] = WM_RPT_BTN_EXP; + } else if (exp) + { + buf[1] = WM_RPT_BTN_EXP; + } else if (motion) + { + buf[1] = WM_RPT_BTN_ACC; + } else + { + buf[1] = WM_RPT_BTN; + } + + WIIUSE_DEBUG("Setting report type: 0x%x", buf[1]); + + exp = wiiuse_send(wm, WM_CMD_REPORT_TYPE, buf, 2); + if (exp <= 0) + { + return exp; + } + + return buf[1]; +} + +/** + * @brief Read data from the wiimote (callback version). + * + * @param wm Pointer to a wiimote_t structure. + * @param read_cb Function pointer to call when the data arrives from the wiimote. + * @param buffer An allocated buffer to store the data as it arrives from the wiimote. + * Must be persistent in memory and large enough to hold the data. + * @param addr The address of wiimote memory to read from. + * @param len The length of the block to be read. + * + * The library can only handle one data read request at a time + * because it must keep track of the buffer and other + * events that are specific to that request. So if a request + * has already been made, subsequent requests will be added + * to a pending list and be sent out when the previous + * finishes. + */ +int wiiuse_read_data_cb(struct wiimote_t *wm, wiiuse_read_cb read_cb, byte *buffer, unsigned int addr, + uint16_t len) +{ + struct read_req_t *req; + + if (!wm || !WIIMOTE_IS_CONNECTED(wm)) + { + return 0; + } + if (!buffer || !len) + { + return 0; + } + + /* make this request structure */ + req = (struct read_req_t *)malloc(sizeof(struct read_req_t)); + if (req == NULL) + { + return 0; + } + req->cb = read_cb; + req->buf = buffer; + req->addr = addr; + req->size = len; + req->wait = len; + req->dirty = 0; + req->next = NULL; + + /* add this to the request list */ + if (!wm->read_req) + { + /* root node */ + wm->read_req = req; + + WIIUSE_DEBUG("Data read request can be sent out immediately."); + + /* send the request out immediately */ + wiiuse_send_next_pending_read_request(wm); + } else + { + struct read_req_t *nptr = wm->read_req; + for (; nptr->next; nptr = nptr->next) + { + ; + } + nptr->next = req; + + WIIUSE_DEBUG("Added pending data read request."); + } + + return 1; +} + +/** + * @brief Read data from the wiimote (event version). + * + * @param wm Pointer to a wiimote_t structure. + * @param buffer An allocated buffer to store the data as it arrives from the wiimote. + * Must be persistent in memory and large enough to hold the data. + * @param addr The address of wiimote memory to read from. + * @param len The length of the block to be read. + * + * The library can only handle one data read request at a time + * because it must keep track of the buffer and other + * events that are specific to that request. So if a request + * has already been made, subsequent requests will be added + * to a pending list and be sent out when the previous + * finishes. + */ +int wiiuse_read_data(struct wiimote_t *wm, byte *buffer, unsigned int addr, uint16_t len) +{ + return wiiuse_read_data_cb(wm, NULL, buffer, addr, len); +} + +/** + * @brief Send the next pending data read request to the wiimote. + * + * @param wm Pointer to a wiimote_t structure. + * + * @see wiiuse_read_data() + * + * This function is not part of the wiiuse API. + */ +void wiiuse_send_next_pending_read_request(struct wiimote_t *wm) +{ + byte buf[6]; + struct read_req_t *req; + + if (!wm || !WIIMOTE_IS_CONNECTED(wm)) + { + return; + } + if (!wm->read_req) + { + return; + } + + /* skip over dirty ones since they have already been read */ + req = wm->read_req; + while (req && req->dirty) + { + req = req->next; + } + if (!req) + { + return; + } + + /* the offset is in big endian */ + to_big_endian_uint32_t(buf, req->addr); + + /* the length is in big endian */ + to_big_endian_uint16_t(buf + 4, req->size); + + WIIUSE_DEBUG("Request read at address: 0x%x length: %i", req->addr, req->size); + wiiuse_send(wm, WM_CMD_READ_DATA, buf, 6); +} + +/** + * @brief Request the wiimote controller status. + * + * @param wm Pointer to a wiimote_t structure. + * + * Controller status includes: battery level, LED status, expansions + */ +void wiiuse_status(struct wiimote_t *wm) +{ + byte buf = 0; + + if (!wm || !WIIMOTE_IS_CONNECTED(wm)) + { + return; + } + + WIIUSE_DEBUG("Requested wiimote status."); + + wiiuse_send(wm, WM_CMD_CTRL_STATUS, &buf, 1); +} + +/** + * @brief Find a wiimote_t structure by its unique identifier. + * + * @param wm Pointer to a wiimote_t structure. + * @param wiimotes The number of wiimote_t structures in \a wm. + * @param unid The unique identifier to search for. + * + * @return Pointer to a wiimote_t structure, or NULL if not found. + */ +struct wiimote_t *wiiuse_get_by_id(struct wiimote_t **wm, int wiimotes, int unid) +{ + int i = 0; + if (!wm) + { + return NULL; + } + + for (; i < wiimotes; ++i) + { + if (!wm[i]) + { + continue; + } + if (wm[i]->unid == unid) + { + return wm[i]; + } + } + + return NULL; +} + +/** + * @brief Write data to the wiimote. + * + * @param wm Pointer to a wiimote_t structure. + * @param addr The address to write to. + * @param data The data to be written to the memory location. + * @param len The length of the block to be written. + */ +int wiiuse_write_data(struct wiimote_t *wm, unsigned int addr, const byte *data, byte len) +{ + byte buf[21] = {0}; /* the payload is always 23 */ + + byte *bufPtr = buf; + if (!wm || !WIIMOTE_IS_CONNECTED(wm)) + { + WIIUSE_ERROR("Attempt to write, but no wiimote available or not connected!"); + return 0; + } + if (!data || !len) + { + WIIUSE_ERROR("Attempt to write, but no data or length == 0"); + return 0; + } + + WIIUSE_DEBUG("Writing %i bytes to memory location 0x%x...", len, addr); + +#ifdef WITH_WIIUSE_DEBUG + { + int i = 0; + printf("Write data is: "); + for (; i < len; ++i) + { + printf("%x ", data[i]); + } + printf("\n"); + } +#endif + + /* the offset is in big endian */ + buffer_big_endian_uint32_t(&bufPtr, (uint32_t)addr); + + /* length */ + buffer_big_endian_uint8_t(&bufPtr, len); + + /* data */ + memcpy(bufPtr, data, len); + + wiiuse_send(wm, WM_CMD_WRITE_DATA, buf, 21); + return 1; +} + +/** + * @brief Write data to the wiimote (callback version). + * + * @param wm Pointer to a wiimote_t structure. + * @param addr The address to write to. + * @param data The data to be written to the memory location. + * @param len The length of the block to be written. + * @param cb Function pointer to call when the data arrives from the wiimote. + * + * The library can only handle one data read request at a time + * because it must keep track of the buffer and other + * events that are specific to that request. So if a request + * has already been made, subsequent requests will be added + * to a pending list and be sent out when the previous + * finishes. + */ +int wiiuse_write_data_cb(struct wiimote_t *wm, unsigned int addr, byte *data, byte len, + wiiuse_write_cb write_cb) +{ + struct data_req_t *req; + + if (!wm || !WIIMOTE_IS_CONNECTED(wm)) + { + return 0; + } + if (!data || !len) + { + return 0; + } + + req = (struct data_req_t *)malloc(sizeof(struct data_req_t)); + req->cb = write_cb; + req->len = len; + memcpy(req->data, data, req->len); + req->state = REQ_READY; + req->addr = addr; /* BIG_ENDIAN_LONG(addr); */ + req->next = NULL; + /* add this to the request list */ + if (!wm->data_req) + { + /* root node */ + wm->data_req = req; + + WIIUSE_DEBUG("Data write request can be sent out immediately."); + + /* send the request out immediately */ + wiiuse_send_next_pending_write_request(wm); + } else + { + struct data_req_t *nptr = wm->data_req; + WIIUSE_DEBUG("chaud2fois"); + for (; nptr->next; nptr = nptr->next) + { + ; + } + nptr->next = req; + + WIIUSE_DEBUG("Added pending data write request."); + } + + return 1; +} + +/** + * @brief Send the next pending data write request to the wiimote. + * + * @param wm Pointer to a wiimote_t structure. + * + * @see wiiuse_write_data() + * + * This function is not part of the wiiuse API. + */ +void wiiuse_send_next_pending_write_request(struct wiimote_t *wm) +{ + struct data_req_t *req; + + if (!wm || !WIIMOTE_IS_CONNECTED(wm)) + { + return; + } + req = wm->data_req; + if (!req) + { + return; + } + if (!req->len) + { + return; + } + if (req->state != REQ_READY) + { + return; + } + + wiiuse_write_data(wm, req->addr, req->data, req->len); + + req->state = REQ_SENT; + return; +} + +/** + * @brief Send a packet to the wiimote. + * + * @param wm Pointer to a wiimote_t structure. + * @param report_type The report type to send (WIIMOTE_CMD_LED, WIIMOTE_CMD_RUMBLE, etc). Found in + *wiiuse.h + * @param msg The payload. Might be changed by the callee. + * @param len Length of the payload in bytes. + * + * This function should replace any write()s directly to the wiimote device. + */ +int wiiuse_send(struct wiimote_t *wm, byte report_type, byte *msg, int len) +{ + switch (report_type) + { + case WM_CMD_LED: + case WM_CMD_RUMBLE: + case WM_CMD_CTRL_STATUS: + { + /* Rumble flag for: 0x11, 0x13, 0x14, 0x15, 0x19 or 0x1a */ + if (WIIMOTE_IS_SET(wm, WIIMOTE_STATE_RUMBLE)) + { + msg[0] |= 0x01; + } + break; + } + default: + break; + } + +#ifdef WITH_WIIUSE_DEBUG + { + int x; + printf("[DEBUG] (id %i) SEND: (%.2x) %.2x ", wm->unid, report_type, msg[0]); + for (x = 1; x < len; ++x) + { + printf("%.2x ", msg[x]); + } + printf("\n"); + } +#endif + + return wiiuse_os_write(wm, report_type, msg, len); +} + +/** + * @brief Set flags for the specified wiimote. + * + * @param wm Pointer to a wiimote_t structure. + * @param enable Flags to enable. + * @param disable Flags to disable. + * + * @return The flags set after 'enable' and 'disable' have been applied. + * + * The values 'enable' and 'disable' may be any flags OR'ed together. + * Flags are defined in wiiuse.h. + */ +int wiiuse_set_flags(struct wiimote_t *wm, int enable, int disable) +{ + if (!wm) + { + return 0; + } + + /* remove mutually exclusive flags */ + enable &= ~disable; + disable &= ~enable; + + wm->flags |= enable; + wm->flags &= ~disable; + + return wm->flags; +} + +/** + * @brief Set the wiimote smoothing alpha value. + * + * @param wm Pointer to a wiimote_t structure. + * @param alpha The alpha value to set. Between 0 and 1. + * + * @return Returns the old alpha value. + * + * The alpha value is between 0 and 1 and is used in an exponential + * smoothing algorithm. + * + * Smoothing is only performed if the WIIMOTE_USE_SMOOTHING is set. + */ +float wiiuse_set_smooth_alpha(struct wiimote_t *wm, float alpha) +{ + float old; + + if (!wm) + { + return 0.0f; + } + + old = wm->accel_calib.st_alpha; + + wm->accel_calib.st_alpha = alpha; + + /* if there is a nunchuk set that too */ + if (wm->exp.type == EXP_NUNCHUK) + { + wm->exp.nunchuk.accel_calib.st_alpha = alpha; + } + + return old; +} + +/** + * @brief Set the bluetooth stack type to use. + * + * @param wm Array of wiimote_t structures. + * @param wiimotes Number of objects in the wm array. + * @param type The type of bluetooth stack to use. + */ +void wiiuse_set_bluetooth_stack(struct wiimote_t **wm, int wiimotes, enum win_bt_stack_t type) +{ +#ifdef WIIUSE_WIN32 + int i; + + if (!wm) + { + return; + } + + for (i = 0; i < wiimotes; ++i) + { + wm[i]->stack = type; + } +#endif +} + +/** + * @brief Set the orientation event threshold. + * + * @param wm Pointer to a wiimote_t structure. + * @param threshold The decimal place that should be considered a significant change. + * + * If threshold is 0.01, and any angle changes by 0.01 then a significant change + * has occurred and the event callback will be invoked. If threshold is 1 then + * the angle has to change by a full degree to generate an event. + */ +void wiiuse_set_orient_threshold(struct wiimote_t *wm, float threshold) +{ + if (!wm) + { + return; + } + + wm->orient_threshold = threshold; +} + +/** + * @brief Set the accelerometer event threshold. + * + * @param wm Pointer to a wiimote_t structure. + * @param threshold The decimal place that should be considered a significant change. + */ +void wiiuse_set_accel_threshold(struct wiimote_t *wm, int threshold) +{ + if (!wm) + { + return; + } + + wm->accel_threshold = threshold; +} + +/** + * @brief Switch the Balance Board to use report 0x34 instead of 0x32 + * + * @param wm Pointer to a wiimote_t structure. + * @param enabled enabled != 0 -> use report 0x32 + */ +void wiiuse_wiiboard_use_alternate_report(struct wiimote_t *wm, int enabled) +{ + if (wm->exp.type == EXP_WII_BOARD) + { + wm->exp.wb.use_alternate_report = enabled; + wiiuse_set_report_type(wm); + } else + printf("Alternate report can be set only on a Balance Board!\n"); +} + +/** + * @brief Try to resync with the wiimote by starting a new handshake. + * + * @param wm Pointer to a wiimote_t structure. + */ +void wiiuse_resync(struct wiimote_t *wm) +{ + if (!wm) + { + return; + } + +#ifndef WIIUSE_SYNC_HANDSHAKE + wm->handshake_state = 0; +#endif + wiiuse_handshake(wm, NULL, 0); +} + +/** + * @brief Set the normal and expansion handshake timeouts. + * + * @param wm Array of wiimote_t structures. + * @param wiimotes Number of objects in the wm array. + * @param normal_timeout The timeout in milliseconds for a normal read. + * @param exp_timeout The timeout in millisecondsd to wait for an expansion handshake. + */ +void wiiuse_set_timeout(struct wiimote_t **wm, int wiimotes, byte normal_timeout, byte exp_timeout) +{ +#ifdef WIIUSE_WIN32 + int i; + + if (!wm) + { + return; + } + + for (i = 0; i < wiimotes; ++i) + { + wm[i]->normal_timeout = normal_timeout; + wm[i]->exp_timeout = exp_timeout; + } +#endif +} diff --git a/lib/wiiuse/src/wiiuse.h b/lib/wiiuse/src/wiiuse.h new file mode 100644 index 000000000..af64b6236 --- /dev/null +++ b/lib/wiiuse/src/wiiuse.h @@ -0,0 +1,967 @@ +/* + * wiiuse + * + * Written By: + * Michael Laforest < para > + * Email: < thepara (--AT--) g m a i l [--DOT--] com > + * + * Copyright 2006-2007 + * + * Mac fields based on wiic_structs.h from WiiC, written By: + * Gabriele Randelli + * Email: < randelli (--AT--) dis [--DOT--] uniroma1 [--DOT--] it > + * + * Copyright 2010 + * + * This file is part of wiiuse. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * $Header$ + * + */ + +/** + * @file + * + * @brief API header file. + * + * If this file is included from inside the wiiuse source + * and not from a third party program, then wiimote_internal.h + * is also included which extends this file. + */ + +/** + * @mainpage + * + * @section intro Introduction + * + * WiiUse is a cross-platform C library for accessing the Nintendo Wii + * Remote and its related expansions and variations. + * + * @section project Project + * + * This is a friendly fork of the original WiiUse project, which seems + * to have gone defunct. This updated version incorporates improvements + * from a number of internal forks found across the Internet, and is + * intended to be the new "upstream" of the project. The new homepage is + * on GitHub, where the source is maintained: + * + * - http://github.com/wiiuse/wiiuse + * + * Contributions (under the GPL 3+) are welcome and encouraged! + * + * @section publicapisec Public API + * + * - @ref publicapi "Public API" - entirely within @ref wiiuse.h + * - @ref wiimote "Wiimote device structure" + * + */ +#ifndef WIIUSE_H_INCLUDED +#define WIIUSE_H_INCLUDED + +#define WIIUSE_MAJOR 0 +#define WIIUSE_MINOR 15 +#define WIIUSE_MICRO 4 + +#define WIIUSE_VERSION_TRANSFORM(MAJ, MIN, MICRO) (MAJ * 1000000 + MIN * 1000 + MICRO) +#define WIIUSE_HAS_VERSION(MAJ, MIN, MICRO) \ + (WIIUSE_VERSION_TRANSFORM(MAJ, MIN, MICRO) \ + <= WIIUSE_VERSION_TRANSFORM(WIIUSE_MAJOR, WIIUSE_MINOR, WIIUSE_MICRO)) + +#ifndef WIIUSE_PLATFORM +#if defined(_WIN32) +#define WIIUSE_PLATFORM +#define WIIUSE_WIN32 +#elif defined(__linux) +#define WIIUSE_PLATFORM +#define WIIUSE_BLUEZ +#elif defined(__APPLE__) +#define WIIUSE_PLATFORM +#define WIIUSE_MAC +#else +#error "Platform not yet supported!" +#endif +#endif + +#ifdef WIIUSE_WIN32 +/* windows */ +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif +#include +#endif +#ifdef WIIUSE_BLUEZ +/* nix */ +#include +#endif + +#if defined(_MSC_VER) && _MSC_VER < 1700 +/* MS compilers of pre-VC2010 versions don't have stdint.h + * and I can't get VC2010's stdint.h to compile nicely in + * WiiUse + */ +#include "wiiuse_msvcstdint.h" +#else +#include +#endif + +#include /* for FILE */ + +/** @defgroup publicapi External API */ +/** @{ */ + +/** @name Wiimote state flags and macros */ +/** @{ */ +#define WIIMOTE_STATE_DEV_FOUND 0x0001 +#define WIIMOTE_STATE_HANDSHAKE 0x0002 /* actual connection exists but no handshake yet */ +#define WIIMOTE_STATE_HANDSHAKE_COMPLETE 0x0004 /* actual connection exists but no handshake yet */ +#define WIIMOTE_STATE_CONNECTED 0x0008 +#define WIIMOTE_STATE_RUMBLE 0x0010 +#define WIIMOTE_STATE_ACC 0x0020 +#define WIIMOTE_STATE_EXP 0x0040 +#define WIIMOTE_STATE_IR 0x0080 +#define WIIMOTE_STATE_SPEAKER 0x0100 +#define WIIMOTE_STATE_IR_SENS_LVL1 0x0200 +#define WIIMOTE_STATE_IR_SENS_LVL2 0x0400 +#define WIIMOTE_STATE_IR_SENS_LVL3 0x0800 +#define WIIMOTE_STATE_IR_SENS_LVL4 0x1000 +#define WIIMOTE_STATE_IR_SENS_LVL5 0x2000 +#define WIIMOTE_STATE_EXP_HANDSHAKE 0x10000 /* actual M+ connection exists but no handshake yet */ +#define WIIMOTE_STATE_EXP_EXTERN 0x20000 /* actual M+ connection exists but handshake failed */ +#define WIIMOTE_STATE_EXP_FAILED 0x40000 /* actual M+ connection exists but handshake failed */ +#define WIIMOTE_STATE_MPLUS_PRESENT 0x80000 /* Motion+ is connected */ + +#define WIIMOTE_ID(wm) (wm->unid) + +#define WIIMOTE_IS_SET(wm, s) ((wm->state & (s)) == (s)) +#define WIIMOTE_IS_CONNECTED(wm) (WIIMOTE_IS_SET(wm, WIIMOTE_STATE_CONNECTED)) +/** @} */ + +/** @name LED bit masks */ +/** @{ */ +#define WIIMOTE_LED_NONE 0x00 +#define WIIMOTE_LED_1 0x10 +#define WIIMOTE_LED_2 0x20 +#define WIIMOTE_LED_3 0x40 +#define WIIMOTE_LED_4 0x80 +/** @} */ + +/** @name Button codes */ +/** @{ */ +#define WIIMOTE_BUTTON_TWO 0x0001 +#define WIIMOTE_BUTTON_ONE 0x0002 +#define WIIMOTE_BUTTON_B 0x0004 +#define WIIMOTE_BUTTON_A 0x0008 +#define WIIMOTE_BUTTON_MINUS 0x0010 +#define WIIMOTE_BUTTON_ZACCEL_BIT6 0x0020 +#define WIIMOTE_BUTTON_ZACCEL_BIT7 0x0040 +#define WIIMOTE_BUTTON_HOME 0x0080 +#define WIIMOTE_BUTTON_LEFT 0x0100 +#define WIIMOTE_BUTTON_RIGHT 0x0200 +#define WIIMOTE_BUTTON_DOWN 0x0400 +#define WIIMOTE_BUTTON_UP 0x0800 +#define WIIMOTE_BUTTON_PLUS 0x1000 +#define WIIMOTE_BUTTON_ZACCEL_BIT4 0x2000 +#define WIIMOTE_BUTTON_ZACCEL_BIT5 0x4000 +#define WIIMOTE_BUTTON_UNKNOWN 0x8000 +#define WIIMOTE_BUTTON_ALL 0x1F9F +/** @} */ + +/** @name Nunchuk button codes */ +/** @{ */ +#define NUNCHUK_BUTTON_Z 0x01 +#define NUNCHUK_BUTTON_C 0x02 +#define NUNCHUK_BUTTON_ALL 0x03 +/** @} */ + +/** @name Classic controller button codes */ +/** @{ */ +#define CLASSIC_CTRL_BUTTON_UP 0x0001 +#define CLASSIC_CTRL_BUTTON_LEFT 0x0002 +#define CLASSIC_CTRL_BUTTON_ZR 0x0004 +#define CLASSIC_CTRL_BUTTON_X 0x0008 +#define CLASSIC_CTRL_BUTTON_A 0x0010 +#define CLASSIC_CTRL_BUTTON_Y 0x0020 +#define CLASSIC_CTRL_BUTTON_B 0x0040 +#define CLASSIC_CTRL_BUTTON_ZL 0x0080 +#define CLASSIC_CTRL_BUTTON_FULL_R 0x0200 +#define CLASSIC_CTRL_BUTTON_PLUS 0x0400 +#define CLASSIC_CTRL_BUTTON_HOME 0x0800 +#define CLASSIC_CTRL_BUTTON_MINUS 0x1000 +#define CLASSIC_CTRL_BUTTON_FULL_L 0x2000 +#define CLASSIC_CTRL_BUTTON_DOWN 0x4000 +#define CLASSIC_CTRL_BUTTON_RIGHT 0x8000 +#define CLASSIC_CTRL_BUTTON_ALL 0xFEFF +/** @} */ + +/** @name Guitar Hero 3 button codes */ +/** @{ */ +#define GUITAR_HERO_3_BUTTON_STRUM_UP 0x0001 +#define GUITAR_HERO_3_BUTTON_YELLOW 0x0008 +#define GUITAR_HERO_3_BUTTON_GREEN 0x0010 +#define GUITAR_HERO_3_BUTTON_BLUE 0x0020 +#define GUITAR_HERO_3_BUTTON_RED 0x0040 +#define GUITAR_HERO_3_BUTTON_ORANGE 0x0080 +#define GUITAR_HERO_3_BUTTON_PLUS 0x0400 +#define GUITAR_HERO_3_BUTTON_MINUS 0x1000 +#define GUITAR_HERO_3_BUTTON_STRUM_DOWN 0x4000 +#define GUITAR_HERO_3_BUTTON_ALL 0xFEFF +/** @} */ + +/** @name Wiimote option flags */ +/** @{ */ +#define WIIUSE_SMOOTHING 0x01 +#define WIIUSE_CONTINUOUS 0x02 +#define WIIUSE_ORIENT_THRESH 0x04 +#define WIIUSE_INIT_FLAGS (WIIUSE_SMOOTHING | WIIUSE_ORIENT_THRESH) + +#define WIIUSE_ORIENT_PRECISION 100.0f +/** @} */ + +/** @name Expansion codes */ +/** @{ */ +#define EXP_NONE 0 +#define EXP_NUNCHUK 1 +#define EXP_CLASSIC 2 +#define EXP_GUITAR_HERO_3 3 +#define EXP_WII_BOARD 4 +#define EXP_MOTION_PLUS 5 +#define EXP_MOTION_PLUS_NUNCHUK 6 /* Motion+ in nunchuk pass-through mode */ +#define EXP_MOTION_PLUS_CLASSIC 7 /* Motion+ in classic ctr. pass-through mode */ +/** @} */ + +/** @brief IR correction types */ +typedef enum ir_position_t { WIIUSE_IR_ABOVE, WIIUSE_IR_BELOW } ir_position_t; + +/** @name Device Inquiry Macros */ +/** @{ */ +/** + * @brief Check if a button is pressed. + * @param dev Pointer to a wiimote_t or expansion structure. + * @param button The button you are interested in. + * @return 1 if the button is pressed, 0 if not. + */ +#define IS_PRESSED(dev, button) ((dev->btns & button) == button) + +/** + * @brief Check if a button is being held. + * @param dev Pointer to a wiimote_t or expansion structure. + * @param button The button you are interested in. + * @return 1 if the button is held, 0 if not. + */ +#define IS_HELD(dev, button) ((dev->btns_held & button) == button) + +/** + * @brief Check if a button is released on this event. \n\n + * This does not mean the button is not pressed, it means \n + * this button was just now released. + * @param dev Pointer to a wiimote_t or expansion structure. + * @param button The button you are interested in. + * @return 1 if the button is released, 0 if not. + * + */ +#define IS_RELEASED(dev, button) ((dev->btns_released & button) == button) + +/** + * @brief Check if a button has just been pressed this event. + * @param dev Pointer to a wiimote_t or expansion structure. + * @param button The button you are interested in. + * @return 1 if the button is pressed, 0 if not. + */ +#define IS_JUST_PRESSED(dev, button) (IS_PRESSED(dev, button) && !IS_HELD(dev, button)) + +/** + * @brief Return the IR sensitivity level. + * @param wm Pointer to a wiimote_t structure. + * @param lvl [out] Pointer to an int that will hold the level setting. + * If no level is set 'lvl' will be set to 0. + */ +#define WIIUSE_GET_IR_SENSITIVITY(wm, lvl) \ + do \ + { \ + if ((wm->state & 0x0200) == 0x0200) \ + *lvl = 1; \ + else if ((wm->state & 0x0400) == 0x0400) \ + *lvl = 2; \ + else if ((wm->state & 0x0800) == 0x0800) \ + *lvl = 3; \ + else if ((wm->state & 0x1000) == 0x1000) \ + *lvl = 4; \ + else if ((wm->state & 0x2000) == 0x2000) \ + *lvl = 5; \ + else \ + *lvl = 0; \ + } while (0) + +#define WIIUSE_USING_ACC(wm) ((wm->state & 0x020) == 0x020) +#define WIIUSE_USING_EXP(wm) ((wm->state & 0x040) == 0x040) +#define WIIUSE_USING_IR(wm) ((wm->state & 0x080) == 0x080) +#define WIIUSE_USING_SPEAKER(wm) ((wm->state & 0x100) == 0x100) + +#define WIIUSE_IS_LED_SET(wm, num) ((wm->leds & WIIMOTE_LED_##num) == WIIMOTE_LED_##num) +/** @} */ + +/* + * This is left over from an old hack, but it may actually + * be a useful feature to keep so it wasn't removed. + */ +#ifdef WIIUSE_WIN32 +#define WIIMOTE_DEFAULT_TIMEOUT 10 +#define WIIMOTE_EXP_TIMEOUT 10 +#endif + +#define WIIUSE_SYNC_HANDSHAKE + +typedef unsigned char byte; +typedef char sbyte; + +struct wiimote_t; +struct vec3b_t; +struct orient_t; +struct gforce_t; + +/** + * @brief Callback that handles a read event. + * + * @param wm Pointer to a wiimote_t structure. + * @param data Pointer to the filled data block. + * @param len Length in bytes of the data block. + * + * @see wiiuse_init() + * + * A registered function of this type is called automatically by the wiiuse + * library when the wiimote has returned the full data requested by a previous + * call to wiiuse_read_data(). + */ +typedef void (*wiiuse_read_cb)(struct wiimote_t *wm, byte *data, uint16_t len); + +/** + * @brief Data read request structure. + */ +struct read_req_t +{ + wiiuse_read_cb cb; /**< read data callback + */ + byte *buf; /**< buffer where read data is written */ + uint32_t addr; /**< the offset that the read started at */ + uint16_t size; /**< the length of the data read */ + uint16_t wait; /**< num bytes still needed to finish read */ + byte dirty; /**< set to 1 if not using callback and needs to be cleaned up */ + + struct read_req_t + *next; /**< next read request in the queue */ +}; + +/** + * @struct ang3s_t + * @brief Roll/Pitch/Yaw short angles. + */ +typedef struct ang3s_t +{ + int16_t roll, pitch, yaw; +} ang3s_t; + +/** + * @struct ang3f_t + * @brief Roll/Pitch/Yaw float angles. + */ +typedef struct ang3f_t +{ + float roll, pitch, yaw; +} ang3f_t; + +/** + * @brief Unsigned x,y byte vector. + */ +typedef struct vec2b_t +{ + byte x, y; +} vec2b_t; + +/** + * @brief Unsigned x,y,z byte vector. + */ +typedef struct vec3b_t +{ + byte x, y, z; +} vec3b_t; + +/** + * @brief Signed x,y,z float struct. + */ +typedef struct vec3f_t +{ + float x, y, z; +} vec3f_t; + +/** + * @brief Orientation struct. + * + * Yaw, pitch, and roll range from -180 to 180 degrees. + */ +typedef struct orient_t +{ + float roll; /**< roll, this may be smoothed if enabled */ + float pitch; /**< pitch, this may be smoothed if enabled */ + float yaw; + + float a_roll; /**< absolute roll, unsmoothed */ + float a_pitch; /**< absolute pitch, unsmoothed */ +} orient_t; + +/** + * @brief Gravity force struct. + */ +typedef struct gforce_t +{ + float x, y, z; +} gforce_t; + +/** + * @brief Accelerometer struct. For any device with an accelerometer. + */ +typedef struct accel_t +{ + struct vec3b_t cal_zero; /**< zero calibration */ + struct vec3b_t cal_g; /**< 1g difference around 0cal */ + + float st_roll; /**< last smoothed roll value */ + float st_pitch; /**< last smoothed roll pitch */ + float st_alpha; /**< alpha value for smoothing [0-1] */ +} accel_t; + +/** + * @brief A single IR source. + */ +typedef struct ir_dot_t +{ + byte visible; /**< if the IR source is visible */ + + unsigned int x; /**< interpolated X coordinate */ + unsigned int y; /**< interpolated Y coordinate */ + + int16_t rx; /**< raw X coordinate (0-1023) */ + int16_t ry; /**< raw Y coordinate (0-767) */ + + byte order; /**< increasing order by x-axis value */ + + byte size; /**< size of the IR dot (0-15) */ +} ir_dot_t; + +/** + * @brief Screen aspect ratio. + */ +typedef enum aspect_t { WIIUSE_ASPECT_4_3, WIIUSE_ASPECT_16_9 } aspect_t; + +/** + * @brief IR struct. Hold all data related to the IR tracking. + */ +typedef struct ir_t +{ + struct ir_dot_t dot[4]; /**< IR dots */ + byte num_dots; /**< number of dots at this time */ + + enum aspect_t aspect; /**< aspect ratio of the screen */ + + enum ir_position_t pos; /**< IR sensor bar position */ + + unsigned int vres[2]; /**< IR virtual screen resolution */ + int offset[2]; /**< IR XY correction offset */ + int state; /**< keeps track of the IR state */ + + int ax; /**< absolute X coordinate */ + int ay; /**< absolute Y coordinate */ + + int x; /**< calculated X coordinate */ + int y; /**< calculated Y coordinate */ + + float distance; /**< pixel distance between first 2 dots*/ + float z; /**< calculated distance */ +} ir_t; + +/** + * @brief Joystick calibration structure. + * + * The angle \a ang is relative to the positive y-axis into quadrant I + * and ranges from 0 to 360 degrees. So if the joystick is held straight + * upwards then angle is 0 degrees. If it is held to the right it is 90, + * down is 180, and left is 270. + * + * The magnitude \a mag is the distance from the center to where the + * joystick is being held. The magnitude ranges from 0 to 1. + * If the joystick is only slightly tilted from the center the magnitude + * will be low, but if it is closer to the outter edge the value will + * be higher. + */ +typedef struct joystick_t +{ + struct vec2b_t max; /**< maximum joystick values */ + struct vec2b_t min; /**< minimum joystick values */ + struct vec2b_t center; /**< center joystick values */ + + float ang; /**< angle the joystick is being held */ + float mag; /**< magnitude of the joystick (range 0-1) */ + float x; /**< horizontal position of the joystick (range [-1, 1] */ + float y; /**< vertical position of the joystick (range [-1, 1] */ +} joystick_t; + +/** + * @brief Nunchuk expansion device. + */ +typedef struct nunchuk_t +{ + struct accel_t accel_calib; /**< nunchuk accelerometer calibration */ + struct joystick_t js; /**< joystick calibration */ + + int *flags; /**< options flag (points to wiimote_t.flags) */ + + byte btns; /**< what buttons have just been pressed */ + byte btns_held; /**< what buttons are being held down */ + byte btns_released; /**< what buttons were just released this */ + + float orient_threshold; /**< threshold for orient to generate an event */ + int accel_threshold; /**< threshold for accel to generate an event */ + + struct vec3b_t accel; /**< current raw acceleration data */ + struct orient_t orient; /**< current orientation on each axis */ + struct gforce_t gforce; /**< current gravity forces on each axis */ +} nunchuk_t; + +/** + * @brief Classic controller expansion device. + */ +typedef struct classic_ctrl_t +{ + int16_t btns; /**< what buttons have just been pressed */ + int16_t btns_held; /**< what buttons are being held down */ + int16_t btns_released; /**< what buttons were just released this */ + + float r_shoulder; /**< right shoulder button (range 0-1) */ + float l_shoulder; /**< left shoulder button (range 0-1) */ + + struct joystick_t ljs; /**< left joystick calibration */ + struct joystick_t rjs; /**< right joystick calibration */ +} classic_ctrl_t; + +/** + * @brief Guitar Hero 3 expansion device. + */ +typedef struct guitar_hero_3_t +{ + int16_t btns; /**< what buttons have just been pressed */ + int16_t btns_held; /**< what buttons are being held down */ + int16_t btns_released; /**< what buttons were just released this */ + + float whammy_bar; /**< whammy bar (range 0-1) */ + + struct joystick_t js; /**< joystick calibration */ +} guitar_hero_3_t; + +/** + * @brief Motion Plus expansion device + */ +typedef struct motion_plus_t +{ + byte ext; /**< is there a device on the pass-through port? */ + + struct ang3s_t raw_gyro; /**< current raw gyroscope data */ + struct ang3s_t cal_gyro; /**< calibration raw gyroscope data */ + struct ang3f_t angle_rate_gyro; /**< current gyro angle rate */ + struct orient_t orient; /**< current orientation on each axis using Motion Plus gyroscopes */ + byte acc_mode; /**< Fast/slow rotation mode for roll, pitch and yaw (0 if rotating fast, 1 if slow or + still) */ + int raw_gyro_threshold; /**< threshold for gyroscopes to generate an event */ + + struct nunchuk_t *nc; /**< pointers to nunchuk & classic in pass-through-mode */ + struct classic_ctrl_t *classic; +} motion_plus_t; + +/** + * @brief Wii Balance Board "expansion" device. + * + * A Balance Board presents itself as a Wiimote with a permanently-attached + * Balance Board expansion device. + */ +typedef struct wii_board_t +{ + /** @name Interpolated weight per sensor (kg) + * + * These are the values you're most likely to use. + * + * See example.c for how to compute total weight and center of gravity + * from these values. + */ + /** @{ */ + float tl; + float tr; + float bl; + float br; + /** @} */ + + /** @name Raw sensor values */ + /** @{ */ + uint16_t rtl; + uint16_t rtr; + uint16_t rbl; + uint16_t rbr; + /** @} */ + + /** @name Sensor calibration values */ + /** @{ */ + uint16_t ctl[3]; /* Calibration */ + uint16_t ctr[3]; + uint16_t cbl[3]; + uint16_t cbr[3]; /* /Calibration */ + /** @} */ + uint8_t update_calib; + uint8_t use_alternate_report; +} wii_board_t; + +/** + * @brief Generic expansion device plugged into wiimote. + */ +typedef struct expansion_t +{ + int type; /**< type of expansion attached */ + + struct motion_plus_t mp; + + union + { + struct nunchuk_t nunchuk; + struct classic_ctrl_t classic; + struct guitar_hero_3_t gh3; + struct wii_board_t wb; + }; +} expansion_t; + +/** + * @brief Available bluetooth stacks for Windows. + */ +typedef enum win_bt_stack_t { WIIUSE_STACK_UNKNOWN, WIIUSE_STACK_MS, WIIUSE_STACK_BLUESOLEIL } win_bt_stack_t; + +/** + * @brief Significant data from the previous event. + */ +typedef struct wiimote_state_t +{ + /* expansion_t */ + float exp_ljs_ang; + float exp_rjs_ang; + float exp_ljs_mag; + float exp_rjs_mag; + uint16_t exp_btns; + struct orient_t exp_orient; + struct vec3b_t exp_accel; + float exp_r_shoulder; + float exp_l_shoulder; + + /* motion plus */ + short drx; + short dry; + short drz; + + /* wiiboard */ + uint16_t exp_wb_rtr; + uint16_t exp_wb_rtl; + uint16_t exp_wb_rbr; + uint16_t exp_wb_rbl; + + /* ir_t */ + int ir_ax; + int ir_ay; + float ir_distance; + + struct orient_t orient; + uint16_t btns; + + struct vec3b_t accel; +} wiimote_state_t; + +/** + * @brief Events that wiiuse can generate from a poll. + */ +typedef enum WIIUSE_EVENT_TYPE { + WIIUSE_NONE = 0, + WIIUSE_EVENT, + WIIUSE_STATUS, + WIIUSE_CONNECT, + WIIUSE_DISCONNECT, + WIIUSE_UNEXPECTED_DISCONNECT, + WIIUSE_READ_DATA, + WIIUSE_WRITE_DATA, + WIIUSE_NUNCHUK_INSERTED, + WIIUSE_NUNCHUK_REMOVED, + WIIUSE_CLASSIC_CTRL_INSERTED, + WIIUSE_CLASSIC_CTRL_REMOVED, + WIIUSE_GUITAR_HERO_3_CTRL_INSERTED, + WIIUSE_GUITAR_HERO_3_CTRL_REMOVED, + WIIUSE_WII_BOARD_CTRL_INSERTED, + WIIUSE_WII_BOARD_CTRL_REMOVED, + WIIUSE_MOTION_PLUS_ACTIVATED, + WIIUSE_MOTION_PLUS_REMOVED +} WIIUSE_EVENT_TYPE; + +/** + * @brief Type of wiimote peripheral + */ +typedef enum WIIUSE_WIIMOTE_TYPE { + WIIUSE_WIIMOTE_REGULAR = 0, + WIIUSE_WIIMOTE_MOTION_PLUS_INSIDE, +} WIIUSE_WIIMOTE_TYPE; + +/** + * @brief Main Wiimote device structure. + * + * You need one of these to do pretty much anything with this library. + */ +typedef struct wiimote_t +{ + int unid; /**< user specified id */ + +#ifdef WIIUSE_BLUEZ + /** @name Linux-specific (BlueZ) members */ + /** @{ */ + char bdaddr_str[18]; /**< readable bt address */ + bdaddr_t bdaddr; /**< bt address */ + int out_sock; /**< output socket */ + int in_sock; /**< input socket */ + /** @} */ +#endif + +#ifdef WIIUSE_WIN32 + /** @name Windows-specific members */ + /** @{ */ + HANDLE dev_handle; /**< HID handle */ + OVERLAPPED hid_overlap; /**< overlap handle */ + enum win_bt_stack_t stack; /**< type of bluetooth stack to use */ + int timeout; /**< read timeout */ + byte normal_timeout; /**< normal timeout */ + byte exp_timeout; /**< timeout for expansion handshake */ + /** @} */ +#endif + +#ifdef WIIUSE_MAC + /** @name Mac OS X-specific members */ + /** @{ */ + void *objc_wm; /** WiiuseWiimote* as opaque pointer */ + /** @} */ +#endif + + int state; /**< various state flags */ + byte leds; /**< currently lit leds */ + float battery_level; /**< battery level */ + + int flags; /**< options flag */ + +#ifndef WIIUSE_SYNC_HANDSHAKE + byte handshake_state; /**< the state of the connection handshake */ +#endif + byte expansion_state; /**< the state of the expansion handshake */ + struct data_req_t *data_req; /**< list of data read requests */ + + struct read_req_t *read_req; /**< list of data read requests */ + struct accel_t accel_calib; /**< wiimote accelerometer calibration */ + struct expansion_t exp; /**< wiimote expansion device */ + + struct vec3b_t accel; /**< current raw acceleration data */ + struct orient_t orient; /**< current orientation on each axis */ + struct gforce_t gforce; /**< current gravity forces on each axis */ + + struct ir_t ir; /**< IR data */ + + uint16_t btns; /**< what buttons have just been pressed */ + uint16_t btns_held; /**< what buttons are being held down */ + uint16_t btns_released; /**< what buttons were just released this */ + + float orient_threshold; /**< threshold for orient to generate an event */ + int32_t accel_threshold; /**< threshold for accel to generate an event */ + + struct wiimote_state_t lstate; /**< last saved state */ + + WIIUSE_EVENT_TYPE event; /**< type of event that occurred */ + byte motion_plus_id[6]; + WIIUSE_WIIMOTE_TYPE type; +} wiimote; + +/** @brief Data passed to a callback during wiiuse_update() */ +typedef struct wiimote_callback_data_t +{ + int uid; + byte leds; + float battery_level; + struct vec3b_t accel; + struct orient_t orient; + struct gforce_t gforce; + struct ir_t ir; + uint16_t buttons; + uint16_t buttons_held; + uint16_t buttons_released; + WIIUSE_EVENT_TYPE event; + int state; + struct expansion_t expansion; +} wiimote_callback_data_t; + +/** @brief Callback type */ +typedef void (*wiiuse_update_cb)(struct wiimote_callback_data_t *wm); + +/** + * @brief Callback that handles a write event. + * + * @param wm Pointer to a wiimote_t structure. + * @param data Pointer to the sent data block. + * @param len Length in bytes of the data block. + * + * @see wiiuse_init() + * + * A registered function of this type is called automatically by the wiiuse + * library when the wiimote has returned the full data requested by a previous + * call to wiiuse_write_data(). + */ +typedef void (*wiiuse_write_cb)(struct wiimote_t *wm, unsigned char *data, unsigned short len); + +typedef enum data_req_s { REQ_READY = 0, REQ_SENT, REQ_DONE } data_req_s; + +/** + * @struct data_req_t + * @brief Data write request structure. + */ +struct data_req_t +{ + + byte data[21]; /**< buffer where read data is written */ + byte len; + unsigned int addr; + data_req_s state; /**< set to 1 if not using callback and needs to be cleaned up */ + wiiuse_write_cb cb; /**< read data callback + */ + struct data_req_t *next; +}; + +/** + * @brief Loglevels supported by wiiuse. + */ +typedef enum wiiuse_loglevel { + LOGLEVEL_ERROR = 0, + LOGLEVEL_WARNING = 1, + LOGLEVEL_INFO = 2, + LOGLEVEL_DEBUG = 3 +} wiiuse_loglevel; + +/***************************************** + * + * Include API specific stuff + * + *****************************************/ + +#ifdef WIIUSE_WIN32 +#ifdef WIIUSE_STATIC +#define WIIUSE_EXPORT_DECL +#define WIIUSE_IMPORT_DECL +#else +#define WIIUSE_EXPORT_DECL __declspec(dllexport) +#define WIIUSE_IMPORT_DECL __declspec(dllimport) +#endif +#else +#define WIIUSE_EXPORT_DECL +#define WIIUSE_IMPORT_DECL +#endif + +#ifdef WIIUSE_COMPILE_LIB +#define WIIUSE_EXPORT WIIUSE_EXPORT_DECL +#else +#define WIIUSE_EXPORT WIIUSE_IMPORT_DECL +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* wiiuse.c */ +WIIUSE_EXPORT extern const char *wiiuse_version(); + +/** @brief Define indicating the presence of the feature allowing you to + * redirect output for one or more logging levels within the library. + */ +#define WIIUSE_HAS_OUTPUT_REDIRECTION +WIIUSE_EXPORT extern void wiiuse_set_output(enum wiiuse_loglevel loglevel, FILE *logtarget); + +WIIUSE_EXPORT extern struct wiimote_t **wiiuse_init(int wiimotes); +WIIUSE_EXPORT extern void wiiuse_disconnected(struct wiimote_t *wm); +WIIUSE_EXPORT extern void wiiuse_cleanup(struct wiimote_t **wm, int wiimotes); +WIIUSE_EXPORT extern void wiiuse_rumble(struct wiimote_t *wm, int status); +WIIUSE_EXPORT extern void wiiuse_toggle_rumble(struct wiimote_t *wm); +WIIUSE_EXPORT extern void wiiuse_set_leds(struct wiimote_t *wm, int leds); +WIIUSE_EXPORT extern void wiiuse_motion_sensing(struct wiimote_t *wm, int status); +WIIUSE_EXPORT extern int wiiuse_read_data(struct wiimote_t *wm, byte *buffer, unsigned int offset, + uint16_t len); +WIIUSE_EXPORT extern int wiiuse_write_data(struct wiimote_t *wm, unsigned int addr, const byte *data, + byte len); +WIIUSE_EXPORT extern void wiiuse_status(struct wiimote_t *wm); +WIIUSE_EXPORT extern struct wiimote_t *wiiuse_get_by_id(struct wiimote_t **wm, int wiimotes, int unid); +WIIUSE_EXPORT extern int wiiuse_set_flags(struct wiimote_t *wm, int enable, int disable); +WIIUSE_EXPORT extern float wiiuse_set_smooth_alpha(struct wiimote_t *wm, float alpha); +WIIUSE_EXPORT extern void wiiuse_set_bluetooth_stack(struct wiimote_t **wm, int wiimotes, + enum win_bt_stack_t type); +WIIUSE_EXPORT extern void wiiuse_set_orient_threshold(struct wiimote_t *wm, float threshold); +WIIUSE_EXPORT extern void wiiuse_resync(struct wiimote_t *wm); +WIIUSE_EXPORT extern void wiiuse_set_timeout(struct wiimote_t **wm, int wiimotes, byte normal_timeout, + byte exp_timeout); +WIIUSE_EXPORT extern void wiiuse_set_accel_threshold(struct wiimote_t *wm, int threshold); +WIIUSE_EXPORT extern void wiiuse_wiiboard_use_alternate_report(struct wiimote_t *wm, int enabled); + +/* io.c */ +WIIUSE_EXPORT extern int wiiuse_find(struct wiimote_t **wm, int max_wiimotes, int timeout); +WIIUSE_EXPORT extern int wiiuse_connect(struct wiimote_t **wm, int wiimotes); +WIIUSE_EXPORT extern void wiiuse_disconnect(struct wiimote_t *wm); + +/* events.c */ +WIIUSE_EXPORT extern int wiiuse_poll(struct wiimote_t **wm, int wiimotes); + +/** + * @brief Poll Wiimotes, and call the provided callback with information + * on each Wiimote that had an event. + * + * Alternative to calling wiiuse_poll yourself, and provides the same + * information struct on all platforms. + * + * @return Number of wiimotes that had an event. + */ +WIIUSE_EXPORT extern int wiiuse_update(struct wiimote_t **wm, int wiimotes, wiiuse_update_cb callback); + +/* ir.c */ +WIIUSE_EXPORT extern void wiiuse_set_ir(struct wiimote_t *wm, int status); +WIIUSE_EXPORT extern void wiiuse_set_ir_vres(struct wiimote_t *wm, unsigned int x, unsigned int y); +WIIUSE_EXPORT extern void wiiuse_set_ir_position(struct wiimote_t *wm, enum ir_position_t pos); +WIIUSE_EXPORT extern void wiiuse_set_aspect_ratio(struct wiimote_t *wm, enum aspect_t aspect); +WIIUSE_EXPORT extern void wiiuse_set_ir_sensitivity(struct wiimote_t *wm, int level); + +/* nunchuk.c */ +WIIUSE_EXPORT extern void wiiuse_set_nunchuk_orient_threshold(struct wiimote_t *wm, float threshold); +WIIUSE_EXPORT extern void wiiuse_set_nunchuk_accel_threshold(struct wiimote_t *wm, int threshold); + +/* wiiboard.c */ +/* this function not currently implemented... */ +WIIUSE_EXPORT extern void wiiuse_set_wii_board_calib(struct wiimote_t *wm); + +WIIUSE_EXPORT extern void wiiuse_set_motion_plus(struct wiimote_t *wm, int status); + +#ifdef __cplusplus +} +#endif + +/** @} */ + +#endif /* WIIUSE_H_INCLUDED */ diff --git a/lib/wiiuse/src/wiiuse_internal.h b/lib/wiiuse/src/wiiuse_internal.h new file mode 100644 index 000000000..983692808 --- /dev/null +++ b/lib/wiiuse/src/wiiuse_internal.h @@ -0,0 +1,459 @@ +/* + * wiiuse + * + * Written By: + * Michael Laforest < para > + * Email: < thepara (--AT--) g m a i l [--DOT--] com > + * + * Copyright 2006-2007 + * + * This file is part of wiiuse. + * + * Mac device classes based on wiic_internal.h from WiiC, written By: + * Gabriele Randelli + * Email: < randelli (--AT--) dis [--DOT--] uniroma1 [--DOT--] it > + * + * Copyright 2010 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * $Header$ + * + */ + +/** + * @file + * @brief General internal wiiuse stuff. + * + * Since Wiiuse is a library, wiiuse.h is a duplicate + * of the API header. + * + * The code that would normally go in that file, but + * which is not needed by third party developers, + * is put here. + * + * So wiiuse_internal.h is included by other files + * internally, wiiuse.h is included only here. + */ + +#ifndef WIIUSE_INTERNAL_H_INCLUDED +#define WIIUSE_INTERNAL_H_INCLUDED + +#ifndef WIIUSE_PLATFORM +#if defined(_WIN32) +#define WIIUSE_PLATFORM +#define WIIUSE_WIN32 +#elif defined(__linux) +#define WIIUSE_PLATFORM +#define WIIUSE_BLUEZ +#elif defined(__APPLE__) +#define WIIUSE_PLATFORM +#define WIIUSE_MAC +#else +#error "Platform not yet supported!" +#endif +#endif + +#ifdef WIIUSE_WIN32 +#include +#endif +#ifdef WIIUSE_BLUEZ +#include /* htons() */ +#include +#endif +#ifdef WIIUSE_MAC +/* mac */ +#include /*CFRunLoops and CFNumberRef in Bluetooth classes*/ +#include /*IOBluetoothDeviceRef and IOBluetoothL2CAPChannelRef*/ +#endif + +#include "definitions.h" + +#if defined(_MSC_VER) && _MSC_VER < 1700 +/* MS compilers of pre-VC2010 versions don't have stdint.h + * and I can't get VC2010's stdint.h to compile nicely in + * WiiUse + */ +#include "wiiuse_msvcstdint.h" +#else +#include +#endif + +/******************** + * + * Wiimote internal codes + * + ********************/ + +/** @addtogroup internal_general Internal: API for General Internal Use */ +/** @{ */ +/* Communication channels */ +#define WM_OUTPUT_CHANNEL 0x11 +#define WM_INPUT_CHANNEL 0x13 + +#define WM_SET_REPORT 0x50 +#define WM_SET_DATA 0xA0 + +/* commands */ +#define WM_CMD_LED 0x11 +#define WM_CMD_REPORT_TYPE 0x12 +#define WM_CMD_RUMBLE 0x13 +#define WM_CMD_IR 0x13 +#define WM_CMD_CTRL_STATUS 0x15 +#define WM_CMD_WRITE_DATA 0x16 +#define WM_CMD_READ_DATA 0x17 +#define WM_CMD_IR_2 0x1A + +/* input report ids */ +#define WM_RPT_CTRL_STATUS 0x20 +#define WM_RPT_READ 0x21 +#define WM_RPT_WRITE 0x22 +#define WM_RPT_BTN 0x30 +#define WM_RPT_BTN_ACC 0x31 +#define WM_RPT_BTN_EXP_8 0x32 +#define WM_RPT_BTN_ACC_IR 0x33 +#define WM_RPT_BTN_EXP 0x34 +#define WM_RPT_BTN_ACC_EXP 0x35 +#define WM_RPT_BTN_IR_EXP 0x36 +#define WM_RPT_BTN_ACC_IR_EXP 0x37 + +#define WM_BT_INPUT 0x01 +#define WM_BT_OUTPUT 0x02 + +/* Identify the wiimote device by its class */ + +/* (Explanation and mac classes taken from WiiC) + * The different codes wrt. to Linux + * is a bit hard to explain. + * Looking at Bluetooth CoD format, we have 24 bits. + * In wiic Linux they are stored in three fields, + * each one 8bit long. The result number is + * 0x002504. However, MacOS Bluetooth does + * not store them in such a way, rather it uses + * the concept of major service, major class, + * and minor class, that are respectivelly + * 11bit, 5bit, and 6bit long. Hence, the + * numbers are different. + * The Wiimote CoD Bluetooth division is the following: + * 00000000001 00101 000001 00 (major service - major class - minor class - format type) + * This can also be seen in the WiiC Linux way: + * 00000000 00100101 00000100 + */ +#ifdef WIIUSE_MAC +#define WM_DEV_MINOR_CLASS 0x01 // Regular wiimote +#define WM_DEV_MAJOR_CLASS 0x05 +#define WM_DEV_MAJOR_SERVICE 0x01 + +#define WM_PLUS_DEV_MINOR_CLASS 0x02 // For the newer RVL-CNT-01-TR (MotionPlus Inside) +#define WM_PLUS_DEV_MAJOR_CLASS 0x05 +#define WM_PLUS_DEV_MAJOR_SERVICE 0x00 +#else +#define WM_DEV_CLASS_0 0x04 // Regular wiimote +#define WM_DEV_CLASS_1 0x25 +#define WM_DEV_CLASS_2 0x00 + +#define WM_PLUS_DEV_CLASS_0 0x08 // For the newer RVL-CNT-01-TR (MotionPlus Inside) +#define WM_PLUS_DEV_CLASS_1 0x05 +#define WM_PLUS_DEV_CLASS_2 0x00 +#endif +#define WM_VENDOR_ID 0x057E +#define WM_PRODUCT_ID 0x0306 // Regular wiimote +#define WM_PRODUCT_ID_TR 0x0330 // RVL-CNT-01-TR Wiimote (with MotionPlus built-in) + +/* controller status stuff */ +#define WM_MAX_BATTERY_CODE 0xC8 + +/* offsets in wiimote memory */ +#define WM_MEM_OFFSET_CALIBRATION 0x16 +#define WM_EXP_MEM_BASE 0x04A40000 +#define WM_EXP_ID 0x04A400FA +#define WM_EXP_MEM_ENABLE 0x04A40040 +#define WM_EXP_MEM_ENABLE1 0x04A400F0 +#define WM_EXP_MEM_ENABLE2 0x04A400FB +#define WM_EXP_MEM_CALIBR 0x04A40020 +#define WM_EXP_MOTION_PLUS_IDENT 0x04A600FA +#define WM_EXP_MOTION_PLUS_ENABLE 0x04A600FE +#define WM_EXP_MOTION_PLUS_INIT 0x04A600F0 +#define WM_REG_IR 0x04B00030 +#define WM_REG_IR_BLOCK1 0x04B00000 +#define WM_REG_IR_BLOCK2 0x04B0001A +#define WM_REG_IR_MODENUM 0x04B00033 + +/* unknown Wii Balance Board offsets used for init */ +#define WM_EXP_BBOARD_INIT1 0x04A400F1 + +#define WM_IR_TYPE_BASIC 0x01 +#define WM_IR_TYPE_EXTENDED 0x03 + +/* controller status flags for the first message byte */ +/* bit 1 is unknown */ +#define WM_CTRL_STATUS_BYTE1_ATTACHMENT 0x02 +#define WM_CTRL_STATUS_BYTE1_SPEAKER_ENABLED 0x04 +#define WM_CTRL_STATUS_BYTE1_IR_ENABLED 0x08 +#define WM_CTRL_STATUS_BYTE1_LED_1 0x10 +#define WM_CTRL_STATUS_BYTE1_LED_2 0x20 +#define WM_CTRL_STATUS_BYTE1_LED_3 0x40 +#define WM_CTRL_STATUS_BYTE1_LED_4 0x80 + +/* aspect ratio */ +#define WM_ASPECT_16_9_X 660 +#define WM_ASPECT_16_9_Y 370 +#define WM_ASPECT_4_3_X 560 +#define WM_ASPECT_4_3_Y 420 + +/** + * Expansion stuff + */ + +/* decrypted expansion id codes (located at 0x04A400FC) */ +#define EXP_ID_CODE_NUNCHUK 0xA4200000 +#define EXP_ID_CODE_WII_BOARD 0xA4200402 +#define EXP_ID_CODE_CLASSIC_CONTROLLER 0xA4200101 +#define EXP_ID_CODE_GUITAR 0xA4200103 +#define EXP_ID_CODE_MOTION_PLUS 0xA4200405 +#define EXP_ID_CODE_MOTION_PLUS_NUNCHUK 0xA4200505 /** Motion Plus ID in Nunchuck passthrough mode */ +#define EXP_ID_CODE_MOTION_PLUS_CLASSIC 0xA4200705 /** Motion Plus ID in Classic control. passthrough */ + +/* decrypted M+ codes at 0x04A600FA */ +#define EXP_ID_CODE_INACTIVE_MOTION_PLUS 0xA6200005 /** Inactive Motion Plus ID */ +#define EXP_ID_CODE_INACTIVE_MOTION_PLUS_BUILTIN 0xA4200005 /** Inactive Motion Plus ID in Wii Remote Plus \ + */ +#define EXP_ID_CODE_NLA_MOTION_PLUS 0xA6200405 /** No longer active Motion Plus ID */ +#define EXP_ID_CODE_NLA_MOTION_PLUS_NUNCHUK 0xA6200505 /** No longer active Motion Plus ID in Nunchuck passthrough mode */ +#define EXP_ID_CODE_NLA_MOTION_PLUS_CLASSIC 0xA6200705 /** No longer active Motion Plus ID in Classic control. passthrough */ + +#define EXP_HANDSHAKE_LEN 224 + +/******************** + * + * End Wiimote internal codes + * + ********************/ + +#define WIIMOTE_INIT_STATES (WIIMOTE_STATE_IR_SENS_LVL3) + +/* macro to manage states */ +#define WIIMOTE_ENABLE_STATE(wm, s) (wm->state |= (s)) +#define WIIMOTE_DISABLE_STATE(wm, s) (wm->state &= ~(s)) +#define WIIMOTE_TOGGLE_STATE(wm, s) \ + ((wm->state & (s)) ? WIIMOTE_DISABLE_STATE(wm, s) : WIIMOTE_ENABLE_STATE(wm, s)) + +#define WIIMOTE_IS_FLAG_SET(wm, s) ((wm->flags & (s)) == (s)) +#define WIIMOTE_ENABLE_FLAG(wm, s) (wm->flags |= (s)) +#define WIIMOTE_DISABLE_FLAG(wm, s) (wm->flags &= ~(s)) +#define WIIMOTE_TOGGLE_FLAG(wm, s) \ + ((wm->flags & (s)) ? WIIMOTE_DISABLE_FLAG(wm, s) : WIIMOTE_ENABLE_FLAG(wm, s)) + +#define NUNCHUK_IS_FLAG_SET(wm, s) ((*(wm->flags) & (s)) == (s)) + +/* + * Largest known payload is 21 bytes. + * Add 1 (Win32) or 2 (Mac, *nix) for the prefix and round up to a power of 2. + */ +#define MAX_PAYLOAD 32 + +/* + * Smooth tilt calculations are computed with the + * exponential moving average formula: + * St = St_last + (alpha * (tilt - St_last)) + * alpha is between 0 and 1 + */ +#define WIIUSE_DEFAULT_SMOOTH_ALPHA 0.07f + +#define SMOOTH_ROLL 0x01 +#define SMOOTH_PITCH 0x02 + +#define WIIUSE_READ_TIMEOUT 5000 + +/** @} */ +#include "wiiuse.h" +/** @addtogroup internal_general */ +/** @{ */ +#define _STRINGIFY(s) _STRINGIFY_IMPL(s) +#define _STRINGIFY_IMPL(s) #s + +/* wiiuse version, from public per-component version defines */ +#define WIIUSE_VERSION _STRINGIFY(WIIUSE_MAJOR) "." _STRINGIFY(WIIUSE_MINOR) "." _STRINGIFY(WIIUSE_MICRO) + +#ifdef _MSC_VER +#define INLINE_UTIL __inline +#else +#define INLINE_UTIL static inline +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* not part of the api */ + +/** @brief Cross-platform call to sleep for at least the specified number + * of milliseconds. + * + * Use instead of Sleep(), usleep(), or similar functions. + * Defined in util.c + */ +void wiiuse_millisleep(int durationMilliseconds); + +int wiiuse_set_report_type(struct wiimote_t *wm); +void wiiuse_send_next_pending_read_request(struct wiimote_t *wm); +void wiiuse_send_next_pending_write_request(struct wiimote_t *wm); +int wiiuse_send(struct wiimote_t *wm, byte report_type, byte *msg, int len); +int wiiuse_read_data_cb(struct wiimote_t *wm, wiiuse_read_cb read_cb, byte *buffer, unsigned int offset, + uint16_t len); +int wiiuse_write_data_cb(struct wiimote_t *wm, unsigned int addr, byte *data, byte len, + wiiuse_write_cb write_cb); + +#ifdef WIIUSE_DOXYGEN_PARSING +/** @addtogroup betosystem Big-endian buffer to system-byte-order value + @{ */ + +/** @brief Given a buffer buf, copy and return a value of type uint8_t. +*/ +uint8_t from_big_endian_uint8_t(byte *buf); +/** @brief Given a buffer buf, copy out a uint16_t, convert it from big-endian + to system byte order, and return it. + + @note Requires that at least 2 bytes be available in buf, but does not + check this - it is your responsibility. +*/ +uint16_t from_big_endian_uint16_t(byte *buf); + +/** @brief Given a buffer buf, copy out a uint32_t, convert it from big-endian + to system byte order, and return it. + + @note Requires that at least 4 bytes be available in buf, but does not + check this - it is your responsibility. +*/ +uint32_t from_big_endian_uint32_t(byte *buf); +/** @} */ + +/** @addtogroup systemtobe System-byte-order value to big-endian buffer + @{ +*/ + +/** @brief Copies the value val into the buffer buf. + @note Requires that at least 1 byte is available in buf, but does not + check this - it is your responsibility. +*/ +void to_big_endian_uint8_t(byte *buf, uint8_t val); + +/** @brief Converts the value val from system byte order to big endian, + and copies it into the given buffer starting at buf. + + @note Requires that at least 2 bytes be available in buf, but does not + check this - it is your responsibility. +*/ +void to_big_endian_uint16_t(byte *buf, uint16_t val); + +/** @brief Converts the value val from system byte order to big endian, + and copies it into the given buffer starting at buf. + + @note Requires that at least 4 bytes be available in buf, but does not + check this - it is your responsibility. +*/ +void to_big_endian_uint32_t(byte *buf, uint32_t val); +/** @} +*/ + +/** @addtogroup bufferfunc Buffering functions + @brief These wrap around from/to_big_endian_TYPE, but take a byte** so that + they can advance the input/output pointer appropriately. + @{ +*/ +/** @brief Converts the value val from system byte order to big endian, + copies it into the given buffer starting at *buf, and advances buf by + sizeof(uint16_t). +*/ +void buffer_big_endian_uint16_t(byte **buf, uint16_t val); + +/** @brief Given the address of a buffer pointer buf, copy out a uint16_t + from *buf, convert it from big-endian to system byte order, advance + buf by sizeof(uint16_t), and return the value retrieved. +*/ +uint16_t unbuffer_big_endian_uint16_t(byte **buf); + +/** @sa buffer_big_endian_uint16_t() +*/ +void buffer_big_endian_uint8_t(byte **buf, uint8_t val); + +/** @sa unbuffer_big_endian_uint8_t +*/ +uint8_t unbuffer_big_endian_uint8_t(byte **buf); + +/** @sa buffer_big_endian_uint16_t +*/ +void buffer_big_endian_uint32_t(byte **buf, uint32_t val); + +/** @sa unbuffer_big_endian_uint32_t +*/ +uint8_t unbuffer_big_endian_uint32_t(byte **buf) + +/** @} */ +#else /* this else is true when not in doxygen */ + +INLINE_UTIL void to_big_endian_uint8_t(byte *buf, uint8_t val) { memcpy(buf, &val, 1); } + +INLINE_UTIL uint8_t from_big_endian_uint8_t(byte *buf) +{ + uint8_t beVal; + memcpy(&beVal, buf, 1); + return beVal; +} + +#define WIIUSE_DECLARE_ENDIAN_CONVERSION_OPS(_TYPE, _TOBE, _FROMBE) \ + INLINE_UTIL void to_big_endian_##_TYPE(byte *buf, _TYPE val) \ + { \ + _TYPE beVal = _TOBE(val); \ + memcpy(buf, &beVal, sizeof(_TYPE)); \ + } \ + INLINE_UTIL _TYPE from_big_endian_##_TYPE(byte *buf) \ + { \ + _TYPE beVal; \ + memcpy(&beVal, buf, sizeof(_TYPE)); \ + return _FROMBE(beVal); \ + } + +WIIUSE_DECLARE_ENDIAN_CONVERSION_OPS(uint16_t, htons, ntohs) +WIIUSE_DECLARE_ENDIAN_CONVERSION_OPS(uint32_t, htonl, ntohl) + +#undef WIIUSE_DECLARE_ENDIAN_CONVERSION_OPS + +#define WIIUSE_DECLARE_BUFFERING_OPS(_TYPE) \ + INLINE_UTIL void buffer_big_endian_##_TYPE(byte **buf, _TYPE val) \ + { \ + to_big_endian_##_TYPE(*buf, val); \ + *buf += sizeof(_TYPE); \ + } \ + INLINE_UTIL _TYPE unbuffer_big_endian_##_TYPE(byte **buf) \ + { \ + byte *current = *buf; \ + *buf += sizeof(_TYPE); \ + return from_big_endian_##_TYPE(current); \ + } + +WIIUSE_DECLARE_BUFFERING_OPS(uint8_t) +WIIUSE_DECLARE_BUFFERING_OPS(uint16_t) +WIIUSE_DECLARE_BUFFERING_OPS(uint32_t) + +#undef WIIUSE_DECLARE_BUFFERING_OPS + +#endif /* not in doxygen */ + +#ifdef __cplusplus +} +#endif +/** @} */ + +#endif /* WIIUSE_INTERNAL_H_INCLUDED */ diff --git a/lib/wiiuse/src/wiiuse_msvcstdint.h b/lib/wiiuse/src/wiiuse_msvcstdint.h new file mode 100644 index 000000000..c0d92c713 --- /dev/null +++ b/lib/wiiuse/src/wiiuse_msvcstdint.h @@ -0,0 +1,223 @@ +// ISO C9x compliant stdint.h for Microsoft Visual Studio +// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 +// +// Copyright (c) 2006-2008 Alexander Chemeris +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. The name of the author may be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _MSC_VER // [ +#error "Use this header only with Microsoft Visual C++ compilers!" +#endif // _MSC_VER ] + +#ifndef _MSC_STDINT_H_ // [ +#define _MSC_STDINT_H_ + +#if _MSC_VER > 1000 +#pragma once +#endif + +#include + +// For Visual Studio 6 in C++ mode and for many Visual Studio versions when +// compiling for ARM we should wrap include with 'extern "C++" {}' +// or compiler give many errors like this: +// error C2733: second C linkage of overloaded function 'wmemchr' not allowed +#ifdef __cplusplus +extern "C" { +#endif +#include +#ifdef __cplusplus +} +#endif + +// Define _W64 macros to mark types changing their size, like intptr_t. +#ifndef _W64 +#if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 +#define _W64 __w64 +#else +#define _W64 +#endif +#endif + +// 7.18.1 Integer types + +// 7.18.1.1 Exact-width integer types + +// Visual Studio 6 and Embedded Visual C++ 4 doesn't +// realize that, e.g. char has the same size as __int8 +// so we give up on __intX for them. +#if (_MSC_VER < 1300) +typedef signed char int8_t; +typedef signed short int16_t; +typedef signed int int32_t; +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; +#else +typedef signed __int8 int8_t; +typedef signed __int16 int16_t; +typedef signed __int32 int32_t; +typedef unsigned __int8 uint8_t; +typedef unsigned __int16 uint16_t; +typedef unsigned __int32 uint32_t; +#endif +typedef signed __int64 int64_t; +typedef unsigned __int64 uint64_t; + +// 7.18.1.4 Integer types capable of holding object pointers +#ifdef _WIN64 // [ +typedef signed __int64 intptr_t; +typedef unsigned __int64 uintptr_t; +#else // _WIN64 ][ +typedef _W64 signed int intptr_t; +typedef _W64 unsigned int uintptr_t; +#endif // _WIN64 ] + +// 7.18.1.5 Greatest-width integer types +typedef int64_t intmax_t; +typedef uint64_t uintmax_t; + +// 7.18.2 Limits of specified-width integer types + +#if !defined(__cplusplus) \ + || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259 + +// 7.18.2.1 Limits of exact-width integer types +#define INT8_MIN ((int8_t)_I8_MIN) +#define INT8_MAX _I8_MAX +#define INT16_MIN ((int16_t)_I16_MIN) +#define INT16_MAX _I16_MAX +#define INT32_MIN ((int32_t)_I32_MIN) +#define INT32_MAX _I32_MAX +#define INT64_MIN ((int64_t)_I64_MIN) +#define INT64_MAX _I64_MAX +#define UINT8_MAX _UI8_MAX +#define UINT16_MAX _UI16_MAX +#define UINT32_MAX _UI32_MAX +#define UINT64_MAX _UI64_MAX + +// 7.18.2.2 Limits of minimum-width integer types +#define INT_LEAST8_MIN INT8_MIN +#define INT_LEAST8_MAX INT8_MAX +#define INT_LEAST16_MIN INT16_MIN +#define INT_LEAST16_MAX INT16_MAX +#define INT_LEAST32_MIN INT32_MIN +#define INT_LEAST32_MAX INT32_MAX +#define INT_LEAST64_MIN INT64_MIN +#define INT_LEAST64_MAX INT64_MAX +#define UINT_LEAST8_MAX UINT8_MAX +#define UINT_LEAST16_MAX UINT16_MAX +#define UINT_LEAST32_MAX UINT32_MAX +#define UINT_LEAST64_MAX UINT64_MAX + +// 7.18.2.3 Limits of fastest minimum-width integer types +#define INT_FAST8_MIN INT8_MIN +#define INT_FAST8_MAX INT8_MAX +#define INT_FAST16_MIN INT16_MIN +#define INT_FAST16_MAX INT16_MAX +#define INT_FAST32_MIN INT32_MIN +#define INT_FAST32_MAX INT32_MAX +#define INT_FAST64_MIN INT64_MIN +#define INT_FAST64_MAX INT64_MAX +#define UINT_FAST8_MAX UINT8_MAX +#define UINT_FAST16_MAX UINT16_MAX +#define UINT_FAST32_MAX UINT32_MAX +#define UINT_FAST64_MAX UINT64_MAX + +// 7.18.2.4 Limits of integer types capable of holding object pointers +#ifdef _WIN64 // [ +#define INTPTR_MIN INT64_MIN +#define INTPTR_MAX INT64_MAX +#define UINTPTR_MAX UINT64_MAX +#else // _WIN64 ][ +#define INTPTR_MIN INT32_MIN +#define INTPTR_MAX INT32_MAX +#define UINTPTR_MAX UINT32_MAX +#endif // _WIN64 ] + +// 7.18.2.5 Limits of greatest-width integer types +#define INTMAX_MIN INT64_MIN +#define INTMAX_MAX INT64_MAX +#define UINTMAX_MAX UINT64_MAX + +// 7.18.3 Limits of other integer types + +#ifdef _WIN64 // [ +#define PTRDIFF_MIN _I64_MIN +#define PTRDIFF_MAX _I64_MAX +#else // _WIN64 ][ +#define PTRDIFF_MIN _I32_MIN +#define PTRDIFF_MAX _I32_MAX +#endif // _WIN64 ] + +#define SIG_ATOMIC_MIN INT_MIN +#define SIG_ATOMIC_MAX INT_MAX + +#ifndef SIZE_MAX // [ +#ifdef _WIN64 // [ +#define SIZE_MAX _UI64_MAX +#else // _WIN64 ][ +#define SIZE_MAX _UI32_MAX +#endif // _WIN64 ] +#endif // SIZE_MAX ] + +// WCHAR_MIN and WCHAR_MAX are also defined in +#ifndef WCHAR_MIN // [ +#define WCHAR_MIN 0 +#endif // WCHAR_MIN ] +#ifndef WCHAR_MAX // [ +#define WCHAR_MAX _UI16_MAX +#endif // WCHAR_MAX ] + +#define WINT_MIN 0 +#define WINT_MAX _UI16_MAX + +#endif // __STDC_LIMIT_MACROS ] + +// 7.18.4 Limits of other integer types + +#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260 + +// 7.18.4.1 Macros for minimum-width integer constants + +#define INT8_C(val) val##i8 +#define INT16_C(val) val##i16 +#define INT32_C(val) val##i32 +#define INT64_C(val) val##i64 + +#define UINT8_C(val) val##ui8 +#define UINT16_C(val) val##ui16 +#define UINT32_C(val) val##ui32 +#define UINT64_C(val) val##ui64 + +// 7.18.4.2 Macros for greatest-width integer constants +#define INTMAX_C INT64_C +#define UINTMAX_C UINT64_C + +#endif // __STDC_CONSTANT_MACROS ] + +#endif // _MSC_STDINT_H_ ] diff --git a/lib/wiiuse/wiiboard.c b/lib/wiiuse/wiiboard.c deleted file mode 100644 index 8c4f9f033..000000000 --- a/lib/wiiuse/wiiboard.c +++ /dev/null @@ -1,146 +0,0 @@ -/* - * wiiuse - * - * Written By: - * Michael Laforest < para > - * Email: < thepara (--AT--) g m a i l [--DOT--] com > - * - * Copyright 2006-2007 - * - * This file is part of wiiuse. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * $Header$ - * - */ - -/** - * @file - * @brief Wii Fit Balance Board device. - */ - - -#include "wiiboard.h" - -#include /* for printf */ -#include /* for memset */ - -/** - * @brief Handle the handshake data from the wiiboard. - * - * @param wb A pointer to a wii_board_t structure. - * @param data The data read in from the device. - * @param len The length of the data block, in bytes. - * - * @return Returns 1 if handshake was successful, 0 if not. - */ - -int wii_board_handshake(struct wiimote_t* wm, struct wii_board_t* wb, byte* data, uint16_t len) { - byte * bufptr; - /* decrypt data */ -#ifdef WITH_WIIUSE_DEBUG - int i; - printf("DECRYPTED DATA WIIBOARD\n"); - for (i = 0; i < len; ++i) { - if (i % 16 == 0) { - if (i != 0) { - printf("\n"); - } - - printf("%X: ", 0x4a40000 + 32 + i); - } - printf("%02X ", data[i]); - } - printf("\n"); -#endif - - bufptr = data + 4; - wb->ctr[0] = unbuffer_big_endian_uint16_t(&bufptr); - wb->cbr[0] = unbuffer_big_endian_uint16_t(&bufptr); - wb->ctl[0] = unbuffer_big_endian_uint16_t(&bufptr); - wb->cbl[0] = unbuffer_big_endian_uint16_t(&bufptr); - - wb->ctr[1] = unbuffer_big_endian_uint16_t(&bufptr); - wb->cbr[1] = unbuffer_big_endian_uint16_t(&bufptr); - wb->ctl[1] = unbuffer_big_endian_uint16_t(&bufptr); - wb->cbl[1] = unbuffer_big_endian_uint16_t(&bufptr); - - wb->ctr[2] = unbuffer_big_endian_uint16_t(&bufptr); - wb->cbr[2] = unbuffer_big_endian_uint16_t(&bufptr); - wb->ctl[2] = unbuffer_big_endian_uint16_t(&bufptr); - wb->cbl[2] = unbuffer_big_endian_uint16_t(&bufptr); - - /* handshake done */ - wm->event = WIIUSE_WII_BOARD_CTRL_INSERTED; - wm->exp.type = EXP_WII_BOARD; - -#ifdef WIIUSE_WIN32 - wm->timeout = WIIMOTE_DEFAULT_TIMEOUT; -#endif - - return 1; -} - - -/** - * @brief The wii board disconnected. - * - * @param cc A pointer to a wii_board_t structure. - */ -void wii_board_disconnected(struct wii_board_t* wb) { - memset(wb, 0, sizeof(struct wii_board_t)); -} - -static float do_interpolate(uint16_t raw, uint16_t cal[3]) { -#define WIIBOARD_MIDDLE_CALIB 17.0f - if (raw < cal[0]) { - return 0.0f; - } else if (raw < cal[1]) { - return ((float)(raw - cal[0]) * WIIBOARD_MIDDLE_CALIB) / (float)(cal[1] - cal[0]); - } else if (raw < cal[2]) { - return ((float)(raw - cal[1]) * WIIBOARD_MIDDLE_CALIB) / (float)(cal[2] - cal[1]) + WIIBOARD_MIDDLE_CALIB; - } else { - return WIIBOARD_MIDDLE_CALIB * 2.0f; - } -} - -/** - * @brief Handle wii board event. - * - * @param wb A pointer to a wii_board_t structure. - * @param msg The message specified in the event packet. - */ -void wii_board_event(struct wii_board_t* wb, byte* msg) { - byte * bufPtr = msg; - wb->rtr = unbuffer_big_endian_uint16_t(&bufPtr); - wb->rbr = unbuffer_big_endian_uint16_t(&bufPtr); - wb->rtl = unbuffer_big_endian_uint16_t(&bufPtr); - wb->rbl = unbuffer_big_endian_uint16_t(&bufPtr); - - /* - Interpolate values - Calculations borrowed from wiili.org - No names to mention sadly :( http://www.wiili.org/index.php/Wii_Balance_Board_PC_Drivers page however! - */ - wb->tr = do_interpolate(wb->rtr, wb->ctr); - wb->tl = do_interpolate(wb->rtl, wb->ctl); - wb->br = do_interpolate(wb->rbr, wb->cbr); - wb->bl = do_interpolate(wb->rbl, wb->cbl); -} - -/** - @todo not implemented! -*/ -void wiiuse_set_wii_board_calib(struct wiimote_t *wm) { -} diff --git a/lib/wiiuse/wiiuse.c b/lib/wiiuse/wiiuse.c deleted file mode 100644 index 8fe7ec5fd..000000000 --- a/lib/wiiuse/wiiuse.c +++ /dev/null @@ -1,860 +0,0 @@ -/* - * wiiuse - * - * Written By: - * Michael Laforest < para > - * Email: < thepara (--AT--) g m a i l [--DOT--] com > - * - * Copyright 2006-2007 - * - * This file is part of wiiuse. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * $Header$ - * - */ - -/** - * @file - * @brief General wiimote operations. - * - * The file includes functions that handle general - * tasks. Most of these are functions that are part - * of the API. - */ - -#include "wiiuse_internal.h" -#include "io.h" /* for wiiuse_handshake, etc */ -#include "os.h" /* for wiiuse_os_* */ - -#include /* for printf, FILE */ -#include /* for malloc, free */ -#include /* for memcpy, memset */ - -static int g_banner = 0; -static const char g_wiiuse_version_string[] = WIIUSE_VERSION; - -/** - * @brief Returns the version of the library. - */ -const char* wiiuse_version() { - return g_wiiuse_version_string; -} - -/** - * @brief Output FILE stream for each wiiuse_loglevel. - */ -FILE* logtarget[4]; - -/** - * @brief Specify an alternate FILE stream for a log level. - * - * @param loglevel The loglevel, for which the output should be set. - * - * @param logfile A valid, writeable FILE*, or 0, if output should be disabled. - * - * The default FILE* for all loglevels is stderr - */ -void wiiuse_set_output(enum wiiuse_loglevel loglevel, FILE *logfile) { - logtarget[(int)loglevel] = logfile; -} - -/** - * @brief Clean up wiimote_t array created by wiiuse_init() - */ -void wiiuse_cleanup(struct wiimote_t** wm, int wiimotes) { - int i = 0; - - if (!wm) { - return; - } - - WIIUSE_INFO("wiiuse clean up..."); - - for (; i < wiimotes; ++i) { - wiiuse_disconnect(wm[i]); - wiiuse_cleanup_platform_fields(wm[i]); - free(wm[i]); - } - - free(wm); - - return; -} - - -/** - * @brief Initialize an array of wiimote structures. - * - * @param wiimotes Number of wiimote_t structures to create. - * - * @return An array of initialized wiimote_t structures. - * - * @see wiiuse_connect() - * - * The array returned by this function can be passed to various - * functions, including wiiuse_connect(). - */ -struct wiimote_t** wiiuse_init(int wiimotes) { - int i = 0; - struct wiimote_t** wm = NULL; - - /* - * Please do not remove this banner. - * GPL asks that you please leave output credits intact. - * Thank you. - * - * This banner is only displayed once so that if you need - * to call this function again it won't be intrusive. - */ - if (!g_banner) { - printf("wiiuse v" WIIUSE_VERSION " loaded.\n" - " Fork at http://github.com/rpavlik/wiiuse\n" - " Original By: Michael Laforest http://wiiuse.net\n"); - g_banner = 1; - } - - logtarget[0] = stderr; - logtarget[1] = stderr; - logtarget[2] = stderr; - logtarget[3] = stderr; - - if (!wiimotes) { - return NULL; - } - - wm = malloc(sizeof(struct wiimote_t*) * wiimotes); - - for (i = 0; i < wiimotes; ++i) { - wm[i] = malloc(sizeof(struct wiimote_t)); - memset(wm[i], 0, sizeof(struct wiimote_t)); - - wm[i]->unid = i + 1; - wiiuse_init_platform_fields(wm[i]); - - wm[i]->state = WIIMOTE_INIT_STATES; - wm[i]->flags = WIIUSE_INIT_FLAGS; - - wm[i]->event = WIIUSE_NONE; - - wm[i]->exp.type = EXP_NONE; - wm[i]->expansion_state = 0; - - wiiuse_set_aspect_ratio(wm[i], WIIUSE_ASPECT_4_3); - wiiuse_set_ir_position(wm[i], WIIUSE_IR_ABOVE); - - wm[i]->orient_threshold = 0.5f; - wm[i]->accel_threshold = 5; - - wm[i]->accel_calib.st_alpha = WIIUSE_DEFAULT_SMOOTH_ALPHA; - - wm[i]->type = WIIUSE_WIIMOTE_REGULAR; - } - - return wm; -} - - -/** - * @brief The wiimote disconnected. - * - * @param wm Pointer to a wiimote_t structure. - */ -void wiiuse_disconnected(struct wiimote_t* wm) { - if (!wm) { - return; - } - - WIIUSE_INFO("Wiimote disconnected [id %i].", wm->unid); - - /* disable the connected flag */ - WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_CONNECTED); - - /* reset a bunch of stuff */ - wm->leds = 0; - wm->state = WIIMOTE_INIT_STATES; - wm->read_req = NULL; -#ifndef WIIUSE_SYNC_HANDSHAKE - wm->handshake_state = 0; -#endif - wm->btns = 0; - wm->btns_held = 0; - wm->btns_released = 0; - - wm->event = WIIUSE_DISCONNECT; -} - - -/** - * @brief Enable or disable the rumble. - * - * @param wm Pointer to a wiimote_t structure. - * @param status 1 to enable, 0 to disable. - */ -void wiiuse_rumble(struct wiimote_t* wm, int status) { - byte buf; - - if (!wm || !WIIMOTE_IS_CONNECTED(wm)) { - return; - } - - /* make sure to keep the current lit leds */ - buf = wm->leds; - - if (status) { - WIIUSE_DEBUG("Starting rumble..."); - WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_RUMBLE); - buf |= 0x01; - } else { - WIIUSE_DEBUG("Stopping rumble..."); - WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_RUMBLE); - buf &= ~(0x01); - } - - /* preserve IR state */ - if (WIIMOTE_IS_SET(wm, WIIMOTE_STATE_IR)) { - buf |= 0x04; - } - - wiiuse_send(wm, WM_CMD_RUMBLE, &buf, 1); -} - - -/** - * @brief Toggle the state of the rumble. - * - * @param wm Pointer to a wiimote_t structure. - */ -void wiiuse_toggle_rumble(struct wiimote_t* wm) { - if (!wm) { - return; - } - - wiiuse_rumble(wm, !WIIMOTE_IS_SET(wm, WIIMOTE_STATE_RUMBLE)); -} - - -/** - * @brief Set the enabled LEDs. - * - * @param wm Pointer to a wiimote_t structure. - * @param leds What LEDs to enable. - * - * \a leds is a bitwise or of WIIMOTE_LED_1, WIIMOTE_LED_2, WIIMOTE_LED_3, or WIIMOTE_LED_4. - */ -void wiiuse_set_leds(struct wiimote_t* wm, int leds) { - byte buf; - - if (!wm || !WIIMOTE_IS_CONNECTED(wm)) { - return; - } - - /* remove the lower 4 bits because they control rumble */ - wm->leds = (leds & 0xF0); - - /* make sure if the rumble is on that we keep it on */ - if (WIIMOTE_IS_SET(wm, WIIMOTE_STATE_RUMBLE)) { - wm->leds |= 0x01; - } - - buf = wm->leds; - - wiiuse_send(wm, WM_CMD_LED, &buf, 1); -} - - -/** - * @brief Set if the wiimote should report motion sensing. - * - * @param wm Pointer to a wiimote_t structure. - * @param status 1 to enable, 0 to disable. - * - * Since reporting motion sensing sends a lot of data, - * the wiimote saves power by not transmitting it - * by default. - */ -void wiiuse_motion_sensing(struct wiimote_t* wm, int status) { - if (status) { - WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_ACC); - } else { - WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_ACC); - } - - wiiuse_set_report_type(wm); -} - - -/** - * @brief Set the report type based on the current wiimote state. - * - * @param wm Pointer to a wiimote_t structure. - * - * @return The report type sent. - * - * The wiimote reports formatted packets depending on the - * report type that was last requested. This function will - * update the type of report that should be sent based on - * the current state of the device. - */ -int wiiuse_set_report_type(struct wiimote_t* wm) { - byte buf[2]; - int motion, exp, ir; - - if (!wm || !WIIMOTE_IS_CONNECTED(wm)) { - return 0; - } - - buf[0] = (WIIMOTE_IS_FLAG_SET(wm, WIIUSE_CONTINUOUS) ? 0x04 : 0x00); /* set to 0x04 for continuous reporting */ - buf[1] = 0x00; - - /* if rumble is enabled, make sure we keep it */ - if (WIIMOTE_IS_SET(wm, WIIMOTE_STATE_RUMBLE)) { - buf[0] |= 0x01; - } - - motion = WIIMOTE_IS_SET(wm, WIIMOTE_STATE_ACC); - exp = WIIMOTE_IS_SET(wm, WIIMOTE_STATE_EXP); - ir = WIIMOTE_IS_SET(wm, WIIMOTE_STATE_IR); - - if (motion && ir && exp) { - buf[1] = WM_RPT_BTN_ACC_IR_EXP; - } else if (motion && exp) { - buf[1] = WM_RPT_BTN_ACC_EXP; - } else if (motion && ir) { - buf[1] = WM_RPT_BTN_ACC_IR; - } else if (ir && exp) { - buf[1] = WM_RPT_BTN_IR_EXP; - } else if (ir) { - buf[1] = WM_RPT_BTN_ACC_IR; - } else if (exp) { - buf[1] = WM_RPT_BTN_EXP; - } else if (motion) { - buf[1] = WM_RPT_BTN_ACC; - } else { - buf[1] = WM_RPT_BTN; - } - - WIIUSE_DEBUG("Setting report type: 0x%x", buf[1]); - - exp = wiiuse_send(wm, WM_CMD_REPORT_TYPE, buf, 2); - if (exp <= 0) { - return exp; - } - - return buf[1]; -} - - -/** - * @brief Read data from the wiimote (callback version). - * - * @param wm Pointer to a wiimote_t structure. - * @param read_cb Function pointer to call when the data arrives from the wiimote. - * @param buffer An allocated buffer to store the data as it arrives from the wiimote. - * Must be persistent in memory and large enough to hold the data. - * @param addr The address of wiimote memory to read from. - * @param len The length of the block to be read. - * - * The library can only handle one data read request at a time - * because it must keep track of the buffer and other - * events that are specific to that request. So if a request - * has already been made, subsequent requests will be added - * to a pending list and be sent out when the previous - * finishes. - */ -int wiiuse_read_data_cb(struct wiimote_t* wm, wiiuse_read_cb read_cb, byte* buffer, unsigned int addr, uint16_t len) { - struct read_req_t* req; - - if (!wm || !WIIMOTE_IS_CONNECTED(wm)) { - return 0; - } - if (!buffer || !len) { - return 0; - } - - /* make this request structure */ - req = (struct read_req_t*)malloc(sizeof(struct read_req_t)); - if (req == NULL) { - return 0; - } - req->cb = read_cb; - req->buf = buffer; - req->addr = addr; - req->size = len; - req->wait = len; - req->dirty = 0; - req->next = NULL; - - /* add this to the request list */ - if (!wm->read_req) { - /* root node */ - wm->read_req = req; - - WIIUSE_DEBUG("Data read request can be sent out immediately."); - - /* send the request out immediately */ - wiiuse_send_next_pending_read_request(wm); - } else { - struct read_req_t* nptr = wm->read_req; - for (; nptr->next; nptr = nptr->next) { - ; - } - nptr->next = req; - - WIIUSE_DEBUG("Added pending data read request."); - } - - return 1; -} - - -/** - * @brief Read data from the wiimote (event version). - * - * @param wm Pointer to a wiimote_t structure. - * @param buffer An allocated buffer to store the data as it arrives from the wiimote. - * Must be persistent in memory and large enough to hold the data. - * @param addr The address of wiimote memory to read from. - * @param len The length of the block to be read. - * - * The library can only handle one data read request at a time - * because it must keep track of the buffer and other - * events that are specific to that request. So if a request - * has already been made, subsequent requests will be added - * to a pending list and be sent out when the previous - * finishes. - */ -int wiiuse_read_data(struct wiimote_t* wm, byte* buffer, unsigned int addr, uint16_t len) { - return wiiuse_read_data_cb(wm, NULL, buffer, addr, len); -} - - -/** - * @brief Send the next pending data read request to the wiimote. - * - * @param wm Pointer to a wiimote_t structure. - * - * @see wiiuse_read_data() - * - * This function is not part of the wiiuse API. - */ -void wiiuse_send_next_pending_read_request(struct wiimote_t* wm) { - byte buf[6]; - struct read_req_t* req; - - if (!wm || !WIIMOTE_IS_CONNECTED(wm)) { - return; - } - if (!wm->read_req) { - return; - } - - /* skip over dirty ones since they have already been read */ - req = wm->read_req; - while (req && req->dirty) { - req = req->next; - } - if (!req) { - return; - } - - /* the offset is in big endian */ - to_big_endian_uint32_t(buf, req->addr); - - /* the length is in big endian */ - to_big_endian_uint16_t(buf + 4, req->size); - - WIIUSE_DEBUG("Request read at address: 0x%x length: %i", req->addr, req->size); - wiiuse_send(wm, WM_CMD_READ_DATA, buf, 6); -} - - -/** - * @brief Request the wiimote controller status. - * - * @param wm Pointer to a wiimote_t structure. - * - * Controller status includes: battery level, LED status, expansions - */ -void wiiuse_status(struct wiimote_t* wm) { - byte buf = 0; - - if (!wm || !WIIMOTE_IS_CONNECTED(wm)) { - return; - } - - WIIUSE_DEBUG("Requested wiimote status."); - - wiiuse_send(wm, WM_CMD_CTRL_STATUS, &buf, 1); -} - - -/** - * @brief Find a wiimote_t structure by its unique identifier. - * - * @param wm Pointer to a wiimote_t structure. - * @param wiimotes The number of wiimote_t structures in \a wm. - * @param unid The unique identifier to search for. - * - * @return Pointer to a wiimote_t structure, or NULL if not found. - */ -struct wiimote_t* wiiuse_get_by_id(struct wiimote_t** wm, int wiimotes, int unid) { - int i = 0; - if (!wm) { - return NULL; - } - - for (; i < wiimotes; ++i) { - if (!wm[i]) { - continue; - } - if (wm[i]->unid == unid) { - return wm[i]; - } - } - - return NULL; -} - - -/** - * @brief Write data to the wiimote. - * - * @param wm Pointer to a wiimote_t structure. - * @param addr The address to write to. - * @param data The data to be written to the memory location. - * @param len The length of the block to be written. - */ -int wiiuse_write_data(struct wiimote_t* wm, unsigned int addr, const byte* data, byte len) { - byte buf[21] = {0}; /* the payload is always 23 */ - - byte * bufPtr = buf; - if (!wm || !WIIMOTE_IS_CONNECTED(wm)) { - return 0; - } - if (!data || !len) { - return 0; - } - - WIIUSE_DEBUG("Writing %i bytes to memory location 0x%x...", len, addr); - -#ifdef WITH_WIIUSE_DEBUG - { - int i = 0; - printf("Write data is: "); - for (; i < len; ++i) { - printf("%x ", data[i]); - } - printf("\n"); - } -#endif - - /* the offset is in big endian */ - buffer_big_endian_uint32_t(&bufPtr, (uint32_t)addr); - - /* length */ - buffer_big_endian_uint8_t(&bufPtr, len); - - /* data */ - memcpy(bufPtr, data, len); - - wiiuse_send(wm, WM_CMD_WRITE_DATA, buf, 21); - return 1; -} - -/** - * @brief Write data to the wiimote (callback version). - * - * @param wm Pointer to a wiimote_t structure. - * @param addr The address to write to. - * @param data The data to be written to the memory location. - * @param len The length of the block to be written. - * @param cb Function pointer to call when the data arrives from the wiimote. - * - * The library can only handle one data read request at a time - * because it must keep track of the buffer and other - * events that are specific to that request. So if a request - * has already been made, subsequent requests will be added - * to a pending list and be sent out when the previous - * finishes. - */ -int wiiuse_write_data_cb(struct wiimote_t *wm, unsigned int addr, byte *data, byte len, wiiuse_write_cb write_cb) { - struct data_req_t* req; - - if (!wm || !WIIMOTE_IS_CONNECTED(wm)) { - return 0; - } - if (!data || !len) { - return 0; - } - - req = (struct data_req_t*)malloc(sizeof(struct data_req_t)); - req->cb = write_cb; - req->len = len; - memcpy(req->data, data, req->len); - req->state = REQ_READY; - req->addr = addr;/* BIG_ENDIAN_LONG(addr); */ - req->next = NULL; - /* add this to the request list */ - if (!wm->data_req) { - /* root node */ - wm->data_req = req; - - WIIUSE_DEBUG("Data write request can be sent out immediately."); - - /* send the request out immediately */ - wiiuse_send_next_pending_write_request(wm); - } else { - struct data_req_t* nptr = wm->data_req; - WIIUSE_DEBUG("chaud2fois"); - for (; nptr->next; nptr = nptr->next) { - ; - } - nptr->next = req; - - WIIUSE_DEBUG("Added pending data write request."); - } - - return 1; -} - -/** - * @brief Send the next pending data write request to the wiimote. - * - * @param wm Pointer to a wiimote_t structure. - * - * @see wiiuse_write_data() - * - * This function is not part of the wiiuse API. - */ -void wiiuse_send_next_pending_write_request(struct wiimote_t* wm) { - struct data_req_t* req; - - if (!wm || !WIIMOTE_IS_CONNECTED(wm)) { - return; - } - req = wm->data_req; - if (!req) { - return; - } - if (!req->data || !req->len) { - return; - } - if (req->state != REQ_READY) { - return; - } - - wiiuse_write_data(wm, req->addr, req->data, req->len); - - req->state = REQ_SENT; - return; -} - -/** - * @brief Send a packet to the wiimote. - * - * @param wm Pointer to a wiimote_t structure. - * @param report_type The report type to send (WIIMOTE_CMD_LED, WIIMOTE_CMD_RUMBLE, etc). Found in wiiuse.h - * @param msg The payload. Might be changed by the callee. - * @param len Length of the payload in bytes. - * - * This function should replace any write()s directly to the wiimote device. - */ -int wiiuse_send(struct wiimote_t* wm, byte report_type, byte* msg, int len) { - switch (report_type) { - case WM_CMD_LED: - case WM_CMD_RUMBLE: - case WM_CMD_CTRL_STATUS: { - /* Rumble flag for: 0x11, 0x13, 0x14, 0x15, 0x19 or 0x1a */ - if (WIIMOTE_IS_SET(wm, WIIMOTE_STATE_RUMBLE)) { - msg[0] |= 0x01; - } - break; - } - default: - break; - } - -#ifdef WITH_WIIUSE_DEBUG - { - int x; - printf("[DEBUG] (id %i) SEND: (%.2x) %.2x ", wm->unid, report_type, msg[0]); - for (x = 1; x < len; ++x) { - printf("%.2x ", msg[x]); - } - printf("\n"); - } -#endif - - return wiiuse_os_write(wm, report_type, msg, len); -} - - -/** - * @brief Set flags for the specified wiimote. - * - * @param wm Pointer to a wiimote_t structure. - * @param enable Flags to enable. - * @param disable Flags to disable. - * - * @return The flags set after 'enable' and 'disable' have been applied. - * - * The values 'enable' and 'disable' may be any flags OR'ed together. - * Flags are defined in wiiuse.h. - */ -int wiiuse_set_flags(struct wiimote_t* wm, int enable, int disable) { - if (!wm) { - return 0; - } - - /* remove mutually exclusive flags */ - enable &= ~disable; - disable &= ~enable; - - wm->flags |= enable; - wm->flags &= ~disable; - - return wm->flags; -} - - -/** - * @brief Set the wiimote smoothing alpha value. - * - * @param wm Pointer to a wiimote_t structure. - * @param alpha The alpha value to set. Between 0 and 1. - * - * @return Returns the old alpha value. - * - * The alpha value is between 0 and 1 and is used in an exponential - * smoothing algorithm. - * - * Smoothing is only performed if the WIIMOTE_USE_SMOOTHING is set. - */ -float wiiuse_set_smooth_alpha(struct wiimote_t* wm, float alpha) { - float old; - - if (!wm) { - return 0.0f; - } - - old = wm->accel_calib.st_alpha; - - wm->accel_calib.st_alpha = alpha; - - /* if there is a nunchuk set that too */ - if (wm->exp.type == EXP_NUNCHUK) { - wm->exp.nunchuk.accel_calib.st_alpha = alpha; - } - - return old; -} - - -/** - * @brief Set the bluetooth stack type to use. - * - * @param wm Array of wiimote_t structures. - * @param wiimotes Number of objects in the wm array. - * @param type The type of bluetooth stack to use. - */ -void wiiuse_set_bluetooth_stack(struct wiimote_t** wm, int wiimotes, enum win_bt_stack_t type) { -#ifdef WIIUSE_WIN32 - int i; - - if (!wm) { - return; - } - - for (i = 0; i < wiimotes; ++i) { - wm[i]->stack = type; - } -#endif -} - - -/** - * @brief Set the orientation event threshold. - * - * @param wm Pointer to a wiimote_t structure. - * @param threshold The decimal place that should be considered a significant change. - * - * If threshold is 0.01, and any angle changes by 0.01 then a significant change - * has occurred and the event callback will be invoked. If threshold is 1 then - * the angle has to change by a full degree to generate an event. - */ -void wiiuse_set_orient_threshold(struct wiimote_t* wm, float threshold) { - if (!wm) { - return; - } - - wm->orient_threshold = threshold; -} - - -/** - * @brief Set the accelerometer event threshold. - * - * @param wm Pointer to a wiimote_t structure. - * @param threshold The decimal place that should be considered a significant change. - */ -void wiiuse_set_accel_threshold(struct wiimote_t* wm, int threshold) { - if (!wm) { - return; - } - - wm->accel_threshold = threshold; -} - - -/** - * @brief Try to resync with the wiimote by starting a new handshake. - * - * @param wm Pointer to a wiimote_t structure. - */ -void wiiuse_resync(struct wiimote_t* wm) { - if (!wm) { - return; - } - -#ifndef WIIUSE_SYNC_HANDSHAKE - wm->handshake_state = 0; -#endif - wiiuse_handshake(wm, NULL, 0); -} - - -/** - * @brief Set the normal and expansion handshake timeouts. - * - * @param wm Array of wiimote_t structures. - * @param wiimotes Number of objects in the wm array. - * @param normal_timeout The timeout in milliseconds for a normal read. - * @param exp_timeout The timeout in millisecondsd to wait for an expansion handshake. - */ -void wiiuse_set_timeout(struct wiimote_t** wm, int wiimotes, byte normal_timeout, byte exp_timeout) { -#ifdef WIIUSE_WIN32 - int i; - - if (!wm) { - return; - } - - for (i = 0; i < wiimotes; ++i) { - wm[i]->normal_timeout = normal_timeout; - wm[i]->exp_timeout = exp_timeout; - } -#endif -} diff --git a/lib/wiiuse/wiiuse.h b/lib/wiiuse/wiiuse.h deleted file mode 100644 index 43320538f..000000000 --- a/lib/wiiuse/wiiuse.h +++ /dev/null @@ -1,960 +0,0 @@ -/* - * wiiuse - * - * Written By: - * Michael Laforest < para > - * Email: < thepara (--AT--) g m a i l [--DOT--] com > - * - * Copyright 2006-2007 - * - * Mac fields based on wiic_structs.h from WiiC, written By: - * Gabriele Randelli - * Email: < randelli (--AT--) dis [--DOT--] uniroma1 [--DOT--] it > - * - * Copyright 2010 - * - * This file is part of wiiuse. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * $Header$ - * - */ - -/** - * @file - * - * @brief API header file. - * - * If this file is included from inside the wiiuse source - * and not from a third party program, then wiimote_internal.h - * is also included which extends this file. - */ - -/** - * @mainpage - * - * @section intro Introduction - * - * WiiUse is a cross-platform C library for accessing the Nintendo Wii - * Remote and its related expansions and variations. - * - * @section project Project - * - * This is a friendly fork of the original WiiUse project, which seems - * to have gone defunct. This updated version incorporates improvements - * from a number of internal forks found across the Internet, and is - * intended to be the new "upstream" of the project. The new homepage is - * on GitHub, where the source is maintained: - * - * - http://github.com/rpavlik/wiiuse - * - * Contributions (under the GPL 3+) are welcome and encouraged! - * - * @section publicapisec Public API - * - * - @ref publicapi "Public API" - entirely within @ref wiiuse.h - * - @ref wiimote "Wiimote device structure" - * - */ -#ifndef WIIUSE_H_INCLUDED -#define WIIUSE_H_INCLUDED - -#define WIIUSE_MAJOR 0 -#define WIIUSE_MINOR 14 -#define WIIUSE_MICRO 0 - -#ifndef WIIUSE_PLATFORM - #if defined(_WIN32) - #define WIIUSE_PLATFORM - #define WIIUSE_WIN32 - #elif defined(__linux) - #define WIIUSE_PLATFORM - #define WIIUSE_BLUEZ - #elif defined(__APPLE__) - #define WIIUSE_PLATFORM - #define WIIUSE_MAC - #else - #error "Platform not yet supported!" - #endif -#endif - -#ifdef WIIUSE_WIN32 - /* windows */ - #ifndef WIN32_LEAN_AND_MEAN - #define WIN32_LEAN_AND_MEAN 1 - #endif - #include -#endif -#ifdef WIIUSE_BLUEZ - /* nix */ - #include -#endif - -#ifndef WCONST - #define WCONST const -#endif - -#if defined(_MSC_VER) -/* MS compilers of pre-VC2010 versions don't have stdint.h - * and I can't get VC2010's stdint.h to compile nicely in - * WiiUse - */ - #include "wiiuse_msvcstdint.h" -#else - #include -#endif - -#include /* for FILE */ - -/** @defgroup publicapi External API */ -/** @{ */ - -/** @name Wiimote state flags and macros */ -/** @{ */ -#define WIIMOTE_STATE_DEV_FOUND 0x0001 -#define WIIMOTE_STATE_HANDSHAKE 0x0002 /* actual connection exists but no handshake yet */ -#define WIIMOTE_STATE_HANDSHAKE_COMPLETE 0x0004 /* actual connection exists but no handshake yet */ -#define WIIMOTE_STATE_CONNECTED 0x0008 -#define WIIMOTE_STATE_RUMBLE 0x0010 -#define WIIMOTE_STATE_ACC 0x0020 -#define WIIMOTE_STATE_EXP 0x0040 -#define WIIMOTE_STATE_IR 0x0080 -#define WIIMOTE_STATE_SPEAKER 0x0100 -#define WIIMOTE_STATE_IR_SENS_LVL1 0x0200 -#define WIIMOTE_STATE_IR_SENS_LVL2 0x0400 -#define WIIMOTE_STATE_IR_SENS_LVL3 0x0800 -#define WIIMOTE_STATE_IR_SENS_LVL4 0x1000 -#define WIIMOTE_STATE_IR_SENS_LVL5 0x2000 -#define WIIMOTE_STATE_EXP_HANDSHAKE 0x10000 /* actual M+ connection exists but no handshake yet */ -#define WIIMOTE_STATE_EXP_EXTERN 0x20000 /* actual M+ connection exists but handshake failed */ -#define WIIMOTE_STATE_EXP_FAILED 0x40000 /* actual M+ connection exists but handshake failed */ -#define WIIMOTE_STATE_MPLUS_PRESENT 0x80000 /* Motion+ is connected */ - -#define WIIMOTE_ID(wm) (wm->unid) - -#define WIIMOTE_IS_SET(wm, s) ((wm->state & (s)) == (s)) -#define WIIMOTE_IS_CONNECTED(wm) (WIIMOTE_IS_SET(wm, WIIMOTE_STATE_CONNECTED)) -/** @} */ - -/** @name LED bit masks */ -/** @{ */ -#define WIIMOTE_LED_NONE 0x00 -#define WIIMOTE_LED_1 0x10 -#define WIIMOTE_LED_2 0x20 -#define WIIMOTE_LED_3 0x40 -#define WIIMOTE_LED_4 0x80 -/** @} */ - -/** @name Button codes */ -/** @{ */ -#define WIIMOTE_BUTTON_TWO 0x0001 -#define WIIMOTE_BUTTON_ONE 0x0002 -#define WIIMOTE_BUTTON_B 0x0004 -#define WIIMOTE_BUTTON_A 0x0008 -#define WIIMOTE_BUTTON_MINUS 0x0010 -#define WIIMOTE_BUTTON_ZACCEL_BIT6 0x0020 -#define WIIMOTE_BUTTON_ZACCEL_BIT7 0x0040 -#define WIIMOTE_BUTTON_HOME 0x0080 -#define WIIMOTE_BUTTON_LEFT 0x0100 -#define WIIMOTE_BUTTON_RIGHT 0x0200 -#define WIIMOTE_BUTTON_DOWN 0x0400 -#define WIIMOTE_BUTTON_UP 0x0800 -#define WIIMOTE_BUTTON_PLUS 0x1000 -#define WIIMOTE_BUTTON_ZACCEL_BIT4 0x2000 -#define WIIMOTE_BUTTON_ZACCEL_BIT5 0x4000 -#define WIIMOTE_BUTTON_UNKNOWN 0x8000 -#define WIIMOTE_BUTTON_ALL 0x1F9F -/** @} */ - -/** @name Nunchuk button codes */ -/** @{ */ -#define NUNCHUK_BUTTON_Z 0x01 -#define NUNCHUK_BUTTON_C 0x02 -#define NUNCHUK_BUTTON_ALL 0x03 -/** @} */ - -/** @name Classic controller button codes */ -/** @{ */ -#define CLASSIC_CTRL_BUTTON_UP 0x0001 -#define CLASSIC_CTRL_BUTTON_LEFT 0x0002 -#define CLASSIC_CTRL_BUTTON_ZR 0x0004 -#define CLASSIC_CTRL_BUTTON_X 0x0008 -#define CLASSIC_CTRL_BUTTON_A 0x0010 -#define CLASSIC_CTRL_BUTTON_Y 0x0020 -#define CLASSIC_CTRL_BUTTON_B 0x0040 -#define CLASSIC_CTRL_BUTTON_ZL 0x0080 -#define CLASSIC_CTRL_BUTTON_FULL_R 0x0200 -#define CLASSIC_CTRL_BUTTON_PLUS 0x0400 -#define CLASSIC_CTRL_BUTTON_HOME 0x0800 -#define CLASSIC_CTRL_BUTTON_MINUS 0x1000 -#define CLASSIC_CTRL_BUTTON_FULL_L 0x2000 -#define CLASSIC_CTRL_BUTTON_DOWN 0x4000 -#define CLASSIC_CTRL_BUTTON_RIGHT 0x8000 -#define CLASSIC_CTRL_BUTTON_ALL 0xFEFF -/** @} */ - -/** @name Guitar Hero 3 button codes */ -/** @{ */ -#define GUITAR_HERO_3_BUTTON_STRUM_UP 0x0001 -#define GUITAR_HERO_3_BUTTON_YELLOW 0x0008 -#define GUITAR_HERO_3_BUTTON_GREEN 0x0010 -#define GUITAR_HERO_3_BUTTON_BLUE 0x0020 -#define GUITAR_HERO_3_BUTTON_RED 0x0040 -#define GUITAR_HERO_3_BUTTON_ORANGE 0x0080 -#define GUITAR_HERO_3_BUTTON_PLUS 0x0400 -#define GUITAR_HERO_3_BUTTON_MINUS 0x1000 -#define GUITAR_HERO_3_BUTTON_STRUM_DOWN 0x4000 -#define GUITAR_HERO_3_BUTTON_ALL 0xFEFF -/** @} */ - -/** @name Wiimote option flags */ -/** @{ */ -#define WIIUSE_SMOOTHING 0x01 -#define WIIUSE_CONTINUOUS 0x02 -#define WIIUSE_ORIENT_THRESH 0x04 -#define WIIUSE_INIT_FLAGS (WIIUSE_SMOOTHING | WIIUSE_ORIENT_THRESH) - -#define WIIUSE_ORIENT_PRECISION 100.0f -/** @} */ - -/** @name Expansion codes */ -/** @{ */ -#define EXP_NONE 0 -#define EXP_NUNCHUK 1 -#define EXP_CLASSIC 2 -#define EXP_GUITAR_HERO_3 3 -#define EXP_WII_BOARD 4 -#define EXP_MOTION_PLUS 5 -#define EXP_MOTION_PLUS_NUNCHUK 6 /* Motion+ in nunchuk pass-through mode */ -#define EXP_MOTION_PLUS_CLASSIC 7 /* Motion+ in classic ctr. pass-through mode */ -/** @} */ - -/** @brief IR correction types */ -typedef enum ir_position_t { - WIIUSE_IR_ABOVE, - WIIUSE_IR_BELOW -} ir_position_t; - - -/** @name Device Inquiry Macros */ -/** @{ */ -/** - * @brief Check if a button is pressed. - * @param dev Pointer to a wiimote_t or expansion structure. - * @param button The button you are interested in. - * @return 1 if the button is pressed, 0 if not. - */ -#define IS_PRESSED(dev, button) ((dev->btns & button) == button) - -/** - * @brief Check if a button is being held. - * @param dev Pointer to a wiimote_t or expansion structure. - * @param button The button you are interested in. - * @return 1 if the button is held, 0 if not. - */ -#define IS_HELD(dev, button) ((dev->btns_held & button) == button) - -/** - * @brief Check if a button is released on this event. \n\n - * This does not mean the button is not pressed, it means \n - * this button was just now released. - * @param dev Pointer to a wiimote_t or expansion structure. - * @param button The button you are interested in. - * @return 1 if the button is released, 0 if not. - * - */ -#define IS_RELEASED(dev, button) ((dev->btns_released & button) == button) - -/** - * @brief Check if a button has just been pressed this event. - * @param dev Pointer to a wiimote_t or expansion structure. - * @param button The button you are interested in. - * @return 1 if the button is pressed, 0 if not. - */ -#define IS_JUST_PRESSED(dev, button) (IS_PRESSED(dev, button) && !IS_HELD(dev, button)) - -/** - * @brief Return the IR sensitivity level. - * @param wm Pointer to a wiimote_t structure. - * @param lvl [out] Pointer to an int that will hold the level setting. - * If no level is set 'lvl' will be set to 0. - */ -#define WIIUSE_GET_IR_SENSITIVITY(dev, lvl) \ - do { \ - if ((wm->state & 0x0200) == 0x0200) *lvl = 1; \ - else if ((wm->state & 0x0400) == 0x0400) *lvl = 2; \ - else if ((wm->state & 0x0800) == 0x0800) *lvl = 3; \ - else if ((wm->state & 0x1000) == 0x1000) *lvl = 4; \ - else if ((wm->state & 0x2000) == 0x2000) *lvl = 5; \ - else *lvl = 0; \ - } while (0) - -#define WIIUSE_USING_ACC(wm) ((wm->state & 0x020) == 0x020) -#define WIIUSE_USING_EXP(wm) ((wm->state & 0x040) == 0x040) -#define WIIUSE_USING_IR(wm) ((wm->state & 0x080) == 0x080) -#define WIIUSE_USING_SPEAKER(wm) ((wm->state & 0x100) == 0x100) - -#define WIIUSE_IS_LED_SET(wm, num) ((wm->leds & WIIMOTE_LED_##num) == WIIMOTE_LED_##num) -/** @} */ - -/* - * This is left over from an old hack, but it may actually - * be a useful feature to keep so it wasn't removed. - */ -#ifdef WIIUSE_WIN32 - #define WIIMOTE_DEFAULT_TIMEOUT 10 - #define WIIMOTE_EXP_TIMEOUT 10 -#endif - -#define WIIUSE_SYNC_HANDSHAKE - - -typedef unsigned char byte; -typedef char sbyte; - -struct wiimote_t; -struct vec3b_t; -struct orient_t; -struct gforce_t; - - -/** - * @brief Callback that handles a read event. - * - * @param wm Pointer to a wiimote_t structure. - * @param data Pointer to the filled data block. - * @param len Length in bytes of the data block. - * - * @see wiiuse_init() - * - * A registered function of this type is called automatically by the wiiuse - * library when the wiimote has returned the full data requested by a previous - * call to wiiuse_read_data(). - */ -typedef void (*wiiuse_read_cb)(struct wiimote_t* wm, byte* data, uint16_t len); - - -/** - * @brief Data read request structure. - */ -struct read_req_t { - wiiuse_read_cb cb; /**< read data callback */ - byte* buf; /**< buffer where read data is written */ - uint32_t addr; /**< the offset that the read started at */ - uint16_t size; /**< the length of the data read */ - uint16_t wait; /**< num bytes still needed to finish read */ - byte dirty; /**< set to 1 if not using callback and needs to be cleaned up */ - - struct read_req_t* next; /**< next read request in the queue */ -}; - -/** - * @struct ang3s_t - * @brief Roll/Pitch/Yaw short angles. - */ -typedef struct ang3s_t { - int16_t roll, pitch, yaw; -} ang3s_t; - -/** - * @struct ang3f_t - * @brief Roll/Pitch/Yaw float angles. - */ -typedef struct ang3f_t { - float roll, pitch, yaw; -} ang3f_t; - -/** - * @brief Unsigned x,y byte vector. - */ -typedef struct vec2b_t { - byte x, y; -} vec2b_t; - - -/** - * @brief Unsigned x,y,z byte vector. - */ -typedef struct vec3b_t { - byte x, y, z; -} vec3b_t; - - -/** - * @brief Signed x,y,z float struct. - */ -typedef struct vec3f_t { - float x, y, z; -} vec3f_t; - - -/** - * @brief Orientation struct. - * - * Yaw, pitch, and roll range from -180 to 180 degrees. - */ -typedef struct orient_t { - float roll; /**< roll, this may be smoothed if enabled */ - float pitch; /**< pitch, this may be smoothed if enabled */ - float yaw; - - float a_roll; /**< absolute roll, unsmoothed */ - float a_pitch; /**< absolute pitch, unsmoothed */ -} orient_t; - - -/** - * @brief Gravity force struct. - */ -typedef struct gforce_t { - float x, y, z; -} gforce_t; - - -/** - * @brief Accelerometer struct. For any device with an accelerometer. - */ -typedef struct accel_t { - struct vec3b_t cal_zero; /**< zero calibration */ - struct vec3b_t cal_g; /**< 1g difference around 0cal */ - - float st_roll; /**< last smoothed roll value */ - float st_pitch; /**< last smoothed roll pitch */ - float st_alpha; /**< alpha value for smoothing [0-1] */ -} accel_t; - - -/** - * @brief A single IR source. - */ -typedef struct ir_dot_t { - byte visible; /**< if the IR source is visible */ - - unsigned int x; /**< interpolated X coordinate */ - unsigned int y; /**< interpolated Y coordinate */ - - int16_t rx; /**< raw X coordinate (0-1023) */ - int16_t ry; /**< raw Y coordinate (0-767) */ - - byte order; /**< increasing order by x-axis value */ - - byte size; /**< size of the IR dot (0-15) */ -} ir_dot_t; - - -/** - * @brief Screen aspect ratio. - */ -typedef enum aspect_t { - WIIUSE_ASPECT_4_3, - WIIUSE_ASPECT_16_9 -} aspect_t; - - -/** - * @brief IR struct. Hold all data related to the IR tracking. - */ -typedef struct ir_t { - struct ir_dot_t dot[4]; /**< IR dots */ - byte num_dots; /**< number of dots at this time */ - - enum aspect_t aspect; /**< aspect ratio of the screen */ - - enum ir_position_t pos; /**< IR sensor bar position */ - - unsigned int vres[2]; /**< IR virtual screen resolution */ - int offset[2]; /**< IR XY correction offset */ - int state; /**< keeps track of the IR state */ - - int ax; /**< absolute X coordinate */ - int ay; /**< absolute Y coordinate */ - - int x; /**< calculated X coordinate */ - int y; /**< calculated Y coordinate */ - - float distance; /**< pixel distance between first 2 dots*/ - float z; /**< calculated distance */ -} ir_t; - - -/** - * @brief Joystick calibration structure. - * - * The angle \a ang is relative to the positive y-axis into quadrant I - * and ranges from 0 to 360 degrees. So if the joystick is held straight - * upwards then angle is 0 degrees. If it is held to the right it is 90, - * down is 180, and left is 270. - * - * The magnitude \a mag is the distance from the center to where the - * joystick is being held. The magnitude ranges from 0 to 1. - * If the joystick is only slightly tilted from the center the magnitude - * will be low, but if it is closer to the outter edge the value will - * be higher. - */ -typedef struct joystick_t { - struct vec2b_t max; /**< maximum joystick values */ - struct vec2b_t min; /**< minimum joystick values */ - struct vec2b_t center; /**< center joystick values */ - - float ang; /**< angle the joystick is being held */ - float mag; /**< magnitude of the joystick (range 0-1) */ -} joystick_t; - - -/** - * @brief Nunchuk expansion device. - */ -typedef struct nunchuk_t { - struct accel_t accel_calib; /**< nunchuk accelerometer calibration */ - struct joystick_t js; /**< joystick calibration */ - - int* flags; /**< options flag (points to wiimote_t.flags) */ - - byte btns; /**< what buttons have just been pressed */ - byte btns_held; /**< what buttons are being held down */ - byte btns_released; /**< what buttons were just released this */ - - float orient_threshold; /**< threshold for orient to generate an event */ - int accel_threshold; /**< threshold for accel to generate an event */ - - struct vec3b_t accel; /**< current raw acceleration data */ - struct orient_t orient; /**< current orientation on each axis */ - struct gforce_t gforce; /**< current gravity forces on each axis */ -} nunchuk_t; - - -/** - * @brief Classic controller expansion device. - */ -typedef struct classic_ctrl_t { - int16_t btns; /**< what buttons have just been pressed */ - int16_t btns_held; /**< what buttons are being held down */ - int16_t btns_released; /**< what buttons were just released this */ - - float r_shoulder; /**< right shoulder button (range 0-1) */ - float l_shoulder; /**< left shoulder button (range 0-1) */ - - struct joystick_t ljs; /**< left joystick calibration */ - struct joystick_t rjs; /**< right joystick calibration */ -} classic_ctrl_t; - - -/** - * @brief Guitar Hero 3 expansion device. - */ -typedef struct guitar_hero_3_t { - int16_t btns; /**< what buttons have just been pressed */ - int16_t btns_held; /**< what buttons are being held down */ - int16_t btns_released; /**< what buttons were just released this */ - - float whammy_bar; /**< whammy bar (range 0-1) */ - - struct joystick_t js; /**< joystick calibration */ -} guitar_hero_3_t; - - -/** - * @brief Motion Plus expansion device - */ -typedef struct motion_plus_t { - byte ext; /**< is there a device on the pass-through port? */ - - struct ang3s_t raw_gyro; /**< current raw gyroscope data */ - struct ang3s_t cal_gyro; /**< calibration raw gyroscope data */ - struct ang3f_t angle_rate_gyro; /**< current gyro angle rate */ - struct orient_t orient; /**< current orientation on each axis using Motion Plus gyroscopes */ - byte acc_mode; /**< Fast/slow rotation mode for roll, pitch and yaw (0 if rotating fast, 1 if slow or still) */ - int raw_gyro_threshold; /**< threshold for gyroscopes to generate an event */ - - struct nunchuk_t *nc; /**< pointers to nunchuk & classic in pass-through-mode */ - struct classic_ctrl_t *classic; -} motion_plus_t; - -/** - * @brief Wii Balance Board "expansion" device. - * - * A Balance Board presents itself as a Wiimote with a permanently-attached - * Balance Board expansion device. - */ -typedef struct wii_board_t { - /** @name Interpolated weight per sensor (kg) - * - * These are the values you're most likely to use. - * - * See example.c for how to compute total weight and center of gravity - * from these values. - */ - /** @{ */ - float tl; - float tr; - float bl; - float br; - /** @} */ - - /** @name Raw sensor values */ - /** @{ */ - uint16_t rtl; - uint16_t rtr; - uint16_t rbl; - uint16_t rbr; - /** @} */ - - /** @name Sensor calibration values */ - /** @{ */ - uint16_t ctl[3]; /* Calibration */ - uint16_t ctr[3]; - uint16_t cbl[3]; - uint16_t cbr[3]; /* /Calibration */ - /** @} */ - uint8_t update_calib; -} wii_board_t; - - -/** - * @brief Generic expansion device plugged into wiimote. - */ -typedef struct expansion_t { - int type; /**< type of expansion attached */ - - struct motion_plus_t mp; - - union { - struct nunchuk_t nunchuk; - struct classic_ctrl_t classic; - struct guitar_hero_3_t gh3; - struct wii_board_t wb; - }; -} expansion_t; - - -/** - * @brief Available bluetooth stacks for Windows. - */ -typedef enum win_bt_stack_t { - WIIUSE_STACK_UNKNOWN, - WIIUSE_STACK_MS, - WIIUSE_STACK_BLUESOLEIL -} win_bt_stack_t; - - -/** - * @brief Significant data from the previous event. - */ -typedef struct wiimote_state_t { - /* expansion_t */ - float exp_ljs_ang; - float exp_rjs_ang; - float exp_ljs_mag; - float exp_rjs_mag; - uint16_t exp_btns; - struct orient_t exp_orient; - struct vec3b_t exp_accel; - float exp_r_shoulder; - float exp_l_shoulder; - - /* motion plus */ - short drx; - short dry; - short drz; - - /* wiiboard */ - uint16_t exp_wb_rtr; - uint16_t exp_wb_rtl; - uint16_t exp_wb_rbr; - uint16_t exp_wb_rbl; - - /* ir_t */ - int ir_ax; - int ir_ay; - float ir_distance; - - struct orient_t orient; - uint16_t btns; - - struct vec3b_t accel; -} wiimote_state_t; - - -/** - * @brief Events that wiiuse can generate from a poll. - */ -typedef enum WIIUSE_EVENT_TYPE { - WIIUSE_NONE = 0, - WIIUSE_EVENT, - WIIUSE_STATUS, - WIIUSE_CONNECT, - WIIUSE_DISCONNECT, - WIIUSE_UNEXPECTED_DISCONNECT, - WIIUSE_READ_DATA, - WIIUSE_WRITE_DATA, - WIIUSE_NUNCHUK_INSERTED, - WIIUSE_NUNCHUK_REMOVED, - WIIUSE_CLASSIC_CTRL_INSERTED, - WIIUSE_CLASSIC_CTRL_REMOVED, - WIIUSE_GUITAR_HERO_3_CTRL_INSERTED, - WIIUSE_GUITAR_HERO_3_CTRL_REMOVED, - WIIUSE_WII_BOARD_CTRL_INSERTED, - WIIUSE_WII_BOARD_CTRL_REMOVED, - WIIUSE_MOTION_PLUS_ACTIVATED, - WIIUSE_MOTION_PLUS_REMOVED -} WIIUSE_EVENT_TYPE; - -/** - * @brief Type of wiimote peripheral - */ -typedef enum WIIUSE_WIIMOTE_TYPE { - WIIUSE_WIIMOTE_REGULAR = 0, - WIIUSE_WIIMOTE_MOTION_PLUS_INSIDE, -} WIIUSE_WIIMOTE_TYPE; - -/** - * @brief Main Wiimote device structure. - * - * You need one of these to do pretty much anything with this library. - */ -typedef struct wiimote_t { - WCONST int unid; /**< user specified id */ - -#ifdef WIIUSE_BLUEZ - /** @name Linux-specific (BlueZ) members */ - /** @{ */ - WCONST char bdaddr_str[18]; /**< readable bt address */ - WCONST bdaddr_t bdaddr; /**< bt address */ - WCONST int out_sock; /**< output socket */ - WCONST int in_sock; /**< input socket */ - /** @} */ -#endif - -#ifdef WIIUSE_WIN32 - /** @name Windows-specific members */ - /** @{ */ - WCONST HANDLE dev_handle; /**< HID handle */ - WCONST OVERLAPPED hid_overlap; /**< overlap handle */ - WCONST enum win_bt_stack_t stack; /**< type of bluetooth stack to use */ - WCONST int timeout; /**< read timeout */ - WCONST byte normal_timeout; /**< normal timeout */ - WCONST byte exp_timeout; /**< timeout for expansion handshake */ - /** @} */ -#endif - -#ifdef WIIUSE_MAC - /** @name Mac OS X-specific members */ - /** @{ */ - WCONST void* objc_wm; /** WiiuseWiimote* as opaque pointer */ - /** @} */ -#endif - - WCONST int state; /**< various state flags */ - WCONST byte leds; /**< currently lit leds */ - WCONST float battery_level; /**< battery level */ - - WCONST int flags; /**< options flag */ - -#ifndef WIIUSE_SYNC_HANDSHAKE - WCONST byte handshake_state; /**< the state of the connection handshake */ -#endif - WCONST byte expansion_state; /**< the state of the expansion handshake */ - WCONST struct data_req_t* data_req; /**< list of data read requests */ - - WCONST struct read_req_t* read_req; /**< list of data read requests */ - WCONST struct accel_t accel_calib; /**< wiimote accelerometer calibration */ - WCONST struct expansion_t exp; /**< wiimote expansion device */ - - WCONST struct vec3b_t accel; /**< current raw acceleration data */ - WCONST struct orient_t orient; /**< current orientation on each axis */ - WCONST struct gforce_t gforce; /**< current gravity forces on each axis */ - - WCONST struct ir_t ir; /**< IR data */ - - WCONST uint16_t btns; /**< what buttons have just been pressed */ - WCONST uint16_t btns_held; /**< what buttons are being held down */ - WCONST uint16_t btns_released; /**< what buttons were just released this */ - - WCONST float orient_threshold; /**< threshold for orient to generate an event */ - WCONST int32_t accel_threshold; /**< threshold for accel to generate an event */ - - WCONST struct wiimote_state_t lstate; /**< last saved state */ - - WCONST WIIUSE_EVENT_TYPE event; /**< type of event that occurred */ - WCONST byte motion_plus_id[6]; - WCONST WIIUSE_WIIMOTE_TYPE type; -} wiimote; - -/** @brief Data passed to a callback during wiiuse_update() */ -typedef struct wiimote_callback_data_t { - WCONST int uid; - WCONST byte leds; - WCONST float battery_level; - WCONST struct vec3b_t accel; - WCONST struct orient_t orient; - WCONST struct gforce_t gforce; - WCONST struct ir_t ir; - WCONST uint16_t buttons; - WCONST uint16_t buttons_held; - WCONST uint16_t buttons_released; - WCONST WIIUSE_EVENT_TYPE event; - WCONST int state; - WCONST struct expansion_t expansion; -} wiimote_callback_data_t; - -/** @brief Callback type */ -typedef void (*wiiuse_update_cb)(struct wiimote_callback_data_t* wm); - -/** - * @brief Callback that handles a write event. - * - * @param wm Pointer to a wiimote_t structure. - * @param data Pointer to the sent data block. - * @param len Length in bytes of the data block. - * - * @see wiiuse_init() - * - * A registered function of this type is called automatically by the wiiuse - * library when the wiimote has returned the full data requested by a previous - * call to wiiuse_write_data(). - */ -typedef void (*wiiuse_write_cb)(struct wiimote_t* wm, unsigned char* data, unsigned short len); - -typedef enum data_req_s { - REQ_READY = 0, - REQ_SENT, - REQ_DONE -} data_req_s; - -/** - * @struct data_req_t - * @brief Data write request structure. - */ -struct data_req_t { - - byte data[21]; /**< buffer where read data is written */ - byte len; - unsigned int addr; - data_req_s state; /**< set to 1 if not using callback and needs to be cleaned up */ - wiiuse_write_cb cb; /**< read data callback */ - struct data_req_t *next; -}; - -/** - * @brief Loglevels supported by wiiuse. - */ -typedef enum wiiuse_loglevel { - LOGLEVEL_ERROR = 0, - LOGLEVEL_WARNING = 1, - LOGLEVEL_INFO = 2, - LOGLEVEL_DEBUG = 3 -} wiiuse_loglevel; - -/***************************************** - * - * Include API specific stuff - * - *****************************************/ - -#ifdef WIIUSE_WIN32 - #ifdef WIIUSE_STATIC - #define WIIUSE_EXPORT_DECL - #define WIIUSE_IMPORT_DECL - #else - #define WIIUSE_EXPORT_DECL __declspec(dllexport) - #define WIIUSE_IMPORT_DECL __declspec(dllimport) - #endif -#else - #define WIIUSE_EXPORT_DECL - #define WIIUSE_IMPORT_DECL -#endif - -#ifdef WIIUSE_COMPILE_LIB - #define WIIUSE_EXPORT WIIUSE_EXPORT_DECL -#else - #define WIIUSE_EXPORT WIIUSE_IMPORT_DECL -#endif - -#ifdef __cplusplus -extern "C" { -#endif - - /* wiiuse.c */ - WIIUSE_EXPORT extern const char* wiiuse_version(); - - /** @brief Define indicating the presence of the feature allowing you to - * redirect output for one or more logging levels within the library. - */ -#define WIIUSE_HAS_OUTPUT_REDIRECTION - WIIUSE_EXPORT extern void wiiuse_set_output(enum wiiuse_loglevel loglevel, FILE *logtarget); - - WIIUSE_EXPORT extern struct wiimote_t** wiiuse_init(int wiimotes); - WIIUSE_EXPORT extern void wiiuse_disconnected(struct wiimote_t* wm); - WIIUSE_EXPORT extern void wiiuse_cleanup(struct wiimote_t** wm, int wiimotes); - WIIUSE_EXPORT extern void wiiuse_rumble(struct wiimote_t* wm, int status); - WIIUSE_EXPORT extern void wiiuse_toggle_rumble(struct wiimote_t* wm); - WIIUSE_EXPORT extern void wiiuse_set_leds(struct wiimote_t* wm, int leds); - WIIUSE_EXPORT extern void wiiuse_motion_sensing(struct wiimote_t* wm, int status); - WIIUSE_EXPORT extern int wiiuse_read_data(struct wiimote_t* wm, byte* buffer, unsigned int offset, uint16_t len); - WIIUSE_EXPORT extern int wiiuse_write_data(struct wiimote_t* wm, unsigned int addr, const byte* data, byte len); - WIIUSE_EXPORT extern void wiiuse_status(struct wiimote_t* wm); - WIIUSE_EXPORT extern struct wiimote_t* wiiuse_get_by_id(struct wiimote_t** wm, int wiimotes, int unid); - WIIUSE_EXPORT extern int wiiuse_set_flags(struct wiimote_t* wm, int enable, int disable); - WIIUSE_EXPORT extern float wiiuse_set_smooth_alpha(struct wiimote_t* wm, float alpha); - WIIUSE_EXPORT extern void wiiuse_set_bluetooth_stack(struct wiimote_t** wm, int wiimotes, enum win_bt_stack_t type); - WIIUSE_EXPORT extern void wiiuse_set_orient_threshold(struct wiimote_t* wm, float threshold); - WIIUSE_EXPORT extern void wiiuse_resync(struct wiimote_t* wm); - WIIUSE_EXPORT extern void wiiuse_set_timeout(struct wiimote_t** wm, int wiimotes, byte normal_timeout, byte exp_timeout); - WIIUSE_EXPORT extern void wiiuse_set_accel_threshold(struct wiimote_t* wm, int threshold); - - /* io.c */ - WIIUSE_EXPORT extern int wiiuse_find(struct wiimote_t** wm, int max_wiimotes, int timeout); - WIIUSE_EXPORT extern int wiiuse_connect(struct wiimote_t** wm, int wiimotes); - WIIUSE_EXPORT extern void wiiuse_disconnect(struct wiimote_t* wm); - - /* events.c */ - WIIUSE_EXPORT extern int wiiuse_poll(struct wiimote_t** wm, int wiimotes); - - /** - * @brief Poll Wiimotes, and call the provided callback with information - * on each Wiimote that had an event. - * - * Alternative to calling wiiuse_poll yourself, and provides the same - * information struct on all platforms. - * - * @return Number of wiimotes that had an event. - */ - WIIUSE_EXPORT extern int wiiuse_update(struct wiimote_t** wm, int wiimotes, wiiuse_update_cb callback); - - /* ir.c */ - WIIUSE_EXPORT extern void wiiuse_set_ir(struct wiimote_t* wm, int status); - WIIUSE_EXPORT extern void wiiuse_set_ir_vres(struct wiimote_t* wm, unsigned int x, unsigned int y); - WIIUSE_EXPORT extern void wiiuse_set_ir_position(struct wiimote_t* wm, enum ir_position_t pos); - WIIUSE_EXPORT extern void wiiuse_set_aspect_ratio(struct wiimote_t* wm, enum aspect_t aspect); - WIIUSE_EXPORT extern void wiiuse_set_ir_sensitivity(struct wiimote_t* wm, int level); - - /* nunchuk.c */ - WIIUSE_EXPORT extern void wiiuse_set_nunchuk_orient_threshold(struct wiimote_t* wm, float threshold); - WIIUSE_EXPORT extern void wiiuse_set_nunchuk_accel_threshold(struct wiimote_t* wm, int threshold); - - /* wiiboard.c */ - /* this function not currently implemented... */ - WIIUSE_EXPORT extern void wiiuse_set_wii_board_calib(struct wiimote_t *wm); - - WIIUSE_EXPORT extern void wiiuse_set_motion_plus(struct wiimote_t *wm, int status); - -#ifdef __cplusplus -} -#endif - -/** @} */ - -#endif /* WIIUSE_H_INCLUDED */ - diff --git a/lib/wiiuse/wiiuse/wiiuse.vcproj b/lib/wiiuse/wiiuse/wiiuse.vcproj deleted file mode 100755 index 1b3912912..000000000 --- a/lib/wiiuse/wiiuse/wiiuse.vcproj +++ /dev/null @@ -1,271 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/lib/wiiuse/wiiuse_internal.h b/lib/wiiuse/wiiuse_internal.h deleted file mode 100644 index 9e6018b4a..000000000 --- a/lib/wiiuse/wiiuse_internal.h +++ /dev/null @@ -1,448 +0,0 @@ -/* - * wiiuse - * - * Written By: - * Michael Laforest < para > - * Email: < thepara (--AT--) g m a i l [--DOT--] com > - * - * Copyright 2006-2007 - * - * This file is part of wiiuse. - * - * Mac device classes based on wiic_internal.h from WiiC, written By: - * Gabriele Randelli - * Email: < randelli (--AT--) dis [--DOT--] uniroma1 [--DOT--] it > - * - * Copyright 2010 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * $Header$ - * - */ - -/** - * @file - * @brief General internal wiiuse stuff. - * - * Since Wiiuse is a library, wiiuse.h is a duplicate - * of the API header. - * - * The code that would normally go in that file, but - * which is not needed by third party developers, - * is put here. - * - * So wiiuse_internal.h is included by other files - * internally, wiiuse.h is included only here. - */ - -#ifndef WIIUSE_INTERNAL_H_INCLUDED -#define WIIUSE_INTERNAL_H_INCLUDED - -#ifndef WIIUSE_PLATFORM - #if defined(_WIN32) - #define WIIUSE_PLATFORM - #define WIIUSE_WIN32 - #elif defined(__linux) - #define WIIUSE_PLATFORM - #define WIIUSE_BLUEZ - #elif defined(__APPLE__) - #define WIIUSE_PLATFORM - #define WIIUSE_MAC - #else - #error "Platform not yet supported!" - #endif -#endif - -#ifdef WIIUSE_WIN32 - #include -#endif -#ifdef WIIUSE_BLUEZ - #include /* htons() */ - #include -#endif -#ifdef WIIUSE_MAC - /* mac */ - #include /*CFRunLoops and CFNumberRef in Bluetooth classes*/ - #include /*IOBluetoothDeviceRef and IOBluetoothL2CAPChannelRef*/ -#endif - -#include "definitions.h" - -#if defined(_MSC_VER) -/* MS compilers of pre-VC2010 versions don't have stdint.h - * and I can't get VC2010's stdint.h to compile nicely in - * WiiUse - */ - #include "wiiuse_msvcstdint.h" -#else - #include -#endif - -/******************** - * - * Wiimote internal codes - * - ********************/ - - -/** @addtogroup internal_general Internal: API for General Internal Use */ -/** @{ */ -/* Communication channels */ -#define WM_OUTPUT_CHANNEL 0x11 -#define WM_INPUT_CHANNEL 0x13 - -#define WM_SET_REPORT 0x50 -#define WM_SET_DATA 0xA0 - -/* commands */ -#define WM_CMD_LED 0x11 -#define WM_CMD_REPORT_TYPE 0x12 -#define WM_CMD_RUMBLE 0x13 -#define WM_CMD_IR 0x13 -#define WM_CMD_CTRL_STATUS 0x15 -#define WM_CMD_WRITE_DATA 0x16 -#define WM_CMD_READ_DATA 0x17 -#define WM_CMD_IR_2 0x1A - -/* input report ids */ -#define WM_RPT_CTRL_STATUS 0x20 -#define WM_RPT_READ 0x21 -#define WM_RPT_WRITE 0x22 -#define WM_RPT_BTN 0x30 -#define WM_RPT_BTN_ACC 0x31 -#define WM_RPT_BTN_ACC_IR 0x33 -#define WM_RPT_BTN_EXP 0x34 -#define WM_RPT_BTN_ACC_EXP 0x35 -#define WM_RPT_BTN_IR_EXP 0x36 -#define WM_RPT_BTN_ACC_IR_EXP 0x37 - -#define WM_BT_INPUT 0x01 -#define WM_BT_OUTPUT 0x02 - -/* Identify the wiimote device by its class */ - -/* (Explanation and mac classes taken from WiiC) - * The different codes wrt. to Linux - * is a bit hard to explain. - * Looking at Bluetooth CoD format, we have 24 bits. - * In wiic Linux they are stored in three fields, - * each one 8bit long. The result number is - * 0x002504. However, MacOS Bluetooth does - * not store them in such a way, rather it uses - * the concept of major service, major class, - * and minor class, that are respectivelly - * 11bit, 5bit, and 6bit long. Hence, the - * numbers are different. - * The Wiimote CoD Bluetooth division is the following: - * 00000000001 00101 000001 00 (major service - major class - minor class - format type) - * This can also be seen in the WiiC Linux way: - * 00000000 00100101 00000100 - */ -#ifdef WIIUSE_MAC - #define WM_DEV_MINOR_CLASS 0x01 // Regular wiimote - #define WM_DEV_MAJOR_CLASS 0x05 - #define WM_DEV_MAJOR_SERVICE 0x01 - - #define WM_PLUS_DEV_MINOR_CLASS 0x02 // For the newer RVL-CNT-01-TR (MotionPlus Inside) - #define WM_PLUS_DEV_MAJOR_CLASS 0x05 - #define WM_PLUS_DEV_MAJOR_SERVICE 0x00 -#else - #define WM_DEV_CLASS_0 0x04 // Regular wiimote - #define WM_DEV_CLASS_1 0x25 - #define WM_DEV_CLASS_2 0x00 - - #define WM_PLUS_DEV_CLASS_0 0x08 // For the newer RVL-CNT-01-TR (MotionPlus Inside) - #define WM_PLUS_DEV_CLASS_1 0x05 - #define WM_PLUS_DEV_CLASS_2 0x00 -#endif -#define WM_VENDOR_ID 0x057E -#define WM_PRODUCT_ID 0x0306 // Regular wiimote -#define WM_PLUS_PRODUCT_ID 0x0330 // For the newer RVL-CNT-01-TR (MotionPlus Inside) - -/* controller status stuff */ -#define WM_MAX_BATTERY_CODE 0xC8 - -/* offsets in wiimote memory */ -#define WM_MEM_OFFSET_CALIBRATION 0x16 -#define WM_EXP_MEM_BASE 0x04A40000 -#define WM_EXP_ID 0x04A400FA -#define WM_EXP_MEM_ENABLE 0x04A40040 -#define WM_EXP_MEM_ENABLE1 0x04A400F0 -#define WM_EXP_MEM_ENABLE2 0x04A400FB -#define WM_EXP_MEM_CALIBR 0x04A40020 -#define WM_EXP_MOTION_PLUS_IDENT 0x04A600FA -#define WM_EXP_MOTION_PLUS_ENABLE 0x04A600FE -#define WM_EXP_MOTION_PLUS_INIT 0x04A600F0 -#define WM_REG_IR 0x04B00030 -#define WM_REG_IR_BLOCK1 0x04B00000 -#define WM_REG_IR_BLOCK2 0x04B0001A -#define WM_REG_IR_MODENUM 0x04B00033 - - -#define WM_IR_TYPE_BASIC 0x01 -#define WM_IR_TYPE_EXTENDED 0x03 - -/* controller status flags for the first message byte */ -/* bit 1 is unknown */ -#define WM_CTRL_STATUS_BYTE1_ATTACHMENT 0x02 -#define WM_CTRL_STATUS_BYTE1_SPEAKER_ENABLED 0x04 -#define WM_CTRL_STATUS_BYTE1_IR_ENABLED 0x08 -#define WM_CTRL_STATUS_BYTE1_LED_1 0x10 -#define WM_CTRL_STATUS_BYTE1_LED_2 0x20 -#define WM_CTRL_STATUS_BYTE1_LED_3 0x40 -#define WM_CTRL_STATUS_BYTE1_LED_4 0x80 - -/* aspect ratio */ -#define WM_ASPECT_16_9_X 660 -#define WM_ASPECT_16_9_Y 370 -#define WM_ASPECT_4_3_X 560 -#define WM_ASPECT_4_3_Y 420 - - -/** - * Expansion stuff - */ - -/* decrypted expansion id codes (located at 0x04A400FC) */ -#define EXP_ID_CODE_NUNCHUK 0xA4200000 -#define EXP_ID_CODE_WII_BOARD 0xA4200402 -#define EXP_ID_CODE_CLASSIC_CONTROLLER 0xA4200101 -#define EXP_ID_CODE_GUITAR 0xA4200103 -#define EXP_ID_CODE_MOTION_PLUS 0xA4200405 -#define EXP_ID_CODE_MOTION_PLUS_NUNCHUK 0xA4200505 /** Motion Plus ID in Nunchuck passthrough mode */ -#define EXP_ID_CODE_MOTION_PLUS_CLASSIC 0xA4200705 /** Motion Plus ID in Classic control. passthrough */ - -/* decrypted M+ codes at 0x04A600FA */ -#define EXP_ID_CODE_INACTIVE_MOTION_PLUS 0xA6200005 /** Inactive Motion Plus ID */ -#define EXP_ID_CODE_NLA_MOTION_PLUS 0xA6200405 /** No longer active Motion Plus ID */ -#define EXP_ID_CODE_NLA_MOTION_PLUS_NUNCHUK 0xA6200505 /** No longer active Motion Plus ID in Nunchuck passthrough mode */ -#define EXP_ID_CODE_NLA_MOTION_PLUS_CLASSIC 0xA6200705 /** No longer active Motion Plus ID in Classic control. passthrough */ - -#define EXP_HANDSHAKE_LEN 224 - -/******************** - * - * End Wiimote internal codes - * - ********************/ - -#define WIIMOTE_INIT_STATES (WIIMOTE_STATE_IR_SENS_LVL3) - -/* macro to manage states */ -#define WIIMOTE_ENABLE_STATE(wm, s) (wm->state |= (s)) -#define WIIMOTE_DISABLE_STATE(wm, s) (wm->state &= ~(s)) -#define WIIMOTE_TOGGLE_STATE(wm, s) ((wm->state & (s)) ? WIIMOTE_DISABLE_STATE(wm, s) : WIIMOTE_ENABLE_STATE(wm, s)) - -#define WIIMOTE_IS_FLAG_SET(wm, s) ((wm->flags & (s)) == (s)) -#define WIIMOTE_ENABLE_FLAG(wm, s) (wm->flags |= (s)) -#define WIIMOTE_DISABLE_FLAG(wm, s) (wm->flags &= ~(s)) -#define WIIMOTE_TOGGLE_FLAG(wm, s) ((wm->flags & (s)) ? WIIMOTE_DISABLE_FLAG(wm, s) : WIIMOTE_ENABLE_FLAG(wm, s)) - -#define NUNCHUK_IS_FLAG_SET(wm, s) ((*(wm->flags) & (s)) == (s)) - -/* - * Largest known payload is 21 bytes. - * Add 1 (Win32) or 2 (Mac, *nix) for the prefix and round up to a power of 2. - */ -#define MAX_PAYLOAD 32 - -/* - * Smooth tilt calculations are computed with the - * exponential moving average formula: - * St = St_last + (alpha * (tilt - St_last)) - * alpha is between 0 and 1 - */ -#define WIIUSE_DEFAULT_SMOOTH_ALPHA 0.07f - -#define SMOOTH_ROLL 0x01 -#define SMOOTH_PITCH 0x02 - -/** @} */ -#include "wiiuse.h" -/** @addtogroup internal_general */ -/** @{ */ -#define _STRINGIFY(s) _STRINGIFY_IMPL(s) -#define _STRINGIFY_IMPL(s) #s - -/* wiiuse version, from public per-component version defines */ -#define WIIUSE_VERSION _STRINGIFY(WIIUSE_MAJOR) "." _STRINGIFY(WIIUSE_MINOR) "." _STRINGIFY(WIIUSE_MICRO) - -#ifdef _MSC_VER -# define INLINE_UTIL __inline -#else -# define INLINE_UTIL static inline -#endif - -#ifdef __cplusplus -extern "C" { -#endif - - /* not part of the api */ - - /** @brief Cross-platform call to sleep for at least the specified number - * of milliseconds. - * - * Use instead of Sleep(), usleep(), or similar functions. - * Defined in util.c - */ - void wiiuse_millisleep(int durationMilliseconds); - - int wiiuse_set_report_type(struct wiimote_t* wm); - void wiiuse_send_next_pending_read_request(struct wiimote_t* wm); - void wiiuse_send_next_pending_write_request(struct wiimote_t* wm); - int wiiuse_send(struct wiimote_t* wm, byte report_type, byte* msg, int len); - int wiiuse_read_data_cb(struct wiimote_t* wm, wiiuse_read_cb read_cb, byte* buffer, unsigned int offset, uint16_t len); - int wiiuse_write_data_cb(struct wiimote_t *wm, unsigned int addr, byte* data, byte len, wiiuse_write_cb write_cb); - - -#ifdef WIIUSE_DOXYGEN_PARSING - /** @addtogroup betosystem Big-endian buffer to system-byte-order value - @{ */ - - /** @brief Given a buffer buf, copy and return a value of type uint8_t. - */ - uint8_t from_big_endian_uint8_t(byte * buf); - /** @brief Given a buffer buf, copy out a uint16_t, convert it from big-endian - to system byte order, and return it. - - @note Requires that at least 2 bytes be available in buf, but does not - check this - it is your responsibility. - */ - uint16_t from_big_endian_uint16_t(byte * buf); - - /** @brief Given a buffer buf, copy out a uint32_t, convert it from big-endian - to system byte order, and return it. - - @note Requires that at least 4 bytes be available in buf, but does not - check this - it is your responsibility. - */ - uint32_t from_big_endian_uint32_t(byte * buf); - /** @} */ - - /** @addtogroup systemtobe System-byte-order value to big-endian buffer - @{ - */ - - /** @brief Copies the value val into the buffer buf. - @note Requires that at least 1 byte is available in buf, but does not - check this - it is your responsibility. - */ - void to_big_endian_uint8_t(byte * buf, uint8_t val); - - /** @brief Converts the value val from system byte order to big endian, - and copies it into the given buffer starting at buf. - - @note Requires that at least 2 bytes be available in buf, but does not - check this - it is your responsibility. - */ - void to_big_endian_uint16_t(byte * buf, uint16_t val); - - /** @brief Converts the value val from system byte order to big endian, - and copies it into the given buffer starting at buf. - - @note Requires that at least 4 bytes be available in buf, but does not - check this - it is your responsibility. - */ - void to_big_endian_uint32_t(byte * buf, uint32_t val); - /** @} - */ - - /** @addtogroup bufferfunc Buffering functions - @brief These wrap around from/to_big_endian_TYPE, but take a byte** so that - they can advance the input/output pointer appropriately. - @{ - */ - /** @brief Converts the value val from system byte order to big endian, - copies it into the given buffer starting at *buf, and advances buf by - sizeof(uint16_t). - */ - void buffer_big_endian_uint16_t(byte ** buf, uint16_t val); - - /** @brief Given the address of a buffer pointer buf, copy out a uint16_t - from *buf, convert it from big-endian to system byte order, advance - buf by sizeof(uint16_t), and return the value retrieved. - */ - uint16_t unbuffer_big_endian_uint16_t(byte ** buf); - - /** @sa buffer_big_endian_uint16_t() - */ - void buffer_big_endian_uint8_t(byte ** buf, uint8_t val); - - /** @sa unbuffer_big_endian_uint8_t - */ - uint8_t unbuffer_big_endian_uint8_t(byte ** buf); - - /** @sa buffer_big_endian_uint16_t - */ - void buffer_big_endian_uint32_t(byte ** buf, uint32_t val); - - /** @sa unbuffer_big_endian_uint32_t - */ - uint8_t unbuffer_big_endian_uint32_t(byte ** buf) - - /** @} */ -#else /* this else is true when not in doxygen */ - - INLINE_UTIL void to_big_endian_uint8_t(byte * buf, uint8_t val) { - memcpy(buf, &val, 1); - } - - INLINE_UTIL uint8_t from_big_endian_uint8_t(byte * buf) { - uint8_t beVal; - memcpy(&beVal, buf, 1); - return beVal; - } - -#define WIIUSE_DECLARE_ENDIAN_CONVERSION_OPS(_TYPE, _TOBE, _FROMBE) \ -INLINE_UTIL void to_big_endian_##_TYPE(byte * buf, _TYPE val) { \ - _TYPE beVal = _TOBE(val); \ - memcpy(buf, &beVal, sizeof(_TYPE)); \ -} \ -INLINE_UTIL _TYPE from_big_endian_##_TYPE(byte * buf) { \ - _TYPE beVal; \ - memcpy(&beVal, buf, sizeof(_TYPE)); \ - return _FROMBE(beVal); \ -} - - WIIUSE_DECLARE_ENDIAN_CONVERSION_OPS(uint16_t, htons, ntohs) - WIIUSE_DECLARE_ENDIAN_CONVERSION_OPS(uint32_t, htonl, ntohl) - -#undef WIIUSE_DECLARE_ENDIAN_CONVERSION_OPS - -#define WIIUSE_DECLARE_BUFFERING_OPS(_TYPE) \ -INLINE_UTIL void buffer_big_endian_##_TYPE (byte ** buf, _TYPE val) { \ - to_big_endian_##_TYPE(*buf, val); \ - *buf += sizeof(_TYPE); \ -} \ -INLINE_UTIL _TYPE unbuffer_big_endian_##_TYPE (byte ** buf) { \ - byte * current = *buf; \ - *buf += sizeof(_TYPE); \ - return from_big_endian_##_TYPE(current); \ -} - - WIIUSE_DECLARE_BUFFERING_OPS(uint8_t) - WIIUSE_DECLARE_BUFFERING_OPS(uint16_t) - WIIUSE_DECLARE_BUFFERING_OPS(uint32_t) - -#undef WIIUSE_DECLARE_BUFFERING_OPS - -#endif /* not in doxygen */ - -#ifdef __cplusplus -} -#endif -/** @} */ - -#endif /* WIIUSE_INTERNAL_H_INCLUDED */ diff --git a/lib/wiiuse/wiiuse_msvcstdint.h b/lib/wiiuse/wiiuse_msvcstdint.h deleted file mode 100644 index 2a11a03e6..000000000 --- a/lib/wiiuse/wiiuse_msvcstdint.h +++ /dev/null @@ -1,253 +0,0 @@ -// ISO C9x compliant stdint.h for Microsoft Visual Studio -// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 -// -// Copyright (c) 2006-2008 Alexander Chemeris -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. The name of the author may be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED -// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _MSC_VER // [ -#error "Use this header only with Microsoft Visual C++ compilers!" -#endif // _MSC_VER ] - -#ifndef _MSC_STDINT_H_ // [ -#define _MSC_STDINT_H_ - -#if _MSC_VER > 1000 -#pragma once -#endif - -#include - -// For Visual Studio 6 in C++ mode and for many Visual Studio versions when -// compiling for ARM we should wrap include with 'extern "C++" {}' -// or compiler give many errors like this: -// error C2733: second C linkage of overloaded function 'wmemchr' not allowed -#ifdef __cplusplus -extern "C" { -#endif -# include -#ifdef __cplusplus -} -#endif - -// Define _W64 macros to mark types changing their size, like intptr_t. -#ifndef _W64 -# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 -# define _W64 __w64 -# else -# define _W64 -# endif -#endif - - -// 7.18.1 Integer types - -// 7.18.1.1 Exact-width integer types - -// Visual Studio 6 and Embedded Visual C++ 4 doesn't -// realize that, e.g. char has the same size as __int8 -// so we give up on __intX for them. -#if (_MSC_VER < 1300) - typedef signed char int8_t; - typedef signed short int16_t; - typedef signed int int32_t; - typedef unsigned char uint8_t; - typedef unsigned short uint16_t; - typedef unsigned int uint32_t; -#else - typedef signed __int8 int8_t; - typedef signed __int16 int16_t; - typedef signed __int32 int32_t; - typedef unsigned __int8 uint8_t; - typedef unsigned __int16 uint16_t; - typedef unsigned __int32 uint32_t; -#endif -typedef signed __int64 int64_t; -typedef unsigned __int64 uint64_t; - - -// 7.18.1.2 Minimum-width integer types -typedef int8_t int_least8_t; -typedef int16_t int_least16_t; -typedef int32_t int_least32_t; -typedef int64_t int_least64_t; -typedef uint8_t uint_least8_t; -typedef uint16_t uint_least16_t; -typedef uint32_t uint_least32_t; -typedef uint64_t uint_least64_t; - -// 7.18.1.3 Fastest minimum-width integer types -typedef int8_t int_fast8_t; -// Redefinition with different type on VS 2012 -#if (_MSC_VER < 1700) -typedef int16_t int_fast16_t; -#endif -typedef int32_t int_fast32_t; -typedef int64_t int_fast64_t; -typedef uint8_t uint_fast8_t; -// Redefinition with different type on VS 2012 -#if (_MSC_VER < 1700) -typedef uint16_t uint_fast16_t; -#endif -typedef uint32_t uint_fast32_t; -typedef uint64_t uint_fast64_t; - -// 7.18.1.4 Integer types capable of holding object pointers -#ifdef _WIN64 // [ - typedef signed __int64 intptr_t; - typedef unsigned __int64 uintptr_t; -#else // _WIN64 ][ - typedef _W64 signed int intptr_t; - typedef _W64 unsigned int uintptr_t; -#endif // _WIN64 ] - -// 7.18.1.5 Greatest-width integer types -typedef int64_t intmax_t; -typedef uint64_t uintmax_t; - - -// 7.18.2 Limits of specified-width integer types - -#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259 - -// 7.18.2.1 Limits of exact-width integer types -#define INT8_MIN ((int8_t)_I8_MIN) -#define INT8_MAX _I8_MAX -#define INT16_MIN ((int16_t)_I16_MIN) -#define INT16_MAX _I16_MAX -#define INT32_MIN ((int32_t)_I32_MIN) -#define INT32_MAX _I32_MAX -#define INT64_MIN ((int64_t)_I64_MIN) -#define INT64_MAX _I64_MAX -#define UINT8_MAX _UI8_MAX -#define UINT16_MAX _UI16_MAX -#define UINT32_MAX _UI32_MAX -#define UINT64_MAX _UI64_MAX - -// 7.18.2.2 Limits of minimum-width integer types -#define INT_LEAST8_MIN INT8_MIN -#define INT_LEAST8_MAX INT8_MAX -#define INT_LEAST16_MIN INT16_MIN -#define INT_LEAST16_MAX INT16_MAX -#define INT_LEAST32_MIN INT32_MIN -#define INT_LEAST32_MAX INT32_MAX -#define INT_LEAST64_MIN INT64_MIN -#define INT_LEAST64_MAX INT64_MAX -#define UINT_LEAST8_MAX UINT8_MAX -#define UINT_LEAST16_MAX UINT16_MAX -#define UINT_LEAST32_MAX UINT32_MAX -#define UINT_LEAST64_MAX UINT64_MAX - -// 7.18.2.3 Limits of fastest minimum-width integer types -#define INT_FAST8_MIN INT8_MIN -#define INT_FAST8_MAX INT8_MAX -#define INT_FAST16_MIN INT16_MIN -#define INT_FAST16_MAX INT16_MAX -#define INT_FAST32_MIN INT32_MIN -#define INT_FAST32_MAX INT32_MAX -#define INT_FAST64_MIN INT64_MIN -#define INT_FAST64_MAX INT64_MAX -#define UINT_FAST8_MAX UINT8_MAX -#define UINT_FAST16_MAX UINT16_MAX -#define UINT_FAST32_MAX UINT32_MAX -#define UINT_FAST64_MAX UINT64_MAX - -// 7.18.2.4 Limits of integer types capable of holding object pointers -#ifdef _WIN64 // [ -# define INTPTR_MIN INT64_MIN -# define INTPTR_MAX INT64_MAX -# define UINTPTR_MAX UINT64_MAX -#else // _WIN64 ][ -# define INTPTR_MIN INT32_MIN -# define INTPTR_MAX INT32_MAX -# define UINTPTR_MAX UINT32_MAX -#endif // _WIN64 ] - -// 7.18.2.5 Limits of greatest-width integer types -#define INTMAX_MIN INT64_MIN -#define INTMAX_MAX INT64_MAX -#define UINTMAX_MAX UINT64_MAX - -// 7.18.3 Limits of other integer types - -#ifdef _WIN64 // [ -# define PTRDIFF_MIN _I64_MIN -# define PTRDIFF_MAX _I64_MAX -#else // _WIN64 ][ -# define PTRDIFF_MIN _I32_MIN -# define PTRDIFF_MAX _I32_MAX -#endif // _WIN64 ] - -#define SIG_ATOMIC_MIN INT_MIN -#define SIG_ATOMIC_MAX INT_MAX - -#ifndef SIZE_MAX // [ -# ifdef _WIN64 // [ -# define SIZE_MAX _UI64_MAX -# else // _WIN64 ][ -# define SIZE_MAX _UI32_MAX -# endif // _WIN64 ] -#endif // SIZE_MAX ] - -// WCHAR_MIN and WCHAR_MAX are also defined in -#ifndef WCHAR_MIN // [ -# define WCHAR_MIN 0 -#endif // WCHAR_MIN ] -#ifndef WCHAR_MAX // [ -# define WCHAR_MAX _UI16_MAX -#endif // WCHAR_MAX ] - -#define WINT_MIN 0 -#define WINT_MAX _UI16_MAX - -#endif // __STDC_LIMIT_MACROS ] - - -// 7.18.4 Limits of other integer types - -#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260 - -// 7.18.4.1 Macros for minimum-width integer constants - -#define INT8_C(val) val##i8 -#define INT16_C(val) val##i16 -#define INT32_C(val) val##i32 -#define INT64_C(val) val##i64 - -#define UINT8_C(val) val##ui8 -#define UINT16_C(val) val##ui16 -#define UINT32_C(val) val##ui32 -#define UINT64_C(val) val##ui64 - -// 7.18.4.2 Macros for greatest-width integer constants -#define INTMAX_C INT64_C -#define UINTMAX_C UINT64_C - -#endif // __STDC_CONSTANT_MACROS ] - - -#endif // _MSC_STDINT_H_ ]