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

Add pkg-config files for control libraries #326

Merged
merged 8 commits into from
Dec 13, 2022
Merged

Conversation

domire8
Copy link
Contributor

@domire8 domire8 commented Dec 9, 2022

Similar to a recent PR on network-interfaces, I'm adding here the pkg-config files to the control libraries. For each module, I'm creating a separate file and then I'm also creating one for the top level cmake project that summarizes the 4 modules. The result are 5 files:

  • /usr/local/lib/pkgconfig/state_representation.pc:
    prefix=/usr/local
    exec_prefix=${prefix}
    includedir=${prefix}/include
    libdir=${exec_prefix}/lib
    
    Name: state_representation
    Description: This library provides a set of classes to represent states in Cartesian and joint space.
    Version: 6.3.1
    Requires: eigen3 >= 3.4.0
    Cflags: -I${includedir} 
    Libs: -L${libdir}
    
  • /usr/local/lib/pkgconfig/dynamical_systems.pc:
    prefix=/usr/local
    exec_prefix=${prefix}
    includedir=${prefix}/include
    libdir=${exec_prefix}/lib
    
    Name: dynamical_systems
    Description: This library provides a set of classes to represent dynamical systems; functions which map a state to a state derivative.
    Version: 6.3.1
    Requires: state_representation >= 6.3.1
    Cflags: -I${includedir} 
    Libs: -L${libdir}
    
  • /usr/local/lib/pkgconfig/robot_model.pc:
    prefix=/usr/local
    exec_prefix=${prefix}
    includedir=${prefix}/include
    libdir=${exec_prefix}/lib
    
    Name: robot_model
    Description: This library is a wrapper for the pinocchio library, used to compute dynamics model of a robot.
    Version: 6.3.1
    Requires: state_representation >= 6.3.1, pinocchio >= 2.6.9
    Cflags: -I${includedir} -lOsqpEigen
    Libs: -L${libdir}
    
  • /usr/local/lib/pkgconfig/controllers.pc:
    prefix=/usr/local
    exec_prefix=${prefix}
    includedir=${prefix}/include
    libdir=${exec_prefix}/lib
    
    Name: controllers
    Description: This library introduces a set of controllers to be used in robotic control-loop schemes.
    Version: 6.3.1
    Requires: robot_model >= 6.3.1
    Cflags: -I${includedir} 
    Libs: -L${libdir}
    
  • /usr/local/lib/pkgconfig/control_libraries.pc:
    prefix=/usr/local
    exec_prefix=${prefix}
    includedir=${prefix}/include
    libdir=${exec_prefix}/lib
    
    Name: control_libraries
    Description: control_libraries
    Version: 6.3.1
    Requires: state_representation >= 6.3.1, dynamical_systems >= 6.3.1, controllers >= 6.3.1, robot_model >= 6.3.1
    Cflags: -I${includedir} 
    Libs: -L${libdir}
    

Of course, the Requires tags in that last file will only be filled with the libraries that are actually installed.

It's a small feature that will most likely not used a lot but it can't hurt to do it. My main motivation is to add it here such that other packages can create pkg-config files where we add Requires: control_libraries. This wouldn't be possible if control libraries doesn't have pkg-config files itself.

buschbapti
buschbapti previously approved these changes Dec 9, 2022
eeberhard
eeberhard previously approved these changes Dec 12, 2022
Copy link
Member

@eeberhard eeberhard left a comment

Choose a reason for hiding this comment

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

Seems like a great addition. Thanks for advancing our project configuration with more cmake magic!

Comment on lines 105 to 106
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/control_libraries-config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
Copy link
Member

Choose a reason for hiding this comment

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

The base config input file was renamed, but the generated output is still ${PROJECT_NAME}Config.cmake. Should it also be changed to the lowercase naming convention <lowercasePackageName>-config.cmake? It shouldn't be a breaking change since find_package looks for both name types but I would also make sure that's tested before confirming it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hm yeah good point, I think I like ${PROJECT_NAME}Config.cmake better. I renamed the file

Comment on lines 27 to 31
if(PKGCONFIG_LIBRARIES)
set(PKGCONFIG_LIBRARIES "${PKGCONFIG_LIBRARIES}, ${ARGV0} >= ${ARGV1}")
else()
set(PKGCONFIG_LIBRARIES "${ARGV0} >= ${ARGV1}")
endif()
Copy link
Member

Choose a reason for hiding this comment

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

Indentation looks a bit off here

Suggested change
if(PKGCONFIG_LIBRARIES)
set(PKGCONFIG_LIBRARIES "${PKGCONFIG_LIBRARIES}, ${ARGV0} >= ${ARGV1}")
else()
set(PKGCONFIG_LIBRARIES "${ARGV0} >= ${ARGV1}")
endif()
if(PKGCONFIG_LIBRARIES)
set(PKGCONFIG_LIBRARIES "${PKGCONFIG_LIBRARIES}, ${ARGV0} >= ${ARGV1}")
else()
set(PKGCONFIG_LIBRARIES "${ARGV0} >= ${ARGV1}")
endif()


if(${PKG_CONFIG_FOUND})
set(PKG_NAME ${LIBRARY_NAME})
set(PKG_DESC "This library provides a set of classes to represent dynamical systems; functions which map a state to a state derivative.")
Copy link
Member

Choose a reason for hiding this comment

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

The semicolon here is not quite right - I would suggest a hyphen or colon instead.

Suggested change
set(PKG_DESC "This library provides a set of classes to represent dynamical systems; functions which map a state to a state derivative.")
set(PKG_DESC "This library provides a set of classes to represent dynamical systems: functions which map a state to a state derivative.")

@domire8 domire8 dismissed stale reviews from eeberhard and buschbapti via 088cd4d December 13, 2022 14:59
@domire8 domire8 merged commit 6e1827b into develop Dec 13, 2022
@domire8 domire8 deleted the feature/pkg-config branch December 13, 2022 16:38
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.

3 participants