Finding OpenNI in windows 64bit (Bug #1339)
Description
The current FindOpenNI.cmake is unable to find openni (either 32bit or 64bit) in a windows 64bit machine. It also doesn't accept the user provided entries.
In a 64 bit windows :- OpenNI 32 bit : is installed in c:/Program Files (x86)
- OpenNI 64 bit : is installed in c:/Program Files, openni lib is Lib64/OpenNI64.lib , sensor module name contains also the "64" suffix.
Fix attached. I also added the default install folder of avin2 sensor module.
History
Updated by Arman Savran over 13 years ago
The patch is good but there is a small problem. The default installation directories for the PRIME_SENSOR module contain "PrimeSense" instead of "Prime Sense". If all them are replaced with no-spaced versions it would be much better.
Updated by Tsukasa Sugiura over 13 years ago
bouffa's openni.patch has a small problem except for Path.
Using this patch the environment where 32bit and 64bit OpenNI installed in Windows(x64), CMake always specifies the OpenNI 32bit's Path ( C:/Program Files (x86)/OpenNI/... ).
I made a patch to fixed this problem.
Updated by Arman Savran over 13 years ago
unanancyowen's patch can not find OPENNI_INLCUDE_DIR (C:\Program Files\OpenNI\Include) and OPENNI_PRIME_SENSOR_MODULE_BIN_DIR (C:\Program Files\PrimeSense\SensorKinect\Bin64), even though the OPEN_NI_INCLUDE environment variable is set by the OpenNI setup.
It only finds OPENNI_LIB_DIR (C:/Program Files/OpenNI/Lib64)
However, bouffa's patch (after replacing 'Prime Sense' with 'PrimeSense' finds all of them correctly!
Replying to [comment:2 unanancyowen]:
bouffa's openni.patch has a small problem except for Path.
Using this patch the environment where 32bit and 64bit OpenNI installed in Windows(x64), CMake always specifies the OpenNI 32bit's Path ( C:/Program Files (x86)/OpenNI/... ).
I made a patch to fixed this problem.
Updated by Mourad Boufarguine over 13 years ago
Replying to [comment:3 arman]:
unanancyowen's patch can not find OPENNI_INLCUDE_DIR (C:\Program Files\OpenNI\Include)
It is because 64bit openni doesn't set OPEN_NI_INCLUDE64 environment variable, but OPEN_NI_INCLUDE
I think it's better to use openni environment variables than the hardcoded paths in my patch.
and OPENNI_PRIME_SENSOR_MODULE_BIN_DIR (C:\Program Files\PrimeSense\SensorKinect\Bin64), even though the OPEN_NI_INCLUDE environment variable is set by the OpenNI setup.
I am not sure if CMake can handle wildcards in PATHS argument (?).. Expending the wildchar to the 2 possible cases should work :
if(NOT)
find_file(OPENNI_PRIME_SENSOR_MODULE "XnCore.dll" PATHS "$ENV{OPEN_NI_INSTALL_PATH}../PrimeSense/Sensor/Bin" "$ENV{OPEN_NI_INSTALL_PATH}../PrimeSense/SensorKinect/Bin" DOC "Core library of PrimeSensor Modules for OpenNI")
else()
find_file(OPENNI_PRIME_SENSOR_MODULE "XnCore64.dll" PATHS "$ENV{OPEN_NI_INSTALL_PATH64}../PrimeSense/Sensor/Bin64" "$ENV{OPEN_NI_INSTALL_PATH64}../PrimeSense/SensorKinect/Bin64" DOC "Core library of PrimeSensor Modules for OpenNI")
endif()
It only finds OPENNI_LIB_DIR (C:/Program Files/OpenNI/Lib64)
However, bouffa's patch (after replacing 'Prime Sense' with 'PrimeSense' finds all of them correctly!
Updated by Tsukasa Sugiura over 13 years ago
Replying to bouffa and arman:
From bouffa and arman, thank you the proposals for an appropriate course of action. OpenNI 64bit didn't set environment variable OPEN_NI_INCLUDE64.
In addition, I was confirm CMake(find_file() and find_library()) deprecated wildcards or can't handle wildcards.
Fixed patch based on these.
Please test operation.
Updated by Arman Savran over 13 years ago
The patch is now working!
Thank you.
Replying to [comment:5 unanancyowen]:
Replying to bouffa and arman:
From bouffa and arman, thank you the proposals for an appropriate course of action.
OpenNI 64bit didn't set environment variable OPEN_NI_INCLUDE64.
In addition, I was confirm CMake(find_file() and find_library()) deprecated wildcards or can't handle wildcards.
Fixed patch based on these.
Please test operation.
Updated by Alexander Shishkov about 13 years ago
- Description changed from The current [[FindOpenNI]].cmake is unable to find openni (either 32bit or 64... to The current FindOpenNI.cmake is unable to find openni (either 32bit or 64bit)... More
Updated by Alexander Shishkov about 13 years ago
- Status deleted (
Open) - Assignee changed from Vadim Pisarevsky to Alexander Shishkov
Updated by Alexander Shishkov about 13 years ago
Thank you for the patches! They were applied to 7336 revision.
- Status set to Done
Updated by Andrey Kamaev about 13 years ago
- Target version set to 2.4.0