1 set(TNG_ROOT_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR})
2 file(RELATIVE_PATH TNG_ROOT_BINARY_DIR ${CMAKE_SOURCE_DIR} ${TNG_ROOT_SOURCE_DIR})
3 set(TNG_ROOT_BINARY_DIR ${CMAKE_BINARY_DIR}/${TNG_ROOT_BINARY_DIR})
5 function (TNG_GENERATE_VERSION_H)
6 set(TNG_MAJOR_VERSION "1")
7 set(TNG_MINOR_VERSION "7")
8 set(TNG_VERSION_PATCH_LEVEL "3")
9 set(TNG_IO_VERSION "${TNG_MAJOR_VERSION}.${TNG_MINOR_VERSION}.${TNG_VERSION_PATCH_LEVEL}")
10 set(TNG_API_VERSION "7")
11 configure_file(${TNG_ROOT_SOURCE_DIR}/include/tng/version.h.in
12 ${TNG_ROOT_BINARY_DIR}/include/tng/version.h)
14 set(TNG_MAJOR_VERSION ${TNG_MAJOR_VERSION} PARENT_SCOPE)
15 set(TNG_IO_VERSION ${TNG_IO_VERSION} PARENT_SCOPE)
18 tng_generate_version_h()
20 include(TestBigEndian)
21 test_big_endian(TNG_INTEGER_BIG_ENDIAN)
22 include(CheckIncludeFile)
23 check_include_file(inttypes.h TNG_HAVE_INTTYPES_H)
25 macro(TNG_GET_SOURCE_LIST TNG_SOURCELIST TNG_COMPILEDEFS)
26 include_directories(BEFORE ${TNG_ROOT_SOURCE_DIR}/include)
27 include_directories(BEFORE ${TNG_ROOT_BINARY_DIR}/include)
28 set(_tng_compression_sources bwlzh.c bwt.c coder.c dict.c fixpoint.c huffman.c huffmem.c lz77.c merge_sort.c mtf.c rle.c tng_compress.c vals16.c warnmalloc.c widemuldiv.c xtc2.c xtc3.c)
29 set(_tng_io_sources tng_io.c md5.c)
30 set(${TNG_SOURCELIST})
31 set(${TNG_COMPILEDEFS})
32 foreach(_file ${_tng_compression_sources})
33 list(APPEND ${TNG_SOURCELIST} ${TNG_ROOT_SOURCE_DIR}/src/compression/${_file})
35 foreach(_file ${_tng_io_sources})
36 list(APPEND ${TNG_SOURCELIST} ${TNG_ROOT_SOURCE_DIR}/src/lib/${_file})
39 list(APPEND ${TNG_SOURCELIST} ${TNG_ROOT_SOURCE_DIR}/src/lib/tng_io_fortran.c)
41 if (TNG_HAVE_INTTYPES_H)
42 list(APPEND ${TNG_COMPILEDEFS} USE_STD_INTTYPES_H)
46 macro(TNG_SET_SOURCE_PROPERTIES)
47 set(_tng_with_zlib OFF)
49 foreach (_arg ${ARGN})
50 if (_arg STREQUAL "WITH_ZLIB")
51 set(_curr_var with_zlib)
53 set(_tng_${_curr_var} ${_arg})
56 message(FATAL_ERROR "Invalid argument ${_arg} to TNG_SET_SOURCE_PROPERTIES")
60 set_property(SOURCE ${TNG_ROOT_SOURCE_DIR}/src/lib/tng_io.c
61 APPEND PROPERTY COMPILE_DEFINITIONS USE_ZLIB)
63 if (TNG_HAVE_INTTYPES_H)
64 set_property(SOURCE ${TNG_ROOT_SOURCE_DIR}/src/lib/tng_io.c
65 APPEND PROPERTY COMPILE_DEFINITIONS USE_STD_INTTYPES_H)
67 if (TNG_INTEGER_BIG_ENDIAN)
68 set_property(SOURCE ${TNG_ROOT_SOURCE_DIR}/src/lib/md5.c
69 APPEND PROPERTY COMPILE_DEFINITIONS TNG_INTEGER_BIG_ENDIAN)