CMake improvements.
- documentation generation with Doxygen
- installation support
1.1 --- a/CMakeLists.txt Fri Jul 18 16:36:57 2008 +0100
1.2 +++ b/CMakeLists.txt Fri Jul 18 16:36:58 2008 +0100
1.3 @@ -1,5 +1,101 @@
1.4 -project (LEMON)
1.5 -enable_testing ()
1.6 -add_subdirectory (lemon)
1.7 -add_subdirectory (demo)
1.8 -add_subdirectory (test)
1.9 +CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
1.10 +
1.11 +#EXECUTE_PROCESS(
1.12 +# COMMAND hg id -i
1.13 +# OUTPUT_VARIABLE HG_REVISION
1.14 +# OUTPUT_STRIP_TRAILING_WHITESPACE)
1.15 +
1.16 +SET(PROJECT_NAME "Lemon")
1.17 +SET(PROJECT_VERSION_MAJOR "0")
1.18 +SET(PROJECT_VERSION_MINOR "99")
1.19 +SET(PROJECT_VERSION_PATCH "0")
1.20 +SET(PROJECT_VERSION
1.21 + "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
1.22 +
1.23 +PROJECT(${PROJECT_NAME})
1.24 +
1.25 +SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
1.26 +
1.27 +INCLUDE(FindDoxygen)
1.28 +INCLUDE(FindGhostscript)
1.29 +
1.30 +ENABLE_TESTING()
1.31 +
1.32 +ADD_SUBDIRECTORY(lemon)
1.33 +ADD_SUBDIRECTORY(demo)
1.34 +ADD_SUBDIRECTORY(doc)
1.35 +ADD_SUBDIRECTORY(test)
1.36 +
1.37 +IF(WIN32)
1.38 + INSTALL(FILES ${CMAKE_SOURCE_DIR}/cmake/nsis/lemon.ico
1.39 + DESTINATION bin)
1.40 +ENDIF(WIN32)
1.41 +
1.42 +IF(WIN32)
1.43 + SET(CPACK_PACKAGE_NAME ${PROJECT_NAME})
1.44 + SET(CPACK_PACKAGE_VENDOR
1.45 + "EGRES - Egervary Research Group on Combinatorial Optimization")
1.46 + SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY
1.47 + "Lemon - Library of Efficient Models and Optimization in Networks")
1.48 + SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
1.49 +
1.50 + SET(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
1.51 + SET(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
1.52 + SET(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
1.53 + SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
1.54 +
1.55 + SET(CPACK_PACKAGE_INSTALL_DIRECTORY
1.56 + "${PROJECT_NAME} ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
1.57 + SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY
1.58 + "${PROJECT_NAME} ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
1.59 +
1.60 + # Variables to generate a component-based installer.
1.61 + #SET(CPACK_COMPONENTS_ALL headers library html_documentation)
1.62 +
1.63 + #SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ headers")
1.64 + #SET(CPACK_COMPONENT_LIBRARY_DISPLAY_NAME "Static library")
1.65 + #SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DISPLAY_NAME "HTML documentation")
1.66 +
1.67 + #SET(CPACK_COMPONENT_HEADERS_DESCRIPTION
1.68 + # "C++ header files for use with the Lemon library")
1.69 + #SET(CPACK_COMPONENT_LIBRARY_DESCRIPTION
1.70 + # "Static library used to build programs with Lemon")
1.71 + #SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DESCRIPTION
1.72 + # "Doxygen generated documentation")
1.73 +
1.74 + #SET(CPACK_COMPONENT_HEADERS_DEPENDS library)
1.75 +
1.76 + #SET(CPACK_COMPONENT_HEADERS_GROUP "Development")
1.77 + #SET(CPACK_COMPONENT_LIBRARY_GROUP "Development")
1.78 + #SET(CPACK_COMPONENT_HTML_DOCUMENTATION_GROUP "Documentation")
1.79 +
1.80 + #SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION
1.81 + # "Components needed to develop software using Lemon")
1.82 + #SET(CPACK_COMPONENT_GROUP_DOCUMENTATION_DESCRIPTION
1.83 + # "Documentation of Lemon")
1.84 +
1.85 + #SET(CPACK_ALL_INSTALL_TYPES Full Developer)
1.86 +
1.87 + #SET(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full)
1.88 + #SET(CPACK_COMPONENT_LIBRARY_INSTALL_TYPES Developer Full)
1.89 + #SET(CPACK_COMPONENT_HTML_DOCUMENTATION_INSTALL_TYPES Full)
1.90 +
1.91 + SET(CPACK_GENERATOR "NSIS")
1.92 + SET(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/cmake/nsis/lemon.ico")
1.93 + SET(CPACK_NSIS_MUI_UNIICON "${CMAKE_SOURCE_DIR}/cmake/nsis/uninstall.ico")
1.94 + #SET(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/cmake/nsis\\\\installer.bmp")
1.95 + SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\lemon.ico")
1.96 + SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} ${PROJECT_NAME}")
1.97 + SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\lemon.cs.elte.hu")
1.98 + SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\lemon.cs.elte.hu")
1.99 + SET(CPACK_NSIS_CONTACT "lemon-user@lemon.cs.elte.hu")
1.100 + SET(CPACK_NSIS_CREATE_ICONS_EXTRA "
1.101 + CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Documentation.lnk\\\" \\\"$INSTDIR\\\\doc\\\\index.html\\\"
1.102 + ")
1.103 + SET(CPACK_NSIS_DELETE_ICONS_EXTRA "
1.104 + !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
1.105 + Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\Documentation.lnk\\\"
1.106 + ")
1.107 +
1.108 + INCLUDE(CPack)
1.109 +ENDIF(WIN32)
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/cmake/FindGhostscript.cmake Fri Jul 18 16:36:58 2008 +0100
2.3 @@ -0,0 +1,10 @@
2.4 +INCLUDE(FindPackageHandleStandardArgs)
2.5 +
2.6 +FIND_PROGRAM(GHOSTSCRIPT_EXECUTABLE
2.7 + NAMES gs gswin32c
2.8 + PATHS "$ENV{ProgramFiles}/gs"
2.9 + PATH_SUFFIXES gs8.61/bin gs8.62/bin
2.10 + DOC "Ghostscript: PostScript and PDF language interpreter and previewer."
2.11 +)
2.12 +
2.13 +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Ghostscript DEFAULT_MSG GHOSTSCRIPT_EXECUTABLE)
3.1 Binary file cmake/nsis/lemon.ico has changed
4.1 Binary file cmake/nsis/uninstall.ico has changed
5.1 --- a/configure.ac Fri Jul 18 16:36:57 2008 +0100
5.2 +++ b/configure.ac Fri Jul 18 16:36:58 2008 +0100
5.3 @@ -6,7 +6,7 @@
5.4 m4_define([lemon_version], [ifelse(lemon_version_number(), [], [lemon_hg_revision()], [lemon_version_number()])])
5.5
5.6 AC_PREREQ([2.59])
5.7 -AC_INIT([LEMON], [lemon_version()], [lemon-devel@lemon.cs.elte.hu], [lemon])
5.8 +AC_INIT([Lemon], [lemon_version()], [lemon-user@lemon.cs.elte.hu], [lemon])
5.9 AC_CONFIG_AUX_DIR([build-aux])
5.10 AC_CONFIG_MACRO_DIR([m4])
5.11 AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects nostdinc])
5.12 @@ -25,6 +25,7 @@
5.13 AC_CHECK_PROG([doxygen_found],[doxygen],[yes],[no])
5.14 AC_CHECK_PROG([gs_found],[gs],[yes],[no])
5.15
5.16 +dnl Set custom compiler flags when using g++.
5.17 if test x"$lx_cmdline_cxxflags_set" != x"set" -a "$GXX" = yes; then
5.18 CXXFLAGS="$CXXFLAGS -Wall -W -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 -Woverloaded-virtual -ansi -fno-strict-aliasing -Wold-style-cast -Wno-unknown-pragmas"
5.19 fi
5.20 @@ -34,7 +35,7 @@
5.21 LX_CHECK_CPLEX
5.22 LX_CHECK_SOPLEX
5.23
5.24 -dnl Disable/enable building the demo programs
5.25 +dnl Disable/enable building the demo programs.
5.26 AC_ARG_ENABLE([demo],
5.27 AS_HELP_STRING([--enable-demo], [build the demo programs])
5.28 AS_HELP_STRING([--disable-demo], [do not build the demo programs @<:@default@:>@]),
5.29 @@ -47,7 +48,7 @@
5.30 fi
5.31 AM_CONDITIONAL([WANT_DEMO], [test x"$enable_demo" != x"no"])
5.32
5.33 -dnl Disable/enable building the binary tools
5.34 +dnl Disable/enable building the binary tools.
5.35 AC_ARG_ENABLE([tools],
5.36 AS_HELP_STRING([--enable-tools], [build additional tools @<:@default@:>@])
5.37 AS_HELP_STRING([--disable-tools], [do not build additional tools]),
5.38 @@ -60,7 +61,7 @@
5.39 fi
5.40 AM_CONDITIONAL([WANT_TOOLS], [test x"$enable_tools" != x"no"])
5.41
5.42 -dnl Disable/enable building the benchmarks
5.43 +dnl Disable/enable building the benchmarks.
5.44 AC_ARG_ENABLE([benchmark],
5.45 AS_HELP_STRING([--enable-benchmark], [build the benchmarks])
5.46 AS_HELP_STRING([--disable-benchmark], [do not build the benchmarks @<:@default@:>@]),
6.1 --- a/demo/CMakeLists.txt Fri Jul 18 16:36:57 2008 +0100
6.2 +++ b/demo/CMakeLists.txt Fri Jul 18 16:36:58 2008 +0100
6.3 @@ -1,13 +1,13 @@
6.4 -include_directories (${LEMON_SOURCE_DIR})
6.5 +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR})
6.6
6.7 -link_directories (${LEMON_BINARY_DIR}/lemon)
6.8 +LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/lemon)
6.9
6.10 -set (DEMOS
6.11 +SET(DEMOS
6.12 arg_parser_demo
6.13 graph_to_eps_demo
6.14 lgf_demo)
6.15
6.16 -foreach (DEMO_NAME ${DEMOS})
6.17 - add_executable (${DEMO_NAME} ${DEMO_NAME}.cc)
6.18 - target_link_libraries (${DEMO_NAME} lemon)
6.19 - endforeach (DEMO_NAME)
6.20 +FOREACH(DEMO_NAME ${DEMOS})
6.21 + ADD_EXECUTABLE(${DEMO_NAME} ${DEMO_NAME}.cc)
6.22 + TARGET_LINK_LIBRARIES(${DEMO_NAME} lemon)
6.23 +ENDFOREACH(DEMO_NAME)
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/doc/CMakeLists.txt Fri Jul 18 16:36:58 2008 +0100
7.3 @@ -0,0 +1,42 @@
7.4 +SET(PACKAGE_NAME ${PROJECT_NAME})
7.5 +SET(PACKAGE_VERSION ${PROJECT_VERSION})
7.6 +SET(abs_top_srcdir ${CMAKE_SOURCE_DIR})
7.7 +SET(abs_top_builddir ${CMAKE_BINARY_DIR})
7.8 +
7.9 +CONFIGURE_FILE(
7.10 + ${CMAKE_SOURCE_DIR}/doc/Doxyfile.in
7.11 + ${CMAKE_BINARY_DIR}/doc/Doxyfile
7.12 + @ONLY)
7.13 +
7.14 +IF(DOXYGEN_EXECUTABLE AND GHOSTSCRIPT_EXECUTABLE)
7.15 + IF(UNIX)
7.16 + ADD_CUSTOM_TARGET(html
7.17 + COMMAND rm -rf gen-images
7.18 + COMMAND mkdir gen-images
7.19 + 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
7.20 + 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
7.21 + 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
7.22 + 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
7.23 + 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
7.24 + COMMAND rm -rf html
7.25 + COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile
7.26 + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
7.27 + ELSEIF(WIN32)
7.28 + ADD_CUSTOM_TARGET(html
7.29 + COMMAND if exist gen-images rmdir /s /q gen-images
7.30 + COMMAND mkdir gen-images
7.31 + 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
7.32 + 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
7.33 + 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
7.34 + 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
7.35 + 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
7.36 + COMMAND if exist html rmdir /s /q html
7.37 + COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile
7.38 + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
7.39 + ENDIF(UNIX)
7.40 +ENDIF(DOXYGEN_EXECUTABLE AND GHOSTSCRIPT_EXECUTABLE)
7.41 +
7.42 +INSTALL(
7.43 + DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/
7.44 + DESTINATION doc
7.45 + COMPONENT html_documentation)
8.1 --- a/lemon/CMakeLists.txt Fri Jul 18 16:36:57 2008 +0100
8.2 +++ b/lemon/CMakeLists.txt Fri Jul 18 16:36:58 2008 +0100
8.3 @@ -1,2 +1,18 @@
8.4 -include_directories (${LEMON_SOURCE_DIR})
8.5 -add_library (lemon arg_parser.cc base.cc color.cc random.cc)
8.6 +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR})
8.7 +
8.8 +ADD_LIBRARY(lemon
8.9 + arg_parser.cc
8.10 + base.cc
8.11 + color.cc
8.12 + random.cc)
8.13 +
8.14 +INSTALL(
8.15 + TARGETS lemon
8.16 + ARCHIVE DESTINATION lib
8.17 + COMPONENT library)
8.18 +
8.19 +INSTALL(
8.20 + DIRECTORY . bits concepts
8.21 + DESTINATION include/lemon
8.22 + COMPONENT headers
8.23 + FILES_MATCHING PATTERN "*.h")
9.1 --- a/test/CMakeLists.txt Fri Jul 18 16:36:57 2008 +0100
9.2 +++ b/test/CMakeLists.txt Fri Jul 18 16:36:58 2008 +0100
9.3 @@ -1,8 +1,8 @@
9.4 -include_directories (${LEMON_SOURCE_DIR})
9.5 +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR})
9.6
9.7 -link_directories (${LEMON_BINARY_DIR}/lemon)
9.8 +LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/lemon)
9.9
9.10 -set (TESTS
9.11 +SET(TESTS
9.12 bfs_test
9.13 counter_test
9.14 dfs_test
9.15 @@ -16,13 +16,13 @@
9.16 heap_test
9.17 kruskal_test
9.18 maps_test
9.19 + random_test
9.20 path_test
9.21 - random_test
9.22 time_measure_test
9.23 unionfind_test)
9.24
9.25 -foreach (TEST_NAME ${TESTS})
9.26 - add_executable (${TEST_NAME} ${TEST_NAME}.cc)
9.27 - target_link_libraries (${TEST_NAME} lemon)
9.28 - add_test(${TEST_NAME} ${TEST_NAME})
9.29 -endforeach (TEST_NAME)
9.30 +FOREACH(TEST_NAME ${TESTS})
9.31 + ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
9.32 + TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
9.33 + ADD_TEST(${TEST_NAME} ${TEST_NAME})
9.34 +ENDFOREACH(TEST_NAME)