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 find_package component support #82

Merged
merged 2 commits into from
Aug 21, 2023
Merged

Conversation

Levi-Armstrong
Copy link
Member

@Levi-Armstrong Levi-Armstrong commented Aug 20, 2023

  • Update documentation
  • Possible update package tooling to support components also

README.rst Outdated Show resolved Hide resolved
README.rst Outdated Show resolved Hide resolved
README.rst Show resolved Hide resolved
README.rst Show resolved Hide resolved
@marip8
Copy link
Member

marip8 commented Aug 21, 2023

Looks fine to me for the most part, but I don't really understand how to make CMake components. Does this affect CPack and debian generation?

@Levi-Armstrong
Copy link
Member Author

Levi-Armstrong commented Aug 21, 2023

Looks fine to me for the most part, but I don't really understand how to make CMake components. Does this affect CPack and debian generation?

I would take a look at the tesseract PR where I leverage the new features for generating components

Instead of having a single tesseract_kinematics-config.cmake file with everything switching things off and on with build options leveraging the components feature you get a separate component config where the tesseract_kinematics-config.cmake looks like this.

# Default *-config.cmake file created by ros-industrial-cmake-boilerplate


####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() #######
####### Any changes to this file will be overwritten by the next CMake run ####
####### The input file was tesseract_kinematics-config.cmake.in                            ########

get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)

macro(set_and_check _var _file)
  set(${_var} "${_file}")
  if(NOT EXISTS "${_file}")
    message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !")
  endif()
endmacro()

####################################################################################

set(tesseract_kinematics_FOUND ON)

# Components
set(supported_components core ikfast kdl opw ur)
if (NOT tesseract_kinematics_FIND_COMPONENTS)
  foreach(component ${supported_components})
    include(${CMAKE_CURRENT_LIST_DIR}/${component}-config.cmake)
  endforeach()
else()
  foreach(component ${tesseract_kinematics_FIND_COMPONENTS})
    if(NOT component IN_LIST supported_components)
      set(tesseract_kinematics_${component}_FOUND OFF)
      set(tesseract_kinematics_${component}_NOT_FOUND_MESSAGE "Unsupported component")
      if (tesseract_kinematics_FIND_REQUIRED_${component})
        message(FATAL_ERROR "Failed to find required component ${component} for package tesseract_kinematics")
      endif()
    else()
      include(${CMAKE_CURRENT_LIST_DIR}/${component}-config.cmake)
    endif()
  endforeach()
endif()


# Extra configuration files
include("${CMAKE_CURRENT_LIST_DIR}/tesseract_kinematics-extras.cmake")

image

@Levi-Armstrong
Copy link
Member Author

This should not affect the cpack debain generation, but I think we should be able to create a separate debian for each component to avoid having one which installs all components.

@Levi-Armstrong Levi-Armstrong merged commit 2718046 into master Aug 21, 2023
@Levi-Armstrong Levi-Armstrong deleted the feat/AddComponentSupport branch August 21, 2023 21:36
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