From 879834178d8859706345b9ac42a7b04c0cafd688 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Fri, 30 Oct 2009 09:01:14 +0000 Subject: [PATCH] compiling info, timer for expbench --- COMPILE | 28 ++++++++++++++++++++++------ tools/creaturedump.cpp | 2 ++ tools/expbench.cpp | 10 ++++++++++ tools/prospector.cpp | 3 --- tools/reveal.cpp | 2 ++ 5 files changed, 36 insertions(+), 9 deletions(-) diff --git a/COMPILE b/COMPILE index 199067d5e..9396b1d56 100644 --- a/COMPILE +++ b/COMPILE @@ -1,19 +1,35 @@ Here's how you build dfhack! ---------------------------- -First, there is one dependency: +First, there is one dependency, regrdless of the OS you use: cmake - it's the build system -building the library is simple. Enter the build folder, run th tools. Like this: - cd build - cmake .. -DCMAKE_BUILD_TYPE:string=Release - make +Building on Linux: +-------------------- + +* To run in the output folder (without installing): -Changing folder to build and using 'cmake ..' is important! +building the library is simple. Enter the build folder, run the tools. Like this: + +cd build +cmake .. -DCMAKE_BUILD_TYPE:string=Release -DMEMXML_DATA_PATH:path=. +make This will build the library and its tools and place them in /output. You can also use a cmake-friendly IDE like KDevelop 4 or the cmake GUI program. +* To be installed into the system or packaged + +cd build +cmake -DCMAKE_BUILD_TYPE:string=Release -DCMAKE_INSTALL_PREFIX=/usr -DMEMXML_DATA_PATH:path=/usr/share/dfhack .. +make +make install + +With this dfhack installs: +library to $CMAKE_INSTALL_PREFIX/lib +executables to $CMAKE_INSTALL_PREFIX/bin +The Memory.xml file to /usr/share/dfhack + Building on Windows: -------------------- diff --git a/tools/creaturedump.cpp b/tools/creaturedump.cpp index d4510f3aa..b4724a2df 100644 --- a/tools/creaturedump.cpp +++ b/tools/creaturedump.cpp @@ -111,5 +111,7 @@ int main (void) } DF.FinishReadCreatures(); delete pDF; + cout << "Done. Press any key to continue" << endl; + cin.ignore(); return 0; } \ No newline at end of file diff --git a/tools/expbench.cpp b/tools/expbench.cpp index 4ca080bc2..f00dfe8f5 100644 --- a/tools/expbench.cpp +++ b/tools/expbench.cpp @@ -3,6 +3,7 @@ #include #include #include +#include using namespace std; #include @@ -10,6 +11,9 @@ using namespace std; int main (void) { + time_t start, end; + double time_diff; + uint32_t x_max,y_max,z_max; uint32_t num_blocks = 0; uint32_t bytes_read = 0; @@ -27,6 +31,7 @@ int main (void) DF.InitMap(); DF.getSize(x_max,y_max,z_max); + time(&start); for(uint32_t i = 0; i< 1000;i++) { if((i % 10) == 0) @@ -52,8 +57,13 @@ int main (void) } } } + time(&end); + time_diff = difftime(end, start); cout << num_blocks << " blocks read" << endl; cout << bytes_read / (1024 * 1024) << " MB" << endl; + cout << "map export tests done in " << time_diff << " seconds." << endl; + cout << "Press any key to continue" << endl; + cin.ignore(); delete pDF; return 0; } \ No newline at end of file diff --git a/tools/prospector.cpp b/tools/prospector.cpp index cad0de715..a85c98bc0 100644 --- a/tools/prospector.cpp +++ b/tools/prospector.cpp @@ -170,10 +170,7 @@ int main (int argc, const char* argv[]) { cout << stonetypes[p->first].id << " : " << p->second << endl; } - // wait for input on windows so the tool is still usable to some extent - #ifndef LINUX_BUILD cin.ignore(); - #endif delete pDF; return 0; } \ No newline at end of file diff --git a/tools/reveal.cpp b/tools/reveal.cpp index d05e47493..fd74b2695 100644 --- a/tools/reveal.cpp +++ b/tools/reveal.cpp @@ -48,5 +48,7 @@ int main (void) } } delete pDF; + cout << "Done. Press any key to continue" << endl; + cin.ignore(); return 0; } \ No newline at end of file