Skip to content
Snippets Groups Projects
Commit 9039d454 authored by Pospelov, Gennady's avatar Pospelov, Gennady
Browse files

PythonAPI and corresponding functional tests are fully working from Windows

parent f8bb6d63
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,7 @@ include($$PWD/shared.pri)
SUBDIRS += Core
SUBDIRS += ThirdParty/gtest
SUBDIRS += Tests/UnitTests/TestCore
#TestCore.depends = ThirdParty/gtest
TestCore.depends = ThirdParty/gtest
SUBDIRS += Tests/FunctionalTests/TestCore
......
......@@ -349,5 +349,14 @@ target.path = $$PWD/../lib
INSTALLS += target
QMAKE_DISTCLEAN += $$target.path/$(TARGET)
isEmpty(MAKEFILE): MAKEFILE="Makefile"
# for python import in Windows we need another extention and preffix
win32{
extra_install.path = $$PWD\..\lib
extra_install.extra = $(COPY) /y \"release\BornAgainCore.dll\" \"release\libBornAgainCore.pyd\"
extra_install.files = $$PWD\release\libBornAgainCore.pyd
INSTALLS += extra_install
}
QMAKE_POST_LINK = $$MAKE_COMMAND -f $${MAKEFILE} install
......@@ -96,5 +96,14 @@ target.path = $$PWD/../lib
INSTALLS += target
QMAKE_DISTCLEAN += $$target.path/$(TARGET)
isEmpty(MAKEFILE): MAKEFILE="Makefile"
QMAKE_POST_LINK = $$MAKE_COMMAND -f $${MAKEFILE} install
# for python import in Windows we need another extention and preffix
win32{
extra_install.path = $$PWD\..\lib
extra_install.extra = $(COPY) /y \"release\BornAgainFit.dll\" \"release\libBornAgainFit.pyd\"
extra_install.files = $$PWD\release\libBornAgainFit.pyd
INSTALLS += extra_install
}
QMAKE_POST_LINK+= $$MAKE_COMMAND -f $${MAKEFILE} install
......@@ -2,7 +2,7 @@
# Common settings for all BornAgain compilations
# -----------------------------------------------------------------------------
#CONFIG += BORNAGAIN_PYTHON # provide python bindings compilation
CONFIG += BORNAGAIN_PYTHON # provide python bindings compilation
win32 {
MAKE_COMMAND = mingw32-make
......@@ -279,26 +279,42 @@ CONFIG(BORNAGAIN_PYTHON) {
WhichPython=$$system(which python)
}
win32 {
WhichPython="C:/Python27"
WhichPython="C:/Python27/python.exe"
}
isEmpty(WhichPython) {
# we do not have python
error("Can not find any sign of python")
} else {
#pythonsysincdir=$$system("$${WhichPython} -c \"import sys; sys.stdout.write(sys.prefix + \'/include/python\' + sys.version[:3])\" ")
#pythonsyslibdir=$$system("$${WhichPython} -c \"import sys; sys.stdout.write(sys.prefix + \'/libs\' )\" ")
pythonvers=$$system("$${WhichPython} -c \"import sys; sys.stdout.write(sys.version[:3])\" ")
pythonnumpy=$$system("$${WhichPython} -c \"import sys; import numpy; sys.stdout.write(numpy.get_include())\" ")
# we have python
pythonvers=$$system("python -c \"import sys; sys.stdout.write(sys.version[:3])\" ")
macx|unix {
pythonsysincdir=$$system("python -c 'import sys; sys.stdout.write(sys.prefix + \"/include/python\" + sys.version[:3])'")
pythonsyslibdir=$$system("python -c 'import sys; sys.stdout.write(sys.prefix + \"/lib\" )'")
pythonsysincdir=$$system("$${WhichPython} -c \"import sys; sys.stdout.write(sys.prefix + \'/include/python\' + sys.version[:3])\" ")
pythonsyslibdir=$$system("$${WhichPython} -c \"import sys; sys.stdout.write(sys.prefix + \'/lib\' )\" ")
# pythonvers=$$system("python -c \"import sys; sys.stdout.write(sys.version[:3])\" ")
# pythonsysincdir=$$system("python -c 'import sys; sys.stdout.write(sys.prefix + \"/include/python\" + sys.version[:3])'")
# pythonsyslibdir=$$system("python -c 'import sys; sys.stdout.write(sys.prefix + \"/lib\" )'")
# pythonnumpy=$$system("python -c \"import sys; import numpy; sys.stdout.write(numpy.get_include())\" ")
}
win32 {
pythonsysincdir=$${WhichPython}/include
pythonsyslibdir=$${WhichPython}/libs
pythonsysincdir=$$system("$${WhichPython} -c \"import sys; sys.stdout.write(sys.prefix + \'/include')\" ")
pythonsyslibdir=$$system("$${WhichPython} -c \"import sys; sys.stdout.write(sys.prefix + \'/libs\' )\" ")
# pythonsysincdir=$${WhichPython}/include
# pythonsyslibdir=$${WhichPython}/libs
# pythonvers=$$system("$${WhichPython}/python.exe -c \"import sys; sys.stdout.write(sys.version[:3])\" ")
# pythonnumpy=$$system("$${WhichPython}/python.exe -c \"import sys; import numpy; sys.stdout.write(numpy.get_include())\" ")
}
message(we have python)
message($$pythonvers)
message($$pythonsysincdir)
message($$pythonsyslibdir)
# pythonsysincdir=$$system("$${WhichPython} -c \"import sys; sys.stdout.write(sys.prefix + \'/include/python\' + sys.version[:3])\" ")
# pythonsyslibdir=$$system("$${WhichPython} -c \"import sys; sys.stdout.write(sys.prefix + \'/libs\' )\" ")
# pythonvers=$$system("$${WhichPython} -c \"import sys; sys.stdout.write(sys.version[:3])\" ")
# pythonnumpy=$$system("$${WhichPython} -c \"import sys; import numpy; sys.stdout.write(numpy.get_include())\" ")
message(pythonvers : $$pythonvers)
message(pythoninc : $$pythonsysincdir)
message(pythonlib : $$pythonsyslibdir)
message(pythonnumpy: $$pythonnumpy)
lessThan(pythonvers, 2.6): error("BornAgain requires python 2.6 or greater")
INCLUDEPATH += $$pythonsysincdir
#LIBS += -L$$pythonsyslibdir -lpython$$pythonvers -lboost_python
......@@ -308,10 +324,9 @@ CONFIG(BORNAGAIN_PYTHON) {
win32 {
PYTHON_LIB_DIRECTIVE="-lpython27"
}
LIBS += -lboost_python -L$$pythonsyslibdir $$PYTHON_LIB_DIRECTIVE
LIBS += -lboost_python$${BOOST_LIB_SUFFIX} -L$$pythonsyslibdir $$PYTHON_LIB_DIRECTIVE
# we need to know the location of numpy
pythonnumpy=$$system("python -c \"import sys; import numpy; sys.stdout.write(numpy.get_include())\" ")
!exists($$pythonnumpy/numpy/arrayobject.h): error("Can't find numpy/arrayobject.h in $$pythonnumpy, you have to install python-numpy-devel")
INCLUDEPATH += $$pythonnumpy
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment