alpar@225: CMAKE_MINIMUM_REQUIRED(VERSION 2.6) alpar@225: ladanyi@678: SET(PROJECT_NAME "LEMON") ladanyi@678: PROJECT(${PROJECT_NAME}) alpar@225: alpar@899: INCLUDE(FindPythonInterp) alpar@912: INCLUDE(FindWget) alpar@899: ladanyi@678: IF(EXISTS ${PROJECT_SOURCE_DIR}/cmake/version.cmake) ladanyi@678: INCLUDE(${PROJECT_SOURCE_DIR}/cmake/version.cmake) ladanyi@678: ELSEIF(DEFINED ENV{LEMON_VERSION}) ladanyi@678: SET(LEMON_VERSION $ENV{LEMON_VERSION} CACHE STRING "LEMON version string.") ladanyi@678: ELSE() ladanyi@678: EXECUTE_PROCESS( alpar@899: COMMAND ${PYTHON_EXECUTABLE} ./scripts/chg-len.py ladanyi@898: WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} ladanyi@898: OUTPUT_VARIABLE HG_REVISION_PATH ladanyi@898: ERROR_QUIET ladanyi@898: OUTPUT_STRIP_TRAILING_WHITESPACE ladanyi@898: ) ladanyi@898: EXECUTE_PROCESS( ladanyi@678: COMMAND hg id -i ladanyi@678: WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} ladanyi@678: OUTPUT_VARIABLE HG_REVISION ladanyi@678: ERROR_QUIET ladanyi@678: OUTPUT_STRIP_TRAILING_WHITESPACE ladanyi@678: ) ladanyi@680: IF(HG_REVISION STREQUAL "") ladanyi@898: SET(HG_REVISION_ID "hg-tip") ladanyi@898: ELSE() alpar@899: IF(HG_REVISION_PATH STREQUAL "") alpar@899: SET(HG_REVISION_ID ${HG_REVISION}) alpar@899: ELSE() alpar@899: SET(HG_REVISION_ID ${HG_REVISION_PATH}.${HG_REVISION}) alpar@899: ENDIF() ladanyi@680: ENDIF() ladanyi@898: SET(LEMON_VERSION ${HG_REVISION_ID} CACHE STRING "LEMON version string.") ladanyi@678: ENDIF() ladanyi@678: ladanyi@678: SET(PROJECT_VERSION ${LEMON_VERSION}) alpar@225: ladanyi@549: SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) alpar@225: ladanyi@679: FIND_PACKAGE(Doxygen) ladanyi@679: FIND_PACKAGE(Ghostscript) ladanyi@473: FIND_PACKAGE(GLPK 4.33) ladanyi@620: FIND_PACKAGE(CPLEX) ladanyi@621: FIND_PACKAGE(COIN) ladanyi@473: alpar@900: IF(DEFINED ENV{LEMON_CXX_WARNING}) alpar@900: SET(CXX_WARNING $ENV{LEMON_CXX_WARNING}) alpar@900: ELSE() alpar@900: IF(CMAKE_COMPILER_IS_GNUCXX) alpar@900: 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@900: SET(CMAKE_CXX_FLAGS_DEBUG CACHE STRING "-ggdb") alpar@900: SET(CMAKE_C_FLAGS_DEBUG CACHE STRING "-ggdb") alpar@900: ELSEIF(MSVC) alpar@900: # This part is unnecessary 'casue the same is set by the lemon/core.h. alpar@900: # Still keep it as an example. alpar@900: SET(CXX_WARNING "/wd4250 /wd4355 /wd4503 /wd4800 /wd4996") alpar@900: # Suppressed warnings: alpar@900: # C4250: 'class1' : inherits 'class2::member' via dominance alpar@900: # C4355: 'this' : used in base member initializer list alpar@900: # C4503: 'function' : decorated name length exceeded, name was truncated alpar@900: # C4800: 'type' : forcing value to bool 'true' or 'false' alpar@900: # (performance warning) alpar@900: # C4996: 'function': was declared deprecated alpar@900: ELSE() alpar@900: SET(CXX_WARNING "-Wall -W") alpar@900: ENDIF() alpar@900: ENDIF() alpar@900: SET(LEMON_CXX_WARNING_FLAGS ${CXX_WARNING} CACHE STRING "LEMON warning flags.") alpar@900: alpar@900: SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LEMON_CXX_WARNING_FLAGS}") alpar@900: alpar@901: SET( CMAKE_CXX_FLAGS_MAINTAINER "-Werror -ggdb" CACHE STRING alpar@901: "Flags used by the C++ compiler during maintainer builds." alpar@901: FORCE ) alpar@901: SET( CMAKE_C_FLAGS_MAINTAINER "-Werror" CACHE STRING alpar@901: "Flags used by the C compiler during maintainer builds." alpar@901: FORCE ) alpar@901: SET( CMAKE_EXE_LINKER_FLAGS_MAINTAINER alpar@901: "-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING alpar@901: "Flags used for linking binaries during maintainer builds." alpar@901: FORCE ) alpar@901: SET( CMAKE_SHARED_LINKER_FLAGS_MAINTAINER alpar@901: "-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING alpar@901: "Flags used by the shared libraries linker during maintainer builds." alpar@901: FORCE ) alpar@901: MARK_AS_ADVANCED( alpar@901: CMAKE_CXX_FLAGS_MAINTAINER alpar@901: CMAKE_C_FLAGS_MAINTAINER alpar@901: CMAKE_EXE_LINKER_FLAGS_MAINTAINER alpar@901: CMAKE_SHARED_LINKER_FLAGS_MAINTAINER ) alpar@901: alpar@901: IF(CMAKE_CONFIGURATION_TYPES) alpar@901: LIST(APPEND CMAKE_CONFIGURATION_TYPES Maintainer) alpar@901: LIST(REMOVE_DUPLICATES CMAKE_CONFIGURATION_TYPES) alpar@901: SET(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING alpar@901: "Add the configurations that we need" alpar@901: FORCE) alpar@901: endif() alpar@901: alpar@900: IF(NOT CMAKE_BUILD_TYPE) alpar@901: SET(CMAKE_BUILD_TYPE "Release") alpar@900: ENDIF() alpar@900: alpar@901: SET( CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING alpar@901: "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel Maintainer." alpar@901: FORCE ) alpar@901: alpar@900: alpar@496: INCLUDE(CheckTypeSize) ladanyi@677: CHECK_TYPE_SIZE("long long" LONG_LONG) ladanyi@677: SET(LEMON_HAVE_LONG_LONG ${HAVE_LONG_LONG}) alpar@496: alpar@225: ENABLE_TESTING() alpar@225: alpar@901: IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer") alpar@901: ADD_CUSTOM_TARGET(check ALL COMMAND ${CMAKE_CTEST_COMMAND}) alpar@901: ELSE() alpar@901: ADD_CUSTOM_TARGET(check COMMAND ${CMAKE_CTEST_COMMAND}) alpar@901: ENDIF() ladanyi@897: alpar@225: ADD_SUBDIRECTORY(lemon) ladanyi@549: IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR}) ladanyi@549: ADD_SUBDIRECTORY(demo) ladanyi@549: ADD_SUBDIRECTORY(tools) ladanyi@549: ADD_SUBDIRECTORY(doc) ladanyi@549: ADD_SUBDIRECTORY(test) ladanyi@679: ENDIF() alpar@225: ladanyi@675: CONFIGURE_FILE( ladanyi@675: ${PROJECT_SOURCE_DIR}/cmake/LEMONConfig.cmake.in ladanyi@675: ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake ladanyi@675: @ONLY ladanyi@675: ) ladanyi@675: IF(UNIX) ladanyi@675: INSTALL( ladanyi@675: FILES ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake ladanyi@675: DESTINATION share/lemon/cmake ladanyi@675: ) ladanyi@675: ELSEIF(WIN32) ladanyi@675: INSTALL( ladanyi@675: FILES ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake ladanyi@675: DESTINATION cmake ladanyi@675: ) ladanyi@679: ENDIF() ladanyi@675: alpar@902: IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR}) ladanyi@679: SET(CPACK_PACKAGE_NAME ${PROJECT_NAME}) ladanyi@679: SET(CPACK_PACKAGE_VENDOR "EGRES") ladanyi@679: SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY ladanyi@679: "LEMON - Library for Efficient Modeling and Optimization in Networks") ladanyi@679: SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE") alpar@225: ladanyi@679: SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) alpar@225: ladanyi@679: SET(CPACK_PACKAGE_INSTALL_DIRECTORY ladanyi@679: "${PROJECT_NAME} ${PROJECT_VERSION}") ladanyi@679: SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY ladanyi@679: "${PROJECT_NAME} ${PROJECT_VERSION}") alpar@225: ladanyi@679: SET(CPACK_COMPONENTS_ALL headers library html_documentation bin) alpar@225: ladanyi@679: SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ headers") ladanyi@679: SET(CPACK_COMPONENT_LIBRARY_DISPLAY_NAME "Dynamic-link library") ladanyi@679: SET(CPACK_COMPONENT_BIN_DISPLAY_NAME "Command line utilities") ladanyi@679: SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DISPLAY_NAME "HTML documentation") alpar@225: ladanyi@679: SET(CPACK_COMPONENT_HEADERS_DESCRIPTION ladanyi@679: "C++ header files") ladanyi@679: SET(CPACK_COMPONENT_LIBRARY_DESCRIPTION ladanyi@679: "DLL and import library") ladanyi@679: SET(CPACK_COMPONENT_BIN_DESCRIPTION ladanyi@679: "Command line utilities") ladanyi@679: SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DESCRIPTION ladanyi@679: "Doxygen generated documentation") alpar@225: ladanyi@679: SET(CPACK_COMPONENT_HEADERS_DEPENDS library) alpar@225: ladanyi@679: SET(CPACK_COMPONENT_HEADERS_GROUP "Development") ladanyi@679: SET(CPACK_COMPONENT_LIBRARY_GROUP "Development") ladanyi@679: SET(CPACK_COMPONENT_HTML_DOCUMENTATION_GROUP "Documentation") alpar@225: ladanyi@679: SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION ladanyi@679: "Components needed to develop software using LEMON") ladanyi@679: SET(CPACK_COMPONENT_GROUP_DOCUMENTATION_DESCRIPTION ladanyi@679: "Documentation of LEMON") alpar@225: ladanyi@679: SET(CPACK_ALL_INSTALL_TYPES Full Developer) alpar@225: ladanyi@679: SET(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full) ladanyi@679: SET(CPACK_COMPONENT_LIBRARY_INSTALL_TYPES Developer Full) ladanyi@679: SET(CPACK_COMPONENT_HTML_DOCUMENTATION_INSTALL_TYPES Full) alpar@225: ladanyi@679: SET(CPACK_GENERATOR "NSIS") ladanyi@679: SET(CPACK_NSIS_MUI_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis/lemon.ico") ladanyi@679: SET(CPACK_NSIS_MUI_UNIICON "${PROJECT_SOURCE_DIR}/cmake/nsis/uninstall.ico") ladanyi@679: #SET(CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis\\\\installer.bmp") ladanyi@679: SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\lemon.ico") ladanyi@679: SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} ${PROJECT_NAME}") ladanyi@679: SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\lemon.cs.elte.hu") ladanyi@679: SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\lemon.cs.elte.hu") ladanyi@679: SET(CPACK_NSIS_CONTACT "lemon-user@lemon.cs.elte.hu") ladanyi@679: SET(CPACK_NSIS_CREATE_ICONS_EXTRA " ladanyi@679: CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Documentation.lnk\\\" \\\"$INSTDIR\\\\share\\\\doc\\\\index.html\\\" ladanyi@679: ") ladanyi@679: SET(CPACK_NSIS_DELETE_ICONS_EXTRA " ladanyi@679: !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP ladanyi@679: Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\Documentation.lnk\\\" ladanyi@679: ") alpar@225: ladanyi@679: INCLUDE(CPack) ladanyi@679: ENDIF()