Ticket #658: cmake_rework.2.diff
File cmake_rework.2.diff, 84.1 KB (added by , 3 years ago) |
---|
-
CMakeLists.txt
diff -r a278d16bd2d0 CMakeLists.txt
a b 1 CMAKE_MINIMUM_REQUIRED(VERSION 2.8) 1 #[[ 2 This file is a part of LEMON, a generic C++ optimization library. 2 3 3 IF(POLICY CMP0048) 4 CMAKE_POLICY(SET CMP0048 OLD) 5 ENDIF(POLICY CMP0048) 4 Copyright (C) 2003-2021 5 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 6 (Egervary Research Group on Combinatorial Optimization, EGRES). 6 7 7 IF(POLICY CMP0043) 8 CMAKE_POLICY(SET CMP0043 NEW) 9 ENDIF(POLICY CMP0043) 8 Permission to use, modify and distribute this software is granted 9 provided that this copyright notice appears in all copies. For 10 precise terms see the accompanying LICENSE file. 10 11 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) 12 This software is provided "AS IS" with no warranty of any kind, 13 express or implied, and with no claim as to its suitability for any 14 purpose. 15 ]] 15 16 16 SET(PROJECT_NAME "LEMON") 17 PROJECT(${PROJECT_NAME}) 17 #[[ 18 This file defines the build options and orchestrates the build by including 19 files in the cmake directory. 20 ]] 18 21 19 INCLUDE(FindPythonInterp) 20 INCLUDE(FindWget) 22 cmake_minimum_required(VERSION 3.15) 23 list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") 24 25 project(LEMON LANGUAGES CXX C) 21 26 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}" 27 # Get version 28 find_package(Hg) 29 if(EXISTS ${PROJECT_SOURCE_DIR}/cmake/LEMONVersion.cmake) 30 include(${PROJECT_SOURCE_DIR}/cmake/LEMONVersion.cmake) 31 elseif(DEFINED ENV{LEMON_VERSION}) 32 set(LEMON_VERSION 33 $ENV{LEMON_VERSION} 34 CACHE STRING "LEMON version string.") 35 elseif(HG_FOUND) 36 execute_process( 37 COMMAND hg log -r. --template "{latesttag}" 30 38 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} 31 39 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}" 40 ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) 41 execute_process( 42 COMMAND hg log -r. --template "{latesttagdistance}" 38 43 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} 39 44 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}" 45 ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) 46 execute_process( 47 COMMAND hg log -r. --template "{node|short}" 46 48 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} 47 49 OUTPUT_VARIABLE HG_REVISION_ID 48 ERROR_QUIET 49 OUTPUT_STRIP_TRAILING_WHITESPACE 50 ) 51 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() 67 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.") 86 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) 119 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() 50 ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) 51 if(HG_REVISION_TAG STREQUAL "") 52 set(HG_REVISION_ID "hg-tip") 53 else() 54 if(HG_REVISION_TAG STREQUAL "null") 55 set(HG_REVISION_TAG "trunk") 56 elseif(HG_REVISION_TAG MATCHES "^r") 57 string(SUBSTRING ${HG_REVISION_TAG} 1 -1 HG_REVISION_TAG) 58 endif() 59 if(HG_REVISION_DIST STREQUAL "0") 60 set(HG_REVISION ${HG_REVISION_TAG}) 61 else() 62 set(HG_REVISION 63 "${HG_REVISION_TAG}+${HG_REVISION_DIST}-${HG_REVISION_ID}") 64 endif() 65 endif() 66 set(LEMON_VERSION ${HG_REVISION}) 67 endif() 132 68 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() 69 # OS 70 if(WIN32) 71 set(LEMON_WIN32 ON) 72 endif() 154 73 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() 162 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. 179 180 # SET(CXX_WARNING "/wd4250 /wd4267 /wd4355 /wd4503 /wd4800 /wd4996") 74 # Building Options # 181 75 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}") 76 # Solvers 77 option(LEMON_ENABLE_GLPK "Enable GLPK solver backend." OFF) 78 option(LEMON_ENABLE_ILOG "Enable ILOG (CPLEX) solver backend." OFF) 79 option(LEMON_ENABLE_COIN "Enable COIN solver backend." OFF) 80 option(LEMON_ENABLE_SOPLEX "Enable SoPlex solver backend." OFF) 197 81 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() 82 # Building + Testing 83 option(LEMON_BUILD_TESTING "Enable unit tests" ON) 84 option(LEMON_MAINTAINER "Enable Maintainer options." OFF) 85 option(LEMON_BUILD_DOCS "Enable docs using doxygen and ghostcript" OFF) 86 option(LEMON_BUILD_TOOLS "Enable project in tools directory" OFF) 87 option(LEMON_BUILD_DEMO "Enable project in demo directory" OFF) 88 option(LEMON_BUILD_ARCHIVE "Enable to create archive" OFF) 89 option(LEMON_BUILD_CPACK "Enable to create cpack" OFF) 90 option(LEMON_TEST_WITH_VALGRIND "Run the tests with valgrind" OFF) 91 option(LEMON_ENABLE_DEBUG "Display debug messages" OFF) 230 92 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() 93 if(NOT CMAKE_BUILD_TYPE) 94 set(CMAKE_BUILD_TYPE "Release") 95 endif() 244 96 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 ) 252 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) 97 set(CMAKE_BUILD_TYPE 98 "${CMAKE_BUILD_TYPE}" 99 CACHE 100 STRING 101 "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." 102 FORCE) 263 103 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() 104 enable_testing() 273 105 274 SET( LEMON_THREADING "${LEMON_THREADING}" CACHE STRING 275 "Choose the threading library, options are: Pthread Win32 None." 276 FORCE ) 277 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() 106 # Add LEMON::LEMON target 107 include(base) 285 108 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() 292 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() 109 if(LEMON_MAINTAINER) 110 add_custom_target(check ALL COMMAND ${CMAKE_CTEST_COMMAND}) 111 else() 112 add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}) 113 endif() 308 114 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() 325 326 CONFIGURE_FILE( 327 ${PROJECT_SOURCE_DIR}/cmake/version.cmake.in 328 ${PROJECT_BINARY_DIR}/cmake/version.cmake 329 @ONLY 330 ) 115 if(LEMON_BUILD_TESTING) 116 add_subdirectory(test) 117 endif() 331 118 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}) 119 if(LEMON_BUILD_TOOLS) 120 add_subdirectory(tools) 121 endif() 351 122 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}) 123 if(LEMON_BUILD_DOCS) 124 add_subdirectory(doc) 125 endif() 361 126 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") 373 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") 127 if(LEMON_BUILD_DEMO) 128 add_subdirectory(demo) 129 endif() 388 130 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) 131 if(LEMON_BUILD_ARCHIVE) 132 include(archive) 133 endif() 399 134 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() 135 if(LEMON_BUILD_CPACK) 136 include(cpack) 137 endif() -
new file cmake/Config.cmake.in
diff -r a278d16bd2d0 cmake/Config.cmake.in
- + 1 @PACKAGE_INIT@ 2 3 include("${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 #[[ 2 This file is a part of LEMON, a generic C++ optimization library. 3 4 Copyright (C) 2003-2021 5 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 6 (Egervary Research Group on Combinatorial Optimization, EGRES). 7 8 Permission to use, modify and distribute this software is granted 9 provided that this copyright notice appears in all copies. For 10 precise terms see the accompanying LICENSE file. 2 11 3 FIND_PATH(COIN_INCLUDE_DIR coin/CoinUtilsConfig.h 4 HINTS ${COIN_ROOT_DIR}/include 5 ) 6 FIND_LIBRARY(COIN_CBC_LIBRARY 12 This software is provided "AS IS" with no warranty of any kind, 13 express or implied, and with no claim as to its suitability for any 14 purpose. 15 ]] 16 17 #[[ 18 This file finds the necessary components of the COIN-OR libraries. 19 Cbc, Clp, Cgl, Osi, and Vol 20 ]] 21 22 set(COIN_ROOT_DIR 23 "" 24 CACHE PATH "COIN root directory") 25 26 find_path(COIN_INCLUDE_DIR coin/CoinUtilsConfig.h 27 HINTS ${COIN_ROOT_DIR}/include) 28 find_library( 29 COIN_CBC_LIBRARY 7 30 NAMES Cbc libCbc 8 31 HINTS ${COIN_ROOT_DIR}/lib/coin 9 HINTS ${COIN_ROOT_DIR}/lib 10 ) 11 FIND_LIBRARY(COIN_CBC_SOLVER_LIBRARY32 HINTS ${COIN_ROOT_DIR}/lib) 33 find_library( 34 COIN_CBC_SOLVER_LIBRARY 12 35 NAMES CbcSolver libCbcSolver 13 36 HINTS ${COIN_ROOT_DIR}/lib/coin 14 HINTS ${COIN_ROOT_DIR}/lib 15 ) 16 FIND_LIBRARY(COIN_CGL_LIBRARY37 HINTS ${COIN_ROOT_DIR}/lib) 38 find_library( 39 COIN_CGL_LIBRARY 17 40 NAMES Cgl libCgl 18 41 HINTS ${COIN_ROOT_DIR}/lib/coin 19 HINTS ${COIN_ROOT_DIR}/lib 20 ) 21 FIND_LIBRARY(COIN_CLP_LIBRARY42 HINTS ${COIN_ROOT_DIR}/lib) 43 find_library( 44 COIN_CLP_LIBRARY 22 45 NAMES Clp libClp 23 46 HINTS ${COIN_ROOT_DIR}/lib/coin 24 HINTS ${COIN_ROOT_DIR}/lib 25 ) 26 FIND_LIBRARY(COIN_COIN_UTILS_LIBRARY47 HINTS ${COIN_ROOT_DIR}/lib) 48 find_library( 49 COIN_COIN_UTILS_LIBRARY 27 50 NAMES CoinUtils libCoinUtils 28 51 HINTS ${COIN_ROOT_DIR}/lib/coin 29 HINTS ${COIN_ROOT_DIR}/lib 30 ) 31 FIND_LIBRARY(COIN_OSI_LIBRARY52 HINTS ${COIN_ROOT_DIR}/lib) 53 find_library( 54 COIN_OSI_LIBRARY 32 55 NAMES Osi libOsi 33 56 HINTS ${COIN_ROOT_DIR}/lib/coin 34 HINTS ${COIN_ROOT_DIR}/lib 35 ) 36 FIND_LIBRARY(COIN_OSI_CBC_LIBRARY57 HINTS ${COIN_ROOT_DIR}/lib) 58 find_library( 59 COIN_OSI_CBC_LIBRARY 37 60 NAMES OsiCbc libOsiCbc 38 61 HINTS ${COIN_ROOT_DIR}/lib/coin 39 HINTS ${COIN_ROOT_DIR}/lib 40 ) 41 FIND_LIBRARY(COIN_OSI_CLP_LIBRARY62 HINTS ${COIN_ROOT_DIR}/lib) 63 find_library( 64 COIN_OSI_CLP_LIBRARY 42 65 NAMES OsiClp libOsiClp 43 66 HINTS ${COIN_ROOT_DIR}/lib/coin 44 HINTS ${COIN_ROOT_DIR}/lib 45 ) 46 FIND_LIBRARY(COIN_OSI_VOL_LIBRARY67 HINTS ${COIN_ROOT_DIR}/lib) 68 find_library( 69 COIN_OSI_VOL_LIBRARY 47 70 NAMES OsiVol libOsiVol 48 71 HINTS ${COIN_ROOT_DIR}/lib/coin 49 HINTS ${COIN_ROOT_DIR}/lib 50 ) 51 FIND_LIBRARY(COIN_VOL_LIBRARY72 HINTS ${COIN_ROOT_DIR}/lib) 73 find_library( 74 COIN_VOL_LIBRARY 52 75 NAMES Vol libVol 53 76 HINTS ${COIN_ROOT_DIR}/lib/coin 54 HINTS ${COIN_ROOT_DIR}/lib 55 ) 77 HINTS ${COIN_ROOT_DIR}/lib) 56 78 57 FIND_LIBRARY(COIN_ZLIB_LIBRARY 79 find_library( 80 COIN_ZLIB_LIBRARY 58 81 NAMES z libz 59 82 HINTS ${COIN_ROOT_DIR}/lib/coin 60 HINTS ${COIN_ROOT_DIR}/lib 61 ) 62 FIND_LIBRARY(COIN_BZ2_LIBRARY83 HINTS ${COIN_ROOT_DIR}/lib) 84 find_library( 85 COIN_BZ2_LIBRARY 63 86 NAMES bz2 libbz2 64 87 HINTS ${COIN_ROOT_DIR}/lib/coin 65 HINTS ${COIN_ROOT_DIR}/lib 66 ) 88 HINTS ${COIN_ROOT_DIR}/lib) 67 89 68 FIND_LIBRARY(COIN_PTHREADS_LIBRARY 90 find_library( 91 COIN_PTHREADS_LIBRARY 69 92 NAMES pthreads libpthreads 70 93 HINTS ${COIN_ROOT_DIR}/lib/coin 71 HINTS ${COIN_ROOT_DIR}/lib 72 ) 94 HINTS ${COIN_ROOT_DIR}/lib) 73 95 74 INCLUDE(FindPackageHandleStandardArgs) 75 FIND_PACKAGE_HANDLE_STANDARD_ARGS(COIN DEFAULT_MSG 96 include(FindPackageHandleStandardArgs) 97 find_package_handle_standard_args( 98 COIN 99 DEFAULT_MSG 76 100 COIN_INCLUDE_DIR 77 101 COIN_CBC_LIBRARY 78 102 COIN_CBC_SOLVER_LIBRARY … … 86 110 # COIN_VOL_LIBRARY 87 111 ) 88 112 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) 113 if(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}) 129 endif(COIN_FOUND) 104 130 105 MARK_AS_ADVANCED(131 mark_as_advanced( 106 132 COIN_INCLUDE_DIR 107 133 COIN_CBC_LIBRARY 108 134 COIN_CBC_SOLVER_LIBRARY … … 115 141 COIN_OSI_VOL_LIBRARY 116 142 COIN_VOL_LIBRARY 117 143 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 #[[ 2 This file is a part of LEMON, a generic C++ optimization library. 3 4 Copyright (C) 2003-2021 5 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 6 (Egervary Research Group on Combinatorial Optimization, EGRES). 2 7 3 SET(GLPK_REGKEY "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Glpk;InstallPath]") 4 GET_FILENAME_COMPONENT(GLPK_ROOT_PATH ${GLPK_REGKEY} ABSOLUTE) 8 Permission to use, modify and distribute this software is granted 9 provided that this copyright notice appears in all copies. For 10 precise terms see the accompanying LICENSE file. 11 12 This software is provided "AS IS" with no warranty of any kind, 13 express or implied, and with no claim as to its suitability for any 14 purpose. 15 ]] 5 16 6 FIND_PATH(GLPK_INCLUDE_DIR 7 glpk.h 17 #[[ 18 This file finds the necessary components for the GLPK solver. 19 ]] 20 21 set(GLPK_ROOT_DIR 22 "" 23 CACHE PATH "GLPK root directory") 24 25 set(GLPK_REGKEY "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Glpk;InstallPath]") 26 get_filename_component(GLPK_ROOT_PATH ${GLPK_REGKEY} ABSOLUTE) 27 28 find_path( 29 GLPK_INCLUDE_DIR glpk.h 8 30 PATHS ${GLPK_REGKEY}/include 9 HINTS ${GLPK_ROOT_DIR}/include 10 ) 11 FIND_LIBRARY(GLPK_LIBRARY 12 glpk31 HINTS ${GLPK_ROOT_DIR}/include) 32 33 find_library( 34 GLPK_LIBRARY glpk 13 35 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) 19 37 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}") 38 if(GLPK_INCLUDE_DIR AND GLPK_LIBRARY) 39 file(READ ${GLPK_INCLUDE_DIR}/glpk.h GLPK_GLPK_H) 27 40 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}") 32 50 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}") 35 62 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) 71 endif(GLPK_INCLUDE_DIR AND GLPK_LIBRARY) 45 72 46 INCLUDE(FindPackageHandleStandardArgs) 47 FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLPK DEFAULT_MSG GLPK_LIBRARY GLPK_INCLUDE_DIR GLPK_PROPER_VERSION_FOUND) 73 include(FindPackageHandleStandardArgs) 74 find_package_handle_standard_args(GLPK DEFAULT_MSG GLPK_LIBRARY 75 GLPK_INCLUDE_DIR GLPK_PROPER_VERSION_FOUND) 48 76 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)77 if(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) 81 endif(GLPK_FOUND) 54 82 55 MARK_AS_ADVANCED(GLPK_LIBRARY GLPK_INCLUDE_DIR GLPK_BIN_DIR)83 mark_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 #[[ 2 This file is a part of LEMON, a generic C++ optimization library. 3 4 Copyright (C) 2003-2021 5 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 6 (Egervary Research Group on Combinatorial Optimization, EGRES). 7 8 Permission to use, modify and distribute this software is granted 9 provided that this copyright notice appears in all copies. For 10 precise terms see the accompanying LICENSE file. 2 11 3 FIND_PROGRAM(GHOSTSCRIPT_EXECUTABLE 12 This software is provided "AS IS" with no warranty of any kind, 13 express or implied, and with no claim as to its suitability for any 14 purpose. 15 ]] 16 17 #[[ 18 This file finds the necessary components for Ghostscript. 19 ]] 20 21 include(FindPackageHandleStandardArgs) 22 23 find_program( 24 GHOSTSCRIPT_EXECUTABLE 4 25 NAMES gs gswin32c 5 26 PATHS "$ENV{ProgramFiles}/gs" 6 27 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.") 9 29 10 FIND_PACKAGE_HANDLE_STANDARD_ARGS(Ghostscript DEFAULT_MSG GHOSTSCRIPT_EXECUTABLE) 30 find_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 #[[ 2 This file is a part of LEMON, a generic C++ optimization library. 3 4 Copyright (C) 2003-2021 5 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 6 (Egervary Research Group on Combinatorial Optimization, EGRES). 7 8 Permission to use, modify and distribute this software is granted 9 provided that this copyright notice appears in all copies. For 10 precise terms see the accompanying LICENSE file. 11 12 This software is provided "AS IS" with no warranty of any kind, 13 express or implied, and with no claim as to its suitability for any 14 purpose. 15 ]] 16 17 #[[ 18 This file finds the necessary components for the ILOG Cplex solver. 19 ]] 20 21 find_path( 22 ILOG_ROOT_DIR 2 23 NAMES cplex 3 24 DOC "CPLEX STUDIO root directory" 4 25 PATHS /opt/ibm/ILOG /usr/local/ibm/ILOG /usr/local/ILOG /usr/local/ilog 5 26 PATHS "$ENV{HOME}/ILOG" "$ENV{HOME}/.local/ILOG" 6 27 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) 12 32 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()33 if(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() 50 endif() 31 51 32 FIND_PATH(ILOG_CPLEX_ROOT_DIR 52 find_path( 53 ILOG_CPLEX_ROOT_DIR 33 54 NAMES include/ilcplex 34 55 HINTS ${ILOG_ROOT_DIR}/cplex ${ILOG_ROOT_DIR}/cplex121 35 ${ILOG_ROOT_DIR}/cplex122 ${ILOG_ROOT_DIR}/cplex12356 ${ILOG_ROOT_DIR}/cplex122 ${ILOG_ROOT_DIR}/cplex123 36 57 DOC "CPLEX root directory" 37 NO_DEFAULT_PATH 38 ) 58 NO_DEFAULT_PATH) 39 59 40 FIND_PATH(ILOG_CONCERT_ROOT_DIR 60 find_path( 61 ILOG_CONCERT_ROOT_DIR 41 62 NAMES include/ilconcert 42 63 HINTS ${ILOG_ROOT_DIR}/concert ${ILOG_ROOT_DIR}/concert29 43 64 DOC "CONCERT root directory" 44 NO_DEFAULT_PATH 45 ) 65 NO_DEFAULT_PATH) 46 66 47 FIND_PATH(ILOG_CPLEX_INCLUDE_DIR 48 ilcplex/cplex.h67 find_path( 68 ILOG_CPLEX_INCLUDE_DIR ilcplex/cplex.h 49 69 HINTS ${ILOG_CPLEX_ROOT_DIR}/include 50 NO_DEFAULT_PATH 51 ) 70 NO_DEFAULT_PATH) 52 71 53 FIND_PATH(ILOG_CONCERT_INCLUDE_DIR 54 ilconcert/ilobasic.h72 find_path( 73 ILOG_CONCERT_INCLUDE_DIR ilconcert/ilobasic.h 55 74 HINTS ${ILOG_CONCERT_ROOT_DIR}/include 56 NO_DEFAULT_PATH 57 ) 75 NO_DEFAULT_PATH) 58 76 59 FIND_LIBRARY(ILOG_CPLEX_LIBRARY 60 cplex cplex121 cplex122 cplex123 cplex12477 find_library( 78 ILOG_CPLEX_LIBRARY cplex cplex121 cplex122 cplex123 cplex124 61 79 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) 70 87 71 FIND_LIBRARY(ILOG_CONCERT_LIBRARY 72 concert88 find_library( 89 ILOG_CONCERT_LIBRARY concert 73 90 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) 82 98 83 FIND_FILE(ILOG_CPLEX_DLL 84 cplex121.dll cplex122.dll cplex123.dll cplex124.dll99 find_file( 100 ILOG_CPLEX_DLL cplex121.dll cplex122.dll cplex123.dll cplex124.dll 85 101 HINTS ${ILOG_CPLEX_ROOT_DIR}/bin/${ILOG_WIN_PLATFORM} 86 NO_DEFAULT_PATH 87 ) 102 NO_DEFAULT_PATH) 88 103 89 INCLUDE(FindPackageHandleStandardArgs) 90 FIND_PACKAGE_HANDLE_STANDARD_ARGS(ILOG 91 DEFAULT_MSG ILOG_CPLEX_LIBRARY ILOG_CPLEX_INCLUDE_DIR 92 ) 104 include(FindPackageHandleStandardArgs) 105 find_package_handle_standard_args(ILOG DEFAULT_MSG ILOG_CPLEX_LIBRARY 106 ILOG_CPLEX_INCLUDE_DIR) 93 107 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")108 if(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") 98 112 # 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") 115 endif(ILOG_FOUND) 102 116 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 ) 117 mark_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 #[[ 2 This file is a part of LEMON, a generic C++ optimization library. 3 4 Copyright (C) 2003-2021 5 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 6 (Egervary Research Group on Combinatorial Optimization, EGRES). 2 7 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 ) 8 Permission to use, modify and distribute this software is granted 9 provided that this copyright notice appears in all copies. For 10 precise terms see the accompanying LICENSE file. 11 12 This software is provided "AS IS" with no warranty of any kind, 13 express or implied, and with no claim as to its suitability for any 14 purpose. 15 ]] 11 16 12 INCLUDE(FindPackageHandleStandardArgs) 13 FIND_PACKAGE_HANDLE_STANDARD_ARGS(SOPLEX DEFAULT_MSG SOPLEX_LIBRARY SOPLEX_INCLUDE_DIR) 17 #[[ 18 This file finds the necessary components for the SOPLEX solver. 19 ]] 20 21 find_path(SOPLEX_INCLUDE_DIR soplex.h HINTS ${SOPLEX_ROOT}/src) 22 find_library(SOPLEX_LIBRARY soplex HINTS ${SOPLEX_ROOT}/lib) 14 23 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) 24 include(FindPackageHandleStandardArgs) 25 find_package_handle_standard_args(SOPLEX DEFAULT_MSG SOPLEX_LIBRARY 26 SOPLEX_INCLUDE_DIR) 22 27 23 MARK_AS_ADVANCED(SOPLEX_LIBRARY SOPLEX_INCLUDE_DIR) 28 if(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") 34 endif(SOPLEX_FOUND) 35 36 mark_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}") 1 set(LEMON_INCLUDE_DIR 2 "@CMAKE_INSTALL_PREFIX@/include" 3 CACHE PATH "LEMON include directory") 4 set(LEMON_INCLUDE_DIRS "${LEMON_INCLUDE_DIR}") 3 5 4 IF(UNIX)5 SET(LEMON_LIB_NAME "libemon.a")6 ELSEIF(WIN32)7 SET(LEMON_LIB_NAME "lemon.lib")8 ENDIF(UNIX)6 if(UNIX) 7 set(LEMON_LIB_NAME "libemon.a") 8 elseif(WIN32) 9 set(LEMON_LIB_NAME "lemon.lib") 10 endif(UNIX) 9 11 10 SET(LEMON_LIBRARY "@CMAKE_INSTALL_PREFIX@/lib/${LEMON_LIB_NAME}" CACHE FILEPATH "LEMON library") 11 SET(LEMON_LIBRARIES "${LEMON_LIBRARY}") 12 set(LEMON_LIBRARY 13 "@CMAKE_INSTALL_PREFIX@/lib/${LEMON_LIB_NAME}" 14 CACHE FILEPATH "LEMON library") 15 set(LEMON_LIBRARIES "${LEMON_LIBRARY}") 12 16 13 MARK_AS_ADVANCED(LEMON_LIBRARY LEMON_INCLUDE_DIR)17 mark_as_advanced(LEMON_LIBRARY LEMON_INCLUDE_DIR) -
new file cmake/archive.cmake
diff -r a278d16bd2d0 cmake/archive.cmake
- + 1 #[[ 2 This file is a part of LEMON, a generic C++ optimization library. 3 4 Copyright (C) 2003-2021 5 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 6 (Egervary Research Group on Combinatorial Optimization, EGRES). 7 8 Permission to use, modify and distribute this software is granted 9 provided that this copyright notice appears in all copies. For 10 precise terms see the accompanying LICENSE file. 11 12 This software is provided "AS IS" with no warranty of any kind, 13 express or implied, and with no claim as to its suitability for any 14 purpose. 15 ]] 16 17 #[[ 18 This file creates compressed files of the current version and places them in the 19 PROJECT_BINARY_DIR as tar.gz and zip files. 20 ]] 21 22 set(ARCHIVE_BASE_NAME ${PROJECT_NAME}) 23 string(TOLOWER ${ARCHIVE_BASE_NAME} ARCHIVE_BASE_NAME) 24 set(ARCHIVE_NAME ${ARCHIVE_BASE_NAME}-${PROJECT_VERSION}) 25 add_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 #[[ 2 This file is a part of LEMON, a generic C++ optimization library. 3 4 Copyright (C) 2003-2021 5 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 6 (Egervary Research Group on Combinatorial Optimization, EGRES). 7 8 Permission to use, modify and distribute this software is granted 9 provided that this copyright notice appears in all copies. For 10 precise terms see the accompanying LICENSE file. 11 12 This software is provided "AS IS" with no warranty of any kind, 13 express or implied, and with no claim as to its suitability for any 14 purpose. 15 ]] 16 17 #[[ 18 This file sets up the necessary dependencies and flags required to build the 19 LEMON::LEMON alias (called from here). This includes: 20 21 - Compile definitions for different architectures 22 - Solver finding if required 23 - 24 25 Also defines main project install target. 26 ]] 27 28 if(DEFINED ENV{LEMON_CXX_WARNING}) 29 set(CXX_WARNING $ENV{LEMON_CXX_WARNING}) 30 else() 31 if(CMAKE_COMPILER_IS_GNUCXX) 32 list( 33 APPEND 34 CXX_WARNING 35 "-Wall" 36 "-W" 37 "-Wunused" 38 "-Wformat=2" 39 "-Wctor-dtor-privacy" 40 "-Wnon-virtual-dtor" 41 "-Wno-char-subscripts" 42 "-Wwrite-strings" 43 "-Wno-char-subscripts" 44 "-Wreturn-type" 45 "-Wcast-qual" 46 "-Wcast-align" 47 "-Wsign-promo" 48 "-Woverloaded-virtual" 49 "-fno-strict-aliasing" 50 "-Wold-style-cast" 51 "-Wno-unknown-pragmas" 52 "-Wno-unused-local-typedefs") 53 set(CMAKE_CXX_FLAGS_DEBUG CACHE STRING "-ggdb") 54 set(CMAKE_C_FLAGS_DEBUG CACHE STRING "${CMAKE_CXX_FLAGS_DEBUG}") 55 if(WIN32 AND MINGW) 56 list(APPEND CXX_WARNING "-Wa,-mbig-obj" "-O2") 57 endif() 58 elseif(MSVC) 59 # This part is unnecessary 'casue the same is set by the lemon/core.h. Still 60 # keep it as an example. 61 # Suppressed warnings: 62 list( 63 APPEND 64 CXX_WARNING 65 "/wd4250" # 'class1' : inherits 'class2::member' via dominance 66 "/wd4355" # 'this' : used in base member initializer list 67 "/wd4503" # 'function' : decorated name length exceeded, name truncated 68 "/wd4800" # 'type' : forcing value to bool 'true' or 'false' 69 # (performance warning) 70 "/wd4996" # 'function': was declared deprecated 71 ) 72 else() 73 list(APPEND CXX_WARNING "-Wall") 74 endif() 75 endif() 76 77 add_definitions(${CXX_WARNING}) 78 79 if(MSVC) 80 set(CMAKE_CXX_FLAGS_MAINTAINER 81 "/WX ${CMAKE_CXX_FLAGS_DEBUG}" 82 CACHE STRING "Flags used by the C++ compiler during maintainer builds.") 83 set(CMAKE_C_FLAGS_MAINTAINER 84 "/WX ${CMAKE_CXX_FLAGS_DEBUG}" 85 CACHE STRING "Flags used by the C compiler during maintainer builds.") 86 set(CMAKE_EXE_LINKER_FLAGS_MAINTAINER 87 "${CMAKE_EXE_LINKER_FLAGS_DEBUG}" 88 CACHE STRING "Flags used for linking binaries during maintainer builds.") 89 set(CMAKE_SHARED_LINKER_FLAGS_MAINTAINER 90 "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}" 91 CACHE 92 STRING 93 "Flags used by the shared libraries linker during maintainer builds.") 94 else() 95 set(CMAKE_CXX_FLAGS_MAINTAINER 96 "-Werror -ggdb -O0" 97 CACHE STRING "Flags used by the C++ compiler during maintainer builds.") 98 set(CMAKE_C_FLAGS_MAINTAINER 99 "-Werror -O0" 100 CACHE STRING "Flags used by the C compiler during maintainer builds.") 101 set(CMAKE_EXE_LINKER_FLAGS_MAINTAINER 102 "${CMAKE_EXE_LINKER_FLAGS_DEBUG}" 103 CACHE STRING "Flags used for linking binaries during maintainer builds.") 104 set(CMAKE_SHARED_LINKER_FLAGS_MAINTAINER 105 "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}" 106 CACHE 107 STRING 108 "Flags used by the shared libraries linker during maintainer builds.") 109 endif() 110 111 mark_as_advanced( 112 CMAKE_CXX_FLAGS_MAINTAINER CMAKE_C_FLAGS_MAINTAINER 113 CMAKE_EXE_LINKER_FLAGS_MAINTAINER CMAKE_SHARED_LINKER_FLAGS_MAINTAINER) 114 115 include(CheckTypeSize) 116 check_type_size("long long" LONG_LONG) 117 set(LEMON_HAVE_LONG_LONG ${HAVE_LONG_LONG}) 118 119 find_package(Threads) 120 121 if(NOT LEMON_THREADING) 122 if(CMAKE_USE_PTHREADS_INIT) 123 set(LEMON_THREADING "Pthread") 124 elseif(CMAKE_USE_WIN32_THREADS_INIT) 125 set(LEMON_THREADING "Win32") 126 else() 127 set(LEMON_THREADING "None") 128 endif() 129 endif() 130 131 set(LEMON_THREADING 132 "${LEMON_THREADING}" 133 CACHE STRING 134 "Choose the threading library, options are: Pthread Win32 None." 135 FORCE) 136 137 if(LEMON_THREADING STREQUAL "Pthread") 138 set(LEMON_USE_PTHREAD ON) 139 elseif(LEMON_THREADING STREQUAL "Win32") 140 set(LEMON_USE_WIN32_THREADS ON) 141 endif() 142 143 # GLPK # 144 if(LEMON_ENABLE_GLPK) 145 find_package(GLPK REQUIRED) 146 endif() 147 if(GLPK_FOUND) 148 set(LEMON_HAVE_LP ON) 149 set(LEMON_HAVE_MIP ON) 150 set(LEMON_HAVE_GLPK ON) 151 endif() 152 153 # ILOG # 154 if(LEMON_ENABLE_ILOG) 155 find_package(ILOG REQUIRED) 156 endif() 157 if(ILOG_FOUND) 158 set(LEMON_HAVE_LP ON) 159 set(LEMON_HAVE_MIP ON) 160 set(LEMON_HAVE_CPLEX ON) 161 endif() 162 163 # COIN # 164 if(LEMON_ENABLE_COIN) 165 find_package(COIN REQUIRED) 166 endif() 167 if(COIN_FOUND) 168 set(LEMON_HAVE_LP ON) 169 set(LEMON_HAVE_MIP ON) 170 set(LEMON_HAVE_CLP ON) 171 set(LEMON_HAVE_CBC ON) 172 endif() 173 174 # SOPLEX # 175 if(LEMON_ENABLE_SOPLEX) 176 find_package(SOPLEX REQUIRED) 177 endif() 178 if(SOPLEX_FOUND) 179 set(LEMON_HAVE_LP ON) 180 set(LEMON_HAVE_SOPLEX ON) 181 endif() 182 183 # Set default LP + MIP solver string # 184 if(ILOG_FOUND) 185 set(DEFAULT_LP "CPLEX") 186 set(DEFAULT_MIP "CPLEX") 187 elseif(COIN_FOUND) 188 set(DEFAULT_LP "CLP") 189 set(DEFAULT_MIP "CBC") 190 elseif(GLPK_FOUND) 191 set(DEFAULT_LP "GLPK") 192 set(DEFAULT_MIP "GLPK") 193 elseif(SOPLEX_FOUND) 194 set(DEFAULT_LP "SOPLEX") 195 endif() 196 197 if(NOT LEMON_DEFAULT_LP 198 OR (NOT ILOG_FOUND AND (LEMON_DEFAULT_LP STREQUAL "CPLEX")) 199 OR (NOT COIN_FOUND AND (LEMON_DEFAULT_LP STREQUAL "CLP")) 200 OR (NOT GLPK_FOUND AND (LEMON_DEFAULT_LP STREQUAL "GLPK")) 201 OR (NOT SOPLEX_FOUND AND (LEMON_DEFAULT_LP STREQUAL "SOPLEX"))) 202 set(LEMON_DEFAULT_LP 203 ${DEFAULT_LP} 204 CACHE STRING "Default LP solver backend (GLPK, CPLEX, CLP or SOPLEX)" 205 FORCE) 206 else() 207 set(LEMON_DEFAULT_LP 208 ${DEFAULT_LP} 209 CACHE STRING "Default LP solver backend (GLPK, CPLEX, CLP or SOPLEX)") 210 endif() 211 212 if(NOT LEMON_DEFAULT_MIP 213 OR (NOT ILOG_FOUND AND (LEMON_DEFAULT_MIP STREQUAL "CPLEX")) 214 OR (NOT COIN_FOUND AND (LEMON_DEFAULT_MIP STREQUAL "CBC")) 215 OR (NOT GLPK_FOUND AND (LEMON_DEFAULT_MIP STREQUAL "GLPK"))) 216 set(LEMON_DEFAULT_MIP 217 ${DEFAULT_MIP} 218 CACHE STRING "Default MIP solver backend (GLPK, CPLEX or CBC)" FORCE) 219 else() 220 set(LEMON_DEFAULT_MIP 221 ${DEFAULT_MIP} 222 CACHE STRING "Default MIP solver backend (GLPK, CPLEX or CBC)") 223 endif() 224 225 add_subdirectory(lemon) 226 227 include(GNUInstallDirs) 228 229 install( 230 EXPORT ${PROJECT_NAME}Targets 231 NAMESPACE LEMON:: 232 DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}") 233 234 include(CMakePackageConfigHelpers) 235 236 # Config file 237 configure_package_config_file( 238 cmake/Config.cmake.in "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" 239 INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}") 240 241 # Version file 242 configure_file(cmake/${PROJECT_NAME}Version.cmake.in 243 "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Version.cmake" @ONLY) 244 245 install( 246 FILES "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" 247 "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Version.cmake" 248 DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" 249 COMPONENT Devel) -
new file cmake/cpack.cmake
diff -r a278d16bd2d0 cmake/cpack.cmake
- + 1 #[[ 2 This file is a part of LEMON, a generic C++ optimization library. 3 4 Copyright (C) 2003-2021 5 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 6 (Egervary Research Group on Combinatorial Optimization, EGRES). 7 8 Permission to use, modify and distribute this software is granted 9 provided that this copyright notice appears in all copies. For 10 precise terms see the accompanying LICENSE file. 11 12 This software is provided "AS IS" with no warranty of any kind, 13 express or implied, and with no claim as to its suitability for any 14 purpose. 15 ]] 16 17 #[[ 18 Defines options using in the Pkg config file. 19 ]] 20 21 include(CPack) 22 set(CPACK_PACKAGE_NAME ${PROJECT_NAME}) 23 set(CPACK_PACKAGE_VENDOR "EGRES") 24 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY 25 "LEMON - Library for Efficient Modeling and Optimization in Networks") 26 set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE") 27 28 set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) 29 30 set(CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME} ${PROJECT_VERSION}") 31 set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${PROJECT_NAME} ${PROJECT_VERSION}") 32 33 set(CPACK_COMPONENTS_ALL headers library html_documentation bin) 34 35 set(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ headers") 36 set(CPACK_COMPONENT_LIBRARY_DISPLAY_NAME "Dynamic-link library") 37 set(CPACK_COMPONENT_BIN_DISPLAY_NAME "Command line utilities") 38 set(CPACK_COMPONENT_HTML_DOCUMENTATION_DISPLAY_NAME "HTML documentation") 39 40 set(CPACK_COMPONENT_HEADERS_DESCRIPTION "C++ header files") 41 set(CPACK_COMPONENT_LIBRARY_DESCRIPTION "DLL and import library") 42 set(CPACK_COMPONENT_BIN_DESCRIPTION "Command line utilities") 43 set(CPACK_COMPONENT_HTML_DOCUMENTATION_DESCRIPTION 44 "Doxygen generated documentation") 45 46 set(CPACK_COMPONENT_HEADERS_DEPENDS library) 47 48 set(CPACK_COMPONENT_HEADERS_GROUP "Development") 49 set(CPACK_COMPONENT_LIBRARY_GROUP "Development") 50 set(CPACK_COMPONENT_HTML_DOCUMENTATION_GROUP "Documentation") 51 52 set(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION 53 "Components needed to develop software using LEMON") 54 set(CPACK_COMPONENT_GROUP_DOCUMENTATION_DESCRIPTION "Documentation of LEMON") 55 56 set(CPACK_ALL_INSTALL_TYPES Full Developer) 57 58 set(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full) 59 set(CPACK_COMPONENT_LIBRARY_INSTALL_TYPES Developer Full) 60 set(CPACK_COMPONENT_HTML_DOCUMENTATION_INSTALL_TYPES Full) 61 62 set(CPACK_GENERATOR "NSIS") 63 set(CPACK_NSIS_MUI_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis/lemon.ico") 64 set(CPACK_NSIS_MUI_UNIICON "${PROJECT_SOURCE_DIR}/cmake/nsis/uninstall.ico") 65 # SET(CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis\\\\installer.bmp") 66 set(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\lemon.ico") 67 set(CPACK_NSIS_DISPLAY_NAME 68 "${CPACK_PACKAGE_INSTALL_DIRECTORY} ${PROJECT_NAME}") 69 set(CPACK_NSIS_HELP_LINK "http:\\\\\\\\lemon.cs.elte.hu") 70 set(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\lemon.cs.elte.hu") 71 set(CPACK_NSIS_CONTACT "lemon-user@lemon.cs.elte.hu") 72 set(CPACK_NSIS_CREATE_ICONS_EXTRA 73 " 74 CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Documentation.lnk\\\" \\\"$INSTDIR\\\\share\\\\doc\\\\index.html\\\" 75 ") 76 set(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}/lemon8 )9 10 1 # Uncomment (and adjust) the following two lines. 'myprog' is the name 11 2 # of the final executable ('.exe' will automatically be added to the 12 3 # name on Windows) and 'myprog-main.cc' is the source code it is … … 14 5 # whitespaces. Moreover, you can add multiple similar blocks if you 15 6 # want to build more than one executables. 16 7 17 # ADD_EXECUTABLE(myprog myprog-main.cc) 18 # TARGET_LINK_LIBRARIES(myprog lemon) 19 8 add_executable(myprog myprog-main.cc) 9 target_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 #[[ 2 This file is a part of LEMON, a generic C++ optimization library. 3 4 Copyright (C) 2003-2021 5 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 6 (Egervary Research Group on Combinatorial Optimization, EGRES). 7 8 Permission to use, modify and distribute this software is granted 9 provided that this copyright notice appears in all copies. For 10 precise terms see the accompanying LICENSE file. 5 11 6 LINK_DIRECTORIES( 7 ${PROJECT_BINARY_DIR}/lemon 8 ) 12 This software is provided "AS IS" with no warranty of any kind, 13 express or implied, and with no claim as to its suitability for any 14 purpose. 15 ]] 16 17 #[[ 18 This file builds an example project consuming LEMON in three different ways: 19 1. Using locally installed LEMON - find_package. 20 2. Using add_subdirectory. 21 3. Using FetchContent. 22 ]] 9 23 10 SET(DEMOS 11 arg_parser_demo 12 graph_to_eps_demo 13 lgf_demo 14 ) 24 cmake_minimum_required(VERSION 3.15) 25 project( 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) 15 35 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 # include(FetchContent) 38 # find_package(Hg) 39 # if(HG_FOUND) 40 # FetchContent_Declare( 41 # LEMON 42 # HG_REPOSITORY "https://lemon.cs.elte.hu/hg/lemon/" 43 # ) 44 # else() 45 # FetchContent_Declare( 46 # LEMON 47 # SOURCE_DIR "path-to-lemon-src") 48 # endif() 49 # FetchContent_MakeAvailable(LEMON) 50 51 set(DEMOS arg_parser_demo graph_to_eps_demo lgf_demo) 52 53 foreach(DEMO_NAME ${DEMOS}) 54 add_executable(${DEMO_NAME} ${DEMO_NAME}.cc) 55 target_link_libraries(${DEMO_NAME} LEMON::LEMON) 56 endforeach() -
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 #[[ 2 This file is a part of LEMON, a generic C++ optimization library. 3 4 Copyright (C) 2003-2021 5 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 6 (Egervary Research Group on Combinatorial Optimization, EGRES). 7 8 Permission to use, modify and distribute this software is granted 9 provided that this copyright notice appears in all copies. For 10 precise terms see the accompanying LICENSE file. 5 11 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.") 12 This software is provided "AS IS" with no warranty of any kind, 13 express or implied, and with no claim as to its suitability for any 14 purpose. 15 ]] 9 16 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 #[[ 18 This file orchestrates the build of the docs. 19 ]] 20 21 find_package(Doxygen REQUIRED) 22 find_package(Ghostscript REQUIRED) 23 find_package(PythonInterp REQUIRED) 24 find_package(Wget REQUIRED) 13 25 26 set(PACKAGE_NAME ${PROJECT_NAME}) 27 set(PACKAGE_VERSION ${PROJECT_VERSION}) 28 set(abs_top_srcdir ${PROJECT_SOURCE_DIR}) 29 set(abs_top_builddir ${PROJECT_BINARY_DIR}) 14 30 15 CONFIGURE_FILE( 16 ${PROJECT_SOURCE_DIR}/doc/Doxyfile.in 17 ${PROJECT_BINARY_DIR}/doc/Doxyfile 18 @ONLY 19 ) 31 set(LEMON_DOC_SOURCE_BROWSER 32 OFF 33 CACHE BOOL "Include source into the doc.") 34 set(LEMON_DOC_USE_MATHJAX 35 OFF 36 CACHE BOOL "Use MathJax to display math formulae.") 37 set(LEMON_DOC_MATHJAX_RELPATH 38 "http://www.mathjax.org/mathjax" 39 CACHE STRING "MathJax library location.") 20 40 21 CONFIGURE_FILE( 22 ${PROJECT_SOURCE_DIR}/doc/mainpage.dox.in 23 ${PROJECT_BINARY_DIR}/doc/mainpage.dox 24 @ONLY 25 ) 41 set(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 45 configure_file(${PROJECT_SOURCE_DIR}/doc/Doxyfile.in 46 ${PROJECT_BINARY_DIR}/doc/Doxyfile @ONLY) 47 48 configure_file(${PROJECT_SOURCE_DIR}/doc/mainpage.dox.in 49 ${PROJECT_BINARY_DIR}/doc/mainpage.dox @ONLY) 26 50 27 51 # 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}/html33 )34 ENDIF()52 if(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) 58 endif() 35 59 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 60 if(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 40 74 COMMAND ${CMAKE_COMMAND} -E remove_directory gen-images 41 75 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 58 139 COMMAND ${CMAKE_COMMAND} -E remove_directory html 59 140 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( 67 145 DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/ 68 146 DESTINATION share/doc/lemon/html 69 COMPONENT html_documentation 70 ) 71 ELSEIF(WIN32) 72 INSTALL( 147 COMPONENT html_documentation) 148 elseif(WIN32) 149 install( 73 150 DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/ 74 151 DESTINATION doc 75 COMPONENT html_documentation 76 ) 77 ENDIF() 78 79 ENDIF() 152 COMPONENT html_documentation) 153 endif() 154 endif() 80 155 81 IF(WGET_FOUND)82 ADD_CUSTOM_TARGET(update-external-tags 83 COMMAND ${WGET_EXECUTABLE} -N ${LEMON_DOC_LIBSTDC++_URL}/libstdc++.tag84 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}85 )86 ENDIF()156 if(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}) 161 endif() -
lemon/CMakeLists.txt
diff -r a278d16bd2d0 lemon/CMakeLists.txt
a b 1 INCLUDE_DIRECTORIES( 2 ${PROJECT_SOURCE_DIR} 3 ${PROJECT_BINARY_DIR} 4 ) 1 #[[ 2 This file is a part of LEMON, a generic C++ optimization library. 3 4 Copyright (C) 2003-2021 5 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 6 (Egervary Research Group on Combinatorial Optimization, EGRES). 7 8 Permission to use, modify and distribute this software is granted 9 provided that this copyright notice appears in all copies. For 10 precise terms see the accompanying LICENSE file. 5 11 6 CONFIGURE_FILE( 7 ${CMAKE_CURRENT_SOURCE_DIR}/config.h.in 8 ${CMAKE_CURRENT_BINARY_DIR}/config.h 9 ) 12 This software is provided "AS IS" with no warranty of any kind, 13 express or implied, and with no claim as to its suitability for any 14 purpose. 15 ]] 10 16 11 CONFIGURE_FILE( 12 ${CMAKE_CURRENT_SOURCE_DIR}/lemon.pc.in 13 ${CMAKE_CURRENT_BINARY_DIR}/lemon.pc 14 @ONLY 15 )17 #[[ 18 This file defines the lemon target and LEMON::LEMON alias. 19 ]] 20 21 set(NAME lemon) 16 22 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 24 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in 25 ${CMAKE_CURRENT_BINARY_DIR}/config.h) 26 # Configure lemon package file 27 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/lemon.pc.in 28 ${CMAKE_CURRENT_BINARY_DIR}/lemon.pc @ONLY) 26 29 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() 30 set(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) 36 38 37 IF(LEMON_HAVE_CPLEX) 38 SET(LEMON_SOURCES ${LEMON_SOURCES} cplex.cc) 39 INCLUDE_DIRECTORIES(${ILOG_INCLUDE_DIRS}) 40 ENDIF() 39 if(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() 47 endif() 41 48 42 IF(LEMON_HAVE_CLP)43 SET(LEMON_SOURCES ${LEMON_SOURCES} clp.cc)44 INCLUDE_DIRECTORIES(${COIN_INCLUDE_DIRS})45 ENDIF()49 if(LEMON_HAVE_CPLEX) 50 set(LEMON_SOURCES ${LEMON_SOURCES} cplex.cc) 51 include_directories(${ILOG_INCLUDE_DIRS}) 52 endif() 46 53 47 IF(LEMON_HAVE_CBC)48 SET(LEMON_SOURCES ${LEMON_SOURCES} cbc.cc)49 INCLUDE_DIRECTORIES(${COIN_INCLUDE_DIRS})50 ENDIF()54 if(LEMON_HAVE_CLP) 55 set(LEMON_SOURCES ${LEMON_SOURCES} clp.cc) 56 include_directories(${COIN_INCLUDE_DIRS}) 57 endif() 51 58 52 IF(LEMON_HAVE_SOPLEX)53 SET(LEMON_SOURCES ${LEMON_SOURCES} soplex.cc)54 INCLUDE_DIRECTORIES(${SOPLEX_INCLUDE_DIRS})55 ENDIF()59 if(LEMON_HAVE_CBC) 60 set(LEMON_SOURCES ${LEMON_SOURCES} cbc.cc) 61 include_directories(${COIN_INCLUDE_DIRS}) 62 endif() 56 63 57 ADD_LIBRARY(lemon ${LEMON_SOURCES}) 64 if(LEMON_HAVE_SOPLEX) 65 set(LEMON_SOURCES ${LEMON_SOURCES} soplex.cc) 66 include_directories(${SOPLEX_INCLUDE_DIRS}) 67 endif() 68 69 file(GLOB _HDRS "*.h" "bits/*h" "concepts/*.h") 70 71 add_library(${NAME} ${LEMON_SOURCES} ${_HDRS}) 58 72 59 TARGET_LINK_LIBRARIES(lemon 60 ${GLPK_LIBRARIES} ${COIN_LIBRARIES} ${ILOG_LIBRARIES} ${SOPLEX_LIBRARIES} 61 ) 73 # Compile options (needed for MacOS) 74 set_target_properties( 75 ${NAME} 76 PROPERTIES CXX_STANDARD 17 77 CXX_STANDARD_REQUIRED ON 78 CXX_EXTENSIONS OFF 79 POSITION_INDEPENDENT_CODE ON) 62 80 63 IF(UNIX) 64 SET_TARGET_PROPERTIES(lemon PROPERTIES OUTPUT_NAME emon VERSION ${LEMON_VERSION} SOVERSION ${LEMON_VERSION}) 65 ENDIF() 81 target_compile_features(${NAME} PUBLIC cxx_std_17) 66 82 67 INSTALL( 68 TARGETS lemon 69 ARCHIVE DESTINATION lib 70 LIBRARY DESTINATION lib 71 COMPONENT library 72 ) 83 target_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. 88 set_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}) 73 94 74 INSTALL( 75 DIRECTORY . bits concepts 76 DESTINATION include/lemon 77 COMPONENT headers 78 FILES_MATCHING PATTERN "*.h" 79 ) 95 target_include_directories( 96 ${NAME} PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}> 97 $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>) 98 # Add alias 99 add_library(LEMON::LEMON ALIAS ${NAME}) 80 100 81 INSTALL( 82 FILES ${CMAKE_CURRENT_BINARY_DIR}/config.h 83 DESTINATION include/lemon 84 COMPONENT headers 85 ) 101 # Install targets 102 include(GNUInstallDirs) 103 install( 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}) 86 109 87 INSTALL( 88 FILES ${CMAKE_CURRENT_BINARY_DIR}/lemon.pc 89 DESTINATION lib/pkgconfig 90 ) 91 110 # Pkg-config 111 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/lemon.pc DESTINATION lib/pkgconfig) -
test/CMakeLists.txt
diff -r a278d16bd2d0 test/CMakeLists.txt
a b 1 INCLUDE_DIRECTORIES( 2 ${PROJECT_SOURCE_DIR} 3 ${PROJECT_BINARY_DIR} 4 ) 1 #[[ 2 This file is a part of LEMON, a generic C++ optimization library. 3 4 Copyright (C) 2003-2021 5 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 6 (Egervary Research Group on Combinatorial Optimization, EGRES). 7 8 Permission to use, modify and distribute this software is granted 9 provided that this copyright notice appears in all copies. For 10 precise terms see the accompanying LICENSE file. 5 11 6 LINK_DIRECTORIES( 7 ${PROJECT_BINARY_DIR}/lemon 8 ) 12 This software is provided "AS IS" with no warranty of any kind, 13 express or implied, and with no claim as to its suitability for any 14 purpose. 15 ]] 9 16 10 SET(TEST_WITH_VALGRIND "NO" CACHE STRING 11 "Run the test with valgrind (YES/NO).") 12 SET(VALGRIND_FLAGS "" CACHE STRING "Valgrind flags used by the tests.") 17 #[[ 18 This file defines all the test targets for ctest. 19 Can also be used to run valgrind 20 ]] 21 22 if(LEMON_TEST_WITH_VALGRIND) 23 set(VALGRIND_FLAGS 24 "--leak-check=full" 25 CACHE STRING "Valgrind flags used by the tests.") 26 endif() 13 27 14 SET(TESTS15 adaptors_test16 arc_look_up_test17 bellman_ford_test18 bfs_test19 bpgraph_test20 circulation_test21 connectivity_test22 counter_test23 dfs_test24 digraph_test25 dijkstra_test26 dim_test27 edge_set_test28 error_test29 euler_test30 fractional_matching_test31 gomory_hu_test32 graph_copy_test33 graph_test34 graph_utils_test35 hao_orlin_test36 heap_test37 kruskal_test38 lgf_reader_writer_test39 lgf_test40 maps_test41 matching_test42 max_cardinality_search_test43 max_clique_test44 max_flow_test45 min_cost_arborescence_test46 min_cost_flow_test47 min_mean_cycle_test48 nagamochi_ibaraki_test49 path_test50 planarity_test51 radix_sort_test52 random_test53 suurballe_test54 time_measure_test55 tsp_test56 unionfind_test57 vf2_test58 )28 set(TESTS 29 adaptors_test 30 arc_look_up_test 31 bellman_ford_test 32 bfs_test 33 bpgraph_test 34 circulation_test 35 connectivity_test 36 counter_test 37 dfs_test 38 digraph_test 39 dijkstra_test 40 dim_test 41 edge_set_test 42 error_test 43 euler_test 44 fractional_matching_test 45 gomory_hu_test 46 graph_copy_test 47 graph_test 48 graph_utils_test 49 hao_orlin_test 50 heap_test 51 kruskal_test 52 lgf_reader_writer_test 53 lgf_test 54 maps_test 55 matching_test 56 max_cardinality_search_test 57 max_clique_test 58 max_flow_test 59 min_cost_arborescence_test 60 min_cost_flow_test 61 min_mean_cycle_test 62 multicommodity_flow_test 63 nagamochi_ibaraki_test 64 path_test 65 planarity_test 66 radix_sort_test 67 random_test 68 suurballe_test 69 time_measure_test 70 tsp_test 71 unionfind_test 72 vf2_test) 59 73 60 IF(LEMON_HAVE_LP) 61 IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer") 62 ADD_EXECUTABLE(lp_test lp_test.cc) 63 ELSE() 64 ADD_EXECUTABLE(lp_test EXCLUDE_FROM_ALL lp_test.cc) 65 ENDIF() 74 if(LEMON_HAVE_LP) 75 if(LEMON_MAINTAINER) 76 add_executable(lp_test lp_test.cc) 77 else() 78 add_executable(lp_test EXCLUDE_FROM_ALL lp_test.cc) 79 endif() 80 81 set(LP_TEST_LIBS lemon) 66 82 67 SET(LP_TEST_LIBS lemon) 83 if(LEMON_HAVE_GLPK) 84 set(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES}) 85 endif() 86 if(LEMON_HAVE_CPLEX) 87 set(LP_TEST_LIBS ${LP_TEST_LIBS} ${ILOG_LIBRARIES}) 88 endif() 89 if(LEMON_HAVE_CLP) 90 set(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES}) 91 endif() 92 if(LEMON_HAVE_SOPLEX) 93 set(LP_TEST_LIBS ${LP_TEST_LIBS} ${SOPLEX_LIBRARIES}) 94 endif() 68 95 69 IF(LEMON_HAVE_GLPK) 70 SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES}) 71 ENDIF() 72 IF(LEMON_HAVE_CPLEX) 73 SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${ILOG_LIBRARIES}) 74 ENDIF() 75 IF(LEMON_HAVE_CLP) 76 SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES}) 77 ENDIF() 78 IF(LEMON_HAVE_SOPLEX) 79 SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${SOPLEX_LIBRARIES}) 80 ENDIF() 96 target_link_libraries(lp_test ${LP_TEST_LIBS}) 97 add_test(lp_test lp_test) 98 # add_dependencies(check lp_test) 81 99 82 TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS}) 83 ADD_TEST(lp_test lp_test) 84 ADD_DEPENDENCIES(check lp_test) 100 if(WIN32 AND LEMON_HAVE_GLPK) 101 get_target_property(TARGET_LOC lp_test LOCATION) 102 get_filename_component(TARGET_PATH ${TARGET_LOC} PATH) 103 add_custom_command( 104 TARGET lp_test 105 POST_BUILD 106 COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH} 107 COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll 108 ${TARGET_PATH} 109 COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}) 110 endif() 85 111 86 IF(WIN32 AND LEMON_HAVE_GLPK) 87 ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD 88 COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll $<TARGET_FILE_DIR:lp_test> 89 COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll $<TARGET_FILE_DIR:lp_test> 90 COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll $<TARGET_FILE_DIR:lp_test> 91 ) 92 ENDIF() 112 if(WIN32 AND LEMON_HAVE_CPLEX) 113 get_target_property(TARGET_LOC lp_test LOCATION) 114 get_filename_component(TARGET_PATH ${TARGET_LOC} PATH) 115 add_custom_command( 116 TARGET lp_test 117 POST_BUILD 118 COMMAND ${CMAKE_COMMAND} -E copy ${ILOG_CPLEX_DLL} ${TARGET_PATH}) 119 endif() 120 endif() 93 121 94 IF(WIN32 AND LEMON_HAVE_CPLEX)95 GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)96 GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)97 ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD98 COMMAND ${CMAKE_COMMAND} -E copy ${ILOG_CPLEX_DLL} ${TARGET_PATH}99 100 ENDIF() 101 ENDIF()122 if(LEMON_HAVE_MIP) 123 if(LEMON_MAINTAINER) 124 add_executable(mip_test mip_test.cc) 125 else() 126 add_executable(mip_test EXCLUDE_FROM_ALL mip_test.cc) 127 endif() 128 129 set(MIP_TEST_LIBS lemon) 102 130 103 IF(LEMON_HAVE_MIP) 104 IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer") 105 ADD_EXECUTABLE(mip_test mip_test.cc) 106 ELSE() 107 ADD_EXECUTABLE(mip_test EXCLUDE_FROM_ALL mip_test.cc) 108 ENDIF() 131 if(LEMON_HAVE_GLPK) 132 set(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES}) 133 endif() 134 if(LEMON_HAVE_CPLEX) 135 set(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${ILOG_LIBRARIES}) 136 endif() 137 if(LEMON_HAVE_CBC) 138 set(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES}) 139 endif() 109 140 110 SET(MIP_TEST_LIBS lemon) 141 target_link_libraries(mip_test ${MIP_TEST_LIBS}) 142 add_test(mip_test mip_test) 143 add_dependencies(check mip_test) 111 144 112 IF(LEMON_HAVE_GLPK) 113 SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES}) 114 ENDIF() 115 IF(LEMON_HAVE_CPLEX) 116 SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${ILOG_LIBRARIES}) 117 ENDIF() 118 IF(LEMON_HAVE_CBC) 119 SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES}) 120 ENDIF() 145 if(WIN32 AND LEMON_HAVE_GLPK) 146 get_target_property(TARGET_LOC mip_test LOCATION) 147 get_filename_component(TARGET_PATH ${TARGET_LOC} PATH) 148 add_custom_command( 149 TARGET mip_test 150 POST_BUILD 151 COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH} 152 COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll 153 ${TARGET_PATH} 154 COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}) 155 endif() 121 156 122 TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS}) 123 ADD_TEST(mip_test mip_test) 124 ADD_DEPENDENCIES(check mip_test) 125 126 IF(WIN32 AND LEMON_HAVE_GLPK) 127 GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION) 128 GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH) 129 ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD 130 COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH} 131 COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH} 132 COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH} 133 ) 134 ENDIF() 157 if(WIN32 AND LEMON_HAVE_CPLEX) 158 get_target_property(TARGET_LOC mip_test LOCATION) 159 get_filename_component(TARGET_PATH ${TARGET_LOC} PATH) 160 add_custom_command( 161 TARGET mip_test 162 POST_BUILD 163 COMMAND ${CMAKE_COMMAND} -E copy ${ILOG_CPLEX_DLL} ${TARGET_PATH}) 164 endif() 165 endif() 135 166 136 IF(WIN32 AND LEMON_HAVE_CPLEX) 137 GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION) 138 GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH) 139 ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD 140 COMMAND ${CMAKE_COMMAND} -E copy ${ILOG_CPLEX_DLL} ${TARGET_PATH} 141 ) 142 ENDIF() 143 ENDIF() 167 foreach(TEST_NAME ${TESTS}) 168 add_executable(${TEST_NAME} ${TEST_NAME}.cc) 169 target_link_libraries(${TEST_NAME} LEMON::LEMON) 170 target_include_directories( 171 ${TEST_NAME} 172 PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}> 173 $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}> 174 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> 175 $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}> 176 $<INSTALL_INTERFACE:include/lemon>) 177 # Inherit lemon target properties (flags, cxx standard) 178 if(APPLE) 179 set_target_properties( 180 ${TEST_NAME} PROPERTIES INSTALL_RPATH 181 "@loader_path/../${CMAKE_INSTALL_LIBDIR}") 182 elseif(UNIX AND NOT APPLE) 183 set_target_properties( 184 ${TEST_NAME} PROPERTIES INSTALL_RPATH 185 "$ORIGIN/../${CMAKE_INSTALL_LIBDIR}") 186 endif() 144 187 145 FOREACH(TEST_NAME ${TESTS}) 146 IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer") 147 ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc) 148 ELSE() 149 ADD_EXECUTABLE(${TEST_NAME} EXCLUDE_FROM_ALL ${TEST_NAME}.cc) 150 ENDIF() 151 TARGET_LINK_LIBRARIES(${TEST_NAME} lemon) 152 IF(TEST_WITH_VALGRIND) 153 ADD_TEST(${TEST_NAME} 154 valgrind --error-exitcode=1 ${VALGRIND_FLAGS} 155 ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME} ) 156 ELSE() 157 ADD_TEST(${TEST_NAME} ${TEST_NAME}) 158 ENDIF() 159 ADD_DEPENDENCIES(check ${TEST_NAME}) 160 ENDFOREACH() 188 if(LEMON_TEST_WITH_VALGRIND) 189 add_test(${TEST_NAME} valgrind --error-exitcode=1 ${VALGRIND_FLAGS} 190 ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME}) 191 else() 192 add_test(${TEST_NAME} ${TEST_NAME}) 193 endif() 194 add_dependencies(check ${TEST_NAME}) 195 endforeach() -
tools/CMakeLists.txt
diff -r a278d16bd2d0 tools/CMakeLists.txt
a b 1 INCLUDE_DIRECTORIES( 2 ${PROJECT_SOURCE_DIR} 3 ${PROJECT_BINARY_DIR} 4 ) 1 #[[ 2 This file is a part of LEMON, a generic C++ optimization library. 3 4 Copyright (C) 2003-2021 5 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 6 (Egervary Research Group on Combinatorial Optimization, EGRES). 5 7 6 LINK_DIRECTORIES( 7 ${PROJECT_BINARY_DIR}/lemon 8 ) 8 Permission to use, modify and distribute this software is granted 9 provided that this copyright notice appears in all copies. For 10 precise terms see the accompanying LICENSE file. 9 11 10 ADD_EXECUTABLE(lgf-gen lgf-gen.cc) 11 TARGET_LINK_LIBRARIES(lgf-gen lemon) 12 This software is provided "AS IS" with no warranty of any kind, 13 express or implied, and with no claim as to its suitability for any 14 purpose. 15 ]] 12 16 13 ADD_EXECUTABLE(dimacs-to-lgf dimacs-to-lgf.cc) 14 TARGET_LINK_LIBRARIES(dimacs-to-lgf lemon) 17 #[[ 18 This file builds some optional tools. 19 ]] 15 20 16 ADD_EXECUTABLE(dimacs-solver dimacs-solver.cc) 17 TARGET_LINK_LIBRARIES(dimacs-solver lemon) 21 add_executable(lgf-gen lgf-gen.cc) 22 target_link_libraries(lgf-gen LEMON::LEMON) 23 24 add_executable(dimacs-to-lgf dimacs-to-lgf.cc) 25 target_link_libraries(dimacs-to-lgf LEMON::LEMON) 18 26 19 INSTALL( 20 TARGETS lgf-gen dimacs-to-lgf dimacs-solver 21 RUNTIME DESTINATION bin 22 COMPONENT bin 23 ) 27 add_executable(dimacs-solver dimacs-solver.cc) 28 target_link_libraries(dimacs-solver LEMON::LEMON) 24 29 25 IF(NOT WIN32) 26 INSTALL( 30 install(TARGETS lgf-gen dimacs-to-lgf dimacs-solver RUNTIME DESTINATION bin 31 COMPONENT bin) 32 33 # TODO: Check 34 if(NOT WIN32) 35 install( 27 36 PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/lemon-0.x-to-1.x.sh 28 37 DESTINATION bin 29 COMPONENT bin 30 ) 31 ENDIF() 38 COMPONENT bin) 39 endif()