-
Notifications
You must be signed in to change notification settings - Fork 46
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
Add fmt 9.1.0 #364
Merged
Merged
Add fmt 9.1.0 #364
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
79191c6
add fmt 9.1.0
kkraus14 58feea2
docs and testing
kkraus14 fda0fd0
fix alignment
kkraus14 477597f
fmt_header_only --> fmt-header-only
kkraus14 5e41667
Clean up and sort CPM packages.
bdice b0d21ff
Reorder fmt.
bdice f5c8153
Merge branch 'branch-23.04' into fmt
bdice b4cbd74
Minor edits.
bdice File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
#============================================================================= | ||
# Copyright (c) 2021, 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#============================================================================= | ||
# Copyright (c) 2021, 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) 2021, 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() |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition to this option there's a
FMT_SYSTEM_HEADERS
option that treats them as system includes instead of user includes presumably to make things like clang-tidy happy. If we want that option I'm happy to add it here (as well as for spdlog which also has the option).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what to say here. @vyasr @robertmaynard?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does anyone know what the behavior of spdlog is when using an internal version of fmt? If it is marking the headers as system I don't mind re-producing that approach.
This will only effect when we are building fmt from source, since installed versions of fmt will always be treated as system due to how
IMPORT
targets in CMake behave.