mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-06-22 10:07:11 +02:00
Use default cpp fmt build script.
This commit is contained in:
vendor/Fmt
CMakeLists.txtCONTRIBUTING.mdChangeLog.rstREADME.rst
doc
CMakeLists.txtindex.rstpython-license.txtsyntax.rstusage.rst
_static
bootstrap.min.js
fonts
_templates
api.rstbasic-bootstrap
bootstrap
alerts.lessbadges.lessbootstrap.lessbreadcrumbs.lessbutton-groups.lessbuttons.lesscarousel.lessclose.lesscode.lesscomponent-animations.lessdropdowns.lessforms.lessglyphicons.lessgrid.lessinput-groups.lessjumbotron.lesslabels.lesslist-group.lessmedia.lessmixins.less
build.pyconf.pycontents.rstfmt.lessmixins
alerts.lessbackground-variant.lessborder-radius.lessbuttons.lesscenter-block.lessclearfix.lessforms.lessgradients.lessgrid-framework.lessgrid.lesshide-text.lessimage.lesslabels.lesslist-group.lessnav-divider.lessnav-vertical-align.lessopacity.lesspagination.lesspanels.lessprogress-bar.lessreset-filter.lessresize.lessresponsive-visibility.lesssize.lesstab-focus.lesstable-row.lesstext-emphasis.lesstext-overflow.lessvendor-prefixes.less
modals.lessnavbar.lessnavs.lessnormalize.lesspager.lesspagination.lesspanels.lesspopovers.lessprint.lessprogress-bars.lessresponsive-embed.lessresponsive-utilities.lessscaffolding.lesstables.lesstheme.lessthumbnails.lesstooltip.lesstype.lessutilities.lessvariables.lesswells.lesshtml
_sources
_static
basic.cssbootstrap.min.jsdoctools.jsdocumentation_options.jsfile.pngfmt.css
api.htmlcontents.htmlgenindex.htmlindex.htmlobjects.invsearch.htmlsearchindex.jssyntax.htmlusage.htmlfonts
glyphicons-halflings-regular.eotglyphicons-halflings-regular.svgglyphicons-halflings-regular.ttfglyphicons-halflings-regular.woff
jquery-3.5.1.jsjquery.jslanguage_data.jsminus.pngplus.pngpygments.csssearchtools.jsunderscore-1.3.1.jsunderscore.jssrc
support
Android.mkAndroidManifest.xmlC++.sublime-syntaxREADMEVagrantfileappveyor-build.pyappveyor.ymlbuild-docs.pybuild.gradle
cmake
compute-powers.pydocopt.pymanage.pyrst2md.pyrtd
test
CMakeLists.txt
add-subdirectory-test
args-test.ccassert-test.ccchrono-test.cccolor-test.cccompile-error-test
compile-test.cccore-test.cccuda-test
enforce-checks-test.ccfind-package-test
formatformat-impl-test.ccformat-test.ccfuzzing
CMakeLists.txtREADME.mdbuild.shchrono-duration.ccfloat.ccfuzzer-common.hmain.ccnamed-arg.ccone-arg.cctwo-args.cc
gtest-extra-test.ccgtest-extra.ccgtest-extra.hgtest
header-only-test.ccmock-allocator.hmodule-test.ccos-test.ccostream-test.ccposix-mock-test.ccposix-mock.hprintf-test.ccranges-test.ccscan-test.ccscan.hstatic-export-test
std-format-test.cctest-assert.htest-main.ccunicode-test.ccutil.ccutil.hxchar-test.cc
73
vendor/Fmt/test/cuda-test/CMakeLists.txt
vendored
Normal file
73
vendor/Fmt/test/cuda-test/CMakeLists.txt
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
# We can find some usecases which follow the guide of CMake which uses
|
||||
# `enable_language(CUDA)` instead of `find_package(CUDA)` and let the CMake
|
||||
# built-in functions use NVCC.
|
||||
|
||||
# See: https://cmake.org/cmake/help/latest/module/FindCUDA.html#replacement
|
||||
#
|
||||
# However, this requires CMake version 3.10 or higher and we can't be sure most
|
||||
# of the CUDA projects are using those.
|
||||
#
|
||||
# This test relies on `find_package(CUDA)` in the parent CMake config.
|
||||
|
||||
# These can be updated when NVCC becomes ready for C++ 17 features
|
||||
# https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#cpp14-language-features
|
||||
set(CMAKE_CUDA_STANDARD 14)
|
||||
set(CMAKE_CUDA_STANDARD_REQUIRED 14)
|
||||
|
||||
# In this test, we assume that the user is going to compile CUDA source code
|
||||
# with some libraries (fmt in this case).
|
||||
#
|
||||
# In addition to that, this test invokes both the C++ host compiler and NVCC
|
||||
# by providing another (non-CUDA) C++ source code.
|
||||
if (${CMAKE_VERSION} VERSION_LESS 3.15)
|
||||
# https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html
|
||||
list(APPEND CUDA_NVCC_FLAGS "-std=c++14")
|
||||
if (MSVC)
|
||||
# This is the solution of pytorch:
|
||||
# https://github.com/pytorch/pytorch/pull/7118
|
||||
list(APPEND CUDA_NVCC_FLAGS "-Xcompiler" "/std:c++14")
|
||||
list(APPEND CUDA_NVCC_FLAGS "-Xcompiler" "/Zc:__cplusplus")
|
||||
# for the reason of this -Xcompiler options, see below.
|
||||
endif ()
|
||||
cuda_add_executable(fmt-in-cuda-test cuda-cpp14.cu cpp14.cc)
|
||||
target_compile_features(fmt-in-cuda-test PRIVATE cxx_std_14)
|
||||
if (MSVC)
|
||||
# This part is for (non-CUDA) C++ code. MSVC can define incorrect
|
||||
# `__cplusplus` macro. Fix for the issue is to use additional compiler flag.
|
||||
#
|
||||
# See Also:
|
||||
# https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/
|
||||
# https://github.com/Microsoft/vscode-cpptools/issues/2595
|
||||
target_compile_options(fmt-in-cuda-test PRIVATE /Zc:__cplusplus /permissive-)
|
||||
endif ()
|
||||
else()
|
||||
# now using a "new" way of handling CUDA
|
||||
add_executable(fmt-in-cuda-test cuda-cpp14.cu cpp14.cc)
|
||||
set_target_properties(fmt-in-cuda-test PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
|
||||
target_compile_features(fmt-in-cuda-test PRIVATE cxx_std_14)
|
||||
if (MSVC)
|
||||
# with MSVC, 'cxx_std_14' will only propagate to the host code (MSVC), but will
|
||||
# not set __cplusplus correctly anyway, while nvcc will ignore it.
|
||||
# If specified for nvcc on the command line as '-std=c++14' nvcc will emit this
|
||||
# message instead:
|
||||
# nvcc warning : The -std=c++14 flag is not supported with the configured host
|
||||
# compiler. Flag will be ignored.
|
||||
set_property(SOURCE cuda-cpp14.cu APPEND PROPERTY
|
||||
COMPILE_OPTIONS -Xcompiler /std:c++14 -Xcompiler /Zc:__cplusplus)
|
||||
set_property(SOURCE cpp14.cc APPEND PROPERTY
|
||||
COMPILE_OPTIONS /std:c++14 /Zc:__cplusplus)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
get_target_property(IN_USE_CUDA_STANDARD fmt-in-cuda-test CUDA_STANDARD)
|
||||
message(STATUS "cuda_standard: ${IN_USE_CUDA_STANDARD}")
|
||||
|
||||
get_target_property(IN_USE_CUDA_STANDARD_REQUIRED
|
||||
fmt-in-cuda-test CUDA_STANDARD_REQUIRED)
|
||||
message(STATUS "cuda_standard_required: ${IN_USE_CUDA_STANDARD_REQUIRED}")
|
||||
|
||||
# We don't use PUBLIC or other keyword for reasons explained in the
|
||||
# CUDA_LINK_LIBRARIES_KEYWORD section in
|
||||
# https://cmake.org/cmake/help/latest/module/FindCUDA.html
|
||||
target_link_libraries(fmt-in-cuda-test fmt::fmt)
|
||||
|
11
vendor/Fmt/test/cuda-test/cpp14.cc
vendored
Normal file
11
vendor/Fmt/test/cuda-test/cpp14.cc
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
#include <fmt/core.h>
|
||||
|
||||
// The purpose of this part is to ensure NVCC's host compiler also supports
|
||||
// the standard version. See 'cuda-cpp14.cu'.
|
||||
//
|
||||
// https://en.cppreference.com/w/cpp/preprocessor/replace#Predefined_macros
|
||||
static_assert(__cplusplus >= 201402L, "expect C++ 2014 for host compiler");
|
||||
|
||||
auto make_message_cpp() -> std::string {
|
||||
return fmt::format("host compiler \t: __cplusplus == {}", __cplusplus);
|
||||
}
|
28
vendor/Fmt/test/cuda-test/cuda-cpp14.cu
vendored
Normal file
28
vendor/Fmt/test/cuda-test/cuda-cpp14.cu
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
// Direct NVCC command line example:
|
||||
//
|
||||
// nvcc ./cuda-cpp14.cu -x cu -I"../include" -l"fmtd" -L"../build/Debug" \
|
||||
// -std=c++14 -Xcompiler /std:c++14 -Xcompiler /Zc:__cplusplus
|
||||
|
||||
// Ensure that we are using the latest C++ standard for NVCC
|
||||
// The version is C++14
|
||||
//
|
||||
// https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#c-cplusplus-language-support
|
||||
// https://en.cppreference.com/w/cpp/preprocessor/replace#Predefined_macros
|
||||
static_assert(__cplusplus >= 201402L, "expect C++ 2014 for nvcc");
|
||||
|
||||
#include <fmt/core.h>
|
||||
|
||||
#include <cuda.h>
|
||||
#include <iostream>
|
||||
|
||||
extern auto make_message_cpp() -> std::string;
|
||||
extern auto make_message_cuda() -> std::string;
|
||||
|
||||
int main() {
|
||||
std::cout << make_message_cuda() << std::endl;
|
||||
std::cout << make_message_cpp() << std::endl;
|
||||
}
|
||||
|
||||
auto make_message_cuda() -> std::string {
|
||||
return fmt::format("nvcc compiler \t: __cplusplus == {}", __cplusplus);
|
||||
}
|
Reference in New Issue
Block a user