CMakeLists.txt 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. cmake_minimum_required(VERSION 2.8)
  2. project(openhmd C CXX)
  3. set(CMAKE_C_FLAGS "-std=c99")
  4. set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
  5. include_directories(${CMAKE_CURRENT_LIST_DIR}/include)
  6. if (MSVC)
  7. # Add the "lib" prefix for generated .lib outputs.
  8. set(LIB_PREFIX lib)
  9. else (MSVC)
  10. # When building with "make", "lib" prefix will be added automatically by
  11. # the build tool.
  12. set(LIB_PREFIX)
  13. endif (MSVC)
  14. #source files set just for Android
  15. set(openhmd_source_files
  16. ${CMAKE_CURRENT_LIST_DIR}/src/openhmd.c
  17. ${CMAKE_CURRENT_LIST_DIR}/src/platform-win32.c
  18. ${CMAKE_CURRENT_LIST_DIR}/src/drv_dummy/dummy.c
  19. ${CMAKE_CURRENT_LIST_DIR}/src/omath.c
  20. ${CMAKE_CURRENT_LIST_DIR}/src/platform-posix.c
  21. ${CMAKE_CURRENT_LIST_DIR}/src/fusion.c
  22. )
  23. OPTION(OPENHMD_DRIVER_OCULUS_RIFT "Oculus Rift DK1 and DK2" ON)
  24. OPTION(OPENHMD_DRIVER_EXTERNAL "External sensor driver" ON)
  25. if(OPENHMD_DRIVER_OCULUS_RIFT)
  26. set(openhmd_source_files ${openhmd_source_files}
  27. ${CMAKE_CURRENT_LIST_DIR}/src/drv_oculus_rift/rift.c
  28. ${CMAKE_CURRENT_LIST_DIR}/src/drv_oculus_rift/packet.c
  29. )
  30. add_definitions(-DDRIVER_OCULUS_RIFT)
  31. find_package(HIDAPI REQUIRED)
  32. include_directories(${HIDAPI_INCLUDE_DIRS})
  33. set(LIBS ${LIBS} ${HIDAPI_LIBRARIES})
  34. endif(OPENHMD_DRIVER_OCULUS_RIFT)
  35. if (OPENHMD_DRIVER_EXTERNAL)
  36. set(openhmd_source_files ${openhmd_source_files}
  37. ${CMAKE_CURRENT_LIST_DIR}/src/drv_external/external.c
  38. )
  39. add_definitions(-DDRIVER_EXTERNAL)
  40. endif(OPENHMD_DRIVER_EXTERNAL)
  41. add_library(openhmd ${openhmd_source_files} ${LIBS})
  42. set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_DIR}/)