Skip to content

Commit

Permalink
Deprecate ign_manual_search, ign_create_packages, ign_create_core_lib…
Browse files Browse the repository at this point in the history
…rary (#255)

Signed-off-by: Louise Poubel <[email protected]>
Signed-off-by: methylDragon <[email protected]>

Co-authored-by: Steve Peters <[email protected]>
Co-authored-by: methylDragon <[email protected]>
  • Loading branch information
3 people authored May 17, 2022
1 parent 14d6398 commit d074a46
Show file tree
Hide file tree
Showing 20 changed files with 82 additions and 48 deletions.
6 changes: 3 additions & 3 deletions cmake/FindAVCODEC.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ ign_pkg_check_modules_quiet(AVCODEC libavcodec)

if(NOT AVCODEC_FOUND)
include(IgnManualSearch)
ign_manual_search(AVCODEC
HEADER_NAMES "libavcodec/avcodec.h"
LIBRARY_NAMES "avcodec")
gz_manual_search(AVCODEC
HEADER_NAMES "libavcodec/avcodec.h"
LIBRARY_NAMES "avcodec")
endif()

include(FindPackageHandleStandardArgs)
Expand Down
6 changes: 3 additions & 3 deletions cmake/FindAVDEVICE.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ ign_pkg_check_modules_quiet(AVDEVICE "libavdevice >= ${av_major}.${av_minor}.${a

if(NOT AVDEVICE_FOUND)
include(IgnManualSearch)
ign_manual_search(AVDEVICE
HEADER_NAMES "libavdevice/avdevice.h"
LIBRARY_NAMES "avdevice")
gz_manual_search(AVDEVICE
HEADER_NAMES "libavdevice/avdevice.h"
LIBRARY_NAMES "avdevice")

# Version check
if(AVDEVICE_FOUND)
Expand Down
6 changes: 3 additions & 3 deletions cmake/FindAVFORMAT.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ ign_pkg_check_modules_quiet(AVFORMAT libavformat)

if(NOT AVFORMAT_FOUND)
include(IgnManualSearch)
ign_manual_search(AVFORMAT
HEADER_NAMES "libavformat/avformat.h"
LIBRARY_NAMES "avformat")
gz_manual_search(AVFORMAT
HEADER_NAMES "libavformat/avformat.h"
LIBRARY_NAMES "avformat")
endif()

include(FindPackageHandleStandardArgs)
Expand Down
6 changes: 3 additions & 3 deletions cmake/FindAVUTIL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ ign_pkg_check_modules_quiet(AVUTIL libavutil)

if(NOT AVUTIL_FOUND)
include(IgnManualSearch)
ign_manual_search(AVUTIL
HEADER_NAMES "libavutil/avutil.h"
LIBRARY_NAMES "avutil")
gz_manual_search(AVUTIL
HEADER_NAMES "libavutil/avutil.h"
LIBRARY_NAMES "avutil")
endif()

include(FindPackageHandleStandardArgs)
Expand Down
6 changes: 3 additions & 3 deletions cmake/FindSWSCALE.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ ign_pkg_check_modules_quiet(SWSCALE libswscale)

if(NOT SWSCALE_FOUND)
include(IgnManualSearch)
ign_manual_search(SWSCALE
HEADER_NAMES "libswscale/swscale.h"
LIBRARY_NAMES "swscale")
gz_manual_search(SWSCALE
HEADER_NAMES "libswscale/swscale.h"
LIBRARY_NAMES "swscale")
endif()

include(FindPackageHandleStandardArgs)
Expand Down
8 changes: 4 additions & 4 deletions cmake/FindUUID.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ if (UNIX)

if(NOT UUID_FOUND)
include(IgnManualSearch)
ign_manual_search(UUID
HEADER_NAMES "uuid.h"
LIBRARY_NAMES "uuid libuuid"
PATH_SUFFIXES "uuid")
gz_manual_search(UUID
HEADER_NAMES "uuid.h"
LIBRARY_NAMES "uuid libuuid"
PATH_SUFFIXES "uuid")
endif()

# The pkg-config or the manual search will place
Expand Down
27 changes: 21 additions & 6 deletions cmake/IgnManualSearch.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.
#
########################################
# ign_manual_search(<package> [INTERFACE]
# gz_manual_search(<package> [INTERFACE]
# [HEADER_NAMES <header_names>]
# [LIBRARY_NAMES <library_names>]
# [TARGET_NAME <target_name>]
Expand Down Expand Up @@ -42,17 +42,32 @@
# PATH_SUFFIXES: Optional. Parameter forwarded to the find_path and find_library calls.
#
macro(ign_manual_search package)
# TODO(chapulina) Enable warnings after all libraries have migrated.
# message(WARNING "ign_manual_search is deprecated, use gz_manual_search instead.")

#------------------------------------
# Define the expected arguments
set(options INTERFACE)
set(oneValueArgs "TARGET_NAME")
set(multiValueArgs "HEADER_NAMES" "LIBRARY_NAMES" "PATH_SUFFIXES")

#------------------------------------
# Parse the arguments
_gz_cmake_parse_arguments(gz_manual_search "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

set(gz_manual_search_skip_parsing true)
gz_manual_search(${PACKAGE_NAME})
endmacro()
macro(gz_manual_search PACKAGE_NAME)

# Deprecated, remove skip parsing logic in version 4
if (NOT gz_manual_search_skip_parsing)
#------------------------------------
# Define the expected arguments
set(options INTERFACE)
set(oneValueArgs "TARGET_NAME")
set(multiValueArgs "HEADER_NAMES" "LIBRARY_NAMES" "PATH_SUFFIXES")

#------------------------------------
# Parse the arguments
_gz_cmake_parse_arguments(gz_manual_search "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
endif()

if(gz_manual_search_INTERFACE)
set(_gz_manual_search_interface_option INTERFACE)
else()
Expand Down
2 changes: 1 addition & 1 deletion cmake/IgnPackaging.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Sets up package information for an ignition library project.
# This function is internal to gz-cmake.
#
# gz_create_package
# gz_create_packages
#
# Creates a package for an ignition library project
#
Expand Down
41 changes: 30 additions & 11 deletions cmake/IgnUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ endmacro()
# current subdirectory if "src/" does not exist. They will be collated into
# library source files <lib_sources_var> and unittest source files <tests_var>.
#
# These output variables can be consumed directly by ign_create_core_library(~),
# These output variables can be consumed directly by gz_create_core_library(~),
# ign_add_component(~), gz_build_tests(~), and ign_build_executables(~).
function(ign_get_libsources_and_unittests lib_sources_var tests_var)
# TODO(chapulina) Enable warnings after all libraries have migrated.
Expand Down Expand Up @@ -851,7 +851,7 @@ endfunction()
# <target_name>
# <pkgconfig_cflags_variable>)
#
# Handles the C++ standard argument for ign_create_core_library(~) and
# Handles the C++ standard argument for gz_create_core_library(~) and
# ign_add_component(~).
#
# NOTE: This is only meant for internal ign-cmake use.
Expand Down Expand Up @@ -897,7 +897,7 @@ macro(_gz_handle_cxx_standard prefix target pkgconfig_cflags)
endmacro()

#################################################
# ign_create_core_library(SOURCES <sources>
# gz_create_core_library(SOURCES <sources>
# [CXX_STANDARD <11|14|17>]
# [PRIVATE_CXX_STANDARD <11|14|17>]
# [INTERFACE_CXX_STANDARD <11|14|17>]
Expand Down Expand Up @@ -941,21 +941,40 @@ endmacro()
# are not allowed to use either of them if you use the CXX_STANDARD argument.
#
function(ign_create_core_library)
# TODO(chapulina) Enable warnings after all libraries have migrated.
# message(WARNING "ign_create_core_library is deprecated, use gz_create_core_library instead.")

#------------------------------------
# Define the expected arguments
set(options INTERFACE)
set(oneValueArgs INCLUDE_SUBDIR LEGACY_PROJECT_PREFIX CXX_STANDARD PRIVATE_CXX_STANDARD INTERFACE_CXX_STANDARD GET_TARGET_NAME)
set(multiValueArgs SOURCES)

#------------------------------------
# Parse the arguments
cmake_parse_arguments(gz_create_core_library "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

set(gz_create_core_library_skip_parsing true)
gz_create_core_library()

if(gz_create_core_library_GET_TARGET_NAME)
set(${gz_create_core_library_GET_TARGET_NAME} ${${gz_create_core_library_GET_TARGET_NAME}} PARENT_SCOPE)
endif()
endfunction()
function(gz_create_core_library)

# Deprecated, remove skip parsing logic in version 4
if (NOT gz_create_core_library_skip_parsing)
#------------------------------------
# Define the expected arguments
set(options INTERFACE)
set(oneValueArgs INCLUDE_SUBDIR LEGACY_PROJECT_PREFIX CXX_STANDARD PRIVATE_CXX_STANDARD INTERFACE_CXX_STANDARD GET_TARGET_NAME)
set(multiValueArgs SOURCES)

#------------------------------------
# Parse the arguments
cmake_parse_arguments(gz_create_core_library "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
endif()

if(gz_create_core_library_SOURCES)
set(sources ${gz_create_core_library_SOURCES})
elseif(NOT gz_create_core_library_INTERFACE)
message(FATAL_ERROR "You must specify SOURCES for ign_create_core_library(~)!")
message(FATAL_ERROR "You must specify SOURCES for gz_create_core_library(~)!")
endif()

if(gz_create_core_library_INTERFACE)
Expand Down Expand Up @@ -1096,7 +1115,7 @@ endfunction()
# with the core library), but the component itself does not need to link to
# the core library.
#
# See the documentation of ign_create_core_library(~) for more information about
# See the documentation of gz_create_core_library(~) for more information about
# specifying the C++ standard. If your component publicly depends on the core
# library, then you probably do not need to specify the standard, because it
# will get inherited from the core library.
Expand Down Expand Up @@ -1342,7 +1361,7 @@ endmacro()

#################################################
# This is only meant for internal use by ignition-cmake. If you are a consumer
# of ignition-cmake, please use ign_create_core_library(~) or
# of ignition-cmake, please use gz_create_core_library(~) or
# ign_add_component(~) instead of this.
#
# _gz_add_library_or_component(LIB_NAME <lib_name>
Expand Down
2 changes: 1 addition & 1 deletion examples/comp_deps/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
gz_get_libsources_and_unittests(sources gtest_sources)

ign_create_core_library(SOURCES ${sources})
gz_create_core_library(SOURCES ${sources})
2 changes: 1 addition & 1 deletion examples/core_child/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
gz_get_libsources_and_unittests(sources gtest_sources)
ign_create_core_library(SOURCES ${sources} CXX_STANDARD 11)
gz_create_core_library(SOURCES ${sources} CXX_STANDARD 11)
target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME}
PUBLIC
ignition-core_no_deps::ignition-core_no_deps)
Expand Down
2 changes: 1 addition & 1 deletion examples/core_child_private/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
gz_get_libsources_and_unittests(sources gtest_sources)
ign_create_core_library(SOURCES ${sources} CXX_STANDARD 11)
gz_create_core_library(SOURCES ${sources} CXX_STANDARD 11)
target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME}
PRIVATE
ignition-core_no_deps::ignition-core_no_deps)
Expand Down
2 changes: 1 addition & 1 deletion examples/core_nodep/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
gz_get_libsources_and_unittests(sources gtest_sources)
ign_create_core_library(SOURCES ${sources} CXX_STANDARD 11)
gz_create_core_library(SOURCES ${sources} CXX_STANDARD 11)
gz_build_tests(TYPE UNIT SOURCES ${gtest_sources})
2 changes: 1 addition & 1 deletion examples/core_nodep_static/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
gz_get_libsources_and_unittests(sources gtest_sources)
ign_create_core_library(SOURCES ${sources} CXX_STANDARD 11)
gz_create_core_library(SOURCES ${sources} CXX_STANDARD 11)
gz_build_tests(TYPE UNIT SOURCES ${gtest_sources})
2 changes: 1 addition & 1 deletion examples/core_static_child/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
gz_get_libsources_and_unittests(sources gtest_sources)
ign_create_core_library(SOURCES ${sources} CXX_STANDARD 11)
gz_create_core_library(SOURCES ${sources} CXX_STANDARD 11)
target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME}
PUBLIC
ignition-core_no_deps_static::ignition-core_no_deps_static)
Expand Down
2 changes: 1 addition & 1 deletion examples/no_ignition_prefix/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
gz_get_libsources_and_unittests(sources gtest_sources)
ign_create_core_library(SOURCES ${sources} CXX_STANDARD 11)
gz_create_core_library(SOURCES ${sources} CXX_STANDARD 11)
gz_build_tests(TYPE UNIT SOURCES ${gtest_sources})
2 changes: 1 addition & 1 deletion examples/prerelease/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

ign_create_core_library(INTERFACE)
gz_create_core_library(INTERFACE)

2 changes: 1 addition & 1 deletion examples/use_component_depsA/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
gz_get_libsources_and_unittests(sources gtest_sources)
ign_create_core_library(SOURCES ${sources} CXX_STANDARD 11)
gz_create_core_library(SOURCES ${sources} CXX_STANDARD 11)
target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME}
PUBLIC
ignition-component_deps::ignition-component_deps-child)
Expand Down
2 changes: 1 addition & 1 deletion examples/use_component_depsB/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
gz_get_libsources_and_unittests(sources gtest_sources)
ign_create_core_library(SOURCES ${sources} CXX_STANDARD 11)
gz_create_core_library(SOURCES ${sources} CXX_STANDARD 11)
target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME}
PUBLIC
ignition-component_deps::ignition-component_deps-child)
Expand Down
2 changes: 1 addition & 1 deletion examples/use_component_depsC/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
gz_get_libsources_and_unittests(sources gtest_sources)
ign_create_core_library(SOURCES ${sources} CXX_STANDARD 11)
gz_create_core_library(SOURCES ${sources} CXX_STANDARD 11)
target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME}
PUBLIC
ignition-component_deps::ignition-component_deps-child)
Expand Down

0 comments on commit d074a46

Please sign in to comment.