Skip to content

Commit

Permalink
Merge branch 'main' into chapulina/3/ign_deprecations_3
Browse files Browse the repository at this point in the history
  • Loading branch information
scpeters committed May 14, 2022
2 parents a074e5a + 4eab833 commit 7923d0e
Show file tree
Hide file tree
Showing 32 changed files with 154 additions and 78 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ _gz_setup_target_for_codecheck()
set(IGNITION_CMAKE_DOXYGEN_DIR "${CMAKE_CURRENT_SOURCE_DIR}/doc/doxygen")
configure_file(${CMAKE_SOURCE_DIR}/api.md.in ${CMAKE_BINARY_DIR}/api.md)
configure_file(${CMAKE_SOURCE_DIR}/tutorials.md.in ${CMAKE_BINARY_DIR}/tutorials.md)
ign_create_docs(
gz_create_docs(
API_MAINPAGE_MD "${CMAKE_BINARY_DIR}/api.md"
TUTORIALS_MAINPAGE_MD "${CMAKE_BINARY_DIR}/tutorials.md"
)
2 changes: 2 additions & 0 deletions Migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ release will remove the deprecated code.
**Replacement**: include/ignition/utils/SuppressWarning.hh
1. **Deprecated**: include/ignition/utilities/ExtraTestMacros.hh
**Replacement**: include/ignition/utils/ExtraTestMacros.hh
1. **Deprecated**: CMake functions and macros starting with `ign_`
**Replacement**: CMake functions and macros starting with `gz_`
22 changes: 18 additions & 4 deletions cmake/IgnConfigureBuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# IgnBuildProject
# -------------------
#
# ign_configure_build()
# gz_configure_build()
#
# Configures the build rules of an ignition library project.
#
Expand All @@ -28,14 +28,28 @@
# Pass the argument QUIT_IF_BUILD_ERRORS to have this macro quit cmake when the
# build_errors
macro(ign_configure_build)

#============================================================================
# Parse the arguments that are passed in
# TODO(chapulina) Enable warnings after all libraries have migrated.
# message(WARNING "ign_configure_build is deprecated, use gz_configure_build instead.")
set(options HIDE_SYMBOLS_BY_DEFAULT QUIT_IF_BUILD_ERRORS)
set(oneValueArgs)
set(multiValueArgs COMPONENTS)
cmake_parse_arguments(gz_configure_build "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

set(gz_configure_build_skip_parsing true)
gz_configure_build()
endmacro()
macro(gz_configure_build)

# Deprecated, remove skip parsing logic in version 4
if (NOT gz_configure_build_skip_parsing)
#============================================================================
# Parse the arguments that are passed in
set(options HIDE_SYMBOLS_BY_DEFAULT QUIT_IF_BUILD_ERRORS)
set(oneValueArgs)
set(multiValueArgs COMPONENTS)
cmake_parse_arguments(gz_configure_build "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
endif()

#============================================================================
# Examine the build type. If we do not recognize the type, we will generate
# an error, so this must come before the error handling.
Expand Down
29 changes: 22 additions & 7 deletions cmake/IgnCreateDocs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# IgnCreatePackage
# ----------------
#
# ign_create_docs
# gz_create_docs
#
# Creates documentation for an ignition library project.
#
Expand All @@ -22,7 +22,7 @@
# limitations under the License.

#################################################
# ign_create_docs(
# gz_create_docs(
# [API_MAINPAGE_MD <api_markdown_mainpage>]
# [AUTOGENERATED_DOC <generated doc dir>]
# [TUTORIALS_MAINPAGE_MD <tutorials_markdown_mainpage>]
Expand All @@ -41,22 +41,37 @@
# TAGFILES: Optional. Specify tagfiles for doxygen to use. It should be a list of strings like:
# "${IGNITION-<DESIGNATION>_DOXYGEN_TAGFILE} = ${IGNITION-<DESIGNATION>_API_URL}"
function(ign_create_docs)
# TODO(chapulina) Enable warnings after all libraries have migrated.
# message(WARNING "ign_create_docs is deprecated, use gz_create_docs instead.")

#------------------------------------
# Define the expected arguments
set(options)
set(oneValueArgs API_MAINPAGE_MD AUTOGENERATED_DOC TUTORIALS_MAINPAGE_MD)
set(multiValueArgs "TAGFILES" "ADDITIONAL_INPUT_DIRS" "IMAGE_PATH_DIRS")
_gz_cmake_parse_arguments(gz_create_docs "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

set(gz_create_docs_skip_parsing true)
gz_create_docs()
endfunction()
function(gz_create_docs)

option(BUILD_DOCS "Build docs" ON)
if (NOT ${BUILD_DOCS})
message(STATUS "Building Documentation disabled via BUILD_DOCS=OFF")
return()
endif()

#------------------------------------
# Parse the arguments
_gz_cmake_parse_arguments(gz_create_docs "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
# Deprecated, remove skip parsing logic in version 4
if (NOT gz_create_docs_skip_parsing)
#------------------------------------
# Define the expected arguments
set(options)
set(oneValueArgs API_MAINPAGE_MD AUTOGENERATED_DOC TUTORIALS_MAINPAGE_MD)
set(multiValueArgs "TAGFILES" "ADDITIONAL_INPUT_DIRS" "IMAGE_PATH_DIRS")

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

set(required_html_files
"doxygen/html/annotated.html"
Expand Down
4 changes: 2 additions & 2 deletions cmake/IgnPackaging.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ endmacro()
# component's name.
#
# NOTE: This will be called automatically by gz_create_core_library(~) and
# ign_add_component(~), so users of ignition-cmake should not call this
# gz_add_component(~), so users of ignition-cmake should not call this
# function.
#
# NOTE: For ignition-cmake developers, the variables needed by ignition.pc.in or
Expand Down Expand Up @@ -235,7 +235,7 @@ endfunction()
# can be used to specify the prefix of these variables.
#
# NOTE: This will be called automatically by gz_create_core_library(~) and
# ign_add_component(~), so users of ignition-cmake should not call this
# gz_add_component(~), so users of ignition-cmake should not call this
# function.
#
# NOTE: For ignition-cmake developers, some of the variables needed by
Expand Down
83 changes: 64 additions & 19 deletions cmake/IgnUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -516,15 +516,24 @@ macro(_gz_list_to_string _output _input_list)
endmacro()

#################################################
# ign_get_sources_and_unittests(<lib_srcs> <tests>)
# gz_get_libsources_and_unittests(<lib_srcs> <tests>)
#
# Grab all the files ending in "*.cc" from either the "src/" subdirectory or the
# 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 gz_create_core_library(~),
# ign_add_component(~), ign_build_tests(~), and ign_build_executables(~).
# 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.
# message(WARNING "ign_get_libsources_and_unittests is deprecated, use gz_get_libsources_and_unittests instead.")

gz_get_libsources_and_unittests(${lib_sources_var} ${tests_var})

set(${lib_sources_var} ${${lib_sources_var}} PARENT_SCOPE)
set(${tests_var} ${${tests_var}} PARENT_SCOPE)
endfunction()
function(gz_get_libsources_and_unittests lib_sources_var tests_var)

# Glob all the source files
if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/src)
Expand Down Expand Up @@ -571,12 +580,20 @@ function(ign_get_libsources_and_unittests lib_sources_var tests_var)
endfunction()

#################################################
# ign_get_sources(<sources>)
# gz_get_sources(<sources>)
#
# From the current directory, grab all the source files and place them into
# <sources>. Remove their paths to make them suitable for passing into
# ign_add_[library/tests].
function(ign_get_sources sources_var)
# TODO(chapulina) Enable warnings after all libraries have migrated.
# message(WARNING "ign_get_sources is deprecated, use gz_get_sources instead.")

gz_get_sources(${sources_var})

set(${sources_var} ${${sources_var}} PARENT_SCOPE)
endfunction()
function(gz_get_sources sources_var)

# GLOB all the source files
file(GLOB source_files "*.cc")
Expand All @@ -599,7 +616,7 @@ function(ign_get_sources sources_var)
endfunction()

#################################################
# ign_install_all_headers(
# gz_install_all_headers(
# [EXCLUDE_FILES <excluded_headers>]
# [EXCLUDE_DIRS <dirs>]
# [GENERATED_HEADERS <headers>]
Expand All @@ -625,17 +642,31 @@ endfunction()
# config.hh file since it would be redundant with the core library.
#
function(ign_install_all_headers)
# TODO(chapulina) Enable warnings after all libraries have migrated.
# message(WARNING "ign_install_all_headers is deprecated, use gz_install_all_headers instead.")

#------------------------------------
# Define the expected arguments
set(options)
set(oneValueArgs COMPONENT) # We are not using oneValueArgs yet
set(oneValueArgs COMPONENT)
set(multiValueArgs EXCLUDE_FILES EXCLUDE_DIRS GENERATED_HEADERS)

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

set(gz_install_all_headers_skip_parsing true)
gz_install_all_headers()
endfunction()
function(gz_install_all_headers)

# Deprecated, remove skip parsing logic in version 4
if (NOT gz_install_all_headers_skip_parsing)
#------------------------------------
# Define the expected arguments
set(options)
set(oneValueArgs COMPONENT)
set(multiValueArgs EXCLUDE_FILES EXCLUDE_DIRS GENERATED_HEADERS)

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

#------------------------------------
# Build the list of directories
Expand Down Expand Up @@ -1616,7 +1647,7 @@ macro(ign_build_executables)
endmacro()

#################################################
# ign_build_tests(TYPE <test_type>
# gz_build_tests(TYPE <test_type>
# SOURCES <sources>
# [LIB_DEPS <library_dependencies>]
# [INCLUDE_DIRS <include_dependencies>]
Expand Down Expand Up @@ -1646,33 +1677,47 @@ endmacro()
# into your executable's directory.
#
macro(ign_build_tests)
# TODO(chapulina) Enable warnings after all libraries have migrated.
# message(WARNING "ign_build_tests is deprecated, use gz_build_tests instead.")

#------------------------------------
# Define the expected arguments
set(options SOURCE EXCLUDE_PROJECT_LIB) # NOTE: DO NOT USE "SOURCE", we're adding it here to catch typos
set(oneValueArgs TYPE TEST_LIST)
set(multiValueArgs SOURCES LIB_DEPS INCLUDE_DIRS)
_gz_cmake_parse_arguments(gz_build_tests "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

set(gz_build_tests_skip_parsing true)
gz_build_tests(${PACKAGE_NAME})
endmacro()
macro(gz_build_tests)

#------------------------------------
# Parse the arguments
_gz_cmake_parse_arguments(gz_build_tests "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
# Deprecated, remove skip parsing logic in version 4
if (NOT gz_build_tests_skip_parsing)
#------------------------------------
# Define the expected arguments
set(options SOURCE EXCLUDE_PROJECT_LIB) # NOTE: DO NOT USE "SOURCE", we're adding it here to catch typos
set(oneValueArgs TYPE TEST_LIST)
set(multiValueArgs SOURCES LIB_DEPS INCLUDE_DIRS)

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

if(NOT gz_build_tests_TYPE)
# If you have encountered this error, you are probably migrating to the
# new ignition-cmake system. Be sure to also provide a SOURCES argument
# when calling ign_build_tests.
# when calling gz_build_tests.
message(FATAL_ERROR "Developer error: You must specify a TYPE for your tests!")
endif()

if(gz_build_tests_SOURCE)

# We have encountered cases where someone accidentally passes a SOURCE
# argument instead of a SOURCES argument into ign_build_tests, and the macro
# argument instead of a SOURCES argument into gz_build_tests, and the macro
# didn't report any problem with it. Adding this warning should make it more
# clear when that particular typo occurs.
message(AUTHOR_WARNING
"Your script has specified SOURCE for ign_build_tests, which is not an "
"Your script has specified SOURCE for gz_build_tests, which is not an "
"option. Did you mean to specify SOURCES (note the plural)?")

endif()
Expand Down
4 changes: 2 additions & 2 deletions examples/comp_deps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
project(ignition-component_deps VERSION 0.1.0)
find_package(ignition-cmake3 REQUIRED)
ign_configure_project()
ign_configure_build(QUIT_IF_BUILD_ERRORS
gz_configure_build(QUIT_IF_BUILD_ERRORS
COMPONENTS child parent)
gz_create_packages()
ign_create_docs()
gz_create_docs()
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 @@
ign_get_libsources_and_unittests(sources gtest_sources)
gz_get_libsources_and_unittests(sources gtest_sources)

gz_create_core_library(SOURCES ${sources})
4 changes: 2 additions & 2 deletions examples/core_child/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ project(ignition-core_child VERSION 0.1.0)
find_package(ignition-cmake3 REQUIRED)
ign_configure_project()
ign_find_package(ignition-core_no_deps REQUIRED)
ign_configure_build(QUIT_IF_BUILD_ERRORS)
gz_configure_build(QUIT_IF_BUILD_ERRORS)
gz_create_packages()
ign_create_docs(TAGFILES "${IGNITION-CORE_NO_DEPS_DOXYGEN_TAGFILE} = ${IGNITION-CORE_NO_DEPS_API_URL}")
gz_create_docs(TAGFILES "${IGNITION-CORE_NO_DEPS_DOXYGEN_TAGFILE} = ${IGNITION-CORE_NO_DEPS_API_URL}")
4 changes: 2 additions & 2 deletions examples/core_child/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ign_get_libsources_and_unittests(sources gtest_sources)
gz_get_libsources_and_unittests(sources gtest_sources)
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)
ign_build_tests(TYPE UNIT SOURCES ${gtest_sources})
gz_build_tests(TYPE UNIT SOURCES ${gtest_sources})
4 changes: 2 additions & 2 deletions examples/core_child_private/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ project(ignition-core_child_private VERSION 0.1.0)
find_package(ignition-cmake3 REQUIRED)
ign_configure_project()
ign_find_package(ignition-core_no_deps PRIVATE REQUIRED)
ign_configure_build(QUIT_IF_BUILD_ERRORS)
gz_configure_build(QUIT_IF_BUILD_ERRORS)
gz_create_packages()
ign_create_docs(TAGFILES "${IGNITION-CORE_NO_DEPS_DOXYGEN_TAGFILE} = ${IGNITION-CORE_NO_DEPS_API_URL}")
gz_create_docs(TAGFILES "${IGNITION-CORE_NO_DEPS_DOXYGEN_TAGFILE} = ${IGNITION-CORE_NO_DEPS_API_URL}")
4 changes: 2 additions & 2 deletions examples/core_child_private/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ign_get_libsources_and_unittests(sources gtest_sources)
gz_get_libsources_and_unittests(sources gtest_sources)
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)
ign_build_tests(TYPE UNIT SOURCES ${gtest_sources})
gz_build_tests(TYPE UNIT SOURCES ${gtest_sources})
4 changes: 2 additions & 2 deletions examples/core_nodep/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
project(ignition-core_no_deps VERSION 0.1.0)
find_package(ignition-cmake3 REQUIRED)
ign_configure_project()
ign_configure_build(QUIT_IF_BUILD_ERRORS)
gz_configure_build(QUIT_IF_BUILD_ERRORS)
gz_create_packages()
ign_create_docs()
gz_create_docs()
4 changes: 2 additions & 2 deletions examples/core_nodep/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ign_get_libsources_and_unittests(sources gtest_sources)
gz_get_libsources_and_unittests(sources gtest_sources)
gz_create_core_library(SOURCES ${sources} CXX_STANDARD 11)
ign_build_tests(TYPE UNIT SOURCES ${gtest_sources})
gz_build_tests(TYPE UNIT SOURCES ${gtest_sources})
4 changes: 2 additions & 2 deletions examples/core_nodep_static/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ project(ignition-core_no_deps_static VERSION 0.1.0)
find_package(ignition-cmake3 REQUIRED)
ign_configure_project()
OPTION(BUILD_SHARED_LIBS OFF)
ign_configure_build(QUIT_IF_BUILD_ERRORS)
gz_configure_build(QUIT_IF_BUILD_ERRORS)
gz_create_packages()
ign_create_docs()
gz_create_docs()
4 changes: 2 additions & 2 deletions examples/core_nodep_static/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ign_get_libsources_and_unittests(sources gtest_sources)
gz_get_libsources_and_unittests(sources gtest_sources)
gz_create_core_library(SOURCES ${sources} CXX_STANDARD 11)
ign_build_tests(TYPE UNIT SOURCES ${gtest_sources})
gz_build_tests(TYPE UNIT SOURCES ${gtest_sources})
4 changes: 2 additions & 2 deletions examples/core_static_child/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ project(ignition-core_static_child VERSION 0.1.0)
find_package(ignition-cmake3 REQUIRED)
ign_configure_project()
ign_find_package(ignition-core_no_deps_static REQUIRED)
ign_configure_build(QUIT_IF_BUILD_ERRORS)
gz_configure_build(QUIT_IF_BUILD_ERRORS)
gz_create_packages()
ign_create_docs(TAGFILES "${IGNITION-CORE_NO_DEPS_STATIC_DOXYGEN_TAGFILE} = ${IGNITION-CORE_NO_DEPS_STATIC_API_URL}")
gz_create_docs(TAGFILES "${IGNITION-CORE_NO_DEPS_STATIC_DOXYGEN_TAGFILE} = ${IGNITION-CORE_NO_DEPS_STATIC_API_URL}")
4 changes: 2 additions & 2 deletions examples/core_static_child/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ign_get_libsources_and_unittests(sources gtest_sources)
gz_get_libsources_and_unittests(sources gtest_sources)
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)
ign_build_tests(TYPE UNIT SOURCES ${gtest_sources})
gz_build_tests(TYPE UNIT SOURCES ${gtest_sources})
Loading

0 comments on commit 7923d0e

Please sign in to comment.