From d33ea035ec9773f0dc69f78ca4b7c5598d36b34f Mon Sep 17 00:00:00 2001 From: methylDragon Date: Fri, 22 Apr 2022 11:51:23 -0700 Subject: [PATCH] Test windows CI Signed-off-by: methylDragon --- cmake/GzExport.hh.in | 68 ++++++++++++++++++++++++++++++++++++++++++++ cmake/IgnUtils.cmake | 30 +++++++++++-------- 2 files changed, 86 insertions(+), 12 deletions(-) create mode 100644 cmake/GzExport.hh.in diff --git a/cmake/GzExport.hh.in b/cmake/GzExport.hh.in new file mode 100644 index 00000000..00d8794d --- /dev/null +++ b/cmake/GzExport.hh.in @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2017 Open Source Robotics Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +/* + * ========================================================================== + * This file was automatically generated by CMake; do not modify it directly. + * To modify this file, make changes to ign-cmake/cmake/Export.hh.in + * ========================================================================== +*/ + +#ifndef @export_base@_EXPORT_HH_ +#define @export_base@_EXPORT_HH_ + +// The detail/Export.hh header is automatically generated by CMake, which only +// provides the system-dependent implementations of these macros, with no +// commentary or explanation, so we configure this public-facing header which +// leverages the auto-generated macros but provides commentary for them. +#include "@include_dir@/detail/Export.hh" + +// TODO(CH3): Remove this and this file (GzExport.hh.in) on tock +// This is to allow for ignition- and gz- targets for the same lib to be found +// together. (To support aliasing and ign -> gz ticktocking +#include "@include_dir@/detail/GzExport.hh" + + +#ifndef @export_base@_VISIBLE +/// For @lib_name@ developers: Apply this macro to @lib_name@ +/// functions and classes which consumers of this library will need to be able +/// to call from their own programs or libraries. +#define @export_base@_VISIBLE \ + DETAIL_@export_base@_VISIBLE +#endif + + +#ifndef @export_base@_HIDDEN +/// For @lib_name@ developers: Apply this macro to @lib_name@ +/// functions and classes which must not be used by consumers of this library. +/// By default, this property is applied to all classes and functions which are +/// not tagged with @export_base@_VISIBLE, so this does not +/// generally need to be used. +#define @export_base@_HIDDEN \ + DETAIL_@export_base@_HIDDEN +#endif + + +#ifndef IGN_DEPRECATED +/// For @lib_name@ developers: Use this macro to indicate that a +/// function or class has been deprecated and should no longer be used. A +/// version should be specified to provide context to the user about when the +/// function became deprecated. +#define IGN_DEPRECATED(version) IGN_DEPRECATED_ALL_VERSIONS +#endif + +#endif diff --git a/cmake/IgnUtils.cmake b/cmake/IgnUtils.cmake index 1237813d..84b05e81 100644 --- a/cmake/IgnUtils.cmake +++ b/cmake/IgnUtils.cmake @@ -1033,13 +1033,6 @@ function(ign_create_core_library) # Support "gz-" if(${PROJECT_LIBRARY_TARGET_NAME} MATCHES "^gz-") - _ign_add_library_or_component( - LIB_NAME ${PROJECT_LIBRARY_TARGET_NAME} - INCLUDE_DIR "${PROJECT_INCLUDE_DIR}" - EXPORT_BASE GZ_${IGN_DESIGNATION_UPPER} - SOURCES ${sources} - ${interface_option}) - # For ticktocking: Export an "ignition-" target as well, allowing linking against # the ignition- prefixed name # TODO(CH3): To remove on tock @@ -1072,6 +1065,15 @@ function(ign_create_core_library) set(project_pkgconfig_core_lib "-l${IGN_PROJECT_NAME_LOWER}") endif() + # Generate the gz- target + # NOTE(CH3): This call MUST be last so that the GzExport.hh.in can be generated and used! + _ign_add_library_or_component( + LIB_NAME ${PROJECT_LIBRARY_TARGET_NAME} + INCLUDE_DIR "${PROJECT_INCLUDE_DIR}" + EXPORT_BASE IGNITION_${IGN_DESIGNATION_UPPER} # IGNITION here is deliberate + SOURCES ${sources} + ${interface_option} + GZ) # TODO(CH3): Remove GZ arg on tock else() _ign_add_library_or_component( LIB_NAME ${PROJECT_LIBRARY_TARGET_NAME} @@ -1463,7 +1465,6 @@ endmacro() # INCLUDE_DIR # EXPORT_BASE # SOURCES ) -# macro(_ign_add_library_or_component) # NOTE: The following local variables are used in the Export.hh.in file, so if @@ -1474,7 +1475,7 @@ macro(_ign_add_library_or_component) #------------------------------------ # Define the expected arguments - set(options INTERFACE) + set(options INTERFACE GZ) set(oneValueArgs LIB_NAME INCLUDE_DIR EXPORT_BASE) set(multiValueArgs SOURCES) @@ -1510,6 +1511,12 @@ macro(_ign_add_library_or_component) _ign_add_library_or_component_arg_error(EXPORT_BASE) endif() + # TODO(CH3): Remove on tock + # Also remove all uses of this variable on tock + if(_ign_add_library_GZ) + set(export_file_prefix "Gz") + endif() + # check that export_base has no invalid symbols string(REPLACE "-" "_" export_base_replaced ${export_base}) if(NOT ${export_base} STREQUAL ${export_base_replaced}) @@ -1543,7 +1550,7 @@ macro(_ign_add_library_or_component) set(binary_include_dir "${CMAKE_BINARY_DIR}/include/${include_dir}") - set(implementation_file_name "${binary_include_dir}/detail/Export.hh") + set(implementation_file_name "${binary_include_dir}/detail/${export_file_prefix}Export.hh") include(GenerateExportHeader) # This macro will generate a header called detail/Export.hh which implements @@ -1571,7 +1578,7 @@ macro(_ign_add_library_or_component) # header provides commentary for the macros so that developers can know their # purpose. configure_file( - "${IGNITION_CMAKE_DIR}/Export.hh.in" + "${IGNITION_CMAKE_DIR}/${export_file_prefix}Export.hh.in" "${binary_include_dir}/Export.hh") # Configure the installation of the public-facing header. @@ -1590,7 +1597,6 @@ macro(_ign_add_library_or_component) #------------------------------------ # Configure the installation of the target - install( TARGETS ${lib_name} EXPORT ${lib_name}