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

[ign ➡️ gz] Internal functions #247

Merged
merged 8 commits into from
May 9, 2022
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
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ set(CPPCHECK_INCLUDE_DIRS
)
set(IGNITION_CMAKE_CODECHECK_DIR "${CMAKE_CURRENT_SOURCE_DIR}/codecheck")
include(IgnCodeCheck)
ign_setup_target_for_codecheck()
_gz_setup_target_for_codecheck()

# Docs
set(IGNITION_CMAKE_DOXYGEN_DIR "${CMAKE_CURRENT_SOURCE_DIR}/doc/doxygen")
Expand Down
5 changes: 3 additions & 2 deletions cmake/FindIgnOGRE.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ set(minor_version ${IgnOGRE_FIND_VERSION_MINOR})
set(full_version ${major_version}.${minor_version})

# Copied from OGREConfig.cmake
macro(ign_ogre_declare_plugin TYPE COMPONENT)
# Internal to gz-cmake.
macro(_gz_ogre_declare_plugin TYPE COMPONENT)
set(OGRE_${TYPE}_${COMPONENT}_FOUND TRUE)
set(OGRE_${TYPE}_${COMPONENT}_LIBRARIES ${TYPE}_${COMPONENT})
list(APPEND OGRE_LIBRARIES ${TYPE}_${COMPONENT})
Expand Down Expand Up @@ -183,7 +184,7 @@ else()
string(SUBSTRING "${ogre_component}" "0" "${split_pos}" component_type)
string(SUBSTRING "${ogre_component}" "${split_pos2}" "${len}" component_name)

ign_ogre_declare_plugin("${component_type}" "${component_name}")
_gz_ogre_declare_plugin("${component_type}" "${component_name}")
endif()
endforeach()

Expand Down
9 changes: 5 additions & 4 deletions cmake/IgnBenchmark.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
# IgnBenchmark
# ------------
#
# ign_add_version_info_target()
# _gz_add_version_info_target()
#
# Adds a target to generate build and system configuration information.
# Adds a target to generate build and system configuration information. This
# function is private to gz-cmake.
#
# ign_add_benchmarks()
#
Expand Down Expand Up @@ -35,7 +36,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

function(ign_add_version_info_target)
function(_gz_add_version_info_target)
# generate a version_info.json file that can be used to embed project
# version information
# While this command may look a bit unweildy, it creates a target
Expand Down Expand Up @@ -83,7 +84,7 @@ function(ign_add_benchmarks)
list(APPEND BENCHMARK_TARGETS_LIST "$<TARGET_FILE:${benchmark}>")
endforeach()

ign_add_version_info_target()
_gz_add_version_info_target()

file(GENERATE
OUTPUT
Expand Down
7 changes: 4 additions & 3 deletions cmake/IgnCodeCheck.cmake
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# Setup the codecheck target, which will run cppcheck and cppplint.
function(ign_setup_target_for_codecheck)
# This function is private to gz-cmake.
function(_gz_setup_target_for_codecheck)
include(IgnPython)

find_program(CPPCHECK_PATH cppcheck)
find_program(FIND_PATH find)

if(NOT CPPCHECK_PATH)
message(STATUS "The program [cppcheck] was not found! Skipping codecheck setup")
return()
endif()

if(NOT FIND_PATH)
message(STATUS "The program [find] was not found! Skipping codecheck setup.")
return()
Expand Down
2 changes: 1 addition & 1 deletion cmake/IgnCodeCoverage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ FUNCTION(ign_setup_target_for_coverage)

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

set(_outputname ${gz_coverage_OUTPUT_NAME})
set(_targetname ${gz_coverage_TARGET_NAME})
Expand Down
22 changes: 11 additions & 11 deletions cmake/IgnConfigureBuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ macro(ign_configure_build)
#============================================================================
# Examine the build type. If we do not recognize the type, we will generate
# an error, so this must come before the error handling.
ign_parse_build_type()
_gz_parse_build_type()

#============================================================================
# Ask whether we should make a shared or static library.
Expand Down Expand Up @@ -85,12 +85,12 @@ macro(ign_configure_build)

#--------------------------------------
# Set up the compiler flags
ign_set_compiler_flags()
_gz_set_compiler_flags()


#--------------------------------------
# Set up the compiler feature flags to help us choose our standard
ign_set_cxx_feature_flags()
_gz_set_cxx_feature_flags()


#--------------------------------------
Expand Down Expand Up @@ -121,7 +121,7 @@ macro(ign_configure_build)

#--------------------------------------
# Create the "all" meta-target
ign_create_all_target()
_gz_create_all_target()


#--------------------------------------
Expand All @@ -140,7 +140,7 @@ macro(ign_configure_build)
else()

add_subdirectory(src)
_ign_find_include_script()
_gz_find_include_script()

endif()

Expand Down Expand Up @@ -239,7 +239,7 @@ macro(ign_configure_build)
set(found_${component}_src TRUE)
endif()

_ign_find_include_script(COMPONENT ${component})
_gz_find_include_script(COMPONENT ${component})

# Add the tests
if(BUILD_TESTING AND
Expand Down Expand Up @@ -271,12 +271,12 @@ macro(ign_configure_build)

#--------------------------------------
# Export the "all" meta-target
ign_export_target_all()
_gz_export_target_all()

#--------------------------------------
# Create codecheck target
include(IgnCodeCheck)
ign_setup_target_for_codecheck()
_gz_setup_target_for_codecheck()

#--------------------------------------
# If we made it this far, the configuration was successful
Expand All @@ -286,7 +286,7 @@ macro(ign_configure_build)

endmacro()

macro(ign_set_cxx_feature_flags)
macro(_gz_set_cxx_feature_flags)

set(IGN_KNOWN_CXX_STANDARDS 11 14 17)

Expand All @@ -296,7 +296,7 @@ macro(ign_set_cxx_feature_flags)

endmacro()

function(_ign_find_include_script)
function(_gz_find_include_script)

#------------------------------------
# Define the expected arguments
Expand Down Expand Up @@ -336,7 +336,7 @@ function(_ign_find_include_script)

endfunction()

macro(ign_parse_build_type)
macro(_gz_parse_build_type)

#============================================================================
# If a build type is not specified, set it to RelWithDebInfo by default
Expand Down
4 changes: 2 additions & 2 deletions cmake/IgnConfigureProject.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ macro(ign_configure_project)

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

# Note: The following are automatically defined by project(~) in cmake v3:
# PROJECT_NAME
Expand Down Expand Up @@ -124,7 +124,7 @@ macro(ign_configure_project)

#============================================================================
# Create package information
ign_setup_packages()
_gz_setup_packages()

#============================================================================
# Initialize build errors/warnings
Expand Down
2 changes: 1 addition & 1 deletion cmake/IgnCreateDocs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function(ign_create_docs)

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

set(required_html_files
"doxygen/html/annotated.html"
Expand Down
2 changes: 1 addition & 1 deletion cmake/IgnGenerateVersionInfo.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# IgnGenerateVersionInfo
# ----------------------
#
# Intended to be invoked as part of the ign_add_version_info_target function
# Intended to be invoked as part of the _gz_add_version_info_target function
# in IgnBenchmark.
#
# Populates information in the version_info.json file.
Expand Down
6 changes: 3 additions & 3 deletions cmake/IgnImportTarget.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ macro(ign_import_target package)

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

#------------------------------------
# Check if a target name has been provided, otherwise use
Expand Down Expand Up @@ -97,7 +97,7 @@ macro(ign_import_target package)
if(NOT gz_import_target_INTERFACE)

if(${gz_import_target_LIB_VAR})
_ign_sort_libraries(${target_name} ${${gz_import_target_LIB_VAR}})
_gz_sort_libraries(${target_name} ${${gz_import_target_LIB_VAR}})
endif()

endif()
Expand Down Expand Up @@ -148,7 +148,7 @@ endmacro()
#
# TODO: Figure out if there is a better way to fill in the various library
# properties of an imported target.
function(_ign_sort_libraries target_name first_lib)
function(_gz_sort_libraries target_name first_lib)

if(MSVC)
# Note: For MSVC, we only care about the "import library" which is the
Expand Down
4 changes: 2 additions & 2 deletions cmake/IgnManualSearch.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ macro(ign_manual_search package)

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

if(gz_manual_search_INTERFACE)
set(_gz_manual_search_interface_option INTERFACE)
Expand Down Expand Up @@ -93,7 +93,7 @@ macro(ign_manual_search package)

if(${package}_FOUND)
include(IgnImportTarget)
ign_import_target(${package} ${_ign_pkg_check_modules_interface_option}
ign_import_target(${package} ${_gz_pkg_check_modules_interface_option}
TARGET_NAME ${ign_pkg_check_modules_TARGET_NAME})
endif()

Expand Down
19 changes: 11 additions & 8 deletions cmake/IgnPackaging.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
# IgnPackaging
# ----------------
#
# ign_setup_packages
# _gz_setup_packages
#
# Sets up package information for an ignition library project.
# This function is internal to gz-cmake.
#
# ign_create_package
#
Expand All @@ -27,7 +28,7 @@

#################################################
# Set up package information
macro(ign_setup_packages)
macro(_gz_setup_packages)

#============================================================================
# Use GNUInstallDirs to get canonical paths.
Expand Down Expand Up @@ -150,7 +151,7 @@ macro(ign_create_packages)

#============================================================================
# Load platform-specific build hooks if present.
ign_load_build_hooks()
_gz_load_build_hooks()

#============================================================================
# Tell the user what their settings are
Expand All @@ -161,7 +162,7 @@ endmacro()


#################################################
# _ign_create_pkgconfig([COMPONENT <component>])
# _gz_create_pkgconfig([COMPONENT <component>])
#
# Provide the name of the target for which we will generate package config info.
# If the target is a component, pass in the COMPONENT argument followed by the
Expand All @@ -175,7 +176,7 @@ endmacro()
# ignition-component.pc.in MUST be set before calling this function.
#
# Create a pkgconfig file for your target, and install it.
function(_ign_create_pkgconfig)
function(_gz_create_pkgconfig)

#------------------------------------
# Define the expected arguments
Expand Down Expand Up @@ -216,7 +217,7 @@ endfunction()


#################################################
# _ign_create_cmake_package([COMPONENT <component>]
# _gz_create_cmake_package([COMPONENT <component>]
# [LEGACY_PROJECT_PREFIX <prefix>])
#
# Provide the name of the target that will be installed and exported. If the
Expand All @@ -239,7 +240,7 @@ endfunction()
# - target_output_filename
#
# Make the cmake config files for this target
function(_ign_create_cmake_package)
function(_gz_create_cmake_package)

#------------------------------------
# Define the expected arguments
Expand Down Expand Up @@ -364,7 +365,9 @@ endfunction()
# Pass an argument to specify the directory where the CMakeLists.txt for the
# build hooks is located. If no argument is provided, we default to:
# ${PROJECT_SOURCE_DIR}/packager-hooks
function(ign_load_build_hooks)
#
# This function is private to gz-cmake.
function(_gz_load_build_hooks)

if(ARGV0)
set(hook_dir ${ARGV0})
Expand Down
6 changes: 3 additions & 3 deletions cmake/IgnPkgConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ macro(ign_pkg_check_modules_quiet package signature)

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

if(gz_pkg_check_modules_INTERFACE)
set(_gz_pkg_check_modules_interface_option INTERFACE)
Expand Down Expand Up @@ -154,7 +154,7 @@ macro(ign_pkg_check_modules_quiet package signature)
#
# TODO: How would we deal with multiple modules that are in different
# directories? How does cmake-3.6+ handle that situation?
_ign_pkgconfig_find_libraries(
_gz_pkgconfig_find_libraries(
${package}_LIBRARIES
${package}
"${${package}_LIBRARIES}"
Expand Down Expand Up @@ -196,7 +196,7 @@ endmacro()

# Based on discussion here: https://cmake.org/Bug/view.php?id=15804
# and a patch written by Sam Thursfield
function(_ign_pkgconfig_find_libraries output_var package library_names library_dirs)
function(_gz_pkgconfig_find_libraries output_var package library_names library_dirs)

foreach(libname ${library_names})

Expand Down
Loading