view src/test/CMakeLists.txt @ 299:b387b224790c

merge
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 12 Feb 2017 08:36:22 +0900
parents 898fce27f334
children
line wrap: on
line source

cmake_minimum_required(VERSION 2.8)

add_definitions("-Wall -g -O0")

set(NVCCFLAG "-std=c++11" "-g" "-O0" )

include_directories("/usr/local/cuda/include")

set(CMAKE_C_COMPILER $ENV{CBC_COMPILER})

set(CUDA_LINK_FLAGS "-framework CUDA -lc++ -Wl,-search_paths_first -Wl,-headerpad_max_install_names /Developer/NVIDIA/CUDA-8.0/lib/libcudart_static.a -Wl,-rpath,/usr/local/cuda/lib") 
# for linux use -lcuda

SET( CMAKE_EXE_LINKER_FLAGS  "${CMAKE_EXE_LINKER_FLAGS} ${CUDA_LINK_FLAGS}" )

cmake_minimum_required(VERSION 2.8)
find_package(CUDA REQUIRED)

add_custom_command(OUTPUT main.o
   DEPENDS main.cu                          
   COMMAND nvcc ${NVCCFLAG} -c  main.cu 
)

add_executable(cudaExmple main.o test.c)

add_custom_command(OUTPUT multiply.ptx
   DEPENDS multiply.cu                          
   COMMAND nvcc ${NVCCFLAG}  -c  multiply.cu  -ptx
)

add_executable(twiceExample twice.cc multiply.ptx )

add_custom_command(OUTPUT vectorAdd_kernel.ptx
   DEPENDS vectorAdd_kernel.cu                          
   COMMAND nvcc ${NVCCFLAG}  -c  vectorAdd_kernel.cu  -ptx
)

add_executable(vectorExample vectorAddDrv.cc vectorAdd_kernel.ptx)

# to compile these, comment out CMAKE_C_COMPILER
# cuda_add_executable(Cudasample_gpu Cudasample_gpu.cu)
# cuda_add_executable(Cudasample_cpu Cudasample_cpu.cu)

# target_link_libraries(twiceExample ${CUDA_LIBRARIES} ${MPI_LIBRARIES} ${OPENGL_LIBRARIES})