-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
56 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,49 @@ | ||
set(GUROBI_ROOT_DIR "$ENV{GUROBI_ROOT_DIR}" CACHE PATH "Gurobi root directory.") | ||
message("Gurobi root" ${GUROBI_ROOT_DIR}) | ||
if(APPLE) | ||
file(GLOB dirs /Library/gurobi*) | ||
file(GLOB dirs /Library/gurobi1*) | ||
foreach(d in ${dirs}) | ||
string(REGEX MATCH "[0-9]+" GUROBI_VERSION "${d}") | ||
string(REGEX MATCH "[0-9]+" GUROBI_VERSION "${d}") | ||
endforeach(d) | ||
elseif(UNIX) | ||
file(GLOB dirs /opt/applications/gurobi/gurobi*) | ||
file(GLOB dirs ${GUROBI_ROOT_DIR}/gurobi1*) | ||
foreach(d in ${dirs}) | ||
string(REGEX MATCH "[0-9]+" GUROBI_VERSION "${d}") | ||
string(REGEX MATCH "[0-9]+" GUROBI_VERSION "${d}") | ||
endforeach(d) | ||
endif() | ||
|
||
message("Gurobi version ${GUROBI_VERSION}") | ||
if(APPLE) | ||
string(CONCAT GUROBI_DIR /Library/gurobi;${GUROBI_VERSION};/mac64) | ||
string(CONCAT GUROBI_DIR2 /Library/gurobi;${GUROBI_VERSION};/macos_universal2) | ||
string(CONCAT GUROBI_DIR /Library/gurobi;${GUROBI_VERSION};/macos_universal2) | ||
elseif(UNIX) | ||
string(CONCAT GUROBI_DIR /opt/applications/gurobi/gurobi;${GUROBI_VERSION};/linux64) | ||
string(CONCAT GUROBI_DIR ${GUROBI_ROOT_DIR};/gurobi;${GUROBI_VERSION};/linux64) | ||
endif() | ||
message("Looking for Gurobi in ${GUROBI_DIR}") | ||
|
||
string(SUBSTRING ${GUROBI_VERSION} 0 2 GUROBI_VERSION_SHORT) | ||
string(SUBSTRING ${GUROBI_VERSION} 0 3 GUROBI_VERSION_SHORT) | ||
|
||
message("Gurobi version short ${GUROBI_VERSION_SHORT}") | ||
|
||
find_path(GUROBI_INCLUDE_DIR gurobi_c++.h HINTS "${GUROBI_DIR}/include" "${GUROBI_DIR2}/include") | ||
find_library(GUROBI_LIBRARY libgurobi${GUROBI_VERSION_SHORT}.dylib HINTS ${GUROBI_DIR}/lib ${GUROBI_DIR2}/lib) | ||
find_library(GUROBI_CPP_LIBRARY libgurobi_c++.a HINTS ${GUROBI_DIR}/lib ${GUROBI_DIR2}/lib) | ||
|
||
find_path(GUROBI_INCLUDE_DIR gurobi_c++.h HINTS "${GUROBI_DIR}/include") | ||
if(APPLE) | ||
find_library(GUROBI_LIBRARY libgurobi${GUROBI_VERSION_SHORT}.dylib HINTS ${GUROBI_DIR}/lib) | ||
elseif(UNIX) | ||
find_library(GUROBI_LIBRARY libgurobi${GUROBI_VERSION_SHORT}.so HINTS ${GUROBI_DIR}/lib) | ||
endif() | ||
message("GUROBI_DIR ${GUROBI_DIR}") | ||
find_library(GUROBI_CPP_LIBRARY libgurobi_c++.a HINTS "${GUROBI_DIR}/lib") | ||
message("GUROBI_CPP_LIBRARY ${GUROBI_CPP_LIBRARY}") | ||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(GUROBI DEFAULT_MSG GUROBI_LIBRARY GUROBI_CPP_LIBRARY GUROBI_INCLUDE_DIR) | ||
|
||
if(GUROBI_FOUND) | ||
set(GRB_LICENSE_FILE "~/gurobi.research.lic") | ||
set(GRB_LICENSE_FILE "~/gurobi/gurobi.lic") | ||
set(GUROBI_INCLUDE_DIRS ${GUROBI_INCLUDE_DIR}) | ||
set(GUROBI_LIBRARIES ${GUROBI_CPP_LIBRARY} ${GUROBI_LIBRARY}) | ||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux") | ||
set(GUROBI_LIBRARIES "${GUROBI_LIBRARIES};m;pthread") | ||
endif(CMAKE_SYSTEM_NAME STREQUAL "Linux") | ||
message("CMAKE_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}") | ||
#if(CMAKE_SYSTEM_NAME STREQUAL "Linux") | ||
# set(GUROBI_LIBRARIES "${GUROBI_LIBRARIES};m;pthread") | ||
# endif(CMAKE_SYSTEM_NAME STREQUAL "Linux") | ||
endif(GUROBI_FOUND) | ||
|
||
mark_as_advanced(GUROBI_LIBRARY GUROBI_CPP_LIBRARY GUROBI_INCLUDE_DIR) | ||
mark_as_advanced(GUROBI_LIBRARY GUROBI_CPP_LIBRARY GUROBI_INCLUDE_DIR) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters