summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Lundborg <lundborg.magnus@gmail.com>2013-03-21 09:26:47 (GMT)
committerMagnus Lundborg <lundborg.magnus@gmail.com>2013-03-21 09:26:47 (GMT)
commit2d9ab8101ca2d287b7b033fc4c3057f56d9c5068 (patch)
tree4d162f6d4d58f961913dc09220921461911c02df
parent61b8806cf3a1164ae145d42cc48ca7c432e2ab53 (diff)
Only compile Fortran compatibility if requested. Fix error in commit b97f4dff
-rw-r--r--CMakeLists.txt2
-rw-r--r--include/tng_io.h25
-rw-r--r--src/lib/CMakeLists.txt8
-rw-r--r--src/lib/tng_io.c2
4 files changed, 22 insertions, 15 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3a810af..3e32141 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,7 +7,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
include_directories(${CMAKE_SOURCE_DIR}/include)
-option(BUILD_FORTRAN "Build Fortran examples" OFF)
+option(BUILD_FORTRAN "Build Fortran compatible library and examples for testing" OFF)
option(USE_OPENMP "Try to use the OpenMP library (if available)" ON)
if(USE_OPENMP)
diff --git a/include/tng_io.h b/include/tng_io.h
index ccaae11..ce56dd5 100644
--- a/include/tng_io.h
+++ b/include/tng_io.h
@@ -33,9 +33,9 @@
* your own risk.
*
* @section authors_sec Authors
- *
+ *
* The TNG trajectory format is developed by:
- *
+ *
* Magnus Lundborg magnus.lundborg@scilifelab.se
*
* Daniel SpÄngberg daniels@mkem.uu.se
@@ -50,7 +50,7 @@
*
* Copyright (c) 2012, The GROMACS development team.
* check out http://www.gromacs.org for more information.
- *
+ *
* The TNG API is released under LGPL 2.1 and is free to redistribute according
* to that license (or a later version of the LGPL license).
*
@@ -59,11 +59,11 @@
* @section install_sec Installation
*
* mkdir build
- *
+ *
* cd build
- *
+ *
* cmake ..
- *
+ *
* make
*
* Test by running:
@@ -85,7 +85,7 @@
* - Update frame set pointers properly.
* - Fixed bug in chain_name_of_particle_get(...)
* - Fixed bug when updating MD5 hashes of data blocks.
- *
+ *
* v. 1.0 - First stable release of the API.
*
*
@@ -216,7 +216,7 @@
*
* To compile the fortran example -DBUILD_FORTRAN=ON needs to be specified when
* running cmake.
- *
+ *
*/
#ifndef _TNGIO_H
@@ -230,7 +230,7 @@
#ifdef USE_STD_INTTYPES_H
#include <inttypes.h>
#else
-
+//
/* Visual Studio does not contain inttypes.h and stdint.h. Some defines and
* typedefs are used from the GNU C Library */
@@ -307,7 +307,7 @@ typedef unsigned long long int uint64_t;
({ __typeof__ (a) _a = (a); \
__typeof__ (b) _b = (b); \
_a < _b ? _a : _b; })
-
+
/** Inline function for finding the highest of two values */
#define tng_max(a,b) \
({ __typeof__ (a) _a = (a); \
@@ -354,12 +354,12 @@ typedef enum {TNG_TRAJ_BOX_SHAPE = 10000,
TNG_TRAJ_VELOCITIES,
TNG_TRAJ_FORCES,
TNG_TRAJ_PARTIAL_CHARGES} tng_trajectory_block_ids;
-
+
/** Flag to specify if a data block contains data related to particles or not.*/
typedef enum {TNG_NON_PARTICLE_BLOCK_DATA,
TNG_PARTICLE_BLOCK_DATA} tng_particle_block_data;
-
+
typedef enum {TNG_FALSE, TNG_TRUE} tng_bool;
/** Flag to specify if the number of atoms change throughout the trajectory or
@@ -1597,6 +1597,7 @@ tng_function_status tng_time_get_str(const tng_trajectory_t tng_data,
char *time);
+
#ifdef __cplusplus
} /* end extern "C" */
#endif
diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt
index 18cf32f..3cd090b 100644
--- a/src/lib/CMakeLists.txt
+++ b/src/lib/CMakeLists.txt
@@ -1,10 +1,14 @@
add_library(tng_io SHARED tng_io.c md5.c)
if(HAVE_INTTYPES_H)
- set_target_properties(tng_io PROPERTIES COMPILE_DEFINITIONS USE_STD_INTTYPES_H=1)
+ set_property(TARGET tng_io APPEND PROPERTY COMPILE_DEFINITIONS USE_STD_INTTYPES_H)
+endif()
+
+if(BUILD_FORTRAN)
+ set_property(TARGET tng_io APPEND PROPERTY COMPILE_DEFINITIONS BUILD_FORTRAN)
endif()
if(ZLIB_FOUND)
- set_target_properties(tng_io PROPERTIES COMPILE_DEFINITIONS USE_ZLIB=1)
+ set_property(TARGET tng_io APPEND PROPERTY COMPILE_DEFINITIONS USE_ZLIB)
target_link_libraries(tng_io ${ZLIB_LIBRARIES})
endif()
diff --git a/src/lib/tng_io.c b/src/lib/tng_io.c
index fdb7809..d985b2d 100644
--- a/src/lib/tng_io.c
+++ b/src/lib/tng_io.c
@@ -11987,6 +11987,7 @@ tng_function_status tng_time_get_str(const tng_trajectory_t tng_data,
}
+#ifdef BUILD_FORTRAN
/* The following is for calling the library from fortran */
tng_function_status tng_trajectory_init_(tng_trajectory_t *tng_data_p)
@@ -12771,3 +12772,4 @@ tng_function_status tng_time_get_str_(const tng_trajectory_t tng_data,
{
return(tng_time_get_str(tng_data, time));
}
+#endif
contact: Jan Huwald // Impressum