-
Notifications
You must be signed in to change notification settings - Fork 35
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
Integrate Ogre-Next 3.x.x built from source #468
base: gz-cmake4
Are you sure you want to change the base?
Conversation
Signed-off-by: Ramir Sultanov <[email protected]>
Signed-off-by: Ramir Sultanov <[email protected]>
As it is related to #457, should I try to merge PS. Sorry for the commits related to a typo and obsolete documetation. For some strange reason I didn't notice it when I was reviewing my code. |
Signed-off-by: Ramir Sultanov <[email protected]>
Signed-off-by: Ramir Sultanov <[email protected]>
As mentioned in #457 (comment) since OgreNext 3.0 it should be sufficient to just call |
Thanks @sumir0 for the PR ! The support for OGRE-3.x and gazebosim/gz-sim#2753 is really cool.
This is indeed a good idea. Even better would be that we can use the the CMake Module shipped directly by upstream as @traversaro mentioned. If you could give it a try, would be great.
No worries! |
I checked Output with OGRE (classic) installed alongside: -- Looking for OGRE...
-- OGRE_PREFIX_WATCH changed.
-- Found PkgConfig: /usr/bin/pkg-config (found version "2.3.0")
-- Checking for module 'OGRE-Next'
-- Package 'OGRE-Next' not found
-- Checking for module 'OGRE'
-- Found OGRE, version 14.3.2
-- Found Ogre (..)
-- Found OGRE: optimized;/usr/lib/libOgreMain.so;debug;/usr/local/lib/libOgreMain_d.so
-- Looking for OGRE_Paging...
-- Found OGRE_Paging: optimized;/usr/lib/libOgrePaging.so;debug;/usr/lib/libOgrePaging.so
-- Looking for OGRE_Terrain...
-- Found OGRE_Terrain: optimized;/usr/lib/libOgreTerrain.so;debug;/usr/lib/libOgreTerrain.so
-- Looking for OGRE_Property...
-- Found OGRE_Property: optimized;/usr/lib/libOgreProperty.so;debug;/usr/lib/libOgreProperty.so
-- Looking for OGRE_Volume...
-- Found OGRE_Volume: optimized;/usr/lib/libOgreVolume.so;debug;/usr/lib/libOgreVolume.so
-- Looking for OGRE_Overlay...
-- Found OGRE_Overlay: optimized;/usr/lib/libOgreOverlay.so;debug;/usr/local/lib/libOgreOverlay_d.so
-- Looking for OGRE_HlmsPbs...
-- Could not locate OGRE_HlmsPbs
-- Looking for OGRE_HlmsUnlit...
-- Could not locate OGRE_HlmsUnlit Output with only OGRE-Next installed (with the Atmosphere component) from source: -- Looking for OGRE...
-- OGRE_PREFIX_WATCH changed.
-- Found PkgConfig: /usr/bin/pkg-config (found version "2.3.0")
-- Checking for module 'OGRE-Next'
-- Package 'OGRE-Next' not found
-- Checking for module 'OGRE'
-- Package 'OGRE' not found
-- Found Ogre Eris (3.0.0)
-- Found OGRE: /usr/local/lib/libOgreMain_d.so
-- Looking for OGRE_Paging...
-- Could not locate OGRE_Paging
-- Looking for OGRE_Terrain...
-- Could not locate OGRE_Terrain
-- Looking for OGRE_Property...
-- Could not locate OGRE_Property
-- Looking for OGRE_Volume...
-- Could not locate OGRE_Volume
-- Looking for OGRE_Overlay...
-- Found OGRE_Overlay: /usr/local/lib/libOgreOverlay_d.so
-- Looking for OGRE_HlmsPbs...
-- Found OGRE_HlmsPbs: /usr/local/lib/libOgreHlmsPbs_d.so
-- Looking for OGRE_HlmsUnlit...
-- Found OGRE_HlmsUnlit: /usr/local/lib/libOgreHlmsUnlit_d.so Thank you to all of you! I will convert this PR to draft for now. I will think about possibility of contributing to OGRE-Next, because I need the Atmosphere component for gazebosim/gz-sim#2753. Feel free to comment, any (good) advice would be appreciated. |
Signed-off-by: Ramir Sultanov <[email protected]>
Summary of my investigation/thinking/review:
|
Added more than one example because they can be used in case we will need automated tests for |
Is the chosen branch correct one to merge into or should I change it? |
Don't know if it was good or bad to sync the fork. Let me know if it was a bad decision. |
Just to clarify, my suggestion is to use |
Sorry, I realized I was missing a point. Is there any problem on just requiring that OgreNext is compiled by enabling the option |
It's no trouble!
Unfortunately, even in that case Take a note of what set(OGRE_PREFIX_GUESSES
/opt/ogre-next
/opt/OGRE-Next
/usr/lib${LIB_SUFFIX}/ogre-next
/usr/lib${LIB_SUFFIX}/OGRE-Next
/usr/local/lib${LIB_SUFFIX}/ogre-next
/usr/local/lib${LIB_SUFFIX}/OGRE-Next
$ENV{HOME}/ogre-next
$ENV{HOME}/OGRE-Next
/opt/ogre
/opt/OGRE
/usr/lib${LIB_SUFFIX}/ogre
/usr/lib${LIB_SUFFIX}/OGRE
/usr/local/lib${LIB_SUFFIX}/ogre
/usr/local/lib${LIB_SUFFIX}/OGRE
$ENV{HOME}/ogre
$ENV{HOME}/OGRE
) Also, take a note of what set(OGRE_PREFIX_PATH
${OGRE_HOME} ${OGRE_SDK} ${ENV_OGRE_HOME} ${ENV_OGRE_SDK}
${OGRE_PREFIX_GUESSES}
) This is the macro used to create paths which will be searched later. In the # Construct search paths for includes and libraries from a PREFIX_PATH
macro(create_search_paths PREFIX)
foreach(dir ${${PREFIX}_PREFIX_PATH})
set(${PREFIX}_INC_SEARCH_PATH ${${PREFIX}_INC_SEARCH_PATH}
${dir}/include ${dir}/Include ${dir}/include/${PREFIX} ${dir}/Headers)
set(${PREFIX}_LIB_SEARCH_PATH ${${PREFIX}_LIB_SEARCH_PATH}
${dir}/lib ${dir}/Lib ${dir}/lib/${PREFIX} ${dir}/Libs)
set(${PREFIX}_BIN_SEARCH_PATH ${${PREFIX}_BIN_SEARCH_PATH}
${dir}/bin)
endforeach(dir)
if(ANDROID)
set(${PREFIX}_LIB_SEARCH_PATH ${${PREFIX}_LIB_SEARCH_PATH} ${OGRE_DEPENDENCIES_DIR}/lib/${ANDROID_ABI})
endif()
set(${PREFIX}_FRAMEWORK_SEARCH_PATH ${${PREFIX}_PREFIX_PATH})
endmacro(create_search_paths) Later on, the include paths are searched as follows. find_path(OGRE_CONFIG_INCLUDE_DIR NAMES OgreBuildSettings.h HINTS ${OGRE_INC_SEARCH_PATH} ${OGRE_FRAMEWORK_INCLUDES} ${OGRE_PKGC_INCLUDE_DIRS} PATH_SUFFIXES "OGRE")
find_path(OGRE_INCLUDE_DIR NAMES OgreRoot.h HINTS ${OGRE_CONFIG_INCLUDE_DIR} ${OGRE_INC_SEARCH_PATH} ${OGRE_FRAMEWORK_INCLUDES} ${OGRE_PKGC_INCLUDE_DIRS} PATH_SUFFIXES "OGRE") And the version is determined via # determine Ogre version
file(READ ${OGRE_INCLUDE_DIR}/OgrePrerequisites.h OGRE_TEMP_VERSION_CONTENT)
get_preprocessor_entry(OGRE_TEMP_VERSION_CONTENT OGRE_VERSION_MAJOR OGRE_VERSION_MAJOR)
get_preprocessor_entry(OGRE_TEMP_VERSION_CONTENT OGRE_VERSION_MINOR OGRE_VERSION_MINOR)
get_preprocessor_entry(OGRE_TEMP_VERSION_CONTENT OGRE_VERSION_PATCH OGRE_VERSION_PATCH)
get_preprocessor_entry(OGRE_TEMP_VERSION_CONTENT OGRE_VERSION_NAME OGRE_VERSION_NAME)
set(OGRE_VERSION "${OGRE_VERSION_MAJOR}.${OGRE_VERSION_MINOR}.${OGRE_VERSION_PATCH}")
pkg_message(OGRE "Found Ogre ${OGRE_VERSION_NAME} (${OGRE_VERSION})") So far:
As a consequence, In conclusion, if OGRE-Next built with |
But in that case you should use |
I am sorry, it seems I didn't understand you for some reason. I am not an expert in CMake (yet). Please, tell me if I have understood something wrong. Let
Hence, to There is no mention of Just in case I tested I apologize, I don't understand how it is supposed to work. |
You are perfectly right, I had a distinct memory that |
Nothing to worry about! I believe, here we all just want to make this world better by making code better. |
Thanks @sumir0 for the clarification. So let's continue the review of this implementation. If we are targeting the
Maintaining both Modules is not the ideal solution but if we want to maintain compatibility we can not remove the |
Signed-off-by: Ramir Sultanov <[email protected]>
"OGRE-Next with major version ${GzOGRE2_FIND_VERSION_MAJOR} was requested to be found but OGRE-Next>=3.0.0 versions are not supported by GzOGRE2. Please, use instead GzOGRENext." | ||
) | ||
|
||
if (NOT (DEFINED GzOGRE2_FIND_VERSION_MAJOR AND DEFINED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By using DEFINED
we allow GzOGRE2_FIND_VERSION_MAJOR==0
or GzOGRE2_FIND_VERSION_MINOR==0
to not produce the warning "find_package(GzOGRE2) must be called with a VERSION argument with a minimum of major and minor version"
.
cmake/FindGzOGRE2.cmake
Outdated
if (${VERSION_MAJOR} VERSION_GREATER "2") | ||
message(WARNING ${MESSAGE_STRING}) | ||
message(WARNING | ||
"Keep in mind FindGzOGRE2.cmake will be removed and FindGzOGRENext.cmake will support OGRE-Next 2.x.x versions in the next major release") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have specified the next major release will move FindGzOGRE2.cmake
functionality to FindGzOGRENext.cmake
. But it is, actually, open for discussion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. To avoid migrations for existing consumers of OGRE2 I would vote for maintaining the module as it is and just moving users to the new one under the new name with the expected move of things from 2.x to 3.x series.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion. Though, I don't know if the move from 2.x to 3.x series is planned in the next major release (gz-cmake5). Therefore, probably, I need to change the message to something like: Keep in mind FindGzOGRE2.cmake is planned to be removed and FindGzOGRENext.cmake is planned to support OGRE-Next>=2.0.0 soon
. Or do you mean the move of things from 2.x to 3.x series is, actually, expected (planned) in the next major release (gz-cmake5)?
For now I will change the message. I assume, we are planning to remove FindGzOGRE2.cmake
at some point in time. Sorry, I didn't clearly understand if it is the case.
Please note, even though
|
Memo for the future: |
I think the code is ready for the next iteration of the review. Please ask you questions if you have any. I will try to explain anything that is not clear. |
cmake/FindGzOGRE2.cmake
Outdated
if (${VERSION_MAJOR} VERSION_GREATER "2") | ||
message(WARNING ${MESSAGE_STRING}) | ||
message(WARNING | ||
"Keep in mind FindGzOGRE2.cmake will be removed and FindGzOGRENext.cmake will support OGRE-Next 2.x.x versions in the next major release") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. To avoid migrations for existing consumers of OGRE2 I would vote for maintaining the module as it is and just moving users to the new one under the new name with the expected move of things from 2.x to 3.x series.
cmake/FindGzOGRE2.cmake
Outdated
# check if ogre-next>=3.0.0 was found | ||
check_possible_ogre_next_3_or_later( | ||
OGRE2_VERSION_MAJOR | ||
"OGRE-Next with major version ${OGRE2_VERSION_MAJOR} was found but OGRE-Next>=3.0.0 is not supported by GzOGRE2. Please, use instead GzOGRENext or specify a path to OGRE-Next<3.0.0 via an environment varialbe: PKG_CONFIG_PATH=<path-to-a-directory-containing-a-pkgconfig-file-for-OGRE-Next>." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or specify a path to OGRE-Next<3.0.0 via an environment varialbe: PKG_CONFIG_PATH=."
I think that we can skip this part about pkg-config if it is not related to CMake or gz-cmake.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI gz_cmake-pr-clowin: requires #476 to work correctly.
Please note, even though
cmake/FindGzOGRENext.cmake
is based oncmake/FindGzOGRE2.cmake
it is, however, a reduced version. Essential parts that have been reduced are:
Thanks that is great !
Sorry does not meant to approve it yet although we are close :)
Signed-off-by: Ramir Sultanov <[email protected]>
Signed-off-by: Ramir Sultanov <[email protected]>
cmake/FindGzOGRE2.cmake
Outdated
# for additional details see | ||
# https://github.com/gazebosim/gz-cmake/pull/468#issuecomment-2662882691 | ||
message(WARNING | ||
"Keep in mind FindGzOGRE2.cmake is planned to be removed and FindGzOGRENext.cmake is planned to support OGRE-Next>=2.0.0 soon") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realized we, probably, should warn about the deprecation not only when GzOGRE2 used for OGRE-Next>=3.0.0 but in any case it is used. Therefore, I put this message here for now. But, as always, it is open for discussion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am duplicating the link to #468 (comment) here in case someone will not notice it in the conversation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry but maybe I was not clear with my previous comment on migration path and deprecation. I think that we should not modify the existing behavior for people using FindGzOGRE2
and leave the module without any warning unless users try to use it to get 3.x. The Module will be removed when we consider that look for OGRE 2.x has no longer any sense.
We can drop this warning.
Signed-off-by: Ramir Sultanov <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much @sumir0 for staying until the end.
I've confirmed that it works as expected compiling ogre3 from source. This is ready to go.
🎉 New feature
Related to Integrating Ogre-Next 3.0's atmosphere component
Summary
This PR allows Ogre-Next version>=3.0.0 to be found by using
gz_find_package
(for example:gz_find_package(GzOGRENext VERSION 3)
.The code was tested on OGRE-Next version 2.3.3 (installed via a package manager) and version 3.0.0 (built from source using
-D OGRE_USE_NEW_PROJECT_NAME=ON
) with OGRE (classic) installed alongside.The code is heavily based on the
cmake/FindGzOGRE2.cmake
file and represents a reduced and slightly modified version of that file.Test it
pacman -S pkg-config
in a terminal. For Ubuntu a similar package probably is available.examples/find_ogre_next/README.md
file.Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining
Signed-off-by
messages.