Mercurial > hg > GearsTemplate
annotate 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 |
rev | line source |
---|---|
290 | 1 cmake_minimum_required(VERSION 2.8) |
2 | |
295 | 3 add_definitions("-Wall -g -O0") |
4 | |
5 set(NVCCFLAG "-std=c++11" "-g" "-O0" ) | |
290 | 6 |
297 | 7 include_directories("/usr/local/cuda/include") |
8 | |
298 | 9 set(CMAKE_C_COMPILER $ENV{CBC_COMPILER}) |
296
f16802b3b580
add comment on CMakeLists.txt for cuda test
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
295
diff
changeset
|
10 |
294 | 11 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") |
296
f16802b3b580
add comment on CMakeLists.txt for cuda test
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
295
diff
changeset
|
12 # for linux use -lcuda |
f16802b3b580
add comment on CMakeLists.txt for cuda test
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
295
diff
changeset
|
13 |
292 | 14 SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CUDA_LINK_FLAGS}" ) |
290 | 15 |
291 | 16 cmake_minimum_required(VERSION 2.8) |
17 find_package(CUDA REQUIRED) | |
18 | |
292 | 19 add_custom_command(OUTPUT main.o |
20 DEPENDS main.cu | |
295 | 21 COMMAND nvcc ${NVCCFLAG} -c main.cu |
290 | 22 ) |
292 | 23 |
24 add_executable(cudaExmple main.o test.c) | |
25 | |
295 | 26 add_custom_command(OUTPUT multiply.ptx |
292 | 27 DEPENDS multiply.cu |
295 | 28 COMMAND nvcc ${NVCCFLAG} -c multiply.cu -ptx |
292 | 29 ) |
30 | |
299 | 31 add_executable(twiceExample twice.cc multiply.ptx ) |
294 | 32 |
297 | 33 add_custom_command(OUTPUT vectorAdd_kernel.ptx |
34 DEPENDS vectorAdd_kernel.cu | |
35 COMMAND nvcc ${NVCCFLAG} -c vectorAdd_kernel.cu -ptx | |
36 ) | |
37 | |
38 add_executable(vectorExample vectorAddDrv.cc vectorAdd_kernel.ptx) | |
39 | |
296
f16802b3b580
add comment on CMakeLists.txt for cuda test
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
295
diff
changeset
|
40 # to compile these, comment out CMAKE_C_COMPILER |
f16802b3b580
add comment on CMakeLists.txt for cuda test
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
295
diff
changeset
|
41 # cuda_add_executable(Cudasample_gpu Cudasample_gpu.cu) |
f16802b3b580
add comment on CMakeLists.txt for cuda test
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
295
diff
changeset
|
42 # cuda_add_executable(Cudasample_cpu Cudasample_cpu.cu) |
f16802b3b580
add comment on CMakeLists.txt for cuda test
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
295
diff
changeset
|
43 |
294 | 44 # target_link_libraries(twiceExample ${CUDA_LIBRARIES} ${MPI_LIBRARIES} ${OPENGL_LIBRARIES}) |
45 |