* pyeo: updated pyeo in order to make it works

This commit is contained in:
Caner Candan 2011-05-04 17:29:45 +02:00
commit 688003e559
4 changed files with 28 additions and 19 deletions

View file

@ -16,13 +16,19 @@
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# change this to your local boost-path # change this to your local boost-path
SET(BOOST_PATH "C:/development/libs/os/boost/boost_1_33_1") # SET(BOOST_PATH "C:/development/libs/os/boost/boost_1_33_1")
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(PyEO) PROJECT(PyEO)
FIND_PACKAGE(Boost 1.42 COMPONENTS program_options python)
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
# python # python
IF(APPLE) IF(APPLE)
@ -38,10 +44,10 @@ IF(APPLE)
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH}) INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})
# boost # boost
SET(BOOST_INC ${BOOST_PATH}) # SET(BOOST_INC ${BOOST_PATH})
INCLUDE_DIRECTORIES(${BOOST_INC}) # INCLUDE_DIRECTORIES(${BOOST_INC})
SET(BOOST_LIBRARY ${BOOST_PATH}/libs/python/build/bin-stage/) # SET(BOOST_LIBRARY ${BOOST_PATH}/libs/python/build/bin-stage/)
SET(BOOSTPYTHON_LIBRARY ${BOOST_LIBRARY}/boost_python) # SET(BOOSTPYTHON_LIBRARY ${BOOST_LIBRARY}/boost_python)
# osx internal # osx internal
find_library(APPLE_CARBON Carbon) find_library(APPLE_CARBON Carbon)
@ -54,10 +60,10 @@ ELSE(APPLE)
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH}) INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})
# boost # boost
SET(BOOST_INC ${BOOST_PATH}) # SET(BOOST_INC ${BOOST_PATH})
INCLUDE_DIRECTORIES(${BOOST_INC}) # INCLUDE_DIRECTORIES(${BOOST_INC})
SET(BOOST_LIBRARY ${BOOST_PATH}/libs/python/build/bin-stage/) # SET(BOOST_LIBRARY ${BOOST_PATH}/libs/python/build/bin-stage/)
SET(BOOSTPYTHON_LIBRARY ${BOOST_LIBRARY}/boost_python) # SET(BOOSTPYTHON_LIBRARY ${BOOST_LIBRARY}/boost_python)
ENDIF(APPLE) ENDIF(APPLE)
@ -84,8 +90,11 @@ ENDIF(WIN32 AND NOT CYGWIN)
# add the libs # add the libs
if(APPLE) if(APPLE)
target_link_libraries(PyEO ${APPLE_CARBON} ${PYTHON_LIBRARY} ${BOOSTPYTHON_LIBRARY} ) target_link_libraries(PyEO ${APPLE_CARBON} ${PYTHON_LIBRARY} ${Boost_LIBRARIES}
#${BOOSTPYTHON_LIBRARY}
)
else(APPLE) else(APPLE)
target_link_libraries(PyEO ${PYTHON_LIBRARY} ${BOOSTPYTHON_LIBRARY} ) target_link_libraries(PyEO ${PYTHON_LIBRARY} ${Boost_LIBRARIES}
#${BOOSTPYTHON_LIBRARY}
)
endif(APPLE) endif(APPLE)

View file

@ -10,7 +10,7 @@ CPPFLAGS = -Wall -O2 #-g #-O2
LDFLAGS = LDFLAGS =
COMPILE = $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c COMPILE = $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c
LINK = $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) LINK = $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS)
INC=-I/usr/include/python2.4 -I.. -I../.. -ftemplate-depth-50 INC=-I/usr/include/python2.6 -I.. -I../.. -ftemplate-depth-50
OBJECTS=eoFunctorStore.o PyEO.o abstract1.o algos.o \ OBJECTS=eoFunctorStore.o PyEO.o abstract1.o algos.o \
random_numbers.o geneticOps.o selectOne.o continuators.o\ random_numbers.o geneticOps.o selectOne.o continuators.o\
@ -26,7 +26,7 @@ clean:
rm PyEO/*.so *.o test/*.pyc rm PyEO/*.so *.o test/*.pyc
PyEO/PyEO.so: $(OBJECTS) PyEO/PyEO.so: $(OBJECTS)
$(LINK) -o PyEO/PyEO.so $(OBJECTS) -lboost_python -lpython2.4 ${LIB} -shared #-lstlport $(LINK) -o PyEO/PyEO.so $(OBJECTS) -lboost_python -lpython2.6 ${LIB} -shared #-lstlport
eoFunctorStore.o: ../eoFunctorStore.h ../eoFunctorStore.cpp eoFunctorStore.o: ../eoFunctorStore.h ../eoFunctorStore.cpp
$(COMPILE) -o eoFunctorStore.o ../eoFunctorStore.cpp $(INC) $(COMPILE) -o eoFunctorStore.o ../eoFunctorStore.cpp $(INC)

View file

@ -21,9 +21,9 @@
#ifndef PICKLE_H #ifndef PICKLE_H
#define PICKLE_h #define PICKLE_h
#ifndef WIN32 // #ifndef WIN32
#include <config.h> // #include <config.h>
#endif // #endif
#include <boost/python.hpp> #include <boost/python.hpp>
#include <sstream> #include <sstream>

View file

@ -99,7 +99,7 @@ void random_numbers()
.def("rand", &eoRng::rand) .def("rand", &eoRng::rand)
.def("rand_max", &eoRng::rand_max) .def("rand_max", &eoRng::rand_max)
.def("reseed", &eoRng::reseed) .def("reseed", &eoRng::reseed)
.def("uniform", &eoRng::uniform) // .def("uniform", &eoRng::uniform)
.def("normal", normal) .def("normal", normal)
.def("negexp", &eoRng::negexp) .def("negexp", &eoRng::negexp)
.def("to_string", rng_to_string) .def("to_string", rng_to_string)