CMakeLists.txt 2.02 KB
Newer Older
1
2
include_directories(${CMAKE_CURRENT_SOURCE_DIR})

3
option(XDMF_BUILD_EXODUS_IO OFF)
4
option(XDMF_BUILD_PARTITIONER OFF)
5

6
set(XdmfUtilsSources
7
  XdmfTopologyConverter)
8
set(XdmfUtilsLinkLibraries Xdmf)
9

10
if(XDMF_BUILD_EXODUS_IO)
11
  set(XDMF_SWIG_FLAGS ${XDMF_SWIG_FLAGS} -DXDMF_BUILD_EXODUS_IO)
12
13
14
15
16
17
18
19
20
  find_package(Exodus REQUIRED)
  if(EXODUS_FOUND)
    include_directories(${EXODUS_INCLUDE_DIR} ${NetCDF_INCLUDE_DIR})
  endif(EXODUS_FOUND)
  set(XdmfUtilsSources ${XdmfUtilsSources} XdmfExodusReader XdmfExodusWriter)
  set(XdmfUtilsLinkLibraries
    ${XdmfUtilsLinkLibraries}
    ${EXODUS_LIBRARIES}
    ${NetCDF_LIBRARIES})
21
22
endif(XDMF_BUILD_EXODUS_IO)

23
if(XDMF_BUILD_PARTITIONER)
24
  set(XDMF_SWIG_FLAGS ${XDMF_SWIG_FLAGS} -DXDMF_BUILD_PARTITIONER)
25
26
27
28
29
30
31
  find_package(Metis REQUIRED)
  if(METIS_FOUND)
    include_directories(${METIS_INCLUDE_DIR})
  endif(METIS_FOUND)
  set(XdmfUtilsExecutables ${XdmfUtilsExecutables} XdmfPartitioner)
  set(XdmfUtilsSources ${XdmfUtilsSources} XdmfPartitioner)
  set(XdmfUtilsLinkLibraries ${XdmfUtilsLinkLibraries} ${METIS_LIBRARIES})
32
endif(XDMF_BUILD_PARTITIONER)
33
34

add_library(XdmfUtils ${XdmfUtilsSources})
35
36
target_link_libraries(XdmfUtils ${XdmfUtilsLinkLibraries})

37
foreach(executable ${XdmfUtilsExecutables})
38
39
40
  add_executable(${executable} ${executable})
  set_target_properties(${executable} PROPERTIES COMPILE_FLAGS -DBUILD_EXE)
  target_link_libraries(${executable} XdmfUtils)
41
endforeach(executable ${XdmfUtilsExecutables})
42

43
if(BUILD_TESTING)
44
  add_subdirectory(tests)
45
endif(BUILD_TESTING)
46

47
if(XDMF_WRAP_JAVA)
48
49
  XDMF_SWIG_JAVA(XdmfUtils XdmfJava)
  set(XDMF_UTILS_JAVA_JAR ${CMAKE_BINARY_DIR}/XdmfUtils.jar CACHE INTERNAL "")
50
endif(XDMF_WRAP_JAVA)
51

52
53
54
55
if(XDMF_WRAP_PYTHON)
  XDMF_SWIG_PYTHON(XdmfUtils Xdmf)
endif(XDMF_WRAP_PYTHON)

56
foreach(source ${XdmfUtilsSources})
57
  set(XdmfUtilsHeaders ${XdmfUtilsHeaders} ${source}.hpp)
58
endforeach(source ${XdmfUtilsSources})
59

60
install(FILES ${XdmfUtilsHeaders} DESTINATION include)
61
install(TARGETS XdmfUtils LIBRARY DESTINATION lib)
62
install(TARGETS ${XdmfUtilsExecutables} RUNTIME DESTINATION bin)