1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- cmake_minimum_required(VERSION 2.8)
- project(openhmd C CXX)
- set(CMAKE_C_FLAGS "-std=c99")
- set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
- include_directories(${CMAKE_CURRENT_LIST_DIR}/include)
- if (MSVC)
- # Add the "lib" prefix for generated .lib outputs.
- set(LIB_PREFIX lib)
- else (MSVC)
- # When building with "make", "lib" prefix will be added automatically by
- # the build tool.
- set(LIB_PREFIX)
- endif (MSVC)
- #source files set just for Android
- set(openhmd_source_files
- ${CMAKE_CURRENT_LIST_DIR}/src/openhmd.c
- ${CMAKE_CURRENT_LIST_DIR}/src/platform-win32.c
- ${CMAKE_CURRENT_LIST_DIR}/src/drv_dummy/dummy.c
- ${CMAKE_CURRENT_LIST_DIR}/src/omath.c
- ${CMAKE_CURRENT_LIST_DIR}/src/platform-posix.c
- ${CMAKE_CURRENT_LIST_DIR}/src/fusion.c
- )
- OPTION(OPENHMD_DRIVER_OCULUS_RIFT "Oculus Rift DK1 and DK2" ON)
- OPTION(OPENHMD_DRIVER_EXTERNAL "External sensor driver" ON)
- if(OPENHMD_DRIVER_OCULUS_RIFT)
- set(openhmd_source_files ${openhmd_source_files}
- ${CMAKE_CURRENT_LIST_DIR}/src/drv_oculus_rift/rift.c
- ${CMAKE_CURRENT_LIST_DIR}/src/drv_oculus_rift/packet.c
- )
- add_definitions(-DDRIVER_OCULUS_RIFT)
- find_package(HIDAPI REQUIRED)
- include_directories(${HIDAPI_INCLUDE_DIRS})
- set(LIBS ${LIBS} ${HIDAPI_LIBRARIES})
- endif(OPENHMD_DRIVER_OCULUS_RIFT)
- if (OPENHMD_DRIVER_EXTERNAL)
- set(openhmd_source_files ${openhmd_source_files}
- ${CMAKE_CURRENT_LIST_DIR}/src/drv_external/external.c
- )
- add_definitions(-DDRIVER_EXTERNAL)
- endif(OPENHMD_DRIVER_EXTERNAL)
- add_library(openhmd ${openhmd_source_files} ${LIBS})
- set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_DIR}/)
|