Commit ecff3e67 authored by Brian Panneton's avatar Brian Panneton

ENH: Added some support for XdmfConfig.cmake file.

parent 5eecc6c4
......@@ -7,8 +7,8 @@ SET(ENV{LD_LIBRARY_PATH} "${LDPATH}${SEPARATOR}$ENV{LD_LIBRARY_PATH}")
MESSAGE("| Calling:\t${python_runtime} ${EXECUTABLE} ${ARGUMENTS}")
EXECUTE_PROCESS(
COMMAND ${python_runtime} ${EXECUTABLE}.pyc ${ARGUMENTS}
WORKING_DIRECTORY ${python_binary_dir}
COMMAND "${python_runtime}" "${EXECUTABLE}.pyc" ${ARGUMENTS}
WORKING_DIRECTORY "${python_binary_dir}"
RESULT_VARIABLE python_result
OUTPUT_VARIABLE python_output
ERROR_VARIABLE python_error
......
......@@ -14,7 +14,6 @@ set(CMAKE_MODULE_PATH
${CMAKE_SOURCE_DIR}/CMake/VersionSuite
)
# Should we build with documentation
option(XDMF_BUILD_DOCUMENTATION OFF)
if(XDMF_BUILD_DOCUMENTATION)
......@@ -38,6 +37,7 @@ if(XDMF_WRAP_PYTHON OR XDMF_WRAP_JAVA)
if(${SWIG_VERSION} LESS 2.0.0)
message(SEND_ERROR "Swig must be version 2.0.0 or greater")
endif(${SWIG_VERSION} LESS 2.0.0)
set(XDMF_SWIG_EXECUTABLE ${SWIG_EXECUTABLE})
endif(XDMF_WRAP_PYTHON OR XDMF_WRAP_JAVA)
# If we are wrapping python, let's include it in the top level
......@@ -45,7 +45,10 @@ if(XDMF_WRAP_PYTHON)
find_package(PythonInterp REQUIRED)
find_package(PythonLibs REQUIRED)
include_directories(${PYTHON_INCLUDE_DIRS})
set(XDMF_PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE})
set(XDMF_PYTHON_LIBRARY ${PYTHON_LIBRARY})
set(XDMF_PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS})
# A macro to swig and create the python files
# Since we essentually do the same thing inside and outside core, it
# would be easier as a macro
......@@ -78,7 +81,10 @@ PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
)
endif(WIN32)
string(TOUPPER ${python_name} python_name_upper)
set(${python_name_upper}_PYTHON_CONFIG
${CMAKE_INSTALL_PREFIX}/lib/python/${python_name}.py)
install(FILES ${CMAKE_BINARY_DIR}/${python_name}.py
DESTINATION lib/python)
install(TARGETS ${SWIG_MODULE_${python_name}_REAL_NAME}
......@@ -92,6 +98,11 @@ if(XDMF_WRAP_JAVA)
find_package(JNI REQUIRED)
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2})
set(XDMF_JAVA_INCLUDE_PATH ${JAVA_INCLUDE_PATH})
set(XDMF_JAVA_INCLUDE_PATH2 ${JAVA_INCLUDE_PATH2})
set(XDMF_JAVA_COMPILE ${JAVA_COMPILE})
set(XDMF_JAVA_ARCHIVE ${JAVA_ARCHIVE})
# A macro to swig and create the jar files
# Since we essentually do the same thing inside and outside core, it
# would be easier as a macro
......@@ -153,6 +164,10 @@ if(XDMF_WRAP_JAVA)
${CMAKE_BINARY_DIR}/${java_name}.jar
${XDMF_JAVA_DIR}
)
string(TOUPPER ${java_name} java_name_upper)
set(${java_name_upper}_JAVA_JAR_CONFIG
${CMAKE_INSTALL_PREFIX}/lib/java/${java_name}.jar)
install(FILES ${CMAKE_BINARY_DIR}/${java_name}.jar
DESTINATION lib/java)
install(TARGETS ${SWIG_MODULE_${java_name}Java_REAL_NAME}
......@@ -218,7 +233,13 @@ if(NOT XDMF_BUILD_CORE_ONLY)
add_subdirectory(utils)
endif(XDMF_BUILD_UTILS)
file(GLOB XdmfHeaders "*.hpp" "*.tpp" "*.i" "CMake/VersionSuite/*.hpp")
if(WIN32)
set(XDMF_LIBRARY_CONFIG ${CMAKE_INSTALL_PREFIX}/bin/Xdmf.dll)
else(WIN32)
set(XDMF_LIBRARY_CONFIG ${CMAKE_INSTALL_PREFIX}/lib/libXdmf.so)
endif(WIN32)
file(GLOB XdmfHeaders "*.hpp" "*.tpp" "*.i" "CMake/VersionSuite/*.hpp")
install(FILES ${XdmfHeaders} DESTINATION include)
install(TARGETS Xdmf
RUNTIME DESTINATION bin
......@@ -226,3 +247,7 @@ if(NOT XDMF_BUILD_CORE_ONLY)
ARCHIVE DESTINATION lib
)
endif(NOT XDMF_BUILD_CORE_ONLY)
configure_file(${CMAKE_BINARY_DIR}/XdmfConfig.cmake.in
${CMAKE_BINARY_DIR}/XdmfConfig.cmake @ONLY)
install(FILES ${CMAKE_BINARY_DIR}/XdmfConfig.cmake DESTINATION .)
# XdmfConfig.cmake - Configure file that provides details for where Xdmf parts
# reside and which libraries were used.
#
# This file is used by UseXdmf.cmake module to load Xdmf's settings.
#
# Xdmf Library locations
set(XDMF_DIR "@CMAKE_INSTALL_PREFIX@")
set(XDMF_INCLUDE_DIRS "@CMAKE_INSTALL_PREFIX@/include")
set(XDMF_LIBRARIES "@CMAKE_INSTALL_PREFIX@/lib")
set(XDMF_BINARIES "@CMAKE_INSTALL_PREFIX@/bin")
set(XDMFCORE_LIBRARY "@XDMFCORE_LIBRARY_CONFIG@")
set(XDMF_LIBRARY "@XDMF_LIBRARY_CONFIG@")
set(XDMF_JAVA_DIR "@CMAKE_INSTALL_PREFIX@/lib/java")
set(XDMFCORE_JAVA_JAR "@XDMFCORE_JAVA_JAR_CONFIG@")
set(XDMF_JAVA_JAR "@XDMF_JAVA_JAR_CONFIG@")
set(XDMF_PYTHON_DIR "@CMAKE_INSTALL_PREFIX@/lib/python")
set(XDMFCORE_PYTHON "@XDMFCORE_PYTHON_CONFIG@")
set(XDMF_PYTHON "@XDMF_PYTHON_CONFIG@")
# Xdmf Boost Locations
set(XDMF_BOOST_ROOT_DIR "@XDMF_BOOST_ROOT_DIR@")
set(XDMF_BOOST_INCLUDE_DIRS "@XDMF_BOOST_INCLUDE_DIRS@")
# Xdmf HDF5 Locations
set(XDMF_HDF5_ROOT_DIR "@XDMF_HDF5_ROOT_DIR@")
set(XDMF_HDF5_INCLUDE_DIR "@XDMF_HDF5_INCLUDE_DIR@")
set(XDMF_HDF5_LIBRARIES "@XDMF_HDF5_LIBRARIES@")
set(XDMF_HDF5_BINARY_DIRS "@XDMF_HDF5_BINARY_DIRS@")
# Xdmf LibXml2 Locations
set(XDMF_LIBXML2_ROOT_DIR "@XDMF_LIBXML2_ROOT_DIR@")
set(XDMF_LIBXML2_INCLUDE_DIR "@XDMF_LIBXML2_INCLUDE_DIR@")
set(XDMF_LIBXML2_LIBRARIES "@XDMF_LIBXML2_LIBRARIES@")
set(XDMF_LIBXML2_BINARY_DIRS "@XDMF_LIBXML2_BINARY_DIRS@")
# Xdmf Swig Locations
set(XDMF_SWIG_EXECUTABLE "@XDMF_SWIG_EXECUTABLE@")
# Xdmf Python Locations
set(XDMF_PYTHON_EXECUTABLE "@XDMF_PYTHON_EXECUTABLE@")
set(XDMF_PYTHON_LIBRARY "@XDMF_PYTHON_LIBRARY@")
set(XDMF_PYTHON_INCLUDE_DIRS "@XDMF_PYTHON_INCLUDE_DIRS@")
# Xdmf Java Locations
set(XDMF_JAVA_INCLUDE_PATH "@XDMF_JAVA_INCLUDE_PATH@")
set(XDMF_JAVA_INCLUDE_PATH2 "@XDMF_JAVA_INCLUDE_PATH2@")
set(XDMF_JAVA_COMPILE "@XDMF_JAVA_COMPILE@")
set(XDMF_JAVA_ARCHIVE "@XDMF_JAVA_ARCHIVE@")
......@@ -18,6 +18,9 @@ option(XDMF_BUILD_DSM OFF)
find_package(Boost REQUIRED)
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
set(XDMF_BOOST_INCLUDE_DIRS ${Boost_INCLUDE_DIRS})
get_filename_component(Boost_ROOT "${Boost_INCLUDE_DIRS}" REALPATH)
set(XDMF_BOOST_ROOT_DIR ${Boost_ROOT})
endif(Boost_FOUND)
find_package(HDF5 REQUIRED)
......@@ -29,8 +32,12 @@ if(HDF5_FOUND)
include_directories(${MPI_INCLUDE_PATH})
endif(MPI_FOUND)
endif(HDF5_IS_PARALLEL)
get_filename_component(HDF5_ROOT "$HDF5_INCLUDE_DIR}/../" REALPATH)
get_filename_component(HDF5_ROOT "${HDF5_INCLUDE_DIR}/../" REALPATH)
set(HDF5_BINARY_DIRS ${HDF5_ROOT}/bin ${HDF5_ROOT}/dll)
set(XDMF_HDF5_ROOT_DIR ${HDF5_ROOT})
set(XDMF_HDF5_INCLUDE_DIR ${HDF5_INCLUDE_DIR})
set(XDMF_HDF5_LIBRARIES ${HDF5_LIBRARIES})
set(XDMF_HDF5_BINARY_DIRS ${HDF5_BINARY_DIRS})
endif(HDF5_FOUND)
if(XDMF_BUILD_DSM)
......@@ -51,8 +58,12 @@ endif(XDMF_BUILD_DSM)
find_package(LibXml2 REQUIRED)
if(LIBXML2_FOUND)
include_directories(${LIBXML2_INCLUDE_DIR})
get_filename_component(LIBXML2_ROOT "${LIBXML2_INCLUDE_DIR}/../" REALPATH)
get_filename_component(LIBXML2_ROOT "${LIBXML2_INCLUDE_DIR}/../../" REALPATH)
set(LIBXML2_BINARY_DIRS ${LIBXML2_ROOT}/bin)
set(XDMF_LIBXML2_ROOT_DIR ${LIBXML2_ROOT})
set(XDMF_LIBXML2_INCLUDE_DIR ${LIBXML2_INCLUDE_DIR})
set(XDMF_LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES})
set(XDMF_LIBXML2_BINARY_DIRS ${LIBXML2_BINARY_DIRS})
endif(LIBXML2_FOUND)
set(XdmfCoreSources
......@@ -101,6 +112,12 @@ if(XDMF_WRAP_PYTHON)
XDMF_SWIG_PYTHON(XdmfCore)
endif(XDMF_WRAP_PYTHON)
if(WIN32)
set(XDMFCORE_LIBRARY_CONFIG ${CMAKE_INSTALL_PREFIX}/bin/XdmfCore.dll)
else(WIN32)
set(XDMFCORE_LIBRARY_CONFIG ${CMAKE_INSTALL_PREFIX}/lib/libXdmfCore.so)
endif(WIN32)
file(GLOB_RECURSE XdmfCoreHeaders "*.hpp" "*.tpp" "*.i" "../CMake/VersionSuite/*.hpp")
file(GLOB LokiHeaders loki/*.h)
install(FILES ${XdmfCoreHeaders} DESTINATION include)
......@@ -116,3 +133,12 @@ set(XdmfCore_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR} ${HD
if(BUILD_TESTING)
add_subdirectory(tests)
endif(BUILD_TESTING)
# Since these are not set as of yet, we don't want to remove them from the
# config file
set(XDMF_LIBRARY_CONFIG "@XDMF_LIBRARY_CONFIG@")
set(XDMF_JAVA_JAR_CONFIG "@XDMF_JAVA_JAR_CONFIG@")
set(XDMF_PYTHON_CONFIG "@XDMF_PYTHON_CONFIG@")
configure_file(${CMAKE_SOURCE_DIR}/XdmfConfig.cmake.in
${CMAKE_BINARY_DIR}/XdmfConfig.cmake.in @ONLY)
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