-
Notifications
You must be signed in to change notification settings - Fork 24
/
CMakeLists.txt
97 lines (82 loc) · 2.52 KB
/
CMakeLists.txt
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
project(DSP)
cmake_minimum_required(VERSION 3.5)
enable_language(CXX)
enable_language(Fortran)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
option(USE_MPI "indicate whether to detect and use mpi or not" TRUE)
include(color_scheme.cmake)
include(UserConfig.cmake)
set(DEPEND_DIR ${CMAKE_BINARY_DIR})
message(STATUS "The system information: ${CMAKE_SYSTEM}.${CMAKE_SYSTEM_PROCESSOR}")
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif(NOT CMAKE_BUILD_TYPE)
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
find_package(BLAS REQUIRED)
find_package(LAPACK REQUIRED)
find_package(ZLIB REQUIRED)
find_package(BZip2 REQUIRED)
if (USE_MPI)
find_package(MPI)
if (MPI_CXX_FOUND)
set(CMAKE_C_COMPILER ${MPI_C_COMPILER})
set(CMAKE_CXX_COMPILER ${MPI_CXX_COMPILER})
set(CMAKE_Fortran_COMPILER ${MPI_Fortran_COMPILER})
endif()
endif(USE_MPI)
if (NOT ${SCIPOPT_LIB_DIR} STREQUAL "")
find_library(SCIPLIB scip PATHS ${SCIPOPT_LIB_DIR})
if(SCIPLIB)
message(STATUS "Found ${SCIPLIB}")
else()
message(FATAL_ERROR "Could NOT find scip library.")
endif()
endif()
if (NOT ${MA27LIB_DIR} STREQUAL "")
find_library(MA27LIB ma27 PATHS ${MA27LIB_DIR})
if(MA27LIB)
message(STATUS "Found ${MA27LIB}")
else()
message(FATAL_ERROR "Could NOT find ma27 library.")
endif()
endif()
if (NOT ${CPLEX_LIB_DIR} STREQUAL "")
find_library(CPLEXLIB cplex PATHS ${CPLEX_LIB_DIR})
if(CPLEXLIB)
message(STATUS "Found ${CPLEXLIB}")
else()
message(FATAL_ERROR "Could NOT find cplex library.")
endif()
endif()
if(NOT ${GUROBI_LIB_DIR} STREQUAL "")
find_library(GUROBILIB NAMES gurobi90 PATHS ${GUROBI_LIB_DIR})
if(GUROBILIB)
message(STATUS "Found ${GUROBILIB}")
else()
message(FATAL_ERROR "Could NOT find libgurobi90: DSP only supports version 9 or later.")
endif()
endif()
if(SCIPLIB OR MA27LIB)
if(APPLE)
set(LIBRARY_PATH_VAR_NAME "DYLD_LIBRARY_PATH")
else(APPLE)
set(LIBRARY_PATH_VAR_NAME "LD_LIBRARY_PATH")
endif(APPLE)
find_library(GFORTRANLIB
NAMES gfortran libgfortran
PATHS ENV ${LIBRARY_PATH_VAR_NAME})
if(GFORTRANLIB)
message(STATUS "Found libgfortran: ${GFORTRANLIB}")
else(GFORTRANLIB)
message(FATAL_ERROR "gfortran library is required, but cannot be found. Please either locate the library to a searchable path or set a proper environment variable for the path.")
endif(GFORTRANLIB)
else()
set(GFORTRANLIB "")
endif()
option(CODE_COVERAGE "Enable coverage reporting" OFF)
option(UNIT_TESTING "Enable unit testing" OFF)
add_subdirectory(extra)
add_subdirectory(src)
enable_testing()
add_subdirectory(test)