0
12
0
1 | 1 |
CMAKE_MINIMUM_REQUIRED(VERSION 2.6) |
2 | 2 |
|
3 | 3 |
IF(EXISTS ${CMAKE_SOURCE_DIR}/cmake/version.cmake) |
4 | 4 |
INCLUDE(${CMAKE_SOURCE_DIR}/cmake/version.cmake) |
5 | 5 |
ELSE(EXISTS ${CMAKE_SOURCE_DIR}/cmake/version.cmake) |
6 | 6 |
SET(PROJECT_NAME "LEMON") |
7 | 7 |
SET(PROJECT_VERSION "hg-tip" CACHE STRING "LEMON version string.") |
8 | 8 |
ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/cmake/version.cmake) |
9 | 9 |
|
10 | 10 |
PROJECT(${PROJECT_NAME}) |
11 | 11 |
|
12 | 12 |
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) |
13 | 13 |
|
14 | 14 |
IF(MSVC) |
15 | 15 |
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4250 /wd4355 /wd4800 /wd4996") |
16 | 16 |
# Suppressed warnings: |
17 | 17 |
# C4250: 'class1' : inherits 'class2::member' via dominance |
18 | 18 |
# C4355: 'this' : used in base member initializer list |
19 | 19 |
# C4800: 'type' : forcing value to bool 'true' or 'false' (performance warning) |
20 | 20 |
# C4996: 'function': was declared deprecated |
21 | 21 |
ENDIF(MSVC) |
22 | 22 |
|
23 | 23 |
INCLUDE(FindDoxygen) |
24 | 24 |
INCLUDE(FindGhostscript) |
25 | 25 |
|
26 |
ADD_DEFINITIONS(-DHAVE_CONFIG_H) |
|
27 |
|
|
26 | 28 |
INCLUDE(CheckTypeSize) |
27 |
CHECK_TYPE_SIZE("long long" |
|
29 |
CHECK_TYPE_SIZE("long long" LEMON_LONG_LONG) |
|
28 | 30 |
|
29 | 31 |
ENABLE_TESTING() |
30 | 32 |
|
31 | 33 |
ADD_SUBDIRECTORY(lemon) |
32 | 34 |
ADD_SUBDIRECTORY(demo) |
33 | 35 |
ADD_SUBDIRECTORY(doc) |
34 | 36 |
ADD_SUBDIRECTORY(test) |
35 | 37 |
|
36 | 38 |
IF(WIN32) |
37 | 39 |
SET(CPACK_PACKAGE_NAME ${PROJECT_NAME}) |
38 | 40 |
SET(CPACK_PACKAGE_VENDOR "EGRES") |
39 | 41 |
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY |
40 | 42 |
"LEMON - Library of Efficient Models and Optimization in Networks") |
41 | 43 |
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE") |
42 | 44 |
|
43 | 45 |
SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) |
44 | 46 |
|
45 | 47 |
SET(CPACK_PACKAGE_INSTALL_DIRECTORY |
46 | 48 |
"${PROJECT_NAME} ${PROJECT_VERSION}") |
47 | 49 |
SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY |
48 | 50 |
"${PROJECT_NAME} ${PROJECT_VERSION}") |
49 | 51 |
|
50 | 52 |
SET(CPACK_COMPONENTS_ALL headers library html_documentation) |
51 | 53 |
|
52 | 54 |
SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ headers") |
53 | 55 |
SET(CPACK_COMPONENT_LIBRARY_DISPLAY_NAME "Dynamic-link library") |
54 | 56 |
SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DISPLAY_NAME "HTML documentation") |
55 | 57 |
|
56 | 58 |
SET(CPACK_COMPONENT_HEADERS_DESCRIPTION |
57 | 59 |
"C++ header files") |
58 | 60 |
SET(CPACK_COMPONENT_LIBRARY_DESCRIPTION |
59 | 61 |
"DLL and import library") |
60 | 62 |
SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DESCRIPTION |
61 | 63 |
"Doxygen generated documentation") |
62 | 64 |
|
63 | 65 |
SET(CPACK_COMPONENT_HEADERS_DEPENDS library) |
64 | 66 |
|
65 | 67 |
SET(CPACK_COMPONENT_HEADERS_GROUP "Development") |
66 | 68 |
SET(CPACK_COMPONENT_LIBRARY_GROUP "Development") |
67 | 69 |
SET(CPACK_COMPONENT_HTML_DOCUMENTATION_GROUP "Documentation") |
68 | 70 |
|
69 | 71 |
SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION |
70 | 72 |
"Components needed to develop software using LEMON") |
71 | 73 |
SET(CPACK_COMPONENT_GROUP_DOCUMENTATION_DESCRIPTION |
72 | 74 |
"Documentation of LEMON") |
73 | 75 |
|
74 | 76 |
SET(CPACK_ALL_INSTALL_TYPES Full Developer) |
75 | 77 |
|
76 | 78 |
SET(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full) |
77 | 79 |
SET(CPACK_COMPONENT_LIBRARY_INSTALL_TYPES Developer Full) |
78 | 80 |
SET(CPACK_COMPONENT_HTML_DOCUMENTATION_INSTALL_TYPES Full) |
79 | 81 |
|
80 | 82 |
SET(CPACK_GENERATOR "NSIS") |
81 | 83 |
SET(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/cmake/nsis/lemon.ico") |
82 | 84 |
SET(CPACK_NSIS_MUI_UNIICON "${CMAKE_SOURCE_DIR}/cmake/nsis/uninstall.ico") |
83 | 85 |
#SET(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/cmake/nsis\\\\installer.bmp") |
84 | 86 |
SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\lemon.ico") |
85 | 87 |
SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} ${PROJECT_NAME}") |
86 | 88 |
SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\lemon.cs.elte.hu") |
87 | 89 |
SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\lemon.cs.elte.hu") |
88 | 90 |
SET(CPACK_NSIS_CONTACT "lemon-user@lemon.cs.elte.hu") |
89 | 91 |
SET(CPACK_NSIS_CREATE_ICONS_EXTRA " |
90 | 92 |
CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Documentation.lnk\\\" \\\"$INSTDIR\\\\share\\\\doc\\\\index.html\\\" |
91 | 93 |
") |
92 | 94 |
SET(CPACK_NSIS_DELETE_ICONS_EXTRA " |
93 | 95 |
!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP |
94 | 96 |
Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\Documentation.lnk\\\" |
95 | 97 |
") |
96 | 98 |
|
97 | 99 |
INCLUDE(CPack) |
98 | 100 |
ENDIF(WIN32) |
1 | 1 |
dnl Process this file with autoconf to produce a configure script. |
2 | 2 |
|
3 | 3 |
dnl Version information. |
4 | 4 |
m4_define([lemon_version_number], |
5 | 5 |
[m4_normalize(esyscmd([echo ${LEMON_VERSION}]))]) |
6 | 6 |
dnl m4_define([lemon_version_number], []) |
7 | 7 |
m4_define([lemon_hg_path], [m4_normalize(esyscmd([./scripts/chg-len.py]))]) |
8 | 8 |
m4_define([lemon_hg_revision], [m4_normalize(esyscmd([hg id -i]))]) |
9 | 9 |
m4_define([lemon_version], [ifelse(lemon_version_number(), |
10 | 10 |
[], |
11 | 11 |
[lemon_hg_path().lemon_hg_revision()], |
12 | 12 |
[lemon_version_number()])]) |
13 | 13 |
|
14 | 14 |
AC_PREREQ([2.59]) |
15 | 15 |
AC_INIT([LEMON], [lemon_version()], [lemon-user@lemon.cs.elte.hu], [lemon]) |
16 | 16 |
AC_CONFIG_AUX_DIR([build-aux]) |
17 | 17 |
AC_CONFIG_MACRO_DIR([m4]) |
18 | 18 |
AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects nostdinc]) |
19 | 19 |
AC_CONFIG_SRCDIR([lemon/list_graph.h]) |
20 | 20 |
AC_CONFIG_HEADERS([config.h lemon/config.h]) |
21 | 21 |
|
22 | 22 |
lx_cmdline_cxxflags_set=${CXXFLAGS+set} |
23 | 23 |
|
24 | 24 |
dnl Do compilation tests using the C++ compiler. |
25 | 25 |
AC_LANG([C++]) |
26 | 26 |
|
27 | 27 |
dnl Check the existence of long long type. |
28 | 28 |
AC_CHECK_TYPE(long long, [long_long_found=yes], [long_long_found=no]) |
29 | 29 |
if test x"$long_long_found" = x"yes"; then |
30 |
AC_DEFINE([ |
|
30 |
AC_DEFINE([LEMON_HAVE_LONG_LONG], [1], [Define to 1 if you have long long.]) |
|
31 | 31 |
fi |
32 | 32 |
|
33 | 33 |
dnl Checks for programs. |
34 | 34 |
AC_PROG_CXX |
35 | 35 |
AC_PROG_CXXCPP |
36 | 36 |
AC_PROG_INSTALL |
37 | 37 |
AC_DISABLE_SHARED |
38 | 38 |
AC_PROG_LIBTOOL |
39 | 39 |
|
40 | 40 |
AC_CHECK_PROG([doxygen_found],[doxygen],[yes],[no]) |
41 | 41 |
AC_CHECK_PROG([gs_found],[gs],[yes],[no]) |
42 | 42 |
|
43 | 43 |
dnl Detect Intel compiler. |
44 | 44 |
AC_MSG_CHECKING([whether we are using the Intel C++ compiler]) |
45 | 45 |
AC_COMPILE_IFELSE([#ifndef __INTEL_COMPILER |
46 | 46 |
choke me |
47 | 47 |
#endif], [ICC=[yes]], [ICC=[no]]) |
48 | 48 |
if test x"$ICC" = x"yes"; then |
49 | 49 |
AC_MSG_RESULT([yes]) |
50 | 50 |
else |
51 | 51 |
AC_MSG_RESULT([no]) |
52 | 52 |
fi |
53 | 53 |
|
54 | 54 |
dnl Set custom compiler flags when using g++. |
55 | 55 |
if test x"$lx_cmdline_cxxflags_set" != x"set" -a "$GXX" = yes -a "$ICC" = no; then |
56 | 56 |
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" |
57 | 57 |
fi |
58 | 58 |
|
59 | 59 |
dnl Checks for libraries. |
60 | 60 |
#LX_CHECK_GLPK |
61 | 61 |
#LX_CHECK_CPLEX |
62 | 62 |
#LX_CHECK_SOPLEX |
63 | 63 |
|
64 | 64 |
dnl Disable/enable building the demo programs. |
65 | 65 |
AC_ARG_ENABLE([demo], |
66 | 66 |
AS_HELP_STRING([--enable-demo], [build the demo programs]) |
67 | 67 |
AS_HELP_STRING([--disable-demo], [do not build the demo programs @<:@default@:>@]), |
68 | 68 |
[], [enable_demo=no]) |
69 | 69 |
AC_MSG_CHECKING([whether to build the demo programs]) |
70 | 70 |
if test x"$enable_demo" != x"no"; then |
71 | 71 |
AC_MSG_RESULT([yes]) |
72 | 72 |
else |
73 | 73 |
AC_MSG_RESULT([no]) |
74 | 74 |
fi |
75 | 75 |
AM_CONDITIONAL([WANT_DEMO], [test x"$enable_demo" != x"no"]) |
76 | 76 |
|
77 | 77 |
dnl Disable/enable building the binary tools. |
78 | 78 |
AC_ARG_ENABLE([tools], |
79 | 79 |
AS_HELP_STRING([--enable-tools], [build additional tools @<:@default@:>@]) |
80 | 80 |
AS_HELP_STRING([--disable-tools], [do not build additional tools]), |
81 | 81 |
[], [enable_tools=yes]) |
82 | 82 |
AC_MSG_CHECKING([whether to build the additional tools]) |
83 | 83 |
if test x"$enable_tools" != x"no"; then |
84 | 84 |
AC_MSG_RESULT([yes]) |
85 | 85 |
else |
86 | 86 |
AC_MSG_RESULT([no]) |
87 | 87 |
fi |
88 | 88 |
AM_CONDITIONAL([WANT_TOOLS], [test x"$enable_tools" != x"no"]) |
89 | 89 |
|
90 | 90 |
dnl Checks for header files. |
91 | 91 |
AC_CHECK_HEADERS(limits.h sys/time.h sys/times.h unistd.h) |
92 | 92 |
|
93 | 93 |
dnl Checks for typedefs, structures, and compiler characteristics. |
94 | 94 |
AC_C_CONST |
95 | 95 |
AC_C_INLINE |
96 | 96 |
AC_TYPE_SIZE_T |
97 | 97 |
AC_HEADER_TIME |
98 | 98 |
AC_STRUCT_TM |
99 | 99 |
|
100 | 100 |
dnl Checks for library functions. |
101 | 101 |
AC_HEADER_STDC |
102 | 102 |
AC_CHECK_FUNCS(gettimeofday times ctime_r) |
103 | 103 |
|
104 | 104 |
dnl Add dependencies on files generated by configure. |
105 | 105 |
AC_SUBST([CONFIG_STATUS_DEPENDENCIES], |
106 | 106 |
['$(top_srcdir)/doc/Doxyfile.in $(top_srcdir)/lemon/lemon.pc.in $(top_srcdir)/cmake/version.cmake.in']) |
107 | 107 |
|
108 | 108 |
AC_CONFIG_FILES([ |
109 | 109 |
Makefile |
110 | 110 |
cmake/version.cmake |
111 | 111 |
doc/Doxyfile |
112 | 112 |
lemon/lemon.pc |
113 | 113 |
]) |
114 | 114 |
|
115 | 115 |
AC_OUTPUT |
116 | 116 |
|
117 | 117 |
echo |
118 | 118 |
echo '****************************** SUMMARY ******************************' |
119 | 119 |
echo |
120 | 120 |
echo Package version............... : $PACKAGE-$VERSION |
121 | 121 |
echo |
122 | 122 |
echo C++ compiler.................. : $CXX |
123 | 123 |
echo C++ compiles flags............ : $CXXFLAGS |
124 | 124 |
echo |
125 | 125 |
echo Compiler supports long long... : $long_long_found |
126 | 126 |
echo |
127 | 127 |
#echo GLPK support.................. : $lx_glpk_found |
128 | 128 |
#echo CPLEX support................. : $lx_cplex_found |
129 | 129 |
#echo SOPLEX support................ : $lx_soplex_found |
130 | 130 |
#echo |
131 | 131 |
echo Build demo programs........... : $enable_demo |
132 | 132 |
echo Build additional tools........ : $enable_tools |
133 | 133 |
echo |
134 | 134 |
echo The packace will be installed in |
135 | 135 |
echo -n ' ' |
136 | 136 |
echo $prefix. |
137 | 137 |
echo |
138 | 138 |
echo '*********************************************************************' |
139 | 139 |
|
140 | 140 |
echo |
141 | 141 |
echo Configure complete, now type \'make\' and then \'make install\'. |
142 | 142 |
echo |
1 |
INCLUDE_DIRECTORIES( |
|
1 |
INCLUDE_DIRECTORIES( |
|
2 |
${CMAKE_SOURCE_DIR} |
|
3 |
${PROJECT_BINARY_DIR} |
|
4 |
) |
|
2 | 5 |
|
3 | 6 |
LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/lemon) |
4 | 7 |
|
5 | 8 |
SET(DEMOS |
6 | 9 |
arg_parser_demo |
7 | 10 |
graph_to_eps_demo |
8 | 11 |
lgf_demo) |
9 | 12 |
|
10 | 13 |
FOREACH(DEMO_NAME ${DEMOS}) |
11 | 14 |
ADD_EXECUTABLE(${DEMO_NAME} ${DEMO_NAME}.cc) |
12 | 15 |
TARGET_LINK_LIBRARIES(${DEMO_NAME} lemon) |
13 | 16 |
ENDFOREACH(DEMO_NAME) |
1 |
INCLUDE_DIRECTORIES( |
|
1 |
INCLUDE_DIRECTORIES( |
|
2 |
${CMAKE_SOURCE_DIR} |
|
3 |
${PROJECT_BINARY_DIR} |
|
4 |
) |
|
5 |
|
|
6 |
CONFIGURE_FILE( |
|
7 |
${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake |
|
8 |
${CMAKE_CURRENT_BINARY_DIR}/config.h |
|
9 |
) |
|
2 | 10 |
|
3 | 11 |
ADD_LIBRARY(lemon |
4 | 12 |
arg_parser.cc |
5 | 13 |
base.cc |
6 | 14 |
color.cc |
7 | 15 |
random.cc |
8 | 16 |
bits/windows.cc |
9 | 17 |
) |
10 | 18 |
|
11 | 19 |
INSTALL( |
12 | 20 |
TARGETS lemon |
13 | 21 |
ARCHIVE DESTINATION lib |
14 | 22 |
COMPONENT library) |
15 | 23 |
|
16 | 24 |
INSTALL( |
17 | 25 |
DIRECTORY . bits concepts |
18 | 26 |
DESTINATION include/lemon |
19 | 27 |
COMPONENT headers |
20 | 28 |
FILES_MATCHING PATTERN "*.h") |
29 |
|
|
30 |
INSTALL( |
|
31 |
FILES ${CMAKE_CURRENT_BINARY_DIR}/config.h |
|
32 |
DESTINATION include/lemon |
|
33 |
COMPONENT headers) |
1 | 1 |
EXTRA_DIST += \ |
2 | 2 |
lemon/lemon.pc.in \ |
3 | 3 |
lemon/CMakeLists.txt |
4 | 4 |
|
5 | 5 |
pkgconfig_DATA += lemon/lemon.pc |
6 | 6 |
|
7 | 7 |
lib_LTLIBRARIES += lemon/libemon.la |
8 | 8 |
|
9 | 9 |
lemon_libemon_la_SOURCES = \ |
10 | 10 |
lemon/arg_parser.cc \ |
11 | 11 |
lemon/base.cc \ |
12 | 12 |
lemon/color.cc \ |
13 | 13 |
lemon/random.cc \ |
14 | 14 |
lemon/bits/windows.cc |
15 | 15 |
|
16 | 16 |
#lemon_libemon_la_CXXFLAGS = $(GLPK_CFLAGS) $(CPLEX_CFLAGS) $(SOPLEX_CXXFLAGS) |
17 | 17 |
#lemon_libemon_la_LDFLAGS = $(GLPK_LIBS) $(CPLEX_LIBS) $(SOPLEX_LIBS) |
18 | 18 |
|
19 | 19 |
lemon_HEADERS += \ |
20 | 20 |
lemon/arg_parser.h \ |
21 | 21 |
lemon/assert.h \ |
22 | 22 |
lemon/bfs.h \ |
23 | 23 |
lemon/bin_heap.h \ |
24 | 24 |
lemon/color.h \ |
25 | 25 |
lemon/concept_check.h \ |
26 |
lemon/config.h \ |
|
26 | 27 |
lemon/counter.h \ |
27 | 28 |
lemon/core.h \ |
28 | 29 |
lemon/dfs.h \ |
29 | 30 |
lemon/dijkstra.h \ |
30 | 31 |
lemon/dim2.h \ |
31 | 32 |
lemon/error.h \ |
32 | 33 |
lemon/graph_to_eps.h \ |
33 | 34 |
lemon/kruskal.h \ |
34 | 35 |
lemon/lgf_reader.h \ |
35 | 36 |
lemon/lgf_writer.h \ |
36 | 37 |
lemon/list_graph.h \ |
37 | 38 |
lemon/maps.h \ |
38 | 39 |
lemon/math.h \ |
39 | 40 |
lemon/path.h \ |
40 | 41 |
lemon/random.h \ |
41 | 42 |
lemon/smart_graph.h \ |
42 | 43 |
lemon/time_measure.h \ |
43 | 44 |
lemon/tolerance.h \ |
44 | 45 |
lemon/unionfind.h \ |
45 | 46 |
lemon/bits/windows.h |
46 | 47 |
|
47 | 48 |
bits_HEADERS += \ |
48 | 49 |
lemon/bits/alteration_notifier.h \ |
49 | 50 |
lemon/bits/array_map.h \ |
50 | 51 |
lemon/bits/base_extender.h \ |
51 | 52 |
lemon/bits/bezier.h \ |
52 | 53 |
lemon/bits/default_map.h \ |
53 | 54 |
lemon/bits/enable_if.h \ |
54 | 55 |
lemon/bits/graph_extender.h \ |
55 | 56 |
lemon/bits/map_extender.h \ |
56 | 57 |
lemon/bits/path_dump.h \ |
57 | 58 |
lemon/bits/traits.h \ |
58 | 59 |
lemon/bits/vector_map.h |
59 | 60 |
|
60 | 61 |
concept_HEADERS += \ |
61 | 62 |
lemon/concepts/digraph.h \ |
62 | 63 |
lemon/concepts/graph.h \ |
63 | 64 |
lemon/concepts/graph_components.h \ |
64 | 65 |
lemon/concepts/heap.h \ |
65 | 66 |
lemon/concepts/maps.h \ |
66 | 67 |
lemon/concepts/path.h |
1 | 1 |
/* -*- mode: C++; indent-tabs-mode: nil; -*- |
2 | 2 |
* |
3 | 3 |
* This file is a part of LEMON, a generic C++ optimization library. |
4 | 4 |
* |
5 | 5 |
* Copyright (C) 2003-2008 |
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
7 | 7 |
* (Egervary Research Group on Combinatorial Optimization, EGRES). |
8 | 8 |
* |
9 | 9 |
* Permission to use, modify and distribute this software is granted |
10 | 10 |
* provided that this copyright notice appears in all copies. For |
11 | 11 |
* precise terms see the accompanying LICENSE file. |
12 | 12 |
* |
13 | 13 |
* This software is provided "AS IS" with no warranty of any kind, |
14 | 14 |
* express or implied, and with no claim as to its suitability for any |
15 | 15 |
* purpose. |
16 | 16 |
* |
17 | 17 |
*/ |
18 | 18 |
|
19 | 19 |
#ifndef LEMON_BITS_DEFAULT_MAP_H |
20 | 20 |
#define LEMON_BITS_DEFAULT_MAP_H |
21 | 21 |
|
22 | 22 |
#include <lemon/config.h> |
23 | 23 |
#include <lemon/bits/array_map.h> |
24 | 24 |
#include <lemon/bits/vector_map.h> |
25 | 25 |
//#include <lemon/bits/debug_map.h> |
26 | 26 |
|
27 | 27 |
//\ingroup graphbits |
28 | 28 |
//\file |
29 | 29 |
//\brief Graph maps that construct and destruct their elements dynamically. |
30 | 30 |
|
31 | 31 |
namespace lemon { |
32 | 32 |
|
33 | 33 |
|
34 | 34 |
//#ifndef LEMON_USE_DEBUG_MAP |
35 | 35 |
|
36 | 36 |
template <typename _Graph, typename _Item, typename _Value> |
37 | 37 |
struct DefaultMapSelector { |
38 | 38 |
typedef ArrayMap<_Graph, _Item, _Value> Map; |
39 | 39 |
}; |
40 | 40 |
|
41 | 41 |
// bool |
42 | 42 |
template <typename _Graph, typename _Item> |
43 | 43 |
struct DefaultMapSelector<_Graph, _Item, bool> { |
44 | 44 |
typedef VectorMap<_Graph, _Item, bool> Map; |
45 | 45 |
}; |
46 | 46 |
|
47 | 47 |
// char |
48 | 48 |
template <typename _Graph, typename _Item> |
49 | 49 |
struct DefaultMapSelector<_Graph, _Item, char> { |
50 | 50 |
typedef VectorMap<_Graph, _Item, char> Map; |
51 | 51 |
}; |
52 | 52 |
|
53 | 53 |
template <typename _Graph, typename _Item> |
54 | 54 |
struct DefaultMapSelector<_Graph, _Item, signed char> { |
55 | 55 |
typedef VectorMap<_Graph, _Item, signed char> Map; |
56 | 56 |
}; |
57 | 57 |
|
58 | 58 |
template <typename _Graph, typename _Item> |
59 | 59 |
struct DefaultMapSelector<_Graph, _Item, unsigned char> { |
60 | 60 |
typedef VectorMap<_Graph, _Item, unsigned char> Map; |
61 | 61 |
}; |
62 | 62 |
|
63 | 63 |
|
64 | 64 |
// int |
65 | 65 |
template <typename _Graph, typename _Item> |
66 | 66 |
struct DefaultMapSelector<_Graph, _Item, signed int> { |
67 | 67 |
typedef VectorMap<_Graph, _Item, signed int> Map; |
68 | 68 |
}; |
69 | 69 |
|
70 | 70 |
template <typename _Graph, typename _Item> |
71 | 71 |
struct DefaultMapSelector<_Graph, _Item, unsigned int> { |
72 | 72 |
typedef VectorMap<_Graph, _Item, unsigned int> Map; |
73 | 73 |
}; |
74 | 74 |
|
75 | 75 |
|
76 | 76 |
// short |
77 | 77 |
template <typename _Graph, typename _Item> |
78 | 78 |
struct DefaultMapSelector<_Graph, _Item, signed short> { |
79 | 79 |
typedef VectorMap<_Graph, _Item, signed short> Map; |
80 | 80 |
}; |
81 | 81 |
|
82 | 82 |
template <typename _Graph, typename _Item> |
83 | 83 |
struct DefaultMapSelector<_Graph, _Item, unsigned short> { |
84 | 84 |
typedef VectorMap<_Graph, _Item, unsigned short> Map; |
85 | 85 |
}; |
86 | 86 |
|
87 | 87 |
|
88 | 88 |
// long |
89 | 89 |
template <typename _Graph, typename _Item> |
90 | 90 |
struct DefaultMapSelector<_Graph, _Item, signed long> { |
91 | 91 |
typedef VectorMap<_Graph, _Item, signed long> Map; |
92 | 92 |
}; |
93 | 93 |
|
94 | 94 |
template <typename _Graph, typename _Item> |
95 | 95 |
struct DefaultMapSelector<_Graph, _Item, unsigned long> { |
96 | 96 |
typedef VectorMap<_Graph, _Item, unsigned long> Map; |
97 | 97 |
}; |
98 | 98 |
|
99 | 99 |
|
100 |
#if defined |
|
100 |
#if defined LEMON_HAVE_LONG_LONG |
|
101 | 101 |
|
102 | 102 |
// long long |
103 | 103 |
template <typename _Graph, typename _Item> |
104 | 104 |
struct DefaultMapSelector<_Graph, _Item, signed long long> { |
105 | 105 |
typedef VectorMap<_Graph, _Item, signed long long> Map; |
106 | 106 |
}; |
107 | 107 |
|
108 | 108 |
template <typename _Graph, typename _Item> |
109 | 109 |
struct DefaultMapSelector<_Graph, _Item, unsigned long long> { |
110 | 110 |
typedef VectorMap<_Graph, _Item, unsigned long long> Map; |
111 | 111 |
}; |
112 | 112 |
|
113 | 113 |
#endif |
114 | 114 |
|
115 | 115 |
|
116 | 116 |
// float |
117 | 117 |
template <typename _Graph, typename _Item> |
118 | 118 |
struct DefaultMapSelector<_Graph, _Item, float> { |
119 | 119 |
typedef VectorMap<_Graph, _Item, float> Map; |
120 | 120 |
}; |
121 | 121 |
|
122 | 122 |
|
123 | 123 |
// double |
124 | 124 |
template <typename _Graph, typename _Item> |
125 | 125 |
struct DefaultMapSelector<_Graph, _Item, double> { |
126 | 126 |
typedef VectorMap<_Graph, _Item, double> Map; |
127 | 127 |
}; |
128 | 128 |
|
129 | 129 |
|
130 | 130 |
// long double |
131 | 131 |
template <typename _Graph, typename _Item> |
132 | 132 |
struct DefaultMapSelector<_Graph, _Item, long double> { |
133 | 133 |
typedef VectorMap<_Graph, _Item, long double> Map; |
134 | 134 |
}; |
135 | 135 |
|
136 | 136 |
|
137 | 137 |
// pointer |
138 | 138 |
template <typename _Graph, typename _Item, typename _Ptr> |
139 | 139 |
struct DefaultMapSelector<_Graph, _Item, _Ptr*> { |
140 | 140 |
typedef VectorMap<_Graph, _Item, _Ptr*> Map; |
141 | 141 |
}; |
142 | 142 |
|
143 | 143 |
// #else |
144 | 144 |
|
145 | 145 |
// template <typename _Graph, typename _Item, typename _Value> |
146 | 146 |
// struct DefaultMapSelector { |
147 | 147 |
// typedef DebugMap<_Graph, _Item, _Value> Map; |
148 | 148 |
// }; |
149 | 149 |
|
150 | 150 |
// #endif |
151 | 151 |
|
152 | 152 |
// DefaultMap class |
153 | 153 |
template <typename _Graph, typename _Item, typename _Value> |
154 | 154 |
class DefaultMap |
155 | 155 |
: public DefaultMapSelector<_Graph, _Item, _Value>::Map { |
156 | 156 |
public: |
157 | 157 |
typedef typename DefaultMapSelector<_Graph, _Item, _Value>::Map Parent; |
158 | 158 |
typedef DefaultMap<_Graph, _Item, _Value> Map; |
159 | 159 |
|
160 | 160 |
typedef typename Parent::Graph Graph; |
161 | 161 |
typedef typename Parent::Value Value; |
162 | 162 |
|
163 | 163 |
explicit DefaultMap(const Graph& graph) : Parent(graph) {} |
164 | 164 |
DefaultMap(const Graph& graph, const Value& value) |
165 | 165 |
: Parent(graph, value) {} |
166 | 166 |
|
167 | 167 |
DefaultMap& operator=(const DefaultMap& cmap) { |
168 | 168 |
return operator=<DefaultMap>(cmap); |
169 | 169 |
} |
170 | 170 |
|
171 | 171 |
template <typename CMap> |
172 | 172 |
DefaultMap& operator=(const CMap& cmap) { |
173 | 173 |
Parent::operator=(cmap); |
174 | 174 |
return *this; |
175 | 175 |
} |
176 | 176 |
|
177 | 177 |
}; |
178 | 178 |
|
179 | 179 |
} |
180 | 180 |
|
181 | 181 |
#endif |
1 | 1 |
AC_DEFUN([LX_CHECK_CPLEX], |
2 | 2 |
[ |
3 | 3 |
AC_ARG_WITH([cplex], |
4 | 4 |
AS_HELP_STRING([--with-cplex@<:@=PREFIX@:>@], [search for CPLEX under PREFIX or under the default search paths if PREFIX is not given @<:@default@:>@]) |
5 | 5 |
AS_HELP_STRING([--without-cplex], [disable checking for CPLEX]), |
6 | 6 |
[], [with_cplex=yes]) |
7 | 7 |
|
8 | 8 |
AC_ARG_WITH([cplex-includedir], |
9 | 9 |
AS_HELP_STRING([--with-cplex-includedir=DIR], [search for CPLEX headers in DIR]), |
10 | 10 |
[], [with_cplex_includedir=no]) |
11 | 11 |
|
12 | 12 |
AC_ARG_WITH([cplex-libdir], |
13 | 13 |
AS_HELP_STRING([--with-cplex-libdir=DIR], [search for CPLEX libraries in DIR]), |
14 | 14 |
[], [with_cplex_libdir=no]) |
15 | 15 |
|
16 | 16 |
lx_cplex_found=no |
17 | 17 |
if test x"$with_cplex" != x"no"; then |
18 | 18 |
AC_MSG_CHECKING([for CPLEX]) |
19 | 19 |
|
20 | 20 |
if test x"$with_cplex_includedir" != x"no"; then |
21 | 21 |
CPLEX_CFLAGS="-I$with_cplex_includedir" |
22 | 22 |
elif test x"$with_cplex" != x"yes"; then |
23 | 23 |
CPLEX_CFLAGS="-I$with_cplex/include" |
24 | 24 |
elif test x"$CPLEX_INCLUDEDIR" != x; then |
25 | 25 |
CPLEX_CFLAGS="-I$CPLEX_INCLUDEDIR" |
26 | 26 |
fi |
27 | 27 |
|
28 | 28 |
if test x"$with_cplex_libdir" != x"no"; then |
29 | 29 |
CPLEX_LDFLAGS="-L$with_cplex_libdir" |
30 | 30 |
elif test x"$with_cplex" != x"yes"; then |
31 | 31 |
CPLEX_LDFLAGS="-L$with_cplex/lib" |
32 | 32 |
elif test x"$CPLEX_LIBDIR" != x; then |
33 | 33 |
CPLEX_LDFLAGS="-L$CPLEX_LIBDIR" |
34 | 34 |
fi |
35 | 35 |
CPLEX_LIBS="-lcplex -lm -lpthread" |
36 | 36 |
|
37 | 37 |
lx_save_cxxflags="$CXXFLAGS" |
38 | 38 |
lx_save_ldflags="$LDFLAGS" |
39 | 39 |
lx_save_libs="$LIBS" |
40 | 40 |
CXXFLAGS="$CPLEX_CFLAGS" |
41 | 41 |
LDFLAGS="$CPLEX_LDFLAGS" |
42 | 42 |
LIBS="$CPLEX_LIBS" |
43 | 43 |
|
44 | 44 |
lx_cplex_test_prog=' |
45 | 45 |
extern "C" { |
46 | 46 |
#include <ilcplex/cplex.h> |
47 | 47 |
} |
48 | 48 |
|
49 | 49 |
int main(int argc, char** argv) |
50 | 50 |
{ |
51 | 51 |
CPXENVptr env = NULL; |
52 | 52 |
return 0; |
53 | 53 |
}' |
54 | 54 |
|
55 | 55 |
AC_LANG_PUSH(C++) |
56 | 56 |
AC_LINK_IFELSE([$lx_cplex_test_prog], [lx_cplex_found=yes], [lx_cplex_found=no]) |
57 | 57 |
AC_LANG_POP(C++) |
58 | 58 |
|
59 | 59 |
CXXFLAGS="$lx_save_cxxflags" |
60 | 60 |
LDFLAGS="$lx_save_ldflags" |
61 | 61 |
LIBS="$lx_save_libs" |
62 | 62 |
|
63 | 63 |
if test x"$lx_cplex_found" = x"yes"; then |
64 |
AC_DEFINE([ |
|
64 |
AC_DEFINE([LEMON_HAVE_CPLEX], [1], [Define to 1 if you have CPLEX.]) |
|
65 | 65 |
AC_MSG_RESULT([yes]) |
66 | 66 |
else |
67 | 67 |
CPLEX_CFLAGS="" |
68 | 68 |
CPLEX_LDFLAGS="" |
69 | 69 |
CPLEX_LIBS="" |
70 | 70 |
AC_MSG_RESULT([no]) |
71 | 71 |
fi |
72 | 72 |
fi |
73 | 73 |
CPLEX_LIBS="$CPLEX_LDFLAGS $CPLEX_LIBS" |
74 | 74 |
AC_SUBST(CPLEX_CFLAGS) |
75 | 75 |
AC_SUBST(CPLEX_LIBS) |
76 | 76 |
AM_CONDITIONAL([HAVE_CPLEX], [test x"$lx_cplex_found" = x"yes"]) |
77 | 77 |
]) |
1 | 1 |
AC_DEFUN([LX_CHECK_GLPK], |
2 | 2 |
[ |
3 | 3 |
AC_ARG_WITH([glpk], |
4 | 4 |
AS_HELP_STRING([--with-glpk@<:@=PREFIX@:>@], [search for GLPK under PREFIX or under the default search paths if PREFIX is not given @<:@default@:>@]) |
5 | 5 |
AS_HELP_STRING([--without-glpk], [disable checking for GLPK]), |
6 | 6 |
[], [with_glpk=yes]) |
7 | 7 |
|
8 | 8 |
AC_ARG_WITH([glpk-includedir], |
9 | 9 |
AS_HELP_STRING([--with-glpk-includedir=DIR], [search for GLPK headers in DIR]), |
10 | 10 |
[], [with_glpk_includedir=no]) |
11 | 11 |
|
12 | 12 |
AC_ARG_WITH([glpk-libdir], |
13 | 13 |
AS_HELP_STRING([--with-glpk-libdir=DIR], [search for GLPK libraries in DIR]), |
14 | 14 |
[], [with_glpk_libdir=no]) |
15 | 15 |
|
16 | 16 |
lx_glpk_found=no |
17 | 17 |
if test x"$with_glpk" != x"no"; then |
18 | 18 |
AC_MSG_CHECKING([for GLPK]) |
19 | 19 |
|
20 | 20 |
if test x"$with_glpk_includedir" != x"no"; then |
21 | 21 |
GLPK_CFLAGS="-I$with_glpk_includedir" |
22 | 22 |
elif test x"$with_glpk" != x"yes"; then |
23 | 23 |
GLPK_CFLAGS="-I$with_glpk/include" |
24 | 24 |
fi |
25 | 25 |
|
26 | 26 |
if test x"$with_glpk_libdir" != x"no"; then |
27 | 27 |
GLPK_LDFLAGS="-L$with_glpk_libdir" |
28 | 28 |
elif test x"$with_glpk" != x"yes"; then |
29 | 29 |
GLPK_LDFLAGS="-L$with_glpk/lib" |
30 | 30 |
fi |
31 | 31 |
GLPK_LIBS="-lglpk" |
32 | 32 |
|
33 | 33 |
lx_save_cxxflags="$CXXFLAGS" |
34 | 34 |
lx_save_ldflags="$LDFLAGS" |
35 | 35 |
lx_save_libs="$LIBS" |
36 | 36 |
CXXFLAGS="$GLPK_CFLAGS" |
37 | 37 |
LDFLAGS="$GLPK_LDFLAGS" |
38 | 38 |
LIBS="$GLPK_LIBS" |
39 | 39 |
|
40 | 40 |
lx_glpk_test_prog=' |
41 | 41 |
extern "C" { |
42 | 42 |
#include <glpk.h> |
43 | 43 |
} |
44 | 44 |
|
45 | 45 |
int main(int argc, char** argv) |
46 | 46 |
{ |
47 | 47 |
LPX *lp; |
48 | 48 |
lp = lpx_create_prob(); |
49 | 49 |
lpx_delete_prob(lp); |
50 | 50 |
return 0; |
51 | 51 |
}' |
52 | 52 |
|
53 | 53 |
AC_LANG_PUSH(C++) |
54 | 54 |
AC_LINK_IFELSE([$lx_glpk_test_prog], [lx_glpk_found=yes], [lx_glpk_found=no]) |
55 | 55 |
AC_LANG_POP(C++) |
56 | 56 |
|
57 | 57 |
CXXFLAGS="$lx_save_cxxflags" |
58 | 58 |
LDFLAGS="$lx_save_ldflags" |
59 | 59 |
LIBS="$lx_save_libs" |
60 | 60 |
|
61 | 61 |
if test x"$lx_glpk_found" = x"yes"; then |
62 |
AC_DEFINE([ |
|
62 |
AC_DEFINE([LEMON_HAVE_GLPK], [1], [Define to 1 if you have GLPK.]) |
|
63 | 63 |
AC_MSG_RESULT([yes]) |
64 | 64 |
else |
65 | 65 |
GLPK_CFLAGS="" |
66 | 66 |
GLPK_LDFLAGS="" |
67 | 67 |
GLPK_LIBS="" |
68 | 68 |
AC_MSG_RESULT([no]) |
69 | 69 |
fi |
70 | 70 |
fi |
71 | 71 |
GLPK_LIBS="$GLPK_LDFLAGS $GLPK_LIBS" |
72 | 72 |
AC_SUBST(GLPK_CFLAGS) |
73 | 73 |
AC_SUBST(GLPK_LIBS) |
74 | 74 |
AM_CONDITIONAL([HAVE_GLPK], [test x"$lx_glpk_found" = x"yes"]) |
75 | 75 |
]) |
1 | 1 |
AC_DEFUN([LX_CHECK_SOPLEX], |
2 | 2 |
[ |
3 | 3 |
AC_ARG_WITH([soplex], |
4 | 4 |
AS_HELP_STRING([--with-soplex@<:@=PREFIX@:>@], [search for SOPLEX under PREFIX or under the default search paths if PREFIX is not given @<:@default@:>@]) |
5 | 5 |
AS_HELP_STRING([--without-soplex], [disable checking for SOPLEX]), |
6 | 6 |
[], [with_soplex=yes]) |
7 | 7 |
|
8 | 8 |
AC_ARG_WITH([soplex-includedir], |
9 | 9 |
AS_HELP_STRING([--with-soplex-includedir=DIR], [search for SOPLEX headers in DIR]), |
10 | 10 |
[], [with_soplex_includedir=no]) |
11 | 11 |
|
12 | 12 |
AC_ARG_WITH([soplex-libdir], |
13 | 13 |
AS_HELP_STRING([--with-soplex-libdir=DIR], [search for SOPLEX libraries in DIR]), |
14 | 14 |
[], [with_soplex_libdir=no]) |
15 | 15 |
|
16 | 16 |
lx_soplex_found=no |
17 | 17 |
if test x"$with_soplex" != x"no"; then |
18 | 18 |
AC_MSG_CHECKING([for SOPLEX]) |
19 | 19 |
|
20 | 20 |
if test x"$with_soplex_includedir" != x"no"; then |
21 | 21 |
SOPLEX_CXXFLAGS="-I$with_soplex_includedir" |
22 | 22 |
elif test x"$with_soplex" != x"yes"; then |
23 | 23 |
SOPLEX_CXXFLAGS="-I$with_soplex/include" |
24 | 24 |
fi |
25 | 25 |
|
26 | 26 |
if test x"$with_soplex_libdir" != x"no"; then |
27 | 27 |
SOPLEX_LDFLAGS="-L$with_soplex_libdir" |
28 | 28 |
elif test x"$with_soplex" != x"yes"; then |
29 | 29 |
SOPLEX_LDFLAGS="-L$with_soplex/lib" |
30 | 30 |
fi |
31 | 31 |
SOPLEX_LIBS="-lsoplex -lz" |
32 | 32 |
|
33 | 33 |
lx_save_cxxflags="$CXXFLAGS" |
34 | 34 |
lx_save_ldflags="$LDFLAGS" |
35 | 35 |
lx_save_libs="$LIBS" |
36 | 36 |
CXXFLAGS="$SOPLEX_CXXFLAGS" |
37 | 37 |
LDFLAGS="$SOPLEX_LDFLAGS" |
38 | 38 |
LIBS="$SOPLEX_LIBS" |
39 | 39 |
|
40 | 40 |
lx_soplex_test_prog=' |
41 | 41 |
#include <soplex/soplex.h> |
42 | 42 |
|
43 | 43 |
int main(int argc, char** argv) |
44 | 44 |
{ |
45 | 45 |
soplex::SoPlex soplex; |
46 | 46 |
return 0; |
47 | 47 |
}' |
48 | 48 |
|
49 | 49 |
AC_LANG_PUSH(C++) |
50 | 50 |
AC_LINK_IFELSE([$lx_soplex_test_prog], [lx_soplex_found=yes], [lx_soplex_found=no]) |
51 | 51 |
AC_LANG_POP(C++) |
52 | 52 |
|
53 | 53 |
CXXFLAGS="$lx_save_cxxflags" |
54 | 54 |
LDFLAGS="$lx_save_ldflags" |
55 | 55 |
LIBS="$lx_save_libs" |
56 | 56 |
|
57 | 57 |
if test x"$lx_soplex_found" = x"yes"; then |
58 |
AC_DEFINE([ |
|
58 |
AC_DEFINE([LEMON_HAVE_SOPLEX], [1], [Define to 1 if you have SOPLEX.]) |
|
59 | 59 |
AC_MSG_RESULT([yes]) |
60 | 60 |
else |
61 | 61 |
SOPLEX_CXXFLAGS="" |
62 | 62 |
SOPLEX_LDFLAGS="" |
63 | 63 |
SOPLEX_LIBS="" |
64 | 64 |
AC_MSG_RESULT([no]) |
65 | 65 |
fi |
66 | 66 |
fi |
67 | 67 |
SOPLEX_LIBS="$SOPLEX_LDFLAGS $SOPLEX_LIBS" |
68 | 68 |
AC_SUBST(SOPLEX_CXXFLAGS) |
69 | 69 |
AC_SUBST(SOPLEX_LIBS) |
70 | 70 |
AM_CONDITIONAL([HAVE_SOPLEX], [test x"$lx_soplex_found" = x"yes"]) |
71 | 71 |
]) |
1 |
INCLUDE_DIRECTORIES( |
|
1 |
INCLUDE_DIRECTORIES( |
|
2 |
${CMAKE_SOURCE_DIR} |
|
3 |
${PROJECT_BINARY_DIR} |
|
4 |
) |
|
2 | 5 |
|
3 | 6 |
LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/lemon) |
4 | 7 |
|
5 | 8 |
SET(TESTS |
6 | 9 |
bfs_test |
7 | 10 |
counter_test |
8 | 11 |
dfs_test |
9 | 12 |
digraph_test |
10 | 13 |
dijkstra_test |
11 | 14 |
dim_test |
12 | 15 |
error_test |
13 | 16 |
graph_copy_test |
14 | 17 |
graph_test |
15 | 18 |
graph_utils_test |
16 | 19 |
heap_test |
17 | 20 |
kruskal_test |
18 | 21 |
maps_test |
19 | 22 |
random_test |
20 | 23 |
path_test |
21 | 24 |
time_measure_test |
22 | 25 |
unionfind_test) |
23 | 26 |
|
24 | 27 |
FOREACH(TEST_NAME ${TESTS}) |
25 | 28 |
ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc) |
26 | 29 |
TARGET_LINK_LIBRARIES(${TEST_NAME} lemon) |
27 | 30 |
ADD_TEST(${TEST_NAME} ${TEST_NAME}) |
28 | 31 |
ENDFOREACH(TEST_NAME) |
0 comments (0 inline)