summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2013-03-15 18:28:37 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2013-03-15 18:28:37 (GMT)
commit2923f64c28650e55833dd9d9a088dd7c4804e3e8 (patch)
treebbf4f0e68aa231c4dd38665a4d4301fc77e76b24 /test
parentc1ddb82ac1d160d59d32f9a012dbffd11911292b (diff)
downloadhdf5-2923f64c28650e55833dd9d9a088dd7c4804e3e8.zip
hdf5-2923f64c28650e55833dd9d9a088dd7c4804e3e8.tar.gz
hdf5-2923f64c28650e55833dd9d9a088dd7c4804e3e8.tar.bz2
[svn-r23357] HDFFV-8338: Add cmake support, this commit only tested for linux
Tested: local linux
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt15
-rw-r--r--test/plugin_lib/CMakeLists.txt74
2 files changed, 89 insertions, 0 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 6af1e94..d104978 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -7,6 +7,21 @@ PROJECT (HDF5_TEST)
ADD_DEFINITIONS (${HDF5_EXTRA_C_FLAGS})
#-----------------------------------------------------------------------------
+# If plugin library tests can be tested
+#-----------------------------------------------------------------------------
+IF (BUILD_SHARED_LIBS)
+ IF (EXISTS "${HDF5_TEST_SOURCE_DIR}/plugin_lib" AND IS_DIRECTORY "${HDF5_TEST_SOURCE_DIR}/plugin_lib")
+ ADD_SUBDIRECTORY (${HDF5_TEST_SOURCE_DIR}/plugin_lib ${PROJECT_BINARY_DIR}/plugin_lib)
+ ENDIF (EXISTS "${HDF5_TEST_SOURCE_DIR}/plugin_lib" AND IS_DIRECTORY "${HDF5_TEST_SOURCE_DIR}/plugin_lib")
+ELSE (BUILD_SHARED_LIBS)
+ MESSAGE (STATUS " **** Plugins libraries must be built as shared libraries **** ")
+ ADD_TEST (
+ NAME H5PLUGIN-SKIPPED
+ COMMAND ${CMAKE_COMMAND} -E echo "SKIP H5PLUGIN TESTING"
+ )
+ENDIF (BUILD_SHARED_LIBS)
+
+#-----------------------------------------------------------------------------
# Define Sources
#-----------------------------------------------------------------------------
SET (TEST_LIB_SRCS
diff --git a/test/plugin_lib/CMakeLists.txt b/test/plugin_lib/CMakeLists.txt
new file mode 100644
index 0000000..f39e2df
--- /dev/null
+++ b/test/plugin_lib/CMakeLists.txt
@@ -0,0 +1,74 @@
+cmake_minimum_required (VERSION 2.8.10)
+PROJECT (HDF5_TEST_PLUGIN_LIB)
+
+#-----------------------------------------------------------------------------
+# Set the core name of the library
+#-----------------------------------------------------------------------------
+SET (HDF5_TEST_PLUGIN_LIB_CORENAME "dynlib1")
+
+#-----------------------------------------------------------------------------
+# Set the true names of all the libraries if customized by external project
+#-----------------------------------------------------------------------------
+SET (HDF5_TEST_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TEST_PLUGIN_LIB_CORENAME}")
+
+#-----------------------------------------------------------------------------
+# Set the target names of all the libraries
+#-----------------------------------------------------------------------------
+SET (HDF5_TEST_PLUGIN_LIB_TARGET ${HDF5_TEST_PLUGIN_LIB_CORENAME})
+
+#-----------------------------------------------------------------------------
+# Apply Definitions to compiler in this directory and below
+#-----------------------------------------------------------------------------
+ADD_DEFINITIONS (${HDF5_EXTRA_C_FLAGS})
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_SRC_DIR})
+
+#-----------------------------------------------------------------------------
+# Define Sources
+#-----------------------------------------------------------------------------
+
+SET (H5_TEST_PLUGIN_LIB_SRCS
+ ${HDF5_TEST_PLUGIN_LIB_SOURCE_DIR}/dynlib1.c
+)
+
+SET (H5_TEST_PLUGIN_LIB_HDRS
+ ${HDF5_TEST_PLUGIN_LIB_SOURCE_DIR}/dynlib1.h
+ ${HDF5_TEST_SOURCE_DIR}/H5srcdir.h
+ ${HDF5_TEST_SOURCE_DIR}/h5test.h
+)
+
+#-----------------------------------------------------------------------------
+# Generate the H5srcdir_str.h file containing user settings needed by compilation
+#-----------------------------------------------------------------------------
+SET (srcdir ${CMAKE_CURRENT_SOURCE_DIR})
+CONFIGURE_FILE (${HDF5_TEST_SOURCE_DIR}/H5srcdir_str.h.in H5srcdir_str.h @ONLY)
+INCLUDE_DIRECTORIES (${CMAKE_CURRENT_BINARY_DIR})
+
+ADD_LIBRARY (${HDF5_TEST_PLUGIN_LIB_TARGET} ${LIB_TYPE} ${H5_TEST_PLUGIN_LIB_SRCS} ${H5_TEST_PLUGIN_LIB_HDRS})
+TARGET_LINK_LIBRARIES (${HDF5_TEST_PLUGIN_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
+#SET_GLOBAL_VARIABLE( HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_TEST_PLUGIN_LIB_TARGET}")
+H5_SET_LIB_OPTIONS (
+ ${HDF5_TEST_PLUGIN_LIB_TARGET} ${HDF5_TEST_PLUGIN_LIB_NAME}
+ ${LIB_TYPE}
+ HDF5_TEST_PLUGIN_LIB_NAME_RELEASE
+ HDF5_TEST_PLUGIN_LIB_NAME_DEBUG
+)
+SET_TARGET_PROPERTIES (${HDF5_TEST_PLUGIN_LIB_TARGET} PROPERTIES FOLDER libraries/TEST_PLUGIN)
+
+##############################################################################
+##############################################################################
+### T E S T S ###
+##############################################################################
+##############################################################################
+
+#-- Adding test for plugin
+ADD_EXECUTABLE (plugin ${HDF5_TEST_SOURCE_DIR}/plugin.c)
+TARGET_NAMING (plugin ${LIB_TYPE})
+TARGET_LINK_LIBRARIES (plugin ${HDF5_TEST_PLUGIN_LIB_TARGET})
+SET_TARGET_PROPERTIES (plugin PROPERTIES FOLDER test)
+
+ADD_TEST (NAME H5PLUGIN-plugin COMMAND $<TARGET_FILE:plugin>)
+SET_TESTS_PROPERTIES (H5PLUGIN-plugin PROPERTIES ENVIRONMENT HDF5_PLUGIN_PATH=${CMAKE_BINARY_DIR}/bin)