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

Brian Panneton's avatar
Brian Panneton committed
4
5
6
7
8
9
10
include(SetUpVersion)
if(VERSION_CONTROL_AUTOUPDATE)
        VersionMajorSet("2")
        VersionCalculate()
        VersionWrite("Xdmf")
endif(VERSION_CONTROL_AUTOUPDATE)

11
12
set(BUILD_SHARED_LIBS true)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
13
14
15
16
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)
17

18
19
option(XDMF_BUILD_DSM OFF)

20
21
22
23
24
25
26
27
28
29
find_package(Boost REQUIRED)
if(Boost_FOUND)
	include_directories(${Boost_INCLUDE_DIRS})
endif(Boost_FOUND)

find_package(HDF5 REQUIRED)
if(HDF5_FOUND)
	include_directories(${HDF5_INCLUDE_DIR})	
endif(HDF5_FOUND)

30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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)

45
46
47
48
49
50
51
52
53
54
55
56
find_package(LibXml2 REQUIRED)
if(LIBXML2_FOUND)
	include_directories(${LIBXML2_INCLUDE_DIR})
endif(LIBXML2_FOUND)

set(XdmfCoreSources
	XdmfArray
	XdmfArrayType
	XdmfCoreItemFactory
	XdmfCoreReader
	XdmfHDF5Controller
	XdmfHDF5Writer
57
58
	XdmfHeavyDataController
	XdmfHeavyDataWriter
59
	XdmfInformation
60
61
	XdmfItem
	XdmfItemProperty
62
	XdmfSystemUtils
63
	XdmfVisitor
64
	XdmfWriter
65
66
)

67
if(XDMF_BUILD_DSM)
68
69
70
71
	set(XdmfCoreSources 
		${XdmfCoreSources}
		XdmfHDF5ControllerDSM 
		XdmfHDF5WriterDSM)
72
73
endif(XDMF_BUILD_DSM)

74
add_library(XdmfCore ${XdmfCoreSources})
75
target_link_libraries(XdmfCore ${HDF5_LIBRARIES} ${HDF5DSM_LIBRARIES} ${LIBXML2_LIBRARIES})
76

77
if(XDMF_WRAP_JAVA)
78
	XDMF_SWIG_JAVA(XdmfCore)
79
80
endif(XDMF_WRAP_JAVA)

81
if(XDMF_WRAP_PYTHON)
82
	XDMF_SWIG_PYTHON(XdmfCore)
83
84
endif(XDMF_WRAP_PYTHON)

85
86
87
88
file(GLOB XdmfCoreHeaders *.hpp)
install(FILES ${XdmfCoreHeaders} DESTINATION include)
install(TARGETS XdmfCore LIBRARY DESTINATION lib)

89
set(XdmfCore_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR} ${HDF5_INCLUDE_DIR} ${LIBXML2_INCLUDE_DIR} ${PYTHON_INCLUDE_DIRS} CACHE INTERNAL "")
90

91
if(BUILD_TESTING)
92
	add_subdirectory(tests)
93
endif(BUILD_TESTING)