PageRenderTime 40ms CodeModel.GetById 30ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/src/ois/CMakeLists.txt

https://bitbucket.org/cabalistic/ogredeps/
CMake | 184 lines | 169 code | 10 blank | 5 comment | 13 complexity | a56621e1956ece4ba49be8d3833cb4d3 MD5 | raw file
  1project(OIS)
  2
  3set(OIS_HEADERS
  4  includes/OISConfig.h
  5  includes/OISEffect.h
  6  includes/OISEvents.h
  7  includes/OISException.h
  8  includes/OISFactoryCreator.h
  9  includes/OISForceFeedback.h
 10  includes/OIS.h
 11  includes/OISInputManager.h
 12  includes/OISInterface.h
 13  includes/OISJoyStick.h
 14  includes/OISKeyboard.h
 15  includes/OISMouse.h
 16  includes/OISMultiTouch.h
 17  includes/OISObject.h
 18  includes/OISPrereqs.h
 19)
 20set(OIS_SOURCES
 21  src/OISEffect.cpp
 22  src/OISException.cpp
 23  src/OISForceFeedback.cpp
 24  src/OISInputManager.cpp
 25  src/OISJoyStick.cpp
 26  src/OISKeyboard.cpp
 27  src/OISObject.cpp
 28  src/extras/LIRC/OISLIRC.cpp
 29  src/extras/LIRC/OISLIRCFactoryCreator.cpp
 30)
 31if (WIN32)
 32  set(OIS_PLATFORM_HEADERS
 33    includes/win32/Win32ForceFeedback.h
 34    includes/win32/Win32InputManager.h
 35    includes/win32/Win32JoyStick.h
 36    includes/win32/Win32KeyBoard.h
 37    includes/win32/Win32Mouse.h
 38    includes/win32/Win32Prereqs.h
 39  )
 40  set(OIS_PLATFORM win32)
 41  set(OIS_PLATFORM_SOURCES
 42    src/win32/Win32ForceFeedback.cpp
 43    src/win32/Win32InputManager.cpp
 44    src/win32/Win32JoyStick.cpp
 45    src/win32/Win32KeyBoard.cpp
 46    src/win32/Win32Mouse.cpp
 47    src/win32/extras/WiiMote/hiddevice.cpp
 48    src/win32/extras/WiiMote/OISWiiMote.cpp
 49    src/win32/extras/WiiMote/OISWiiMoteFactoryCreator.cpp
 50    src/win32/extras/WiiMote/OISWiiMoteForceFeedback.cpp
 51    src/win32/extras/WiiMote/OISWiiMoteRingBuffer.cpp
 52    src/win32/extras/WiiMote/wiimote.cpp
 53  )
 54  # need DirectX includes and libraries
 55  include_directories(${DirectX_INCLUDE_DIRS})
 56  set(OIS_PLATFORM_LIBS ${DirectX_DINPUT8_LIBRARY} ${DirectX_DXGUID_LIBRARY})
 57  if (MINGW)
 58    # standard MinGW cannot cope with the new Win32JoyStick implementation
 59	# therefore we use the old one from OIS 1.2
 60	list(REMOVE_ITEM OIS_PLATFORM_SOURCES src/win32/Win32JoyStick.cpp)
 61	list(APPEND OIS_PLATFORM_SOURCES src/win32/Win32JoyStick.old.cpp)
 62  endif ()
 63elseif (APPLE)
 64  if(OGRE_BUILD_PLATFORM_APPLE_IOS)
 65    set(OIS_PLATFORM_HEADERS
 66      includes/iphone/iPhoneAccelerometer.h
 67      includes/iphone/iPhoneHelpers.h
 68      includes/iphone/iPhoneInputManager.h
 69      includes/iphone/iPhoneMultiTouch.h
 70      includes/iphone/iPhonePrereqs.h
 71    )
 72    set(OIS_PLATFORM iphone)
 73    set(OIS_PLATFORM_SOURCES
 74      src/iphone/iPhoneAccelerometer.mm
 75      src/iphone/iPhoneInputManager.mm
 76      src/iphone/iPhoneMultiTouch.mm
 77    )
 78  else()
 79    set(OIS_PLATFORM_HEADERS
 80      includes/mac/CocoaInputManager.h
 81      includes/mac/CocoaJoyStick.h
 82      includes/mac/CocoaKeyboard.h
 83      includes/mac/CocoaMouse.h
 84      includes/mac/CocoaHelpers.h
 85      includes/mac/MacHelpers.h
 86      includes/mac/MacHIDManager.h
 87      includes/mac/MacInputManager.h
 88      includes/mac/MacJoyStick.h
 89      includes/mac/MacKeyboard.h
 90      includes/mac/MacMouse.h
 91      includes/mac/MacPrereqs.h
 92    )
 93    set(OIS_PLATFORM mac)
 94    set(OIS_PLATFORM_SOURCES
 95      src/mac/CocoaInputManager.mm
 96      src/mac/CocoaJoyStick.mm
 97      src/mac/CocoaKeyboard.mm
 98      src/mac/CocoaMouse.mm
 99      src/mac/MacHelpers.cpp
100      src/mac/MacHIDManager.cpp
101      src/mac/MacInputManager.cpp
102      src/mac/MacJoyStick.cpp
103      src/mac/MacKeyboard.cpp
104      src/mac/MacMouse.cpp
105    )
106  endif()
107elseif (ANDROID)
108  set(OIS_PLATFORM android)
109elseif (EMSCRIPTEN)
110  set(OIS_PLATFORM emscripten)
111else()
112  set(OIS_PLATFORM_HEADERS
113    includes/linux/EventHelpers.h
114    includes/linux/LinuxForceFeedback.h
115    includes/linux/LinuxInputManager.h
116    includes/linux/LinuxJoyStickEvents.h
117    includes/linux/LinuxKeyboard.h
118    includes/linux/LinuxMouse.h
119    includes/linux/LinuxPrereqs.h
120  )
121  set(OIS_PLATFORM linux)
122  set(OIS_PLATFORM_SOURCES
123    src/linux/EventHelpers.cpp
124    src/linux/LinuxForceFeedback.cpp
125    src/linux/LinuxInputManager.cpp
126    src/linux/LinuxJoyStickEvents.cpp
127    src/linux/LinuxKeyboard.cpp
128    src/linux/LinuxMouse.cpp
129  )
130endif ()
131
132include_directories(includes)
133
134# Treat as Objective-C++ code if under OSX
135if(APPLE)
136  set_source_files_properties(${OIS_HEADERS} ${OIS_SOURCES} PROPERTIES COMPILE_FLAGS "-x objective-c++")
137endif ()
138
139if(NOT APPLE AND NOT ANDROID)
140  add_definitions(-DOIS_NONCLIENT_BUILD -DOIS_DYNAMIC_LIB)
141  add_library(OIS SHARED ${OIS_HEADERS} ${OIS_SOURCES} ${OIS_PLATFORM_HEADERS} ${OIS_PLATFORM_SOURCES})
142else ()
143  add_definitions(-DOIS_NONCLIENT_BUILD)
144  add_library(OIS STATIC ${OIS_HEADERS} ${OIS_SOURCES} ${OIS_PLATFORM_HEADERS} ${OIS_PLATFORM_SOURCES})
145endif ()
146if (OGRE_PROJECT_FOLDERS)
147	set_property(TARGET OIS PROPERTY FOLDER Dependencies)
148endif ()
149
150if (MINGW)
151	  # remove lib prefix from DLL outputs
152	  set_target_properties(OIS PROPERTIES PREFIX "")
153endif ()
154
155target_link_libraries(OIS ${OIS_PLATFORM_LIBS})
156install_dep(OIS include/OIS ${OIS_HEADERS})
157if (OGREDEPS_INSTALL_DEV)
158  install(FILES ${OIS_PLATFORM_HEADERS} DESTINATION include/OIS/${OIS_PLATFORM})
159endif ()
160
161if (APPLE)
162  if(OGRE_BUILD_PLATFORM_APPLE_IOS)
163    set_target_properties(OIS PROPERTIES
164      LINK_FLAGS "-framework UIKit"
165    )
166  else()
167    set_target_properties(OIS PROPERTIES
168      LINK_FLAGS "-framework IOKit -framework Cocoa -framework Carbon"
169    )
170  endif()
171endif ()
172
173if (APPLE)
174 set_target_properties(OIS PROPERTIES XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH "NO")
175
176 if(OGRE_BUILD_PLATFORM_APPLE_IOS)
177  set_target_properties(OIS PROPERTIES XCODE_ATTRIBUTE_GCC_THUMB_SUPPORT "NO")
178 endif()
179endif()
180
181set(OIS_INCLUDE_DIR "${OIS_SOURCE_DIR}/includes" CACHE PATH "" FORCE)
182set(OIS_LIBRARY_DBG "OIS" CACHE STRING "" FORCE)
183set(OIS_LIBRARY_REL "OIS" CACHE STRING "" FORCE)
184mark_as_advanced(OIS_INCLUDE_DIR OIS_LIBRARY_DBG OIS_LIBRARY_REL)