CMakeLists.txt 3.11 KB
Newer Older
1
project(Xdmf)
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
2
3
4
cmake_minimum_required(VERSION 2.6)

set(BUILD_SHARED_LIBS true)
5
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
6
7
8
9
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)
10
11
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMake ${CMAKE_CURRENT_SOURCE_DIR}/core/CMake)
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
12

13
14
add_subdirectory(core)
include_directories(${XdmfCore_INCLUDE_DIRS})
15
include_directories(tests/Cxx)
16
17

set(XdmfSources
18
	XdmfAttribute
19
	XdmfAttributeCenter
20
	XdmfAttributeType
21
	XdmfDomain
22
	XdmfGeometry
23
	XdmfGeometryType
24
	XdmfGrid
25
26
	XdmfGridCollection
	XdmfGridCollectionType
27
	XdmfItemFactory
28
	XdmfMap
29
	XdmfReader
30
31
	XdmfSet
	XdmfSetType
32
	XdmfTime
33
	XdmfTopology
34
	XdmfTopologyType
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
35
36
37
)

add_library(Xdmf ${XdmfSources})
38
target_link_libraries(Xdmf XdmfCore)
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
39

40
41
option(XDMF_BUILD_DOCUMENTATION OFF)
if(XDMF_BUILD_DOCUMENTATION)
42
	add_subdirectory(doc)
43
endif(XDMF_BUILD_DOCUMENTATION)
44

45
46
47
if(XDMF_WRAP_PYTHON)
	find_package(SWIG REQUIRED)
	include(${SWIG_USE_FILE})
48
49
	find_package(PythonLibs REQUIRED)
	include_directories(${PYTHON_INCLUDE_DIRS})
50
	set(CMAKE_SWIG_OUTDIR ${CMAKE_BINARY_DIR})
51
52
53
	set_source_files_properties(Xdmf.i PROPERTIES CPLUSPLUS ON)
	swig_add_module(Xdmf python Xdmf.i)
	swig_link_libraries(Xdmf Xdmf ${PYTHON_LIBRARIES})
54
55
	install(FILES ${CMAKE_BINARY_DIR}/Xdmf.py DESTINATION lib/python)
	install(TARGETS ${SWIG_MODULE_Xdmf_REAL_NAME} DESTINATION lib/python)
56
endif(XDMF_WRAP_PYTHON)
57

58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
if(XDMF_WRAP_JAVA)
	find_package(SWIG REQUIRED)
	include(${SWIG_USE_FILE})
	set(CMAKE_SWIG_OUTDIR ${CMAKE_BINARY_DIR})
        set_source_files_properties(Xdmf.i PROPERTIES CPLUSPLUS ON)
        find_package(Java REQUIRED)
        find_package(JNI REQUIRED)
        set(CMAKE_SWIG_FLAGS -v -make_default -package mil.army.arl.xdmf)
        set(XDMF_JAVA_PACKAGE_DIR mil/army/arl/xdmf)
        set(XDMF_JAVA_DIR ${CMAKE_CURRENT_BINARY_DIR}/${XDMF_JAVA_PACKAGE_DIR})
        file(MAKE_DIRECTORY ${XDMF_JAVA_DIR})
        set(CMAKE_SWIG_OUTDIR ${XDMF_JAVA_DIR})
        include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2})
        swig_add_module(XdmfJava java Xdmf.i)
        swig_link_libraries(XdmfJava Xdmf)
        add_dependencies(XdmfJava XdmfCoreJava)
        set(XDMF_JAVA_JAR ${CMAKE_BINARY_DIR}/Xdmf.jar CACHE INTERNAL "")
        add_custom_command(TARGET XdmfJava
                           POST_BUILD
                           DEPENDS ${XDMF_CORE_JAVA_JAR}
                           COMMAND ${JAVA_COMPILE} ARGS -cp ${XDMF_CORE_JAVA_JAR} "${CMAKE_CURRENT_BINARY_DIR}/mil/army/arl/xdmf/*.java"
                           COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_CURRENT_BINARY_DIR} ${JAVA_ARCHIVE} -cvf ${XDMF_JAVA_JAR} "mil/army/arl/xdmf/*.class")
endif(XDMF_WRAP_JAVA)

82
83
84
85
86
option(XDMF_BUILD_UTILS OFF)
if(XDMF_BUILD_UTILS)
	add_subdirectory(utils)
endif(XDMF_BUILD_UTILS)

87
88
89
file(GLOB XdmfHeaders *.hpp)
install(FILES ${XdmfHeaders} DESTINATION include)
install(TARGETS Xdmf LIBRARY DESTINATION lib)
90

91
92
93
94
95
if(XDMF_BUILD_TESTING)
	enable_testing()
	add_subdirectory(tests)
endif(XDMF_BUILD_TESTING)