Skip to content
Snippets Groups Projects
Commit bbeea14f authored by Gigg, Martyn Anthony's avatar Gigg, Martyn Anthony
Browse files

Set cache variables for PYTHON_EXECUTABLE on windows

Also uses fin_package rather than handwritten code to find
Python libraries so unsetting code works as expected.
parent a9480e69
No related branches found
No related tags found
No related merge requests found
......@@ -99,12 +99,14 @@ if(MSVC)
set(PYTHON_VERSION_MAJOR 2)
set(PYTHON_VERSION_MINOR 7)
endif()
set(PYTHON_EXECUTABLE
${THIRD_PARTY_DIR}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/python.exe
)
set(_python_dir ${THIRD_PARTY_DIR}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
set(PYTHON_EXECUTABLE ${_python_dir}/python.exe CACHE FILEPATH "Location of python executable" FORCE)
set(PYTHONW_EXECUTABLE "${_python_dir}/pythonw.exe" CACHE FILEPATH
"The location of the pythonw executable. This suppresses the new terminal window on startup" FORCE )
set(THIRD_PARTY_BIN
"${THIRD_PARTY_DIR}/bin;${THIRD_PARTY_DIR}/lib/qt4/bin;${THIRD_PARTY_DIR}/lib/qt5/bin;${THIRD_PARTY_DIR}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}"
"${THIRD_PARTY_DIR}/bin;${THIRD_PARTY_DIR}/lib/qt4/bin;${THIRD_PARTY_DIR}/lib/qt5/bin;${_python_dir}"
)
unset(_python_dir)
message(STATUS "Third party dependencies are in ${THIRD_PARTY_DIR}")
# Add to the path so that cmake can configure correctly without the user
# having to do it
......
......@@ -31,7 +31,7 @@ string ( REGEX REPLACE "/" "\\\\" THIRD_PARTY_LIB_DIR "${THIRD_PARTY_DIR}/lib/"
# /external:I - Ignore third party library warnings (similar to "isystem" in GCC)
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \
/MP /W3 \
/experimental:external /external:W0 /external:I ${THIRD_PARTY_INCLUDE_DIR} /external:I ${THIRD_PARTY_LIB_DIR}\\python2.7\\ "
/experimental:external /external:W0 /external:I ${THIRD_PARTY_INCLUDE_DIR} /external:I ${THIRD_PARTY_LIB_DIR}\\python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}\\ "
)
# Set PCH heap limit, the default does not work when running msbuild from the commandline for some reason
......@@ -53,18 +53,9 @@ endif()
set ( Qt5_DIR ${THIRD_PARTY_DIR}/lib/qt5/lib/cmake/Qt5 )
###########################################################################
# On Windows we want to bundle Python.
# Python development
###########################################################################
set ( PYTHON_DIR ${THIRD_PARTY_DIR}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} )
## Set the variables that FindPythonLibs would set
set ( PYTHON_INCLUDE_PATH "${PYTHON_DIR}/Include" )
set ( PYTHON_LIBRARIES ${PYTHON_DIR}/libs/python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}.lib )
## The executable
set ( PYTHON_EXECUTABLE "${PYTHON_DIR}/python.exe" CACHE FILEPATH "The location of the python executable" FORCE )
# The "pythonw" executable that avoids raising another terminal when it runs. Used for IPython
set ( PYTHONW_EXECUTABLE "${PYTHON_DIR}/pythonw.exe" CACHE FILEPATH
"The location of the pythonw executable. This suppresses the new terminal window on startup" FORCE )
find_package ( PythonLibs REQUIRED )
###########################################################################
# If required, find tcmalloc
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment