Commit 08c99479 authored by Utkarsh Ayachit's avatar Utkarsh Ayachit

Fixing matplotlib build on Mac.

Set PYTHONPATH correctly so that matplotlib can locate numpy.

Change-Id: I65df3aed9a2f7e1ceeeffadc8a6e561b40640d98
parent 4a6cda5e
......@@ -159,10 +159,14 @@ include(szip)
include(visitbridge)
include(zlib)
if (UNIX OR APPLE)
# since currently, freetype is not supported in windows. It will be soon.
include(freetype)
endif()
if (UNIX AND NOT APPLE)
include(ffmpeg)
include(fontconfig)
include(freetype)
include(mesa)
endif()
......
# INPUT VARIABLES:
# MATPLOTLIB_INSTALL_DIR
# MATPLOTLIB_SOURCE_DIR
# NUMPY_INSTALL_DIR
# PYTHON_EXECUTABLE
# ${pv_python_executable} setup.py install --prefix=${_install_location}
# Find the location of numpy
file(GLOB_RECURSE numpy-egg "${NUMPY_INSTALL_DIR}/lib/*.egg-info")
# message("${NUMPY_INSTALL_DIR}/lib/*.egg-info \n ${numpy-egg} --- ")
if (NOT numpy-egg)
message(FATAL_ERROR "Failed to locate numpy-egg")
endif()
set (pythonpath $ENV{PYTHONPATH})
if (WIN32)
set (separator ";")
else()
set (separator ":")
endif()
# since we may find multiple eggs (or may not), just loop over all of them.
foreach(egg ${numpy-egg})
get_filename_component(dir "${egg}" PATH)
if (pythonpath)
set (pythonpath "${pythonpath}${separator}${dir}")
else()
set (pythonpath "${dir}")
endif()
endforeach()
set (ENV{PYTHONPATH} "${pythonpath}")
message ("PYTHONPATH : ${pythonpath}")
execute_process(COMMAND ${PYTHON_EXECUTABLE} setup.py install --prefix=${MATPLOTLIB_INSTALL_DIR}
WORKING_DIRECTORY ${MATPLOTLIB_SOURCE_DIR}
RESULT_VARIABLE rv)
if (NOT "${rv}" STREQUAL "0")
message(FATAL_ERROR "Failed to build matplot lib")
endif()
......@@ -12,6 +12,11 @@ add_external_project(matplotlib
CONFIGURE_COMMAND ""
INSTALL_COMMAND ""
BUILD_IN_SOURCE 1
BUILD_COMMAND
${pv_python_executable} setup.py install --prefix=${_install_location}
${CMAKE_COMMAND} -DPYTHON_EXECUTABLE:PATH=${pv_python_executable}
-DMATPLOTLIB_SOURCE_DIR:PATH=<SOURCE_DIR>
-DMATPLOTLIB_INSTALL_DIR:PATH=<INSTALL_DIR>
-DNUMPY_INSTALL_DIR:PATH=<INSTALL_DIR>
-P ${CMAKE_CURRENT_LIST_DIR}/matplotlib.build.cmake
)
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