Skip to content

Commit 2520ea6

Browse files
authored
Add RVIZ_OGRE_VENDOR_MANGLE_NAME_OF_LIBRARIES_USED_BY_RVIZ option to further mangle ogre libraries used by rviz (#1493)
1 parent e63f0df commit 2520ea6

File tree

3 files changed

+74
-6
lines changed

3 files changed

+74
-6
lines changed

rviz_ogre_vendor/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ project(rviz_ogre_vendor)
44
find_package(ament_cmake REQUIRED)
55
find_package(ament_cmake_vendor_package REQUIRED)
66

7+
option(RVIZ_OGRE_VENDOR_MANGLE_NAME_OF_LIBRARIES_USED_BY_RVIZ "If enabled, append a unique name to OgreMain, OgreOverlay and OgreGLSupport." FALSE)
8+
79
if(WIN32)
810
set(FREETYPE_C_FLAGS "${CMAKE_C_FLAGS}")
911
if(MSVC)
@@ -104,6 +106,7 @@ ament_vendor(ogre_vendor
104106
-DOGRE_BUILD_RENDERSYSTEM_D3D11:BOOL=OFF
105107
-DOGRE_BUILD_RENDERSYSTEM_D3D9:BOOL=OFF
106108
-DCMAKE_POLICY_DEFAULT_CMP0074=NEW
109+
-DOGRE_MANGLE_NAME_OF_LIBRARIES_USED_BY_RVIZ:BOOL=${RVIZ_OGRE_VENDOR_MANGLE_NAME_OF_LIBRARIES_USED_BY_RVIZ}
107110
"-DCMAKE_CXX_FLAGS=${OGRE_CXX_FLAGS}"
108111
${OGRE_CMAKE_ARGS}
109112
PATCHES patches
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
diff --git a/CMakeLists.txt b/CMakeLists.txt
2+
index f4d8fd4aa..286b80366 100644
3+
--- a/CMakeLists.txt
4+
+++ b/CMakeLists.txt
5+
@@ -404,6 +404,8 @@ if (MSVC OR CMAKE_GENERATOR MATCHES Xcode)
6+
option(OGRE_PROJECT_FOLDERS "Organize project into project folders." TRUE)
7+
endif ()
8+
9+
+option(OGRE_MANGLE_NAME_OF_LIBRARIES_USED_BY_RVIZ "If enabled, append a unique name to OgreMain, OgreOverlay and OgreGLSupport." FALSE)
10+
+
11+
# hide advanced options
12+
mark_as_advanced(
13+
OGRE_BUILD_RTSHADERSYSTEM_CORE_SHADERS
14+
diff --git a/Components/Overlay/CMakeLists.txt b/Components/Overlay/CMakeLists.txt
15+
index 64a2a4ed7..014e1a8a7 100644
16+
--- a/Components/Overlay/CMakeLists.txt
17+
+++ b/Components/Overlay/CMakeLists.txt
18+
@@ -71,6 +71,10 @@ if(OGRE_BUILD_COMPONENT_OVERLAY_IMGUI)
19+
${IMGUI_DIR}/imconfig.h)
20+
endif()
21+
22+
+if(OGRE_MANGLE_NAME_OF_LIBRARIES_USED_BY_RVIZ)
23+
+ set_target_properties(OgreOverlay PROPERTIES OUTPUT_NAME OgreOverlay_rviz)
24+
+endif()
25+
+
26+
generate_export_header(OgreOverlay
27+
EXPORT_MACRO_NAME _OgreOverlayExport
28+
EXPORT_FILE_NAME ${PROJECT_BINARY_DIR}/include/OgreOverlayPrerequisites.h)
29+
diff --git a/OgreMain/CMakeLists.txt b/OgreMain/CMakeLists.txt
30+
index 918f102ed..631a0225a 100644
31+
--- a/OgreMain/CMakeLists.txt
32+
+++ b/OgreMain/CMakeLists.txt
33+
@@ -248,6 +248,11 @@ if (APPLE)
34+
set_target_properties(OgreMain PROPERTIES OUTPUT_NAME Ogre)
35+
endif()
36+
endif ()
37+
+
38+
+if(OGRE_MANGLE_NAME_OF_LIBRARIES_USED_BY_RVIZ)
39+
+ set_target_properties(OgreMain PROPERTIES OUTPUT_NAME OgreMain_rviz)
40+
+endif()
41+
+
42+
target_link_libraries(OgreMain PUBLIC ${PLATFORM_LIBS} PRIVATE ${LIBRARIES} ${CMAKE_DL_LIBS})
43+
44+
# specify a precompiled header to use
45+
diff --git a/RenderSystems/GLSupport/CMakeLists.txt b/RenderSystems/GLSupport/CMakeLists.txt
46+
index 31c750729..e455d75ea 100644
47+
--- a/RenderSystems/GLSupport/CMakeLists.txt
48+
+++ b/RenderSystems/GLSupport/CMakeLists.txt
49+
@@ -112,6 +112,10 @@ target_include_directories(OgreGLSupport PUBLIC
50+
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/GLSL>"
51+
PRIVATE "$<BUILD_INTERFACE:${NATIVE_INCLUDES}>")
52+
53+
+if(OGRE_MANGLE_NAME_OF_LIBRARIES_USED_BY_RVIZ)
54+
+ set_target_properties(OgreGLSupport PROPERTIES OUTPUT_NAME OgreGLSupport_rviz)
55+
+endif()
56+
+
57+
set_property(TARGET OgreGLSupport PROPERTY POSITION_INDEPENDENT_CODE ON)
58+
generate_export_header(OgreGLSupport
59+
EXPORT_MACRO_NAME _OgreGLExport

rviz_ogre_vendor/rviz_ogre_vendor-extras.cmake.in

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,18 @@ message(STATUS "OGRE_PLUGIN_DIR: ${OGRE_PLUGIN_DIR}")
2323
list(APPEND OGRE_LIBRARIES ${OGRE_PLUGINS})
2424
list(APPEND OGRE_LIBRARY_DIRS ${OGRE_PLUGIN_DIR})
2525

26+
if(@RVIZ_OGRE_VENDOR_MANGLE_NAME_OF_LIBRARIES_USED_BY_RVIZ@)
27+
set(LIBRARY_MANGLING_SUFFIX "_rviz")
28+
else()
29+
set(LIBRARY_MANGLING_SUFFIX "")
30+
endif()
31+
2632
foreach(_lib IN LISTS OGRE_LIBRARIES)
2733
# Remove debug suffix from library name for matching
2834
string(REPLACE "_d" "" _lib ${_lib})
2935

3036
if("OgreMainStatic" STREQUAL ${_lib} OR "OgreMain" STREQUAL ${_lib})
31-
find_library(_ogre_main_static_library_abs ${_lib}
37+
find_library(_ogre_main_static_library_abs ${_lib}${LIBRARY_MANGLING_SUFFIX}
3238
PATHS
3339
${OGRE_LIBRARY_DIRS}
3440
NO_DEFAULT_PATH
@@ -38,7 +44,7 @@ foreach(_lib IN LISTS OGRE_LIBRARIES)
3844
NO_CMAKE_SYSTEM_PATH
3945
NO_CMAKE_FIND_ROOT_PATH
4046
)
41-
find_library(_ogre_main_static_library_debug_abs ${_lib}_d
47+
find_library(_ogre_main_static_library_debug_abs ${_lib}${LIBRARY_MANGLING_SUFFIX}_d
4248
PATHS
4349
${OGRE_LIBRARY_DIRS}
4450
NO_DEFAULT_PATH
@@ -133,7 +139,7 @@ foreach(_lib IN LISTS OGRE_LIBRARIES)
133139
)
134140
endif()
135141
if("OgreOverlayStatic" STREQUAL ${_lib} OR "OgreOverlay" STREQUAL ${_lib})
136-
find_library(_ogre_overlay_static_library_abs ${_lib}
142+
find_library(_ogre_overlay_static_library_abs ${_lib}${LIBRARY_MANGLING_SUFFIX}
137143
PATHS
138144
${OGRE_LIBRARY_DIRS}
139145
NO_DEFAULT_PATH
@@ -143,7 +149,7 @@ foreach(_lib IN LISTS OGRE_LIBRARIES)
143149
NO_CMAKE_SYSTEM_PATH
144150
NO_CMAKE_FIND_ROOT_PATH
145151
)
146-
find_library(_ogre_overlay_static_library_debug_abs ${_lib}_d
152+
find_library(_ogre_overlay_static_library_debug_abs ${_lib}${LIBRARY_MANGLING_SUFFIX}_d
147153
PATHS
148154
${OGRE_LIBRARY_DIRS}
149155
NO_DEFAULT_PATH
@@ -185,7 +191,7 @@ foreach(_lib IN LISTS OGRE_LIBRARIES)
185191
)
186192
endif()
187193
if("OgreGLSupportStatic" STREQUAL ${_lib} OR "OgreGLSupport" STREQUAL ${_lib})
188-
find_library(_ogre_gl_support_static_library_abs ${_lib}
194+
find_library(_ogre_gl_support_static_library_abs ${_lib}${LIBRARY_MANGLING_SUFFIX}
189195
PATHS
190196
${OGRE_LIBRARY_DIRS}
191197
NO_DEFAULT_PATH
@@ -195,7 +201,7 @@ foreach(_lib IN LISTS OGRE_LIBRARIES)
195201
NO_CMAKE_SYSTEM_PATH
196202
NO_CMAKE_FIND_ROOT_PATH
197203
)
198-
find_library(_ogre_gl_support_static_library_debug_abs ${_lib}_d
204+
find_library(_ogre_gl_support_static_library_debug_abs ${_lib}${LIBRARY_MANGLING_SUFFIX}_d
199205
PATHS
200206
${OGRE_LIBRARY_DIRS}
201207
NO_DEFAULT_PATH

0 commit comments

Comments
 (0)