Making it easier to switch between python 2 and 3...
@@ -38,6 +38,7 @@ set( INCLUDE_LUA_DESC "Specifies whether to build Malmo with Lua binding
set( INCLUDE_PYTHON_DESC "Specifies whether to build Malmo with Python bindings" )
set( INCLUDE_TORCH_DESC "Specifies whether to build Malmo with Torch bindings (Linux only)" )
set( STATIC_BOOST_DESC "Specifies whether to link Malmo statically against Boost" )
+set( PYTHON_OLD_DESC "Specifies whether to build for use with Python 2 (PYTHON_OLD=ON) or Python 3 (the default)" )
set( BUILD_MOD ON CACHE BOOL ${BUILD_MOD_DESC} )
set( BUILD_DOCUMENTATION ON CACHE BOOL ${BUILD_DOCUMENTATION_DESC} )
set( INCLUDE_ALE OFF CACHE BOOL ${INCLUDE_ALE_DESC} )
@@ -45,10 +46,15 @@ set( INCLUDE_CSHARP ON CACHE BOOL ${INCLUDE_CSHARP_DESC} )
set( INCLUDE_JAVA ON CACHE BOOL ${INCLUDE_JAVA_DESC} )
set( INCLUDE_PYTHON ON CACHE BOOL ${INCLUDE_PYTHON_DESC} )
set( STATIC_BOOST OFF CACHE BOOL ${STATIC_BOOST_DESC} )
+set( PYTHON_OLD OFF CACHE BOOL ${PYTHON_OLD_DESC} )
if( INCLUDE_PYTHON )
- set( USE_PYTHON_VERSIONS_DESC "Specifies which versions of Python to build Malmo with Python bindings" )
+ set( USE_PYTHON_VERSIONS_DESC "Specifies which version of Python to build Malmo with Python bindings" )
+ if ( PYTHON_OLD )
set( USE_PYTHON_VERSIONS 2.7 CACHE STRING ${USE_PYTHON_VERSIONS_DESC} )
+ else
+ set( USE_PYTHON_VERSIONS 3.6 CACHE STRING ${USE_PYTHON_VERSIONS_DESC} )
+ endif()
endif()
if( UNIX AND NOT APPLE )
set( INCLUDE_LUA ON CACHE BOOL ${INCLUDE_LUA_DESC} )
@@ -95,11 +101,19 @@ SET(Boost_ADDITIONAL_VERSIONS "1.60" "1.60.0")
SET(Boost_ADDITIONAL_VERSIONS "1.61" "1.61.0")
SET(Boost_ADDITIONAL_VERSIONS "1.62" "1.62.0")
SET(Boost_ADDITIONAL_VERSIONS "1.63" "1.63.0")
+SET(Boost_ADDITIONAL_VERSIONS "1.64" "1.64.0")
+SET(Boost_ADDITIONAL_VERSIONS "1.65" "1.65.0")
+SET(Boost_ADDITIONAL_VERSIONS "1.65.1" "1.65.1")
+
+BOOST_PYTHON_MODULE_NAME = "python"
+if ( USE_PYTHON_VERSIONS >= 3 )
+ BOOST_PYTHON_MODULE_NAME = "python3"
+
if( WIN32 )
SET(Boost_USE_STATIC_LIBS ON)
- find_package( Boost COMPONENTS chrono date_time filesystem iostreams program_options python regex system thread zlib REQUIRED )
+ find_package( Boost COMPONENTS chrono date_time filesystem iostreams program_options ${BOOST_PYTHON_MODULE_NAME} regex system thread zlib REQUIRED )
else()
- find_package( Boost COMPONENTS chrono date_time filesystem iostreams program_options python regex system thread REQUIRED )
+ find_package( Boost COMPONENTS chrono date_time filesystem iostreams program_options ${BOOST_PYTHON_MODULE_NAME} regex system thread REQUIRED )
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
find_package( Threads REQUIRED )
SET(Boost_USE_STATIC_LIBS ${STATIC_BOOST})
