Skip to content

Commit

Permalink
Hardtock target and pkg names in FindXXX files, and ticktock set vars (
Browse files Browse the repository at this point in the history
…#273)

Signed-off-by: methylDragon <[email protected]>
  • Loading branch information
methylDragon committed Jul 9, 2022
1 parent 39bc3f6 commit a3a9b68
Show file tree
Hide file tree
Showing 8 changed files with 101 additions and 89 deletions.
22 changes: 11 additions & 11 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
1. Fix check for missing components in OGRE2. Be more verbose with components
* [Pull request #220](https://github.com/gazebosim/gz-cmake/pull/220)

1. FindIgnOGRE2: exclude ogre versions different than 2.x
1. FindGzOGRE2: exclude ogre versions different than 2.x
* [Pull request #219](https://github.com/gazebosim/gz-cmake/pull/219)
* [Pull request #221](https://github.com/gazebosim/gz-cmake/pull/221)

Expand Down Expand Up @@ -52,7 +52,7 @@
1. Add Ubuntu Jammy CI
* [Pull request #194](https://github.com/gazebosim/gz-cmake/pull/194)

1. FindIgnURDFDOM cmake module
1. FindGzURDFDOM cmake module
* [Pull request #193](https://github.com/gazebosim/gz-cmake/pull/193)

1. Do not modify `CMAKE_FIND_LIBRARY_PREFIXES` and `CMAKE_FIND_LIBRARY_SUFFIXES` on Windows
Expand Down Expand Up @@ -115,7 +115,7 @@
1. Fix cmake message types
* [Pull request #159](https://github.com/gazebosim/gz-cmake/pull/159)

1. Support imported targets in FindIgnOGRE.cmake
1. Support imported targets in FindGzOGRE.cmake
* [Pull request #150](https://github.com/gazebosim/gz-cmake/pull/150)

1. Infrastructure
Expand Down Expand Up @@ -176,10 +176,10 @@
1. Added build-essential and cmake to packages.apt
* [Pull request 130](https://github.com/gazebosim/gz-cmake/pull/130)

1. Fix FindIgnOgre on Windows when not using vcpkg
1. Fix FindGzOgre on Windows when not using vcpkg
* [Pull request 124](https://github.com/gazebosim/gz-cmake/pull/124)

1. FindIgnOGRE2: prefer versioned component libraries
1. FindGzOGRE2: prefer versioned component libraries
* [Pull request 125](https://github.com/gazebosim/gz-cmake/pull/125)

1. Correct CMake logic and update cpplint to Python3
Expand Down Expand Up @@ -209,7 +209,7 @@
1. Fix use of FindYAML.cmake and FindJSONCPP without pkg-config
* [Pull request 79](https://github.com/gazebosim/gz-cmake/pull/79)

1. Fix use of FindIgnOGRE2 on Windows if OGRE2 is not found
1. Fix use of FindGzOGRE2 on Windows if OGRE2 is not found
* [Pull request 94](https://github.com/gazebosim/gz-cmake/pull/94)
* Thanks to Silvio Traversaro

Expand Down Expand Up @@ -243,14 +243,14 @@
1. Set viewport for doxygen pages.
* [BitBucket pull request 167](https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-cmake/pull-requests/167)

1. Use upstream `CURL::libcurl` imported target in FindIgnCURL.cmake if available.
1. Use upstream `CURL::libcurl` imported target in FindGzCURL.cmake if available.
* [BitBucket pull request 175](https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-cmake/pull-requests/175)

1. Avoid hardcoding /machine:x64 flag on 64-bit on MSVC.
* [BitBucket pull request 171](https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-cmake/pull-requests/171)
* [BitBucket pull request 168](https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-cmake/pull-requests/168)

1. FindIgnOGRE2: fix include paths for new directory structure.
1. FindGzOGRE2: fix include paths for new directory structure.
* [BitBucket pull request 170](https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-cmake/pull-requests/170)
* [BitBucket pull request 157](https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-cmake/pull-requests/157)

Expand All @@ -261,7 +261,7 @@
1. IgnConfigureBuild: only `add_subdirectory(test)` if `BUILD_TESTING` is ON
* [BitBucket pull request 169](https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-cmake/pull-requests/169)

1. Add FindIgnBullet cmake module.
1. Add FindGzBullet cmake module.
* [BitBucket pull request 162](https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-cmake/pull-requests/162)

### Gazebo CMake 2.1.1 (2019-08-07)
Expand Down Expand Up @@ -308,7 +308,7 @@
1. Set viewport for doxygen pages.
* [BitBucket pull request 167](https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-cmake/pull-requests/167)

1. Use upstream `CURL::libcurl` imported target in FindIgnCURL.cmake if available.
1. Use upstream `CURL::libcurl` imported target in FindGzCURL.cmake if available.
* [BitBucket pull request 175](https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-cmake/pull-requests/175)

1. Avoid hardcoding /machine:x64 flag on 64-bit on MSVC.
Expand Down Expand Up @@ -339,7 +339,7 @@
1. Set viewport for doxygen pages.
* [BitBucket pull request 167](https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-cmake/pull-requests/167)

1. Use upstream `CURL::libcurl` imported target in FindIgnCURL.cmake if available.
1. Use upstream `CURL::libcurl` imported target in FindGzCURL.cmake if available.
* [BitBucket pull request 175](https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-cmake/pull-requests/175)

1. Avoid hardcoding /machine:x64 flag on 64-bit on MSVC.
Expand Down
10 changes: 6 additions & 4 deletions cmake/FindGzBullet.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@ endif()
# with Bullet, which uses relative paths and may break transitive dependencies.
find_package(Bullet MODULE ${gz_quiet_arg})

set(IgnBullet_FOUND false)
set(GzBullet_FOUND false)
set(IgnBullet_FOUND false) # TODO(CH3): Deprecated. Remove on tock.
# create Bullet target
if(BULLET_FOUND)
set(IgnBullet_FOUND true)
set(GzBullet_FOUND true)
set(IgnBullet_FOUND true) # TODO(CH3): Deprecated. Remove on tock.

gz_import_target(IgnBullet
TARGET_NAME IgnBullet::IgnBullet
gz_import_target(GzBullet
TARGET_NAME GzBullet::GzBullet
LIB_VAR BULLET_LIBRARIES
INCLUDE_VAR BULLET_INCLUDE_DIRS
)
Expand Down
26 changes: 16 additions & 10 deletions cmake/FindGzCURL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,34 @@
#
# Usage of this module as follows:
#
# find_package(IgnCURL)
# find_package(GzCURL)
#
# Variables defined by this module:
#
# curl::curl Imported target for libcurl
#
# IgnCURL_FOUND System has CURL libs/headers
# IgnCURL_INCLUDE_DIRS The location of CURL headers
# IgnCURL_LIBRARIES The CURL libraries
# IgnCURL_VERSION The version of CURL found
# GzCURL_FOUND System has CURL libs/headers
# GzCURL_INCLUDE_DIRS The location of CURL headers
# GzCURL_LIBRARIES The CURL libraries
# GzCURL_VERSION The version of CURL found

set(gz_quiet_arg)
if(IgnCURL_FIND_QUIETLY)
if(GzCURL_FIND_QUIETLY)
set(gz_quiet_arg QUIET)
endif()

find_package(CURL ${IgnCURL_FIND_VERSION} ${gz_quiet_arg})
find_package(CURL ${GzCURL_FIND_VERSION} ${gz_quiet_arg})

set(IgnCURL_FOUND ${CURL_FOUND})
set(GzCURL_FOUND ${CURL_FOUND})
set(IgnCURL_FOUND ${CURL_FOUND}) # TODO(CH3): Deprecated. Remove on tock.

if(${IgnCURL_FOUND})
if(${GzCURL_FOUND})

set(GzCURL_INCLUDE_DIRS ${CURL_INCLUDE_DIRS})
set(GzCURL_LIBRARIES ${CURL_LIBRARIES})
set(GzCURL_VERSION ${CURL_VERSION_STRING})

# TODO(CH3): Deprecated. Remove on tock.
set(IgnCURL_INCLUDE_DIRS ${CURL_INCLUDE_DIRS})
set(IgnCURL_LIBRARIES ${CURL_LIBRARIES})
set(IgnCURL_VERSION ${CURL_VERSION_STRING})
Expand All @@ -61,6 +67,6 @@ if(${IgnCURL_FOUND})
endif()

include(IgnPkgConfig)
gz_pkg_config_entry(IgnCURL "libcurl >= ${IgnCURL_FIND_VERSION}")
gz_pkg_config_entry(GzCURL "libcurl >= ${GzCURL_FIND_VERSION}")

endif()
36 changes: 19 additions & 17 deletions cmake/FindGzOGRE.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#
# Usage of this module as follows:
#
# gz_find_package(IgnOGRE)
# gz_find_package(GzOGRE)
#
# Variables defined by this module:
#
Expand All @@ -32,7 +32,7 @@
# OGRE_VERSION_MINOR OGRE minor version
# OGRE_VERSION_PATCH OGRE patch version
# OGRE_RESOURCE_PATH Path to ogre plugins directory
# IgnOGRE::IgnOGRE Imported target for OGRE
# GzOGRE::GzOGRE Imported target for OGRE
#
# On Windows, we assume that all the OGRE* defines are passed in manually
# to CMake.
Expand All @@ -41,13 +41,13 @@
#
# Example usage:
#
# gz_find_package(IgnOGRE
# gz_find_package(GzOGRE
# VERSION 1.8.0
# COMPONENTS RTShaderSystem Terrain Overlay)

# Grab the version numbers requested by the call to find_package(~)
set(major_version ${IgnOGRE_FIND_VERSION_MAJOR})
set(minor_version ${IgnOGRE_FIND_VERSION_MINOR})
set(major_version ${GzOGRE_FIND_VERSION_MAJOR})
set(minor_version ${GzOGRE_FIND_VERSION_MINOR})

# Set the full version number
set(full_version ${major_version}.${minor_version})
Expand Down Expand Up @@ -139,11 +139,11 @@ if (NOT WIN32)
OGRE_VERSION_PATCH ${OGRE_VERSION})

# find ogre components
foreach(component ${IgnOGRE_FIND_COMPONENTS})
gz_pkg_check_modules_quiet(IgnOGRE-${component} "OGRE-${component} >= ${full_version}" NO_CMAKE_ENVIRONMENT_PATH)
if(IgnOGRE-${component}_FOUND)
list(APPEND OGRE_LIBRARIES IgnOGRE-${component}::IgnOGRE-${component})
elseif(IgnOGRE_FIND_REQUIRED_${component})
foreach(component ${GzOGRE_FIND_COMPONENTS})
gz_pkg_check_modules_quiet(GzOGRE-${component} "OGRE-${component} >= ${full_version}" NO_CMAKE_ENVIRONMENT_PATH)
if(GzOGRE-${component}_FOUND)
list(APPEND OGRE_LIBRARIES GzOGRE-${component}::GzOGRE-${component})
elseif(GzOGRE_FIND_REQUIRED_${component})
set(OGRE_FOUND false)
endif()
endforeach()
Expand All @@ -158,7 +158,7 @@ if (NOT WIN32)
set(OGRE_PLUGINDIR ${_pkgconfig_invoke_result})
endif()

gz_pkg_config_library_entry(IgnOGRE OgreMain)
gz_pkg_config_library_entry(GzOGRE OgreMain)

set(OGRE_RESOURCE_PATH ${OGRE_PLUGINDIR})
# Seems that OGRE_PLUGINDIR can end in a newline, which will cause problems
Expand All @@ -171,12 +171,12 @@ if (NOT WIN32)

else()
find_package(OGRE ${full_version}
COMPONENTS ${IgnOGRE_FIND_COMPONENTS})
COMPONENTS ${GzOGRE_FIND_COMPONENTS})
if(OGRE_FOUND)
# OGREConfig.cmake from vcpkg disable the link against plugin libs
# when compiling the shared version of it. Here we copied the code
# to use it.
foreach(ogre_component ${IgnOGRE_FIND_COMPONENTS})
foreach(ogre_component ${GzOGRE_FIND_COMPONENTS})
if(ogre_component MATCHES "Plugin_" OR ogre_component MATCHES "RenderSystem_")
string(LENGTH "${ogre_component}" len)
string(FIND "${ogre_component}" "_" split_pos)
Expand Down Expand Up @@ -239,9 +239,11 @@ else()
endif()
endif()

set(IgnOGRE_FOUND false)
set(GzOGRE_FOUND false)
set(IgnOGRE_FOUND false) # TODO(CH3): Deprecated. Remove on tock.
if(OGRE_FOUND)
set(IgnOGRE_FOUND true)
set(GzOGRE_FOUND true)
set(IgnOGRE_FOUND true) # TODO(CH3): Deprecated. Remove on tock.

# manually search and append the the RenderSystem/GL path to
# OGRE_INCLUDE_DIRS so OGRE GL headers can be found
Expand All @@ -260,8 +262,8 @@ if(OGRE_FOUND)
endforeach()

include(IgnImportTarget)
gz_import_target(IgnOGRE
TARGET_NAME IgnOGRE::IgnOGRE
gz_import_target(GzOGRE
TARGET_NAME GzOGRE::GzOGRE
LIB_VAR OGRE_LIBRARIES
INCLUDE_VAR OGRE_INCLUDE_DIRS)
endif()
42 changes: 22 additions & 20 deletions cmake/FindGzOGRE2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#
# Usage of this module as follows:
#
# gz_find_package(IgnOGRE2)
# gz_find_package(GzOGRE2)
#
# Variables used by this module, they can change the default behaviour and need
# to be set before calling find_package:
Expand All @@ -41,7 +41,7 @@
# OGRE2_VERSION_MINOR OGRE minor version
# OGRE2_VERSION_PATCH OGRE patch version
# OGRE2_RESOURCE_PATH Path to ogre plugins directory
# IgnOGRE2::IgnOGRE2 Imported target for OGRE2
# GzOGRE2::GzOGRE2 Imported target for OGRE2
#
# On Windows, we assume that all the OGRE* defines are passed in manually
# to CMake.
Expand All @@ -51,18 +51,18 @@
#
# Example usage:
#
# gz_find_package(IgnOGRE2
# VERSION 2.2.0
# COMPONENTS HlmsPbs HlmsUnlit Overlay)
# gz_find_package(GzOGRE2
# VERSION 2.2.0
# COMPONENTS HlmsPbs HlmsUnlit Overlay)


# Sanity check: exclude OGRE1 project releasing versions in two ways:
# - Legacy in from using 1.x.y until 1.12.y series
# - Modern versions using X.Y.Z starting with 13.y.z
# Reduce valid versions to 2.x series
if (${IgnOGRE2_FIND_VERSION_MAJOR})
if (${IgnOGRE2_FIND_VERSION_MAJOR} VERSION_LESS "2" OR
${IgnOGRE2_FIND_VERSION_MAJOR} VERSION_GREATER_EQUAL "3")
if (${GzOGRE2_FIND_VERSION_MAJOR})
if (${GzOGRE2_FIND_VERSION_MAJOR} VERSION_LESS "2" OR
${GzOGRE2_FIND_VERSION_MAJOR} VERSION_GREATER_EQUAL "3")
set (OGRE2_FOUND false)
return()
endif()
Expand Down Expand Up @@ -144,7 +144,7 @@ if (NOT WIN32)
foreach (IGN_OGRE2_PROJECT_NAME "OGRE2" "OGRE-Next")
message(STATUS "Looking for OGRE using the name: ${IGN_OGRE2_PROJECT_NAME}")
if (IGN_OGRE2_PROJECT_NAME STREQUAL "OGRE2")
set(OGRE2_INSTALL_PATH "OGRE-2.${IgnOGRE2_FIND_VERSION_MINOR}")
set(OGRE2_INSTALL_PATH "OGRE-2.${GzOGRE2_FIND_VERSION_MINOR}")
set(OGRE2LIBNAME "Ogre")
else()
set(OGRE2_INSTALL_PATH "OGRE-Next")
Expand Down Expand Up @@ -262,7 +262,7 @@ if (NOT WIN32)

# find ogre components
include(IgnImportTarget)
foreach(component ${IgnOGRE2_FIND_COMPONENTS})
foreach(component ${GzOGRE2_FIND_COMPONENTS})
find_library(OGRE2-${component}
NAMES
"${OGRE2LIBNAME}${component}_d.${OGRE2_VERSION}"
Expand All @@ -273,7 +273,7 @@ if (NOT WIN32)
if (NOT "${OGRE2-${component}}" STREQUAL "OGRE2-${component}-NOTFOUND")
message(STATUS " + component ${component}: found")
# create a new target for each component
set(component_TARGET_NAME "IgnOGRE2-${component}::IgnOGRE2-${component}")
set(component_TARGET_NAME "GzOGRE2-${component}::GzOGRE2-${component}")
set(component_INCLUDE_DIRS ${OGRE2_INCLUDE_DIRS})

foreach (dir ${OGRE2_INCLUDE_DIRS})
Expand Down Expand Up @@ -303,7 +303,7 @@ if (NOT WIN32)
# add it to the list of ogre libraries
list(APPEND OGRE2_LIBRARIES ${component_TARGET_NAME})

elseif(IgnOGRE2_FIND_REQUIRED_${component})
elseif(GzOGRE2_FIND_REQUIRED_${component})
message(STATUS " ! component ${component}: not found!")
set(OGRE2_FOUND false)
endif()
Expand Down Expand Up @@ -340,7 +340,7 @@ if (NOT WIN32)
# We need to manually specify the pkgconfig entry (and type of entry),
# because gz_pkg_check_modules does not work for it.
include(IgnPkgConfig)
gz_pkg_config_library_entry(IgnOGRE2 OgreMain)
gz_pkg_config_library_entry(GzOGRE2 OgreMain)
else() #WIN32

set(OGRE2_FOUND TRUE)
Expand All @@ -350,7 +350,7 @@ else() #WIN32
set(OGRE2_VERSION_MINOR "")
set(OGRE2_RESOURCE_PATH "")

set(OGRE2_SEARCH_VER "OGRE-${IgnOGRE2_FIND_VERSION_MAJOR}.${IgnOGRE2_FIND_VERSION_MINOR}")
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})
Expand Down Expand Up @@ -461,10 +461,10 @@ else() #WIN32
ogre_find_plugin(RenderSystem_GL3Plus OgreGL3PlusRenderSystem.h RenderSystems/GL3Plus/include)
ogre_find_plugin(RenderSystem_Direct3D11 OgreD3D11RenderSystem.h RenderSystems/Direct3D11/include)

foreach(component ${IgnOGRE2_FIND_COMPONENTS})
foreach(component ${GzOGRE2_FIND_COMPONENTS})
set(PREFIX OGRE2_${component})
if(${PREFIX}_FOUND)
set(component_TARGET_NAME "IgnOGRE2-${component}::IgnOGRE2-${component}")
set(component_TARGET_NAME "GzOGRE2-${component}::GzOGRE2-${component}")
set(component_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIRS})
# append the Hlms/Common include dir if it exists.
string(FIND ${component} "Hlms" HLMS_POS)
Expand Down Expand Up @@ -500,13 +500,15 @@ else() #WIN32
endif()
endif()

set(IgnOGRE2_FOUND false)
set(GzOGRE2_FOUND false)
set(IgnOGRE2_FOUND false) # TODO(CH3): Deprecated. Remove on tock.
# create OGRE2 target
if (OGRE2_FOUND)
set(IgnOGRE2_FOUND true)
set(GzOGRE2_FOUND true)
set(IgnOGRE2_FOUND false) # TODO(CH3): Deprecated. Remove on tock.

gz_import_target(IgnOGRE2
TARGET_NAME IgnOGRE2::IgnOGRE2
gz_import_target(GzOGRE2
TARGET_NAME GzOGRE2::GzOGRE2
LIB_VAR OGRE2_LIBRARIES
INCLUDE_VAR OGRE2_INCLUDE_DIRS)
endif()
Loading

0 comments on commit a3a9b68

Please sign in to comment.