-
Notifications
You must be signed in to change notification settings - Fork 471
Fix cmake issues with external libraries #74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ruffsl
wants to merge
2
commits into
MIT-SPARK:master
Choose a base branch
from
ruffsl:cmake
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
|
|
||
| # This is FindOPENGV.cmake | ||
| # CMake module to locate the OPENGV package | ||
| # | ||
| # The following cache variables may be set before calling this script: | ||
| # | ||
| # OPENGV_DIR (or OPENGV_ROOT): (Optional) The install prefix OR source tree of opengv (e.g. /usr/local or src/opengv) | ||
| # OPENGV_BUILD_NAME: (Optional) If compiling against a source tree, the name of the build directory | ||
| # within it (e.g build-debug). Without this defined, this script tries to | ||
| # intelligently find the build directory based on the project's build directory name | ||
| # or based on the build type (Debug/Release/etc). | ||
| # | ||
| # The following variables will be defined: | ||
| # | ||
| # OPENGV_FOUND : TRUE if the package has been successfully found | ||
| # OPENGV_INCLUDE_DIR : paths to OPENGV's INCLUDE directories | ||
| # OPENGV_LIBS : paths to OPENGV's libraries | ||
| # | ||
| # NOTES on compiling against an uninstalled OPENGV build tree: | ||
| # - A OPENGV source tree will be automatically searched for in the directory | ||
| # 'opengv' next to your project directory, after searching | ||
| # CMAKE_INSTALL_PREFIX and $HOME, but before searching /usr/local and /usr. | ||
| # - The build directory will be searched first with the same name as your | ||
| # project's build directory, e.g. if you build from 'MyProject/build-optimized', | ||
| # 'opengv/build-optimized' will be searched first. Next, a build directory for | ||
| # your project's build type, e.g. if CMAKE_BUILD_TYPE in your project is | ||
| # 'Release', then 'opengv/build-release' will be searched next. Finally, plain | ||
| # 'opengv/build' will be searched. | ||
| # - You can control the opengv build directory name directly by defining the CMake | ||
| # cache variable 'OPENGV_BUILD_NAME', then only 'opengv/${OPENGV_BUILD_NAME} will | ||
| # be searched. | ||
| # - Use the standard CMAKE_PREFIX_PATH, or OPENGV_DIR, to find a specific opengv | ||
| # directory. | ||
|
|
||
| # Get path suffixes to help look for opengv | ||
| if(OPENGV_BUILD_NAME) | ||
| set(opengv_build_names "${OPENGV_BUILD_NAME}/opengv") | ||
| else() | ||
| # lowercase build type | ||
| string(TOLOWER "${CMAKE_BUILD_TYPE}" build_type_suffix) | ||
| # build suffix of this project | ||
| get_filename_component(my_build_name "${CMAKE_BINARY_DIR}" NAME) | ||
|
|
||
| set(opengv_build_names "${my_build_name}/opengv" "build-${build_type_suffix}/opengv" "build/opengv" "build/lib") | ||
| endif() | ||
|
|
||
| # Use OPENGV_ROOT or OPENGV_DIR equivalently | ||
| if(OPENGV_ROOT AND NOT OPENGV_DIR) | ||
| set(OPENGV_DIR "${OPENGV_ROOT}") | ||
| endif() | ||
|
|
||
| if(OPENGV_DIR) | ||
| # Find include dirs | ||
| find_path(OPENGV_INCLUDE_DIR opengv/types.hpp | ||
| PATHS "${OPENGV_DIR}/include" "${OPENGV_DIR}" NO_DEFAULT_PATH | ||
| DOC "OPENGV include directories") | ||
|
|
||
| # Find libraries | ||
| find_library(OPENGV_LIBS NAMES opengv | ||
| HINTS "${OPENGV_DIR}/lib" "${OPENGV_DIR}" NO_DEFAULT_PATH | ||
| PATH_SUFFIXES ${opengv_build_names} | ||
| DOC "OPENGV libraries") | ||
| else() | ||
| # Find include dirs | ||
| set(extra_include_paths ${CMAKE_INSTALL_PREFIX}/include "$ENV{HOME}/include" "${PROJECT_SOURCE_DIR}/../opengv" /usr/local/include /usr/include) | ||
| find_path(OPENGV_INCLUDE_DIR opengv/types.hpp | ||
| PATHS ${extra_include_paths} | ||
| DOC "OPENGV include directories") | ||
| if(NOT OPENGV_INCLUDE_DIR) | ||
| message(STATUS "Searched for opengv headers in default paths plus ${extra_include_paths}") | ||
| endif() | ||
|
|
||
| # Find libraries | ||
| find_library(OPENGV_LIBS NAMES opengv | ||
| HINTS ${CMAKE_INSTALL_PREFIX}/lib "$ENV{HOME}/lib" "${PROJECT_SOURCE_DIR}/../opengv" /usr/local/lib /usr/lib | ||
| PATH_SUFFIXES ${opengv_build_names} | ||
| DOC "OPENGV libraries") | ||
| endif() | ||
|
|
||
| # handle the QUIETLY and REQUIRED arguments and set OPENGV_FOUND to TRUE | ||
| # if all listed variables are TRUE | ||
| include(FindPackageHandleStandardArgs) | ||
| find_package_handle_standard_args(OPENGV DEFAULT_MSG | ||
| OPENGV_LIBS OPENGV_INCLUDE_DIR) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ruffsl I don't see why you need to put DBoW2 include dirs here, this should be already done when calling DBoW2::DBoW2 in target_link_libraries (are you using DBoW2 headers through Kimera?).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that interface is working as you expect. My hunch is that the project was relying on and on finding the headers via the system global paths given the sketchy
*sudo* make installKimera-VIO/Dockerfile_18_04
Lines 68 to 74 in a913c97
or depended on a erroneous limitation in legacy catkin for non-isolated devel space builds:
https://answers.ros.org/question/320613/catkin_make-vs-catkin_make_isolated-which-is-preferred/?answer=320706#post-id-320706
When using current build tools, each package must explicitly declare it's install steps given the use of sanitary/isolated builds. Thus every downstream package must similarly explicitly import the resources they need, as no cmake context it implicitly shared across workspace packages.