# HG changeset patch # User Alpar Juttner # Date 2008-04-22 18:52:01 # Node ID 95d905b6e33d825e1d1e325b3913990da5dd1117 # Parent 356930927a719bc19c1d04cece555f3e926920ee # Parent 4e626dbbe408151cffbebc90dafd85b823a05980 Merge diff --git a/.hgignore b/.hgignore --- a/.hgignore +++ b/.hgignore @@ -34,3 +34,8 @@ ^objs.*/.* ^test/[a-z_]*$ ^demo/.*_demo$ +^build/.* +CMakeFiles +DartTestfile.txt +cmake_install.cmake +CMakeCache.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,5 @@ +project (LEMON) +enable_testing () +add_subdirectory (lemon) +add_subdirectory (demo) +add_subdirectory (test) diff --git a/benchmark/Makefile b/benchmark/Makefile deleted file mode 100644 --- a/benchmark/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -all: - $(MAKE) -C .. diff --git a/demo/CMakeLists.txt b/demo/CMakeLists.txt new file mode 100644 --- /dev/null +++ b/demo/CMakeLists.txt @@ -0,0 +1,13 @@ +include_directories (${LEMON_SOURCE_DIR}) + +link_directories (${LEMON_BINARY_DIR}/lemon) + +set (DEMOS + arg_parser_demo + graph_to_eps_demo + lgf_demo) + +foreach (DEMO_NAME ${DEMOS}) + add_executable (${DEMO_NAME} ${DEMO_NAME}.cc) + target_link_libraries (${DEMO_NAME} lemon) + endforeach (DEMO_NAME) diff --git a/demo/Makefile b/demo/Makefile deleted file mode 100644 --- a/demo/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -all: - $(MAKE) -C .. diff --git a/demo/lgf_demo.cc b/demo/lgf_demo.cc --- a/demo/lgf_demo.cc +++ b/demo/lgf_demo.cc @@ -37,7 +37,7 @@ int main(int argc, const char *argv[]) { const int n = argc > 1 ? std::atoi(argv[1]) : 20; - const int e = argc > 2 ? std::atoi(argv[2]) : static_cast(n * log(n)); + const int e = argc > 2 ? std::atoi(argv[2]) : static_cast(n * std::log(double(n))); const int m = argc > 3 ? std::atoi(argv[3]) : 100; SmartDigraph digraph; diff --git a/doc/Makefile b/doc/Makefile deleted file mode 100644 --- a/doc/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -all: - $(MAKE) -C .. diff --git a/lemon/CMakeLists.txt b/lemon/CMakeLists.txt new file mode 100644 --- /dev/null +++ b/lemon/CMakeLists.txt @@ -0,0 +1,2 @@ +include_directories (${LEMON_SOURCE_DIR}) +add_library (lemon arg_parser.cc base.cc color.cc random.cc) diff --git a/lemon/Makefile b/lemon/Makefile deleted file mode 100644 --- a/lemon/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -all: - $(MAKE) -C .. diff --git a/lemon/assert.h b/lemon/assert.h --- a/lemon/assert.h +++ b/lemon/assert.h @@ -103,7 +103,13 @@ #endif #ifndef LEMON_FUNCTION_NAME -# define LEMON_FUNCTION_NAME (__PRETTY_FUNCTION__) +# if defined __GNUC__ +# define LEMON_FUNCTION_NAME (__PRETTY_FUNCTION__) +# elif defined _MSC_VER +# define LEMON_FUNCTION_NAME (__FUNCSIG__) +# else +# define LEMON_FUNCTION_NAME (__func__) +# endif #endif #ifdef DOXYGEN diff --git a/lemon/graph_to_eps.h b/lemon/graph_to_eps.h --- a/lemon/graph_to_eps.h +++ b/lemon/graph_to_eps.h @@ -29,6 +29,8 @@ #include #include #else +#define WIN32_LEAN_AND_MEAN +#define NOMINMAX #include #endif diff --git a/lemon/path.h b/lemon/path.h --- a/lemon/path.h +++ b/lemon/path.h @@ -903,20 +903,34 @@ namespace _path_bits { template - struct RevTagIndicator { + struct RevPathTagIndicator { static const bool value = false; }; - template - struct RevTagIndicator< - Digraph, - typename enable_if::type + template + struct RevPathTagIndicator< + Path, + typename enable_if::type + > { + static const bool value = true; + }; + + template + struct BuildTagIndicator { + static const bool value = false; + }; + + template + struct BuildTagIndicator< + Path, + typename enable_if::type > { static const bool value = true; }; template + bool buildEnable = BuildTagIndicator::value, + bool revEnable = RevPathTagIndicator::value> struct PathCopySelector { static void copy(Target& target, const Source& source) { target.clear(); @@ -926,10 +940,8 @@ } }; - template - struct PathCopySelector< - Target, Source, BuildEnable, - typename enable_if::type> { + template + struct PathCopySelector { static void copy(Target& target, const Source& source) { target.clear(); for (typename Source::RevArcIt it(source); it != INVALID; ++it) { @@ -938,10 +950,8 @@ } }; - template - struct PathCopySelector< - Target, Source, - typename enable_if::type, RevEnable> { + template + struct PathCopySelector { static void copy(Target& target, const Source& source) { target.clear(); target.build(source); @@ -949,10 +959,7 @@ }; template - struct PathCopySelector< - Target, Source, - typename enable_if::type, - typename enable_if::type> { + struct PathCopySelector { static void copy(Target& target, const Source& source) { target.clear(); target.buildRev(source); diff --git a/lemon/time_measure.h b/lemon/time_measure.h --- a/lemon/time_measure.h +++ b/lemon/time_measure.h @@ -24,6 +24,8 @@ ///\brief Tools for measuring cpu usage #ifdef WIN32 +#define WIN32_LEAN_AND_MEAN +#define NOMINMAX #include #include #else @@ -31,6 +33,7 @@ #include #endif +#include #include #include diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,24 @@ +include_directories (${LEMON_SOURCE_DIR}) + +link_directories (${LEMON_BINARY_DIR}/lemon) + +set (TESTS + bfs_test + counter_test + dfs_test + digraph_test + dim_test + error_test + graph_test + kruskal_test + maps_test + random_test + path_test + time_measure_test + unionfind_test) + +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) diff --git a/test/Makefile b/test/Makefile deleted file mode 100644 --- a/test/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -all: - $(MAKE) -C .. diff --git a/tools/Makefile b/tools/Makefile deleted file mode 100644 --- a/tools/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -all: - $(MAKE) -C ..