Skip to content

Commit

Permalink
Add gz-rendering7 port (#34618)
Browse files Browse the repository at this point in the history
  • Loading branch information
talregev authored Oct 31, 2023
1 parent 9083f6a commit 0e2a0e0
Show file tree
Hide file tree
Showing 8 changed files with 219 additions and 2 deletions.
101 changes: 101 additions & 0 deletions ports/gz-cmake3/dependencies.patch
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,104 @@ index 4eb7a0d..11dae8a 100644
gz_string_append(${component}_CMAKE_DEPENDENCIES "${${PACKAGE_NAME}_find_dependency}" DELIM "\n")
endif()
endforeach()
diff --git a/cmake/FindGzOGRE2.cmake b/cmake/FindGzOGRE2.cmake
--- a/cmake/FindGzOGRE2.cmake
+++ b/cmake/FindGzOGRE2.cmake
@@ -143,11 +143,11 @@
endif ()
endmacro()

find_package(PkgConfig QUIET)
-if (PkgConfig_FOUND)
+if (NOT WIN32)
set(PKG_CONFIG_PATH_ORIGINAL $ENV{PKG_CONFIG_PATH})
- foreach (GZ_OGRE2_PROJECT_NAME "OGRE2" "OGRE-Next")
+ foreach (GZ_OGRE2_PROJECT_NAME "OGRE")
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}")
# For OGRE 2.3 debs built via OpenRobotics buildfarms, we use OgreNext
@@ -159,10 +159,10 @@
set(OGRE2LIBNAME "Ogre")
endif()
else()
# This matches OGRE2.2 debs built in upstream Ubuntu
- set(OGRE2_INSTALL_PATH "OGRE-Next")
- set(OGRE2LIBNAME "OgreNext")
+ set(OGRE2_INSTALL_PATH "OGRE")
+ set(OGRE2LIBNAME "Ogre")
endif()

# Note: OGRE2 installed from debs is named OGRE-2.2 while the version
# installed from source does not have the 2.2 suffix
@@ -172,8 +172,9 @@
if (${GZ_OGRE2_PROJECT_NAME}_FOUND)
set(GZ_PKG_NAME ${OGRE2_INSTALL_PATH})
set(OGRE2_FOUND ${${GZ_OGRE2_PROJECT_NAME}_FOUND}) # sync possible OGRE-Next to OGRE2
fix_pkgconfig_prefix_jammy_bug("${${GZ_OGRE2_PROJECT_NAME}_LIBRARY_DIRS}" OGRE2_LIBRARY_DIRS)
+ set(OGRE2_LIBRARY_DIRS ${${GZ_OGRE2_PROJECT_NAME}_LIBRARY_DIRS})
set(OGRE2_LIBRARIES ${${GZ_OGRE2_PROJECT_NAME}_LIBRARIES}) # sync possible Ogre-Next ot OGRE2
else()
# look for OGRE2 installed from source
set(PKG_CONFIG_PATH_TMP ${PKG_CONFIG_PATH_ORIGINAL})
@@ -308,8 +309,10 @@
"${OGRE2LIBNAME}${component}_d.${OGRE2_VERSION}"
"${OGRE2LIBNAME}${component}_d"
"${OGRE2LIBNAME}${component}.${OGRE2_VERSION}"
"${OGRE2LIBNAME}${component}"
+ "${OGRE2LIBNAME}${component}Static"
+ "${OGRE2LIBNAME}${component}Static_d"
HINTS ${OGRE2_LIBRARY_DIRS})
if (NOT "${OGRE2-${component}}" STREQUAL "OGRE2-${component}-NOTFOUND")
message(STATUS " + component ${component}: found")
# create a new target for each component
@@ -403,15 +406,24 @@
set(OGRE2_SEARCH_VER "OGRE-${GzOGRE2_FIND_VERSION_MAJOR}.${GzOGRE2_FIND_VERSION_MINOR}")
set(OGRE2_PATHS "")
set(OGRE2_INC_PATHS "")
foreach(_rootPath ${VCPKG_CMAKE_FIND_ROOT_PATH})
- list(APPEND OGRE2_PATHS "${_rootPath}/lib/${OGRE2_SEARCH_VER}/")
- list(APPEND OGRE2_PATHS "${_rootPath}/lib/${OGRE2_SEARCH_VER}/manual-link/")
- list(APPEND OGRE2_INC_PATHS "${_rootPath}/include/${OGRE2_SEARCH_VER}")
+ get_filename_component(debug_dir "${_rootPath}" NAME)
+ if(debug_dir MATCHES "debug" AND CMAKE_BUILD_TYPE MATCHES Debug OR NOT debug_dir MATCHES "debug" AND CMAKE_BUILD_TYPE MATCHES Release)
+ list(APPEND OGRE2_PATHS "${_rootPath}/lib/")
+ list(APPEND OGRE2_PATHS "${_rootPath}/lib/manual-link/")
+ endif()
+ list(APPEND OGRE2_INC_PATHS "${_rootPath}/include/OGRE")
endforeach()

+ if(CMAKE_BUILD_TYPE MATCHES Debug)
+ set(OGRE_MAIN_LIB "OgreMain_d")
+ else()
+ set(OGRE_MAIN_LIB "OgreMain")
+ endif()
+
find_library(OGRE2_LIBRARY
- NAMES "OgreMain"
+ NAMES "${OGRE_MAIN_LIB}"
HINTS ${OGRE2_PATHS}
NO_DEFAULT_PATH)

find_path(OGRE2_INCLUDE
@@ -509,8 +521,9 @@

ogre_find_plugin(Plugin_ParticleFX OgreParticleFXPrerequisites.h PlugIns/ParticleFX/include)
ogre_find_plugin(RenderSystem_GL3Plus OgreGL3PlusRenderSystem.h RenderSystems/GL3Plus/include)
ogre_find_plugin(RenderSystem_Direct3D11 OgreD3D11RenderSystem.h RenderSystems/Direct3D11/include)
+ ogre_find_component(PlanarReflections OgrePlanarReflections.h PlanarReflections)

foreach(component ${GzOGRE2_FIND_COMPONENTS})
set(PREFIX OGRE2_${component})
if(${PREFIX}_FOUND)
@@ -520,9 +533,9 @@
string(FIND ${component} "Hlms" HLMS_POS)
if(${HLMS_POS} GREATER -1)
foreach (dir ${OGRE2_INCLUDE_DIRS})
get_filename_component(dir_name "${dir}" NAME)
- if ("${dir_name}" STREQUAL "OGRE-${OGRE2_VERSION_MAJOR}.${OGRE2_VERSION_MINOR}")
+ if ("${dir_name}" STREQUAL "OGRE")
set(dir_include "${dir}/Hlms/Common")
if (EXISTS ${dir_include})
list(APPEND component_INCLUDE_DIRS ${dir_include})
endif()
2 changes: 1 addition & 1 deletion ports/gz-cmake3/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gz-cmake3",
"version": "3.4.1",
"port-version": 2,
"port-version": 3,
"description": "CMake helper functions for building robotic applications",
"homepage": "https://ignitionrobotics.org/libs/cmake",
"license": null,
Expand Down
47 changes: 47 additions & 0 deletions ports/gz-rendering7/fix-dependencies.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -65,12 +65,12 @@

if (APPLE)
gz_find_package(OpenGL
REQUIRED_BY ogre ogre2
- PKGCONFIG gl)
+ PKGCONFIG opengl)
else()
gz_find_package(OpenGL REQUIRED
COMPONENTS OpenGL
OPTIONAL_COMPONENTS EGL
REQUIRED_BY ogre ogre2
- PKGCONFIG gl)
+ PKGCONFIG opengl)
endif()
@@ -81,5 +81,6 @@

#--------------------------------------
# Find OGRE
+if(0)
list(APPEND gz_ogre_components "RTShaderSystem" "Terrain" "Overlay" "Paging")

@@ -97,5 +98,6 @@
"The software might compile and even work but support from upstream"
"could be reduced to accepting patches for newer versions")
endif()
endif()
+endif()

diff --git a/ogre2/src/terrain/Terra/CMakeLists.txt b/ogre2/src/terrain/Terra/CMakeLists.txt
--- a/ogre2/src/terrain/Terra/CMakeLists.txt
+++ b/ogre2/src/terrain/Terra/CMakeLists.txt
@@ -34,8 +34,10 @@
# we must add this one manually for this to build correctly
${OGRE2_INCLUDE}/Hlms/Pbs
${OGRE2_INCLUDE}/Hlms/Common
PUBLIC
- ${CMAKE_CURRENT_LIST_DIR}/include
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>
+ $<INSTALL_INTERFACE:include>
)

target_link_libraries(${PROJECT_NAME} PRIVATE GzOGRE2::GzOGRE2)
+install(TARGETS ${PROJECT_NAME} EXPORT gz-rendering7-ogre2)
25 changes: 25 additions & 0 deletions ports/gz-rendering7/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
set(PACKAGE_NAME rendering)

ignition_modular_library(
NAME ${PACKAGE_NAME}
REF ${PORT}_${VERSION}
VERSION ${VERSION}
SHA512 7c14b268694600b8529fef21130b34f516b26baac771c019b4248a67f84420c40d655e0abedf0b36c53b7cdf19941b3f4f3494696c831a83070632d004b30678
OPTIONS
PATCHES
fix-dependencies.patch
)

if(VCPKG_TARGET_IS_WINDOWS)
file(GLOB plugins "${CURRENT_PACKAGES_DIR}/lib/gz-rendering-7/engine-plugins/*.dll")
if (NOT plugins STREQUAL "")
file(COPY ${plugins} DESTINATION "${CURRENT_PACKAGES_DIR}/bin/engine-plugins/")
file(REMOVE ${plugins})
endif()

file(GLOB plugins_debug "${CURRENT_PACKAGES_DIR}/debug/lib/gz-rendering-7/engine-plugins/*.dll")
if (NOT plugins_debug STREQUAL "")
file(COPY ${plugins_debug} DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin/engine-plugins/")
file(REMOVE ${plugins_debug})
endif()
endif()
26 changes: 26 additions & 0 deletions ports/gz-rendering7/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "gz-rendering7",
"version": "7.4.1",
"description": "Gazebo Rendering is a C++ library designed to provide an abstraction for different rendering engines. It offers unified APIs for creating 3D graphics applications.",
"homepage": "https://gazebosim.org/libs/rendering",
"license": "Apache-2.0",
"dependencies": [
"freeimage",
"gz-cmake3",
"gz-common5",
"gz-math7",
"gz-plugin2",
"gz-utils2",
{
"name": "ignition-modularscripts",
"host": true
},
{
"name": "ogre-next",
"features": [
"planar-reflections"
]
},
"opengl"
]
}
6 changes: 5 additions & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -3170,7 +3170,7 @@
},
"gz-cmake3": {
"baseline": "3.4.1",
"port-version": 2
"port-version": 3
},
"gz-common5": {
"baseline": "5.4.1",
Expand All @@ -3196,6 +3196,10 @@
"baseline": "2.0.1",
"port-version": 0
},
"gz-rendering7": {
"baseline": "7.4.1",
"port-version": 0
},
"gz-tools2": {
"baseline": "2.0.0",
"port-version": 1
Expand Down
5 changes: 5 additions & 0 deletions versions/g-/gz-cmake3.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "5ac0952f283b1e4a700a12c0d616066b36fdeff2",
"version": "3.4.1",
"port-version": 3
},
{
"git-tree": "f0b0d35ac8f99280de71a64494d8597f09986362",
"version": "3.4.1",
Expand Down
9 changes: 9 additions & 0 deletions versions/g-/gz-rendering7.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "5fa361453bcae9a0e8acee956057e9436f8d1377",
"version": "7.4.1",
"port-version": 0
}
]
}

0 comments on commit 0e2a0e0

Please sign in to comment.