# #Python script interpreter # #Build from sources and install where find_package(python) will find it. #We build libpython as a shared library so that other host tools can use it. #For example, various neural network frameworks like Caffe and TensorFlow #want to link with Python to provide a scripting language for training neural #networks. # if (WIN32) ExternalProject_Add ( python3 PREFIX ${CMAKE_INSTALL_PREFIX} URL https://github.com/python-cmake-buildsystem/python-cmake-buildsystem/archive/cc93717837469bcd36746b91739949f100e64123.zip URL_MD5 e77917ab0d2f6bc45326611dc7c8c288 PATCH_COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_LIST_DIR}/patch . CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= -DPYTHON_VERSION:STRING=3.5.2 -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_LIBPYTHON_SHARED:BOOL=ON -DINSTALL_WINDOWS_TRADITIONAL:BOOL=OFF -DBUILD_WININST:BOOL=OFF -DBUILD_WININST_ALWAYS:BOOL=OFF -DINSTALL_MANUAL:BOOL=OFF -DINSTALL_TEST:BOOL=OFF ) endif (WIN32) if (UNIX) #Rely on manual installation via the package manager #You can then invoke python as /usr/bin/python3 #sudo apt-get install python3 ExternalProject_Add ( python3 PREFIX ${CMAKE_INSTALL_PREFIX} BUILD_IN_SOURCE 1 DOWNLOAD_COMMAND "" UPDATE_COMMAND "" CONFIGURE_COMMAND "" BUILD_COMMAND /usr/bin/python3 --version INSTALL_COMMAND "" ) endif (UNIX)