Commit f67d15e9 authored by David Moxey's avatar David Moxey

Remove variable_watch approach and revert to internal cache variable, remove...

Remove variable_watch approach and revert to internal cache variable, remove also extra MacPorts paths that are unnecessary
parent 8a0b9e74
......@@ -70,7 +70,7 @@ IF (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
ENDIF()
# Find default search paths for OS X; adapted from Stack Overflow question
# 1487752
# 1487752.
IF (APPLE)
EXECUTE_PROCESS(COMMAND which port
RESULT_VARIABLE DETECT_MACPORTS
......
......@@ -91,7 +91,7 @@ find_path (PETSC_DIR include/petsc.h
# Arch Linux path
/opt/petsc/linux-c-opt
# MacPorts path
/opt/local/lib/petsc
${MACPORTS_PREFIX}/lib/petsc
$ENV{HOME}/petsc
DOC "PETSc Directory")
......
......@@ -12,16 +12,16 @@ OPTION(NEKTAR_USE_ARPACK
SET(BUILD_ARPACK OFF)
IF (NEKTAR_USE_ARPACK)
FIND_LIBRARY(ARPACK_LIBRARY NAMES "arpack.1" "arpack" PATHS /opt/local/lib)
FIND_LIBRARY(ARPACK_LIBRARY NAMES "arpack.1" "arpack")
IF (ARPACK_LIBRARY)
MESSAGE(STATUS "Found Arpack: ${ARPACK_LIBRARY}")
MARK_AS_ADVANCED(ARPACK_LIBRARY)
ELSE()
IF(CMAKE_Fortran_COMPILER)
SET(BUILD_ARPACK ON)
SET(BUILD_ARPACK ON)
ELSE()
MESSAGE(FATAL_ERROR "Could not find or build Arpack")
MESSAGE(FATAL_ERROR "Could not find or build Arpack")
ENDIF()
ENDIF()
......
......@@ -6,75 +6,85 @@
#
########################################################################
FUNCTION(NEKTAR_FIND_PYTHON)
# Unset any existing python executable/library settings so that
# we can rediscover correct python version if v2/3 settings changed
unset(PYTHON_EXECUTABLE CACHE)
unset(PYTHON_INCLUDE_DIR CACHE)
unset(PYTHON_LIBRARY CACHE)
unset(PYTHON_LIBRARY_DEBUG CACHE)
unset(BOOST_PYTHON_LIB CACHE)
unset(BOOST_NUMPY_LIB CACHE)
SET(PYTHONVER 2.7)
IF (NEKTAR_USE_PYTHON3)
SET(PYTHONVER 3.0)
ENDIF()
IF (NEKTAR_BUILD_PYTHON)
CMAKE_DEPENDENT_OPTION(NEKTAR_USE_PYTHON3
"If true, prefer to use Python 3." OFF "NEKTAR_BUILD_PYTHON" OFF)
# Find Python
FIND_PACKAGE(PythonInterp ${PYTHONVER} REQUIRED)
FIND_PACKAGE(PythonLibsNew ${PYTHONVER} REQUIRED)
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIRS})
ADD_DEFINITIONS(-DWITH_PYTHON)
# Include headers from root directory for config file.
# Now try to find Boost::Python. For now we are relying entirely on
# distributed versions of this (versus trying to compile via ThirdParty)
# because they come with various names and FindBoost is not really geared up
# for this at present. Therefore this is done separately to avoid lots of
# warnings and extraneous output.
#
# We need to try a few variants, depending on if we're doing Python 2 or
# Python 3. Irritatingly this is all very much distriution dependent so we
# just take our best guess at filenames. Seemingly from Boost 1.67 onwards,
# names are just `python27` and `numpy32` but for now we have to deal with
# this ourselves.
STRING(REPLACE "." ";" BOOST_PYTHON_VERSION ${PYTHONLIBS_VERSION_STRING})
LIST(GET BOOST_PYTHON_VERSION 0 BOOST_PYTHON_VERSION_MAJOR)
LIST(GET BOOST_PYTHON_VERSION 1 BOOST_PYTHON_VERSION_MINOR)
SET(TMP_BOOST_LIST ${NEEDED_BOOST_LIBS})
# If we're using multi-threaded, the existing library likely has a '-mt'
# suffix so we need to append this too.
IF (Boost_SYSTEM_LIBRARY MATCHES "-mt")
SET(BOOST_LIB_SUFFIX "-mt")
ENDIF()
IF (NOT NEKTAR_PYTHON3_STATUS STREQUAL NEKTAR_USE_PYTHON3)
# Unset any existing python executable/library settings so that we can
# rediscover correct python version if v2/3 settings changed.
IF (DEFINED NEKTAR_PYTHON3_STATUS)
unset(PYTHON_EXECUTABLE CACHE)
unset(PYTHON_INCLUDE_DIR CACHE)
unset(PYTHON_LIBRARY CACHE)
unset(PYTHON_LIBRARY_DEBUG CACHE)
unset(BOOST_PYTHON_LIB CACHE)
unset(BOOST_NUMPY_LIB CACHE)
ENDIF()
# Try to find Boost::Python
FIND_LIBRARY(BOOST_PYTHON_LIB
NAMES boost_python-py${BOOST_PYTHON_VERSION_MAJOR}${BOOST_PYTHON_VERSION_MINOR}${BOOST_LIB_SUFFIX}
boost_python${BOOST_PYTHON_VERSION_MAJOR}${BOOST_PYTHON_VERSION_MINOR}${BOOST_LIB_SUFFIX}
boost_python-py${BOOST_PYTHON_VERSION_MAJOR}${BOOST_LIB_SUFFIX}
boost_python${BOOST_PYTHON_VERSION_MAJOR}${BOOST_LIB_SUFFIX}
boost_python${BOOST_LIB_SUFFIX}
PATHS ${Boost_LIBRARY_DIRS})
IF (NOT BOOST_PYTHON_LIB)
MESSAGE(FATAL_ERROR "Could not find Boost Python installation: check it is installed in your distribution.")
SET(PYTHONVER 2.7)
IF (NEKTAR_USE_PYTHON3)
SET(PYTHONVER 3.0)
ENDIF()
# Find Python
FIND_PACKAGE(PythonInterp ${PYTHONVER} REQUIRED)
FIND_PACKAGE(PythonLibsNew ${PYTHONVER} REQUIRED)
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIRS})
ADD_DEFINITIONS(-DWITH_PYTHON)
# Include headers from root directory for config file.
# Now try to find Boost::Python. For now we are relying entirely on
# distributed versions of this (versus trying to compile via ThirdParty)
# because they come with various names and FindBoost is not really geared up
# for this at present. Therefore this is done separately to avoid lots of
# warnings and extraneous output.
#
# We need to try a few variants, depending on if we're doing Python 2 or
# Python 3. Irritatingly this is all very much distriution dependent so we
# just take our best guess at filenames. Seemingly from Boost 1.67 onwards,
# names are just `python27` and `numpy32` but for now we have to deal with
# this ourselves.
STRING(REPLACE "." ";" BOOST_PYTHON_VERSION ${PYTHONLIBS_VERSION_STRING})
LIST(GET BOOST_PYTHON_VERSION 0 BOOST_PYTHON_VERSION_MAJOR)
LIST(GET BOOST_PYTHON_VERSION 1 BOOST_PYTHON_VERSION_MINOR)
SET(TMP_BOOST_LIST ${NEEDED_BOOST_LIBS})
# If we're using multi-threaded, the existing library likely has a '-mt'
# suffix so we need to append this too.
IF (Boost_SYSTEM_LIBRARY MATCHES "-mt")
SET(BOOST_LIB_SUFFIX "-mt")
ENDIF()
# Try to find Boost::Python
FIND_LIBRARY(BOOST_PYTHON_LIB
NAMES boost_python-py${BOOST_PYTHON_VERSION_MAJOR}${BOOST_PYTHON_VERSION_MINOR}${BOOST_LIB_SUFFIX}
boost_python${BOOST_PYTHON_VERSION_MAJOR}${BOOST_PYTHON_VERSION_MINOR}${BOOST_LIB_SUFFIX}
boost_python-py${BOOST_PYTHON_VERSION_MAJOR}${BOOST_LIB_SUFFIX}
boost_python${BOOST_PYTHON_VERSION_MAJOR}${BOOST_LIB_SUFFIX}
boost_python${BOOST_LIB_SUFFIX}
PATHS ${Boost_LIBRARY_DIRS})
IF (NOT BOOST_PYTHON_LIB)
MESSAGE(FATAL_ERROR "Could not find Boost Python installation: check it is installed in your distribution.")
ENDIF()
# Try to find Boost.NumPy
FIND_LIBRARY(BOOST_NUMPY_LIB
NAMES boost_numpy-py${BOOST_PYTHON_VERSION_MAJOR}${BOOST_PYTHON_VERSION_MINOR}${BOOST_LIB_SUFFIX}
boost_numpy${BOOST_PYTHON_VERSION_MAJOR}${BOOST_PYTHON_VERSION_MINOR}${BOOST_LIB_SUFFIX}
boost_numpy-py${BOOST_PYTHON_VERSION_MAJOR}${BOOST_LIB_SUFFIX}
boost_numpy${BOOST_PYTHON_VERSION_MAJOR}${BOOST_LIB_SUFFIX}
boost_numpy${BOOST_LIB_SUFFIX}
PATHS ${Boost_LIBRARY_DIRS})
SET(NEKTAR_PYTHON3_STATUS ${NEKTAR_USE_PYTHON3} CACHE INTERNAL "")
ENDIF()
MESSAGE(STATUS "Found Python: ${PYTHON_EXECUTABLE}")
MESSAGE(STATUS "Found Boost.Python: ${BOOST_PYTHON_LIB}")
# Try to find Boost.NumPy
FIND_LIBRARY(BOOST_NUMPY_LIB
NAMES boost_numpy-py${BOOST_PYTHON_VERSION_MAJOR}${BOOST_PYTHON_VERSION_MINOR}${BOOST_LIB_SUFFIX}
boost_numpy${BOOST_PYTHON_VERSION_MAJOR}${BOOST_PYTHON_VERSION_MINOR}${BOOST_LIB_SUFFIX}
boost_numpy-py${BOOST_PYTHON_VERSION_MAJOR}${BOOST_LIB_SUFFIX}
boost_numpy${BOOST_PYTHON_VERSION_MAJOR}${BOOST_LIB_SUFFIX}
boost_numpy${BOOST_LIB_SUFFIX}
PATHS ${Boost_LIBRARY_DIRS})
# If we can't find it, pull it from git and compile it
IF (NOT BOOST_NUMPY_LIB)
INCLUDE(ExternalProject)
......@@ -90,17 +100,17 @@ FUNCTION(NEKTAR_FIND_PYTHON)
TMP_DIR ${TPBUILD}/boost-numpy-tmp
INSTALL_DIR ${TPDIST}
CONFIGURE_COMMAND ${CMAKE_COMMAND}
-G ${CMAKE_GENERATOR} -DCMAKE_INSTALL_PREFIX:PATH=${TPDIST}
-DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
-DBUILD_EXAMPLES=OFF -DBUILD_TESTS=OFF -DLIBRARY_TYPE=STATIC
${TPSRC}/boost-numpy
-G ${CMAKE_GENERATOR} -DCMAKE_INSTALL_PREFIX:PATH=${TPDIST}
-DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
-DBUILD_EXAMPLES=OFF -DBUILD_TESTS=OFF -DLIBRARY_TYPE=STATIC
${TPSRC}/boost-numpy
)
IF (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
SET(BOOST_NUMPY_LIB ${TPDIST}/lib64/${CMAKE_STATIC_LIBRARY_PREFIX}boost_numpy${CMAKE_STATIC_LIBRARY_SUFFIX})
ELSE()
SET(BOOST_NUMPY_LIB ${TPDIST}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}boost_numpy${CMAKE_STATIC_LIBRARY_SUFFIX})
ENDIF()
INCLUDE_DIRECTORIES(SYSTEM ${TPDIST}/include)
MESSAGE(STATUS "Build Boost.NumPy: ${BOOST_NUMPY_LIB}")
ELSE()
......@@ -108,14 +118,7 @@ FUNCTION(NEKTAR_FIND_PYTHON)
ADD_CUSTOM_TARGET(boost-numpy ALL)
ADD_DEFINITIONS(-DBOOST_HAS_NUMPY)
ENDIF()
ENDFUNCTION()
VARIABLE_WATCH(NEKTAR_USE_PYTHON3 NEKTAR_FIND_PYTHON)
IF (NEKTAR_BUILD_PYTHON)
CMAKE_DEPENDENT_OPTION(NEKTAR_USE_PYTHON3
"If true, prefer to use Python 3." OFF "NEKTAR_BUILD_PYTHON" OFF)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/cmake/python/setup.py.in ${CMAKE_BINARY_DIR}/setup.py)
ADD_CUSTOM_TARGET(nekpy-install-user
......
......@@ -10,8 +10,8 @@ OPTION(NEKTAR_USE_TINYXML_STL "Use STL with TinyXML library." ON)
MARK_AS_ADVANCED(NEKTAR_USE_TINYXML_STL)
# First search for system TinyXML installs. Hint /opt/local for MacPorts.
FIND_PATH (TINYXML_INCLUDE_DIR tinyxml.h PATHS /opt/local/include)
FIND_LIBRARY(TINYXML_LIBRARY NAMES "tinyxml" PATHS /opt/local/lib)
FIND_PATH (TINYXML_INCLUDE_DIR tinyxml.h)
FIND_LIBRARY(TINYXML_LIBRARY NAMES "tinyxml")
# If we have our library then don't build TinyXML.
IF (TINYXML_INCLUDE_DIR AND TINYXML_LIBRARY)
......
......@@ -6,13 +6,6 @@
#
########################################################################
# Attempt to identify Macports libraries, if they exist and we didn't override
# ZLIB_ROOT on the command line or in ccmake. This prevents cmake warnings later
# on.
IF (NOT DEFINED ZLIB_ROOT)
SET(ZLIB_ROOT /opt/local/)
ENDIF()
# Find a system ZLIB library. If not found enable the THIRDPARTY_BUILD_ZLIB
# option.
FIND_PACKAGE(ZLIB QUIET)
......
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