Skip to content
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

Find Ogre 2-2 #157

Merged
merged 5 commits into from
Mar 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions cmake/FindIgnOGRE2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
# Example usage:
#
# ign_find_package(IgnOGRE2
# VERSION 2.1.0
# VERSION 2.2.0
# COMPONENTS HlmsPbs HlmsUnlit Overlay)

# sanity check
Expand All @@ -53,6 +53,9 @@ if (${IgnOGRE2_FIND_VERSION_MAJOR})
endif()
endif()

message(STATUS "-- Finding OGRE 2.${IgnOGRE2_FIND_VERSION_MINOR}")
set(OGRE2_INSTALL_PATH "OGRE-2.${IgnOGRE2_FIND_VERSION_MINOR}")

macro(append_library VAR LIB)
if(EXISTS "${LIB}")
list(APPEND ${VAR} ${LIB})
Expand Down Expand Up @@ -92,12 +95,13 @@ endmacro()
if (NOT WIN32)
set(PKG_CONFIG_PATH_ORIGINAL $ENV{PKG_CONFIG_PATH})

# Note: OGRE2 installed from debs is named OGRE-2.1 while the version
# installed from source does not have the 2.1 suffix
# Note: OGRE2 installed from debs is named OGRE-2.2 while the version
# installed from source does not have the 2.2 suffix
# look for OGRE2 installed from debs
ign_pkg_check_modules_quiet(OGRE2 "OGRE-2.1" NO_CMAKE_ENVIRONMENT_PATH QUIET)
ign_pkg_check_modules_quiet(OGRE2 ${OGRE2_INSTALL_PATH} NO_CMAKE_ENVIRONMENT_PATH QUIET)

if (OGRE2_FOUND)
set(IGN_PKG_NAME "OGRE-2.1")
set(IGN_PKG_NAME ${OGRE2_INSTALL_PATH})
else()
# look for OGRE2 installed from source
set(PKG_CONFIG_PATH_TMP ${PKG_CONFIG_PATH_ORIGINAL})
Expand Down
53 changes: 53 additions & 0 deletions examples/find_ogre2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
A quick demonstration of searching for Ogre 2.1 vs 2.2 via ign-cmake.

To test with both versions installed:

## Ogre 2.1

```
cd ogre-2.1
mkdir build
cd build
cmake ..
```

### Expected output

```
-- Looking for IgnOGRE2 - found

-- OGRE2_FOUND: TRUE
-- OGRE2_LIBRARIES: /usr/lib/x86_64-linux-gnu/OGRE-2.1/libOgreMain.soIgnOGRE2-HlmsPbs::IgnOGRE2-HlmsPbsIgnOGRE2-HlmsUnlit::IgnOGRE2-HlmsUnlitIgnOGRE2-Overlay::IgnOGRE2-Overlay
-- OGRE2_INCLUDE_DIRS: /usr/include/OGRE-2.1/usr/include/OGRE-2.1/RenderSystems/GL3Plus
-- OGRE2_VERSION: 2.1.0
-- OGRE2_VERSION_MAJOR: 2
-- OGRE2_VERSION_MINOR: 1
-- OGRE2_VERSION_PATCH: 0
-- OGRE2_RESOURCE_PATH: /usr/lib/x86_64-linux-gnu/OGRE-2.1/OGRE
```

## Ogre 2.2

```
cd ogre-2.2
mkdir build
cd build
cmake ..
```

### Expected output


```
-- Looking for IgnOGRE2 - found

-- OGRE2_FOUND: TRUE
-- OGRE2_LIBRARIES: /usr/lib/x86_64-linux-gnu/OGRE-2.2/libOgreMain.soIgnOGRE2-HlmsPbs::IgnOGRE2-HlmsPbsIgnOGRE2-HlmsUnlit::IgnOGRE2-HlmsUnlitIgnOGRE2-Overlay::IgnOGRE2-Overlay
-- OGRE2_INCLUDE_DIRS: /usr/include/OGRE-2.2/usr/include/OGRE-2.2/RenderSystems/GL3Plus
-- OGRE2_VERSION: 2.2.6
-- OGRE2_VERSION_MAJOR: 2
-- OGRE2_VERSION_MINOR: 2
-- OGRE2_VERSION_PATCH: 6
-- OGRE2_RESOURCE_PATH: /usr/lib/x86_64-linux-gnu/OGRE-2.2/OGRE
```

18 changes: 18 additions & 0 deletions examples/find_ogre2/ogre-2.1/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
project(ignition-ogre-2.1 VERSION 0.1.0)

find_package(ignition-cmake2 REQUIRED)

message(STATUS "Finding OGRE 2.1")

ign_find_package(IgnOGRE2 VERSION 2.1.0
COMPONENTS HlmsPbs HlmsUnlit Overlay)

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})
18 changes: 18 additions & 0 deletions examples/find_ogre2/ogre-2.2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
project(ignition-ogre-2.2 VERSION 0.1.0)

find_package(ignition-cmake2 REQUIRED)

message(STATUS "Finding OGRE 2.2")

ign_find_package(IgnOGRE2 VERSION 2.2.0
COMPONENTS HlmsPbs HlmsUnlit Overlay)

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})