FindGUROBI.cmake 2.85 KB
Newer Older
David Bommes's avatar
David Bommes committed
1
# - Try to find GUROBI
2
3
4

#  GUROBI_BASE - The libraries needed to use Gurobi

David Bommes's avatar
David Bommes committed
5
6
7
8
9
# Once done this will define
#  GUROBI_FOUND - System has Gurobi
#  GUROBI_INCLUDE_DIRS - The Gurobi include directories
#  GUROBI_LIBRARIES - The libraries needed to use Gurobi

10
11
12
13
14
set (GUROBI_ENABLE OFF CACHE BOOL "Enable gurobi?")

if ( GUROBI_ENABLE )
set (GUROBI_BASE "c:" CACHE PATH "Base path of your gurobi installation")

David Bommes's avatar
David Bommes committed
15
16
17
if (GUROBI_INCLUDE_DIR)
  # in cache already
  set(GUROBI_FOUND TRUE)
David Bommes's avatar
David Bommes committed
18
  set(GUROBI_INCLUDE_DIRS "${GUROBI_INCLUDE_DIR}" )
19
  set(GUROBI_LIBRARIES "${GUROBI_CXX_LIBRARY};${GUROBI_LIBRARY}" )
David Bommes's avatar
David Bommes committed
20
21
else (GUROBI_INCLUDE_DIR)

22
23
  

David Bommes's avatar
David Bommes committed
24
25
26
27
find_path(GUROBI_INCLUDE_DIR 
          NAMES gurobi_c++.h
          PATHS "$ENV{GUROBI_HOME}/include"
                  "/Library/gurobi502/mac64/include"
28
                  "/Library/gurobi562/mac64/include"
David Bommes's avatar
David Bommes committed
29
                 "C:\\libs\\gurobi502\\include"
30
                 "C:\\libs\\gurobi562\\include"
31
				 "${GUROBI_BASE}/include"
David Bommes's avatar
David Bommes committed
32
33
34
35
          )

find_library( GUROBI_LIBRARY 
              NAMES gurobi
36
                    gurobi65
Jan Möbius's avatar
Jan Möbius committed
37
	            gurobi60
38
39
40
                    gurobi56
                    gurobi55
                    gurobi51
David Bommes's avatar
David Bommes committed
41
                    gurobi50 
42
43
44
        		    gurobi46
				    gurobi45

David Bommes's avatar
David Bommes committed
45
              PATHS "$ENV{GUROBI_HOME}/lib" 
46
                    "/Library/gurobi562/mac64/lib"
David Bommes's avatar
David Bommes committed
47
                    "/Library/gurobi502/mac64/lib"
48
                    "C:\\libs\\gurobi562\\lib"
David Bommes's avatar
David Bommes committed
49
                    "C:\\libs\\gurobi502\\lib"
50
				    "${GUROBI_BASE}/lib"
David Bommes's avatar
David Bommes committed
51
52
              )

53
54
55
56
  if ( CMAKE_GENERATOR MATCHES "^Visual Studio 12.*Win64" )
    SET(GUROBI_LIB_NAME "gurobi_c++md2013")
  endif()
  
David Bommes's avatar
David Bommes committed
57
find_library( GUROBI_CXX_LIBRARY 
58
59
              NAMES gurobi_c++ 
			        ${GUROBI_LIB_NAME}
David Bommes's avatar
David Bommes committed
60
              PATHS "$ENV{GUROBI_HOME}/lib" 
61
                    "/Library/gurobi562/mac64/lib"
David Bommes's avatar
David Bommes committed
62
                    "/Library/gurobi502/mac64/lib"
63
                    "C:\\libs\\gurobi562\\lib"
David Bommes's avatar
David Bommes committed
64
                    "C:\\libs\\gurobi502\\lib"
65
					"${GUROBI_BASE}/lib"
David Bommes's avatar
David Bommes committed
66
              )
67
68
69
70
			  
# Binary dir for DLLs			
find_path(GUROBI_BIN_DIR 
                NAMES "gurobi60.dll" 
Matthias Möller's avatar
Matthias Möller committed
71
                PATHS "${GUROBI_INCLUDE_DIR}/../bin"
Jan Möbius's avatar
Jan Möbius committed
72
				      "${GUROBI_BASE}/bin"
73
74
                DOC "Directory containing the GUROBI DLLs"
               ) 		  
David Bommes's avatar
David Bommes committed
75
76

set(GUROBI_INCLUDE_DIRS "${GUROBI_INCLUDE_DIR}" )
77
set(GUROBI_LIBRARIES "${GUROBI_CXX_LIBRARY};${GUROBI_LIBRARY}" )
David Bommes's avatar
David Bommes committed
78
79
80
81
82
83
84
85

# use c++ headers as default
# set(GUROBI_COMPILER_FLAGS "-DIL_STD" CACHE STRING "Gurobi Compiler Flags")

include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LIBCPLEX_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(GUROBI  DEFAULT_MSG
86
                                  GUROBI_CXX_LIBRARY GUROBI_LIBRARY GUROBI_INCLUDE_DIR)
David Bommes's avatar
David Bommes committed
87

88
mark_as_advanced(GUROBI_INCLUDE_DIR GUROBI_LIBRARY GUROBI_CXX_LIBRARY GUROBI_BIN_DIR )
David Bommes's avatar
David Bommes committed
89

90
endif(GUROBI_INCLUDE_DIR)
91

92
endif()