New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OSX Refactoring #26
OSX Refactoring #26
Conversation
…to os_*.c/os_mac.m
…le motion plus handshake is being done
Conflicts: src/events.c src/io_mac.m
Taken from http://cocoadev.com/wiki/FindingBluetoothAvailability Conflicts: src/io_mac.m
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind lowercasing the command here? No big deal if you don't - I can run cmake-bulk-decrufter after, just noticed this as I looked through.
(And part of me thinks that at least some of the pulling-out platform specific bits of #14 has been done here, or perhaps vice versa?) |
2c5bec7 Update WinHID drastically to use FindWindowsSDK, so it can easily build against much newer SDKs/DDKs/WDKs. 2273ac4 Add two new functions to FindWindowsSDK eded907 Fix quietness of finding windows SDK and add comment 3f5f7df Add a module to help find things on MinGW (specifically MSYS2). c90ca93 Backported bugfixed version of WriteCompilerDetectionHeader. 6a941e5 ColibriApi: Module written for VRPN. 1dd3d89 Another flag in ExtraCompilerWarnings, to get GCC to stop whining about boost::optional. 90d1a89 Formatting fix in finddirectshow 8b37b27 Updated the InterSense finder to look in default install locations. bd6a7ca Improvements to the WindowsSDK finder for newer win10 sdks and better handling of them. 58ed198 Add a minor tweak to the VRPN module 83a2091 Add a FindJsonCpp module I wrote for various OSVR projects. faf198f Major improvements to FindSDL2 for Mac support. Thanks to David, aka @d235j for lots of help. fe2273c Add GenerateCompatibilityVersionFile, for keeping your msvc from compiling against your android builds. 01d0c41 Major improvements to FindWindowsSDK and FindDirectShow 16a3a8c Add an upstream "FindGit" from CMake 3.2.0 6bc6a53 Fix up create dashboard scripts to use a shared Git location. 1cc81cc Improve SDL2 finder 53d7c1b Improve quiet finding. dbd7ca2 Trailing newline 834581c Add a handful of new modules. 403a97d Fix copyright line. 3e2ae75 Merge pull request #40 from Meinersbur/patch-2 a3da0c4 Use CMAKE_CURRENT_SOURCE_DIR consistently 5b85e5c Merge pull request #23 from StudioEtrange/master e5a5957 Merge pull request #26 from tomgey/master 23aa3af Merge pull request #31 from janisz/Get_CPU_count be74670 Merge pull request #34 from redstar/packed_ref b9ae011 Use .git/packed-refs if ref is not found. c999fd3 Rename opencv finder to indicate it only looks for old OpenCV. 4fec79f Add CopyImportedTarget. 403d8a9 Update readme. eb5d23a Add udev and Xrandr finder, by @godbyk 5d6c1fe Add Oculus SDK finder - initial version by @godbyk, tweaks by me. d2d8ee7 VRPN: Optionally include LibUSB1 fe91913 Add some more ghost fake ehaders. 1cf5047 Update comment. 55d43d6 VRPN/quatlib: Look in where the VRPN CMake installs by default. 66ef6a7 Minor HIDAPI finding changes. 21d2a60 CMake >= 3.1 doesn't like the construction "$ENV{ProgramFiles(x86)}", so we work around it. 2ea7475 Improve directx support. af2331f Find and use MSCGEN in Doxygen. 2ff8db9 Merge pull request #32 from vladzzag/master fef6dfd Added FindWayland.cmake f9bdb65 Set CPU_Count in GetCPUDetails 0f545c3 Update launcher templates to match attributes. 5be4bc0 Add a module to extract a preprocessor definition. da8b557 Find libfreespace c230fc3 Get better at finding libusb1 without pkg-config 87b6fa2 Fix tabs 6870fac Update directshow, windowssdk, directx, and winhid (related) 9728850 Remove outdated/replaced module ceb6031 Don't use the -Weffc++ warning flag 7b5680a Improvements to doxygentargets 4bc009e Add gitattributes file, primarily to handle launcher templates. 1abc46a Fixes to DoxygenTargets.cmake 039b677 Merge pull request #27 from inolen/master 2ee9364 Update README.markdown 2784e2f added FORCE parameter to enable checking all preprocessor configurations use target's INCLUDE_DIRECTORIES property to pass include directories to cppcheck 370d602 BoostTestTargets: fix setting FAIL_REGULAR_EXPRESSION without TESTS list ee59dc8 BoostTestTargets: compatibility with CMake 2.6 08e6657 allow to use semi colon in var like ENVIRONMENT. We need this on windows for setting PATH variable. ce48ca6 agive a chance to choose PLATFORM and fxes when RUNTIME_LIBRARIES_ENVIRONMENT is empty 298ec78 Use CMAKE_CURRENT_SOURCE_DIR in GetGitRevisionDescription. 8def499 Windows SDK updates from working on VRPN 9244b84 Impending CMake 3.0 implies that 2.9.0 is no longer ~= infinity. 368d53e Update backported module and add backported ParseArguments. 5fa68c1 Merge pull request #19 from PiQuer/master ef7faf4 use CMAKE_CURRENT_LISTDIR instead of CMAKE_SOURCE_DIR as GIT_PARENT This guarantees that the search begins in the subdirectory (submodule) where the function is called. Otherwise we will most likely pick up the super-repository. e557594 Merge pull request #17 from gunnarbeutner/patch-1 dc238c7 Merge pull request #18 from PiQuer/master 41097f2 make GetGitRevisionDescription.cmake aware of submodules 67c8277 Fix syntax error in BoostTestTargets.cmake f77873d Update help files. 7eef0a6 Add FindInterSense.cmake 3f1a82f Fix up OpenHaptics nested targets. 4f298e1 Improve windows SDK finding. 11b88e5 Find DirectX XInput library 29bb4a7 Merge pull request #15 from freitass/patch-1 df6aaf4 Merge pull request #16 from lpberg/winhid-wdk8 a287055 added support for wdk8 in WinHID d3a5109 Make launchers on *nix executable 95ae78e Fix VR Juggler base path determination. c9b7f60 Fix CreateLaunchers to support forward-compatible VC versions ec42f07 Skip calibration.table - not used 739f05a Fix FindVRJuggler for newer cmake versions 7eb150d Update help. 3c6058b Update find vrjuggler 3.0 to work more reliably f72cefb Fixed cppcheck unusedFunction option f9fd40c Try handling new versions of cppdom that have their own config file. b13f248 Update WindowsSDK for VS2012 f763d94 Explicitly specify a binary dir for openhaptics nested targets. 0dd813a Update copyright date 1ad505f Update note about git-subtree 3af26c6 Improve finder for winhid git-subtree-dir: cmake git-subtree-split: 2c5bec74c1d9180e7d259431aa1fc926506583a3
38131f4 Merge pull request #47 from wmamrak/patch-1 d4d1d54 Updated Windows 10 SDK versions ad436ee Add creator's update windows SDK to search directories. 6c3c6b0 Merge branch 'nickbroon-improve-cppcheck' 58843ae CppcheckTargets: update credits 66fe49e CppcheckTargets: fix indents 7638eb5 Rename convenience target back to all_cppcheck from cppcheck. 35e6823 Update requirement info for CppcheckTargets 065ecf1 Merge branch 'improve-cppcheck' of https://github.com/nickbroon/cmake-modules into nickbroon-improve-cppcheck 98e28d2 Merge pull request #44 from AlessandroMenti/boost-test-targets-check-fix 82e5a29 Merge pull request #45 from noma/master deca4d3 Added git_local_changes() to GetGitRevisionDescription.cmake 08987b5 Update to stash map config to make it actually properly push and pop c330929 New module: stash map config. 8a18a1b Add new InstallDebugSymbols module. 30573d3 Small JsonCpp cleanup. 2ef829d Fix "no target to set property" error in FindJsonCpp 997754e Fix wrong check in BoostTestTargets.cmake 41e1651 libusb1 enhancements from VRPN 7ef3955 Fixes to FindWindowsSDK so it doesn't return TRUE as the first element of every directory list. a497482 Fix indentation and accidentally-left-in debug messages in FindDirectShow b43b5e2 Bug fix in backported FindGit. 7c8c792 Add a greatly enhanced FindGLEW (for CMake 2.8.12+), based on the upstream. ec0c486 Add the Windows 10 1607 "Anniversary Update" SDK version to the WindowsSDK list. 7dc5198 Fix building against jsoncpp when the build types don't exactly match. 0875d12 FindSDL2: standardize indentation within the file. 75ba012 FindSDL2: Use MinGWSearchPathExtras if it's available and suitable. 66d7885 MinGW: build a list of prefixes too. 83f169b FindSDL2: sdlmain must come before sdl2. 6d639f6 Update list of dependencies in FindWinHID 2c5bec7 Update WinHID drastically to use FindWindowsSDK, so it can easily build against much newer SDKs/DDKs/WDKs. 2273ac4 Add two new functions to FindWindowsSDK eded907 Fix quietness of finding windows SDK and add comment 3f5f7df Add a module to help find things on MinGW (specifically MSYS2). c90ca93 Backported bugfixed version of WriteCompilerDetectionHeader. 6a941e5 ColibriApi: Module written for VRPN. 1dd3d89 Another flag in ExtraCompilerWarnings, to get GCC to stop whining about boost::optional. 90d1a89 Formatting fix in finddirectshow 8b37b27 Updated the InterSense finder to look in default install locations. bd6a7ca Improvements to the WindowsSDK finder for newer win10 sdks and better handling of them. 58ed198 Add a minor tweak to the VRPN module 83a2091 Add a FindJsonCpp module I wrote for various OSVR projects. faf198f Major improvements to FindSDL2 for Mac support. Thanks to David, aka @d235j for lots of help. fe2273c Add GenerateCompatibilityVersionFile, for keeping your msvc from compiling against your android builds. 01d0c41 Major improvements to FindWindowsSDK and FindDirectShow 16a3a8c Add an upstream "FindGit" from CMake 3.2.0 6bc6a53 Fix up create dashboard scripts to use a shared Git location. 1cc81cc Improve SDL2 finder 53d7c1b Improve quiet finding. dbd7ca2 Trailing newline 834581c Add a handful of new modules. 403a97d Fix copyright line. 3e2ae75 Merge pull request #40 from Meinersbur/patch-2 a3da0c4 Use CMAKE_CURRENT_SOURCE_DIR consistently 1932f85 Return to more conservative default settings. b1d2d88 cppcheck will check C as well as C++ a4561de Improvements on cppcheck 5b85e5c Merge pull request #23 from StudioEtrange/master e5a5957 Merge pull request #26 from tomgey/master 23aa3af Merge pull request #31 from janisz/Get_CPU_count be74670 Merge pull request #34 from redstar/packed_ref b9ae011 Use .git/packed-refs if ref is not found. c999fd3 Rename opencv finder to indicate it only looks for old OpenCV. 4fec79f Add CopyImportedTarget. 403d8a9 Update readme. eb5d23a Add udev and Xrandr finder, by @godbyk 5d6c1fe Add Oculus SDK finder - initial version by @godbyk, tweaks by me. d2d8ee7 VRPN: Optionally include LibUSB1 fe91913 Add some more ghost fake ehaders. 1cf5047 Update comment. 55d43d6 VRPN/quatlib: Look in where the VRPN CMake installs by default. 66ef6a7 Minor HIDAPI finding changes. 21d2a60 CMake >= 3.1 doesn't like the construction "$ENV{ProgramFiles(x86)}", so we work around it. 2ea7475 Improve directx support. af2331f Find and use MSCGEN in Doxygen. 2ff8db9 Merge pull request #32 from vladzzag/master fef6dfd Added FindWayland.cmake f9bdb65 Set CPU_Count in GetCPUDetails 0f545c3 Update launcher templates to match attributes. 5be4bc0 Add a module to extract a preprocessor definition. da8b557 Find libfreespace c230fc3 Get better at finding libusb1 without pkg-config 87b6fa2 Fix tabs 6870fac Update directshow, windowssdk, directx, and winhid (related) 9728850 Remove outdated/replaced module ceb6031 Don't use the -Weffc++ warning flag 7b5680a Improvements to doxygentargets 4bc009e Add gitattributes file, primarily to handle launcher templates. 1abc46a Fixes to DoxygenTargets.cmake 039b677 Merge pull request #27 from inolen/master 2ee9364 Update README.markdown 2784e2f added FORCE parameter to enable checking all preprocessor configurations use target's INCLUDE_DIRECTORIES property to pass include directories to cppcheck 370d602 BoostTestTargets: fix setting FAIL_REGULAR_EXPRESSION without TESTS list ee59dc8 BoostTestTargets: compatibility with CMake 2.6 08e6657 allow to use semi colon in var like ENVIRONMENT. We need this on windows for setting PATH variable. ce48ca6 agive a chance to choose PLATFORM and fxes when RUNTIME_LIBRARIES_ENVIRONMENT is empty 298ec78 Use CMAKE_CURRENT_SOURCE_DIR in GetGitRevisionDescription. 8def499 Windows SDK updates from working on VRPN 9244b84 Impending CMake 3.0 implies that 2.9.0 is no longer ~= infinity. 368d53e Update backported module and add backported ParseArguments. 5fa68c1 Merge pull request #19 from PiQuer/master ef7faf4 use CMAKE_CURRENT_LISTDIR instead of CMAKE_SOURCE_DIR as GIT_PARENT This guarantees that the search begins in the subdirectory (submodule) where the function is called. Otherwise we will most likely pick up the super-repository. e557594 Merge pull request #17 from gunnarbeutner/patch-1 dc238c7 Merge pull request #18 from PiQuer/master 41097f2 make GetGitRevisionDescription.cmake aware of submodules 67c8277 Fix syntax error in BoostTestTargets.cmake f77873d Update help files. 7eef0a6 Add FindInterSense.cmake 3f1a82f Fix up OpenHaptics nested targets. 4f298e1 Improve windows SDK finding. 11b88e5 Find DirectX XInput library 29bb4a7 Merge pull request #15 from freitass/patch-1 df6aaf4 Merge pull request #16 from lpberg/winhid-wdk8 a287055 added support for wdk8 in WinHID d3a5109 Make launchers on *nix executable 95ae78e Fix VR Juggler base path determination. c9b7f60 Fix CreateLaunchers to support forward-compatible VC versions ec42f07 Skip calibration.table - not used 739f05a Fix FindVRJuggler for newer cmake versions 7eb150d Update help. 3c6058b Update find vrjuggler 3.0 to work more reliably f72cefb Fixed cppcheck unusedFunction option f9fd40c Try handling new versions of cppdom that have their own config file. b13f248 Update WindowsSDK for VS2012 f763d94 Explicitly specify a binary dir for openhaptics nested targets. 0dd813a Update copyright date 1ad505f Update note about git-subtree 3af26c6 Improve finder for winhid git-subtree-dir: cmake git-subtree-split: 38131f4c7b0914b450c5d03396954629eb13c537
Based on #25, I did a lot of code refactoring, mainly to make the mac version work correctly. The code is inspired by and reuses lots of the original mac code.
Major differences are the fact that receiving data now happens in a synchronized manner, and old messages are not dropped if the poll interval is too low. This fixes #22, among other problems (crash on Mac when powering off Wiimote, ...). Also data is now sent through the interrupt channel on mac, as recommended by the Wiibrew wiki.
In wiiuseexample, I made sure that the program terminates if all wiimotes are disconnected. (This is not important for the rest to work properly, but helped me during development.)
Code-organization wise, I split up the mac implementation into different files in src/os_mac/, because it's a lot of code (compared to the other platforms' implementations).
I tested the code with real hardware (Wiimote, Motion+, Nunchuk) on Windows 8, Ubuntu 12.10, OSX 10.8 (still compiles with 10.6 SDK).