summaryrefslogtreecommitdiffhomepage
path: root/tracker-kinect-face/CMakeLists.txt
blob: 0a110e5a5b16dda766992f0a741a1c76bb2be216 (plain)
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
# Kinect SDK is Windows only
if (WIN32 AND opentrack-intel)
	# Setup cache variable to Kinect SDK path
	set(SDK_KINECT20 "$ENV{KINECTSDK20_DIR}" CACHE PATH "Kinect SDK path")
	# If we have a valid SDK path, try build that tracker
	if(SDK_KINECT20)
		# Register our module
		otr_module(tracker-kinect-face)

		if(MSVC)
		# workaround warning in SDK
			target_compile_options(${self} PRIVATE "-wd4471")
		endif()

		# Add include path to Kinect SDK
		target_include_directories(${self} SYSTEM PRIVATE "${SDK_KINECT20}/inc")

		# Check processor architecture
		if(opentrack-64bit)
            # 64 bits
			set(kinect-arch-dir "x64")
		else()
            # 32 bits
			set(kinect-arch-dir "x86")
		endif()

		# Link against Kinect SDK libraries
		target_link_libraries(${self} "${SDK_KINECT20}/lib/${kinect-arch-dir}/Kinect20.lib" "${SDK_KINECT20}/lib/${kinect-arch-dir}/Kinect20.Face.lib")
		# Link against video utilities, needed for video preview
		target_link_libraries(${self} opentrack-video)

		# Install Kinect Face DLL
		install(FILES "${SDK_KINECT20}/Redist/Face/${kinect-arch-dir}/Kinect20.Face.dll" DESTINATION "${opentrack-libexec}" PERMISSIONS ${opentrack-perms-exec})
		# Install Kinect Face Database
		install(DIRECTORY "${SDK_KINECT20}/Redist/Face/${kinect-arch-dir}/NuiDatabase" DESTINATION "${opentrack-libexec}")

		set(redist-dir "${CMAKE_SOURCE_DIR}/redist/${kinect-arch-dir}")
		install(
		  FILES "${redist-dir}/msvcp110.dll" "${redist-dir}/msvcr110.dll"
		  DESTINATION "${opentrack-libexec}"
		  PERMISSIONS ${opentrack-perms-exec}
		)

        # Optional OpenCV support
        # Needed for Point Tracker to support Kinect V2 IR Sensor
        include(opentrack-opencv)
        find_package(OpenCV QUIET)

        if(OpenCV_FOUND)
            add_definitions(-DOTR_HAVE_OPENCV)
            target_include_directories(${self} SYSTEM PUBLIC ${OpenCV_INCLUDE_DIRS})
            target_link_libraries(${self} opencv_imgproc opentrack-cv opencv_core opentrack-video)
        endif()
	endif()
endif()