Blame view

CMakeLists.txt 1.85 KB
0d840342   David Mayerich   public release co...
1
  #Specify the version being used aswell as the language
ab01c2d7   David Mayerich   Edits to update S...
2
  cmake_minimum_required(VERSION 3.16)
0d840342   David Mayerich   public release co...
3
4
  
  #Name your project here
34f743be   David Mayerich   simplified CMakeL...
5
  project(genetic-gpu)
0d840342   David Mayerich   public release co...
6
7
8
9
  
  #set the module directory
  set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}")
  
34f743be   David Mayerich   simplified CMakeL...
10
  
0d840342   David Mayerich   public release co...
11
12
13
14
15
16
  
  #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 )
0d840342   David Mayerich   public release co...
17
  
0d840342   David Mayerich   public release co...
18
19
20
21
  
  
  
  #find packages-----------------------------------
0d840342   David Mayerich   public release co...
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
  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()
  
0d840342   David Mayerich   public release co...
43
44
45
46
47
  #find LAPACK and supporting link_libraries
  find_package(LAPACKE REQUIRED)
  
  #include include directories
  include_directories(${CUDA_INCLUDE_DIRS}
0d840342   David Mayerich   public release co...
48
49
  					${LAPACKE_INCLUDE_DIR}
  					${STIM_INCLUDE_DIRS}
0d840342   David Mayerich   public release co...
50
51
52
  					"${CMAKE_SOURCE_DIR}/src"
  )
  
34f743be   David Mayerich   simplified CMakeL...
53
  #collect all source files
0d840342   David Mayerich   public release co...
54
  include_directories("${CMAKE_SOURCE_DIR}/src")
34f743be   David Mayerich   simplified CMakeL...
55
  file(GLOB GA_GPU_SRC "${CMAKE_SOURCE_DIR}/src/*")
0d840342   David Mayerich   public release co...
56
57
58
  
  
  #create an executable file
34f743be   David Mayerich   simplified CMakeL...
59
  cuda_add_executable(genetic-gpu
0d840342   David Mayerich   public release co...
60
61
  		${GA_GPU_SRC}
  )
34f743be   David Mayerich   simplified CMakeL...
62
63
  
  target_link_libraries(genetic-gpu ${CUDA_LIBRARIES}
0d840342   David Mayerich   public release co...
64
65
66
67
68
  						 ${CUDA_CUBLAS_LIBRARIES}
  						 ${CUDA_CUFFT_LIBRARIES}
  						 ${LAPACKE_LIBRARIES}
  						 ${LAPACK_LIBRARIES}
  						 ${BLAS_LIBRARIES}
0d840342   David Mayerich   public release co...
69
  						 ${X11_LIBRARIES}
0d840342   David Mayerich   public release co...
70
71
72
  )
  
  
0d840342   David Mayerich   public release co...
73
74
  #if Boost is found, set an environment variable to use with preprocessor directives
  if(Boost_FILESYSTEM_FOUND)
34f743be   David Mayerich   simplified CMakeL...
75
  	target_link_libraries(genetic-gpu ${Boost_FILESYSTEM_LIBRARIES}
0d840342   David Mayerich   public release co...
76
77
  					 ${Boost_SYSTEM_LIBRARY}
  	)
0d840342   David Mayerich   public release co...
78
  endif(Boost_FILESYSTEM_FOUND)