-
Notifications
You must be signed in to change notification settings - Fork 42
/
FindGUROBI.cmake
executable file
·112 lines (96 loc) · 4.24 KB
/
FindGUROBI.cmake
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
# ------------------------------------------------------------------------------
# Copyright (C) 2015 by Liangliang Nan ([email protected])
# https://3d.bk.tudelft.nl/liangliang/
#
# This file is part of Easy3D. If it is useful in your research/work,
# I would be grateful if you show your appreciation by citing it:
# ------------------------------------------------------------------
# Liangliang Nan.
# Easy3D: a lightweight, easy-to-use, and efficient C++
# library for processing and rendering 3D data. 2018.
# ------------------------------------------------------------------
#
# Easy3D is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License Version 3
# as published by the Free Software Foundation.
#
# Easy3D is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# ------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
# This file sets up Gurobi for CMake. Once done this will define
#
# GUROBI_FOUND - system has GUROBI
# GUROBI_INCLUDE_DIRS - the GUROBI include directories
# GUROBI_LIBRARIES - Link these to use GUROBI
#
# In your CMakeLists file, you need to add, e.g. (modify it if necessary):
# if (GUROBI_FOUND)
# message(STATUS "Gurobi include dir: " ${GUROBI_INCLUDE_DIRS})
# message(STATUS "Gurobi libraries: " ${GUROBI_LIBRARIES})
# target_compile_definitions(${PROJECT_NAME} PUBLIC HAS_GUROBI)
# target_include_directories(${PROJECT_NAME} PRIVATE ${GUROBI_INCLUDE_DIRS})
# target_link_libraries(${PROJECT_NAME} PRIVATE ${GUROBI_LIBRARIES})
# endif()
# ------------------------------------------------------------------------------
# Is it already configured?
if (NOT GUROBI_FOUND)
# Hardcoded search paths
set(SEARCH_PATHS_FOR_HEADERS
"$ENV{GUROBI_HOME}/include"
"/Library/gurobi1200/macos_universal2/include"
"/Library/gurobi1003/macos_universal2/include"
"/Library/gurobi952/macos_universal2/include"
"/home/geo3d/dev/gurobi1200/include"
"D:\\dev\\Gurobi-10.0.3\\win64\\include"
)
set(SEARCH_PATHS_FOR_LIBRARIES
"$ENV{GUROBI_HOME}/lib"
"/Library/gurobi1200/macos_universal2/lib"
"/Library/gurobi1003/macos_universal2/lib"
"/Library/gurobi952/macos_universal2/lib"
"/home/geo3d/dev/gurobi1200/lib"
"D:\\dev\\Gurobi-10.0.3\\win64\\lib"
)
find_path(GUROBI_INCLUDE_DIR gurobi_c++.h
PATHS ${SEARCH_PATHS_FOR_HEADERS}
)
find_library(GUROBI_C_LIBRARY
NAMES gurobi120 gurobi100 libgurobi
PATHS ${SEARCH_PATHS_FOR_LIBRARIES}
)
find_library(GUROBI_CXX_LIBRARY_DEBUG
NAMES gurobi_c++ gurobi_c++mdd2017
PATHS ${SEARCH_PATHS_FOR_LIBRARIES}
)
find_library(GUROBI_CXX_LIBRARY_RELEASE
NAMES gurobi_c++ gurobi_c++md2017
PATHS ${SEARCH_PATHS_FOR_LIBRARIES}
)
# setup header file directories
set(GUROBI_INCLUDE_DIRS ${GUROBI_INCLUDE_DIR})
# setup libraries files
set(GUROBI_LIBRARIES
debug ${GUROBI_CXX_LIBRARY_DEBUG}
optimized ${GUROBI_CXX_LIBRARY_RELEASE}
${GUROBI_C_LIBRARY}
)
endif ()
# Check that Gurobi was successfully found
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GUROBI DEFAULT_MSG GUROBI_INCLUDE_DIRS)
find_package_handle_standard_args(GUROBI DEFAULT_MSG GUROBI_LIBRARIES)
# Hide variables from CMake-Gui options
mark_as_advanced(
GUROBI_INCLUDE_DIRS
GUROBI_INCLUDE_DIR
GUROBI_LIBRARIES
GUROBI_CXX_LIBRARY_DEBUG
GUROBI_CXX_LIBRARY_RELEASE
GUROBI_C_LIBRARY
)