Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,20 @@ cmake_minimum_required(VERSION 3.16)

project(PSMoveAPI)

if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/external/hidapi/hidapi/hidapi.h")
message(FATAL_ERROR "hidapi not found, did you forget to run 'git submodule update --init'?")
endif()
option(PSMOVEAPI_VENDORING "Vendor dependencies" ON)

if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/external/libusb-1.0/libusb/libusb.h")
message(FATAL_ERROR "libusb not found, did you forget to run 'git submodule update --init'?")
endif()
if (PSMOVEAPI_VENDORING)
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/external/hidapi/hidapi/hidapi.h")
message(FATAL_ERROR "hidapi not found, did you forget to run 'git submodule update --init'?")
endif()

if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/external/libusb-1.0/libusb/libusb.h")
message(FATAL_ERROR "libusb not found, did you forget to run 'git submodule update --init'?")
endif()

if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/external/PS3EYEDriver/src/ps3eye.h")
message(FATAL_ERROR "PS3EYEDriver not found, did you forget to run 'git submodule update --init'?")
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/external/PS3EYEDriver/src/ps3eye.h")
message(FATAL_ERROR "PS3EYEDriver not found, did you forget to run 'git submodule update --init'?")
endif()
endif()

# get rid of Visual Studio's default "Debug" and "Release" output directories
Expand Down
3 changes: 3 additions & 0 deletions cmake/FindUSB1.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ IF (LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
set(LIBUSB_FOUND TRUE)

ELSE (LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
IF (NOT PSMOVEAPI_VENDORING)
message(FATAL_ERROR "libusb was not found and vendoring is disabled")
ENDIF()
# Because we want to use the static library,
# look locally only.
find_path(LIBUSB_INCLUDE_DIR
Expand Down
31 changes: 26 additions & 5 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ set(PSMOVEAPI_PLATFORM_SRC) # Container for source files
set(PSMOVEAPI_INSTALL_TARGETS) # Container for build targets to be installed
set(PSMOVEAPI_MATH_SRC) # Container for math related source files

include_directories(${ROOT_DIR}/external/hidapi/hidapi)
include_directories(${ROOT_DIR}/external/glm)

IF(PSMOVEAPI_VENDORING)
include_directories(${ROOT_DIR}/external/hidapi/hidapi)
include_directories(${ROOT_DIR}/external/glm)
ENDIF()
include_directories(${CMAKE_BINARY_DIR})

set(INFO_LICENSE "BSD")
Expand Down Expand Up @@ -54,7 +57,11 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
list(APPEND PSMOVEAPI_REQUIRED_LIBS ${COREFOUNDATION})
list(APPEND PSMOVEAPI_REQUIRED_LIBS ${IOBLUETOOTH})

set(HIDAPI_SRC ${ROOT_DIR}/external/hidapi/mac/hid.c)
IF(PSMOVEAPI_VENDORING)
set(HIDAPI_SRC ${ROOT_DIR}/external/hidapi/mac/hid.c)
ELSE()
message(FATAL_ERROR "disabling vendoring is currently not supported for ${CMAKE_SYSTEM_NAME}")
ENDIF()

list(APPEND PSMOVEAPI_PLATFORM_SRC
${CMAKE_CURRENT_LIST_DIR}/platform/psmove_port_osx.mm)
Expand All @@ -69,7 +76,11 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
ELSEIF(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
list(APPEND PSMOVEAPI_REQUIRED_LIBS setupapi bthprops kernel32 ws2_32 winmm version imm32)

set(HIDAPI_SRC ${ROOT_DIR}/external/hidapi/windows/hid.c)
IF(PSMOVEAPI_VENDORING)
set(HIDAPI_SRC ${ROOT_DIR}/external/hidapi/windows/hid.c)
ELSE()
message(FATAL_ERROR "disabling vendoring is currently not supported for ${CMAKE_SYSTEM_NAME}")
ENDIF()

list(APPEND PSMOVEAPI_PLATFORM_SRC
${CMAKE_CURRENT_LIST_DIR}/platform/psmove_port_windows.c)
Expand All @@ -93,7 +104,17 @@ ELSE()
include_directories(${BLUEZ_INCLUDE_DIRS})
list(APPEND PSMOVEAPI_REQUIRED_LIBS ${BLUEZ_LIBRARIES})

set(HIDAPI_SRC ${ROOT_DIR}/external/hidapi/linux/hid.c)
IF(PSMOVEAPI_VENDORING)
set(HIDAPI_SRC ${ROOT_DIR}/external/hidapi/linux/hid.c)
ELSE()
pkg_check_modules(HIDAPI REQUIRED hidapi-hidraw)
include_directories(${HIDAPI_INCLUDE_DIRS})
list(APPEND PSMOVEAPI_REQUIRED_LIBS hidapi-hidraw)

pkg_check_modules(GLM REQUIRED glm)
include_directories(${GLM_INCLUDE_DIRS})
list(APPEND PSMOVEAPI_REQUIRED_LIBS ${GLM_LIBRARIES})
ENDIF()

list(APPEND PSMOVEAPI_PLATFORM_SRC
${CMAKE_CURRENT_LIST_DIR}/platform/psmove_port_linux.cpp)
Expand Down
3 changes: 3 additions & 0 deletions src/tracker/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ option(PSMOVE_USE_DEBUG_CAPTURE "Always show camera capture input" OFF)


IF(PSMOVE_USE_PS3EYE_DRIVER)
IF(NOT PSMOVEAPI_VENDORING)
message(FATAL_ERROR "disabling vendoring is currently not supported for PS3EYEDriver")
ENDIF()
# PS3EYEDriver is based on GPL'd code
set(INFO_LICENSE "GPL")

Expand Down