CMakeLists.txt 3.3 KB
Newer Older
1
2
3
project(XdmfCore)
cmake_minimum_required(VERSION 2.6)

Brian Panneton's avatar
Brian Panneton committed
4
5
include(SetUpVersion)
if(VERSION_CONTROL_AUTOUPDATE)
6
        VersionCreate("Xdmf" "2" "XDMFCORE_EXPORT" "XdmfCore.hpp")
Brian Panneton's avatar
Brian Panneton committed
7
8
endif(VERSION_CONTROL_AUTOUPDATE)

9
10
set(BUILD_SHARED_LIBS true)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
11
12
13
14
SET(CMAKE_SKIP_BUILD_RPATH  FALSE)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) 
SET(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib)
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
15

16
17
option(XDMF_BUILD_DSM OFF)

18
mark_as_advanced(CLEAR Boost_INCLUDE_DIR)
19
20
21
find_package(Boost REQUIRED)
if(Boost_FOUND)
	include_directories(${Boost_INCLUDE_DIRS})
22
	mark_as_advanced(FORCE Boost_INCLUDE_DIR)
23
24
endif(Boost_FOUND)

25
26
27
mark_as_advanced(CLEAR HDF5_C_INCLUDE_DIR)
mark_as_advanced(CLEAR HDF5_hdf5_LIBRARY_DEBUG)
mark_as_advanced(CLEAR HDF5_hdf5_LIBRARY_RELEASE)
28
29
find_package(HDF5 REQUIRED)
if(HDF5_FOUND)
30
31
32
33
	include_directories(${HDF5_INCLUDE_DIRS})
	mark_as_advanced(FORCE HDF5_C_INCLUDE_DIR)
	mark_as_advanced(FORCE HDF5_hdf5_LIBRARY_DEBUG)
	mark_as_advanced(FORCE HDF5_hdf5_LIBRARY_RELEASE)
34
35
endif(HDF5_FOUND)

36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
if(XDMF_BUILD_DSM)
	find_path(HDF5DSM_DIR include/H5FDdsm.h)
	if(HDF5DSM_DIR AND EXISTS ${HDF5DSM_DIR}/include/H5FDdsm.h)
	  include_directories(${HDF5DSM_DIR}/include)
	  find_library(HDF5DSM_LIBRARIES H5FDdsm ${HDF5DSM_DIR}/lib)
	else(HDF5DSM_DIR AND EXISTS ${HDF5DSM_DIR}/include/H5FDdsm.h)
	  message(SEND_ERROR "Cannot find HDF5DSM!  Please set HDF5DSM_DIR and configure again.")
	endif(HDF5DSM_DIR AND EXISTS ${HDF5DSM_DIR}/include/H5FDdsm.h)
	
	find_package(MPI REQUIRED)
	if(MPI_FOUND)
		include_directories(${MPI_INCLUDE_PATH})
	endif(MPI_FOUND)
endif(XDMF_BUILD_DSM)

51
52
53
54
55
56
57
58
59
60
61
62
find_package(LibXml2 REQUIRED)
if(LIBXML2_FOUND)
	include_directories(${LIBXML2_INCLUDE_DIR})
endif(LIBXML2_FOUND)

set(XdmfCoreSources
	XdmfArray
	XdmfArrayType
	XdmfCoreItemFactory
	XdmfCoreReader
	XdmfHDF5Controller
	XdmfHDF5Writer
63
64
	XdmfHeavyDataController
	XdmfHeavyDataWriter
65
	XdmfInformation
66
67
	XdmfItem
	XdmfItemProperty
68
	XdmfSystemUtils
69
    XdmfVersion
70
	XdmfVisitor
71
	XdmfWriter
72
73
)

74
if(XDMF_BUILD_DSM)
75
76
77
78
	set(XdmfCoreSources 
		${XdmfCoreSources}
		XdmfHDF5ControllerDSM 
		XdmfHDF5WriterDSM)
79
80
endif(XDMF_BUILD_DSM)

81
add_library(XdmfCore ${XdmfCoreSources})
82
target_link_libraries(XdmfCore ${HDF5_hdf5_LIBRARY} ${HDF5DSM_LIBRARIES} ${LIBXML2_LIBRARIES})
83

84
85
86
87
88
89
90
91
92
93
if(WIN32)
    add_definitions(-D_HDF5USEDLL_ -D_HDF5USEHLDLL_)
    set_target_properties(XdmfCore PROPERTIES 
            DEFINE_SYMBOL XdmfCore_EXPORTS
            PREFIX ../
            RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
            LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
            ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
endif(WIN32)

94
if(XDMF_WRAP_JAVA)
95
	XDMF_SWIG_JAVA(XdmfCore)
96
97
endif(XDMF_WRAP_JAVA)

98
if(XDMF_WRAP_PYTHON)
99
	XDMF_SWIG_PYTHON(XdmfCore)
100
101
endif(XDMF_WRAP_PYTHON)

102
file(GLOB_RECURSE XdmfCoreHeaders "*.hpp" "*.tpp" "*.i" "../CMake/VersionSuite/*.hpp")
103
file(GLOB LokiHeaders loki/*.h)
104
install(FILES ${XdmfCoreHeaders} DESTINATION include)
105
install(FILES ${LokiHeaders} DESTINATION include/loki)
106
107
108
109
110
install(TARGETS XdmfCore 
    RUNTIME DESTINATION bin
    LIBRARY DESTINATION lib
    ARCHIVE DESTINATION lib
)
111

112
set(XdmfCore_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR} ${HDF5_INCLUDE_DIR} ${LIBXML2_INCLUDE_DIR} ${PYTHON_INCLUDE_DIRS} CACHE INTERNAL "")
113

114
if(BUILD_TESTING)
115
	add_subdirectory(tests)
116
endif(BUILD_TESTING)