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] Migrate more internal variables #263

Merged
merged 3 commits into from
May 27, 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
26 changes: 13 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ install(DIRECTORY tools/

#--------------------------------------
# Create configuration and installation variables
set(ign_config_input "${CMAKE_CURRENT_SOURCE_DIR}/config/ignition-cmake-config.cmake.in")
set(ign_config_output "${PROJECT_NAME_LOWER}-config.cmake")
set(ign_version_output "${PROJECT_NAME_LOWER}-config-version.cmake")
set(ign_config_install_dir "${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PROJECT_NAME_LOWER}")
set(gz_config_input "${CMAKE_CURRENT_SOURCE_DIR}/config/ignition-cmake-config.cmake.in")
set(gz_config_output "${PROJECT_NAME_LOWER}-config.cmake")
set(gz_version_output "${PROJECT_NAME_LOWER}-config-version.cmake")
set(gz_config_install_dir "${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PROJECT_NAME_LOWER}")
set(ign_pkgconfig_input "${CMAKE_CURRENT_SOURCE_DIR}/config/ignition-cmake.pc.in")
set(ign_pkgconfig_output "${CMAKE_BINARY_DIR}/ignition-cmake${PROJECT_VERSION_MAJOR}.pc")
set(ign_pkgconfig_install_dir "${IGN_LIB_INSTALL_DIR}/pkgconfig")
Expand All @@ -69,24 +69,24 @@ set(simple_utilities_import_name ${PROJECT_EXPORT_NAME}::utilities)
#--------------------------------------
# Configure and install the config file
configure_package_config_file(
${ign_config_input}
${ign_config_output}
INSTALL_DESTINATION ${ign_config_install_dir}
${gz_config_input}
${gz_config_output}
INSTALL_DESTINATION ${gz_config_install_dir}
PATH_VARS IGN_DATA_INSTALL_DIR
NO_CHECK_REQUIRED_COMPONENTS_MACRO)

#--------------------------------------
# Configure and install the version file
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/${ign_version_output}
${CMAKE_CURRENT_BINARY_DIR}/${gz_version_output}
VERSION "${PROJECT_VERSION_FULL_NO_SUFFIX}"
COMPATIBILITY SameMajorVersion)

install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/${ign_config_output}
${CMAKE_CURRENT_BINARY_DIR}/${ign_version_output}
DESTINATION ${ign_config_install_dir}
${CMAKE_CURRENT_BINARY_DIR}/${gz_config_output}
${CMAKE_CURRENT_BINARY_DIR}/${gz_version_output}
DESTINATION ${gz_config_install_dir}
COMPONENT cmake)

#--------------------------------------
Expand Down Expand Up @@ -127,7 +127,7 @@ export(

install(
EXPORT ${ign_utilities_target}
DESTINATION ${ign_config_install_dir}
DESTINATION ${gz_config_install_dir}
FILE ${ign_utilities_target_output_filename}
NAMESPACE ${PROJECT_EXPORT_NAME}::)

Expand All @@ -141,7 +141,7 @@ install(
#============================================================================
# Install the files for this package
#============================================================================
set(ign_modules_install_dir "${ign_config_install_dir}/cmake${PROJECT_VERSION_MAJOR}")
set(ign_modules_install_dir "${gz_config_install_dir}/cmake${PROJECT_VERSION_MAJOR}")

file(GLOB modules "cmake/*.cmake")
file(GLOB templates "cmake/*.in")
Expand Down
8 changes: 4 additions & 4 deletions cmake/Export.hh.in
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@
// TICKTOCK IGNITION ========================================================
// TODO(CH3): Remove on ticktock, supports defining IGNITION macros if a lib
// is using GZ_ prefixed export macros
#ifndef @_ign_export_base@_VISIBLE
#define @_ign_export_base@_VISIBLE @export_base@_VISIBLE
#ifndef @_gz_export_base@_VISIBLE
#define @_gz_export_base@_VISIBLE @export_base@_VISIBLE
#endif

#ifndef @_ign_export_base@_HIDDEN
#define @_ign_export_base@_HIDDEN @export_base@_HIDDEN
#ifndef @_gz_export_base@_HIDDEN
#define @_gz_export_base@_HIDDEN @export_base@_HIDDEN
#endif

#ifndef IGN_DEPRECATED_ALL_VERSIONS
Expand Down
6 changes: 3 additions & 3 deletions cmake/FindIgnBullet.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
# This file is provided under the "BSD-style" License
########################################

set(ign_quiet_arg)
set(gz_quiet_arg)
if(IgnBullet_FIND_QUIETLY)
set(ign_quiet_arg QUIET)
set(gz_quiet_arg QUIET)
endif()

# Bullet. Force MODULE mode to use the FindBullet.cmake file distributed with
# CMake. Otherwise, we may end up using the BulletConfig.cmake file distributed
# with Bullet, which uses relative paths and may break transitive dependencies.
find_package(Bullet MODULE ${ign_quiet_arg})
find_package(Bullet MODULE ${gz_quiet_arg})

set(IgnBullet_FOUND false)
# create Bullet target
Expand Down
8 changes: 4 additions & 4 deletions cmake/FindIgnCURL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
# IgnCURL_LIBRARIES The CURL libraries
# IgnCURL_VERSION The version of CURL found

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

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

set(IgnCURL_FOUND ${CURL_FOUND})

Expand All @@ -51,7 +51,7 @@ if(${IgnCURL_FOUND})
set_target_properties(curl::curl PROPERTIES
INTERFACE_LINK_LIBRARIES CURL::libcurl)
endif()

include(IgnImportTarget)

if(NOT TARGET curl::curl)
Expand Down
22 changes: 11 additions & 11 deletions cmake/FindOptiX.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ else()
set(bit_dest "")
endif()

# ign-cmake modification: added "ign_" prefix to macro name
macro(ign_OPTIX_find_api_library name version)
# gz-cmake modification: added "gz_" prefix to macro name
macro(gz_OPTIX_find_api_library name version)
find_library(${name}_LIBRARY
NAMES ${name}.${version} ${name}
PATHS "${OptiX_INSTALL_DIR}/lib${bit_dest}"
Expand All @@ -102,9 +102,9 @@ macro(ign_OPTIX_find_api_library name version)
endif()
endmacro()

ign_OPTIX_find_api_library(optix 1)
ign_OPTIX_find_api_library(optixu 1)
ign_OPTIX_find_api_library(optix_prime 1)
gz_OPTIX_find_api_library(optix 1)
gz_OPTIX_find_api_library(optixu 1)
gz_OPTIX_find_api_library(optix_prime 1)

# Include
find_path(OptiX_INCLUDE
Expand Down Expand Up @@ -142,7 +142,7 @@ function(OptiX_add_imported_library name lib_location dll_lib dependent_libs)
set(CMAKE_IMPORT_FILE_VERSION 1)

# Create imported target
# ign-cmake modification: changed to use ${target_name} instead of ${name}
# gz-cmake modification: changed to use ${target_name} instead of ${name}
set(target_name optix::${name})
add_library(${target_name} SHARED IMPORTED)

Expand Down Expand Up @@ -180,8 +180,8 @@ OptiX_add_imported_library(optix "${optix_LIBRARY}" "${optix_DLL}" "${OPENGL_LIB
OptiX_add_imported_library(optixu "${optixu_LIBRARY}" "${optixu_DLL}" "")
OptiX_add_imported_library(optix_prime "${optix_prime_LIBRARY}" "${optix_prime_DLL}" "")

# ign-cmake modification: added "ign_" prefix to macro name
macro(ign_OptiX_check_same_path libA libB)
# gz-cmake modification: added "gz_" prefix to macro name
macro(gz_OptiX_check_same_path libA libB)
if(_optix_path_to_${libA})
if(NOT _optix_path_to_${libA} STREQUAL _optix_path_to_${libB})
# ${libA} and ${libB} are in different paths. Make sure there isn't a ${libA} next
Expand All @@ -203,10 +203,10 @@ if(APPLE)
set( _optix_rpath "-Wl,-rpath,${_optix_path_to_optix}" )
endif()
get_filename_component(_optix_path_to_optixu "${optixu_LIBRARY}" PATH)
ign_OptiX_check_same_path(optixu optix)
gz_OptiX_check_same_path(optixu optix)
get_filename_component(_optix_path_to_optix_prime "${optix_prime_LIBRARY}" PATH)
ign_OptiX_check_same_path(optix_prime optix)
ign_OptiX_check_same_path(optix_prime optixu)
gz_OptiX_check_same_path(optix_prime optix)
gz_OptiX_check_same_path(optix_prime optixu)

set( optix_rpath ${_optix_rpath} ${_optixu_rpath} ${_optix_prime_rpath} )
list(LENGTH optix_rpath optix_rpath_LENGTH)
Expand Down
6 changes: 3 additions & 3 deletions cmake/IgnConfigureBuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,9 @@ macro(gz_configure_build)
#--------------------------------------
# Initialize the list of header directories that should be parsed by doxygen
if(EXISTS "${CMAKE_SOURCE_DIR}/include")
set(ign_doxygen_component_input_dirs "${CMAKE_SOURCE_DIR}/include")
set(gz_doxygen_component_input_dirs "${CMAKE_SOURCE_DIR}/include")
else()
set(ign_doxygen_component_input_dirs "")
set(gz_doxygen_component_input_dirs "")
endif()

#--------------------------------------
Expand All @@ -222,7 +222,7 @@ macro(gz_configure_build)
# backslashes in order to get a \ plus a newline. This might be
# dependent on the implementation of gz_string_append, so be careful
# when changing the implementation of that function.
gz_string_append(ign_doxygen_component_input_dirs
gz_string_append(gz_doxygen_component_input_dirs
"${CMAKE_CURRENT_LIST_DIR}/${component}/include"
DELIM " \\\\\\\\\n ")
endif()
Expand Down
4 changes: 2 additions & 2 deletions cmake/IgnCreateDocs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ function(gz_create_docs)
# about the spaces between input files/directories. If you put each cmake
# variable on a separate line to make this `set` command more readable,
# then doxygen will not generate the correct/complete output.
set(IGNITION_DOXYGEN_INPUT "${IGNITION_DOXYGEN_API_MAINPAGE_MD} ${IGNITION_DOXYGEN_AUTOGENERATED_DOC} ${IGNITION_DOXYGEN_TUTORIALS_DIR} ${IGNITION_DOXYGEN_TUTORIALS_MAINPAGE_MD} ${ign_doxygen_component_input_dirs} ${IGNITION_DOXYGEN_ADDITIONAL_INPUT_DIRS}")
set(IGNITION_DOXYGEN_INPUT "${IGNITION_DOXYGEN_API_MAINPAGE_MD} ${IGNITION_DOXYGEN_AUTOGENERATED_DOC} ${IGNITION_DOXYGEN_TUTORIALS_DIR} ${IGNITION_DOXYGEN_TUTORIALS_MAINPAGE_MD} ${gz_doxygen_component_input_dirs} ${IGNITION_DOXYGEN_ADDITIONAL_INPUT_DIRS}")
configure_file(${IGNITION_CMAKE_DOXYGEN_DIR}/api.in
${CMAKE_BINARY_DIR}/api.dox @ONLY)

Expand All @@ -187,7 +187,7 @@ function(gz_create_docs)
set(IGNITION_DOXYGEN_GENHTML "NO")
set(IGNITION_DOXYGEN_GENTAGFILE
"${CMAKE_BINARY_DIR}/${PROJECT_NAME_LOWER}.tag.xml")
set(IGNITION_DOXYGEN_INPUT "${ign_doxygen_component_input_dirs} ${IGNITION_DOXYGEN_AUTOGENERATED_DOC}")
set(IGNITION_DOXYGEN_INPUT "${gz_doxygen_component_input_dirs} ${IGNITION_DOXYGEN_AUTOGENERATED_DOC}")
configure_file(${IGNITION_CMAKE_DOXYGEN_DIR}/api.in
${CMAKE_BINARY_DIR}/api_tagfile.dox @ONLY)

Expand Down
42 changes: 21 additions & 21 deletions cmake/IgnPackaging.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -270,20 +270,20 @@ function(_gz_create_cmake_package)

set(component ${_gz_create_cmake_package_COMPONENT})
set(target_name ${PROJECT_LIBRARY_TARGET_NAME}-${component})
set(ign_config_input "${IGNITION_CMAKE_DIR}/ignition-component-config.cmake.in")
set(gz_config_input "${IGNITION_CMAKE_DIR}/ignition-component-config.cmake.in")
set(simple_import_name ${component})

elseif(_gz_create_cmake_package_ALL)

set(ign_config_input "${IGNITION_CMAKE_DIR}/ignition-all-config.cmake.in")
set(gz_config_input "${IGNITION_CMAKE_DIR}/ignition-all-config.cmake.in")
set(target_name ${PROJECT_LIBRARY_TARGET_NAME}-all)
set(all_pkg_name ${PROJECT_LIBRARY_TARGET_NAME}-all)
set(simple_import_name all)

else()

set(target_name ${PROJECT_LIBRARY_TARGET_NAME})
set(ign_config_input "${IGNITION_CMAKE_DIR}/ignition-config.cmake.in")
set(gz_config_input "${IGNITION_CMAKE_DIR}/ignition-config.cmake.in")
set(simple_import_name core)

endif()
Expand All @@ -300,46 +300,46 @@ function(_gz_create_cmake_package)

# This gets used by the ignition-*.config.cmake.in files
set(target_output_filename ${target_name}-targets.cmake)
set(ign_config_output "${PROJECT_BINARY_DIR}/cmake/${target_name}-config.cmake")
set(ign_version_output "${PROJECT_BINARY_DIR}/cmake/${target_name}-config-version.cmake")
set(ign_target_ouput "${PROJECT_BINARY_DIR}/cmake/${target_output_filename}")
set(gz_config_output "${PROJECT_BINARY_DIR}/cmake/${target_name}-config.cmake")
set(gz_version_output "${PROJECT_BINARY_DIR}/cmake/${target_name}-config-version.cmake")
set(gz_target_ouput "${PROJECT_BINARY_DIR}/cmake/${target_output_filename}")

# NOTE: Each component needs to go into its own cmake directory in order to be
# found by cmake's native find_package(~) command.
set(ign_config_install_dir "${IGN_LIB_INSTALL_DIR}/cmake/${target_name}")
set(ign_namespace ${PROJECT_LIBRARY_TARGET_NAME}::)
set(gz_config_install_dir "${IGN_LIB_INSTALL_DIR}/cmake/${target_name}")
set(gz_namespace ${PROJECT_LIBRARY_TARGET_NAME}::)

set(import_target_name ${ign_namespace}${target_name})
set(simple_import_name ${ign_namespace}${simple_import_name})
set(import_target_name ${gz_namespace}${target_name})
set(simple_import_name ${gz_namespace}${simple_import_name})

# Configure the package config file. It will be installed to
# "[lib]/cmake/ignition-<project><major_version>/" where [lib] is the library
# installation directory.
configure_package_config_file(
${ign_config_input}
${ign_config_output}
INSTALL_DESTINATION ${ign_config_install_dir}
${gz_config_input}
${gz_config_output}
INSTALL_DESTINATION ${gz_config_install_dir}
PATH_VARS IGN_LIB_INSTALL_DIR IGN_INCLUDE_INSTALL_DIR_FULL)

# Use write_basic_package_version_file to generate a ConfigVersion file that
# allow users of the library to specify the API or version to depend on
write_basic_package_version_file(
${ign_version_output}
${gz_version_output}
VERSION "${PROJECT_VERSION_FULL_NO_SUFFIX}"
COMPATIBILITY SameMajorVersion)

# Install the configuration files to the configuration installation directory
install(
FILES
${ign_config_output}
${ign_version_output}
DESTINATION ${ign_config_install_dir}
${gz_config_output}
${gz_version_output}
DESTINATION ${gz_config_install_dir}
COMPONENT cmake)

# Create *-targets.cmake file for build directory
export(
EXPORT ${target_name}
FILE ${ign_target_ouput}
FILE ${gz_target_ouput}
# We add a namespace that ends with a :: to the name of the exported target.
# This is so consumers of the project can call
# find_package(ignition-<project>)
Expand All @@ -354,15 +354,15 @@ function(_gz_create_cmake_package)
# The advantage of linking against a target rather than a library is that
# you will automatically link against all the dependencies of that target.
# This also helps us create find-config files that are relocatable.
NAMESPACE ${ign_namespace})
NAMESPACE ${gz_namespace})

# Install *-targets.cmake file
install(
EXPORT ${target_name}
DESTINATION ${ign_config_install_dir}
DESTINATION ${gz_config_install_dir}
FILE ${target_output_filename}
# See explanation above for NAMESPACE
NAMESPACE ${ign_namespace})
NAMESPACE ${gz_namespace})

endfunction()

Expand Down
16 changes: 8 additions & 8 deletions cmake/IgnUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -304,12 +304,12 @@ macro(gz_find_package PACKAGE_NAME)
endif()

# NOTE (MXG): 7 seems to be the number of escapes required to get
# "${ign_package_required}" and "${ign_package_quiet}" to show up correctly
# "${gz_package_required}" and "${gz_package_quiet}" to show up correctly
# as strings in the final config-file outputs. It is unclear to me why the
# escapes get collapsed exactly three times, so it is possible that any
# changes to this script could cause a different number of escapes to be
# necessary. Please use caution when modifying this script.
gz_string_append(${PACKAGE_NAME}_dependency_args "\\\\\\\${ign_package_quiet} \\\\\\\${ign_package_required}")
gz_string_append(${PACKAGE_NAME}_dependency_args "\\\\\\\${gz_package_quiet} \\\\\\\${gz_package_required}")

# If we have specified components of the dependency, mention those.
if(gz_find_package_COMPONENTS)
Expand Down Expand Up @@ -1304,10 +1304,10 @@ function(ign_add_component component_name)
if(NOT gz_add_component_INDEPENDENT_FROM_PROJECT_LIB)

# Add the core library as a cmake dependency for this component
# NOTE: It seems we need to triple-escape "${ign_package_required}" and
# "${ign_package_quiet}" here.
# NOTE: It seems we need to triple-escape "${gz_package_required}" and
# "${gz_package_quiet}" here.
gz_string_append(${component_name}_CMAKE_DEPENDENCIES
"if(NOT ${PKG_NAME}_CONFIG_INCLUDED)\n find_package(${PKG_NAME} ${PROJECT_VERSION_FULL_NO_SUFFIX} EXACT \\\${ign_package_quiet} \\\${ign_package_required})\nendif()" DELIM "\n")
"if(NOT ${PKG_NAME}_CONFIG_INCLUDED)\n find_package(${PKG_NAME} ${PROJECT_VERSION_FULL_NO_SUFFIX} EXACT \\\${gz_package_quiet} \\\${gz_package_required})\nendif()" DELIM "\n")

# Choose what type of pkgconfig entry the core library belongs to
set(lib_pkgconfig_type ${component_name}_PKGCONFIG_REQUIRES)
Expand All @@ -1322,7 +1322,7 @@ function(ign_add_component component_name)

if(gz_add_component_DEPENDS_ON_COMPONENTS)
gz_string_append(${component_name}_CMAKE_DEPENDENCIES
"find_package(${PKG_NAME} ${PROJECT_VERSION_FULL_NO_SUFFIX} EXACT \\\${ign_package_quiet} \\\${ign_package_required} COMPONENTS ${gz_add_component_DEPENDS_ON_COMPONENTS})" DELIM "\n")
"find_package(${PKG_NAME} ${PROJECT_VERSION_FULL_NO_SUFFIX} EXACT \\\${gz_package_quiet} \\\${gz_package_required} COMPONENTS ${gz_add_component_DEPENDS_ON_COMPONENTS})" DELIM "\n")
endif()

#------------------------------------
Expand Down Expand Up @@ -1428,7 +1428,7 @@ macro(_gz_add_library_or_component)
# - export_base
# - lib_name
#
# - _ign_export_base
# - _gz_export_base

#------------------------------------
# Define the expected arguments
Expand Down Expand Up @@ -1532,7 +1532,7 @@ macro(_gz_add_library_or_component)
# TODO(CH3): Remove this on ticktock
# This is to allow IGNITION_ prefixed export macros to generate in Export.hh
# _using_gz_export_base is used in Export.hh.in's configuration!
string(REGEX REPLACE "^GZ_" "IGNITION_" _ign_export_base ${export_base})
string(REGEX REPLACE "^GZ_" "IGNITION_" _gz_export_base ${export_base})

configure_file(
"${IGNITION_CMAKE_DIR}/Export.hh.in"
Expand Down
Loading