Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

cmake: option to install thrust when used via add_subdirectory() #1297

Merged
merged 1 commit into from
Oct 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
# Support adding Thrust to a parent project via add_subdirectory.
# See examples/cmake/add_subdir/CMakeLists.txt for details.
if (NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_LIST_DIR}")
include(cmake/ThrustAddSubdir.cmake)
return()
endif()

# 3.15 is the minimum.
# 3.17 for nvc++/Feta
# 3.18 for C++17 + CUDA
Expand All @@ -18,12 +11,31 @@ endif()

project(Thrust NONE)

# Determine whether Thrust is the top-level project or included into
# another project via add_subdirectory()
if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_LIST_DIR}")
set(THRUST_TOPLEVEL_PROJECT ON)
else()
set(THRUST_TOPLEVEL_PROJECT OFF)
endif()

option(THRUST_ENABLE_INSTALL_RULES "Enable installation of Thrust" ${THRUST_TOPLEVEL_PROJECT})
if (THRUST_ENABLE_INSTALL_RULES)
include(cmake/ThrustInstallRules.cmake)
endif()

# Support adding Thrust to a parent project via add_subdirectory.
# See examples/cmake/add_subdir/CMakeLists.txt for details.
if (NOT THRUST_TOPLEVEL_PROJECT)
include(cmake/ThrustAddSubdir.cmake)
return()
endif()

include(cmake/AppendOptionIfAvailable.cmake)

include(cmake/ThrustBuildCompilerTargets.cmake)
include(cmake/ThrustBuildTargetList.cmake)
include(cmake/ThrustMultiConfig.cmake)
include(cmake/ThrustInstallRules.cmake)
include(cmake/ThrustUtilities.cmake)

option(THRUST_ENABLE_HEADER_TESTING "Test that all public headers compile." "ON")
Expand Down
6 changes: 6 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,8 @@ The CMake options are divided into these categories:
- `THRUST_ENABLE_EXAMPLE_FILECHECK={ON, OFF}`
- Enable validation of example outputs using the LLVM FileCheck utility.
Default is `OFF`.
- `THRUST_ENABLE_INSTALL_RULES={ON, OFF}`
- If true, installation rules will be generated for thrust. Default is `ON`.

## Single Config CMake Options

Expand Down Expand Up @@ -391,6 +393,10 @@ The CMake options are divided into these categories:
simultaneously.
- CUB configurations will be generated for each C++ dialect targeted by
the current Thrust build.
- `THRUST_INSTALL_CUB_HEADERS={ON, OFF}`
- If enabled, the CUB project's headers will be installed through Thrust's
installation rules. Default is `ON`.
- This option depends on `THRUST_ENABLE_INSTALL_RULES`.
- `THRUST_ENABLE_COMPUTE_XX={ON, OFF}`
- Controls the targeted CUDA architecture(s)
- Multiple options may be selected when using NVCC as the CUDA compiler.
Expand Down