diff --git a/include/fmt/core.h b/include/fmt/core.h index 1448ab24..7abaf657 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -133,15 +133,8 @@ # endif #endif -// Workaround broken [[deprecated]] in the Intel compiler. -#ifdef __INTEL_COMPILER -# define FMT_DEPRECATED_ALIAS -#else -# define FMT_DEPRECATED_ALIAS FMT_DEPRECATED -#endif - -// Workaround broken [[deprecated]] for the NVCC (CUDA with C++14) -#if defined(__NVCC__) || defined(__CUDACC__) +// Workaround broken [[deprecated]] in the Intel compiler and NVCC +#if defined(__INTEL_COMPILER) || defined(__NVCC__) || defined(__CUDACC__) # define FMT_DEPRECATED_ALIAS #else # define FMT_DEPRECATED_ALIAS FMT_DEPRECATED diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index e6c75361..338c9af7 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -232,15 +232,6 @@ endif () # find_package(CUDA 9.0) if(CUDA_FOUND) - add_test(cuda-test ${CMAKE_CTEST_COMMAND} - -C ${CMAKE_BUILD_TYPE} - --build-and-test - "${CMAKE_CURRENT_SOURCE_DIR}/cuda-test" - "${CMAKE_CURRENT_BINARY_DIR}/cuda-test" - --build-generator ${CMAKE_GENERATOR} - --build-makeprogram ${CMAKE_MAKE_PROGRAM} - --build-options - "-DFMT_DIR=${PROJECT_BINARY_DIR}" - "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}" - ) + add_subdirectory(cuda-test) + add_test(NAME cuda-test COMMAND fmt-in-cuda-test) endif() diff --git a/test/cuda-test/CMakeLists.txt b/test/cuda-test/CMakeLists.txt index 9873f409..bb7ac973 100644 --- a/test/cuda-test/CMakeLists.txt +++ b/test/cuda-test/CMakeLists.txt @@ -24,13 +24,10 @@ # Follow the Root CMakeLists.txt cmake_minimum_required(VERSION 3.1) -project(fmt-cuda-test LANGUAGES CXX) -# See 'test/CMakeLists.txt'. It's using ${PROJECT_BINARY_DIR} -find_package(FMT REQUIRED) - -# The environment variables (CUDA_BIN_PATH & CUDA_PATH) must be specified -find_package(CUDA REQUIRED) +# We already knows the packages. This part shows example. +# find_package(CUDA 9.0 REQUIRED) +# find_package(FMT 6.0 REQUIRED) # # Update these when NVCC becomes ready for C++ 17 features @@ -39,6 +36,9 @@ find_package(CUDA REQUIRED) set(CMAKE_CUDA_STANDARD 14) set(CMAKE_CUDA_STANDARD_REQUIRED 14) +# +# 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 @@ -62,27 +62,20 @@ cuda_add_executable(fmt-in-cuda-test cpp14.cc ) -# -# https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html -# -set_target_properties(fmt-in-cuda-test -PROPERTIES - CXX_STANDARD 14 # Notice this is for C++ code -) target_compile_features(fmt-in-cuda-test PRIVATE cxx_std_14 # just make sure of the property ) -get_target_property(cuda_standard +get_target_property(IN_USE_CUDA_STANDARD fmt-in-cuda-test CUDA_STANDARD ) -message(STATUS "cuda_standard: ${cuda_standard}") +message(STATUS "cuda_standard: ${IN_USE_CUDA_STANDARD}") -get_target_property(cuda_standard_required +get_target_property(IN_USE_CUDA_STANDARD_REQUIRED fmt-in-cuda-test CUDA_STANDARD_REQUIRED ) -message(STATUS "cuda_standard_required: ${cuda_standard_required}") +message(STATUS "cuda_standard_required: ${IN_USE_CUDA_STANDARD_REQUIRED}") # # https://cmake.org/cmake/help/latest/module/FindCUDA.html diff --git a/test/cuda-test/cuda-cpp14.cu b/test/cuda-test/cuda-cpp14.cu index 48a36b62..0fafd524 100644 --- a/test/cuda-test/cuda-cpp14.cu +++ b/test/cuda-test/cuda-cpp14.cu @@ -34,14 +34,12 @@ static_assert(__cplusplus >= 201402L, "expect C++ 2014 for nvcc"); #include #include -using namespace std; - extern auto make_message_cpp() -> std::string; extern auto make_message_cuda() -> std::string; int main(int, char*[]) { - cout << make_message_cuda() << endl; - cout << make_message_cpp() << endl; + std::cout << make_message_cuda() << std::endl; + std::cout << make_message_cpp() << std::endl; } auto make_message_cuda() -> std::string {