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

All possible info about Python used during the build.

parent 2d6627ca
No related branches found
No related tags found
No related merge requests found
...@@ -25,12 +25,25 @@ ...@@ -25,12 +25,25 @@
bool SysPath::runTest() bool SysPath::runTest()
{ {
// Python build info
std::cout << "pythonExecutable():" << BABuild::pythonExecutable() << std::endl;
std::cout << "pythonVersionString():" << BABuild::pythonVersionString() << std::endl;
std::cout << "pythonLibraries():" << BABuild::pythonLibraries() << std::endl;
std::cout << "pythonIncludeDirs():" << BABuild::pythonIncludeDirs() << std::endl;
std::cout << "pythonLibsVersionString():" << BABuild::pythonLibsVersionString() << std::endl;
std::cout << "numpyIncludeDir():" << BABuild::numpyIncludeDir() << std::endl;
std::cout << "numpyVersionString():" << BABuild::numpyVersionString() << std::endl;
// BornAgain build
std::cout << "buildLibDir(): " << BABuild::buildLibDir() << std::endl;
// Runtime environment
std::cout << "PYTHONPATH: " << SysUtils::getenv("PYTHONPATH") << std::endl; std::cout << "PYTHONPATH: " << SysUtils::getenv("PYTHONPATH") << std::endl;
std::cout << "PYTHONHOME: " << SysUtils::getenv("PYTHONHOME") << std::endl; std::cout << "PYTHONHOME: " << SysUtils::getenv("PYTHONHOME") << std::endl;
std::cout << "BUILD_LIB_DIR: " << BABuild::buildLibDir() << std::endl;
Py_Initialize(); Py_Initialize();
// Runtime Python's sys.path
PyObject *sysPath = PySys_GetObject((char*)"path"); PyObject *sysPath = PySys_GetObject((char*)"path");
auto content = PyEmbeddedUtils::toVectorString(sysPath); auto content = PyEmbeddedUtils::toVectorString(sysPath);
for (auto s : content) for (auto s : content)
......
...@@ -22,7 +22,17 @@ namespace BABuild ...@@ -22,7 +22,17 @@ namespace BABuild
std::string cmakeBinaryDir() { return "@CMAKE_BINARY_DIR@"; } std::string cmakeBinaryDir() { return "@CMAKE_BINARY_DIR@"; }
std::string buildLibDir() { return "@CMAKE_BINARY_DIR@/lib"; } std::string buildLibDir() { return "@CMAKE_BINARY_DIR@/lib"; }
std::string buildBinDir() { return "@CMAKE_BINARY_DIR@/bin"; } std::string buildBinDir() { return "@CMAKE_BINARY_DIR@/bin"; }
//! Methods to access info about Python used during the build.
std::string pythonExecutable() { return "@PYTHON_EXECUTABLE@"; } std::string pythonExecutable() { return "@PYTHON_EXECUTABLE@"; }
std::string pythonVersionString() { return "@PYTHON_VERSION_STRING@"; }
std::string pythonLibraries() { return "@PYTHON_LIBRARIES@"; }
std::string pythonIncludeDirs() { return "@PYTHON_INCLUDE_DIRS@"; }
std::string pythonLibsVersionString() { return "@PYTHONLIBS_VERSION_STRING@"; }
std::string numpyIncludeDir() { return "@NUMPY_INCLUDE_DIR@"; }
std::string numpyVersionString() { return "@NUMPY_VERSION_STRING@"; }
} }
#endif #endif
......
...@@ -31,6 +31,7 @@ else() ...@@ -31,6 +31,7 @@ else()
OUTPUT_VARIABLE numpy_version_number OUTPUT_VARIABLE numpy_version_number
RESULT_VARIABLE numpy_return_value RESULT_VARIABLE numpy_return_value
OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_STRIP_TRAILING_WHITESPACE)
set (NUMPY_VERSION_STRING ${numpy_version_number})
endif() endif()
endif() endif()
...@@ -46,3 +47,4 @@ endif() ...@@ -46,3 +47,4 @@ endif()
MARK_AS_ADVANCED (NUMPY_INCLUDE_DIR) MARK_AS_ADVANCED (NUMPY_INCLUDE_DIR)
MARK_AS_ADVANCED (NUMPY_VERSION_STRING)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment