From 8ecef39168b9e1979c1d8c58bd7b20b46e79c062 Mon Sep 17 00:00:00 2001 From: Caner Candan Date: Wed, 17 Nov 2010 11:41:43 +0100 Subject: [PATCH 1/6] fixed unistd.h portability issue --- eo/src/utils/eoLogger.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/eo/src/utils/eoLogger.cpp b/eo/src/utils/eoLogger.cpp index a0aa36e5..a729d0cf 100644 --- a/eo/src/utils/eoLogger.cpp +++ b/eo/src/utils/eoLogger.cpp @@ -26,7 +26,12 @@ Authors: */ +#ifdef _INTERIX +#include +#else // _INTERIX #include +#endif // ! _INTERIX + #include #include #include // used to define EOF From 979a1863784c53eed4ba4288e83c80832f89d3a2 Mon Sep 17 00:00:00 2001 From: Caner Candan Date: Wed, 17 Nov 2010 11:47:49 +0100 Subject: [PATCH 2/6] unit test for eoParser added --- eo/test/t-eoParser.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 eo/test/t-eoParser.cpp diff --git a/eo/test/t-eoParser.cpp b/eo/test/t-eoParser.cpp new file mode 100644 index 00000000..1fd6c7fd --- /dev/null +++ b/eo/test/t-eoParser.cpp @@ -0,0 +1,31 @@ +#include +#include + +int main(int ac, char** av) +{ + eoParser parser(ac, av); + + unsigned int alpha1 = parser.createParam(10, "alpha1", "Alpha parameter").value(); + unsigned int alpha2 = parser.createParam(10, "alpha2", "Alpha parameter").value(); + unsigned int alpha3 = parser.createParam(10, "alpha3", "Alpha parameter").value(); + unsigned int alpha4 = parser.createParam(10, "alpha4", "Alpha parameter").value(); + unsigned int alpha5 = parser.createParam(10, "alpha5", "Alpha parameter").value(); + unsigned int alpha6 = parser.createParam(10, "alpha6", "Alpha parameter").value(); + + if (parser.userNeedsHelp()) + { + parser.printHelp(std::cout); + exit(1); + } + + make_help(parser); + + std::cout << "alpha1: " << alpha1 << std::endl; + std::cout << "alpha2: " << alpha2 << std::endl; + std::cout << "alpha3: " << alpha3 << std::endl; + std::cout << "alpha4: " << alpha4 << std::endl; + std::cout << "alpha5: " << alpha5 << std::endl; + std::cout << "alpha6: " << alpha6 << std::endl; + + return 0; +} From fe231cd7013dc087ab27710062b986e954f851ac Mon Sep 17 00:00:00 2001 From: Caner Candan Date: Thu, 18 Nov 2010 10:47:29 +0100 Subject: [PATCH 3/6] forgot to add t-eoParser in test/CMakeLists.txt --- eo/test/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/eo/test/CMakeLists.txt b/eo/test/CMakeLists.txt index 4f194681..7dd931c6 100644 --- a/eo/test/CMakeLists.txt +++ b/eo/test/CMakeLists.txt @@ -65,6 +65,7 @@ SET (TEST_LIST t-eoExtendedVelocity t-eoLogger t-eoIQRStat + t-eoParser ) From 52b527409481092a95bca84551cce56f8fd591c9 Mon Sep 17 00:00:00 2001 From: Caner Candan Date: Thu, 18 Nov 2010 10:49:24 +0100 Subject: [PATCH 4/6] added some new scripts to specialize building and a build script for visual studio 2008 --- eo/build_gcc_linux_tutorial | 7 +++++++ eo/build_gcc_linux_unittest | 7 +++++++ eo/build_vs2008_release.bat | 5 +++++ eo/tutorial/CMakeLists.txt | 16 ++++++++++------ 4 files changed, 29 insertions(+), 6 deletions(-) create mode 100755 eo/build_gcc_linux_tutorial create mode 100755 eo/build_gcc_linux_unittest create mode 100644 eo/build_vs2008_release.bat diff --git a/eo/build_gcc_linux_tutorial b/eo/build_gcc_linux_tutorial new file mode 100755 index 00000000..f4168fd3 --- /dev/null +++ b/eo/build_gcc_linux_tutorial @@ -0,0 +1,7 @@ +#!/usr/bin/env sh + +mkdir release +cd release +cmake -DENABLE_EO_TUTORIAL=1 .. +make +cd .. diff --git a/eo/build_gcc_linux_unittest b/eo/build_gcc_linux_unittest new file mode 100755 index 00000000..36220ba0 --- /dev/null +++ b/eo/build_gcc_linux_unittest @@ -0,0 +1,7 @@ +#!/usr/bin/env sh + +mkdir debug +cd debug +cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_CMAKE_TESTING=1 .. +make +cd .. diff --git a/eo/build_vs2008_release.bat b/eo/build_vs2008_release.bat new file mode 100644 index 00000000..13513c14 --- /dev/null +++ b/eo/build_vs2008_release.bat @@ -0,0 +1,5 @@ +mkdir release +cd release +cmake -G "Visual Studio 9 2008" .. +cd .. +pause diff --git a/eo/tutorial/CMakeLists.txt b/eo/tutorial/CMakeLists.txt index 4573f0b4..6462b5a5 100644 --- a/eo/tutorial/CMakeLists.txt +++ b/eo/tutorial/CMakeLists.txt @@ -2,11 +2,15 @@ ### 1) Where must cmake go now ? ###################################################################################### -ADD_SUBDIRECTORY(Lesson1) -ADD_SUBDIRECTORY(Lesson2) -ADD_SUBDIRECTORY(Lesson3) -ADD_SUBDIRECTORY(Lesson4) -ADD_SUBDIRECTORY(Lesson5) -ADD_SUBDIRECTORY(Lesson6) +IF(ENABLE_EO_TUTORIAL) + + ADD_SUBDIRECTORY(Lesson1) + ADD_SUBDIRECTORY(Lesson2) + ADD_SUBDIRECTORY(Lesson3) + ADD_SUBDIRECTORY(Lesson4) + ADD_SUBDIRECTORY(Lesson5) + ADD_SUBDIRECTORY(Lesson6) + +ENDIF() ###################################################################################### From ea0bd040c1c4eaff99e5ae1ccf48a607420472e2 Mon Sep 17 00:00:00 2001 From: Caner Candan Date: Fri, 19 Nov 2010 11:50:51 +0100 Subject: [PATCH 5/6] changed pkg-config file creation process --- eo/CMakeLists.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/eo/CMakeLists.txt b/eo/CMakeLists.txt index eea4df29..7217df60 100644 --- a/eo/CMakeLists.txt +++ b/eo/CMakeLists.txt @@ -57,7 +57,7 @@ INCLUDE(ConfigureChecks.cmake) INCLUDE(Dart OPTIONNAL) # now create config headers -configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) +CONFIGURE_FILE(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) # Set a special flag if the environment is windows (should do the same in a config.g file) IF (WIN32) @@ -113,7 +113,11 @@ ADD_SUBDIRECTORY(tutorial) ### 6) Install pkg-config config file for EO ###################################################################################### -INSTALL(FILES eo.pc DESTINATION lib/pkgconfig COMPONENT headers) +SET(PCPREFIX "/usr") +SET(PCFLAGS "-leoutils -leo -les -lga -lcma -lgcov") +SET(PCINCLUDEDIR "eo") +CONFIGURE_FILE(pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/eo.pc) +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/eo.pc DESTINATION lib/pkgconfig COMPONENT headers) ###################################################################################### From 651ba9f89911045aa02cc08b3f3e89695a04411e Mon Sep 17 00:00:00 2001 From: Caner Candan Date: Fri, 19 Nov 2010 11:54:45 +0100 Subject: [PATCH 6/6] new pkg-config file --- eo/eo.pc | 12 ------------ eo/pc.cmake | 6 ++++++ eo/src/do/make_pop.h | 8 ++++---- 3 files changed, 10 insertions(+), 16 deletions(-) delete mode 100644 eo/eo.pc create mode 100644 eo/pc.cmake diff --git a/eo/eo.pc b/eo/eo.pc deleted file mode 100644 index d15d1081..00000000 --- a/eo/eo.pc +++ /dev/null @@ -1,12 +0,0 @@ -# Package Information for pkg-config - -prefix=/usr -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include/eo - -Name: Evolving Object -Description: Evolving Object -Version: 1.02-cvs1 -Libs: -L${libdir} -leoutils -leo -les -lga -lcma -leomoo -lgcov -Cflags: -I${includedir} diff --git a/eo/pc.cmake b/eo/pc.cmake new file mode 100644 index 00000000..ad3c17ef --- /dev/null +++ b/eo/pc.cmake @@ -0,0 +1,6 @@ +# Package Information for pkg-config +Name: @PACKAGE_NAME@ +Description: @PACKAGE_NAME@ +Version: @PROJECT_VERSION@ +Libs: -L@PCPREFIX@/lib @PCFLAGS@ +Cflags: -I@PCPREFIX@/include/@PCINCLUDEDIR@ diff --git a/eo/src/do/make_pop.h b/eo/src/do/make_pop.h index 76242cab..191ab065 100644 --- a/eo/src/do/make_pop.h +++ b/eo/src/do/make_pop.h @@ -57,17 +57,17 @@ template eoPop& do_make_pop(eoParser & _parser, eoState& _state, eoInit & _init) { // random seed - eoValueParam& seedParam = _parser.createParam(uint32_t(0), "seed", "Random number seed", 'S'); + eoValueParam& seedParam = _parser.getORcreateParam(uint32_t(0), "seed", "Random number seed", 'S'); if (seedParam.value() == 0) seedParam.value() = time(0); - eoValueParam& popSize = _parser.createParam(unsigned(20), "popSize", "Population Size", 'P', "Evolution Engine"); + eoValueParam& popSize = _parser.getORcreateParam(unsigned(20), "popSize", "Population Size", 'P', "Evolution Engine"); // Either load or initialize // create an empty pop and let the state handle the memory eoPop& pop = _state.takeOwnership(eoPop()); - eoValueParam& loadNameParam = _parser.createParam(std::string(""), "Load","A save file to restart from",'L', "Persistence" ); - eoValueParam & recomputeFitnessParam = _parser.createParam(false, "recomputeFitness", "Recompute the fitness after re-loading the pop.?", 'r', "Persistence" ); + eoValueParam& loadNameParam = _parser.getORcreateParam(std::string(""), "Load","A save file to restart from",'L', "Persistence" ); + eoValueParam & recomputeFitnessParam = _parser.getORcreateParam(false, "recomputeFitness", "Recompute the fitness after re-loading the pop.?", 'r', "Persistence" ); if (loadNameParam.value() != "") // something to load {