Blame view

CMakeLists.txt 3.71 KB
0d840342   David Mayerich   public release co...
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
  #Specify the version being used aswell as the language
  cmake_minimum_required(VERSION 2.8)
  
  #Name your project here
  project(ga-gpu)
  
  #set the module directory
  set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}")
  
  #default to release mode
  if(NOT CMAKE_BUILD_TYPE) 
  	set(CMAKE_BUILD_TYPE Release)
  endif(NOT CMAKE_BUILD_TYPE)
  
  #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 )
  #MAYBE REMOVE-----------------
  #set C++11 flags if using GCC
  if( CMAKE_COMPILER_IS_GNUCC )
  #	SET( CMAKE_CXX_FLAGS "-std=c++11")
  	set(CMAKE_CXX_FLAGS "-std=c++11 -D_FORCE_INLINES")
  #	SET( CUDA_NVCC_FLAGS "-std=c++11")
  endif( CMAKE_COMPILER_IS_GNUCC )
  
  SET( CUDA_NVCC_FLAGS "--gpu-architecture=compute_50 --gpu-code=sm_50,compute_50")
  #-----------------------------
  
  
  
  #find packages-----------------------------------
  #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 STIM library
  find_package(STIM)
  
  #find CUDA, mostly for LA stuff using cuBLAS
  find_package(CUDA REQUIRED)
  
  #find Boost for Unix-based file lists
  if( CMAKE_COMPILER_IS_GNUCC )
  	find_package(Boost COMPONENTS filesystem system)
  	if(Boost_FOUND)
  		include_directories(${Boost_INCLUDE_DIR})
  	else()
  		message(FATAL_ERROR "HSIproc requires Boost::filesystem and Boost::system when using GCC")
  	endif()
  endif()
  
  #find FANN
  #find_package(FANN REQUIRED)
  
  #find the GLUT library for visualization
  #find_package(OpenGL REQUIRED)
  #find_package(GLUT REQUIRED)
  #if(WIN32)
  #	find_package(GLEW REQUIRED)
  #	include_directories(${GLEW_INCLUDE_DIR})
  #endif(WIN32)
  
  #find LAPACK and supporting link_libraries
  find_package(LAPACKE REQUIRED)
  
  #include include directories
  include_directories(${CUDA_INCLUDE_DIRS}
  					${OpenCV_INCLUDE_DIRS}
  					${LAPACKE_INCLUDE_DIR}
  					${STIM_INCLUDE_DIRS}
  					${OpenGL_INCLUDE_DIRS}
  #					${GLUT_INCLUDE_DIR}
  					${FANN_INCLUDE_DIRS}
  					"${CMAKE_SOURCE_DIR}/src"
  )
  
  #Assign a variable for all of the header files in this project
  include_directories("${CMAKE_SOURCE_DIR}/src")
  #file(GLOB GACPU_H "${CMAKE_SOURCE_DIR}/src/gacpu/*.h")
  file(GLOB GAGPU_H "${CMAKE_SOURCE_DIR}/src/*.h")
  #file(GLOB GA_H "${CMAKE_SOURCE_DIR}/src/*.h")
  
  #Assign source files to the appropriate variables to easily associate them with executables
  #file(GLOB GA_CPU_SRC "${CMAKE_SOURCE_DIR}/src/gacpu/*.cpp")
  file(GLOB GA_GPU_SRC "${CMAKE_SOURCE_DIR}/src/*.c*")
  
  
  #create an executable file
  cuda_add_executable(ga-gpu
  		${GAGPU_H}
  #		${GA_H}
  		${GA_GPU_SRC}
  )
  target_link_libraries(ga-gpu ${CUDA_LIBRARIES}
  						 ${CUDA_CUBLAS_LIBRARIES}
  						 ${CUDA_CUFFT_LIBRARIES}
  						 ${LAPACKE_LIBRARIES}
  						 ${LAPACK_LIBRARIES}
  						 ${BLAS_LIBRARIES}
  						 ${CMAKE_THREAD_LIBS_INIT}
  						 ${X11_LIBRARIES}
  						 ${OpenCV_LIBS}
  )
  
  
  #create the PROC executable----------------------------------------------
  
  #create an executable file
  #add_executable(hsiga
  #		${GACPU_H}
  #		${GA_H}
  #		${GA_CPU_SRC}
  #)
  #target_link_libraries(hsiga ${LAPACKE_LIBRARIES}
  #						 ${LAPACK_LIBRARIES}
  #						 ${BLAS_LIBRARIES}
  #						 ${CMAKE_THREAD_LIBS_INIT}
  #						 ${X11_LIBRARIES}
  #						 ${OpenCV_LIBS}
  #)
  
  
  
  #if Boost is found, set an environment variable to use with preprocessor directives
  if(Boost_FILESYSTEM_FOUND)
  #	if(BUILD_GACPU)	
  #		target_link_libraries(hsiga ${Boost_FILESYSTEM_LIBRARIES}
  #					      ${Boost_SYSTEM_LIBRARY}
  #		)
  		#message(${Boost_FILESYSTEM_LIBRARIES})
  #	endif(BUILD_GACPU)
  #	if(BUILD_GAGPU)
  	target_link_libraries(ga-gpu ${Boost_FILESYSTEM_LIBRARIES}
  					 ${Boost_SYSTEM_LIBRARY}
  	)
  #	endif(BUILD_GAGPU)	
  endif(Boost_FILESYSTEM_FOUND)