Skip to content
This repository has been archived by the owner on Feb 3, 2025. It is now read-only.

Find OGRE correctly in a system with pkg-config but without OGRE .pc files #2719

Merged
merged 1 commit into from
Sep 30, 2020

Conversation

traversaro
Copy link
Collaborator

This PR fixes the configuration in a system in which pkg-config is available in the path, but OGRE did not install any .pc file.

This works by ensuing that any invocation of pkg-config to extract OGRE-specific versions only occurs if OGRE has been found by the pkg_check_modules(OGRE OGRE>=${MIN_OGRE_VERSION}) call.

An example of such a setup is when you build Gazebo for Windows using the vcpkg-installed OGRE (that as of 04/2020 does not install .pc files) on the windows-2019 image of GitHub Actions (that instead contains pkg-config).

Without this fix, the configuration fails with the following error (from https://github.com/robotology/robotology-superbuild-dependencies-vcpkg/runs/626432931):

 CMake Error at cmake/SearchForStuff.cmake:339 (string):
  string sub-command REPLACE requires at least four arguments.
Call Stack (most recent call first):
  CMakeLists.txt:151 (include)


CMake Error at cmake/SearchForStuff.cmake:345 (string):
  string sub-command REGEX, mode REPLACE needs at least 6 arguments total to
  command.
Call Stack (most recent call first):
  CMakeLists.txt:151 (include)

An example of successful Gazebo configuration on GitHub Action with this fix is https://github.com/robotology/robotology-superbuild-dependencies-vcpkg/runs/626459680 .

…files

This fixes the configuration in a system in which `pkg-config` is available in the path,
but OGRE did not install any `.pc` file.

Signed-off-by: Silvio Traversaro <silvio@traversaro.it>
Copy link
Contributor

@iche033 iche033 left a comment

Choose a reason for hiding this comment

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

looks good to me!

traversaro added a commit to iit-danieli-joint-lab/idjl-software-dependencies-vcpkg that referenced this pull request May 4, 2020
On the top of the usual `vcpkg-idjl.zip` archive, this commit also generates the archive `vcpkg-idjl-with-gazebo.zip`,
that is like the usual `vcpkg-idjl.zip` archive, but that also contains a `C:\idjl\gazebo\install` directory in which gazebo 11
and its dependencies are installed.

As Gazebo in this case it is  not installed via vcpkg, it is not possible to find it via the official vcpkg's integration via the
`CMAKE_TOOLCHAIN_FILE`, so also a set of scripts is provided to set for a given terminal (`setup-deps.bat` and `setup-deps.sh`) or
for the system (`addPathsToUserEnvVariables-deps.ps1` and `removePathsFromUserEnvVariables-deps.ps1`) the necessary environment
variables to find the dependencies and run Gazebo.

The specific version of Gazebo installed by the scripts are contained in the gazebo-repos.yaml file. They do refer to specific
commit due to the fact that the Gazebo windows support requires some of the latest fix (some still pending, see gazebosim/gazebo-classic#2719),
but they will be updated to tags once a release will be made including the required tags.
traversaro added a commit to iit-danieli-joint-lab/idjl-software-dependencies-vcpkg that referenced this pull request May 4, 2020
On the top of the usual `vcpkg-idjl.zip` archive, this commit also generates the archive `vcpkg-idjl-with-gazebo.zip`,
that is like the usual `vcpkg-idjl.zip` archive, but that also contains a `C:\idjl\gazebo\install` directory in which gazebo 11
and its dependencies are installed.

As Gazebo in this case it is  not installed via vcpkg, it is not possible to find it via the official vcpkg's integration via the
`CMAKE_TOOLCHAIN_FILE`, so also a set of scripts is provided to set for a given terminal (`setup-deps.bat` and `setup-deps.sh`) or
for the system (`addPathsToUserEnvVariables-deps.ps1` and `removePathsFromUserEnvVariables-deps.ps1`) the necessary environment
variables to find the dependencies and run Gazebo.

The specific version of Gazebo installed by the scripts are contained in the gazebo-repos.yaml file. They do refer to specific
commit due to the fact that the Gazebo windows support requires some of the latest fix (some still pending, see gazebosim/gazebo-classic#2719),
but they will be updated to tags once a release will be made including the required tags.
traversaro added a commit to iit-danieli-joint-lab/idjl-software-dependencies-vcpkg that referenced this pull request May 4, 2020
On the top of the usual `vcpkg-idjl.zip` archive, this commit also generates the archive `vcpkg-idjl-with-gazebo.zip`,
that is like the usual `vcpkg-idjl.zip` archive, but that also contains a `C:\idjl\gazebo\install` directory in which gazebo 11
and its dependencies are installed.

As Gazebo in this case it is  not installed via vcpkg, it is not possible to find it via the official vcpkg's integration via the
`CMAKE_TOOLCHAIN_FILE`, so also a set of scripts is provided to set for a given terminal (`setup-deps.bat` and `setup-deps.sh`) or
for the system (`addPathsToUserEnvVariables-deps.ps1` and `removePathsFromUserEnvVariables-deps.ps1`) the necessary environment
variables to find the dependencies and run Gazebo.

The specific version of Gazebo installed by the scripts are contained in the gazebo-repos.yaml file. They do refer to specific
commit due to the fact that the Gazebo windows support requires some of the latest fix (some still pending, see gazebosim/gazebo-classic#2719),
but they will be updated to tags once a release will be made including the required tags.
traversaro added a commit to iit-danieli-joint-lab/idjl-software-dependencies-vcpkg that referenced this pull request May 4, 2020
On the top of the usual `vcpkg-idjl.zip` archive, this commit also generates the archive `vcpkg-idjl-with-gazebo.zip`,
that is like the usual `vcpkg-idjl.zip` archive, but that also contains a `C:\idjl\gazebo\install` directory in which gazebo 11
and its dependencies are installed.

As Gazebo in this case it is  not installed via vcpkg, it is not possible to find it via the official vcpkg's integration via the
`CMAKE_TOOLCHAIN_FILE`, so also a set of scripts is provided to set for a given terminal (`setup-deps.bat` and `setup-deps.sh`) or
for the system (`addPathsToUserEnvVariables-deps.ps1` and `removePathsFromUserEnvVariables-deps.ps1`) the necessary environment
variables to find the dependencies and run Gazebo.

The specific version of Gazebo installed by the scripts are contained in the gazebo-repos.yaml file. They do refer to specific
commit due to the fact that the Gazebo windows support requires some of the latest fix (some still pending, see gazebosim/gazebo-classic#2719),
but they will be updated to tags once a release will be made including the required tags.
@simonschmeisser
Copy link

Recent versions of OGRE provide a OGREconfig.cmake which should allow using simply find_package(OGRE 1.11 REQUIRED COMPONENTS Bites RTShaderSystem) https://ogrecave.github.io/ogre/api/latest/setup.html

@traversaro
Copy link
Collaborator Author

Recent versions of OGRE provide a OGREconfig.cmake which should allow using simply find_package(OGRE 1.11 REQUIRED COMPONENTS Bites RTShaderSystem) https://ogrecave.github.io/ogre/api/latest/setup.html

The support for using OGREconfig.cmake has been already added in 51c1622.

@traversaro
Copy link
Collaborator Author

Hi @j-rivero , if there is anything I can do to help in getting this merged feel free to let me know, thanks!

@chapulina chapulina merged commit 67c4346 into gazebosim:gazebo11 Sep 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
11 Gazebo 11
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants