Commit 14b6c976 authored by Dave Moxey's avatar Dave Moxey
Browse files

Lots of updates to code locations, get Tester working with tutorial

parent af8a95db
......@@ -160,7 +160,6 @@ OPTION(NEKTAR_BUILD_PYTHON "Build Nektar++ Python bindings" OFF)
OPTION(NEKTAR_BUILD_PACKAGES "Build Nektar++ binary packages" OFF)
MARK_AS_ADVANCED(NEKTAR_BUILD_PACKAGES)
OPTION(NEKTAR_TEST_ALL "Include full set of regression tests to this build." OFF)
OPTION(NEKTAR_TEST_USE_HOSTFILE "Use a hostfile to explicitly specify number of
slots." OFF)
......@@ -250,6 +249,7 @@ INCLUDE (ThirdPartyOCE)
INCLUDE (ThirdPartyTriangle)
INCLUDE (ThirdPartyTetGen)
INCLUDE (ThirdPartyCCM)
INCLUDE (ThirdPartyPython)
INCLUDE (FindCFI)
INCLUDE (Doxygen)
......
......@@ -249,3 +249,43 @@ MACRO(ADD_NEKTAR_TEST name)
COMMAND Tester ${CMAKE_CURRENT_SOURCE_DIR}/Tests/${name}.tst)
ENDIF()
ENDMACRO(ADD_NEKTAR_TEST)
#
# ADD_NEKPY_LIBRARY(name SOURCES src1 src2 ...)
#
# Adds a new NekPy library with the given sources.
#
MACRO(ADD_NEKPY_LIBRARY name)
CMAKE_PARSE_ARGUMENTS(NEKPY "" "" "SOURCES" ${ARGN})
SET(NEKPY_NAME ${name})
# Create library.
ADD_LIBRARY(_${name} SHARED ${NEKPY_SOURCES})
# Python requires a .so extension, even on OS X.
SET_TARGET_PROPERTIES(_${name} PROPERTIES PREFIX "")
SET_TARGET_PROPERTIES(_${name} PROPERTIES SUFFIX ".so")
ADD_DEPENDENCIES(_${name} boost-numpy)
# Add target link libraries.
TARGET_LINK_LIBRARIES(_${name}
${Boost_SYSTEM_LIBRARY}
${Boost_PYTHON_LIBRARY}
${BOOST_NUMPY_LIB}
${PYTHON_LIBRARIES}
${name})
# Install __init__.py files.
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/cmake/python/init.py.in
${CMAKE_BINARY_DIR}/NekPy/${name}/__init__.py)
SET_TARGET_PROPERTIES(_${name} PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/NekPy/${name})
ENDMACRO()
MACRO(ADD_NEKPY_EXECUTABLE name source)
# Copy the files into binary directory.
INSTALL(FILES ${source} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
FILE(COPY ${source} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
ADD_CUSTOM_TARGET(${name} SOURCES ${source})
ENDMACRO()
\ No newline at end of file
########################################################################
#
# ThirdParty configuration for Nektar++
#
# Python interfaces
#
########################################################################
IF (NEKTAR_BUILD_PYTHON)
# Find Python
FIND_PACKAGE(PythonInterp REQUIRED)
FIND_PACKAGE(PythonLibsNew REQUIRED)
INCLUDE_DIRECTORIES(SYSTEM ${PYTHON_INCLUDE_DIRS})
# Include headers from root directory for config file.
# Try to find Boost.NumPy
FIND_LIBRARY(BOOST_NUMPY_LIB boost_numpy PATHS ${Boost_LIBRARY_DIRS})
# If we can't find it, pull it from git and compile it
IF (NOT BOOST_NUMPY_LIB)
INCLUDE(ExternalProject)
EXTERNALPROJECT_ADD(
boost-numpy
PREFIX ${TPSRC}
GIT_REPOSITORY http://github.com/ndarray/Boost.NumPy.git
STAMP_DIR ${TPBUILD}/stamp
DOWNLOAD_DIR ${TPSRC}
SOURCE_DIR ${TPSRC}/boost-numpy
BINARY_DIR ${TPBUILD}/boost-numpy
TMP_DIR ${TPBUILD}/boost-numpy-tmp
INSTALL_DIR ${TPDIST}
CONFIGURE_COMMAND ${CMAKE_COMMAND}
-G ${CMAKE_GENERATOR} -DCMAKE_INSTALL_PREFIX:PATH=${TPDIST} -DBUILD_EXAMPLES=OFF -DBUILD_TESTS=OFF -DLIBRARY_TYPE=STATIC
${TPSRC}/boost-numpy
)
SET(BOOST_NUMPY_LIB ${TPDIST}/lib64/${CMAKE_STATIC_LIBRARY_PREFIX}boost_numpy${CMAKE_STATIC_LIBRARY_SUFFIX})
INCLUDE_DIRECTORIES(SYSTEM ${TPDIST}/include)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/cmake/python/setup.py.in ${CMAKE_BINARY_DIR}/setup.py)
ADD_CUSTOM_TARGET(nekpy-install-user
DEPENDS _MultiRegions
COMMAND python setup.py install --user
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/NekPy)
FILE(WRITE ${CMAKE_BINARY_DIR}/NekPy/__init__.py "# placeholder")
ELSE()
ADD_CUSTOM_TARGET(boost-numpy ALL)
ADD_DEFINITIONS(-DBOOST_HAS_NUMPY)
ENDIF()
ENDIF()
from ._${NEKPY_NAME} import *
from distutils.core import setup
libs = ['LibUtilities', 'StdRegions', 'SpatialDomains', 'LocalRegions', 'MultiRegions']
setup(name='NekPy',
version='${NEKTAR_VERSION}',
package_dir={ '': '${CMAKE_BINARY_DIR}' },
packages=[ 'NekPy' ] + [ 'NekPy.%s' % l for l in libs ],
package_data={ 'NekPy.%s' % l : ['_%s.so' % l] for l in libs }
)
......@@ -28,6 +28,5 @@ IF (NEKTAR_UTILITY_FIELDCONVERT OR NEKTAR_UTILITY_NEKMESH OR NEKTAR_BUILD_SOLVER
ENDIF()
IF (NEKTAR_BUILD_PYTHON)
SUBDIRS(Python)
INCLUDE_DIRECTORIES(Python)
ENDIF()
......@@ -431,6 +431,10 @@ IF( NEKTAR_USE_PETSC )
ADD_DEPENDENCIES(LibUtilities petsc-3.7.2)
ENDIF( NEKTAR_USE_PETSC )
IF (NEKTAR_BUILD_PYTHON)
SUBDIRS(Python)
ENDIF()
# HDF5
IF( NEKTAR_USE_HDF5 )
TARGET_LINK_LIBRARIES(LibUtilities LINK_PUBLIC ${HDF5_LIBRARIES})
......
SET(LIBUTILITIES_SOURCES
ADD_NEKPY_LIBRARY(LibUtilities SOURCES
LibUtilities.cpp
BasicUtils/SessionReader.cpp
BasicUtils/SharedArray.cpp
......@@ -7,5 +7,3 @@ SET(LIBUTILITIES_SOURCES
Foundations/Points.cpp
LinearAlgebra/NekMatrix.cpp
)
ADD_NEKPY_LIBRARY(LibUtilities LIBUTILITIES_SOURCES)
......@@ -49,5 +49,9 @@ ADD_NEKTAR_LIBRARY(LocalRegions
SUMMARY "Nektar++ LocalRegions library"
DESCRIPTION "This library provides physical space expansions on the various supported regions.")
IF (NEKTAR_BUILD_PYTHON)
SUBDIRS(Python)
ENDIF()
INSTALL(DIRECTORY ./ DESTINATION ${NEKTAR_INCLUDE_DIR}/LocalRegions
COMPONENT dev FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp")
SET(LOCALREGIONS_SOURCES
ADD_NEKPY_LIBRARY(LocalRegions SOURCES
LocalRegions.cpp
Expansion.cpp
QuadExp.cpp
SegExp.cpp
TriExp.cpp
)
ADD_NEKPY_LIBRARY(LocalRegions LOCALREGIONS_SOURCES)
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