Support for Python 3 on Linux
This commit is contained in:
parent
5c3af1f5a5
commit
98a90496f6
|
@ -19,7 +19,7 @@ namespace carla {
|
|||
|
||||
static bool ThisThreadHasTheGIL() {
|
||||
#ifdef LIBCARLA_WITH_PYTHON_SUPPORT
|
||||
# ifdef PYTHON3X
|
||||
# if PY_MAJOR_VERSION >= 3
|
||||
return PyGILState_Check();
|
||||
# else
|
||||
PyThreadState *tstate = _PyThreadState_Current;
|
||||
|
|
|
@ -51,7 +51,7 @@ template <typename T>
|
|||
static auto GetRawDataAsBuffer(T &self) {
|
||||
auto *data = reinterpret_cast<unsigned char *>(self.data());
|
||||
auto size = sizeof(typename T::value_type) * self.size();
|
||||
#if PYTHON3X // NOTE(Andrei): python 3
|
||||
#if PY_MAJOR_VERSION >= 3 // NOTE(Andrei): python 3
|
||||
auto *ptr = PyMemoryView_FromMemory(reinterpret_cast<char *>(data), size, PyBUF_READ);
|
||||
#else // NOTE(Andrei): python 2
|
||||
auto *ptr = PyBuffer_FromMemory(data, size);
|
||||
|
|
|
@ -52,7 +52,7 @@ while true; do
|
|||
LIBCARLA_RELEASE=true;
|
||||
LIBCARLA_DEBUG=true;
|
||||
PYTHON_API_2=true;
|
||||
PYTHON_API_3=false; # @todo Python 3 not supported yet.
|
||||
PYTHON_API_3=true;
|
||||
shift ;;
|
||||
--libcarla-release )
|
||||
LIBCARLA_RELEASE=true;
|
||||
|
|
|
@ -45,3 +45,5 @@ function move_if_changed {
|
|||
copy_if_changed $1 $2
|
||||
rm -f $1
|
||||
}
|
||||
|
||||
CARLA_BUILD_CONCURRENCY=`nproc --all`
|
||||
|
|
|
@ -44,7 +44,7 @@ CarlaUE4Editor: LibCarla
|
|||
|
||||
.PHONY: PythonAPI
|
||||
PythonAPI: LibCarla
|
||||
@${CARLA_BUILD_TOOLS_FOLDER}/BuildPythonAPI.sh --py2
|
||||
@${CARLA_BUILD_TOOLS_FOLDER}/BuildPythonAPI.sh --py2 --py3
|
||||
|
||||
.PHONY: LibCarla
|
||||
LibCarla: setup
|
||||
|
|
|
@ -99,10 +99,19 @@ else
|
|||
./bootstrap.sh \
|
||||
--with-toolset=clang \
|
||||
--prefix=../boost-install \
|
||||
--with-libraries=python,filesystem
|
||||
./b2 clean
|
||||
./b2 toolset="${BOOST_TOOLSET}" cxxflags="${BOOST_CFLAGS}" --prefix="../${BOOST_BASENAME}-install" -j 12 stage release
|
||||
./b2 install toolset="${BOOST_TOOLSET}" cxxflags="${BOOST_CFLAGS}" --prefix="../${BOOST_BASENAME}-install" -j 12
|
||||
--with-libraries=python,filesystem \
|
||||
--with-python=/usr/bin/python2 --with-python-root=/usr
|
||||
./b2 toolset="${BOOST_TOOLSET}" cxxflags="${BOOST_CFLAGS}" --prefix="../${BOOST_BASENAME}-install" -j ${CARLA_BUILD_CONCURRENCY} stage release
|
||||
./b2 toolset="${BOOST_TOOLSET}" cxxflags="${BOOST_CFLAGS}" --prefix="../${BOOST_BASENAME}-install" -j ${CARLA_BUILD_CONCURRENCY} install
|
||||
./b2 toolset="${BOOST_TOOLSET}" cxxflags="${BOOST_CFLAGS}" --prefix="../${BOOST_BASENAME}-install" -j ${CARLA_BUILD_CONCURRENCY} --clean-all
|
||||
|
||||
./bootstrap.sh \
|
||||
--with-toolset=clang \
|
||||
--prefix=../boost-install \
|
||||
--with-libraries=python \
|
||||
--with-python=/usr/bin/python3 --with-python-root=/usr
|
||||
./b2 toolset="${BOOST_TOOLSET}" cxxflags="${BOOST_CFLAGS}" --prefix="../${BOOST_BASENAME}-install" -j ${CARLA_BUILD_CONCURRENCY} stage release
|
||||
./b2 toolset="${BOOST_TOOLSET}" cxxflags="${BOOST_CFLAGS}" --prefix="../${BOOST_BASENAME}-install" -j ${CARLA_BUILD_CONCURRENCY} install
|
||||
|
||||
popd >/dev/null
|
||||
|
||||
|
|
Loading…
Reference in New Issue