mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-01-30 15:32:37 +08:00
[svn-r23357] HDFFV-8338: Add cmake support, this commit only tested for linux
Tested: local linux
This commit is contained in:
parent
c1ddb82ac1
commit
2923f64c28
@ -477,6 +477,16 @@ SET (H5P_HDRS
|
||||
)
|
||||
IDE_GENERATED_PROPERTIES ("H5P" "${H5P_HDRS}" "${H5P_SRCS}" )
|
||||
|
||||
SET (H5PL_SRCS
|
||||
${HDF5_SRC_DIR}/H5PL.c
|
||||
)
|
||||
|
||||
SET (H5PL_HDRS
|
||||
${HDF5_SRC_DIR}/H5PLpkg.h
|
||||
${HDF5_SRC_DIR}/H5PLpublic.h
|
||||
)
|
||||
IDE_GENERATED_PROPERTIES ("H5PL" "${H5PL_HDRS}" "${H5PL_SRCS}" )
|
||||
|
||||
|
||||
SET (H5R_SRCS
|
||||
${HDF5_SRC_DIR}/H5R.c
|
||||
@ -662,6 +672,7 @@ SET (common_SRCS
|
||||
${H5MP_SRCS}
|
||||
${H5O_SRCS}
|
||||
${H5P_SRCS}
|
||||
${H5PL_SRCS}
|
||||
${H5R_SRCS}
|
||||
${H5RC_SRCS}
|
||||
${H5RS_SRCS}
|
||||
@ -701,6 +712,7 @@ SET (H5_PUBLIC_HEADERS
|
||||
${H5MP_HDRS}
|
||||
${H5O_HDRS}
|
||||
${H5P_HDRS}
|
||||
${H5PL_HDRS}
|
||||
${H5R_HDRS}
|
||||
${H5S_HDRS}
|
||||
${H5SM_HDRS}
|
||||
@ -739,6 +751,7 @@ SET (H5_PRIVATE_HEADERS
|
||||
${HDF5_SRC_DIR}/H5MPprivate.h
|
||||
${HDF5_SRC_DIR}/H5Oprivate.h
|
||||
${HDF5_SRC_DIR}/H5Pprivate.h
|
||||
${HDF5_SRC_DIR}/H5PLprivate.h
|
||||
${HDF5_SRC_DIR}/H5RCprivate.h
|
||||
${HDF5_SRC_DIR}/H5Rprivate.h
|
||||
${HDF5_SRC_DIR}/H5RSprivate.h
|
||||
@ -825,6 +838,9 @@ SET_SOURCE_FILES_PROPERTIES (${HDF5_BINARY_DIR}/H5overflow.h GENERATED)
|
||||
|
||||
ADD_LIBRARY (${HDF5_LIB_TARGET} ${LIB_TYPE} ${common_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS})
|
||||
TARGET_LINK_LIBRARIES (${HDF5_LIB_TARGET} ${LINK_LIBS})
|
||||
IF (NOT WIN32)
|
||||
TARGET_LINK_LIBRARIES (${HDF5_LIB_TARGET} dl)
|
||||
ENDIF (NOT WIN32)
|
||||
SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT ${HDF5_LIB_TARGET})
|
||||
H5_SET_LIB_OPTIONS (${HDF5_LIB_TARGET} ${HDF5_LIB_NAME} ${LIB_TYPE})
|
||||
SET_TARGET_PROPERTIES (${HDF5_LIB_TARGET} PROPERTIES FOLDER libraries)
|
||||
|
@ -6,6 +6,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
|
||||
#-----------------------------------------------------------------------------
|
||||
|
74
test/plugin_lib/CMakeLists.txt
Normal file
74
test/plugin_lib/CMakeLists.txt
Normal file
@ -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)
|
Loading…
Reference in New Issue
Block a user