CMakeLists.txt 3.88 KB
Newer Older
myron's avatar
myron committed
1
2
3
4
5
6
7
8
9
10
11
12
cmake_minimum_required (VERSION 3.8)

option (USE_STATIC_LIBRARIES "Link with static libraries if available" OFF)
option (TRY_CUDA  "compile Cuda files" OFF)
# c++ as a basis
project (FRSV LANGUAGES  CXX  C)

# optionally we can use cuda
# to compile conditionally
include(CheckLanguage)


myron's avatar
myron committed
13
14
15
16
17

find_package(HighFive REQUIRED)



myron's avatar
myron committed
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
find_package(MPI )

if(MPI_C_FOUND)
  message(STATUS "YES :  MPI support: configured variable   MPI_C_COMPILER  = ${MPI_C_COMPILER}      " ) 
  message(STATUS "                                          MPI_C_COMPILE_FLAGS  = ${MPI_C_COMPILEFLAGS}      " ) 
  message(STATUS "                                          MPI_C_INCLUDE_PATH   = ${MPI_C_INCLUDE_PATH}      " ) 
  message(STATUS "                                          MPI_C_LINK_FLAGS   = ${MPI_C_LINK_FLAGS}      " ) 
  message(STATUS "                                          MPI_C_ LIBRARIES   = ${MPI_C_LIBRARIES}      " ) 
  message(STATUS "                                          MPI_CXX_COMPILER  = ${MPI_CXX_COMPILER}      " ) 
  message(STATUS "                                          MPI_CXX_COMPILE_FLAGS  = ${MPI_CXX_COMPILEFLAGS}      " ) 
  message(STATUS "                                          MPI_CXX_INCLUDE_PATH   = ${MPI_CXX_INCLUDE_PATH}      " ) 
  message(STATUS "                                          MPI_CXX_LINK_FLAGS   = ${MPI_CXX_LINK_FLAGS}      " ) 
  message(STATUS "                                          MPI_CXX_ LIBRARIES   = ${MPI_CXX_LIBRARIES}      " ) 
endif()



find_package(Boost 1.50 REQUIRED COMPONENTS filesystem system)
message(STATUS "Boost version: ${Boost_VERSION}")
if(Boost_FOUND)
  message(" FOUND Boost")
  message(  Boost_INCLUDEDIR "${BOOST_INCLUDE_DIR}"  ) 
  message(  Boost_LIBRARY_DIR_RELEASE "${BOOST_LIBRARY_DIR_RELEASE}"  ) 
  message(   "${}"  ) 
  message(   "${}"  ) 
endif()


find_package(Yaml-cpp)

if(Yaml-cpp_FOUND)
  message(" FOUND YAML-CPP")
  message(STATUS "YAML_CPP_INCLUDE_DIR  ${YAML_CPP_INCLUDE_DIR} "  ) 
  message(STATUS "YAML_CPP_LIBRARIES  ${YAML_CPP_LIBRARIES} "  ) 
  message(STATUS "                                              YAML_CPP_VERSION         = ${YAML_CPP_VERSION}      " ) 
  message(STATUS "                                              YAML_CPP_LIBRARY_DIR         = ${YAML_CPP_LIBRARY_DIR}      " ) 
endif()

include(CheckCXXCompilerFlag)


# The version number.
set (FRSV_VERSION_MAJOR 1)
set (FRSV_VERSION_MINOR 0)

# Set minimum C++ to 2011 standards
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)


      
# configure a header file to pass some of the CMake settings
# to the source code
configure_file (
  "${PROJECT_SOURCE_DIR}/FRSVConfig.h.in"
  "${PROJECT_BINARY_DIR}/FRSVConfig.h"
  )


# add the binary tree to the search path for include files
# so that we will find FRSVConfig.h
include_directories("${PROJECT_BINARY_DIR}")

set(CMAKE_BUILD_TYPE RELEASE)

if(NOT CMAKE_BUILD_TYPE)
  set(CMAKE_BUILD_TYPE DEBUG)
endif()

myron's avatar
myron committed
87
88
89
90
91
92
93
94
95
96

find_package(OpenMP)
if (OPENMP_FOUND)
    set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
    set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
  endif()

  

myron's avatar
myron committed
97
98
99
100
101
102
103
104
105
106
## set(CMAKE_CXX_FLAGS "-Wextra -Wall  -mfpmath=sse -Ofast -flto -mcpu=native  ${CMAKE_CXX_FLAGS} "  )
set(CMAKE_CXX_FLAGS_DEBUG "-g -Wextra -Wall -fopenmp ${CMAKE_CXX_FLAGS} "  )
set(CMAKE_CXX_FLAGS_RELEASE " -g -Wextra -Wall -fopenmp  -Ofast  -mtune=native${CMAKE_CXX_FLAGS}  "  )
## set(CMAKE_CXX_FLAGS_PIPPO "-g -Wextra -Wall  -Ofast -flto -mtune=native ${CMAKE_CXX_FLAGS}"     )
set(CMAKE_CXX_FLAGS_PIPPO "-g -Wextra -Wall   ${CMAKE_CXX_FLAGS}"     )

# set(CMAKE_CXX_FLAGS "-g -Wextra -Wall -mfpmath=sse -Ofast -mtune=native  ${CMAKE_CXX_FLAGS}"     )

add_executable (frsv frsv.cc)

myron's avatar
myron committed
107
target_link_libraries( frsv  PRIVATE yaml-cpp  Boost::filesystem Boost::system   HighFive )
myron's avatar
myron committed
108
109
target_include_directories ( frsv  PRIVATE   "${PROJECT_SOURCE_DIR}")