Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

Revision 9e180cdb4df1d8370ccd9aeee1499709441dbdd1 authored by Jan on 25 February 2022, 08:39:17 UTC, committed by Jan on 25 February 2022, 08:39:17 UTC
Missing finder call for QT5
1 parent 2f76d63
  • Files
  • Changes
  • 2fab760
  • /
  • finders
  • /
  • FindGurobi.cmake
Raw File Download

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • revision
  • directory
  • content
revision badge
swh:1:rev:9e180cdb4df1d8370ccd9aeee1499709441dbdd1
directory badge
swh:1:dir:b467608f81d4839ef837ea706e1aa65b45d5da44
content badge
swh:1:cnt:605e95f250d8074fa7af21e18022356dbc070aec

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • revision
  • directory
  • content
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
FindGurobi.cmake
# Once done this will define
#  Gurobi_FOUND - System has Gurobi
#  Targets:
#       Gurobi::GurobiC   - only the C interface
#       Gurobi::GurobiCXX - C and C++ interface

find_path(GUROBI_HOME
          NAMES include/gurobi_c++.h
          PATHS
          $ENV{GUROBI_HOME}
          "/opt/gurobi/linux64/"
          NO_DEFAULT_PATH # avoid finding /usr
          )

find_path(GUROBI_INCLUDE_DIR
    NAMES gurobi_c++.h
    HINTS
    "${GUROBI_HOME}/include"
    )
mark_as_advanced(GUROBI_INCLUDE_DIR)

set(GUROBI_BIN_DIR "${GUROBI_HOME}/bin")
set(GUROBI_LIB_DIR "${GUROBI_HOME}/lib")

if (WIN32)
    file(GLOB GUROBI_LIBRARY_LIST
        RELATIVE ${GUROBI_BIN_DIR}
        ${GUROBI_BIN_DIR}/gurobi*.dll
        )
else()
    file(GLOB GUROBI_LIBRARY_LIST
        RELATIVE ${GUROBI_LIB_DIR}
        ${GUROBI_LIB_DIR}/libgurobi*.so
        )
endif()

# Ignore libgurobiXY_light.so, libgurobi.so (without version):
string(REGEX MATCHALL
    "gurobi([0-9]+)\\..*"
    GUROBI_LIBRARY_LIST
    "${GUROBI_LIBRARY_LIST}"
    )

string(REGEX REPLACE
    ".*gurobi([0-9]+)\\..*"
    "\\1"
    GUROBI_LIBRARY_VERSIONS
    "${GUROBI_LIBRARY_LIST}")
list(LENGTH GUROBI_LIBRARY_VERSIONS GUROBI_NUMVER)

#message("GUROBI LIB VERSIONS: ${GUROBI_LIBRARY_VERSIONS}")

if (GUROBI_NUMVER EQUAL 0)
    message(STATUS "Found no Gurobi library version, GUROBI_HOME = ${GUROBI_HOME}.")
elseif (GUROBI_NUMVER EQUAL 1)
    list(GET GUROBI_LIBRARY_VERSIONS 0 GUROBI_LIBRARY_VERSION)
else()
    # none or more than one versioned library -let's try without suffix,
    # maybe the user added a symlink to the desired library
    message(STATUS "Found more than one Gurobi library version (${GUROBI_LIBRARY_VERSIONS}), trying without suffix. Set GUROBI_LIBRARY if you want to pick a certain one.")
    set(GUROBI_LIBRARY_VERSION "")
endif()

if (WIN32)
    find_library(GUROBI_LIBRARY
        NAMES "gurobi${GUROBI_LIBRARY_VERSION}"
        PATHS
        ${GUROBI_BIN_DIR}
    )
    find_library(GUROBI_IMPLIB
        NAMES "gurobi${GUROBI_LIBRARY_VERSION}"
        PATHS
        ${GUROBI_LIB_DIR}
    )
    mark_as_advanced(GUROBI_IMPLIB)
else ()
    find_library(GUROBI_LIBRARY
        NAMES "gurobi${GUROBI_LIBRARY_VERSION}"
        PATHS
        ${GUROBI_LIB_DIR}
    )
endif()
mark_as_advanced(GUROBI_LIBRARY)

if(GUROBI_LIBRARY AND NOT TARGET Gurobi::GurobiC)
    add_library(Gurobi::GurobiC SHARED IMPORTED)
    target_include_directories(Gurobi::GurobiC INTERFACE ${GUROBI_INCLUDE_DIR})
    set_target_properties(Gurobi::GurobiC PROPERTIES IMPORTED_LOCATION ${GUROBI_LIBRARY})
    if (GUROBI_IMPLIB)
        set_target_properties(Gurobi::GurobiC PROPERTIES IMPORTED_IMPLIB ${GUROBI_IMPLIB})
    endif()
endif()

# Gurobi ships with some compiled versions of its C++ library for specific
# compilers, however it also comes with the source code. We will compile
# the source code outselves -- this is much safer, as it guarantees the same
# compiler version and flags.
# (Note: doing this is motivated by actual sometimes-subtle ABI compatibility bugs)

find_path(GUROBI_SRC_DIR NAMES "Model.h" PATHS "${GUROBI_HOME}/src/cpp/")
mark_as_advanced(GUROBI_SRC_DIR)

file(GLOB GUROBI_CXX_SRC CONFIGURE_DEPENDS ${GUROBI_SRC_DIR}/*.cpp)
if(TARGET Gurobi::GurobiC AND GUROBI_CXX_SRC AND NOT TARGET Gurobi::GurobiCXX)
    add_library(GurobiCXX STATIC EXCLUDE_FROM_ALL ${GUROBI_CXX_SRC})
    add_library(Gurobi::GurobiCXX ALIAS GurobiCXX)

    target_compile_options(GurobiCXX
        PRIVATE
        $<$<CXX_COMPILER_ID:GNU>:-Wno-deprecated-copy>
        $<$<CXX_COMPILER_ID:Clang>:-Wno-deprecated-copy>
        )

    if(MSVC)
        target_compile_definitions(GurobiCXX PRIVATE "WIN64")
    endif()

    target_include_directories(GurobiCXX PUBLIC ${GUROBI_INCLUDE_DIR})
    target_link_libraries(GurobiCXX PUBLIC Gurobi::GurobiC)
    # We need to be able to link this into a shared library:
    set_target_properties(GurobiCXX PROPERTIES POSITION_INDEPENDENT_CODE ON)

endif()

# legacy support:
set(GUROBI_INCLUDE_DIRS "${GUROBI_INCLUDE_DIR}")
set(GUROBI_LIBRARIES Gurobi::GurobiC Gurobi::GurobiCXX)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Gurobi  DEFAULT_MSG GUROBI_LIBRARY GUROBI_INCLUDE_DIR GUROBI_SRC_DIR)

The diff you're trying to view is too large. Only the first 1000 changed files have been loaded.
Showing with 0 additions and 0 deletions (0 / 0 diffs computed)
swh spinner

Computing file changes ...

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API