Skip to content

Commit

Permalink
Changes for OGRE-2.3 (#283)
Browse files Browse the repository at this point in the history
CMake updates to make gz-cmake compatible with OGRE-2.3 debs built by OpenRobotics

Signed-off-by: Michael Carroll <[email protected]>
  • Loading branch information
mjcarroll authored Jul 26, 2022
1 parent 8a437ab commit 4823bd0
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
23 changes: 22 additions & 1 deletion cmake/FindGzOGRE2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,16 @@ if (NOT WIN32)
message(STATUS "Looking for OGRE using the name: ${GZ_OGRE2_PROJECT_NAME}")
if (GZ_OGRE2_PROJECT_NAME STREQUAL "OGRE2")
set(OGRE2_INSTALL_PATH "OGRE-2.${GzOGRE2_FIND_VERSION_MINOR}")
set(OGRE2LIBNAME "Ogre")
# For OGRE 2.3 debs built via OpenRobotics buildfarms, we use OgreNext
# For OGRE 2.3 macOS homebrew builds retain the OGRE name
# For OGRE 2.2 and below retain the OGRE name
if (${GzOGRE2_FIND_VERSION_MINOR} GREATER_EQUAL "3" AND NOT APPLE)
set(OGRE2LIBNAME "OgreNext")
else()
set(OGRE2LIBNAME "Ogre")
endif()
else()
# This matches OGRE2.2 debs built in upstream Ubuntu
set(OGRE2_INSTALL_PATH "OGRE-Next")
set(OGRE2LIBNAME "OgreNext")
endif()
Expand Down Expand Up @@ -300,6 +308,12 @@ if (NOT WIN32)
LIB_VAR component_LIBRARIES
INCLUDE_VAR component_INCLUDE_DIRS)

# Forward the link directories to be used by RPath
set_property(
TARGET ${component_TARGET_NAME}
PROPERTY INTERFACE_LINK_DIRECTORIES
${OGRE2_LIBRARY_DIRS}
)
# add it to the list of ogre libraries
list(APPEND OGRE2_LIBRARIES ${component_TARGET_NAME})

Expand Down Expand Up @@ -509,6 +523,13 @@ if (OGRE2_FOUND)
TARGET_NAME GzOGRE2::GzOGRE2
LIB_VAR OGRE2_LIBRARIES
INCLUDE_VAR OGRE2_INCLUDE_DIRS)

# Forward the link directories to be used by RPath
set_property(
TARGET GzOGRE2::GzOGRE2
PROPERTY INTERFACE_LINK_DIRECTORIES
${OGRE2_LIBRARY_DIRS}
)
endif()

set(IgnOGRE2_FOUND ${GzOGRE2_FOUND}) # TODO(CH3): Deprecated. Remove on tock.
Expand Down
17 changes: 17 additions & 0 deletions examples/find_ogre2/ogre-2.3/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
project(gz-ogre-2.3 VERSION 0.1.0)

find_package(gz-cmake3 REQUIRED)

message(STATUS "Finding OGRE 2.3")

gz_find_package(IgnOGRE2 VERSION 2.3.0)

message(STATUS "OGRE2_FOUND: " ${OGRE2_FOUND})
message(STATUS "OGRE2_LIBRARIES: " ${OGRE2_LIBRARIES})
message(STATUS "OGRE2_INCLUDE_DIRS: " ${OGRE2_INCLUDE_DIRS})
message(STATUS "OGRE2_VERSION: " ${OGRE2_VERSION})
message(STATUS "OGRE2_VERSION_MAJOR: " ${OGRE2_VERSION_MAJOR})
message(STATUS "OGRE2_VERSION_MINOR: " ${OGRE2_VERSION_MINOR})
message(STATUS "OGRE2_VERSION_PATCH: " ${OGRE2_VERSION_PATCH})
message(STATUS "OGRE2_RESOURCE_PATH: " ${OGRE2_RESOURCE_PATH})

0 comments on commit 4823bd0

Please sign in to comment.