COIN-OR::LEMON - Graph Library

Ticket #658: cmake_rework.diff

File cmake_rework.diff, 72.9 KB (added by David Torres Sanchez, 2 years ago)
  • CMakeLists.txt

    diff -r a278d16bd2d0 CMakeLists.txt
    a b  
    1 CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
    2 
    3 IF(POLICY CMP0048)
    4   CMAKE_POLICY(SET CMP0048 OLD)
    5 ENDIF(POLICY CMP0048)
    6 
    7 IF(POLICY CMP0043)
    8   CMAKE_POLICY(SET CMP0043 NEW)
    9 ENDIF(POLICY CMP0043)
     1#[[
     2This file is a part of LEMON, a generic C++ optimization library.
    103
    11 IF(POLICY CMP0026)
    12   #This is for copying the dll's needed by glpk (in lp_test and mip_test)
    13   CMAKE_POLICY(SET CMP0026 NEW)
    14 ENDIF(POLICY CMP0026)
    15 
    16 SET(PROJECT_NAME "LEMON")
    17 PROJECT(${PROJECT_NAME})
    18 
    19 INCLUDE(FindPythonInterp)
    20 INCLUDE(FindWget)
     4Copyright (C) 2003-2021
     5Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     6(Egervary Research Group on Combinatorial Optimization, EGRES).
    217
    22 IF(EXISTS ${PROJECT_SOURCE_DIR}/cmake/version.cmake)
    23   INCLUDE(${PROJECT_SOURCE_DIR}/cmake/version.cmake)
    24 ELSEIF(DEFINED ENV{LEMON_VERSION})
    25   SET(LEMON_VERSION $ENV{LEMON_VERSION} CACHE STRING "LEMON version string.")
    26 ELSE()
    27   EXECUTE_PROCESS(
    28     COMMAND
    29     hg log -r. --template "{latesttag}"
    30     WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
    31     OUTPUT_VARIABLE HG_REVISION_TAG
    32     ERROR_QUIET
    33     OUTPUT_STRIP_TRAILING_WHITESPACE
    34   )
    35   EXECUTE_PROCESS(
    36     COMMAND
    37     hg log -r. --template "{latesttagdistance}"
    38     WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
    39     OUTPUT_VARIABLE HG_REVISION_DIST
    40     ERROR_QUIET
    41     OUTPUT_STRIP_TRAILING_WHITESPACE
    42   )
    43   EXECUTE_PROCESS(
    44     COMMAND
    45     hg log -r. --template "{node|short}"
    46     WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
    47     OUTPUT_VARIABLE HG_REVISION_ID
    48     ERROR_QUIET
    49     OUTPUT_STRIP_TRAILING_WHITESPACE
    50   )
     8Permission to use, modify and distribute this software is granted
     9provided that this copyright notice appears in all copies. For
     10precise terms see the accompanying LICENSE file.
    5111
    52   IF(HG_REVISION_TAG STREQUAL "")
    53     SET(HG_REVISION_ID "hg-tip")
    54   ELSE()
    55     IF(HG_REVISION_TAG STREQUAL "null")
    56       SET(HG_REVISION_TAG "trunk")
    57     ELSEIF(HG_REVISION_TAG MATCHES "^r")
    58       STRING(SUBSTRING ${HG_REVISION_TAG} 1 -1 HG_REVISION_TAG)
    59     ENDIF()
    60     IF(HG_REVISION_DIST STREQUAL "0")
    61       SET(HG_REVISION ${HG_REVISION_TAG})
    62     ELSE()
    63       SET(HG_REVISION
    64         "${HG_REVISION_TAG}+${HG_REVISION_DIST}-${HG_REVISION_ID}")
    65     ENDIF()
    66   ENDIF()
     12This software is provided "AS IS" with no warranty of any kind,
     13express or implied, and with no claim as to its suitability for any
     14purpose.
     15]]
    6716
    68   SET(LEMON_VERSION ${HG_REVISION} CACHE STRING "LEMON version string.")
    69 ENDIF()
    70 
    71 SET(PROJECT_VERSION ${LEMON_VERSION})
    72 
    73 SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
    74 
    75 FIND_PACKAGE(Doxygen)
    76 FIND_PACKAGE(Ghostscript)
    77 
    78 IF(WIN32)
    79   SET(LEMON_WIN32 TRUE)
    80 ENDIF(WIN32)
    81 
    82 SET(LEMON_ENABLE_GLPK YES CACHE STRING "Enable GLPK solver backend.")
    83 SET(LEMON_ENABLE_ILOG YES CACHE STRING "Enable ILOG (CPLEX) solver backend.")
    84 SET(LEMON_ENABLE_COIN YES CACHE STRING "Enable COIN solver backend.")
    85 SET(LEMON_ENABLE_SOPLEX YES CACHE STRING "Enable SoPlex solver backend.")
     17#[[
     18This file defines the build options and orchestrates the build by including
     19files in the cmake directory.
     20]]
    8621
    87 IF(LEMON_ENABLE_GLPK)
    88   FIND_PACKAGE(GLPK 4.33)
    89   IF(GLPK_FOUND)
    90     SET(LEMON_HAVE_LP TRUE)
    91     SET(LEMON_HAVE_MIP TRUE)
    92     SET(LEMON_HAVE_GLPK TRUE)
    93   ENDIF(GLPK_FOUND)
    94 ENDIF(LEMON_ENABLE_GLPK)
    95 IF(LEMON_ENABLE_ILOG)
    96   FIND_PACKAGE(ILOG)
    97   IF(ILOG_FOUND)
    98     SET(LEMON_HAVE_LP TRUE)
    99     SET(LEMON_HAVE_MIP TRUE)
    100     SET(LEMON_HAVE_CPLEX TRUE)
    101   ENDIF(ILOG_FOUND)
    102 ENDIF(LEMON_ENABLE_ILOG)
    103 IF(LEMON_ENABLE_COIN)
    104   FIND_PACKAGE(COIN)
    105   IF(COIN_FOUND)
    106     SET(LEMON_HAVE_LP TRUE)
    107     SET(LEMON_HAVE_MIP TRUE)
    108     SET(LEMON_HAVE_CLP TRUE)
    109     SET(LEMON_HAVE_CBC TRUE)
    110   ENDIF(COIN_FOUND)
    111 ENDIF(LEMON_ENABLE_COIN)
    112 IF(LEMON_ENABLE_SOPLEX)
    113   FIND_PACKAGE(SOPLEX)
    114   IF(SOPLEX_FOUND)
    115     SET(LEMON_HAVE_LP TRUE)
    116     SET(LEMON_HAVE_SOPLEX TRUE)
    117   ENDIF(SOPLEX_FOUND)
    118 ENDIF(LEMON_ENABLE_SOPLEX)
     22cmake_minimum_required(VERSION 3.15)
     23list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
    11924
    120 IF(ILOG_FOUND)
    121   SET(DEFAULT_LP "CPLEX")
    122   SET(DEFAULT_MIP "CPLEX")
    123 ELSEIF(COIN_FOUND)
    124   SET(DEFAULT_LP "CLP")
    125   SET(DEFAULT_MIP "CBC")
    126 ELSEIF(GLPK_FOUND)
    127   SET(DEFAULT_LP "GLPK")
    128   SET(DEFAULT_MIP "GLPK")
    129 ELSEIF(SOPLEX_FOUND)
    130   SET(DEFAULT_LP "SOPLEX")
    131 ENDIF()
     25project(
     26  LEMON
     27  VERSION 1.4.0
     28  LANGUAGES CXX C)
    13229
    133 IF(NOT LEMON_DEFAULT_LP OR
    134     (NOT ILOG_FOUND AND (LEMON_DEFAULT_LP STREQUAL "CPLEX")) OR
    135     (NOT COIN_FOUND AND (LEMON_DEFAULT_LP STREQUAL "CLP")) OR
    136     (NOT GLPK_FOUND AND (LEMON_DEFAULT_LP STREQUAL "GLPK")) OR
    137     (NOT SOPLEX_FOUND AND (LEMON_DEFAULT_LP STREQUAL "SOPLEX")))
    138   SET(LEMON_DEFAULT_LP ${DEFAULT_LP} CACHE STRING
    139     "Default LP solver backend (GLPK, CPLEX, CLP or SOPLEX)" FORCE)
    140 ELSE()
    141   SET(LEMON_DEFAULT_LP ${DEFAULT_LP} CACHE STRING
    142     "Default LP solver backend (GLPK, CPLEX, CLP or SOPLEX)")
    143 ENDIF()
    144 IF(NOT LEMON_DEFAULT_MIP OR
    145     (NOT ILOG_FOUND AND (LEMON_DEFAULT_MIP STREQUAL "CPLEX")) OR
    146     (NOT COIN_FOUND AND (LEMON_DEFAULT_MIP STREQUAL "CBC")) OR
    147     (NOT GLPK_FOUND AND (LEMON_DEFAULT_MIP STREQUAL "GLPK")))
    148   SET(LEMON_DEFAULT_MIP ${DEFAULT_MIP} CACHE STRING
    149     "Default MIP solver backend (GLPK, CPLEX or CBC)" FORCE)
    150 ELSE()
    151   SET(LEMON_DEFAULT_MIP ${DEFAULT_MIP} CACHE STRING
    152     "Default MIP solver backend (GLPK, CPLEX or CBC)")
    153 ENDIF()
    154 
    155 IF( ( ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") AND
    156       ("${CMAKE_CXX_COMPILER_VERSION}" VERSION_GREATER_EQUAL "4.8") )
    157     OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
    158     OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
    159     )
    160   SET(LEMON_NO_UNUSED_LOCAL_TYPEDEF_WARNINGS TRUE)
    161 ENDIF()
     30# OS
     31if(WIN32)
     32  set(LEMON_WIN32 ON)
     33endif()
    16234
    163 IF(DEFINED ENV{LEMON_CXX_WARNING})
    164   SET(CXX_WARNING $ENV{LEMON_CXX_WARNING})
    165 ELSE()
    166   IF( ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
    167       OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
    168       )
    169     SET(CXX_WARNING "-Wall -W -Wunused -Wformat=2 -Wctor-dtor-privacy -Wnon-virtual-dtor -Wno-char-subscripts -Wwrite-strings -Wno-char-subscripts -Wreturn-type -Wcast-qual -Wcast-align -Wsign-promo -Woverloaded-virtual -fno-strict-aliasing -Wold-style-cast -Wno-unknown-pragmas")
    170     SET(CMAKE_CXX_FLAGS_DEBUG CACHE STRING "-ggdb")
    171     SET(CMAKE_C_FLAGS_DEBUG CACHE STRING "-ggdb")
    172   ELSEIF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
    173     SET(CXX_WARNING "-Wall -W -Wunused -Wformat=2 -Wnon-virtual-dtor -Wno-char-subscripts -Wwrite-strings -Wno-char-subscripts -Wreturn-type -Wcast-qual -Wsign-promo -Woverloaded-virtual -fno-strict-aliasing -Wno-unknown-pragmas")
    174     SET(CMAKE_CXX_FLAGS_DEBUG CACHE STRING "-ggdb")
    175     SET(CMAKE_C_FLAGS_DEBUG CACHE STRING "-ggdb")
    176   ELSEIF(MSVC)
    177     # This part is unnecessary 'casue the same is set by the lemon/core.h.
    178     # Still kept as an example.
     35# Building Options #
    17936
    180     # SET(CXX_WARNING "/wd4250 /wd4267 /wd4355 /wd4503 /wd4800 /wd4996")
    181 
    182     # Suppressed warnings:
    183     # C4250: 'class1' : inherits 'class2::member' via dominance
    184     # C4267: conversion from 'size_t' to 'type', possible loss of data
    185     # C4355: 'this' : used in base member initializer list
    186     # C4503: 'function' : decorated name length exceeded, name was truncated
    187     # C4800: 'type' : forcing value to bool 'true' or 'false'
    188     #        (performance warning)
    189     # C4996: 'function': was declared deprecated
    190   ELSE()
    191     SET(CXX_WARNING "-Wall")
    192   ENDIF()
    193 ENDIF()
    194 SET(LEMON_CXX_WARNING_FLAGS ${CXX_WARNING} CACHE STRING "LEMON warning flags.")
    195 
    196 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LEMON_CXX_WARNING_FLAGS}")
     37# Solvers
     38option(LEMON_ENABLE_GLPK "Enable GLPK solver backend." OFF)
     39option(LEMON_ENABLE_ILOG "Enable ILOG (CPLEX) solver backend." OFF)
     40option(LEMON_ENABLE_COIN "Enable COIN solver backend." OFF)
     41option(LEMON_ENABLE_SOPLEX "Enable SoPlex solver backend." OFF)
    19742
    198 IF(MSVC)
    199   SET( CMAKE_CXX_FLAGS "/bigobj ${CMAKE_CXX_FLAGS}")
    200   SET( CMAKE_CXX_FLAGS_MAINTAINER "/WX ${CMAKE_CXX_FLAGS_DEBUG}" CACHE STRING
    201     "Flags used by the C++ compiler during maintainer builds." FORCE
    202     )
    203   SET( CMAKE_C_FLAGS_MAINTAINER "/WX ${CMAKE_CXX_FLAGS_DEBUG}" CACHE STRING
    204     "Flags used by the C compiler during maintainer builds." FORCE
    205     )
    206   SET( CMAKE_EXE_LINKER_FLAGS_MAINTAINER
    207     "${CMAKE_EXE_LINKER_FLAGS_DEBUG}" CACHE STRING
    208     "Flags used for linking binaries during maintainer builds." FORCE
    209     )
    210   SET( CMAKE_SHARED_LINKER_FLAGS_MAINTAINER
    211     "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}" CACHE STRING
    212     "Flags used by the shared libraries linker during maintainer builds."
    213      FORCE
    214     )
    215 ELSE()
    216   SET( CMAKE_CXX_FLAGS_MAINTAINER "-Werror -ggdb -O0" CACHE STRING
    217     "Flags used by the C++ compiler during maintainer builds." FORCE
    218     )
    219   SET( CMAKE_C_FLAGS_MAINTAINER "-Werror -O0" CACHE STRING
    220     "Flags used by the C compiler during maintainer builds." FORCE
    221     )
    222   SET( CMAKE_EXE_LINKER_FLAGS_MAINTAINER
    223     "${CMAKE_EXE_LINKER_FLAGS_DEBUG}" CACHE STRING
    224     "Flags used for linking binaries during maintainer builds." FORCE
    225     )
    226   SET( CMAKE_SHARED_LINKER_FLAGS_MAINTAINER
    227     "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}" CACHE STRING
    228     "Flags used by the shared libraries linker during maintainer builds." FORCE)
    229 ENDIF()
    230 
    231 MARK_AS_ADVANCED(
    232     CMAKE_CXX_FLAGS_MAINTAINER
    233     CMAKE_C_FLAGS_MAINTAINER
    234     CMAKE_EXE_LINKER_FLAGS_MAINTAINER
    235     CMAKE_SHARED_LINKER_FLAGS_MAINTAINER )
    236 
    237 IF(CMAKE_CONFIGURATION_TYPES)
    238   LIST(APPEND CMAKE_CONFIGURATION_TYPES Maintainer)
    239   LIST(REMOVE_DUPLICATES CMAKE_CONFIGURATION_TYPES)
    240   SET(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING
    241       "Add the configurations that we need"
    242       FORCE)
    243  endif()
    244 
    245 IF(NOT CMAKE_BUILD_TYPE)
    246   SET(CMAKE_BUILD_TYPE "Release")
    247 ENDIF()
    248 
    249 SET( CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING
    250     "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel Maintainer."
    251     FORCE )
     43# Maintainer only options
     44option(LEMON_BUILD_DOCS "" OFF)
     45option(LEMON_BUILD_TOOLS "" OFF)
     46option(LEMON_BUILD_DEMO "" OFF)
     47option(LEMON_BUILD_ARCHIVE "Enable to create archive" OFF)
     48option(LEMON_BUILD_CPACK "Enable to create cpack" OFF)
     49option(LEMON_TEST_WITH_VALGRIND "Run the test wit valgrind" OFF)
     50option(LEMON_ENABLE_DEBUG "Display debug messages" OFF)
    25251
    253 SET_DIRECTORY_PROPERTIES(PROPERTIES
    254   COMPILE_DEFINITIONS
    255   $<$<OR:$<CONFIG:Debug>,$<CONFIG:Maintainer>>:LEMON_ENABLE_DEBUG>
    256 )
    257 
    258 INCLUDE(CheckTypeSize)
    259 CHECK_TYPE_SIZE("long long" LONG_LONG)
    260 SET(LEMON_HAVE_LONG_LONG ${HAVE_LONG_LONG})
    261 
    262 INCLUDE(FindThreads)
    263 
    264 IF(NOT LEMON_THREADING)
    265   IF(CMAKE_USE_PTHREADS_INIT)
    266     SET(LEMON_THREADING "Pthread")
    267   ELSEIF(CMAKE_USE_WIN32_THREADS_INIT)
    268     SET(LEMON_THREADING "Win32")
    269   ELSE()
    270     SET(LEMON_THREADING "None")
    271   ENDIF()
    272 ENDIF()
    273 
    274 SET( LEMON_THREADING "${LEMON_THREADING}" CACHE STRING
    275   "Choose the threading library, options are: Pthread Win32 None."
    276   FORCE )
     52if(CMAKE_CONFIGURATION_TYPES)
     53  list(APPEND CMAKE_CONFIGURATION_TYPES Maintainer)
     54  list(REMOVE_DUPLICATES CMAKE_CONFIGURATION_TYPES)
     55  set(CMAKE_CONFIGURATION_TYPES
     56      "${CMAKE_CONFIGURATION_TYPES}"
     57      CACHE STRING "Add the configurations that we need" FORCE)
     58endif()
    27759
    278 IF(LEMON_THREADING STREQUAL "Pthread")
    279   SET(LEMON_USE_PTHREAD TRUE)
    280 ELSEIF(LEMON_THREADING STREQUAL "Win32")
    281   SET(LEMON_USE_WIN32_THREADS TRUE)
    282 ENDIF()
    283 
    284 ENABLE_TESTING()
    285 
    286 
    287 INCLUDE(CheckCXXCompilerFlag)
    288 CHECK_CXX_COMPILER_FLAG("-std=c++11" LEMON_CXX11)
    289 IF(LEMON_CXX11)
    290   SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
    291 ENDIF()
     60if(NOT CMAKE_BUILD_TYPE)
     61  set(CMAKE_BUILD_TYPE "Release")
     62endif()
    29263
    293 
    294 IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
    295   ADD_CUSTOM_TARGET(check ALL COMMAND ${CMAKE_CTEST_COMMAND})
    296 ELSE()
    297   ADD_CUSTOM_TARGET(check COMMAND ${CMAKE_CTEST_COMMAND})
    298 ENDIF()
    299 
    300 ADD_SUBDIRECTORY(lemon)
    301 IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
    302   ADD_SUBDIRECTORY(contrib)
    303   ADD_SUBDIRECTORY(demo)
    304   ADD_SUBDIRECTORY(tools)
    305   ADD_SUBDIRECTORY(doc)
    306   ADD_SUBDIRECTORY(test)
    307 ENDIF()
     64set(CMAKE_BUILD_TYPE
     65    "${CMAKE_BUILD_TYPE}"
     66    CACHE
     67      STRING
     68      "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel Maintainer."
     69      FORCE)
    30870
    309 CONFIGURE_FILE(
    310   ${PROJECT_SOURCE_DIR}/cmake/LEMONConfig.cmake.in
    311   ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake
    312   @ONLY
    313 )
    314 IF(UNIX)
    315   INSTALL(
    316     FILES ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake
    317     DESTINATION share/lemon/cmake
    318   )
    319 ELSEIF(WIN32)
    320   INSTALL(
    321     FILES ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake
    322     DESTINATION cmake
    323   )
    324 ENDIF()
     71enable_testing()
    32572
    326 CONFIGURE_FILE(
    327   ${PROJECT_SOURCE_DIR}/cmake/version.cmake.in
    328   ${PROJECT_BINARY_DIR}/cmake/version.cmake
    329   @ONLY
    330 )
     73# Add LEMON::LEMON target
     74include(base)
    33175
    332 SET(ARCHIVE_BASE_NAME ${CMAKE_PROJECT_NAME})
    333 STRING(TOLOWER ${ARCHIVE_BASE_NAME} ARCHIVE_BASE_NAME)
    334 SET(ARCHIVE_NAME ${ARCHIVE_BASE_NAME}-${PROJECT_VERSION})
    335 ADD_CUSTOM_TARGET(dist
    336   COMMAND cmake -E remove_directory ${ARCHIVE_NAME}
    337   COMMAND hg archive ${ARCHIVE_NAME}
    338   COMMAND cmake -E copy cmake/version.cmake ${ARCHIVE_NAME}/cmake/version.cmake
    339   COMMAND tar -czf ${ARCHIVE_BASE_NAME}-nodoc-${PROJECT_VERSION}.tar.gz ${ARCHIVE_NAME}
    340   COMMAND zip -r ${ARCHIVE_BASE_NAME}-nodoc-${PROJECT_VERSION}.zip ${ARCHIVE_NAME}
    341   COMMAND cmake -E copy_directory doc/html ${ARCHIVE_NAME}/doc/html
    342   COMMAND tar -czf ${ARCHIVE_NAME}.tar.gz ${ARCHIVE_NAME}
    343   COMMAND zip -r ${ARCHIVE_NAME}.zip ${ARCHIVE_NAME}
    344   COMMAND cmake -E copy_directory doc/html ${ARCHIVE_BASE_NAME}-doc-${PROJECT_VERSION}
    345   COMMAND tar -czf ${ARCHIVE_BASE_NAME}-doc-${PROJECT_VERSION}.tar.gz ${ARCHIVE_BASE_NAME}-doc-${PROJECT_VERSION}
    346   COMMAND zip -r ${ARCHIVE_BASE_NAME}-doc-${PROJECT_VERSION}.zip ${ARCHIVE_BASE_NAME}-doc-${PROJECT_VERSION}
    347   COMMAND cmake -E remove_directory ${ARCHIVE_NAME}
    348   COMMAND cmake -E remove_directory ${ARCHIVE_BASE_NAME}-doc-${PROJECT_VERSION}
    349   DEPENDS html
    350   WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
     76if(BUILD_TESTING AND ${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
     77  add_subdirectory(test)
     78endif()
    35179
    352 # CPACK config (Basically for NSIS)
    353 IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
    354   SET(CPACK_PACKAGE_NAME ${PROJECT_NAME})
    355   SET(CPACK_PACKAGE_VENDOR "EGRES")
    356   SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY
    357     "LEMON - Library for Efficient Modeling and Optimization in Networks")
    358   SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
    359 
    360   SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
     80if(LEMON_BUILD_TOOLS AND ${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
     81  add_subdirectory(tools)
     82endif()
    36183
    362   SET(CPACK_PACKAGE_INSTALL_DIRECTORY
    363     "${PROJECT_NAME} ${PROJECT_VERSION}")
    364   SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY
    365     "${PROJECT_NAME} ${PROJECT_VERSION}")
    366 
    367   SET(CPACK_COMPONENTS_ALL headers library html_documentation bin)
    368 
    369   SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ headers")
    370   SET(CPACK_COMPONENT_LIBRARY_DISPLAY_NAME "Dynamic-link library")
    371   SET(CPACK_COMPONENT_BIN_DISPLAY_NAME "Command line utilities")
    372   SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DISPLAY_NAME "HTML documentation")
     84if(LEMON_BUILD_DOCS AND ${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
     85  add_subdirectory(doc)
     86endif()
    37387
    374   SET(CPACK_COMPONENT_HEADERS_DESCRIPTION
    375     "C++ header files")
    376   SET(CPACK_COMPONENT_LIBRARY_DESCRIPTION
    377     "DLL and import library")
    378   SET(CPACK_COMPONENT_BIN_DESCRIPTION
    379     "Command line utilities")
    380   SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DESCRIPTION
    381     "Doxygen generated documentation")
    382 
    383   SET(CPACK_COMPONENT_HEADERS_DEPENDS library)
    384 
    385   SET(CPACK_COMPONENT_HEADERS_GROUP "Development")
    386   SET(CPACK_COMPONENT_LIBRARY_GROUP "Development")
    387   SET(CPACK_COMPONENT_HTML_DOCUMENTATION_GROUP "Documentation")
     88if(LEMON_BUILD_DEMO AND ${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
     89  add_subdirectory(demo)
     90endif()
    38891
    389   SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION
    390     "Components needed to develop software using LEMON")
    391   SET(CPACK_COMPONENT_GROUP_DOCUMENTATION_DESCRIPTION
    392     "Documentation of LEMON")
    393 
    394   SET(CPACK_ALL_INSTALL_TYPES Full Developer)
    395 
    396   SET(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full)
    397   SET(CPACK_COMPONENT_LIBRARY_INSTALL_TYPES Developer Full)
    398   SET(CPACK_COMPONENT_HTML_DOCUMENTATION_INSTALL_TYPES Full)
     92if(LEMON_BUILD_ARCHIVE AND ${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
     93  include(archive)
     94endif()
    39995
    400   SET(CPACK_GENERATOR "NSIS")
    401   SET(CPACK_NSIS_MUI_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis/lemon.ico")
    402   SET(CPACK_NSIS_MUI_UNIICON "${PROJECT_SOURCE_DIR}/cmake/nsis/uninstall.ico")
    403   #SET(CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis\\\\installer.bmp")
    404   SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\lemon.ico")
    405   SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} ${PROJECT_NAME}")
    406   SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\lemon.cs.elte.hu")
    407   SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\lemon.cs.elte.hu")
    408   SET(CPACK_NSIS_CONTACT "lemon-user@lemon.cs.elte.hu")
    409   SET(CPACK_NSIS_CREATE_ICONS_EXTRA "
    410     CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Documentation.lnk\\\" \\\"$INSTDIR\\\\share\\\\doc\\\\index.html\\\"
    411     ")
    412   SET(CPACK_NSIS_DELETE_ICONS_EXTRA "
    413     !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
    414     Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\Documentation.lnk\\\"
    415     ")
    416 
    417   INCLUDE(CPack)
    418 ENDIF()
     96if(LEMON_BUILD_CPACK AND ${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
     97  include(cpack)
     98endif()
  • new file cmake/Config.cmake.in

    diff -r a278d16bd2d0 cmake/Config.cmake.in
    - +  
     1@PACKAGE_INIT@
     2
     3include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
  • cmake/FindCOIN.cmake

    diff -r a278d16bd2d0 cmake/FindCOIN.cmake
    a b  
    1 SET(COIN_ROOT_DIR "" CACHE PATH "COIN root directory")
     1#[[
     2This file is a part of LEMON, a generic C++ optimization library.
     3
     4Copyright (C) 2003-2021
     5Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     6(Egervary Research Group on Combinatorial Optimization, EGRES).
     7
     8Permission to use, modify and distribute this software is granted
     9provided that this copyright notice appears in all copies. For
     10precise terms see the accompanying LICENSE file.
    211
    3 FIND_PATH(COIN_INCLUDE_DIR coin/CoinUtilsConfig.h
    4   HINTS ${COIN_ROOT_DIR}/include
    5 )
    6 FIND_LIBRARY(COIN_CBC_LIBRARY
     12This software is provided "AS IS" with no warranty of any kind,
     13express or implied, and with no claim as to its suitability for any
     14purpose.
     15]]
     16
     17#[[
     18This file finds the necessary components of the COIN-OR libraries.
     19Cbc, Clp, Cgl, Osi, and Vol
     20]]
     21
     22set(COIN_ROOT_DIR
     23    ""
     24    CACHE PATH "COIN root directory")
     25
     26find_path(COIN_INCLUDE_DIR coin/CoinUtilsConfig.h
     27          HINTS ${COIN_ROOT_DIR}/include)
     28find_library(
     29  COIN_CBC_LIBRARY
    730  NAMES Cbc libCbc
    831  HINTS ${COIN_ROOT_DIR}/lib/coin
    9   HINTS ${COIN_ROOT_DIR}/lib
    10 )
    11 FIND_LIBRARY(COIN_CBC_SOLVER_LIBRARY
     32  HINTS ${COIN_ROOT_DIR}/lib)
     33find_library(
     34  COIN_CBC_SOLVER_LIBRARY
    1235  NAMES CbcSolver libCbcSolver
    1336  HINTS ${COIN_ROOT_DIR}/lib/coin
    14   HINTS ${COIN_ROOT_DIR}/lib
    15 )
    16 FIND_LIBRARY(COIN_CGL_LIBRARY
     37  HINTS ${COIN_ROOT_DIR}/lib)
     38find_library(
     39  COIN_CGL_LIBRARY
    1740  NAMES Cgl libCgl
    1841  HINTS ${COIN_ROOT_DIR}/lib/coin
    19   HINTS ${COIN_ROOT_DIR}/lib
    20 )
    21 FIND_LIBRARY(COIN_CLP_LIBRARY
     42  HINTS ${COIN_ROOT_DIR}/lib)
     43find_library(
     44  COIN_CLP_LIBRARY
    2245  NAMES Clp libClp
    2346  HINTS ${COIN_ROOT_DIR}/lib/coin
    24   HINTS ${COIN_ROOT_DIR}/lib
    25 )
    26 FIND_LIBRARY(COIN_COIN_UTILS_LIBRARY
     47  HINTS ${COIN_ROOT_DIR}/lib)
     48find_library(
     49  COIN_COIN_UTILS_LIBRARY
    2750  NAMES CoinUtils libCoinUtils
    2851  HINTS ${COIN_ROOT_DIR}/lib/coin
    29   HINTS ${COIN_ROOT_DIR}/lib
    30 )
    31 FIND_LIBRARY(COIN_OSI_LIBRARY
     52  HINTS ${COIN_ROOT_DIR}/lib)
     53find_library(
     54  COIN_OSI_LIBRARY
    3255  NAMES Osi libOsi
    3356  HINTS ${COIN_ROOT_DIR}/lib/coin
    34   HINTS ${COIN_ROOT_DIR}/lib
    35 )
    36 FIND_LIBRARY(COIN_OSI_CBC_LIBRARY
     57  HINTS ${COIN_ROOT_DIR}/lib)
     58find_library(
     59  COIN_OSI_CBC_LIBRARY
    3760  NAMES OsiCbc libOsiCbc
    3861  HINTS ${COIN_ROOT_DIR}/lib/coin
    39   HINTS ${COIN_ROOT_DIR}/lib
    40 )
    41 FIND_LIBRARY(COIN_OSI_CLP_LIBRARY
     62  HINTS ${COIN_ROOT_DIR}/lib)
     63find_library(
     64  COIN_OSI_CLP_LIBRARY
    4265  NAMES OsiClp libOsiClp
    4366  HINTS ${COIN_ROOT_DIR}/lib/coin
    44   HINTS ${COIN_ROOT_DIR}/lib
    45 )
    46 FIND_LIBRARY(COIN_OSI_VOL_LIBRARY
     67  HINTS ${COIN_ROOT_DIR}/lib)
     68find_library(
     69  COIN_OSI_VOL_LIBRARY
    4770  NAMES OsiVol libOsiVol
    4871  HINTS ${COIN_ROOT_DIR}/lib/coin
    49   HINTS ${COIN_ROOT_DIR}/lib
    50 )
    51 FIND_LIBRARY(COIN_VOL_LIBRARY
     72  HINTS ${COIN_ROOT_DIR}/lib)
     73find_library(
     74  COIN_VOL_LIBRARY
    5275  NAMES Vol libVol
    5376  HINTS ${COIN_ROOT_DIR}/lib/coin
    54   HINTS ${COIN_ROOT_DIR}/lib
    55 )
     77  HINTS ${COIN_ROOT_DIR}/lib)
    5678
    57 FIND_LIBRARY(COIN_ZLIB_LIBRARY
     79find_library(
     80  COIN_ZLIB_LIBRARY
    5881  NAMES z libz
    5982  HINTS ${COIN_ROOT_DIR}/lib/coin
    60   HINTS ${COIN_ROOT_DIR}/lib
    61 )
    62 FIND_LIBRARY(COIN_BZ2_LIBRARY
     83  HINTS ${COIN_ROOT_DIR}/lib)
     84find_library(
     85  COIN_BZ2_LIBRARY
    6386  NAMES bz2 libbz2
    6487  HINTS ${COIN_ROOT_DIR}/lib/coin
    65   HINTS ${COIN_ROOT_DIR}/lib
    66 )
     88  HINTS ${COIN_ROOT_DIR}/lib)
    6789
    68 FIND_LIBRARY(COIN_PTHREADS_LIBRARY
     90find_library(
     91  COIN_PTHREADS_LIBRARY
    6992  NAMES pthreads libpthreads
    7093  HINTS ${COIN_ROOT_DIR}/lib/coin
    71   HINTS ${COIN_ROOT_DIR}/lib
    72 )
     94  HINTS ${COIN_ROOT_DIR}/lib)
    7395
    74 INCLUDE(FindPackageHandleStandardArgs)
    75 FIND_PACKAGE_HANDLE_STANDARD_ARGS(COIN DEFAULT_MSG
     96include(FindPackageHandleStandardArgs)
     97find_package_handle_standard_args(
     98  COIN
     99  DEFAULT_MSG
    76100  COIN_INCLUDE_DIR
    77101  COIN_CBC_LIBRARY
    78102  COIN_CBC_SOLVER_LIBRARY
     
    86110  # COIN_VOL_LIBRARY
    87111)
    88112
    89 IF(COIN_FOUND)
    90   SET(COIN_INCLUDE_DIRS ${COIN_INCLUDE_DIR})
    91   SET(COIN_CLP_LIBRARIES "${COIN_CLP_LIBRARY};${COIN_COIN_UTILS_LIBRARY}")
    92   IF(COIN_ZLIB_LIBRARY)
    93     SET(COIN_CLP_LIBRARIES "${COIN_CLP_LIBRARIES};${COIN_ZLIB_LIBRARY}")
    94   ENDIF(COIN_ZLIB_LIBRARY)
    95    IF(COIN_BZ2_LIBRARY)
    96     SET(COIN_CLP_LIBRARIES "${COIN_CLP_LIBRARIES};${COIN_BZ2_LIBRARY}")
    97   ENDIF(COIN_BZ2_LIBRARY)
    98    IF(COIN_PTHREADS_LIBRARY)
    99     SET(COIN_CLP_LIBRARIES "${COIN_CLP_LIBRARIES};${COIN_PTHREADS_LIBRARY}")
    100   ENDIF(COIN_PTHREADS_LIBRARY)
    101   SET(COIN_CBC_LIBRARIES "${COIN_CBC_LIBRARY};${COIN_CBC_SOLVER_LIBRARY};${COIN_CGL_LIBRARY};${COIN_OSI_LIBRARY};${COIN_OSI_CBC_LIBRARY};${COIN_OSI_CLP_LIBRARY};${COIN_CLP_LIBRARIES}")
    102   SET(COIN_LIBRARIES ${COIN_CBC_LIBRARIES})
    103 ENDIF(COIN_FOUND)
     113if(COIN_FOUND)
     114  set(COIN_INCLUDE_DIRS ${COIN_INCLUDE_DIR})
     115  set(COIN_CLP_LIBRARIES "${COIN_CLP_LIBRARY};${COIN_COIN_UTILS_LIBRARY}")
     116  if(COIN_ZLIB_LIBRARY)
     117    set(COIN_CLP_LIBRARIES "${COIN_CLP_LIBRARIES};${COIN_ZLIB_LIBRARY}")
     118  endif(COIN_ZLIB_LIBRARY)
     119  if(COIN_BZ2_LIBRARY)
     120    set(COIN_CLP_LIBRARIES "${COIN_CLP_LIBRARIES};${COIN_BZ2_LIBRARY}")
     121  endif(COIN_BZ2_LIBRARY)
     122  if(COIN_PTHREADS_LIBRARY)
     123    set(COIN_CLP_LIBRARIES "${COIN_CLP_LIBRARIES};${COIN_PTHREADS_LIBRARY}")
     124  endif(COIN_PTHREADS_LIBRARY)
     125  set(COIN_CBC_LIBRARIES
     126      "${COIN_CBC_LIBRARY};${COIN_CBC_SOLVER_LIBRARY};${COIN_CGL_LIBRARY};${COIN_OSI_LIBRARY};${COIN_OSI_CBC_LIBRARY};${COIN_OSI_CLP_LIBRARY};${COIN_CLP_LIBRARIES}"
     127  )
     128  set(COIN_LIBRARIES ${COIN_CBC_LIBRARIES})
     129endif(COIN_FOUND)
    104130
    105 MARK_AS_ADVANCED(
     131mark_as_advanced(
    106132  COIN_INCLUDE_DIR
    107133  COIN_CBC_LIBRARY
    108134  COIN_CBC_SOLVER_LIBRARY
     
    115141  COIN_OSI_VOL_LIBRARY
    116142  COIN_VOL_LIBRARY
    117143  COIN_ZLIB_LIBRARY
    118   COIN_BZ2_LIBRARY
    119 )
     144  COIN_BZ2_LIBRARY)
  • cmake/FindGLPK.cmake

    diff -r a278d16bd2d0 cmake/FindGLPK.cmake
    a b  
    1 SET(GLPK_ROOT_DIR "" CACHE PATH "GLPK root directory")
     1#[[
     2This file is a part of LEMON, a generic C++ optimization library.
     3
     4Copyright (C) 2003-2021
     5Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     6(Egervary Research Group on Combinatorial Optimization, EGRES).
    27
    3 SET(GLPK_REGKEY "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Glpk;InstallPath]")
    4 GET_FILENAME_COMPONENT(GLPK_ROOT_PATH ${GLPK_REGKEY} ABSOLUTE)
     8Permission to use, modify and distribute this software is granted
     9provided that this copyright notice appears in all copies. For
     10precise terms see the accompanying LICENSE file.
     11
     12This software is provided "AS IS" with no warranty of any kind,
     13express or implied, and with no claim as to its suitability for any
     14purpose.
     15]]
    516
    6 FIND_PATH(GLPK_INCLUDE_DIR
    7   glpk.h
     17#[[
     18This file finds the necessary components for the GLPK solver.
     19]]
     20
     21set(GLPK_ROOT_DIR
     22    ""
     23    CACHE PATH "GLPK root directory")
     24
     25set(GLPK_REGKEY "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Glpk;InstallPath]")
     26get_filename_component(GLPK_ROOT_PATH ${GLPK_REGKEY} ABSOLUTE)
     27
     28find_path(
     29  GLPK_INCLUDE_DIR glpk.h
    830  PATHS ${GLPK_REGKEY}/include
    9   HINTS ${GLPK_ROOT_DIR}/include
    10 )
    11 FIND_LIBRARY(GLPK_LIBRARY
    12   glpk
     31  HINTS ${GLPK_ROOT_DIR}/include)
     32
     33find_library(
     34  GLPK_LIBRARY glpk
    1335  PATHS ${GLPK_REGKEY}/lib
    14   HINTS ${GLPK_ROOT_DIR}/lib
    15 )
    16 
    17 IF(GLPK_INCLUDE_DIR AND GLPK_LIBRARY)
    18   FILE(READ ${GLPK_INCLUDE_DIR}/glpk.h GLPK_GLPK_H)
     36  HINTS ${GLPK_ROOT_DIR}/lib)
    1937
    20   STRING(REGEX MATCH "define[ ]+GLP_MAJOR_VERSION[ ]+[0-9]+" GLPK_MAJOR_VERSION_LINE "${GLPK_GLPK_H}")
    21   STRING(REGEX REPLACE "define[ ]+GLP_MAJOR_VERSION[ ]+([0-9]+)" "\\1" GLPK_VERSION_MAJOR "${GLPK_MAJOR_VERSION_LINE}")
    22 
    23   STRING(REGEX MATCH "define[ ]+GLP_MINOR_VERSION[ ]+[0-9]+" GLPK_MINOR_VERSION_LINE "${GLPK_GLPK_H}")
    24   STRING(REGEX REPLACE "define[ ]+GLP_MINOR_VERSION[ ]+([0-9]+)" "\\1" GLPK_VERSION_MINOR "${GLPK_MINOR_VERSION_LINE}")
    25 
    26   SET(GLPK_VERSION_STRING "${GLPK_VERSION_MAJOR}.${GLPK_VERSION_MINOR}")
     38if(GLPK_INCLUDE_DIR AND GLPK_LIBRARY)
     39  file(READ ${GLPK_INCLUDE_DIR}/glpk.h GLPK_GLPK_H)
    2740
    28   IF(GLPK_FIND_VERSION)
    29     IF(GLPK_FIND_VERSION_COUNT GREATER 2)
    30       MESSAGE(SEND_ERROR "unexpected version string")
    31     ENDIF(GLPK_FIND_VERSION_COUNT GREATER 2)
     41  string(REGEX MATCH "define[ ]+GLP_MAJOR_VERSION[ ]+[0-9]+"
     42               GLPK_MAJOR_VERSION_LINE "${GLPK_GLPK_H}")
     43  string(REGEX REPLACE "define[ ]+GLP_MAJOR_VERSION[ ]+([0-9]+)" "\\1"
     44                       GLPK_VERSION_MAJOR "${GLPK_MAJOR_VERSION_LINE}")
     45
     46  string(REGEX MATCH "define[ ]+GLP_MINOR_VERSION[ ]+[0-9]+"
     47               GLPK_MINOR_VERSION_LINE "${GLPK_GLPK_H}")
     48  string(REGEX REPLACE "define[ ]+GLP_MINOR_VERSION[ ]+([0-9]+)" "\\1"
     49                       GLPK_VERSION_MINOR "${GLPK_MINOR_VERSION_LINE}")
    3250
    33     MATH(EXPR GLPK_REQUESTED_VERSION "${GLPK_FIND_VERSION_MAJOR}*100 + ${GLPK_FIND_VERSION_MINOR}")
    34     MATH(EXPR GLPK_FOUND_VERSION "${GLPK_VERSION_MAJOR}*100 + ${GLPK_VERSION_MINOR}")
     51  set(GLPK_VERSION_STRING "${GLPK_VERSION_MAJOR}.${GLPK_VERSION_MINOR}")
     52
     53  if(GLPK_FIND_VERSION)
     54    if(GLPK_FIND_VERSION_COUNT GREATER 2)
     55      message(SEND_ERROR "unexpected version string")
     56    endif(GLPK_FIND_VERSION_COUNT GREATER 2)
     57
     58    math(EXPR GLPK_REQUESTED_VERSION
     59         "${GLPK_FIND_VERSION_MAJOR}*100 + ${GLPK_FIND_VERSION_MINOR}")
     60    math(EXPR GLPK_FOUND_VERSION
     61         "${GLPK_VERSION_MAJOR}*100 + ${GLPK_VERSION_MINOR}")
    3562
    36     IF(GLPK_FOUND_VERSION LESS GLPK_REQUESTED_VERSION)
    37       SET(GLPK_PROPER_VERSION_FOUND FALSE)
    38     ELSE(GLPK_FOUND_VERSION LESS GLPK_REQUESTED_VERSION)
    39       SET(GLPK_PROPER_VERSION_FOUND TRUE)
    40     ENDIF(GLPK_FOUND_VERSION LESS GLPK_REQUESTED_VERSION)
    41   ELSE(GLPK_FIND_VERSION)
    42     SET(GLPK_PROPER_VERSION_FOUND TRUE)
    43   ENDIF(GLPK_FIND_VERSION)
    44 ENDIF(GLPK_INCLUDE_DIR AND GLPK_LIBRARY)
     63    if(GLPK_FOUND_VERSION LESS GLPK_REQUESTED_VERSION)
     64      set(GLPK_PROPER_VERSION_FOUND FALSE)
     65    else(GLPK_FOUND_VERSION LESS GLPK_REQUESTED_VERSION)
     66      set(GLPK_PROPER_VERSION_FOUND TRUE)
     67    endif(GLPK_FOUND_VERSION LESS GLPK_REQUESTED_VERSION)
     68  else(GLPK_FIND_VERSION)
     69    set(GLPK_PROPER_VERSION_FOUND TRUE)
     70  endif(GLPK_FIND_VERSION)
     71endif(GLPK_INCLUDE_DIR AND GLPK_LIBRARY)
    4572
    46 INCLUDE(FindPackageHandleStandardArgs)
    47 FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLPK DEFAULT_MSG GLPK_LIBRARY GLPK_INCLUDE_DIR GLPK_PROPER_VERSION_FOUND)
     73include(FindPackageHandleStandardArgs)
     74find_package_handle_standard_args(GLPK DEFAULT_MSG GLPK_LIBRARY
     75                                  GLPK_INCLUDE_DIR GLPK_PROPER_VERSION_FOUND)
    4876
    49 IF(GLPK_FOUND)
    50   SET(GLPK_INCLUDE_DIRS ${GLPK_INCLUDE_DIR})
    51   SET(GLPK_LIBRARIES ${GLPK_LIBRARY})
    52   SET(GLPK_BIN_DIR ${GLPK_ROOT_PATH}/bin)
    53 ENDIF(GLPK_FOUND)
     77if(GLPK_FOUND)
     78  set(GLPK_INCLUDE_DIRS ${GLPK_INCLUDE_DIR})
     79  set(GLPK_LIBRARIES ${GLPK_LIBRARY})
     80  set(GLPK_BIN_DIR ${GLPK_ROOT_PATH}/bin)
     81endif(GLPK_FOUND)
    5482
    55 MARK_AS_ADVANCED(GLPK_LIBRARY GLPK_INCLUDE_DIR GLPK_BIN_DIR)
     83mark_as_advanced(GLPK_LIBRARY GLPK_INCLUDE_DIR GLPK_BIN_DIR)
  • cmake/FindGhostscript.cmake

    diff -r a278d16bd2d0 cmake/FindGhostscript.cmake
    a b  
    1 INCLUDE(FindPackageHandleStandardArgs)
     1#[[
     2This file is a part of LEMON, a generic C++ optimization library.
     3
     4Copyright (C) 2003-2021
     5Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     6(Egervary Research Group on Combinatorial Optimization, EGRES).
     7
     8Permission to use, modify and distribute this software is granted
     9provided that this copyright notice appears in all copies. For
     10precise terms see the accompanying LICENSE file.
    211
    3 FIND_PROGRAM(GHOSTSCRIPT_EXECUTABLE
     12This software is provided "AS IS" with no warranty of any kind,
     13express or implied, and with no claim as to its suitability for any
     14purpose.
     15]]
     16
     17#[[
     18This file finds the necessary components for Ghostscript.
     19]]
     20
     21include(FindPackageHandleStandardArgs)
     22
     23find_program(
     24  GHOSTSCRIPT_EXECUTABLE
    425  NAMES gs gswin32c
    526  PATHS "$ENV{ProgramFiles}/gs"
    627  PATH_SUFFIXES gs8.61/bin gs8.62/bin gs8.63/bin gs8.64/bin gs8.65/bin
    7   DOC "Ghostscript: PostScript and PDF language interpreter and previewer."
    8 )
     28  DOC "Ghostscript: PostScript and PDF language interpreter and previewer.")
    929
    10 FIND_PACKAGE_HANDLE_STANDARD_ARGS(Ghostscript DEFAULT_MSG GHOSTSCRIPT_EXECUTABLE)
     30find_package_handle_standard_args(Ghostscript DEFAULT_MSG
     31                                  GHOSTSCRIPT_EXECUTABLE)
  • cmake/FindILOG.cmake

    diff -r a278d16bd2d0 cmake/FindILOG.cmake
    a b  
    1 FIND_PATH(ILOG_ROOT_DIR
     1#[[
     2This file is a part of LEMON, a generic C++ optimization library.
     3
     4Copyright (C) 2003-2021
     5Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     6(Egervary Research Group on Combinatorial Optimization, EGRES).
     7
     8Permission to use, modify and distribute this software is granted
     9provided that this copyright notice appears in all copies. For
     10precise terms see the accompanying LICENSE file.
     11
     12This software is provided "AS IS" with no warranty of any kind,
     13express or implied, and with no claim as to its suitability for any
     14purpose.
     15]]
     16
     17#[[
     18This file finds the necessary components for the ILOG Cplex solver.
     19]]
     20
     21find_path(
     22  ILOG_ROOT_DIR
    223  NAMES cplex
    324  DOC "CPLEX STUDIO root directory"
    425  PATHS /opt/ibm/ILOG /usr/local/ibm/ILOG /usr/local/ILOG /usr/local/ilog
    526  PATHS "$ENV{HOME}/ILOG" "$ENV{HOME}/.local/ILOG"
    627  PATHS "$ENV{HOME}/ibm/ILOG" "$ENV{HOME}/.local/ibm/ILOG"
    7   PATHS "C:/Program Files/IBM/ILOG"
    8   PATH_SUFFIXES "CPLEX_Studio126" "CPLEX_Studio125"
    9   "CPLEX_Studio124" "CPLEX_Studio123" "CPLEX_Studio122"
    10   NO_DEFAULT_PATH
    11 )
     28  PATHS "C:/Program Files/IBM/ILOG"
     29  PATH_SUFFIXES "CPLEX_Studio126" "CPLEX_Studio125" "CPLEX_Studio124"
     30                "CPLEX_Studio123" "CPLEX_Studio122" "CPLEX_Studio201"
     31  NO_DEFAULT_PATH)
    1232
    13 IF(WIN32)
    14   IF(MSVC_VERSION STREQUAL "1400")
    15     SET(ILOG_WIN_COMPILER "windows_vs2005")
    16   ELSEIF(MSVC_VERSION STREQUAL "1500")
    17     SET(ILOG_WIN_COMPILER "windows_vs2008")
    18   ELSEIF(MSVC_VERSION STREQUAL "1600")
    19     SET(ILOG_WIN_COMPILER "windows_vs2010")
    20   ELSE()
    21     SET(ILOG_WIN_COMPILER "windows_vs2008")
    22   ENDIF()
    23   IF(CMAKE_CL_64)
    24     SET(ILOG_WIN_COMPILER "x64_${ILOG_WIN_COMPILER}")
    25     SET(ILOG_WIN_PLATFORM "x64_win32")
    26   ELSE()
    27     SET(ILOG_WIN_COMPILER "x86_${ILOG_WIN_COMPILER}")
    28     SET(ILOG_WIN_PLATFORM "x86_win32")
    29   ENDIF()
    30 ENDIF()
     33if(WIN32)
     34  if(MSVC_VERSION STREQUAL "1400")
     35    set(ILOG_WIN_COMPILER "windows_vs2005")
     36  elseif(MSVC_VERSION STREQUAL "1500")
     37    set(ILOG_WIN_COMPILER "windows_vs2008")
     38  elseif(MSVC_VERSION STREQUAL "1600")
     39    set(ILOG_WIN_COMPILER "windows_vs2010")
     40  else()
     41    set(ILOG_WIN_COMPILER "windows_vs2008")
     42  endif()
     43  if(CMAKE_CL_64)
     44    set(ILOG_WIN_COMPILER "x64_${ILOG_WIN_COMPILER}")
     45    set(ILOG_WIN_PLATFORM "x64_win32")
     46  else()
     47    set(ILOG_WIN_COMPILER "x86_${ILOG_WIN_COMPILER}")
     48    set(ILOG_WIN_PLATFORM "x86_win32")
     49  endif()
     50endif()
    3151
    32 FIND_PATH(ILOG_CPLEX_ROOT_DIR
     52find_path(
     53  ILOG_CPLEX_ROOT_DIR
    3354  NAMES include/ilcplex
    3455  HINTS ${ILOG_ROOT_DIR}/cplex ${ILOG_ROOT_DIR}/cplex121
    35   ${ILOG_ROOT_DIR}/cplex122 ${ILOG_ROOT_DIR}/cplex123
     56        ${ILOG_ROOT_DIR}/cplex122 ${ILOG_ROOT_DIR}/cplex123
    3657  DOC "CPLEX root directory"
    37   NO_DEFAULT_PATH
    38 )
     58  NO_DEFAULT_PATH)
    3959
    40 FIND_PATH(ILOG_CONCERT_ROOT_DIR
     60find_path(
     61  ILOG_CONCERT_ROOT_DIR
    4162  NAMES include/ilconcert
    4263  HINTS ${ILOG_ROOT_DIR}/concert ${ILOG_ROOT_DIR}/concert29
    4364  DOC "CONCERT root directory"
    44   NO_DEFAULT_PATH
    45 )
     65  NO_DEFAULT_PATH)
    4666
    47 FIND_PATH(ILOG_CPLEX_INCLUDE_DIR
    48   ilcplex/cplex.h
     67find_path(
     68  ILOG_CPLEX_INCLUDE_DIR ilcplex/cplex.h
    4969  HINTS ${ILOG_CPLEX_ROOT_DIR}/include
    50   NO_DEFAULT_PATH
    51 )
     70  NO_DEFAULT_PATH)
    5271
    53 FIND_PATH(ILOG_CONCERT_INCLUDE_DIR
    54   ilconcert/ilobasic.h
     72find_path(
     73  ILOG_CONCERT_INCLUDE_DIR ilconcert/ilobasic.h
    5574  HINTS ${ILOG_CONCERT_ROOT_DIR}/include
    56   NO_DEFAULT_PATH
    57 )
     75  NO_DEFAULT_PATH)
    5876
    59 FIND_LIBRARY(ILOG_CPLEX_LIBRARY
    60   cplex cplex121 cplex122 cplex123 cplex124
     77find_library(
     78  ILOG_CPLEX_LIBRARY cplex cplex121 cplex122 cplex123 cplex124
    6179  HINTS ${ILOG_CPLEX_ROOT_DIR}/lib/x86_sles10_4.1/static_pic
    62   ${ILOG_CPLEX_ROOT_DIR}/lib/x86-64_sles10_4.1/static_pic
    63   ${ILOG_CPLEX_ROOT_DIR}/lib/x86_debian4.0_4.1/static_pic
    64   ${ILOG_CPLEX_ROOT_DIR}/lib/x86-64_debian4.0_4.1/static_pic
    65   ${ILOG_CPLEX_ROOT_DIR}/lib/x86_linux/static_pic
    66   ${ILOG_CPLEX_ROOT_DIR}/lib/x86-64_linux/static_pic
    67   ${ILOG_CPLEX_ROOT_DIR}/lib/${ILOG_WIN_COMPILER}/stat_mda
    68   NO_DEFAULT_PATH
    69   )
     80        ${ILOG_CPLEX_ROOT_DIR}/lib/x86-64_sles10_4.1/static_pic
     81        ${ILOG_CPLEX_ROOT_DIR}/lib/x86_debian4.0_4.1/static_pic
     82        ${ILOG_CPLEX_ROOT_DIR}/lib/x86-64_debian4.0_4.1/static_pic
     83        ${ILOG_CPLEX_ROOT_DIR}/lib/x86_linux/static_pic
     84        ${ILOG_CPLEX_ROOT_DIR}/lib/x86-64_linux/static_pic
     85        ${ILOG_CPLEX_ROOT_DIR}/lib/${ILOG_WIN_COMPILER}/stat_mda
     86  NO_DEFAULT_PATH)
    7087
    71 FIND_LIBRARY(ILOG_CONCERT_LIBRARY
    72   concert
     88find_library(
     89  ILOG_CONCERT_LIBRARY concert
    7390  HINTS ${ILOG_CONCERT_ROOT_DIR}/lib/x86_sles10_4.1/static_pic
    74   ${ILOG_CONCERT_ROOT_DIR}/lib/x86-64_sles10_4.1/static_pic
    75   ${ILOG_CONCERT_ROOT_DIR}/lib/x86_debian4.0_4.1/static_pic
    76   ${ILOG_CONCERT_ROOT_DIR}/lib/x86-64_debian4.0_4.1/static_pic
    77   ${ILOG_CONCERT_ROOT_DIR}/lib/x86_linux/static_pic
    78   ${ILOG_CONCERT_ROOT_DIR}/lib/x86-64_linux/static_pic
    79   ${ILOG_CONCERT_ROOT_DIR}/lib/${ILOG_WIN_COMPILER}/stat_mda
    80   NO_DEFAULT_PATH
    81   )
     91        ${ILOG_CONCERT_ROOT_DIR}/lib/x86-64_sles10_4.1/static_pic
     92        ${ILOG_CONCERT_ROOT_DIR}/lib/x86_debian4.0_4.1/static_pic
     93        ${ILOG_CONCERT_ROOT_DIR}/lib/x86-64_debian4.0_4.1/static_pic
     94        ${ILOG_CONCERT_ROOT_DIR}/lib/x86_linux/static_pic
     95        ${ILOG_CONCERT_ROOT_DIR}/lib/x86-64_linux/static_pic
     96        ${ILOG_CONCERT_ROOT_DIR}/lib/${ILOG_WIN_COMPILER}/stat_mda
     97  NO_DEFAULT_PATH)
    8298
    83 FIND_FILE(ILOG_CPLEX_DLL
    84   cplex121.dll cplex122.dll cplex123.dll cplex124.dll
     99find_file(
     100  ILOG_CPLEX_DLL cplex121.dll cplex122.dll cplex123.dll cplex124.dll
    85101  HINTS ${ILOG_CPLEX_ROOT_DIR}/bin/${ILOG_WIN_PLATFORM}
    86   NO_DEFAULT_PATH
    87   )
     102  NO_DEFAULT_PATH)
    88103
    89 INCLUDE(FindPackageHandleStandardArgs)
    90 FIND_PACKAGE_HANDLE_STANDARD_ARGS(ILOG
    91   DEFAULT_MSG ILOG_CPLEX_LIBRARY ILOG_CPLEX_INCLUDE_DIR
    92   )
     104include(FindPackageHandleStandardArgs)
     105find_package_handle_standard_args(ILOG DEFAULT_MSG ILOG_CPLEX_LIBRARY
     106                                  ILOG_CPLEX_INCLUDE_DIR)
    93107
    94 IF(ILOG_FOUND)
    95   SET(ILOG_INCLUDE_DIRS ${ILOG_CPLEX_INCLUDE_DIR} ${ILOG_CONCERT_INCLUDE_DIR})
    96   SET(ILOG_LIBRARIES ${ILOG_CPLEX_LIBRARY} ${ILOG_CONCERT_LIBRARY})
    97   IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
     108if(ILOG_FOUND)
     109  set(ILOG_INCLUDE_DIRS ${ILOG_CPLEX_INCLUDE_DIR} ${ILOG_CONCERT_INCLUDE_DIR})
     110  set(ILOG_LIBRARIES ${ILOG_CPLEX_LIBRARY} ${ILOG_CONCERT_LIBRARY})
     111  if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
    98112    # SET(CPLEX_LIBRARIES "${CPLEX_LIBRARIES};m;pthread")
    99     SET(ILOG_LIBRARIES ${ILOG_LIBRARIES} "m" "pthread" "dl")
    100   ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
    101 ENDIF(ILOG_FOUND)
     113    set(ILOG_LIBRARIES ${ILOG_LIBRARIES} "m" "pthread" "dl")
     114  endif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
     115endif(ILOG_FOUND)
    102116
    103 MARK_AS_ADVANCED(
    104   ILOG_CPLEX_LIBRARY ILOG_CPLEX_INCLUDE_DIR ILOG_CPLEX_DLL
    105   ILOG_CONCERT_LIBRARY ILOG_CONCERT_INCLUDE_DIR ILOG_CONCERT_DLL
    106   )
     117mark_as_advanced(ILOG_CPLEX_LIBRARY ILOG_CPLEX_INCLUDE_DIR ILOG_CPLEX_DLL
     118                 ILOG_CONCERT_LIBRARY ILOG_CONCERT_INCLUDE_DIR ILOG_CONCERT_DLL)
  • cmake/FindSOPLEX.cmake

    diff -r a278d16bd2d0 cmake/FindSOPLEX.cmake
    a b  
    1 SET(SOPLEX_ROOT_DIR "" CACHE PATH "SoPlex root directory")
     1#[[
     2This file is a part of LEMON, a generic C++ optimization library.
     3
     4Copyright (C) 2003-2021
     5Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     6(Egervary Research Group on Combinatorial Optimization, EGRES).
    27
    3 FIND_PATH(SOPLEX_INCLUDE_DIR
    4   soplex.h
    5   HINTS ${SOPLEX_ROOT_DIR}/src
    6 )
    7 FIND_LIBRARY(SOPLEX_LIBRARY
    8   soplex
    9   HINTS ${SOPLEX_ROOT_DIR}/lib
    10 )
     8Permission to use, modify and distribute this software is granted
     9provided that this copyright notice appears in all copies. For
     10precise terms see the accompanying LICENSE file.
     11
     12This software is provided "AS IS" with no warranty of any kind,
     13express or implied, and with no claim as to its suitability for any
     14purpose.
     15]]
    1116
    12 INCLUDE(FindPackageHandleStandardArgs)
    13 FIND_PACKAGE_HANDLE_STANDARD_ARGS(SOPLEX DEFAULT_MSG SOPLEX_LIBRARY SOPLEX_INCLUDE_DIR)
     17#[[
     18This file finds the necessary components for the SOPLEX solver.
     19]]
     20
     21find_path(SOPLEX_INCLUDE_DIR soplex.h HINTS ${SOPLEX_ROOT}/src)
     22find_library(SOPLEX_LIBRARY soplex HINTS ${SOPLEX_ROOT}/lib)
    1423
    15 IF(SOPLEX_FOUND)
    16   SET(SOPLEX_INCLUDE_DIRS ${SOPLEX_INCLUDE_DIR})
    17   SET(SOPLEX_LIBRARIES ${SOPLEX_LIBRARY})
    18   IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
    19     SET(SOPLEX_LIBRARIES "${SOPLEX_LIBRARIES};z")
    20   ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
    21 ENDIF(SOPLEX_FOUND)
     24include(FindPackageHandleStandardArgs)
     25find_package_handle_standard_args(SOPLEX DEFAULT_MSG SOPLEX_LIBRARY
     26                                  SOPLEX_INCLUDE_DIR)
    2227
    23 MARK_AS_ADVANCED(SOPLEX_LIBRARY SOPLEX_INCLUDE_DIR)
     28if(SOPLEX_FOUND)
     29  set(SOPLEX_INCLUDE_DIRS ${SOPLEX_INCLUDE_DIR})
     30  set(SOPLEX_LIBRARIES ${SOPLEX_LIBRARY})
     31  if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
     32    set(SOPLEX_LIBRARIES "${SOPLEX_LIBRARIES};z")
     33  endif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
     34endif(SOPLEX_FOUND)
     35
     36mark_as_advanced(SOPLEX_LIBRARY SOPLEX_INCLUDE_DIR)
  • cmake/LEMONConfig.cmake.in

    diff -r a278d16bd2d0 cmake/LEMONConfig.cmake.in
    a b  
    1 SET(LEMON_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/include" CACHE PATH "LEMON include directory")
    2 SET(LEMON_INCLUDE_DIRS "${LEMON_INCLUDE_DIR}")
     1set(LEMON_INCLUDE_DIR
     2    "@CMAKE_INSTALL_PREFIX@/include"
     3    CACHE PATH "LEMON include directory")
     4set(LEMON_INCLUDE_DIRS "${LEMON_INCLUDE_DIR}")
    35
    4 IF(UNIX)
    5   SET(LEMON_LIB_NAME "libemon.a")
    6 ELSEIF(WIN32)
    7   SET(LEMON_LIB_NAME "lemon.lib")
    8 ENDIF(UNIX)
     6if(UNIX)
     7  set(LEMON_LIB_NAME "libemon.a")
     8elseif(WIN32)
     9  set(LEMON_LIB_NAME "lemon.lib")
     10endif(UNIX)
    911
    10 SET(LEMON_LIBRARY "@CMAKE_INSTALL_PREFIX@/lib/${LEMON_LIB_NAME}" CACHE FILEPATH "LEMON library")
    11 SET(LEMON_LIBRARIES "${LEMON_LIBRARY}")
     12set(LEMON_LIBRARY
     13    "@CMAKE_INSTALL_PREFIX@/lib/${LEMON_LIB_NAME}"
     14    CACHE FILEPATH "LEMON library")
     15set(LEMON_LIBRARIES "${LEMON_LIBRARY}")
    1216
    13 MARK_AS_ADVANCED(LEMON_LIBRARY LEMON_INCLUDE_DIR)
     17mark_as_advanced(LEMON_LIBRARY LEMON_INCLUDE_DIR)
  • new file cmake/archive.cmake

    diff -r a278d16bd2d0 cmake/archive.cmake
    - +  
     1#[[
     2This file is a part of LEMON, a generic C++ optimization library.
     3
     4Copyright (C) 2003-2021
     5Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     6(Egervary Research Group on Combinatorial Optimization, EGRES).
     7
     8Permission to use, modify and distribute this software is granted
     9provided that this copyright notice appears in all copies. For
     10precise terms see the accompanying LICENSE file.
     11
     12This software is provided "AS IS" with no warranty of any kind,
     13express or implied, and with no claim as to its suitability for any
     14purpose.
     15]]
     16
     17#[[
     18This file creates compressed files of the current version and places them in the
     19PROJECT_BINARY_DIR as tar.gz and zip files.
     20]]
     21
     22set(ARCHIVE_BASE_NAME ${PROJECT_NAME})
     23string(TOLOWER ${ARCHIVE_BASE_NAME} ARCHIVE_BASE_NAME)
     24set(ARCHIVE_NAME ${ARCHIVE_BASE_NAME}-${PROJECT_VERSION})
     25add_custom_target(
     26  dist
     27  COMMAND cmake -E remove_directory ${ARCHIVE_NAME}
     28  COMMAND hg archive ${ARCHIVE_NAME}
     29  COMMAND cmake -E copy ${PROJECT_NAME}ConfigVersion.cmake
     30          ${ARCHIVE_NAME}/cmake/${PROJECT_NAME}ConfigVersion.cmake
     31  COMMAND tar -czf ${ARCHIVE_BASE_NAME}-nodoc-${PROJECT_VERSION}.tar.gz
     32          ${ARCHIVE_NAME}
     33  COMMAND zip -r ${ARCHIVE_BASE_NAME}-nodoc-${PROJECT_VERSION}.zip
     34          ${ARCHIVE_NAME}
     35  COMMAND cmake -E copy_directory doc/html ${ARCHIVE_NAME}/doc/html
     36  COMMAND tar -czf ${ARCHIVE_NAME}.tar.gz ${ARCHIVE_NAME}
     37  COMMAND zip -r ${ARCHIVE_NAME}.zip ${ARCHIVE_NAME}
     38  COMMAND cmake -E copy_directory doc/html
     39          ${ARCHIVE_BASE_NAME}-doc-${PROJECT_VERSION}
     40  COMMAND tar -czf ${ARCHIVE_BASE_NAME}-doc-${PROJECT_VERSION}.tar.gz
     41          ${ARCHIVE_BASE_NAME}-doc-${PROJECT_VERSION}
     42  COMMAND zip -r ${ARCHIVE_BASE_NAME}-doc-${PROJECT_VERSION}.zip
     43          ${ARCHIVE_BASE_NAME}-doc-${PROJECT_VERSION}
     44  COMMAND cmake -E remove_directory ${ARCHIVE_NAME}
     45  COMMAND cmake -E remove_directory ${ARCHIVE_BASE_NAME}-doc-${PROJECT_VERSION}
     46  DEPENDS html
     47  WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
  • new file cmake/base.cmake

    diff -r a278d16bd2d0 cmake/base.cmake
    - +  
     1#[[
     2This file is a part of LEMON, a generic C++ optimization library.
     3
     4Copyright (C) 2003-2021
     5Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     6(Egervary Research Group on Combinatorial Optimization, EGRES).
     7
     8Permission to use, modify and distribute this software is granted
     9provided that this copyright notice appears in all copies. For
     10precise terms see the accompanying LICENSE file.
     11
     12This software is provided "AS IS" with no warranty of any kind,
     13express or implied, and with no claim as to its suitability for any
     14purpose.
     15]]
     16
     17#[[
     18This file sets up the necessary dependencies and flags required to build the
     19LEMON::LEMON alias (called from here). Also defines main project install target.
     20]]
     21
     22if(DEFINED ENV{LEMON_CXX_WARNING})
     23  set(CXX_WARNING $ENV{LEMON_CXX_WARNING})
     24else()
     25  if(CMAKE_COMPILER_IS_GNUCXX)
     26    list(
     27      APPEND
     28      CXX_WARNING
     29      "-Wall"
     30      "-W"
     31      "-Wunused"
     32      "-Wformat=2"
     33      "-Wctor-dtor-privacy"
     34      "-Wnon-virtual-dtor"
     35      "-Wno-char-subscripts"
     36      "-Wwrite-strings"
     37      "-Wno-char-subscripts"
     38      "-Wreturn-type"
     39      "-Wcast-qual"
     40      "-Wcast-align"
     41      "-Wsign-promo"
     42      "-Woverloaded-virtual"
     43      "-fno-strict-aliasing"
     44      "-Wold-style-cast"
     45      "-Wno-unknown-pragmas"
     46      "-Wno-unused-local-typedefs")
     47    set(CMAKE_CXX_FLAGS_DEBUG CACHE STRING "-ggdb")
     48    set(CMAKE_C_FLAGS_DEBUG CACHE STRING "${CMAKE_CXX_FLAGS_DEBUG}")
     49    if(WIN32 AND MINGW)
     50      list(APPEND CXX_WARNING "-Wa,-mbig-obj" "-O2")
     51    endif()
     52  elseif(MSVC)
     53    # This part is unnecessary 'casue the same is set by the lemon/core.h. Still
     54    # keep it as an example.
     55    # Suppressed warnings:
     56    list(
     57      APPEND
     58      CXX_WARNING
     59      "/wd4250" # 'class1' : inherits 'class2::member' via dominance
     60      "/wd4355" # 'this' : used in base member initializer list
     61      "/wd4503" # 'function' : decorated name length exceeded, name truncated
     62      "/wd4800" # 'type' : forcing value to bool 'true' or 'false'
     63      # (performance warning)
     64      "/wd4996" # 'function': was declared deprecated
     65    )
     66  else()
     67    list(APPEND CXX_WARNING "-Wall")
     68  endif()
     69endif()
     70
     71add_definitions(${CXX_WARNING})
     72
     73if(MSVC)
     74  set(CMAKE_CXX_FLAGS_MAINTAINER
     75      "/WX ${CMAKE_CXX_FLAGS_DEBUG}"
     76      CACHE STRING "Flags used by the C++ compiler during maintainer builds.")
     77  set(CMAKE_C_FLAGS_MAINTAINER
     78      "/WX ${CMAKE_CXX_FLAGS_DEBUG}"
     79      CACHE STRING "Flags used by the C compiler during maintainer builds.")
     80  set(CMAKE_EXE_LINKER_FLAGS_MAINTAINER
     81      "${CMAKE_EXE_LINKER_FLAGS_DEBUG}"
     82      CACHE STRING "Flags used for linking binaries during maintainer builds.")
     83  set(CMAKE_SHARED_LINKER_FLAGS_MAINTAINER
     84      "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}"
     85      CACHE
     86        STRING
     87        "Flags used by the shared libraries linker during maintainer builds.")
     88else()
     89  set(CMAKE_CXX_FLAGS_MAINTAINER
     90      "-Werror -ggdb -O0"
     91      CACHE STRING "Flags used by the C++ compiler during maintainer builds.")
     92  set(CMAKE_C_FLAGS_MAINTAINER
     93      "-Werror -O0"
     94      CACHE STRING "Flags used by the C compiler during maintainer builds.")
     95  set(CMAKE_EXE_LINKER_FLAGS_MAINTAINER
     96      "${CMAKE_EXE_LINKER_FLAGS_DEBUG}"
     97      CACHE STRING "Flags used for linking binaries during maintainer builds.")
     98  set(CMAKE_SHARED_LINKER_FLAGS_MAINTAINER
     99      "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}"
     100      CACHE
     101        STRING
     102        "Flags used by the shared libraries linker during maintainer builds.")
     103endif()
     104
     105mark_as_advanced(
     106  CMAKE_CXX_FLAGS_MAINTAINER CMAKE_C_FLAGS_MAINTAINER
     107  CMAKE_EXE_LINKER_FLAGS_MAINTAINER CMAKE_SHARED_LINKER_FLAGS_MAINTAINER)
     108
     109include(CheckTypeSize)
     110check_type_size("long long" LONG_LONG)
     111set(LEMON_HAVE_LONG_LONG ${HAVE_LONG_LONG})
     112
     113find_package(Threads)
     114
     115if(NOT LEMON_THREADING)
     116  if(CMAKE_USE_PTHREADS_INIT)
     117    set(LEMON_THREADING "Pthread")
     118  elseif(CMAKE_USE_WIN32_THREADS_INIT)
     119    set(LEMON_THREADING "Win32")
     120  else()
     121    set(LEMON_THREADING "None")
     122  endif()
     123endif()
     124
     125set(LEMON_THREADING
     126    "${LEMON_THREADING}"
     127    CACHE STRING
     128          "Choose the threading library, options are: Pthread Win32 None."
     129          FORCE)
     130
     131if(LEMON_THREADING STREQUAL "Pthread")
     132  set(LEMON_USE_PTHREAD ON)
     133elseif(LEMON_THREADING STREQUAL "Win32")
     134  set(LEMON_USE_WIN32_THREADS ON)
     135endif()
     136
     137# GLPK #
     138if(LEMON_ENABLE_GLPK)
     139  find_package(GLPK 4.33)
     140endif()
     141if(GLPK_FOUND)
     142  set(LEMON_HAVE_LP ON)
     143  set(LEMON_HAVE_MIP ON)
     144  set(LEMON_HAVE_GLPK ON)
     145endif()
     146
     147# ILOG #
     148if(LEMON_ENABLE_ILOG)
     149  find_package(ILOG)
     150endif()
     151if(ILOG_FOUND)
     152  set(LEMON_HAVE_LP ON)
     153  set(LEMON_HAVE_MIP ON)
     154  set(LEMON_HAVE_CPLEX ON)
     155endif()
     156
     157# COIN #
     158if(LEMON_ENABLE_COIN)
     159  find_package(COIN)
     160endif()
     161if(COIN_FOUND)
     162  set(LEMON_HAVE_LP ON)
     163  set(LEMON_HAVE_MIP ON)
     164  set(LEMON_HAVE_CLP ON)
     165  set(LEMON_HAVE_CBC ON)
     166endif()
     167
     168# SOPLEX #
     169if(LEMON_ENABLE_SOPLEX)
     170  find_package(SOPLEX)
     171endif()
     172if(SOPLEX_FOUND)
     173  set(LEMON_HAVE_LP ON)
     174  set(LEMON_HAVE_SOPLEX ON)
     175endif()
     176
     177# Set default LP + MIP solver string #
     178if(ILOG_FOUND)
     179  set(DEFAULT_LP "CPLEX")
     180  set(DEFAULT_MIP "CPLEX")
     181elseif(COIN_FOUND)
     182  set(DEFAULT_LP "CLP")
     183  set(DEFAULT_MIP "CBC")
     184elseif(GLPK_FOUND)
     185  set(DEFAULT_LP "GLPK")
     186  set(DEFAULT_MIP "GLPK")
     187elseif(SOPLEX_FOUND)
     188  set(DEFAULT_LP "SOPLEX")
     189endif()
     190
     191if(NOT LEMON_DEFAULT_LP
     192   OR (NOT ILOG_FOUND AND (LEMON_DEFAULT_LP STREQUAL "CPLEX"))
     193   OR (NOT COIN_FOUND AND (LEMON_DEFAULT_LP STREQUAL "CLP"))
     194   OR (NOT GLPK_FOUND AND (LEMON_DEFAULT_LP STREQUAL "GLPK"))
     195   OR (NOT SOPLEX_FOUND AND (LEMON_DEFAULT_LP STREQUAL "SOPLEX")))
     196  set(LEMON_DEFAULT_LP
     197      ${DEFAULT_LP}
     198      CACHE STRING "Default LP solver backend (GLPK, CPLEX, CLP or SOPLEX)"
     199            FORCE)
     200else()
     201  set(LEMON_DEFAULT_LP
     202      ${DEFAULT_LP}
     203      CACHE STRING "Default LP solver backend (GLPK, CPLEX, CLP or SOPLEX)")
     204endif()
     205
     206if(NOT LEMON_DEFAULT_MIP
     207   OR (NOT ILOG_FOUND AND (LEMON_DEFAULT_MIP STREQUAL "CPLEX"))
     208   OR (NOT COIN_FOUND AND (LEMON_DEFAULT_MIP STREQUAL "CBC"))
     209   OR (NOT GLPK_FOUND AND (LEMON_DEFAULT_MIP STREQUAL "GLPK")))
     210  set(LEMON_DEFAULT_MIP
     211      ${DEFAULT_MIP}
     212      CACHE STRING "Default MIP solver backend (GLPK, CPLEX or CBC)" FORCE)
     213else()
     214  set(LEMON_DEFAULT_MIP
     215      ${DEFAULT_MIP}
     216      CACHE STRING "Default MIP solver backend (GLPK, CPLEX or CBC)")
     217endif()
     218
     219add_subdirectory(lemon)
     220
     221include(GNUInstallDirs)
     222
     223install(
     224  EXPORT ${PROJECT_NAME}Targets
     225  NAMESPACE LEMON::
     226  DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
     227
     228include(CMakePackageConfigHelpers)
     229
     230configure_package_config_file(
     231  cmake/Config.cmake.in "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
     232  INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
     233
     234write_basic_package_version_file(
     235  "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
     236  COMPATIBILITY SameMajorVersion)
     237
     238install(
     239  FILES "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
     240        "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
     241  DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
     242  COMPONENT Devel)
  • new file cmake/cpack.cmake

    diff -r a278d16bd2d0 cmake/cpack.cmake
    - +  
     1#[[
     2This file is a part of LEMON, a generic C++ optimization library.
     3
     4Copyright (C) 2003-2021
     5Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     6(Egervary Research Group on Combinatorial Optimization, EGRES).
     7
     8Permission to use, modify and distribute this software is granted
     9provided that this copyright notice appears in all copies. For
     10precise terms see the accompanying LICENSE file.
     11
     12This software is provided "AS IS" with no warranty of any kind,
     13express or implied, and with no claim as to its suitability for any
     14purpose.
     15]]
     16
     17#[[
     18Defines options using in the Pkg config file.
     19]]
     20
     21include(CPack)
     22set(CPACK_PACKAGE_NAME ${PROJECT_NAME})
     23set(CPACK_PACKAGE_VENDOR "EGRES")
     24set(CPACK_PACKAGE_DESCRIPTION_SUMMARY
     25    "LEMON - Library for Efficient Modeling and Optimization in Networks")
     26set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
     27
     28set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
     29
     30set(CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME} ${PROJECT_VERSION}")
     31set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${PROJECT_NAME} ${PROJECT_VERSION}")
     32
     33set(CPACK_COMPONENTS_ALL headers library html_documentation bin)
     34
     35set(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ headers")
     36set(CPACK_COMPONENT_LIBRARY_DISPLAY_NAME "Dynamic-link library")
     37set(CPACK_COMPONENT_BIN_DISPLAY_NAME "Command line utilities")
     38set(CPACK_COMPONENT_HTML_DOCUMENTATION_DISPLAY_NAME "HTML documentation")
     39
     40set(CPACK_COMPONENT_HEADERS_DESCRIPTION "C++ header files")
     41set(CPACK_COMPONENT_LIBRARY_DESCRIPTION "DLL and import library")
     42set(CPACK_COMPONENT_BIN_DESCRIPTION "Command line utilities")
     43set(CPACK_COMPONENT_HTML_DOCUMENTATION_DESCRIPTION
     44    "Doxygen generated documentation")
     45
     46set(CPACK_COMPONENT_HEADERS_DEPENDS library)
     47
     48set(CPACK_COMPONENT_HEADERS_GROUP "Development")
     49set(CPACK_COMPONENT_LIBRARY_GROUP "Development")
     50set(CPACK_COMPONENT_HTML_DOCUMENTATION_GROUP "Documentation")
     51
     52set(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION
     53    "Components needed to develop software using LEMON")
     54set(CPACK_COMPONENT_GROUP_DOCUMENTATION_DESCRIPTION "Documentation of LEMON")
     55
     56set(CPACK_ALL_INSTALL_TYPES Full Developer)
     57
     58set(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full)
     59set(CPACK_COMPONENT_LIBRARY_INSTALL_TYPES Developer Full)
     60set(CPACK_COMPONENT_HTML_DOCUMENTATION_INSTALL_TYPES Full)
     61
     62set(CPACK_GENERATOR "NSIS")
     63set(CPACK_NSIS_MUI_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis/lemon.ico")
     64set(CPACK_NSIS_MUI_UNIICON "${PROJECT_SOURCE_DIR}/cmake/nsis/uninstall.ico")
     65# SET(CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis\\\\installer.bmp")
     66set(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\lemon.ico")
     67set(CPACK_NSIS_DISPLAY_NAME
     68    "${CPACK_PACKAGE_INSTALL_DIRECTORY} ${PROJECT_NAME}")
     69set(CPACK_NSIS_HELP_LINK "http:\\\\\\\\lemon.cs.elte.hu")
     70set(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\lemon.cs.elte.hu")
     71set(CPACK_NSIS_CONTACT "lemon-user@lemon.cs.elte.hu")
     72set(CPACK_NSIS_CREATE_ICONS_EXTRA
     73    "
     74    CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Documentation.lnk\\\" \\\"$INSTDIR\\\\share\\\\doc\\\\index.html\\\"
     75    ")
     76set(CPACK_NSIS_DELETE_ICONS_EXTRA
     77    "
     78    !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
     79    Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\Documentation.lnk\\\"
     80    ")
  • contrib/CMakeLists.txt

    diff -r a278d16bd2d0 contrib/CMakeLists.txt
    a b  
    1 INCLUDE_DIRECTORIES(
    2   ${PROJECT_SOURCE_DIR}
    3   ${PROJECT_BINARY_DIR}
    4 )
    5 
    6 LINK_DIRECTORIES(
    7   ${PROJECT_BINARY_DIR}/lemon
    8 )
    9 
    101# Uncomment (and adjust) the following two lines. 'myprog' is the name
    112# of the final executable ('.exe' will automatically be added to the
    123# name on Windows) and 'myprog-main.cc' is the source code it is
     
    145# whitespaces. Moreover, you can add multiple similar blocks if you
    156# want to build more than one executables.
    167
    17 # ADD_EXECUTABLE(myprog myprog-main.cc)
    18 # TARGET_LINK_LIBRARIES(myprog lemon)
    19 
     8add_executable(myprog myprog-main.cc)
     9target_link_libraries(myprog LEMON::LEMON)
  • demo/CMakeLists.txt

    diff -r a278d16bd2d0 demo/CMakeLists.txt
    a b  
    1 INCLUDE_DIRECTORIES(
    2   ${PROJECT_SOURCE_DIR}
    3   ${PROJECT_BINARY_DIR}
    4 )
     1#[[
     2This file is a part of LEMON, a generic C++ optimization library.
     3
     4Copyright (C) 2003-2021
     5Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     6(Egervary Research Group on Combinatorial Optimization, EGRES).
     7
     8Permission to use, modify and distribute this software is granted
     9provided that this copyright notice appears in all copies. For
     10precise terms see the accompanying LICENSE file.
    511
    6 LINK_DIRECTORIES(
    7   ${PROJECT_BINARY_DIR}/lemon
    8 )
     12This software is provided "AS IS" with no warranty of any kind,
     13express or implied, and with no claim as to its suitability for any
     14purpose.
     15]]
     16
     17#[[
     18This file builds an example project consuming LEMON in three different ways:
     191. Using locally installed LEMON - find_package.
     202. Using add_subdirectory.
     213. Using FetchContent.
     22]]
    923
    10 SET(DEMOS
    11   arg_parser_demo
    12   graph_to_eps_demo
    13   lgf_demo
    14 )
     24cmake_minimum_required(VERSION 3.15)
     25project(
     26  demo
     27  VERSION 0.1.0
     28  LANGUAGES CXX)
     29
     30# Option 1.
     31# find_package(LEMON REQUIRED)
     32
     33# Option 2.
     34# add_subdirectory(path-to-lemon)
    1535
    16 FOREACH(DEMO_NAME ${DEMOS})
    17   ADD_EXECUTABLE(${DEMO_NAME} ${DEMO_NAME}.cc)
    18   TARGET_LINK_LIBRARIES(${DEMO_NAME} lemon)
    19 ENDFOREACH()
     36# Option 3. (works with updated repo)
     37# find_package(Hg)
     38# if(HG_FOUND)
     39#   FetchContent_Declare(
     40#     LEMON
     41#     HG_REPOSITORY "https://lemon.cs.elte.hu/hg/lemon/"
     42#     )
     43# else()
     44#   FetchContent_Declare(
     45#     SOURCE_DIR "path-to-lemon-src")
     46# endif()
     47# FetchContent_MakeAvailable(LEMON)
     48
     49set(DEMOS arg_parser_demo graph_to_eps_demo lgf_demo)
     50
     51foreach(DEMO_NAME ${DEMOS})
     52  add_executable(${DEMO_NAME} ${DEMO_NAME}.cc)
     53  target_link_libraries(${DEMO_NAME} LEMON::LEMON)
     54endforeach()
  • doc/CMakeLists.txt

    diff -r a278d16bd2d0 doc/CMakeLists.txt
    a b  
    1 SET(PACKAGE_NAME ${PROJECT_NAME})
    2 SET(PACKAGE_VERSION ${PROJECT_VERSION})
    3 SET(abs_top_srcdir ${PROJECT_SOURCE_DIR})
    4 SET(abs_top_builddir ${PROJECT_BINARY_DIR})
     1#[[
     2This file is a part of LEMON, a generic C++ optimization library.
     3
     4Copyright (C) 2003-2021
     5Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     6(Egervary Research Group on Combinatorial Optimization, EGRES).
     7
     8Permission to use, modify and distribute this software is granted
     9provided that this copyright notice appears in all copies. For
     10precise terms see the accompanying LICENSE file.
    511
    6 SET(LEMON_DOC_SOURCE_BROWSER "NO" CACHE STRING "Include source into the doc (YES/NO).")
    7 SET(LEMON_DOC_USE_MATHJAX "NO" CACHE STRING "Use MathJax to display math formulae (YES/NO).")
    8 SET(LEMON_DOC_MATHJAX_RELPATH "http://www.mathjax.org/mathjax" CACHE STRING "MathJax library location.")
     12This software is provided "AS IS" with no warranty of any kind,
     13express or implied, and with no claim as to its suitability for any
     14purpose.
     15]]
    916
    10 SET(LEMON_DOC_LIBSTDC++_URL
    11   "http://gcc.gnu.org/onlinedocs/gcc-4.7.3/libstdc++/api"
    12   CACHE STRING "GCC libstdc++ doxygen doc url.")
     17#[[
     18This file orchestrates the build of the docs.
     19]]
     20
     21find_package(Doxygen REQUIRED)
     22find_package(Ghostscript REQUIRED)
     23find_package(PythonInterp REQUIRED)
     24find_package(Wget REQUIRED)
    1325
     26set(PACKAGE_NAME ${PROJECT_NAME})
     27set(PACKAGE_VERSION ${PROJECT_VERSION})
     28set(abs_top_srcdir ${PROJECT_SOURCE_DIR})
     29set(abs_top_builddir ${PROJECT_BINARY_DIR})
    1430
    15 CONFIGURE_FILE(
    16   ${PROJECT_SOURCE_DIR}/doc/Doxyfile.in
    17   ${PROJECT_BINARY_DIR}/doc/Doxyfile
    18   @ONLY
    19 )
     31set(LEMON_DOC_SOURCE_BROWSER
     32    OFF
     33    CACHE BOOL "Include source into the doc.")
     34set(LEMON_DOC_USE_MATHJAX
     35    OFF
     36    CACHE BOOL "Use MathJax to display math formulae.")
     37set(LEMON_DOC_MATHJAX_RELPATH
     38    "http://www.mathjax.org/mathjax"
     39    CACHE STRING "MathJax library location.")
    2040
    21 CONFIGURE_FILE(
    22   ${PROJECT_SOURCE_DIR}/doc/mainpage.dox.in
    23   ${PROJECT_BINARY_DIR}/doc/mainpage.dox
    24   @ONLY
    25 )
     41set(LEMON_DOC_LIBSTDC++_URL
     42    "http://gcc.gnu.org/onlinedocs/gcc-4.7.3/libstdc++/api"
     43    CACHE STRING "GCC libstdc++ doxygen doc url.")
     44
     45configure_file(${PROJECT_SOURCE_DIR}/doc/Doxyfile.in
     46               ${PROJECT_BINARY_DIR}/doc/Doxyfile @ONLY)
     47
     48configure_file(${PROJECT_SOURCE_DIR}/doc/mainpage.dox.in
     49               ${PROJECT_BINARY_DIR}/doc/mainpage.dox @ONLY)
    2650
    2751# Copy doc from source (if exists)
    28 IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/html AND
    29     NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/html/index.html)
    30   MESSAGE(STATUS "Copy doc from source tree")
    31   EXECUTE_PROCESS(
    32     COMMAND cmake -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/html ${CMAKE_CURRENT_BINARY_DIR}/html
    33     )
    34 ENDIF()
     52if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/html
     53   AND NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/html/index.html)
     54  message(STATUS "Copy doc from source tree")
     55  execute_process(
     56    COMMAND cmake -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/html
     57            ${CMAKE_CURRENT_BINARY_DIR}/html)
     58endif()
    3559
    36 IF(DOXYGEN_EXECUTABLE AND PYTHONINTERP_FOUND AND GHOSTSCRIPT_EXECUTABLE)
    37   FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/)
    38   SET(GHOSTSCRIPT_OPTIONS -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha)
    39   ADD_CUSTOM_TARGET(html
     60if(DOXYGEN_EXECUTABLE
     61   AND PYTHONINTERP_FOUND
     62   AND GHOSTSCRIPT_EXECUTABLE)
     63  file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/)
     64  set(GHOSTSCRIPT_OPTIONS
     65      "-dNOPAUSE"
     66      "-dBATCH"
     67      "-q"
     68      "-dEPSCrop"
     69      "-dTextAlphaBits=4"
     70      "-dGraphicsAlphaBits=4"
     71      "-sDEVICE=pngalpha")
     72  add_custom_target(
     73    html
    4074    COMMAND ${CMAKE_COMMAND} -E remove_directory gen-images
    4175    COMMAND ${CMAKE_COMMAND} -E make_directory gen-images
    42     COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r20 -sOutputFile=gen-images/grid_graph.png ${CMAKE_CURRENT_SOURCE_DIR}/images/grid_graph.eps
    43     COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r32 -sOutputFile=gen-images/adaptors2.png ${CMAKE_CURRENT_SOURCE_DIR}/images/adaptors2.eps
    44     COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r32 -sOutputFile=gen-images/connected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/connected_components.eps
    45     COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r32 -sOutputFile=gen-images/strongly_connected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/strongly_connected_components.eps
    46     COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r32 -sOutputFile=gen-images/node_biconnected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/node_biconnected_components.eps
    47     COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r32 -sOutputFile=gen-images/edge_biconnected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/edge_biconnected_components.eps
    48     COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r32 -sOutputFile=gen-images/bipartite_partitions.png ${CMAKE_CURRENT_SOURCE_DIR}/images/bipartite_partitions.eps
    49     COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r24 -sOutputFile=gen-images/matching.png ${CMAKE_CURRENT_SOURCE_DIR}/images/matching.eps
    50     COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r24 -sOutputFile=gen-images/bipartite_matching.png ${CMAKE_CURRENT_SOURCE_DIR}/images/bipartite_matching.eps
    51     COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r40 -sOutputFile=gen-images/planar.png ${CMAKE_CURRENT_SOURCE_DIR}/images/planar.eps
    52     COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r24 -sOutputFile=gen-images/tsp.png ${CMAKE_CURRENT_SOURCE_DIR}/images/tsp.eps
    53     COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r8 -sOutputFile=gen-images/nodeshape_0.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_0.eps
    54     COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r8 -sOutputFile=gen-images/nodeshape_1.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_1.eps
    55     COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r8 -sOutputFile=gen-images/nodeshape_2.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_2.eps
    56     COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r8 -sOutputFile=gen-images/nodeshape_3.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_3.eps
    57     COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r8 -sOutputFile=gen-images/nodeshape_4.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_4.eps
     76    COMMAND
     77      ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r20
     78      -sOutputFile=gen-images/grid_graph.png
     79      ${CMAKE_CURRENT_SOURCE_DIR}/images/grid_graph.eps
     80    COMMAND
     81      ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r32
     82      -sOutputFile=gen-images/adaptors2.png
     83      ${CMAKE_CURRENT_SOURCE_DIR}/images/adaptors2.eps
     84    COMMAND
     85      ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r32
     86      -sOutputFile=gen-images/connected_components.png
     87      ${CMAKE_CURRENT_SOURCE_DIR}/images/connected_components.eps
     88    COMMAND
     89      ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r32
     90      -sOutputFile=gen-images/strongly_connected_components.png
     91      ${CMAKE_CURRENT_SOURCE_DIR}/images/strongly_connected_components.eps
     92    COMMAND
     93      ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r32
     94      -sOutputFile=gen-images/node_biconnected_components.png
     95      ${CMAKE_CURRENT_SOURCE_DIR}/images/node_biconnected_components.eps
     96    COMMAND
     97      ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r32
     98      -sOutputFile=gen-images/edge_biconnected_components.png
     99      ${CMAKE_CURRENT_SOURCE_DIR}/images/edge_biconnected_components.eps
     100    COMMAND
     101      ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r32
     102      -sOutputFile=gen-images/bipartite_partitions.png
     103      ${CMAKE_CURRENT_SOURCE_DIR}/images/bipartite_partitions.eps
     104    COMMAND
     105      ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r24
     106      -sOutputFile=gen-images/matching.png
     107      ${CMAKE_CURRENT_SOURCE_DIR}/images/matching.eps
     108    COMMAND
     109      ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r24
     110      -sOutputFile=gen-images/bipartite_matching.png
     111      ${CMAKE_CURRENT_SOURCE_DIR}/images/bipartite_matching.eps
     112    COMMAND
     113      ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r40
     114      -sOutputFile=gen-images/planar.png
     115      ${CMAKE_CURRENT_SOURCE_DIR}/images/planar.eps
     116    COMMAND
     117      ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r24
     118      -sOutputFile=gen-images/tsp.png ${CMAKE_CURRENT_SOURCE_DIR}/images/tsp.eps
     119    COMMAND
     120      ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r8
     121      -sOutputFile=gen-images/nodeshape_0.png
     122      ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_0.eps
     123    COMMAND
     124      ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r8
     125      -sOutputFile=gen-images/nodeshape_1.png
     126      ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_1.eps
     127    COMMAND
     128      ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r8
     129      -sOutputFile=gen-images/nodeshape_2.png
     130      ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_2.eps
     131    COMMAND
     132      ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r8
     133      -sOutputFile=gen-images/nodeshape_3.png
     134      ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_3.eps
     135    COMMAND
     136      ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r8
     137      -sOutputFile=gen-images/nodeshape_4.png
     138      ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_4.eps
    58139    COMMAND ${CMAKE_COMMAND} -E remove_directory html
    59140    COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile
    60     WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
    61   )
    62 
    63   SET_TARGET_PROPERTIES(html PROPERTIES PROJECT_LABEL BUILD_DOC)
    64 
    65   IF(UNIX)
    66     INSTALL(
     141    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
     142  # set_target_properties(html PROPERTIES PROJECT_LABEL BUILD_DOC)
     143  if(UNIX)
     144    install(
    67145      DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/
    68146      DESTINATION share/doc/lemon/html
    69       COMPONENT html_documentation
    70     )
    71   ELSEIF(WIN32)
    72     INSTALL(
     147      COMPONENT html_documentation)
     148  elseif(WIN32)
     149    install(
    73150      DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/
    74151      DESTINATION doc
    75       COMPONENT html_documentation
    76     )
    77   ENDIF()
    78 
    79 ENDIF()
     152      COMPONENT html_documentation)
     153  endif()
     154endif()
    80155
    81 IF(WGET_FOUND)
    82 ADD_CUSTOM_TARGET(update-external-tags
    83   COMMAND ${WGET_EXECUTABLE} -N ${LEMON_DOC_LIBSTDC++_URL}/libstdc++.tag
    84   WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
    85   )
    86 ENDIF()
     156if(WGET_FOUND)
     157  add_custom_target(
     158    update-external-tags
     159    COMMAND ${WGET_EXECUTABLE} -N ${LEMON_DOC_LIBSTDC++_URL}/libstdc++.tag
     160    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
     161endif()
  • lemon/CMakeLists.txt

    diff -r a278d16bd2d0 lemon/CMakeLists.txt
    a b  
    1 INCLUDE_DIRECTORIES(
    2   ${PROJECT_SOURCE_DIR}
    3   ${PROJECT_BINARY_DIR}
    4 )
     1#[[
     2This file is a part of LEMON, a generic C++ optimization library.
     3
     4Copyright (C) 2003-2021
     5Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     6(Egervary Research Group on Combinatorial Optimization, EGRES).
     7
     8Permission to use, modify and distribute this software is granted
     9provided that this copyright notice appears in all copies. For
     10precise terms see the accompanying LICENSE file.
    511
    6 CONFIGURE_FILE(
    7   ${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
    8   ${CMAKE_CURRENT_BINARY_DIR}/config.h
    9 )
     12This software is provided "AS IS" with no warranty of any kind,
     13express or implied, and with no claim as to its suitability for any
     14purpose.
     15]]
    1016
    11 CONFIGURE_FILE(
    12   ${CMAKE_CURRENT_SOURCE_DIR}/lemon.pc.in
    13   ${CMAKE_CURRENT_BINARY_DIR}/lemon.pc
    14   @ONLY
    15 )
     17#[[
     18This file defines the lemon target and LEMON::LEMON alias.
     19]]
     20
     21set(NAME lemon)
    1622
    17 SET(LEMON_SOURCES
    18   arg_parser.cc
    19   base.cc
    20   color.cc
    21   lp_base.cc
    22   lp_skeleton.cc
    23   random.cc
    24   bits/windows.cc
    25 )
     23# Configure
     24configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
     25               ${CMAKE_CURRENT_BINARY_DIR}/config.h)
     26# Configure lemon package file
     27configure_file(${CMAKE_CURRENT_SOURCE_DIR}/lemon.pc.in
     28               ${CMAKE_CURRENT_BINARY_DIR}/lemon.pc @ONLY)
    2629
    27 IF(LEMON_HAVE_GLPK)
    28   SET(LEMON_SOURCES ${LEMON_SOURCES} glpk.cc)
    29   INCLUDE_DIRECTORIES(${GLPK_INCLUDE_DIRS})
    30   IF(WIN32)
    31     INSTALL(FILES ${GLPK_BIN_DIR}/glpk.dll DESTINATION bin)
    32     INSTALL(FILES ${GLPK_BIN_DIR}/libltdl3.dll DESTINATION bin)
    33     INSTALL(FILES ${GLPK_BIN_DIR}/zlib1.dll DESTINATION bin)
    34   ENDIF()
    35 ENDIF()
     30set(LEMON_SOURCES
     31    arg_parser.cc
     32    base.cc
     33    color.cc
     34    lp_base.cc
     35    lp_skeleton.cc
     36    random.cc
     37    bits/windows.cc)
    3638
    37 IF(LEMON_HAVE_CPLEX)
    38   SET(LEMON_SOURCES ${LEMON_SOURCES} cplex.cc)
    39   INCLUDE_DIRECTORIES(${ILOG_INCLUDE_DIRS})
    40 ENDIF()
     39if(LEMON_HAVE_GLPK)
     40  set(LEMON_SOURCES ${LEMON_SOURCES} glpk.cc)
     41  include_directories(${GLPK_INCLUDE_DIRS})
     42  if(WIN32)
     43    install(FILES ${GLPK_BIN_DIR}/glpk.dll DESTINATION bin)
     44    install(FILES ${GLPK_BIN_DIR}/libltdl3.dll DESTINATION bin)
     45    install(FILES ${GLPK_BIN_DIR}/zlib1.dll DESTINATION bin)
     46  endif()
     47endif()
    4148
    42 IF(LEMON_HAVE_CLP)
    43   SET(LEMON_SOURCES ${LEMON_SOURCES} clp.cc)
    44   INCLUDE_DIRECTORIES(${COIN_INCLUDE_DIRS})
    45 ENDIF()
     49if(LEMON_HAVE_CPLEX)
     50  set(LEMON_SOURCES ${LEMON_SOURCES} cplex.cc)
     51  include_directories(${ILOG_INCLUDE_DIRS})
     52endif()
    4653
    47 IF(LEMON_HAVE_CBC)
    48   SET(LEMON_SOURCES ${LEMON_SOURCES} cbc.cc)
    49   INCLUDE_DIRECTORIES(${COIN_INCLUDE_DIRS})
    50 ENDIF()
     54if(LEMON_HAVE_CLP)
     55  set(LEMON_SOURCES ${LEMON_SOURCES} clp.cc)
     56  include_directories(${COIN_INCLUDE_DIRS})
     57endif()
    5158
    52 IF(LEMON_HAVE_SOPLEX)
    53   SET(LEMON_SOURCES ${LEMON_SOURCES} soplex.cc)
    54   INCLUDE_DIRECTORIES(${SOPLEX_INCLUDE_DIRS})
    55 ENDIF()
     59if(LEMON_HAVE_CBC)
     60  set(LEMON_SOURCES ${LEMON_SOURCES} cbc.cc)
     61  include_directories(${COIN_INCLUDE_DIRS})
     62endif()
    5663
    57 ADD_LIBRARY(lemon ${LEMON_SOURCES})
     64if(LEMON_HAVE_SOPLEX)
     65  set(LEMON_SOURCES ${LEMON_SOURCES} soplex.cc)
     66  include_directories(${SOPLEX_INCLUDE_DIRS})
     67endif()
     68
     69file(GLOB _HDRS "*.h" "bits/*h" "concepts/*.h")
     70
     71add_library(${NAME} ${LEMON_SOURCES} ${_HDRS})
    5872
    59 TARGET_LINK_LIBRARIES(lemon
    60   ${GLPK_LIBRARIES} ${COIN_LIBRARIES} ${ILOG_LIBRARIES} ${SOPLEX_LIBRARIES}
    61   )
     73# Compile options (needed for MacOS)
     74set_target_properties(
     75  ${NAME}
     76  PROPERTIES CXX_STANDARD 17
     77             CXX_STANDARD_REQUIRED ON
     78             CXX_EXTENSIONS OFF
     79             POSITION_INDEPENDENT_CODE ON)
    6280
    63 IF(UNIX)
    64   SET_TARGET_PROPERTIES(lemon PROPERTIES OUTPUT_NAME emon VERSION ${LEMON_VERSION} SOVERSION ${LEMON_VERSION})
    65 ENDIF()
     81target_compile_features(${NAME} PUBLIC cxx_std_17)
    6682
    67 INSTALL(
    68   TARGETS lemon
    69   ARCHIVE DESTINATION lib
    70   LIBRARY DESTINATION lib
    71   COMPONENT library
    72 )
     83target_link_libraries(${NAME} ${GLPK_LIBRARIES} ${COIN_LIBRARIES}
     84                      ${ILOG_LIBRARIES} ${SOPLEX_LIBRARIES})
     85
     86# Target output name depends on OS: libemon if on UNIX (LINUX and MacOS),
     87# liblemon if on WIN32.
     88set_target_properties(
     89  ${NAME}
     90  PROPERTIES PUBLIC_HEADER "${_HDRS};${CMAKE_CURRENT_BINARY_DIR}/config.h"
     91             OUTPUT_NAME $<IF:$<BOOL:${UNIX}>,emon,${NAME}>
     92             VERSION ${PROJECT_VERSION}
     93             SOVERSION ${PROJECT_VERSION_MAJOR})
    7394
    74 INSTALL(
    75   DIRECTORY . bits concepts
    76   DESTINATION include/lemon
    77   COMPONENT headers
    78   FILES_MATCHING PATTERN "*.h"
    79 )
     95target_include_directories(
     96  ${NAME} PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
     97                 $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>)
     98# Add alias
     99add_library(LEMON::LEMON ALIAS ${NAME})
    80100
    81 INSTALL(
    82   FILES ${CMAKE_CURRENT_BINARY_DIR}/config.h
    83   DESTINATION include/lemon
    84   COMPONENT headers
    85 )
     101# Install targets
     102include(GNUInstallDirs)
     103install(
     104  TARGETS ${NAME}
     105  EXPORT ${PROJECT_NAME}Targets
     106  PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/lemon
     107  ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
     108  LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
    86109
    87 INSTALL(
    88   FILES ${CMAKE_CURRENT_BINARY_DIR}/lemon.pc
    89   DESTINATION lib/pkgconfig
    90 )
    91 
     110# Pkg-config
     111install(FILES ${CMAKE_CURRENT_BINARY_DIR}/lemon.pc DESTINATION lib/pkgconfig)
  • tools/CMakeLists.txt

    diff -r a278d16bd2d0 tools/CMakeLists.txt
    a b  
    1 INCLUDE_DIRECTORIES(
    2   ${PROJECT_SOURCE_DIR}
    3   ${PROJECT_BINARY_DIR}
    4 )
     1#[[
     2This file is a part of LEMON, a generic C++ optimization library.
     3
     4Copyright (C) 2003-2021
     5Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     6(Egervary Research Group on Combinatorial Optimization, EGRES).
    57
    6 LINK_DIRECTORIES(
    7   ${PROJECT_BINARY_DIR}/lemon
    8 )
     8Permission to use, modify and distribute this software is granted
     9provided that this copyright notice appears in all copies. For
     10precise terms see the accompanying LICENSE file.
    911
    10 ADD_EXECUTABLE(lgf-gen lgf-gen.cc)
    11 TARGET_LINK_LIBRARIES(lgf-gen lemon)
     12This software is provided "AS IS" with no warranty of any kind,
     13express or implied, and with no claim as to its suitability for any
     14purpose.
     15]]
    1216
    13 ADD_EXECUTABLE(dimacs-to-lgf dimacs-to-lgf.cc)
    14 TARGET_LINK_LIBRARIES(dimacs-to-lgf lemon)
     17#[[
     18This file builds some optional tools.
     19]]
    1520
    16 ADD_EXECUTABLE(dimacs-solver dimacs-solver.cc)
    17 TARGET_LINK_LIBRARIES(dimacs-solver lemon)
     21add_executable(lgf-gen lgf-gen.cc)
     22target_link_libraries(lgf-gen LEMON::LEMON)
     23
     24add_executable(dimacs-to-lgf dimacs-to-lgf.cc)
     25target_link_libraries(dimacs-to-lgf LEMON::LEMON)
    1826
    19 INSTALL(
    20   TARGETS lgf-gen dimacs-to-lgf dimacs-solver
    21   RUNTIME DESTINATION bin
    22   COMPONENT bin
    23 )
     27add_executable(dimacs-solver dimacs-solver.cc)
     28target_link_libraries(dimacs-solver LEMON::LEMON)
    2429
    25 IF(NOT WIN32)
    26   INSTALL(
     30install(TARGETS lgf-gen dimacs-to-lgf dimacs-solver RUNTIME DESTINATION bin
     31                                                            COMPONENT bin)
     32
     33# TODO: Check
     34if(NOT WIN32)
     35  install(
    2736    PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/lemon-0.x-to-1.x.sh
    2837    DESTINATION bin
    29     COMPONENT bin
    30   )
    31 ENDIF()
     38    COMPONENT bin)
     39endif()