Separated CMakeLists into self-contained files in subdirectories.#180
Separated CMakeLists into self-contained files in subdirectories.#180cboulay wants to merge 2 commits into
Conversation
84a28aa to
ac89881
Compare
|
I updated the original comment after adding new commits and squashing. It now works on all 3 platforms. |
|
Good idea, but I'd even go for |
|
OK. The While I'm at it I will fix up the OpenCV logic. The way it is now, it always includes & links a system OpenCV if found. Then, additionally, if PSMOVE_USE_LOCAL_OPENCV is set then it will ALSO include and link the local version. This actually hid a problem from me when I was trying to update to opencv3, because I still had system opencv 2.4.11 but had local opencv3. |
|
I think the best option for better OpenCV support (also addressing my comment for #170) is to provide a FindOpenCV.cmake file. Whether or not USE_LOCAL_OPENCV is set will determine whether or not OPENCV_SRC_DIR is used as a path hint for find_package. Then FindOpenCV.cmake will look for the OpenCV libraries in lib, in the appropriate directory from the precompiled binary distribution (win only), or wherever As for using Anyway, I think that is a bit much for this first PR. |
ad0778b to
8fd1921
Compare
|
CMake's built-in ability to find the OpenCV package works very well. I put OpenCV 2.4.11 or OpenCV 3 in psmoveapi/external/opencv and it worked fine. As long as the user builds OpenCV with cmake (as it will generate a file needed by find_package) I don't see any issues. I tested in Windows MinGW64-32 with local OpenCV, with OSX with a local opencv and homebrew opencv, and in ubuntu with local opencv and system opencv. find_package found it every time without me doing anything extra. I was able to build and run test_tracker in all the above systems. Also note that I changed the PS3EYEDriver logic around a little so now it builds with MinGW64-32, so that's an option even without the CL Eye driver. I'm still using The other thing about So there are two options:
I'm going to stop working on the CMake part and I'm going to use this version as my base for MSVC support. |
|
What's the status here? Let me know when it's reviewable / mergeable. |
…oved OpenCV searching/installing, instead rely on cmake find_package. Tested in Windows Mingw64-32 bit, Ubuntu local and system OpenCV, OSX local and system OpenCV.
5d48b66 to
6b360dc
Compare
|
Superseded by #190 |
I broke up CMakeLists into 5 files in the following directories:
All I did was cut & paste, and I changed a few directories to using relative CMAKE_CURRENT_LIST_DIR where possible to make the folders more portable if there's ever a desire to remove them or rename them. I did not change any of the logic.
With these changes, the directories listed above are self-contained. The main advantage for me is that it will be much easier to modify the preprocessor logic for the tracker without worrying about what I'm screwing up elsewhere. This is a prerequisite for me to be able to do the work in #163
Note that I am using the CMake
include(path/to/sub/CMakeLists.txt)command instead ofadd_subdirectory(path/to/sub)because the latter places the binaries in similarly named build/path/to/sub/ and I don't know if that is desired.(It is possible to specify that all targets build to the same directory, but that generates many warnings and also interferes with CMake's ability to calculate % complete).Also, when using add_subdirectory, variables defined in sister directories are not available, so
examplesandbindingscannot see OpenCV. I was able to include and link OpenCV successfully for the targets in these folders but there's currently an error in the OpenCV include and link logic that masked some other problems. I will revisit this in a future pull request.I tested this with Windows MinGW64 mingw32-make, ubuntu, and in OS X.
I only tested the Python bindings in Windows, and the Python, Java, and Processing bindings in OS X.