@@ -15,8 +15,11 @@ set(PSMOVEAPI_PLATFORM_SRC) # Container for source files
1515set (PSMOVEAPI_INSTALL_TARGETS) # Container for build targets to be installed
1616set (PSMOVEAPI_MATH_SRC) # Container for math related source files
1717
18- include_directories (${ROOT_DIR} /external/hidapi/hidapi )
19- include_directories (${ROOT_DIR} /external/glm )
18+
19+ IF (PSMOVEAPI_VENDORING)
20+ include_directories (${ROOT_DIR} /external/hidapi/hidapi )
21+ include_directories (${ROOT_DIR} /external/glm )
22+ ENDIF ()
2023include_directories (${CMAKE_BINARY_DIR } )
2124
2225set (INFO_LICENSE "BSD" )
@@ -54,7 +57,11 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
5457 list (APPEND PSMOVEAPI_REQUIRED_LIBS ${COREFOUNDATION} )
5558 list (APPEND PSMOVEAPI_REQUIRED_LIBS ${IOBLUETOOTH} )
5659
57- set (HIDAPI_SRC ${ROOT_DIR} /external/hidapi/mac/hid.c)
60+ IF (PSMOVEAPI_VENDORING)
61+ set (HIDAPI_SRC ${ROOT_DIR} /external/hidapi/mac/hid.c)
62+ ELSE ()
63+ message (FATAL_ERROR "disabling vendoring is currently not supported for ${CMAKE_SYSTEM_NAME } " )
64+ ENDIF ()
5865
5966 list (APPEND PSMOVEAPI_PLATFORM_SRC
6067 ${CMAKE_CURRENT_LIST_DIR } /platform/psmove_port_osx.mm)
@@ -69,7 +76,11 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
6976ELSEIF (${CMAKE_SYSTEM_NAME } MATCHES "Windows" )
7077 list (APPEND PSMOVEAPI_REQUIRED_LIBS setupapi bthprops kernel32 ws2_32 winmm version imm32)
7178
72- set (HIDAPI_SRC ${ROOT_DIR} /external/hidapi/windows/hid.c)
79+ IF (PSMOVEAPI_VENDORING)
80+ set (HIDAPI_SRC ${ROOT_DIR} /external/hidapi/windows/hid.c)
81+ ELSE ()
82+ message (FATAL_ERROR "disabling vendoring is currently not supported for ${CMAKE_SYSTEM_NAME } " )
83+ ENDIF ()
7384
7485 list (APPEND PSMOVEAPI_PLATFORM_SRC
7586 ${CMAKE_CURRENT_LIST_DIR } /platform/psmove_port_windows.c)
@@ -93,7 +104,17 @@ ELSE()
93104 include_directories (${BLUEZ_INCLUDE_DIRS} )
94105 list (APPEND PSMOVEAPI_REQUIRED_LIBS ${BLUEZ_LIBRARIES} )
95106
96- set (HIDAPI_SRC ${ROOT_DIR} /external/hidapi/linux /hid.c)
107+ IF (PSMOVEAPI_VENDORING)
108+ set (HIDAPI_SRC ${ROOT_DIR} /external/hidapi/linux /hid.c)
109+ ELSE ()
110+ pkg_check_modules (HIDAPI REQUIRED hidapi-hidraw )
111+ include_directories (${HIDAPI_INCLUDE_DIRS} )
112+ list (APPEND PSMOVEAPI_REQUIRED_LIBS hidapi-hidraw)
113+
114+ pkg_check_modules (GLM REQUIRED glm )
115+ include_directories (${GLM_INCLUDE_DIRS} )
116+ list (APPEND PSMOVEAPI_REQUIRED_LIBS ${GLM_LIBRARIES} )
117+ ENDIF ()
97118
98119 list (APPEND PSMOVEAPI_PLATFORM_SRC
99120 ${CMAKE_CURRENT_LIST_DIR } /platform/psmove_port_linux.cpp)
0 commit comments