forked from IntelRealSense/librealsense
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
72 lines (62 loc) · 2.7 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# minimum required cmake version: 3.1.0
cmake_minimum_required(VERSION 3.1.0)
project(RealsensePythonWrappers)
if (NOT BUILD_PYTHON_BINDINGS)
message(WARNING "Python Bindings being built despite unset option because they are required for python documentation")
endif()
set(DEPENDENCIES realsense2)
add_subdirectory(third_party/pybind11)
pybind11_add_module(pyrealsense2 SHARED python.cpp)
target_link_libraries(pyrealsense2 PRIVATE ${DEPENDENCIES})
set_target_properties(pyrealsense2 PROPERTIES VERSION
${REALSENSE_VERSION_STRING} SOVERSION "${REALSENSE_VERSION_MAJOR}.${REALSENSE_VERSION_MINOR}")
set_target_properties(pyrealsense2 PROPERTIES FOLDER Wrappers/python)
install(TARGETS pyrealsense2 EXPORT realsense2Targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
set(RAW_RS_CPP ../../src/backend.cpp pybackend_extras.cpp pybackend.cpp
../../src/linux/backend-v4l2.cpp ../../src/linux/backend-hid.cpp ../../src/types.cpp
../../src/log.cpp ../../src/types.cpp ../../third-party/easyloggingpp/src/easylogging++.cc)
set(RAW_RS_HPP ../../src/backend.h ../../src/linux/backend-v4l2.h ../../src/linux/backend-hid.h
pybackend_extras.h
../../src/types.h ../../third-party/easyloggingpp/src/easylogging++.h)
if( (${CMAKE_SYSTEM_VERSION} EQUAL 6.1) OR (FORCE_WINUSB_UVC) ) # Windows 7
list(APPEND RAW_RS_CPP
../../src/win7/win7-helpers.cpp
../../src/win7/win7-uvc.cpp
../../src/win7/win7-usb.cpp
../../src/win7/win7-hid.cpp
../../src/win7/win7-backend.cpp
../../src/win7/winusb_uvc/winusb_uvc.cpp
)
else() # Some other windows version
list(APPEND RAW_RS_CPP
../../src/win/win-helpers.cpp
../../src/win/win-uvc.cpp
../../src/win/win-usb.cpp
../../src/win/win-hid.cpp
../../src/win/win-backend.cpp
)
endif()
pybind11_add_module(pybackend2 SHARED ${RAW_RS_CPP} ${RAW_RS_HPP})
include(libusb_config)
if(USE_EXTERNAL_USB)
add_dependencies(pybackend2 libusb)
endif()
target_link_libraries(pybackend2 PRIVATE usb ${CMAKE_THREAD_LIBS_INIT})
set_target_properties(pybackend2 PROPERTIES
VERSION ${REALSENSE_VERSION_STRING}
SOVERSION ${REALSENSE_VERSION_MAJOR})
set_target_properties(pybackend2 PROPERTIES FOLDER Wrappers/python)
include_directories(pybackend2 ../../include)
install(TARGETS pybackend2
EXPORT realsense2Targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
if (BUILD_PYTHON_DOCS)
add_subdirectory(docs)
endif()