Blame view

CMakeLists.txt 2.29 KB
9191c39e   Jiaming Guo   first version of ...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
  #Specify the version being used as well as the language
  cmake_minimum_required(VERSION 2.8.11)
  
  #Name your project here
  project(flow3)
  
  #set the module directory
  set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}")
  
  #find the STIM library
  find_package(STIM)
  
  #if the STIM library isn't found, download it
  if(NOT STIM_INCLUDE_DIRS)
  	file(REMOVE_RECURSE ${CMAKE_BINARY_DIR}/stimlib)	#remove the stimlib directory if it exists
  	set(STIM_GIT "https://git.stim.ee.uh.edu/codebase/stimlib.git")
  	execute_process(COMMAND git clone --depth 1 ${STIM_GIT} WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
  	set(STIM_INCLUDE_DIRS "${CMAKE_BINARY_DIR}/stimlib" CACHE TYPE PATH)
  endif(NOT STIM_INCLUDE_DIRS)
  
  #find BOOST
  find_package(Boost REQUIRED)
  
  #find cuda
  find_package(CUDA REQUIRED)
  
  #find the GLUT library for visualization
  find_package(OpenGL REQUIRED)
  
  find_package(GLUT REQUIRED)
  
  #find OpenCV
  find_package(OpenCV REQUIRED)
  add_definitions(-DUSING_OPENCV)
  
  #find the pthreads package
  find_package(Threads)
  
  #find the X11 package
  find_package(X11)
  
  #find the Approximate Nearest Neighbor Library
  #find_package(ANN REQUIRED)
  
  #build the executable in the binary directory on MS Visual Studio
  if ( MSVC )
  	SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${OUTPUT_DIRECTORY}")
  	SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${OUTPUT_DIRECTORY}")
  endif ( MSVC )
  
  include_directories(
  					${OPENGL_INCLUDE_DIRS}
  					${GLUT_INCLUDE_DIR}
  					${STIM_INCLUDE_DIRS}
            			#${ANN_INCLUDE_DIR}
  					${Boost_INCLUDE_DIR}
  					${CUDA_INCLUDE_DIRS}
  					${OpenCV_INCLUDE_DIRS}
  					)
  
  #Assign source files to the appropriate variables
  #file(GLOB SRC_CU "*.cu")
  #file(GLOB SRC_H "*.h")
  #file(GLOB SRC_CUH "*.h")
  
  #create an executable file
  cuda_add_executable(flow3 
  						main.cu
  						#${SRC_CUH}
  						)
  
  #set the link libraries
  target_link_libraries(flow3
  #						${OpenGL_LIBRARIES}
  						${OPENGL_gl_LIBRARY}
  						${OPENGL_glu_LIBRARY}
  						${GLUT_LIBRARIES}
  						${CMAKE_THREAD_LIBS_INIT}
              			#${ANN_LIBRARY}
  						${X11_LIBRARIES}
  						${CUDA_cublas_LIBRARY}
  						${OpenCV_LIBS}
  		  )
  
  #set up copying data files
  configure_file(data/h1_GT.obj ${CMAKE_CURRENT_BINARY_DIR}/h1_GT.obj @ONLY)
  configure_file(data/h2_GT.obj ${CMAKE_CURRENT_BINARY_DIR}/h2_GT.obj @ONLY)
  configure_file(data/00_GT.obj ${CMAKE_CURRENT_BINARY_DIR}/00_GT.obj @ONLY)