Skip to content
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

modernize cmake syntax #13

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

modernize cmake syntax #13

wants to merge 3 commits into from

Conversation

mamoll
Copy link
Member

@mamoll mamoll commented Sep 8, 2024

This PR mirrors the changes in ompl/ompl#1066.

The pkg-config file ompl.pc that is generated is actually broken. The same is true for the ompl repo. I'm thinking we should just remove the png-config related stuff.

I noticed that in the ompl repo, libompl gets installed in CMAKE_INSTALL_DATAROOTDIR (i.e., /usr/share) rather than CMAKE_INSTALL_LIBDIR (i.e. /usr/lib). That is fixed in this PR for omplapp, but if this is right, we need to make the same change in ompl.

@mamoll
Copy link
Member Author

mamoll commented Sep 8, 2024

@Ryanf55 FYSA

@mamoll mamoll mentioned this pull request Sep 8, 2024
Copy link
Contributor

@Ryanf55 Ryanf55 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice improvement!

if(DEFINED ENV{ROS_DISTRO})
include_directories("/opt/ros/$ENV{ROS_DISTRO}/include")
endif()
"${OMPL_INCLUDE_DIRS}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to just call target_link_libraries on ompl::ompl?

DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT omplapp)
endif()
install(EXPORT omplExport
Copy link
Contributor

@Ryanf55 Ryanf55 Sep 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this conflict with the other export if someone installs both libraries into the same folder (a colcon user would share the install folder between multiple repos)? Usually, I've seen ${PROJECT_NAME}Export to prevent conflicts.

@@ -1,6 +1,6 @@
add_executable(ompl_benchmark
CFGBenchmark.cpp BenchmarkOptions.cpp BenchmarkTypes.cpp benchmark.cpp)
target_link_libraries(ompl_benchmark ${OMPLAPP_LIBRARIES} ompl ompl_app_base ${Boost_PROGRAM_OPTIONS_LIBRARY})
target_link_libraries(ompl_benchmark ${OMPLAPP_LIBRARIES} ompl ompl_app_base Boost::program_options)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
target_link_libraries(ompl_benchmark ${OMPLAPP_LIBRARIES} ompl ompl_app_base Boost::program_options)
target_link_libraries(ompl_benchmark ompl::omplapp ompl ompl_app_base Boost::program_options)

If you can, try linking to an ALIAS targets for all of these. They don't all exist, but are easily created for the internal ones..

@Ryanf55
Copy link
Contributor

Ryanf55 commented Sep 8, 2024

I tried your PR in an isolated environment, and it didn't compile. After cloning and changing directory into the repo:

docker run --net host -v $(pwd):/ws -w /ws -it ubuntu:22.04 bash
apt update
apt install -y \
    build-essential libboost-filesystem-dev libboost-serialization-dev libboost-system-dev libboost-program-options-dev \
    cmake libeigen3-dev libassimp-dev libfcl-dev
cmake -B build/Release
cmake --build build/Release/ --parallel $(nproc)

Results in

[ 87%] Built target demo_MultiLevelPlanningRigidBody2D
[ 88%] Building CXX object src/omplapp/CMakeFiles/ompl_app_base.dir/apps/detail/appUtil.cpp.o
[ 88%] Linking CXX executable ../../bin/demo_MultiLevelPlanningRigidBody3D
[ 88%] Built target demo_MultiLevelPlanningRigidBody3D
[ 88%] Building CXX object src/omplapp/CMakeFiles/ompl_app_base.dir/geometry/RigidBodyGeometry.cpp.o
gmake[2]: *** No rule to make target '/usr/lib/x86_64-linux-gnu/libz.so', needed by 'lib/libompl_app_base.so.1.6.0'.  Stop.
gmake[2]: *** Waiting for unfinished jobs....
[ 88%] Building CXX object src/omplapp/CMakeFiles/ompl_app_base.dir/geometry/detail/assimpUtil.cpp.o
[ 88%] Linking CXX executable ../../bin/demo_Koules
[ 88%] Linking CXX executable ../../bin/demo_MultiLevelPlanningHyperCube
[ 88%] Built target demo_Koules
[ 88%] Built target demo_MultiLevelPlanningHyperCube
[ 89%] Linking CXX executable ../../bin/demo_ConstrainedPlanningKinematicChain
[ 89%] Built target demo_ConstrainedPlanningKinematicChain
[ 89%] Linking CXX executable ../../bin/demo_ConstrainedPlanningSphere
[ 89%] Built target demo_ConstrainedPlanningSphere
[ 90%] Linking CXX executable ../../bin/demo_ConstrainedPlanningTorus
[ 90%] Built target demo_ConstrainedPlanningTorus
[ 90%] Linking CXX executable ../../bin/demo_MultiLevelPlanningKinematicChain
[ 90%] Built target demo_MultiLevelPlanningKinematicChain
[ 90%] Linking CXX executable ../../bin/demo_ConstrainedPlanningImplicitChain
[ 90%] Built target demo_ConstrainedPlanningImplicitChain
[ 90%] Linking CXX executable ../../bin/demo_MultiLevelPlanningHyperCubeBenchmark
[ 90%] Built target demo_MultiLevelPlanningHyperCubeBenchmark
[ 90%] Linking CXX executable ../../bin/demo_ConstrainedPlanningImplicitParallel
[ 90%] Built target demo_ConstrainedPlanningImplicitParallel
gmake[1]: *** [CMakeFiles/Makefile2:1298: src/omplapp/CMakeFiles/ompl_app_base.dir/all] Error 2

Note I use slightly different build instructions rather than calling make directly, but it works much the same, with less typing.

@mamoll
Copy link
Member Author

mamoll commented Sep 9, 2024

The docker build error looks to me like libassimp-dev's Debian package is broken and doesn't declare a dependency on zlib1g-dev. Once you install the later, the build succeeds

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants