22# GPUtils
33# ====================================================================
44cmake_minimum_required (VERSION 3.20 FATAL_ERROR)
5-
65if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.29" )
76 cmake_policy (SET CMP0135 NEW)
87endif ()
9-
8+ # ----
109# Set C++ version and SM architecture
1110if (NOT DEFINED CPPVERSION)
1211 set (CPPVERSION 20) # A40: 20, Orin: 17
1312endif ()
1413if (NOT DEFINED SM_ARCH)
1514 set (SM_ARCH 86)# A40: 86, Orin: 87
1615endif ()
17-
18-
16+ # ----
1917project (GPUtils
2018 DESCRIPTION "Easy use of vectors and matrices on GPGPU devices."
2119 HOMEPAGE_URL "https://github.com/GPUEngineering/GPUtils"
@@ -31,8 +29,8 @@ set(CMAKE_CUDA_FLAGS "-std=c++${CPPVERSION}")
3129set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} ; "-std=c++${CPPVERSION} " )
3230enable_language (CUDA)
3331# ----
34- add_library (device_compiler_flags INTERFACE )
35- target_compile_features (device_compiler_flags INTERFACE cxx_std_${CPPVERSION} )
32+ add_library (gputils_compiler_flags INTERFACE )
33+ target_compile_features (gputils_compiler_flags INTERFACE cxx_std_${CPPVERSION} )
3634set (CMAKE_CXX_EXTENSIONS OFF )
3735# ----
3836add_library (developer_flags INTERFACE )
@@ -45,30 +43,31 @@ target_compile_options(developer_flags
4543 # flags for CUDA builds
4644 $<$<COMPILE_LANGUAGE:CUDA>:${cuda_flags} >
4745 )
48- target_link_libraries (device_compiler_flags INTERFACE $<BUILD_INTERFACE:developer_flags>)
46+ target_link_libraries (gputils_compiler_flags INTERFACE $<BUILD_INTERFACE:developer_flags>)
4947# ----
50-
51-
52- # ====================================================================
53- # comment out for release
54- # ====================================================================
55- add_executable (main)
56- target_sources (main
48+ add_executable (gputils_main)
49+ target_sources (gputils_main
5750 PRIVATE
5851 main.cu
5952 )
60- target_link_libraries (main
53+ target_link_libraries (gputils_main
6154 PRIVATE
62- device_compiler_flags
55+ gputils_compiler_flags
6356 cublas
6457 cusolver
6558 cudadevrt
6659 )
67- target_include_directories (main
60+ target_include_directories (gputils_main
6861 PRIVATE
6962 "${PROJECT_BINARY_DIR} "
7063 "${PROJECT_SOURCE_DIR} /include"
7164 )
7265# ----
73- add_subdirectory (test )
66+ if (NOT GPUTILS_BUILD_TEST)
67+ set (GPUTILS_BUILD_TEST OFF ) # Set to ON for local testing (or add `-DGPUTILS_BUILD_TEST=ON` to your CMake profile)
68+ endif ()
69+ if (GPUTILS_BUILD_TEST)
70+ add_subdirectory (test )
71+ endif ()
72+ unset (GPUTILS_BUILD_TEST CACHE )
7473# ----
0 commit comments