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
Add absl to CMake and Bazel builds. #1301
Conversation
Is there a reason why this is only a subset of whole abseil? For example I don't see the memory or synchronization subfolders which will probably be most interesting for us. |
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 think you pulled the wrong rev? This is only including the first three subfolders of absl.
NVM - seems to be an UI issue ...
@CodeArno FYI |
(sorry about my previous comment if you got an email about it, I got confused about the repositories). |
Following up on @CodeArno's previous comment. Do we need to copy Abseil here for CMake to work? Or what is the reasoning? Should this rationale be added to the PR description? |
@wohe We can either copy it or add it as a sub-module. In the latter case, the users will have to call |
@pifon2a there is a third option which is a lot like this one (pasting a copy of the 3rd party repo inside your repo), and that is using |
@pifon2a Since absl already depends on cmake 3.1, we can also use cmake's |
I dimly remember wanting to smash something every time I tried using |
a50d9b5
to
a02a547
Compare
6d2fcdc
to
9e18129
Compare
CMakeLists.txt
Outdated
|
||
find_package(Eigen3) | ||
if(NOT EIGEN3_FOUND) | ||
set(EIGEN3_INCLUDE_DIRS ${/usr/include/eigen3}) |
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.
is this unrelated to absl?
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.
When I install cmake 3.x in trusty/jessie, Cartographer complains that it cannot find FindEigen3.cmake, although Ceres was compiled just prior to that. I do not know whether it is a good solution or not. @gaschler PTAL, because CMake scares and confuses me.
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.
This is unrelated to abseil and should be a separate PR where only the cmake version is bumped.
(It's hard to say why a newer cmake makes the package search stricter.)
So, no change here, please. (Setting an include path manually is not portable and wouldn't be part of a cmake style guide.)
A proper solution would be to add a FindEigen3.cmake to cmake/modules similar to (but much shorter than) what ceres does: https://github.com/ceres-solver/ceres-solver/blob/master/cmake/FindEigen.cmake
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.
Also, when bumping cmake, it would be good to bump cmake_minimum_required
in this file and update the install instructions in the documentation.
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.
Thank you.
Do you have a plan to verify (and update if necessary)
- Catkin build of cartographer_ros/_fetch,
- the ROS release build https://github.com/ros-gbp/cartographer-release/
- manual install instructions following documentation?
scripts/install_debs_cmake.sh
Outdated
sudo apt-get install python-software-properties apt-file -y | ||
sudo apt-file update | ||
sudo apt-get install software-properties-common -y | ||
sudo add-apt-repository ppa:george-edison55/cmake-3.x |
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.
no need to install personal (untrusted) packages,
just install cmake3
https://packages.ubuntu.com/en/trusty/cmake3
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.
oh, thanks, done
cmake/modules/FindAbseil.cmake
Outdated
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# DO NOT SUBMIT, would break on CMake versions. |
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.
drop this comment (after bumping cmake)
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.
done
CMakeLists.txt
Outdated
|
||
find_package(Eigen3) | ||
if(NOT EIGEN3_FOUND) | ||
set(EIGEN3_INCLUDE_DIRS ${/usr/include/eigen3}) |
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.
Also, when bumping cmake, it would be good to bump cmake_minimum_required
in this file and update the install instructions in the documentation.
cmake/modules/FindAbseil.cmake
Outdated
"${ABSEIL_PROJECT_BUILD_DIR}/absl/numeric/libabsl_numeric.a" | ||
"${ABSEIL_PROJECT_BUILD_DIR}/absl/strings/libabsl_strings.a" | ||
"${ABSEIL_PROJECT_BUILD_DIR}/absl/types/libabsl_bad_any_cast.a" | ||
"${ABSEIL_PROJECT_BUILD_DIR}/absl/types/libabsl_any.a" |
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.
sort alphabetically
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.
done
cmake/modules/FindAbseil.cmake
Outdated
set(ABSEIL_INCLUDE_DIRS ${ABSEIL_PROJECT_SRC_DIR}) | ||
set(ABSEIL_LIBRARY_PATH | ||
"${ABSEIL_PROJECT_BUILD_DIR}/absl/synchronization/${CMAKE_STATIC_LIBRARY_PREFIX}absl_synchronization${CMAKE_STATIC_LIBRARY_SUFFIX}") | ||
set(dependent_libraries |
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.
style: rename to ABSEIL_DEPENDENT_LIBRARIES
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.
done
cmake/modules/FindAbseil.cmake
Outdated
${CMAKE_CURRENT_BINARY_DIR}/${ABSEIL_PROJECT_NAME}/src/${ABSEIL_PROJECT_NAME}-build) | ||
set(ABSEIL_INCLUDE_DIRS ${ABSEIL_PROJECT_SRC_DIR}) | ||
set(ABSEIL_LIBRARY_PATH | ||
"${ABSEIL_PROJECT_BUILD_DIR}/absl/synchronization/${CMAKE_STATIC_LIBRARY_PREFIX}absl_synchronization${CMAKE_STATIC_LIBRARY_SUFFIX}") |
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.
drop the prefix and suffix (for consistency with dependent_libraries), this isn't portable anyways
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.
done
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.
done
cmake/modules/FindAbseil.cmake
Outdated
PROPERTIES IMPORTED_LOCATION | ||
${ABSEIL_LIBRARY_PATH} | ||
INTERFACE_LINK_LIBRARIES | ||
"${dependent_libraries}" |
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.
@hauke76 Is there a cleaner way to glob all static libraries into one target?
ABSEIL_LIBRARY_PATH=synchronization/libabsl_synchronization.a was an arbitrary choice only because this is the first one we will use.
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.
As discussed offline, this is fine.
Having to support both CMake and Bazel builds, we are adding it as a copy in third_party/ directory.