This repository has been archived by the owner on Mar 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 757
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix and add test for cmake config install rules.
Needed to move some bits around to be able to include GNUInstallDirs, and along the way all of the compiler hacks got moved into their own file.
- Loading branch information
1 parent
35f5492
commit f5ea60f
Showing
9 changed files
with
258 additions
and
109 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# Set up compiler paths and apply temporary hacks to support NVC++ (Feta). | ||
# This file must be included before enabling any languages. | ||
|
||
# Temporary hacks to make Feta work; this requires you to define | ||
# `CMAKE_CUDA_COMPILER_ID=Feta` and `CMAKE_CUDA_COMPILER_FORCED`. | ||
if ("Feta" STREQUAL "${CMAKE_CUDA_COMPILER_ID}") | ||
# If using Feta, don't set CXX compiler | ||
if (NOT "${CMAKE_CXX_COMPILER}" STREQUAL "") | ||
unset(CMAKE_CXX_COMPILER CACHE) | ||
message(FATAL_ERROR "You are using Feta as your CUDA C++ compiler, but have" | ||
" specified a different ISO C++ compiler; Feta acts as both, so please" | ||
" unset the CMAKE_CXX_COMPILER variable." | ||
) | ||
endif() | ||
|
||
# We don't set CMAKE_CUDA_HOST_COMPILER for Feta; if we do, CMake tries to | ||
# pass `-ccbin ${CMAKE_CUDA_HOST_COMPILER}` to Feta, which it doesn't | ||
# understand. | ||
if (NOT "${CMAKE_CUDA_HOST_COMPILER}" STREQUAL "") | ||
unset(CMAKE_CUDA_HOST_COMPILER CACHE) | ||
message(FATAL_ERROR "You are using Feta as your CUDA C++ compiler, but have" | ||
" specified a different host ISO C++ compiler; Feta acts as both, so" | ||
" please unset the CMAKE_CUDA_HOST_COMPILER variable." | ||
) | ||
endif() | ||
|
||
set(CMAKE_CXX_COMPILER "${CMAKE_CUDA_COMPILER}") | ||
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -stdpar") | ||
set(CMAKE_CUDA_HOST_LINK_LAUNCHER "${CMAKE_CUDA_COMPILER}") | ||
set(CMAKE_CUDA_LINK_EXECUTABLE | ||
"<CMAKE_CUDA_HOST_LINK_LAUNCHER> ${CMAKE_CUDA_FLAGS} <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") | ||
endif () | ||
|
||
# We don't set CMAKE_CUDA_HOST_COMPILER for Feta; if we do, CMake tries to | ||
# pass `-ccbin ${CMAKE_CUDA_HOST_COMPILER}` to Feta, which it doesn't | ||
# understand. | ||
if ((NOT "Feta" STREQUAL "${CMAKE_CUDA_COMPILER_ID}")) | ||
if (NOT ("${CMAKE_CUDA_HOST_COMPILER}" STREQUAL "" OR | ||
"${CMAKE_CUDA_HOST_COMPILER}" STREQUAL "${CMAKE_CXX_COMPILER}")) | ||
set(tmp "${CMAKE_CUDA_HOST_COMPILER}") | ||
unset(CMAKE_CUDA_HOST_COMPILER CACHE) | ||
message(FATAL_ERROR | ||
"For convenience, Thrust's test harness uses CMAKE_CXX_COMPILER for the " | ||
"CUDA host compiler. Refusing to overwrite specified " | ||
"CMAKE_CUDA_HOST_COMPILER -- please reconfigure without setting this " | ||
"variable. Currently:\n" | ||
"CMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}\n" | ||
"CMAKE_CUDA_HOST_COMPILER=${tmp}" | ||
) | ||
endif () | ||
set(CMAKE_CUDA_HOST_COMPILER "${CMAKE_CXX_COMPILER}") | ||
endif () | ||
|
||
# Temporary hacks to make Feta work; this requires you to define | ||
# `CMAKE_CUDA_COMPILER_ID=Feta` and `CMAKE_CUDA_COMPILER_FORCED`. | ||
if ("Feta" STREQUAL "${CMAKE_CUDA_COMPILER_ID}") | ||
# Need 3.17 for the properties used below. | ||
cmake_minimum_required(VERSION 3.17) | ||
|
||
set(CMAKE_CUDA_STANDARD_DEFAULT 03) | ||
|
||
set(CMAKE_CUDA03_STANDARD_COMPILE_OPTION "-std=c++03") | ||
set(CMAKE_CUDA03_EXTENSION_COMPILE_OPTION "-std=c++03") | ||
set(CMAKE_CUDA03_STANDARD__HAS_FULL_SUPPORT TRUE) | ||
set_property(GLOBAL PROPERTY CMAKE_CUDA03_KNOWN_FEATURES) | ||
|
||
set(CMAKE_CUDA11_STANDARD_COMPILE_OPTION "-std=c++11") | ||
set(CMAKE_CUDA11_EXTENSION_COMPILE_OPTION "-std=c++11") | ||
set(CMAKE_CUDA11_STANDARD__HAS_FULL_SUPPORT TRUE) | ||
set_property(GLOBAL PROPERTY CMAKE_CUDA11_KNOWN_FEATURES) | ||
|
||
set(CMAKE_CUDA14_STANDARD_COMPILE_OPTION "-std=c++14") | ||
set(CMAKE_CUDA14_EXTENSION_COMPILE_OPTION "-std=c++14") | ||
set(CMAKE_CUDA14_STANDARD__HAS_FULL_SUPPORT TRUE) | ||
set_property(GLOBAL PROPERTY CMAKE_CUDA14_KNOWN_FEATURES) | ||
|
||
set(CMAKE_CUDA17_STANDARD_COMPILE_OPTION "-std=c++17") | ||
set(CMAKE_CUDA17_EXTENSION_COMPILE_OPTION "-std=c++17") | ||
set(CMAKE_CUDA17_STANDARD__HAS_FULL_SUPPORT TRUE) | ||
set_property(GLOBAL PROPERTY CMAKE_CUDA17_KNOWN_FEATURES) | ||
|
||
cmake_record_cuda_compile_features() | ||
|
||
set(CMAKE_CUDA_COMPILE_FEATURES | ||
${CMAKE_CUDA03_COMPILE_FEATURES} | ||
${CMAKE_CUDA11_COMPILE_FEATURES} | ||
${CMAKE_CUDA14_COMPILE_FEATURES} | ||
${CMAKE_CUDA17_COMPILE_FEATURES} | ||
${CMAKE_CUDA20_COMPILE_FEATURES} | ||
) | ||
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
Submodule cub
updated
9 files
+17 −6 | CMakeLists.txt | |
+17 −0 | cmake/CubCompilerHacks.cmake | |
+1 −9 | cmake/CubCudaConfig.cmake | |
+7 −1 | cmake/CubInstallRules.cmake | |
+9 −2 | cub/cmake/cub-config-version.cmake | |
+5 −2 | cub/cmake/cub-config.cmake | |
+2 −0 | test/CMakeLists.txt | |
+15 −0 | test/cmake/CMakeLists.txt | |
+93 −0 | test/cmake/test_install/CMakeLists.txt |
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,17 @@ | ||
thrust_update_system_found_flags() | ||
|
||
if (THRUST_CPP_FOUND AND THRUST_CUDA_FOUND) | ||
# Test that we can use `find_package` on an installed Thrust: | ||
add_test( | ||
NAME thrust.test.cmake.test_install | ||
COMMAND "${CMAKE_COMMAND}" | ||
--log-level=VERBOSE | ||
-G "${CMAKE_GENERATOR}" | ||
-S "${CMAKE_CURRENT_SOURCE_DIR}/test_install" | ||
-B "${CMAKE_CURRENT_BINARY_DIR}/test_install" | ||
-D "THRUST_BINARY_DIR=${Thrust_BINARY_DIR}" | ||
-D "CMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}" | ||
-D "CMAKE_CUDA_COMPILER=${CMAKE_CUDA_COMPILER}" | ||
-D "CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}" | ||
) | ||
endif() |
Oops, something went wrong.