FindGUROBI.cmake 2.82 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
			        gurobi60
37
38
39
                    gurobi56
                    gurobi55
                    gurobi51
David Bommes's avatar
David Bommes committed
40
                    gurobi50 
41
42
43
        		    gurobi46
				    gurobi45

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

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

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

# 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
85
                                  GUROBI_CXX_LIBRARY GUROBI_LIBRARY GUROBI_INCLUDE_DIR)
David Bommes's avatar
David Bommes committed
86

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

89
endif(GUROBI_INCLUDE_DIR)
90
91

endif()