CMakeLists.txt
author Balazs Dezso <deba@google.com>
Fri, 22 Jan 2021 10:55:32 +0100
changeset 1208 c6aa2cc1af04
parent 1185 c8d0179a32a2
parent 1197 f179aa1045a4
child 1204 736a341e604b
permissions -rw-r--r--
Factor out recursion from weighted matching algorithms (#638)
alpar@1107
     1
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
alpar@225
     2
alpar@1119
     3
IF(POLICY CMP0048) 
alpar@1119
     4
  CMAKE_POLICY(SET CMP0048 OLD) 
alpar@1119
     5
ENDIF(POLICY CMP0048)
alpar@1114
     6
alpar@1128
     7
IF(POLICY CMP0043) 
alpar@1128
     8
  CMAKE_POLICY(SET CMP0043 OLD) 
alpar@1128
     9
ENDIF(POLICY CMP0043)
alpar@1128
    10
alpar@1137
    11
IF(POLICY CMP0026)
alpar@1137
    12
  #This is for copying the dll's needed by glpk (in lp_test and mip_test)
alpar@1137
    13
  CMAKE_POLICY(SET CMP0026 OLD) 
alpar@1137
    14
ENDIF(POLICY CMP0026)
alpar@1137
    15
ladanyi@678
    16
SET(PROJECT_NAME "LEMON")
ladanyi@678
    17
PROJECT(${PROJECT_NAME})
alpar@225
    18
alpar@927
    19
INCLUDE(FindPythonInterp)
alpar@927
    20
INCLUDE(FindWget)
alpar@927
    21
ladanyi@678
    22
IF(EXISTS ${PROJECT_SOURCE_DIR}/cmake/version.cmake)
ladanyi@678
    23
  INCLUDE(${PROJECT_SOURCE_DIR}/cmake/version.cmake)
ladanyi@678
    24
ELSEIF(DEFINED ENV{LEMON_VERSION})
ladanyi@678
    25
  SET(LEMON_VERSION $ENV{LEMON_VERSION} CACHE STRING "LEMON version string.")
ladanyi@678
    26
ELSE()
ladanyi@678
    27
  EXECUTE_PROCESS(
alpar@982
    28
    COMMAND
alpar@982
    29
    hg log -r. --template "{latesttag}"
alpar@927
    30
    WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
alpar@982
    31
    OUTPUT_VARIABLE HG_REVISION_TAG
alpar@927
    32
    ERROR_QUIET
alpar@927
    33
    OUTPUT_STRIP_TRAILING_WHITESPACE
alpar@927
    34
  )
alpar@927
    35
  EXECUTE_PROCESS(
alpar@982
    36
    COMMAND
alpar@982
    37
    hg log -r. --template "{latesttagdistance}"
ladanyi@678
    38
    WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
alpar@982
    39
    OUTPUT_VARIABLE HG_REVISION_DIST
ladanyi@678
    40
    ERROR_QUIET
ladanyi@678
    41
    OUTPUT_STRIP_TRAILING_WHITESPACE
ladanyi@678
    42
  )
alpar@982
    43
  EXECUTE_PROCESS(
alpar@982
    44
    COMMAND
alpar@982
    45
    hg log -r. --template "{node|short}"
alpar@982
    46
    WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
alpar@982
    47
    OUTPUT_VARIABLE HG_REVISION_ID
alpar@982
    48
    ERROR_QUIET
alpar@982
    49
    OUTPUT_STRIP_TRAILING_WHITESPACE
alpar@982
    50
  )
alpar@982
    51
alpar@982
    52
  IF(HG_REVISION_TAG STREQUAL "")
alpar@927
    53
    SET(HG_REVISION_ID "hg-tip")
alpar@927
    54
  ELSE()
alpar@982
    55
    IF(HG_REVISION_TAG STREQUAL "null")
alpar@982
    56
      SET(HG_REVISION_TAG "trunk")
alpar@982
    57
    ELSEIF(HG_REVISION_TAG MATCHES "^r")
alpar@982
    58
      STRING(SUBSTRING ${HG_REVISION_TAG} 1 -1 HG_REVISION_TAG)
alpar@982
    59
    ENDIF()
alpar@982
    60
    IF(HG_REVISION_DIST STREQUAL "0")
alpar@982
    61
      SET(HG_REVISION ${HG_REVISION_TAG})
alpar@927
    62
    ELSE()
alpar@982
    63
      SET(HG_REVISION
alpar@982
    64
	"${HG_REVISION_TAG}+${HG_REVISION_DIST}-${HG_REVISION_ID}")
alpar@927
    65
    ENDIF()
ladanyi@680
    66
  ENDIF()
alpar@982
    67
alpar@982
    68
  SET(LEMON_VERSION ${HG_REVISION} CACHE STRING "LEMON version string.")
ladanyi@678
    69
ENDIF()
ladanyi@678
    70
ladanyi@678
    71
SET(PROJECT_VERSION ${LEMON_VERSION})
alpar@225
    72
ladanyi@549
    73
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
alpar@225
    74
ladanyi@679
    75
FIND_PACKAGE(Doxygen)
ladanyi@679
    76
FIND_PACKAGE(Ghostscript)
alpar@1064
    77
alpar@1134
    78
IF(WIN32)
alpar@1134
    79
  SET(LEMON_WIN32 TRUE)
alpar@1134
    80
ENDIF(WIN32)
alpar@1134
    81
alpar@1064
    82
SET(LEMON_ENABLE_GLPK YES CACHE STRING "Enable GLPK solver backend.")
alpar@1064
    83
SET(LEMON_ENABLE_ILOG YES CACHE STRING "Enable ILOG (CPLEX) solver backend.")
alpar@1064
    84
SET(LEMON_ENABLE_COIN YES CACHE STRING "Enable COIN solver backend.")
alpar@1088
    85
SET(LEMON_ENABLE_SOPLEX YES CACHE STRING "Enable SoPlex solver backend.")
alpar@1064
    86
alpar@1064
    87
IF(LEMON_ENABLE_GLPK) 
alpar@1064
    88
  FIND_PACKAGE(GLPK 4.33)
alpar@1180
    89
  IF(GLPK_FOUND)
alpar@1180
    90
    SET(LEMON_HAVE_LP TRUE)
alpar@1180
    91
    SET(LEMON_HAVE_MIP TRUE)
alpar@1180
    92
    SET(LEMON_HAVE_GLPK TRUE)
alpar@1180
    93
  ENDIF(GLPK_FOUND)
alpar@1064
    94
ENDIF(LEMON_ENABLE_GLPK)
alpar@1064
    95
IF(LEMON_ENABLE_ILOG)
alpar@1064
    96
  FIND_PACKAGE(ILOG)
alpar@1180
    97
  IF(ILOG_FOUND)
alpar@1180
    98
    SET(LEMON_HAVE_LP TRUE)
alpar@1180
    99
    SET(LEMON_HAVE_MIP TRUE)
alpar@1180
   100
    SET(LEMON_HAVE_CPLEX TRUE)
alpar@1180
   101
  ENDIF(ILOG_FOUND)
alpar@1064
   102
ENDIF(LEMON_ENABLE_ILOG)
alpar@1064
   103
IF(LEMON_ENABLE_COIN)
alpar@1064
   104
  FIND_PACKAGE(COIN)
alpar@1180
   105
  IF(COIN_FOUND)
alpar@1180
   106
    SET(LEMON_HAVE_LP TRUE)
alpar@1180
   107
    SET(LEMON_HAVE_MIP TRUE)
alpar@1180
   108
    SET(LEMON_HAVE_CLP TRUE)
alpar@1180
   109
    SET(LEMON_HAVE_CBC TRUE)
alpar@1180
   110
  ENDIF(COIN_FOUND)
alpar@1064
   111
ENDIF(LEMON_ENABLE_COIN)
alpar@1088
   112
IF(LEMON_ENABLE_SOPLEX)
alpar@1088
   113
  FIND_PACKAGE(SOPLEX)
alpar@1180
   114
  IF(SOPLEX_FOUND)
alpar@1180
   115
    SET(LEMON_HAVE_LP TRUE)
alpar@1180
   116
    SET(LEMON_HAVE_SOPLEX TRUE)
alpar@1180
   117
  ENDIF(SOPLEX_FOUND)
alpar@1088
   118
ENDIF(LEMON_ENABLE_SOPLEX)
alpar@1064
   119
alpar@1064
   120
IF(ILOG_FOUND)
alpar@1064
   121
  SET(DEFAULT_LP "CPLEX")
alpar@1064
   122
  SET(DEFAULT_MIP "CPLEX")
alpar@1064
   123
ELSEIF(COIN_FOUND)
alpar@1064
   124
  SET(DEFAULT_LP "CLP")
alpar@1064
   125
  SET(DEFAULT_MIP "CBC")
alpar@1064
   126
ELSEIF(GLPK_FOUND)
alpar@1064
   127
  SET(DEFAULT_LP "GLPK")
alpar@1064
   128
  SET(DEFAULT_MIP "GLPK")
alpar@1088
   129
ELSEIF(SOPLEX_FOUND)
alpar@1088
   130
  SET(DEFAULT_LP "SOPLEX")
alpar@1064
   131
ENDIF()
alpar@1064
   132
alpar@1064
   133
IF(NOT LEMON_DEFAULT_LP OR
alpar@1064
   134
    (NOT ILOG_FOUND AND (LEMON_DEFAULT_LP STREQUAL "CPLEX")) OR
alpar@1064
   135
    (NOT COIN_FOUND AND (LEMON_DEFAULT_LP STREQUAL "CLP")) OR
alpar@1088
   136
    (NOT GLPK_FOUND AND (LEMON_DEFAULT_LP STREQUAL "GLPK")) OR
alpar@1088
   137
    (NOT SOPLEX_FOUND AND (LEMON_DEFAULT_LP STREQUAL "SOPLEX")))
alpar@1064
   138
  SET(LEMON_DEFAULT_LP ${DEFAULT_LP} CACHE STRING
alpar@1088
   139
    "Default LP solver backend (GLPK, CPLEX, CLP or SOPLEX)" FORCE)
alpar@1105
   140
ELSE()
alpar@1105
   141
  SET(LEMON_DEFAULT_LP ${DEFAULT_LP} CACHE STRING
alpar@1105
   142
    "Default LP solver backend (GLPK, CPLEX, CLP or SOPLEX)")
alpar@1064
   143
ENDIF()
alpar@1064
   144
IF(NOT LEMON_DEFAULT_MIP OR
alpar@1064
   145
    (NOT ILOG_FOUND AND (LEMON_DEFAULT_MIP STREQUAL "CPLEX")) OR
alpar@1064
   146
    (NOT COIN_FOUND AND (LEMON_DEFAULT_MIP STREQUAL "CBC")) OR
alpar@1064
   147
    (NOT GLPK_FOUND AND (LEMON_DEFAULT_MIP STREQUAL "GLPK")))
alpar@1064
   148
  SET(LEMON_DEFAULT_MIP ${DEFAULT_MIP} CACHE STRING
alpar@1064
   149
    "Default MIP solver backend (GLPK, CPLEX or CBC)" FORCE)
alpar@1105
   150
ELSE()
alpar@1105
   151
  SET(LEMON_DEFAULT_MIP ${DEFAULT_MIP} CACHE STRING
alpar@1105
   152
    "Default MIP solver backend (GLPK, CPLEX or CBC)")
alpar@1064
   153
ENDIF()
alpar@1064
   154
kpeter@1197
   155
IF( ( ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") AND
kpeter@1197
   156
      ("${CMAKE_CXX_COMPILER_VERSION}" VERSION_GREATER_EQUAL "4.8") )
kpeter@1197
   157
    OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
kpeter@1197
   158
    OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
kpeter@1197
   159
    )
kpeter@1197
   160
  SET(LEMON_NO_UNUSED_LOCAL_TYPEDEF_WARNINGS TRUE)
kpeter@1197
   161
ENDIF()
ladanyi@473
   162
alpar@927
   163
IF(DEFINED ENV{LEMON_CXX_WARNING})
alpar@927
   164
  SET(CXX_WARNING $ENV{LEMON_CXX_WARNING})
alpar@927
   165
ELSE()
kpeter@1197
   166
  IF( ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
kpeter@1197
   167
      OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
kpeter@1197
   168
      )
alpar@940
   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")
alpar@927
   170
    SET(CMAKE_CXX_FLAGS_DEBUG CACHE STRING "-ggdb")
alpar@927
   171
    SET(CMAKE_C_FLAGS_DEBUG CACHE STRING "-ggdb")
kpeter@1197
   172
  ELSEIF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
kpeter@1197
   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")
kpeter@1197
   174
    SET(CMAKE_CXX_FLAGS_DEBUG CACHE STRING "-ggdb")
kpeter@1197
   175
    SET(CMAKE_C_FLAGS_DEBUG CACHE STRING "-ggdb")
alpar@927
   176
  ELSEIF(MSVC)
alpar@927
   177
    # This part is unnecessary 'casue the same is set by the lemon/core.h.
alpar@1123
   178
    # Still kept as an example.
alpar@1123
   179
alpar@1123
   180
    # SET(CXX_WARNING "/wd4250 /wd4267 /wd4355 /wd4503 /wd4800 /wd4996")
alpar@1123
   181
alpar@927
   182
    # Suppressed warnings:
alpar@927
   183
    # C4250: 'class1' : inherits 'class2::member' via dominance
alpar@1123
   184
    # C4267: conversion from 'size_t' to 'type', possible loss of data
alpar@927
   185
    # C4355: 'this' : used in base member initializer list
alpar@927
   186
    # C4503: 'function' : decorated name length exceeded, name was truncated
alpar@927
   187
    # C4800: 'type' : forcing value to bool 'true' or 'false'
alpar@927
   188
    #        (performance warning)
alpar@927
   189
    # C4996: 'function': was declared deprecated
alpar@927
   190
  ELSE()
alpar@975
   191
    SET(CXX_WARNING "-Wall")
alpar@927
   192
  ENDIF()
alpar@927
   193
ENDIF()
alpar@927
   194
SET(LEMON_CXX_WARNING_FLAGS ${CXX_WARNING} CACHE STRING "LEMON warning flags.")
alpar@927
   195
alpar@927
   196
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LEMON_CXX_WARNING_FLAGS}")
alpar@927
   197
alpar@1017
   198
IF(MSVC)
alpar@1122
   199
  SET(CMAKE_CXX_FLAGS "/bigobj ${CMAKE_CXX_FLAGS}")
alpar@1017
   200
  SET( CMAKE_CXX_FLAGS_MAINTAINER "/WX ${CMAKE_CXX_FLAGS_DEBUG}" CACHE STRING
alpar@927
   201
    "Flags used by the C++ compiler during maintainer builds."
alpar@1017
   202
    )
alpar@1017
   203
  SET( CMAKE_C_FLAGS_MAINTAINER "/WX ${CMAKE_CXX_FLAGS_DEBUG}" CACHE STRING
alpar@927
   204
    "Flags used by the C compiler during maintainer builds."
alpar@1017
   205
    )
alpar@1017
   206
  SET( CMAKE_EXE_LINKER_FLAGS_MAINTAINER
alpar@1017
   207
    "${CMAKE_EXE_LINKER_FLAGS_DEBUG}" CACHE STRING
alpar@1017
   208
    "Flags used for linking binaries during maintainer builds."
alpar@1017
   209
    )
alpar@1017
   210
  SET( CMAKE_SHARED_LINKER_FLAGS_MAINTAINER
alpar@1017
   211
    "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}" CACHE STRING
alpar@1017
   212
    "Flags used by the shared libraries linker during maintainer builds."
alpar@1017
   213
    )
alpar@1017
   214
ELSE()
alpar@1017
   215
  SET( CMAKE_CXX_FLAGS_MAINTAINER "-Werror -ggdb -O0" CACHE STRING
alpar@1017
   216
    "Flags used by the C++ compiler during maintainer builds."
alpar@1017
   217
    )
alpar@1017
   218
  SET( CMAKE_C_FLAGS_MAINTAINER "-Werror -O0" CACHE STRING
alpar@1017
   219
    "Flags used by the C compiler during maintainer builds."
alpar@1017
   220
    )
alpar@1017
   221
  SET( CMAKE_EXE_LINKER_FLAGS_MAINTAINER
alpar@1111
   222
    "${CMAKE_EXE_LINKER_FLAGS_DEBUG}" CACHE STRING
alpar@927
   223
    "Flags used for linking binaries during maintainer builds."
alpar@1017
   224
    )
alpar@1017
   225
  SET( CMAKE_SHARED_LINKER_FLAGS_MAINTAINER
alpar@1111
   226
    "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}" CACHE STRING
alpar@927
   227
    "Flags used by the shared libraries linker during maintainer builds."
alpar@1017
   228
    )
alpar@1017
   229
ENDIF()
alpar@1017
   230
alpar@927
   231
MARK_AS_ADVANCED(
alpar@927
   232
    CMAKE_CXX_FLAGS_MAINTAINER
alpar@927
   233
    CMAKE_C_FLAGS_MAINTAINER
alpar@927
   234
    CMAKE_EXE_LINKER_FLAGS_MAINTAINER
alpar@927
   235
    CMAKE_SHARED_LINKER_FLAGS_MAINTAINER )
alpar@927
   236
alpar@927
   237
IF(CMAKE_CONFIGURATION_TYPES)
alpar@927
   238
  LIST(APPEND CMAKE_CONFIGURATION_TYPES Maintainer)
alpar@927
   239
  LIST(REMOVE_DUPLICATES CMAKE_CONFIGURATION_TYPES)
alpar@927
   240
  SET(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING
alpar@927
   241
      "Add the configurations that we need"
alpar@927
   242
      FORCE)
alpar@927
   243
 endif()
alpar@927
   244
alpar@927
   245
IF(NOT CMAKE_BUILD_TYPE)
alpar@927
   246
  SET(CMAKE_BUILD_TYPE "Release")
alpar@927
   247
ENDIF()
alpar@927
   248
alpar@927
   249
SET( CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING
alpar@927
   250
    "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel Maintainer."
alpar@927
   251
    FORCE )
alpar@927
   252
alpar@1128
   253
SET_DIRECTORY_PROPERTIES(PROPERTIES
alpar@1128
   254
  COMPILE_DEFINITIONS_DEBUG "LEMON_ENABLE_DEBUG"
alpar@1128
   255
  COMPILE_DEFINITIONS_MAINTAINER "LEMON_ENABLE_DEBUG"
alpar@1128
   256
)
alpar@927
   257
alpar@496
   258
INCLUDE(CheckTypeSize)
ladanyi@677
   259
CHECK_TYPE_SIZE("long long" LONG_LONG)
ladanyi@677
   260
SET(LEMON_HAVE_LONG_LONG ${HAVE_LONG_LONG})
alpar@496
   261
deba@979
   262
INCLUDE(FindThreads)
alpar@980
   263
alpar@980
   264
IF(NOT LEMON_THREADING)
alpar@980
   265
  IF(CMAKE_USE_PTHREADS_INIT)
alpar@980
   266
    SET(LEMON_THREADING "Pthread")
alpar@980
   267
  ELSEIF(CMAKE_USE_WIN32_THREADS_INIT)
alpar@980
   268
    SET(LEMON_THREADING "Win32")
alpar@980
   269
  ELSE()
alpar@980
   270
    SET(LEMON_THREADING "None")
alpar@980
   271
  ENDIF()
alpar@980
   272
ENDIF()
alpar@980
   273
alpar@980
   274
SET( LEMON_THREADING "${LEMON_THREADING}" CACHE STRING
alpar@980
   275
  "Choose the threading library, options are: Pthread Win32 None."
alpar@980
   276
  FORCE )
alpar@980
   277
alpar@980
   278
IF(LEMON_THREADING STREQUAL "Pthread")
alpar@980
   279
  SET(LEMON_USE_PTHREAD TRUE)
alpar@980
   280
ELSEIF(LEMON_THREADING STREQUAL "Win32")
alpar@980
   281
  SET(LEMON_USE_WIN32_THREADS TRUE)
alpar@980
   282
ENDIF()
alpar@744
   283
alpar@225
   284
ENABLE_TESTING()
alpar@225
   285
ggab90@1130
   286
ggab90@1130
   287
INCLUDE(CheckCXXCompilerFlag)
alpar@1131
   288
CHECK_CXX_COMPILER_FLAG("-std=c++11" LEMON_CXX11)
alpar@1131
   289
IF(LEMON_CXX11)
ggab90@1130
   290
  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
ggab90@1130
   291
ENDIF()
ggab90@1130
   292
ggab90@1130
   293
alpar@927
   294
IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@927
   295
  ADD_CUSTOM_TARGET(check ALL COMMAND ${CMAKE_CTEST_COMMAND})
alpar@927
   296
ELSE()
alpar@927
   297
  ADD_CUSTOM_TARGET(check COMMAND ${CMAKE_CTEST_COMMAND})
alpar@927
   298
ENDIF()
alpar@927
   299
alpar@225
   300
ADD_SUBDIRECTORY(lemon)
ladanyi@549
   301
IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
alpar@925
   302
  ADD_SUBDIRECTORY(contrib)
ladanyi@549
   303
  ADD_SUBDIRECTORY(demo)
ladanyi@549
   304
  ADD_SUBDIRECTORY(tools)
ladanyi@549
   305
  ADD_SUBDIRECTORY(doc)
ladanyi@549
   306
  ADD_SUBDIRECTORY(test)
ladanyi@679
   307
ENDIF()
alpar@225
   308
ladanyi@675
   309
CONFIGURE_FILE(
ladanyi@675
   310
  ${PROJECT_SOURCE_DIR}/cmake/LEMONConfig.cmake.in
ladanyi@675
   311
  ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake
ladanyi@675
   312
  @ONLY
ladanyi@675
   313
)
ladanyi@675
   314
IF(UNIX)
ladanyi@675
   315
  INSTALL(
ladanyi@675
   316
    FILES ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake
ladanyi@675
   317
    DESTINATION share/lemon/cmake
ladanyi@675
   318
  )
ladanyi@675
   319
ELSEIF(WIN32)
ladanyi@675
   320
  INSTALL(
ladanyi@675
   321
    FILES ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake
ladanyi@675
   322
    DESTINATION cmake
ladanyi@675
   323
  )
ladanyi@679
   324
ENDIF()
ladanyi@675
   325
alpar@983
   326
CONFIGURE_FILE(
alpar@983
   327
  ${PROJECT_SOURCE_DIR}/cmake/version.cmake.in
alpar@983
   328
  ${PROJECT_BINARY_DIR}/cmake/version.cmake
alpar@983
   329
  @ONLY
alpar@983
   330
)
alpar@983
   331
alpar@983
   332
SET(ARCHIVE_BASE_NAME ${CMAKE_PROJECT_NAME})
alpar@983
   333
STRING(TOLOWER ${ARCHIVE_BASE_NAME} ARCHIVE_BASE_NAME)
alpar@983
   334
SET(ARCHIVE_NAME ${ARCHIVE_BASE_NAME}-${PROJECT_VERSION})
alpar@983
   335
ADD_CUSTOM_TARGET(dist
alpar@983
   336
  COMMAND cmake -E remove_directory ${ARCHIVE_NAME}
alpar@983
   337
  COMMAND hg archive ${ARCHIVE_NAME}
alpar@983
   338
  COMMAND cmake -E copy cmake/version.cmake ${ARCHIVE_NAME}/cmake/version.cmake
alpar@983
   339
  COMMAND tar -czf ${ARCHIVE_BASE_NAME}-nodoc-${PROJECT_VERSION}.tar.gz ${ARCHIVE_NAME}
alpar@983
   340
  COMMAND zip -r ${ARCHIVE_BASE_NAME}-nodoc-${PROJECT_VERSION}.zip ${ARCHIVE_NAME}
alpar@983
   341
  COMMAND cmake -E copy_directory doc/html ${ARCHIVE_NAME}/doc/html
alpar@983
   342
  COMMAND tar -czf ${ARCHIVE_NAME}.tar.gz ${ARCHIVE_NAME}
alpar@983
   343
  COMMAND zip -r ${ARCHIVE_NAME}.zip ${ARCHIVE_NAME}
alpar@983
   344
  COMMAND cmake -E copy_directory doc/html ${ARCHIVE_BASE_NAME}-doc-${PROJECT_VERSION}
alpar@983
   345
  COMMAND tar -czf ${ARCHIVE_BASE_NAME}-doc-${PROJECT_VERSION}.tar.gz ${ARCHIVE_BASE_NAME}-doc-${PROJECT_VERSION}
alpar@983
   346
  COMMAND zip -r ${ARCHIVE_BASE_NAME}-doc-${PROJECT_VERSION}.zip ${ARCHIVE_BASE_NAME}-doc-${PROJECT_VERSION}
alpar@983
   347
  COMMAND cmake -E remove_directory ${ARCHIVE_NAME}
alpar@983
   348
  COMMAND cmake -E remove_directory ${ARCHIVE_BASE_NAME}-doc-${PROJECT_VERSION}
alpar@983
   349
  DEPENDS html
alpar@983
   350
  WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
alpar@983
   351
alpar@983
   352
# CPACK config (Basically for NSIS)
alpar@927
   353
IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
ladanyi@679
   354
  SET(CPACK_PACKAGE_NAME ${PROJECT_NAME})
ladanyi@679
   355
  SET(CPACK_PACKAGE_VENDOR "EGRES")
ladanyi@679
   356
  SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY
ladanyi@679
   357
    "LEMON - Library for Efficient Modeling and Optimization in Networks")
ladanyi@679
   358
  SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
alpar@225
   359
ladanyi@679
   360
  SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
alpar@225
   361
ladanyi@679
   362
  SET(CPACK_PACKAGE_INSTALL_DIRECTORY
ladanyi@679
   363
    "${PROJECT_NAME} ${PROJECT_VERSION}")
ladanyi@679
   364
  SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY
ladanyi@679
   365
    "${PROJECT_NAME} ${PROJECT_VERSION}")
alpar@225
   366
ladanyi@679
   367
  SET(CPACK_COMPONENTS_ALL headers library html_documentation bin)
alpar@225
   368
ladanyi@679
   369
  SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ headers")
ladanyi@679
   370
  SET(CPACK_COMPONENT_LIBRARY_DISPLAY_NAME "Dynamic-link library")
ladanyi@679
   371
  SET(CPACK_COMPONENT_BIN_DISPLAY_NAME "Command line utilities")
ladanyi@679
   372
  SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DISPLAY_NAME "HTML documentation")
alpar@225
   373
ladanyi@679
   374
  SET(CPACK_COMPONENT_HEADERS_DESCRIPTION
ladanyi@679
   375
    "C++ header files")
ladanyi@679
   376
  SET(CPACK_COMPONENT_LIBRARY_DESCRIPTION
ladanyi@679
   377
    "DLL and import library")
ladanyi@679
   378
  SET(CPACK_COMPONENT_BIN_DESCRIPTION
ladanyi@679
   379
    "Command line utilities")
ladanyi@679
   380
  SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DESCRIPTION
ladanyi@679
   381
    "Doxygen generated documentation")
alpar@225
   382
ladanyi@679
   383
  SET(CPACK_COMPONENT_HEADERS_DEPENDS library)
alpar@225
   384
ladanyi@679
   385
  SET(CPACK_COMPONENT_HEADERS_GROUP "Development")
ladanyi@679
   386
  SET(CPACK_COMPONENT_LIBRARY_GROUP "Development")
ladanyi@679
   387
  SET(CPACK_COMPONENT_HTML_DOCUMENTATION_GROUP "Documentation")
alpar@225
   388
ladanyi@679
   389
  SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION
ladanyi@679
   390
    "Components needed to develop software using LEMON")
ladanyi@679
   391
  SET(CPACK_COMPONENT_GROUP_DOCUMENTATION_DESCRIPTION
ladanyi@679
   392
    "Documentation of LEMON")
alpar@225
   393
ladanyi@679
   394
  SET(CPACK_ALL_INSTALL_TYPES Full Developer)
alpar@225
   395
ladanyi@679
   396
  SET(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full)
ladanyi@679
   397
  SET(CPACK_COMPONENT_LIBRARY_INSTALL_TYPES Developer Full)
ladanyi@679
   398
  SET(CPACK_COMPONENT_HTML_DOCUMENTATION_INSTALL_TYPES Full)
alpar@225
   399
ladanyi@679
   400
  SET(CPACK_GENERATOR "NSIS")
ladanyi@679
   401
  SET(CPACK_NSIS_MUI_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis/lemon.ico")
ladanyi@679
   402
  SET(CPACK_NSIS_MUI_UNIICON "${PROJECT_SOURCE_DIR}/cmake/nsis/uninstall.ico")
ladanyi@679
   403
  #SET(CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis\\\\installer.bmp")
ladanyi@679
   404
  SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\lemon.ico")
ladanyi@679
   405
  SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} ${PROJECT_NAME}")
ladanyi@679
   406
  SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\lemon.cs.elte.hu")
ladanyi@679
   407
  SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\lemon.cs.elte.hu")
ladanyi@679
   408
  SET(CPACK_NSIS_CONTACT "lemon-user@lemon.cs.elte.hu")
ladanyi@679
   409
  SET(CPACK_NSIS_CREATE_ICONS_EXTRA "
ladanyi@679
   410
    CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Documentation.lnk\\\" \\\"$INSTDIR\\\\share\\\\doc\\\\index.html\\\"
ladanyi@679
   411
    ")
ladanyi@679
   412
  SET(CPACK_NSIS_DELETE_ICONS_EXTRA "
ladanyi@679
   413
    !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
ladanyi@679
   414
    Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\Documentation.lnk\\\"
ladanyi@679
   415
    ")
alpar@225
   416
ladanyi@679
   417
  INCLUDE(CPack)
ladanyi@679
   418
ENDIF()