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