-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds fmt 9.1.0 to rapids-cmake via `rapids_cpm_fmt` based on discussion in rapidsai/rmm#1177. Nothing should be using `rapids_cpm_fmt` yet so we don't need to version align it with spdlog until spdlog is updated to `1.11.0`. Depends on #366 Authors: - Keith Kraus (https://github.com/kkraus14) - Bradley Dice (https://github.com/bdice) Approvers: - Bradley Dice (https://github.com/bdice) URL: #364
- Loading branch information
Showing
9 changed files
with
184 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.. cmake-module:: ../../rapids-cmake/cpm/fmt.cmake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
#============================================================================= | ||
# Copyright (c) 2023, NVIDIA CORPORATION. | ||
# | ||
# 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. | ||
#============================================================================= | ||
include_guard(GLOBAL) | ||
|
||
#[=======================================================================[.rst: | ||
rapids_cpm_fmt | ||
----------------- | ||
.. versionadded:: v23.04.00 | ||
Allow projects to find or build `fmt` via `CPM` with built-in | ||
tracking of these dependencies for correct export support. | ||
Uses the version of fmt :ref:`specified in the version file <cpm_versions>` for consistency | ||
across all RAPIDS projects. | ||
.. code-block:: cmake | ||
rapids_cpm_fmt( [BUILD_EXPORT_SET <export-name>] | ||
[INSTALL_EXPORT_SET <export-name>] | ||
[<CPM_ARGS> ...]) | ||
.. |PKG_NAME| replace:: fmt | ||
.. include:: common_package_args.txt | ||
Result Targets | ||
^^^^^^^^^^^^^^ | ||
fmt::fmt, fmt::fmt-header-only targets will be created | ||
Result Variables | ||
^^^^^^^^^^^^^^^^ | ||
:cmake:variable:`fmt_SOURCE_DIR` is set to the path to the source directory of fmt. | ||
:cmake:variable:`fmt_BINARY_DIR` is set to the path to the build directory of fmt. | ||
:cmake:variable:`fmt_ADDED` is set to a true value if fmt has not been added before. | ||
:cmake:variable:`fmt_VERSION` is set to the version of fmt specified by the versions.json. | ||
#]=======================================================================] | ||
function(rapids_cpm_fmt) | ||
list(APPEND CMAKE_MESSAGE_CONTEXT "rapids.cpm.fmt") | ||
|
||
set(to_install OFF) | ||
if(INSTALL_EXPORT_SET IN_LIST ARGN) | ||
set(to_install ON) | ||
endif() | ||
|
||
include("${rapids-cmake-dir}/cpm/detail/package_details.cmake") | ||
rapids_cpm_package_details(fmt version repository tag shallow exclude) | ||
|
||
include("${rapids-cmake-dir}/cpm/detail/generate_patch_command.cmake") | ||
rapids_cpm_generate_patch_command(fmt ${version} patch_command) | ||
|
||
include("${rapids-cmake-dir}/cpm/find.cmake") | ||
rapids_cpm_find(fmt ${version} ${ARGN} | ||
GLOBAL_TARGETS fmt::fmt fmt::fmt-header-only | ||
CPM_ARGS | ||
GIT_REPOSITORY ${repository} | ||
GIT_TAG ${tag} | ||
GIT_SHALLOW ${shallow} | ||
PATCH_COMMAND ${patch_command} | ||
EXCLUDE_FROM_ALL ${exclude} | ||
OPTIONS "FMT_INSTALL ${to_install}") | ||
|
||
include("${rapids-cmake-dir}/cpm/detail/display_patch_status.cmake") | ||
rapids_cpm_display_patch_status(fmt) | ||
|
||
# Propagate up variables that CPMFindPackage provide | ||
set(fmt_SOURCE_DIR "${fmt_SOURCE_DIR}" PARENT_SCOPE) | ||
set(fmt_BINARY_DIR "${fmt_BINARY_DIR}" PARENT_SCOPE) | ||
set(fmt_ADDED "${fmt_ADDED}" PARENT_SCOPE) | ||
set(fmt_VERSION ${version} PARENT_SCOPE) | ||
|
||
# fmt creates the correct namespace aliases | ||
endfunction() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#============================================================================= | ||
# Copyright (c) 2023, NVIDIA CORPORATION. | ||
# | ||
# 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. | ||
#============================================================================= | ||
include(${rapids-cmake-dir}/cpm/init.cmake) | ||
include(${rapids-cmake-dir}/cpm/fmt.cmake) | ||
|
||
rapids_cpm_init() | ||
|
||
rapids_cpm_fmt(BUILD_EXPORT_SET frank INSTALL_EXPORT_SET test) | ||
rapids_cpm_fmt(INSTALL_EXPORT_SET test2) | ||
|
||
get_target_property(packages rapids_export_install_test PACKAGE_NAMES) | ||
if(NOT fmt IN_LIST packages) | ||
message(FATAL_ERROR "rapids_cpm_fmt failed to record fmt needs to be exported") | ||
endif() | ||
|
||
get_target_property(packages rapids_export_install_test2 PACKAGE_NAMES) | ||
if(NOT fmt IN_LIST packages) | ||
message(FATAL_ERROR "rapids_cpm_fmt failed to record fmt needs to be exported") | ||
endif() | ||
|
||
get_target_property(packages rapids_export_build_frank PACKAGE_NAMES) | ||
if(NOT fmt IN_LIST packages) | ||
message(FATAL_ERROR "rapids_cpm_fmt failed to record fmt needs to be exported") | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#============================================================================= | ||
# Copyright (c) 2023, NVIDIA CORPORATION. | ||
# | ||
# 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. | ||
#============================================================================= | ||
include(${rapids-cmake-dir}/cpm/init.cmake) | ||
include(${rapids-cmake-dir}/cpm/fmt.cmake) | ||
|
||
rapids_cpm_init() | ||
|
||
if(TARGET fmt::fmt-header-only) | ||
message(FATAL_ERROR "Expected fmt::fmt-header-only expected to not exist") | ||
endif() | ||
|
||
if(TARGET fmt::fmt) | ||
message(FATAL_ERROR "Expected fmt::fmt expected to not exist") | ||
endif() | ||
|
||
rapids_cpm_fmt() | ||
|
||
if(NOT TARGET fmt::fmt-header-only) | ||
message(FATAL_ERROR "Expected fmt::fmt-header-only target to exist") | ||
endif() | ||
|
||
if(NOT TARGET fmt::fmt) | ||
message(FATAL_ERROR "Expected fmt::fmt target to exist") | ||
endif() | ||
|
||
rapids_cpm_fmt() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters