# HG changeset patch # User Alpar Juttner # Date 2009-06-01 18:49:43 # Node ID f1909b4c38d60b74ba6864fa607e3a5a35ecb175 # Parent 150004315af4c85b225977d888de22d35866492d # Parent 257e91516e09d8d6be58236c587e3e0199770412 Merge several CMAKE related improvements diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,24 +1,39 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -IF(EXISTS ${CMAKE_SOURCE_DIR}/cmake/version.cmake) - INCLUDE(${CMAKE_SOURCE_DIR}/cmake/version.cmake) -ELSE(EXISTS ${CMAKE_SOURCE_DIR}/cmake/version.cmake) - SET(PROJECT_NAME "LEMON") - SET(PROJECT_VERSION "hg-tip" CACHE STRING "LEMON version string.") -ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/cmake/version.cmake) +SET(PROJECT_NAME "LEMON") +PROJECT(${PROJECT_NAME}) -PROJECT(${PROJECT_NAME}) +IF(EXISTS ${PROJECT_SOURCE_DIR}/cmake/version.cmake) + INCLUDE(${PROJECT_SOURCE_DIR}/cmake/version.cmake) +ELSEIF(DEFINED ENV{LEMON_VERSION}) + SET(LEMON_VERSION $ENV{LEMON_VERSION} CACHE STRING "LEMON version string.") +ELSE() + EXECUTE_PROCESS( + COMMAND hg id -i + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + OUTPUT_VARIABLE HG_REVISION + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + IF(HG_REVISION STREQUAL "") + SET(HG_REVISION "hg-tip") + ENDIF() + SET(LEMON_VERSION ${HG_REVISION} CACHE STRING "LEMON version string.") +ENDIF() + +SET(PROJECT_VERSION ${LEMON_VERSION}) SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) -INCLUDE(FindDoxygen) -INCLUDE(FindGhostscript) +FIND_PACKAGE(Doxygen) +FIND_PACKAGE(Ghostscript) FIND_PACKAGE(GLPK 4.33) FIND_PACKAGE(CPLEX) FIND_PACKAGE(COIN) INCLUDE(CheckTypeSize) -CHECK_TYPE_SIZE("long long" LEMON_LONG_LONG) +CHECK_TYPE_SIZE("long long" LONG_LONG) +SET(LEMON_HAVE_LONG_LONG ${HAVE_LONG_LONG}) ENABLE_TESTING() @@ -28,73 +43,88 @@ ADD_SUBDIRECTORY(tools) ADD_SUBDIRECTORY(doc) ADD_SUBDIRECTORY(test) -ENDIF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR}) +ENDIF() -IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR}) - IF(WIN32) - SET(CPACK_PACKAGE_NAME ${PROJECT_NAME}) - SET(CPACK_PACKAGE_VENDOR "EGRES") - SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY - "LEMON - Library for Efficient Modeling and Optimization in Networks") - SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE") +CONFIGURE_FILE( + ${PROJECT_SOURCE_DIR}/cmake/LEMONConfig.cmake.in + ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake + @ONLY +) +IF(UNIX) + INSTALL( + FILES ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake + DESTINATION share/lemon/cmake + ) +ELSEIF(WIN32) + INSTALL( + FILES ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake + DESTINATION cmake + ) +ENDIF() - SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) +IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR} AND WIN32) + SET(CPACK_PACKAGE_NAME ${PROJECT_NAME}) + SET(CPACK_PACKAGE_VENDOR "EGRES") + SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY + "LEMON - Library for Efficient Modeling and Optimization in Networks") + SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE") - SET(CPACK_PACKAGE_INSTALL_DIRECTORY - "${PROJECT_NAME} ${PROJECT_VERSION}") - SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY - "${PROJECT_NAME} ${PROJECT_VERSION}") + SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) - SET(CPACK_COMPONENTS_ALL headers library html_documentation bin) + SET(CPACK_PACKAGE_INSTALL_DIRECTORY + "${PROJECT_NAME} ${PROJECT_VERSION}") + SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY + "${PROJECT_NAME} ${PROJECT_VERSION}") - SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ headers") - SET(CPACK_COMPONENT_LIBRARY_DISPLAY_NAME "Dynamic-link library") - SET(CPACK_COMPONENT_BIN_DISPLAY_NAME "Command line utilities") - SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DISPLAY_NAME "HTML documentation") + SET(CPACK_COMPONENTS_ALL headers library html_documentation bin) - SET(CPACK_COMPONENT_HEADERS_DESCRIPTION - "C++ header files") - SET(CPACK_COMPONENT_LIBRARY_DESCRIPTION - "DLL and import library") - SET(CPACK_COMPONENT_BIN_DESCRIPTION - "Command line utilities") - SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DESCRIPTION - "Doxygen generated documentation") + SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ headers") + SET(CPACK_COMPONENT_LIBRARY_DISPLAY_NAME "Dynamic-link library") + SET(CPACK_COMPONENT_BIN_DISPLAY_NAME "Command line utilities") + SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DISPLAY_NAME "HTML documentation") - SET(CPACK_COMPONENT_HEADERS_DEPENDS library) + SET(CPACK_COMPONENT_HEADERS_DESCRIPTION + "C++ header files") + SET(CPACK_COMPONENT_LIBRARY_DESCRIPTION + "DLL and import library") + SET(CPACK_COMPONENT_BIN_DESCRIPTION + "Command line utilities") + SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DESCRIPTION + "Doxygen generated documentation") - SET(CPACK_COMPONENT_HEADERS_GROUP "Development") - SET(CPACK_COMPONENT_LIBRARY_GROUP "Development") - SET(CPACK_COMPONENT_HTML_DOCUMENTATION_GROUP "Documentation") + SET(CPACK_COMPONENT_HEADERS_DEPENDS library) - SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION - "Components needed to develop software using LEMON") - SET(CPACK_COMPONENT_GROUP_DOCUMENTATION_DESCRIPTION - "Documentation of LEMON") + SET(CPACK_COMPONENT_HEADERS_GROUP "Development") + SET(CPACK_COMPONENT_LIBRARY_GROUP "Development") + SET(CPACK_COMPONENT_HTML_DOCUMENTATION_GROUP "Documentation") - SET(CPACK_ALL_INSTALL_TYPES Full Developer) + SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION + "Components needed to develop software using LEMON") + SET(CPACK_COMPONENT_GROUP_DOCUMENTATION_DESCRIPTION + "Documentation of LEMON") - SET(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full) - SET(CPACK_COMPONENT_LIBRARY_INSTALL_TYPES Developer Full) - SET(CPACK_COMPONENT_HTML_DOCUMENTATION_INSTALL_TYPES Full) + SET(CPACK_ALL_INSTALL_TYPES Full Developer) - SET(CPACK_GENERATOR "NSIS") - SET(CPACK_NSIS_MUI_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis/lemon.ico") - SET(CPACK_NSIS_MUI_UNIICON "${PROJECT_SOURCE_DIR}/cmake/nsis/uninstall.ico") - #SET(CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis\\\\installer.bmp") - SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\lemon.ico") - SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} ${PROJECT_NAME}") - SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\lemon.cs.elte.hu") - SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\lemon.cs.elte.hu") - SET(CPACK_NSIS_CONTACT "lemon-user@lemon.cs.elte.hu") - SET(CPACK_NSIS_CREATE_ICONS_EXTRA " - CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Documentation.lnk\\\" \\\"$INSTDIR\\\\share\\\\doc\\\\index.html\\\" - ") - SET(CPACK_NSIS_DELETE_ICONS_EXTRA " - !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP - Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\Documentation.lnk\\\" - ") + SET(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full) + SET(CPACK_COMPONENT_LIBRARY_INSTALL_TYPES Developer Full) + SET(CPACK_COMPONENT_HTML_DOCUMENTATION_INSTALL_TYPES Full) - INCLUDE(CPack) - ENDIF(WIN32) -ENDIF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR}) + SET(CPACK_GENERATOR "NSIS") + SET(CPACK_NSIS_MUI_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis/lemon.ico") + SET(CPACK_NSIS_MUI_UNIICON "${PROJECT_SOURCE_DIR}/cmake/nsis/uninstall.ico") + #SET(CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis\\\\installer.bmp") + SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\lemon.ico") + SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} ${PROJECT_NAME}") + SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\lemon.cs.elte.hu") + SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\lemon.cs.elte.hu") + SET(CPACK_NSIS_CONTACT "lemon-user@lemon.cs.elte.hu") + SET(CPACK_NSIS_CREATE_ICONS_EXTRA " + CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Documentation.lnk\\\" \\\"$INSTDIR\\\\share\\\\doc\\\\index.html\\\" + ") + SET(CPACK_NSIS_DELETE_ICONS_EXTRA " + !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP + Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\Documentation.lnk\\\" + ") + + INCLUDE(CPack) +ENDIF() diff --git a/cmake/LEMONConfig.cmake.in b/cmake/LEMONConfig.cmake.in new file mode 100644 --- /dev/null +++ b/cmake/LEMONConfig.cmake.in @@ -0,0 +1,13 @@ +SET(LEMON_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/include" CACHE PATH "LEMON include directory") +SET(LEMON_INCLUDE_DIRS "${LEMON_INCLUDE_DIR}") + +IF(UNIX) + SET(LEMON_LIB_NAME "libemon.a") +ELSEIF(WIN32) + SET(LEMON_LIB_NAME "lemon.lib") +ENDIF(UNIX) + +SET(LEMON_LIBRARY "@CMAKE_INSTALL_PREFIX@/lib/${LEMON_LIB_NAME}" CACHE FILEPATH "LEMON library") +SET(LEMON_LIBRARIES "${LEMON_LIBRARY}") + +MARK_AS_ADVANCED(LEMON_LIBRARY LEMON_INCLUDE_DIR) diff --git a/cmake/version.cmake.in b/cmake/version.cmake.in --- a/cmake/version.cmake.in +++ b/cmake/version.cmake.in @@ -1,2 +1,1 @@ -SET(PROJECT_NAME "@PACKAGE_NAME@") -SET(PROJECT_VERSION "@PACKAGE_VERSION@" CACHE STRING "LEMON version string.") +SET(LEMON_VERSION "@PACKAGE_VERSION@" CACHE STRING "LEMON version string.") diff --git a/configure.ac b/configure.ac --- a/configure.ac +++ b/configure.ac @@ -2,14 +2,17 @@ dnl Version information. m4_define([lemon_version_number], - [m4_normalize(esyscmd([echo ${LEMON_VERSION}]))]) + [m4_normalize(esyscmd([echo ${LEMON_VERSION}]))]) dnl m4_define([lemon_version_number], []) m4_define([lemon_hg_path], [m4_normalize(esyscmd([./scripts/chg-len.py]))]) -m4_define([lemon_hg_revision], [m4_normalize(esyscmd([hg id -i]))]) +m4_define([lemon_hg_revision], [m4_normalize(esyscmd([hg id -i 2> /dev/null]))]) m4_define([lemon_version], [ifelse(lemon_version_number(), - [], - [lemon_hg_path().lemon_hg_revision()], - [lemon_version_number()])]) + [], + [ifelse(lemon_hg_revision(), + [], + [hg-tip], + [lemon_hg_path().lemon_hg_revision()])], + [lemon_version_number()])]) AC_PREREQ([2.59]) AC_INIT([LEMON], [lemon_version()], [lemon-user@lemon.cs.elte.hu], [lemon]) @@ -19,6 +22,8 @@ AC_CONFIG_SRCDIR([lemon/list_graph.h]) AC_CONFIG_HEADERS([config.h lemon/config.h]) +AC_DEFINE([LEMON_VERSION], [lemon_version()], [The version string]) + dnl Do compilation tests using the C++ compiler. AC_LANG([C++]) diff --git a/demo/CMakeLists.txt b/demo/CMakeLists.txt --- a/demo/CMakeLists.txt +++ b/demo/CMakeLists.txt @@ -3,14 +3,17 @@ ${PROJECT_BINARY_DIR} ) -LINK_DIRECTORIES(${PROJECT_BINARY_DIR}/lemon) +LINK_DIRECTORIES( + ${PROJECT_BINARY_DIR}/lemon +) SET(DEMOS arg_parser_demo graph_to_eps_demo - lgf_demo) + lgf_demo +) FOREACH(DEMO_NAME ${DEMOS}) ADD_EXECUTABLE(${DEMO_NAME} ${DEMO_NAME}.cc) TARGET_LINK_LIBRARIES(${DEMO_NAME} lemon) -ENDFOREACH(DEMO_NAME) +ENDFOREACH() diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -6,51 +6,46 @@ CONFIGURE_FILE( ${PROJECT_SOURCE_DIR}/doc/Doxyfile.in ${PROJECT_BINARY_DIR}/doc/Doxyfile - @ONLY) + @ONLY +) IF(DOXYGEN_EXECUTABLE AND GHOSTSCRIPT_EXECUTABLE) FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/) + SET(GHOSTSCRIPT_OPTIONS -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha) + ADD_CUSTOM_TARGET(html + COMMAND ${CMAKE_COMMAND} -E remove_directory gen-images + COMMAND ${CMAKE_COMMAND} -E make_directory gen-images + COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r18 -sOutputFile=gen-images/bipartite_matching.png ${CMAKE_CURRENT_SOURCE_DIR}/images/bipartite_matching.eps + COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r18 -sOutputFile=gen-images/bipartite_partitions.png ${CMAKE_CURRENT_SOURCE_DIR}/images/bipartite_partitions.eps + COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r18 -sOutputFile=gen-images/connected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/connected_components.eps + COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r18 -sOutputFile=gen-images/edge_biconnected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/edge_biconnected_components.eps + COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r18 -sOutputFile=gen-images/grid_graph.png ${CMAKE_CURRENT_SOURCE_DIR}/images/grid_graph.eps + COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r18 -sOutputFile=gen-images/node_biconnected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/node_biconnected_components.eps + COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r18 -sOutputFile=gen-images/nodeshape_0.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_0.eps + COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r18 -sOutputFile=gen-images/nodeshape_1.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_1.eps + COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r18 -sOutputFile=gen-images/nodeshape_2.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_2.eps + COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r18 -sOutputFile=gen-images/nodeshape_3.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_3.eps + COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r18 -sOutputFile=gen-images/nodeshape_4.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_4.eps + COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r18 -sOutputFile=gen-images/strongly_connected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/strongly_connected_components.eps + COMMAND ${CMAKE_COMMAND} -E remove_directory html + COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) + + SET_TARGET_PROPERTIES(html PROPERTIES PROJECT_LABEL BUILD_DOC) + IF(UNIX) - ADD_CUSTOM_TARGET(html - COMMAND rm -rf gen-images - COMMAND mkdir gen-images - COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/bipartite_matching.png ${CMAKE_CURRENT_SOURCE_DIR}/images/bipartite_matching.eps - COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/bipartite_partitions.png ${CMAKE_CURRENT_SOURCE_DIR}/images/bipartite_partitions.eps - COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/connected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/connected_components.eps - COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/edge_biconnected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/edge_biconnected_components.eps - COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/grid_graph.png ${CMAKE_CURRENT_SOURCE_DIR}/images/grid_graph.eps - COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/node_biconnected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/node_biconnected_components.eps - COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_0.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_0.eps - COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_1.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_1.eps - COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_2.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_2.eps - COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_3.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_3.eps - COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_4.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_4.eps - COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/strongly_connected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/strongly_connected_components.eps - COMMAND rm -rf html - COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + INSTALL( + DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/ + DESTINATION share/doc/lemon/html + COMPONENT html_documentation + ) ELSEIF(WIN32) - ADD_CUSTOM_TARGET(html - COMMAND if exist gen-images rmdir /s /q gen-images - COMMAND mkdir gen-images - COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/bipartite_matching.png ${CMAKE_CURRENT_SOURCE_DIR}/images/bipartite_matching.eps - COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/bipartite_partitions.png ${CMAKE_CURRENT_SOURCE_DIR}/images/bipartite_partitions.eps - COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/connected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/connected_components.eps - COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/edge_biconnected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/edge_biconnected_components.eps - COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/grid_graph.png ${CMAKE_CURRENT_SOURCE_DIR}/images/grid_graph.eps - COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/node_biconnected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/node_biconnected_components.eps - COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_0.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_0.eps - COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_1.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_1.eps - COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_2.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_2.eps - COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_3.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_3.eps - COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_4.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_4.eps - COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/strongly_connected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/strongly_connected_components.eps - COMMAND if exist html rmdir /s /q html - COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - ENDIF(UNIX) - INSTALL( - DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/ - DESTINATION share/doc - COMPONENT html_documentation) -ENDIF(DOXYGEN_EXECUTABLE AND GHOSTSCRIPT_EXECUTABLE) + INSTALL( + DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/ + DESTINATION doc + COMPONENT html_documentation + ) + ENDIF() + +ENDIF() diff --git a/doc/Makefile.am b/doc/Makefile.am --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -91,19 +91,19 @@ install-html-local: doc/html @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(htmldir)/docs + $(mkinstalldirs) $(DESTDIR)$(htmldir)/html for p in doc/html/*.{html,css,png,map,gif,tag} ; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(INSTALL_DATA) $$p $(DESTDIR)$(htmldir)/docs/$$f"; \ - $(INSTALL_DATA) $$p $(DESTDIR)$(htmldir)/docs/$$f; \ + echo " $(INSTALL_DATA) $$p $(DESTDIR)$(htmldir)/html/$$f"; \ + $(INSTALL_DATA) $$p $(DESTDIR)$(htmldir)/html/$$f; \ done uninstall-local: @$(NORMAL_UNINSTALL) for p in doc/html/*.{html,css,png,map,gif,tag} ; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " rm -f $(DESTDIR)$(htmldir)/docs/$$f"; \ - rm -f $(DESTDIR)$(htmldir)/docs/$$f; \ + echo " rm -f $(DESTDIR)$(htmldir)/html/$$f"; \ + rm -f $(DESTDIR)$(htmldir)/html/$$f; \ done .PHONY: update-external-tags diff --git a/lemon/CMakeLists.txt b/lemon/CMakeLists.txt --- a/lemon/CMakeLists.txt +++ b/lemon/CMakeLists.txt @@ -25,38 +25,44 @@ INSTALL(FILES ${GLPK_BIN_DIR}/glpk.dll DESTINATION bin) INSTALL(FILES ${GLPK_BIN_DIR}/libltdl3.dll DESTINATION bin) INSTALL(FILES ${GLPK_BIN_DIR}/zlib1.dll DESTINATION bin) - ENDIF(WIN32) -ENDIF(LEMON_HAVE_GLPK) + ENDIF() +ENDIF() IF(LEMON_HAVE_CPLEX) SET(LEMON_SOURCES ${LEMON_SOURCES} cplex.cc) INCLUDE_DIRECTORIES(${CPLEX_INCLUDE_DIRS}) -ENDIF(LEMON_HAVE_CPLEX) +ENDIF() IF(LEMON_HAVE_CLP) SET(LEMON_SOURCES ${LEMON_SOURCES} clp.cc) INCLUDE_DIRECTORIES(${COIN_INCLUDE_DIRS}) -ENDIF(LEMON_HAVE_CLP) +ENDIF() IF(LEMON_HAVE_CBC) SET(LEMON_SOURCES ${LEMON_SOURCES} cbc.cc) INCLUDE_DIRECTORIES(${COIN_INCLUDE_DIRS}) -ENDIF(LEMON_HAVE_CBC) +ENDIF() ADD_LIBRARY(lemon ${LEMON_SOURCES}) +IF(UNIX) + SET_TARGET_PROPERTIES(lemon PROPERTIES OUTPUT_NAME emon) +ENDIF() INSTALL( TARGETS lemon ARCHIVE DESTINATION lib - COMPONENT library) + COMPONENT library +) INSTALL( DIRECTORY . bits concepts DESTINATION include/lemon COMPONENT headers - FILES_MATCHING PATTERN "*.h") + FILES_MATCHING PATTERN "*.h" +) INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/config.h DESTINATION include/lemon - COMPONENT headers) + COMPONENT headers +) diff --git a/lemon/config.h.cmake b/lemon/config.h.cmake --- a/lemon/config.h.cmake +++ b/lemon/config.h.cmake @@ -1,3 +1,4 @@ +#define LEMON_VERSION "@PROJECT_VERSION@" #cmakedefine LEMON_HAVE_LONG_LONG 1 #cmakedefine LEMON_HAVE_LP 1 #cmakedefine LEMON_HAVE_MIP 1 diff --git a/lemon/config.h.in b/lemon/config.h.in --- a/lemon/config.h.in +++ b/lemon/config.h.in @@ -1,3 +1,6 @@ +/* The version string */ +#undef LEMON_VERSION + /* Define to 1 if you have long long */ #undef LEMON_HAVE_LONG_LONG diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -3,7 +3,9 @@ ${PROJECT_BINARY_DIR} ) -LINK_DIRECTORIES(${PROJECT_BINARY_DIR}/lemon) +LINK_DIRECTORIES( + ${PROJECT_BINARY_DIR}/lemon +) SET(TESTS adaptors_test @@ -35,20 +37,23 @@ random_test suurballe_test time_measure_test - unionfind_test) + unionfind_test +) IF(LEMON_HAVE_LP) ADD_EXECUTABLE(lp_test lp_test.cc) SET(LP_TEST_LIBS lemon) + IF(LEMON_HAVE_GLPK) SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES}) - ENDIF(LEMON_HAVE_GLPK) + ENDIF() IF(LEMON_HAVE_CPLEX) SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES}) - ENDIF(LEMON_HAVE_CPLEX) + ENDIF() IF(LEMON_HAVE_CLP) SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES}) - ENDIF(LEMON_HAVE_CLP) + ENDIF() + TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS}) ADD_TEST(lp_test lp_test) @@ -56,32 +61,35 @@ GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION) GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH) ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD - COMMAND cmake -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH} - COMMAND cmake -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH} - COMMAND cmake -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH} ) - ENDIF(WIN32 AND LEMON_HAVE_GLPK) + ENDIF() + IF(WIN32 AND LEMON_HAVE_CPLEX) GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION) GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH) ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD - COMMAND cmake -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH} ) - ENDIF(WIN32 AND LEMON_HAVE_CPLEX) -ENDIF(LEMON_HAVE_LP) + ENDIF() +ENDIF() IF(LEMON_HAVE_MIP) ADD_EXECUTABLE(mip_test mip_test.cc) SET(MIP_TEST_LIBS lemon) + IF(LEMON_HAVE_GLPK) SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES}) - ENDIF(LEMON_HAVE_GLPK) + ENDIF() IF(LEMON_HAVE_CPLEX) SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES}) - ENDIF(LEMON_HAVE_CPLEX) + ENDIF() IF(LEMON_HAVE_CBC) SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES}) - ENDIF(LEMON_HAVE_CBC) + ENDIF() + TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS}) ADD_TEST(mip_test mip_test) @@ -89,22 +97,23 @@ GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION) GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH) ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD - COMMAND cmake -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH} - COMMAND cmake -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH} - COMMAND cmake -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH} ) - ENDIF(WIN32 AND LEMON_HAVE_GLPK) + ENDIF() + IF(WIN32 AND LEMON_HAVE_CPLEX) GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION) GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH) ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD - COMMAND cmake -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH} ) - ENDIF(WIN32 AND LEMON_HAVE_CPLEX) -ENDIF(LEMON_HAVE_MIP) + ENDIF() +ENDIF() FOREACH(TEST_NAME ${TESTS}) ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc) TARGET_LINK_LIBRARIES(${TEST_NAME} lemon) ADD_TEST(${TEST_NAME} ${TEST_NAME}) -ENDFOREACH(TEST_NAME) +ENDFOREACH() diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -3,7 +3,9 @@ ${PROJECT_BINARY_DIR} ) -LINK_DIRECTORIES(${PROJECT_BINARY_DIR}/lemon) +LINK_DIRECTORIES( + ${PROJECT_BINARY_DIR}/lemon +) ADD_EXECUTABLE(lgf-gen lgf-gen.cc) TARGET_LINK_LIBRARIES(lgf-gen lemon) @@ -24,5 +26,6 @@ INSTALL( PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/lemon-0.x-to-1.x.sh DESTINATION bin - COMPONENT bin) -ENDIF(NOT WIN32) + COMPONENT bin + ) +ENDIF() diff --git a/tools/Makefile.am b/tools/Makefile.am --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -1,3 +1,6 @@ +EXTRA_DIST += \ + tools/CMakeLists.txt + if WANT_TOOLS bin_PROGRAMS += \