290
|
1 cmake_minimum_required(VERSION 2.8)
|
|
2
|
291
|
3 # add_definitions("-Wall -g -O0")
|
290
|
4
|
292
|
5 set(CMAKE_C_COMPILER $ENV{CBC_COMPILER})
|
294
|
6 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")
|
292
|
7 SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CUDA_LINK_FLAGS}" )
|
290
|
8
|
291
|
9 cmake_minimum_required(VERSION 2.8)
|
|
10 find_package(CUDA REQUIRED)
|
|
11
|
292
|
12 add_custom_command(OUTPUT main.o
|
|
13 DEPENDS main.cu
|
|
14 COMMAND nvcc -O -c main.cu
|
290
|
15 )
|
292
|
16
|
|
17 add_executable(cudaExmple main.o test.c)
|
|
18
|
|
19 add_custom_command(OUTPUT twice.o
|
|
20 DEPENDS twice.cu
|
|
21 COMMAND nvcc -O -c twice.cu
|
|
22 )
|
|
23
|
|
24 add_custom_command(OUTPUT multiply.o
|
|
25 DEPENDS multiply.cu
|
294
|
26 COMMAND nvcc -std=c++11 -O -c multiply.cu
|
292
|
27 )
|
|
28
|
294
|
29 add_executable(twiceExample twice.o multiply.o test.c)
|
|
30
|
|
31 # target_link_libraries(twiceExample ${CUDA_LIBRARIES} ${MPI_LIBRARIES} ${OPENGL_LIBRARIES})
|
|
32
|