mirror of
				https://github.com/NVIDIA/cuda-samples.git
				synced 2025-11-04 15:47:50 +08:00 
			
		
		
		
	Update the CMakeLists.txt for Tegra sample nbody_opengles
This commit is contained in:
		
							parent
							
								
									1e0c660f22
								
							
						
					
					
						commit
						e228ad9389
					
				@ -6,24 +6,52 @@ project(nbody_opengles LANGUAGES C CXX CUDA)
 | 
			
		||||
 | 
			
		||||
find_package(CUDAToolkit REQUIRED)
 | 
			
		||||
 | 
			
		||||
set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 75 80 86 89 90)
 | 
			
		||||
set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90)
 | 
			
		||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
 | 
			
		||||
    # set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G")  # enable cuda-gdb (expensive)
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
# Include directories and libraries
 | 
			
		||||
include_directories(../../../Common)
 | 
			
		||||
include_directories(../../../../Common)
 | 
			
		||||
 | 
			
		||||
find_package(EGL)
 | 
			
		||||
find_package(X11)
 | 
			
		||||
find_package(OpenGL)
 | 
			
		||||
 | 
			
		||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
 | 
			
		||||
    # Source file
 | 
			
		||||
    # Add target for nbody_opengles
 | 
			
		||||
    add_executable(nbody_opengles nbody_opengles.cu)
 | 
			
		||||
    if(${OpenGL_FOUND})
 | 
			
		||||
        if(${EGL_FOUND})
 | 
			
		||||
            if(${X11_FOUND})
 | 
			
		||||
                # Add target for nbody_opengles
 | 
			
		||||
                add_executable(nbody_opengles bodysystemcuda.cu render_particles.cpp nbody_opengles.cpp)
 | 
			
		||||
 | 
			
		||||
    target_compile_options(nbody_opengles PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:--extended-lambda>)
 | 
			
		||||
                target_compile_options(nbody_opengles PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:--extended-lambda>)
 | 
			
		||||
 | 
			
		||||
    target_compile_features(nbody_opengles PRIVATE cxx_std_17 cuda_std_17)
 | 
			
		||||
                target_compile_features(nbody_opengles PRIVATE cxx_std_17 cuda_std_17)
 | 
			
		||||
 | 
			
		||||
    set_target_properties(nbody_opengles PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
 | 
			
		||||
                set_target_properties(nbody_opengles PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
 | 
			
		||||
 | 
			
		||||
                target_include_directories(nbody_opengles PUBLIC
 | 
			
		||||
                    ${EGL_INCLUDE_DIR}
 | 
			
		||||
                    ${OPENGL_INCLUDE_DIR}
 | 
			
		||||
                    ${CUDAToolkit_INCLUDE_DIRS}
 | 
			
		||||
                )
 | 
			
		||||
 | 
			
		||||
                target_link_libraries(nbody_opengles
 | 
			
		||||
                    ${EGL_LIBRARY}
 | 
			
		||||
                    ${X11_LIBRARIES}
 | 
			
		||||
                    ${OPENGL_LIBRARIES}
 | 
			
		||||
                )
 | 
			
		||||
            else()
 | 
			
		||||
                message(STATUS "X11 libraries not found - will not build sample 'nbody_opengles'")
 | 
			
		||||
            endif()
 | 
			
		||||
        else()
 | 
			
		||||
            message(STATUS "EGL not found - will not build sample 'nbody_opengles'")
 | 
			
		||||
        endif()
 | 
			
		||||
    else()
 | 
			
		||||
        message(STATUS "OpenGL not found - will not build sample 'nbody_opengles'")
 | 
			
		||||
    endif()
 | 
			
		||||
else()
 | 
			
		||||
    message(STATUS "Will not build sample nbody_opengles - requires Linux OS")
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user