/alps/fastwriter

To get this branch, use:
bzr branch http://darksoft.org/webbzr/alps/fastwriter
16 by Suren A. Chilingaryan
RPM support
1
project(fastwriter C)
1 by Suren A. Chilingaryan
Initial release
2
16 by Suren A. Chilingaryan
RPM support
3
set(RELEASE "0")
9 by Suren A. Chilingaryan
Support XFS RealTime partition
4
set(FASTWRITER_VERSION "0.0.2")
1 by Suren A. Chilingaryan
Initial release
5
set(FASTWRITER_ABI_VERSION "0")
6
7
cmake_minimum_required(VERSION 2.8)
8
13 by Suren A. Chilingaryan
AIO support
9
set(DISABLE_AIO TRUE CACHE BOOL "Use kernel AIO writer")
9 by Suren A. Chilingaryan
Support XFS RealTime partition
10
set(DISABLE_XFS_REALTIME FALSE CACHE BOOL "Disable support of RealTime XFS partition")
12.1.2 by Suren A. Chilingaryan
Seems new memcpy is only good for ipepdvcompute2, make it optional and disabled by default
11
set(USE_CUSTOM_MEMCPY FALSE CACHE BOOL "Use custom memcpy routine instead of stanadrd")
1 by Suren A. Chilingaryan
Initial release
12
18 by Suren A. Chilingaryan
Use GNUInstallDirs to detect install paths
13
include(GNUInstallDirs)
1 by Suren A. Chilingaryan
Initial release
14
include(CheckIncludeFiles)
15
check_include_files("linux/falloc.h" HAVE_LINUX_FALLOC_H)
16
9 by Suren A. Chilingaryan
Support XFS RealTime partition
17
if (NOT DISABLE_XFS_REALTIME)
18
    check_include_files("xfs/xfs.h" HAVE_XFS_H)
19
    if (NOT HAVE_XFS_H)
12.2.1 by Suren A. Chilingaryan
Detect missing libuuid library
20
	check_include_files("uuid/uuid.h" HAVE_UUID_H)
21
	if (HAVE_UUID_H)
22
	    message(FATAL_ERROR "error: xfs/xfs.h is not found...")
23
	else (HAVE_UUID_H)
24
	    message(FATAL_ERROR "error: uuid/uuid.h is not found...")
25
	endif (HAVE_UUID_H)
9 by Suren A. Chilingaryan
Support XFS RealTime partition
26
    endif (NOT HAVE_XFS_H)
27
endif (NOT DISABLE_XFS_REALTIME)
28
6 by Suren A. Chilingaryan
Adjust cmake scripts
29
include_directories(
30
    ${CMAKE_SOURCE_DIR}/src 
31
    ${CMAKE_CURRENT_BINARY_DIR}
32
)
33
1 by Suren A. Chilingaryan
Initial release
34
add_definitions("-fPIC --std=c99 -Wall -O2 -pthread")
35
6 by Suren A. Chilingaryan
Adjust cmake scripts
36
set(HEADERS fastwriter.h sysinfo.h default.h private.h)
13 by Suren A. Chilingaryan
AIO support
37
set(SOURCES fastwriter.c sysinfo.c default.c)
38
12.1.2 by Suren A. Chilingaryan
Seems new memcpy is only good for ipepdvcompute2, make it optional and disabled by default
39
if (USE_CUSTOM_MEMCPY)
14 by Suren A. Chilingaryan
Merge custom memcpy
40
    set(HEADERS ${HEADERS} memcpy.h)
41
    set(SOURCES ${SOURCES} memcpy.c)
12.1.2 by Suren A. Chilingaryan
Seems new memcpy is only good for ipepdvcompute2, make it optional and disabled by default
42
endif (USE_CUSTOM_MEMCPY)
43
13 by Suren A. Chilingaryan
AIO support
44
if (NOT DISABLE_AIO)
45
    check_include_files("libaio.h" HAVE_LIBAIO_H)
46
    if (NOT HAVE_LIBAIO_H)
47
	message(FATAL_ERROR "error: libaio.h is not found...")
48
    endif (NOT HAVE_LIBAIO_H)
49
endif (NOT DISABLE_AIO)
50
51
add_library(fastwriter SHARED ${SOURCES}) 
1 by Suren A. Chilingaryan
Initial release
52
53
set_target_properties(fastwriter PROPERTIES
54
    VERSION ${FASTWRITER_VERSION}
55
    SOVERSION ${FASTWRITER_ABI_VERSION}
56
    LINK_FLAGS "-pthread"
57
)
58
13 by Suren A. Chilingaryan
AIO support
59
if (NOT DISABLE_AIO)
60
    target_link_libraries(fastwriter aio)
61
endif (NOT DISABLE_AIO)
62
1 by Suren A. Chilingaryan
Initial release
63
set(TARNAME "fastwriter")
64
set(PACKAGE_VERSION ${FASTWRITER_VERSION})
65
set(PACKAGE_NAME "${TARNAME}")
66
set(PACKAGE_TARNAME "${TARNAME}")
67
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
68
set(PACKAGE_BUGREPORT "http://ufo.kit.edu/ufo/newticket")
69
16 by Suren A. Chilingaryan
RPM support
70
set(CPACK_SOURCE_GENERATOR "TBZ2")
71
set(CPACK_PACKAGE_CONTACT "Suren A. Chilingaryan <csa@suren.me>")
72
if (${RELEASE} GREATER 0)
73
    set(CPACK_PACKAGE_VERSION "${PACKAGE_VERSION}.${RELEASE}")
74
else (${RELEASE} GREATER 0)
75
    set(CPACK_PACKAGE_VERSION "${PACKAGE_VERSION}")
76
endif (${RELEASE} GREATER 0)
77
set(CPACK_SOURCE_IGNORE_FILES "/.bzr/;CMakeFiles;_CPack_Packages;cmake_install.cmake;CPack.*.cmake;CMakeCache.txt;install_manifest.txt;config.h$;.pc$;Makefile;.tar.bz2$;~$;${CPACK_SOURCE_IGNORE_FILES}")
78
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION}")
79
include(CPack)
80
81
add_custom_target(dist_clean COMMAND ${CMAKE_MAKE_PROGRAM} clean WORKING_DIRECTORY ${CMAKE_CURRENT_DIR})
82
add_custom_target(dist DEPENDS dist_clean COMMAND ${CMAKE_MAKE_PROGRAM} package_source)
83
84
1 by Suren A. Chilingaryan
Initial release
85
configure_file(fastwriter.pc.in ${CMAKE_CURRENT_BINARY_DIR}/fastwriter.pc)
16 by Suren A. Chilingaryan
RPM support
86
configure_file(fastwriter.spec.in ${CMAKE_CURRENT_BINARY_DIR}/fastwriter.spec)
1 by Suren A. Chilingaryan
Initial release
87
configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
88
89
install(TARGETS fastwriter
18 by Suren A. Chilingaryan
Use GNUInstallDirs to detect install paths
90
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
1 by Suren A. Chilingaryan
Initial release
91
)
92
93
install(FILES fastwriter.h
19 by Suren A. Chilingaryan
Use also
94
    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
1 by Suren A. Chilingaryan
Initial release
95
)
96
97
install(FILES 
98
    ${CMAKE_CURRENT_BINARY_DIR}/fastwriter.pc 
18 by Suren A. Chilingaryan
Use GNUInstallDirs to detect install paths
99
    DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
1 by Suren A. Chilingaryan
Initial release
100
)