Browse Source

fix python home and path on windows

python
Jørgen Lien Sellæg 7 years ago committed by Jørgen Sverre Lien Sellæg
parent
commit
1244f1a32f
  1. 4
      CMakeLists.txt
  2. 8
      src/python_interpreter.cc

4
CMakeLists.txt

@ -62,7 +62,7 @@ if(${CMAKE_VERSION} VERSION_GREATER 3.11.4)
find_path(Python3_INCLUDE_DIRS "Python.h" HINTS "${MINGW_INCLUDE_DIR}/python${MINGW_PYTHON_VERSION}m" NO_DEFAULT_PATH)
if (EXISTS ${Python3_LIBRARIES} AND EXISTS ${Python3_INCLUDE_DIRS})
set(Python3_FOUND True)
set(Python3_LIBRARY_DIRS "${MINGW_LIBRARY_DIR}/python${MINGW_PYTHON_VERSION}")
set(Python3_LIBRARY_DIRS ${MINGW_LIBRARY_DIR})
set(Python3_VERSION_MAJOR 3)
set(Python3_VERSION_MINOR 7)
endif()
@ -76,7 +76,6 @@ endif()
if(${Python3_FOUND})
if(${CMAKE_HOST_WIN32})
set(PYTHONLIBS_FOUND True)
set(PYTHON_MODULE_EXTENSION True)
endif()
set(PYTHONLIBS_FOUND ${Python3_FOUND})
@ -99,6 +98,7 @@ endif()
if(${PYGOBJECT_FOUND})
add_definitions(-DJUCI_ENABLE_PLUGINS)
add_definitions(-DPYTHON_HOME_DIR=L"${PYTHON_LIBRARY_DIR}")
else()
message(STATUS "Python or pygobject not found. Building juCi++ without plugin support.")
endif()

8
src/python_interpreter.cc

@ -27,5 +27,13 @@ Python::Interpreter::~Interpreter() {
}
Python::Interpreter::Interpreter() {
#ifdef PYTHON_HOME_DIR
#ifdef _WIN32
const std::wstring python_home(PYTHON_HOME_DIR);
const std::wstring python_path(python_home + L";" + python_home + L"\\lib-dynload;" + python_home + L"\\site-packages" );
Py_SetPythonHome(python_home.c_str());
Py_SetPath(python_path.c_str());
#endif
#endif
py::initialize_interpreter();
}

Loading…
Cancel
Save