Commit 588ac773 authored by Davis King's avatar Davis King

Improved error message when boost isn't found.

parent e44a2e23
...@@ -59,59 +59,57 @@ if (PYTHON3) ...@@ -59,59 +59,57 @@ if (PYTHON3)
FIND_PACKAGE(Boost 1.41.0 COMPONENTS python-py34 ) FIND_PACKAGE(Boost 1.41.0 COMPONENTS python-py34 )
if (NOT Boost_FOUND) if (NOT Boost_FOUND)
# But if you don't find it then try looking for a module called python. # But if you don't find it then try looking for a module called python.
FIND_PACKAGE(Boost 1.41.0 COMPONENTS python REQUIRED) FIND_PACKAGE(Boost 1.41.0 COMPONENTS python)
endif() endif()
FIND_PACKAGE(PythonLibs 3.4 REQUIRED) FIND_PACKAGE(PythonLibs 3.4 REQUIRED)
else() else()
FIND_PACKAGE(Boost 1.41.0 COMPONENTS python REQUIRED) FIND_PACKAGE(Boost 1.41.0 COMPONENTS python)
FIND_PACKAGE(PythonLibs 2.6 REQUIRED) FIND_PACKAGE(PythonLibs 2.6 REQUIRED)
endif() endif()
if (NOT Boost_FOUND) if (NOT Boost_FOUND)
message(STATUS " *****************************************************************************************************")
if (WIN32) if (WIN32)
message(" Set the BOOST_ROOT and BOOST_LIBRARYDIR environment variables before running cmake. ") message(STATUS "We couldn't find the right version of boost python. If you installed boost and you are still "
message(" E.g. Something like this: ")
message(" set BOOST_ROOT=C:\\local\\boost_1_57_0 " )
message(" set BOOST_LIBRARYDIR=C:\\local\\boost_1_57_0\\stage\\lib")
message("")
message(" You will also likely need to compile boost yourself rather than using one of the precompiled ")
message(" windows binaries. Do this by going to the folder tools\\build\\ within boost and running ")
message(" bootstrap.bat. Then run the command: ")
message(" b2 install")
message(" And then add the output bin folder to your PATH. Usually this is the C:\\boost-build-engine\\bin")
message(" folder. Finally, go to the boost root and run a command like this:")
message(" b2 --with-python address-model=64 toolset=msvc --build-type=complete")
message(" When it completes, set BOOST_LIBRARYDIR equal to wherever b2 put the compiled libraries.")
message(" Note that you will need to set the address-model based on if you want a 32 or 64bit python library.")
message("")
message(" Next, when you invoke cmake to compile dlib you may have to use cmake's -G option to set the ")
message(" 64 vs. 32bit mode of visual studio. Also, if you want a Python3 library you will need to ")
message(" add -DPYTHON3=1. You do this with a statement like: ")
message(" cmake -G \"Visual Studio 12 2013 Win64\" -DPYTHON3=1 ..\\..\\tools\\python")
message(" Rather than:")
message(" cmake ..\\..\\tools\\python")
message(" Which will build a 32bit Python2 module by default on most systems.")
message("")
else()
message("")
message(" *****************************************************************************************************")
message(" To compile Boost.Python yourself download boost from boost.org and then go into the boost root folder")
message(" and run these commands: ")
message(" ./bootstrap.sh --with-libraries=python")
message(" ./b2")
message(" sudo ./b2 install")
message(" *****************************************************************************************************")
message("")
endif()
endif()
if (WIN32 AND NOT Boost_LIBRARIES)
message(FATAL_ERROR "We couldn't find the right version of boost python. If you installed boost and you are still "
"getting this error then you might have installed a version of boost that was compiled with a different " "getting this error then you might have installed a version of boost that was compiled with a different "
"version of visual studio than the one you are using. So you have to make sure that the version of " "version of visual studio than the one you are using. So you have to make sure that the version of "
"visual studio is the same version that was used to compile the copy of boost you are using.") "visual studio is the same version that was used to compile the copy of boost you are using.")
message(STATUS " Set the BOOST_ROOT and BOOST_LIBRARYDIR environment variables before running cmake. ")
message(STATUS " E.g. Something like this: ")
message(STATUS " set BOOST_ROOT=C:\\local\\boost_1_57_0 " )
message(STATUS " set BOOST_LIBRARYDIR=C:\\local\\boost_1_57_0\\stage\\lib")
message(STATUS "")
message(STATUS " You will also likely need to compile boost yourself rather than using one of the precompiled ")
message(STATUS " windows binaries. Do this by going to the folder tools\\build\\ within boost and running ")
message(STATUS " bootstrap.bat. Then run the command: ")
message(STATUS " b2 install")
message(STATUS " And then add the output bin folder to your PATH. Usually this is the C:\\boost-build-engine\\bin")
message(STATUS " folder. Finally, go to the boost root and run a command like this:")
message(STATUS " b2 --with-python address-model=64 toolset=msvc --build-type=complete")
message(STATUS " When it completes, set BOOST_LIBRARYDIR equal to wherever b2 put the compiled libraries.")
message(STATUS " Note that you will need to set the address-model based on if you want a 32 or 64bit python library.")
message(STATUS "")
message(STATUS " Next, when you invoke cmake to compile dlib you may have to use cmake's -G option to set the ")
message(STATUS " 64 vs. 32bit mode of visual studio. Also, if you want a Python3 library you will need to ")
message(STATUS " add -DPYTHON3=1. You do this with a statement like: ")
message(STATUS " cmake -G \"Visual Studio 12 2013 Win64\" -DPYTHON3=1 ..\\..\\tools\\python")
message(STATUS " Rather than:")
message(STATUS " cmake ..\\..\\tools\\python")
message(STATUS " Which will build a 32bit Python2 module by default on most systems.")
message(STATUS "")
else()
message(STATUS " To compile Boost.Python yourself download boost from boost.org and then go into the boost root folder")
message(STATUS " and run these commands: ")
message(STATUS " ./bootstrap.sh --with-libraries=python")
message(STATUS " ./b2")
message(STATUS " sudo ./b2 install")
endif()
message(STATUS " *****************************************************************************************************")
message(FATAL_ERROR " Boost python library not found. ")
endif() endif()
INCLUDE_DIRECTORIES("${Boost_INCLUDE_DIRS}") INCLUDE_DIRECTORIES("${Boost_INCLUDE_DIRS}")
if (PYTHON_INCLUDE_PATH) if (PYTHON_INCLUDE_PATH)
INCLUDE_DIRECTORIES("${PYTHON_INCLUDE_PATH}" ) INCLUDE_DIRECTORIES("${PYTHON_INCLUDE_PATH}" )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment