From cdb8eecaba54a806348457c080539e70ce2e035e Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 9 Feb 2019 12:41:15 +0100 Subject: tracker/kinect: fix cmake - fix bogus sdk warning - quote paths that can contain spaces - use opentrack-{intel,64bit,hier-pfx} - shorten module name - don't use EXISTS with pathname, it should fail at build time --- tracker-kinect-face/CMakeLists.txt | 54 ++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 28 deletions(-) (limited to 'tracker-kinect-face/CMakeLists.txt') diff --git a/tracker-kinect-face/CMakeLists.txt b/tracker-kinect-face/CMakeLists.txt index 690f82e7..7108eea8 100644 --- a/tracker-kinect-face/CMakeLists.txt +++ b/tracker-kinect-face/CMakeLists.txt @@ -1,42 +1,40 @@ # Kinect SDK is Windows only -if (WIN32) +if (WIN32 AND opentrack-intel) find_package(OpenCV QUIET) if(OpenCV_FOUND) - # Setup cache variable to Kinect SDK path - if(DEFINED ENV{KINECTSDK20_DIR}) - set(SDK_KINECT20 $ENV{KINECTSDK20_DIR} CACHE PATH $ENV{KINECTSDK20_DIR}) - else() - set(SDK_KINECT20 $ENV{KINECTSDK20_DIR} CACHE PATH "") - endif() - + # 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(EXISTS ${SDK_KINECT20}) + if(SDK_KINECT20) # Register our module otr_module(tracker-kinect-face) - # Add include path to Kinect SDK - target_include_directories(opentrack-tracker-kinect-face SYSTEM PUBLIC "${SDK_KINECT20}/inc") - - # Check processor architecture - if(CMAKE_SIZEOF_VOID_P EQUAL 4) - # 32 bits - set (kinect-arch-dir "x86") - elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) - # 64 bits - set (kinect-arch-dir "x64") + if(MSVC) + # workaround warning in SDK + target_compile_options(${self} PUBLIC "-wd4471") + endif() + + # Add include path to Kinect SDK + target_include_directories(${self} SYSTEM PRIVATE "${SDK_KINECT20}/inc") + + # Check processor architecture + if(NOT opentrack-64bit) + # 32 bits + set(kinect-arch-dir "x86") else() - message(FATAL_ERROR "Kinect: architecture not supported!") + # 64 bits + set(kinect-arch-dir "x64") endif() - + # Link against Kinect SDK libraries - target_link_libraries(opentrack-tracker-kinect-face "${SDK_KINECT20}/lib/${kinect-arch-dir}/Kinect20.lib" "${SDK_KINECT20}/lib/${kinect-arch-dir}/Kinect20.Face.lib") + target_link_libraries(${self} "${SDK_KINECT20}/lib/${kinect-arch-dir}/Kinect20.lib" "${SDK_KINECT20}/lib/${kinect-arch-dir}/Kinect20.Face.lib") # Link against OpenCV stuff, needed for video preview - target_link_libraries(opentrack-tracker-kinect-face opencv_imgproc opentrack-cv opencv_core) + target_link_libraries(${self} opentrack-cv) # Install Kinect Face DLL - install(FILES "${SDK_KINECT20}/Redist/Face/${kinect-arch-dir}/Kinect20.Face.dll" DESTINATION "./modules/" PERMISSIONS ${opentrack-perms-exec}) + install(FILES "${SDK_KINECT20}/Redist/Face/${kinect-arch-dir}/Kinect20.Face.dll" DESTINATION "${opentrack-hier-pfx}" PERMISSIONS ${opentrack-perms-exec}) # Install Kinect Face Database - install(DIRECTORY "${SDK_KINECT20}/Redist/Face/${kinect-arch-dir}/NuiDatabase" DESTINATION "./modules/") - endif(EXISTS ${SDK_KINECT20}) - endif(OpenCV_FOUND) -endif(WIN32) \ No newline at end of file + install(DIRECTORY "${SDK_KINECT20}/Redist/Face/${kinect-arch-dir}/NuiDatabase" DESTINATION "${opentrack-hier-pfx}") + endif() + endif() +endif() -- cgit v1.2.3