author | Peter Kovacs <kpeter@inf.elte.hu> |
Tue, 15 Mar 2011 19:52:31 +0100 | |
changeset 937 | 1226290a9b7d |
parent 925 | 06491fd08efd |
parent 927 | 16d466589b54 |
child 941 | 6660ac776acf |
permissions | -rw-r--r-- |
alpar@225 | 1 |
CMAKE_MINIMUM_REQUIRED(VERSION 2.6) |
alpar@225 | 2 |
|
ladanyi@678 | 3 |
SET(PROJECT_NAME "LEMON") |
ladanyi@678 | 4 |
PROJECT(${PROJECT_NAME}) |
alpar@225 | 5 |
|
alpar@927 | 6 |
INCLUDE(FindPythonInterp) |
alpar@927 | 7 |
INCLUDE(FindWget) |
alpar@927 | 8 |
|
ladanyi@678 | 9 |
IF(EXISTS ${PROJECT_SOURCE_DIR}/cmake/version.cmake) |
ladanyi@678 | 10 |
INCLUDE(${PROJECT_SOURCE_DIR}/cmake/version.cmake) |
ladanyi@678 | 11 |
ELSEIF(DEFINED ENV{LEMON_VERSION}) |
ladanyi@678 | 12 |
SET(LEMON_VERSION $ENV{LEMON_VERSION} CACHE STRING "LEMON version string.") |
ladanyi@678 | 13 |
ELSE() |
ladanyi@678 | 14 |
EXECUTE_PROCESS( |
alpar@927 | 15 |
COMMAND ${PYTHON_EXECUTABLE} ./scripts/chg-len.py |
alpar@927 | 16 |
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} |
alpar@927 | 17 |
OUTPUT_VARIABLE HG_REVISION_PATH |
alpar@927 | 18 |
ERROR_QUIET |
alpar@927 | 19 |
OUTPUT_STRIP_TRAILING_WHITESPACE |
alpar@927 | 20 |
) |
alpar@927 | 21 |
EXECUTE_PROCESS( |
ladanyi@678 | 22 |
COMMAND hg id -i |
ladanyi@678 | 23 |
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} |
ladanyi@678 | 24 |
OUTPUT_VARIABLE HG_REVISION |
ladanyi@678 | 25 |
ERROR_QUIET |
ladanyi@678 | 26 |
OUTPUT_STRIP_TRAILING_WHITESPACE |
ladanyi@678 | 27 |
) |
ladanyi@680 | 28 |
IF(HG_REVISION STREQUAL "") |
alpar@927 | 29 |
SET(HG_REVISION_ID "hg-tip") |
alpar@927 | 30 |
ELSE() |
alpar@927 | 31 |
IF(HG_REVISION_PATH STREQUAL "") |
alpar@927 | 32 |
SET(HG_REVISION_ID ${HG_REVISION}) |
alpar@927 | 33 |
ELSE() |
alpar@927 | 34 |
SET(HG_REVISION_ID ${HG_REVISION_PATH}.${HG_REVISION}) |
alpar@927 | 35 |
ENDIF() |
ladanyi@680 | 36 |
ENDIF() |
alpar@927 | 37 |
SET(LEMON_VERSION ${HG_REVISION_ID} CACHE STRING "LEMON version string.") |
ladanyi@678 | 38 |
ENDIF() |
ladanyi@678 | 39 |
|
ladanyi@678 | 40 |
SET(PROJECT_VERSION ${LEMON_VERSION}) |
alpar@225 | 41 |
|
ladanyi@549 | 42 |
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) |
alpar@225 | 43 |
|
ladanyi@679 | 44 |
FIND_PACKAGE(Doxygen) |
ladanyi@679 | 45 |
FIND_PACKAGE(Ghostscript) |
ladanyi@473 | 46 |
FIND_PACKAGE(GLPK 4.33) |
ladanyi@620 | 47 |
FIND_PACKAGE(CPLEX) |
ladanyi@621 | 48 |
FIND_PACKAGE(COIN) |
ladanyi@473 | 49 |
|
alpar@927 | 50 |
IF(DEFINED ENV{LEMON_CXX_WARNING}) |
alpar@927 | 51 |
SET(CXX_WARNING $ENV{LEMON_CXX_WARNING}) |
alpar@927 | 52 |
ELSE() |
alpar@927 | 53 |
IF(CMAKE_COMPILER_IS_GNUCXX) |
alpar@927 | 54 |
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 -ansi -fno-strict-aliasing -Wold-style-cast -Wno-unknown-pragmas") |
alpar@927 | 55 |
SET(CMAKE_CXX_FLAGS_DEBUG CACHE STRING "-ggdb") |
alpar@927 | 56 |
SET(CMAKE_C_FLAGS_DEBUG CACHE STRING "-ggdb") |
alpar@927 | 57 |
ELSEIF(MSVC) |
alpar@927 | 58 |
# This part is unnecessary 'casue the same is set by the lemon/core.h. |
alpar@927 | 59 |
# Still keep it as an example. |
alpar@927 | 60 |
SET(CXX_WARNING "/wd4250 /wd4355 /wd4503 /wd4800 /wd4996") |
alpar@927 | 61 |
# Suppressed warnings: |
alpar@927 | 62 |
# C4250: 'class1' : inherits 'class2::member' via dominance |
alpar@927 | 63 |
# C4355: 'this' : used in base member initializer list |
alpar@927 | 64 |
# C4503: 'function' : decorated name length exceeded, name was truncated |
alpar@927 | 65 |
# C4800: 'type' : forcing value to bool 'true' or 'false' |
alpar@927 | 66 |
# (performance warning) |
alpar@927 | 67 |
# C4996: 'function': was declared deprecated |
alpar@927 | 68 |
ELSE() |
alpar@927 | 69 |
SET(CXX_WARNING "-Wall -W") |
alpar@927 | 70 |
ENDIF() |
alpar@927 | 71 |
ENDIF() |
alpar@927 | 72 |
SET(LEMON_CXX_WARNING_FLAGS ${CXX_WARNING} CACHE STRING "LEMON warning flags.") |
alpar@927 | 73 |
|
alpar@927 | 74 |
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LEMON_CXX_WARNING_FLAGS}") |
alpar@927 | 75 |
|
alpar@927 | 76 |
SET( CMAKE_CXX_FLAGS_MAINTAINER "-Werror -ggdb" CACHE STRING |
alpar@927 | 77 |
"Flags used by the C++ compiler during maintainer builds." |
alpar@927 | 78 |
FORCE ) |
alpar@927 | 79 |
SET( CMAKE_C_FLAGS_MAINTAINER "-Werror" CACHE STRING |
alpar@927 | 80 |
"Flags used by the C compiler during maintainer builds." |
alpar@927 | 81 |
FORCE ) |
alpar@927 | 82 |
SET( CMAKE_EXE_LINKER_FLAGS_MAINTAINER |
alpar@927 | 83 |
"-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING |
alpar@927 | 84 |
"Flags used for linking binaries during maintainer builds." |
alpar@927 | 85 |
FORCE ) |
alpar@927 | 86 |
SET( CMAKE_SHARED_LINKER_FLAGS_MAINTAINER |
alpar@927 | 87 |
"-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING |
alpar@927 | 88 |
"Flags used by the shared libraries linker during maintainer builds." |
alpar@927 | 89 |
FORCE ) |
alpar@927 | 90 |
MARK_AS_ADVANCED( |
alpar@927 | 91 |
CMAKE_CXX_FLAGS_MAINTAINER |
alpar@927 | 92 |
CMAKE_C_FLAGS_MAINTAINER |
alpar@927 | 93 |
CMAKE_EXE_LINKER_FLAGS_MAINTAINER |
alpar@927 | 94 |
CMAKE_SHARED_LINKER_FLAGS_MAINTAINER ) |
alpar@927 | 95 |
|
alpar@927 | 96 |
IF(CMAKE_CONFIGURATION_TYPES) |
alpar@927 | 97 |
LIST(APPEND CMAKE_CONFIGURATION_TYPES Maintainer) |
alpar@927 | 98 |
LIST(REMOVE_DUPLICATES CMAKE_CONFIGURATION_TYPES) |
alpar@927 | 99 |
SET(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING |
alpar@927 | 100 |
"Add the configurations that we need" |
alpar@927 | 101 |
FORCE) |
alpar@927 | 102 |
endif() |
alpar@927 | 103 |
|
alpar@927 | 104 |
IF(NOT CMAKE_BUILD_TYPE) |
alpar@927 | 105 |
SET(CMAKE_BUILD_TYPE "Release") |
alpar@927 | 106 |
ENDIF() |
alpar@927 | 107 |
|
alpar@927 | 108 |
SET( CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING |
alpar@927 | 109 |
"Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel Maintainer." |
alpar@927 | 110 |
FORCE ) |
alpar@927 | 111 |
|
alpar@927 | 112 |
|
alpar@496 | 113 |
INCLUDE(CheckTypeSize) |
ladanyi@677 | 114 |
CHECK_TYPE_SIZE("long long" LONG_LONG) |
ladanyi@677 | 115 |
SET(LEMON_HAVE_LONG_LONG ${HAVE_LONG_LONG}) |
alpar@496 | 116 |
|
alpar@225 | 117 |
ENABLE_TESTING() |
alpar@225 | 118 |
|
alpar@927 | 119 |
IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer") |
alpar@927 | 120 |
ADD_CUSTOM_TARGET(check ALL COMMAND ${CMAKE_CTEST_COMMAND}) |
alpar@927 | 121 |
ELSE() |
alpar@927 | 122 |
ADD_CUSTOM_TARGET(check COMMAND ${CMAKE_CTEST_COMMAND}) |
alpar@927 | 123 |
ENDIF() |
alpar@927 | 124 |
|
alpar@225 | 125 |
ADD_SUBDIRECTORY(lemon) |
ladanyi@549 | 126 |
IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR}) |
alpar@925 | 127 |
ADD_SUBDIRECTORY(contrib) |
ladanyi@549 | 128 |
ADD_SUBDIRECTORY(demo) |
ladanyi@549 | 129 |
ADD_SUBDIRECTORY(tools) |
ladanyi@549 | 130 |
ADD_SUBDIRECTORY(doc) |
ladanyi@549 | 131 |
ADD_SUBDIRECTORY(test) |
ladanyi@679 | 132 |
ENDIF() |
alpar@225 | 133 |
|
ladanyi@675 | 134 |
CONFIGURE_FILE( |
ladanyi@675 | 135 |
${PROJECT_SOURCE_DIR}/cmake/LEMONConfig.cmake.in |
ladanyi@675 | 136 |
${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake |
ladanyi@675 | 137 |
@ONLY |
ladanyi@675 | 138 |
) |
ladanyi@675 | 139 |
IF(UNIX) |
ladanyi@675 | 140 |
INSTALL( |
ladanyi@675 | 141 |
FILES ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake |
ladanyi@675 | 142 |
DESTINATION share/lemon/cmake |
ladanyi@675 | 143 |
) |
ladanyi@675 | 144 |
ELSEIF(WIN32) |
ladanyi@675 | 145 |
INSTALL( |
ladanyi@675 | 146 |
FILES ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake |
ladanyi@675 | 147 |
DESTINATION cmake |
ladanyi@675 | 148 |
) |
ladanyi@679 | 149 |
ENDIF() |
ladanyi@675 | 150 |
|
alpar@927 | 151 |
IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR}) |
ladanyi@679 | 152 |
SET(CPACK_PACKAGE_NAME ${PROJECT_NAME}) |
ladanyi@679 | 153 |
SET(CPACK_PACKAGE_VENDOR "EGRES") |
ladanyi@679 | 154 |
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY |
ladanyi@679 | 155 |
"LEMON - Library for Efficient Modeling and Optimization in Networks") |
ladanyi@679 | 156 |
SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE") |
alpar@225 | 157 |
|
ladanyi@679 | 158 |
SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) |
alpar@225 | 159 |
|
ladanyi@679 | 160 |
SET(CPACK_PACKAGE_INSTALL_DIRECTORY |
ladanyi@679 | 161 |
"${PROJECT_NAME} ${PROJECT_VERSION}") |
ladanyi@679 | 162 |
SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY |
ladanyi@679 | 163 |
"${PROJECT_NAME} ${PROJECT_VERSION}") |
alpar@225 | 164 |
|
ladanyi@679 | 165 |
SET(CPACK_COMPONENTS_ALL headers library html_documentation bin) |
alpar@225 | 166 |
|
ladanyi@679 | 167 |
SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ headers") |
ladanyi@679 | 168 |
SET(CPACK_COMPONENT_LIBRARY_DISPLAY_NAME "Dynamic-link library") |
ladanyi@679 | 169 |
SET(CPACK_COMPONENT_BIN_DISPLAY_NAME "Command line utilities") |
ladanyi@679 | 170 |
SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DISPLAY_NAME "HTML documentation") |
alpar@225 | 171 |
|
ladanyi@679 | 172 |
SET(CPACK_COMPONENT_HEADERS_DESCRIPTION |
ladanyi@679 | 173 |
"C++ header files") |
ladanyi@679 | 174 |
SET(CPACK_COMPONENT_LIBRARY_DESCRIPTION |
ladanyi@679 | 175 |
"DLL and import library") |
ladanyi@679 | 176 |
SET(CPACK_COMPONENT_BIN_DESCRIPTION |
ladanyi@679 | 177 |
"Command line utilities") |
ladanyi@679 | 178 |
SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DESCRIPTION |
ladanyi@679 | 179 |
"Doxygen generated documentation") |
alpar@225 | 180 |
|
ladanyi@679 | 181 |
SET(CPACK_COMPONENT_HEADERS_DEPENDS library) |
alpar@225 | 182 |
|
ladanyi@679 | 183 |
SET(CPACK_COMPONENT_HEADERS_GROUP "Development") |
ladanyi@679 | 184 |
SET(CPACK_COMPONENT_LIBRARY_GROUP "Development") |
ladanyi@679 | 185 |
SET(CPACK_COMPONENT_HTML_DOCUMENTATION_GROUP "Documentation") |
alpar@225 | 186 |
|
ladanyi@679 | 187 |
SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION |
ladanyi@679 | 188 |
"Components needed to develop software using LEMON") |
ladanyi@679 | 189 |
SET(CPACK_COMPONENT_GROUP_DOCUMENTATION_DESCRIPTION |
ladanyi@679 | 190 |
"Documentation of LEMON") |
alpar@225 | 191 |
|
ladanyi@679 | 192 |
SET(CPACK_ALL_INSTALL_TYPES Full Developer) |
alpar@225 | 193 |
|
ladanyi@679 | 194 |
SET(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full) |
ladanyi@679 | 195 |
SET(CPACK_COMPONENT_LIBRARY_INSTALL_TYPES Developer Full) |
ladanyi@679 | 196 |
SET(CPACK_COMPONENT_HTML_DOCUMENTATION_INSTALL_TYPES Full) |
alpar@225 | 197 |
|
ladanyi@679 | 198 |
SET(CPACK_GENERATOR "NSIS") |
ladanyi@679 | 199 |
SET(CPACK_NSIS_MUI_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis/lemon.ico") |
ladanyi@679 | 200 |
SET(CPACK_NSIS_MUI_UNIICON "${PROJECT_SOURCE_DIR}/cmake/nsis/uninstall.ico") |
ladanyi@679 | 201 |
#SET(CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis\\\\installer.bmp") |
ladanyi@679 | 202 |
SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\lemon.ico") |
ladanyi@679 | 203 |
SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} ${PROJECT_NAME}") |
ladanyi@679 | 204 |
SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\lemon.cs.elte.hu") |
ladanyi@679 | 205 |
SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\lemon.cs.elte.hu") |
ladanyi@679 | 206 |
SET(CPACK_NSIS_CONTACT "lemon-user@lemon.cs.elte.hu") |
ladanyi@679 | 207 |
SET(CPACK_NSIS_CREATE_ICONS_EXTRA " |
ladanyi@679 | 208 |
CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Documentation.lnk\\\" \\\"$INSTDIR\\\\share\\\\doc\\\\index.html\\\" |
ladanyi@679 | 209 |
") |
ladanyi@679 | 210 |
SET(CPACK_NSIS_DELETE_ICONS_EXTRA " |
ladanyi@679 | 211 |
!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP |
ladanyi@679 | 212 |
Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\Documentation.lnk\\\" |
ladanyi@679 | 213 |
") |
alpar@225 | 214 |
|
ladanyi@679 | 215 |
INCLUDE(CPack) |
ladanyi@679 | 216 |
ENDIF() |