Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update FindGUROBI.cmake to support Linux ARM64 GUROBI #220

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions FindGUROBI.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ if(EXISTS ${GUROBI_HOME} )
string(STRIP ${GUROBI_VER} GUROBI_VER )
message( "-- The retrieved version of Gurobi is: " ${GUROBI_VER} )

string(SUBSTRING ${GUROBI_VER} 0 2 GUROBI_VER_LIB)
string(SUBSTRING ${GUROBI_VER} 0 3 GUROBI_VER_LIB)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems for GUROBI v11 there is no need to cut the last digit, i.e. 110 needs to stay 110.


message( "-- The retrieved name of version-specific library is " gurobi ${GUROBI_VER_LIB} )

file( GLOB GUROBI_LIB_FILE ${GUROBI_HOME}/linux64/lib/libgurobi${GUROBI_VER_LIB}.* )
file( GLOB GUROBI_LIB_FILE ${GUROBI_HOME}/*linux64/lib/libgurobi${GUROBI_VER_LIB}.* )
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GUROBI for Linux ARM64 uses .../armlinux64/** as a base folder.

if( GUROBI_LIB_FILE )
message( "-- Gurobi library " ${GUROBI_LIB_FILE} " found in " ${GUROBI_HOME} "/linux64/lib/" )
message( "-- Gurobi library " ${GUROBI_LIB_FILE} " found in " ${GUROBI_HOME} "/*linux64/lib/" )
else()
file( GLOB GUROBI_LIB_FILE ${GUROBI_HOME}/mac64/lib/libgurobi${GUROBI_VER_LIB}.* )
if( GUROBI_LIB_FILE )
Expand All @@ -34,7 +34,7 @@ if(EXISTS ${GUROBI_HOME} )
if( GUROBI_LIB_FILE )
message( "-- Gurobi library " ${GUROBI_LIB_FILE} " found in " ${GUROBI_HOME} "/lib/" )
else()
message( FATAL_ERROR "libgurobi" ${GUROBI_VER_LIB} ".* not found either in " ${GUROBI_HOME} "/linux64/lib/ or " ${GUROBI_HOME} "/mac64/lib/ or " ${GUROBI_HOME} "/lib, please check the file exists and provide the correct PATH or manually set Gurobi's version. CMake will exit." )
message( FATAL_ERROR "libgurobi" ${GUROBI_VER_LIB} ".* not found either in " ${GUROBI_HOME} "/*linux64/lib/ or " ${GUROBI_HOME} "/mac64/lib/ or " ${GUROBI_HOME} "/lib, please check the file exists and provide the correct PATH or manually set Gurobi's version. CMake will exit." )
endif()
endif()
endif()
Expand All @@ -43,17 +43,17 @@ endif()

FIND_PATH(GUROBI_INCLUDE_DIR
NAMES "gurobi_c++.h" "gurobi_c.h"
PATHS /usr/local/gurobi751/linux64/include/ /Library/gurobi751/mac64/include/ ${GUROBI_HOME}/linux64/include/ ${GUROBI_HOME}/mac64/include/ ${GUROBI_HOME}/include/
PATHS /usr/local/gurobi751/linux64/include/ /Library/gurobi751/mac64/include/ ${GUROBI_HOME}/linux64/include/ ${GUROBI_HOME}/armlinux64/include/ ${GUROBI_HOME}/mac64/include/ ${GUROBI_HOME}/include/
DOC "Gurobi include directory")

FIND_LIBRARY(GUROBI_CPP_LIB
NAMES gurobi_c++
PATHS /usr/local/gurobi751/linux64/lib/ /Library/gurobi751/mac64/lib/ ${GUROBI_HOME}/linux64/lib/ ${GUROBI_HOME}/mac64/lib/ ${GUROBI_HOME}/lib/
PATHS /usr/local/gurobi751/linux64/lib/ /Library/gurobi751/mac64/lib/ ${GUROBI_HOME}/linux64/lib/ ${GUROBI_HOME}/armlinux64/lib/ ${GUROBI_HOME}/mac64/lib/ ${GUROBI_HOME}/lib/
DOC "Gurobi C++ Libraries")

FIND_LIBRARY(GUROBI_LIB
NAMES "gurobi${GUROBI_VER_LIB}"
PATHS /usr/local/gurobi751/linux64/lib/ /Library/gurobi751/mac64/lib/ ${GUROBI_HOME}/linux64/lib/ ${GUROBI_HOME}/mac64/lib/ ${GUROBI_HOME}/lib/
PATHS /usr/local/gurobi751/linux64/lib/ /Library/gurobi751/mac64/lib/ ${GUROBI_HOME}/linux64/lib/ ${GUROBI_HOME}/armlinux64/lib/ ${GUROBI_HOME}/mac64/lib/ ${GUROBI_HOME}/lib/
DOC "Gurobi C Libraries")

set(GUROBI_LIBRARIES ${GUROBI_CPP_LIB} ${GUROBI_LIB})
Expand Down