Commit 790a701a authored by Andreas Tille's avatar Andreas Tille
Browse files

New upstream version 1.6.3

parent 05af19a6
Loading
Loading
Loading
Loading

.gitattributes

0 → 100644
+13 −0
Original line number Diff line number Diff line
# Fix incorrect language classifications on GitHub.com
/aclocal.m4 linguist-vendored
/autom4te.cache/* linguist-language=text linguist-generated=true
/compile linguist-vendored
/config.* linguist-vendored
/configure linguist-vendored
/depcomp linguist-vendored
/install-sh linguist-vendored
/ltmain.sh linguist-vendored
/m4/* linguist-vendored
/Makefile.in linguist-vendored
/missing linguist-vendored
/test-driver linguist-vendored
+2 −1
Original line number Diff line number Diff line
.idea/
.deps/
.libs/
*.la
@@ -13,7 +14,7 @@ libtool
Makefile
stamp-*
stamp-h2

target*

# aclocal.m4
# autom4te.cache/
+105 −42
Original line number Diff line number Diff line
@@ -13,9 +13,12 @@
#   Heavily modified by Cris Luengo, July 2017
#
##############################################################################
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.5)
if(POLICY CMP0068)
   cmake_policy(SET CMP0068 NEW)
endif()

project(libics VERSION 1.6.2)
project(libics VERSION 1.6.3)

# Note: the version number above is not yet used anywhere.
# TODO: rewrite the header file with this version number.
@@ -25,26 +28,24 @@ project(libics VERSION 1.6.2)
# Compiler flags
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED on)
# TODO: This flags works for GCC and CLang, not sure about other compilers
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall")

if(CMAKE_C_COMPILER_ID MATCHES "Clang") # also matchs "AppleClang"
   set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wconversion -Wsign-conversion -pedantic")
elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU")
   set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wconversion -Wsign-conversion -Wno-unused-parameter -pedantic")
elseif(CMAKE_C_COMPILER_ID STREQUAL "Intel")
   # TODO: compiler flags for Intel compiler
elseif(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
   # TODO: compiler flags for MSVC compiler
endif()

# Debug or Release?
if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
   set(CMAKE_BUILD_TYPE Release)
endif()

# Zlib
find_package(ZLIB)
if(ZLIB_FOUND)
   set(USE_ZLIB TRUE CACHE BOOL "Use Zlib")
endif()
if(USE_ZLIB)
   include_directories(${ZLIB_INCLUDE_DIRS})
   add_definitions(-DICS_ZLIB)
endif()

# ICS
configure_file(libics_conf.h.in ${PROJECT_SOURCE_DIR}/libics_conf.h COPYONLY)
configure_file(libics_conf.h.in ${CMAKE_CURRENT_SOURCE_DIR}/libics_conf.h COPYONLY)
set(SOURCES
      libics_binary.c
      libics_compress.c
@@ -69,36 +70,82 @@ set(HEADERS
      libics_test.h
      )

include_directories(${PROJECT_SOURCE_DIR})
add_library(libics ${SOURCES} ${HEADERS})

# Build a dll
add_library(libics SHARED ${SOURCES} ${HEADERS})
target_compile_definitions(libics PRIVATE BUILD_ICSLIB) # For Windows, when compiling DLL
target_compile_definitions(libics INTERFACE USE_ICSLIB_DLL) # For Windows, when linking against DLL
if(BUILD_SHARED_LIBS)
   target_compile_definitions(libics PRIVATE BUILD_ICSLIB) # When compiling DLL/SO
   target_compile_definitions(libics INTERFACE USE_ICSLIB_DLL) # When linking against DLL/SO
endif()

target_include_directories(libics PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)

# Build a static library
add_library(libics_static STATIC ${SOURCES} ${HEADERS})
if(UNIX)
   set_target_properties(libics PROPERTIES OUTPUT_NAME "ics")
   target_link_libraries(libics PUBLIC m)
endif(UNIX)

# Link against zlib
if(USE_ZLIB)
    target_link_libraries(libics ${ZLIB_LIBRARIES})
    target_link_libraries(libics_static ${ZLIB_LIBRARIES})
find_package(ZLIB)
if(ZLIB_FOUND)
   set(LIBICS_USE_ZLIB TRUE CACHE BOOL "Use Zlib in libics")
endif()
if(LIBICS_USE_ZLIB)
   target_link_libraries(libics PUBLIC ${ZLIB_LIBRARIES})
   target_include_directories(libics PRIVATE ${ZLIB_INCLUDE_DIRS})
   target_compile_definitions(libics PUBLIC -DICS_ZLIB)
endif()

# Reentrant string tokenization
include(CheckFunctionExists)
check_function_exists(strtok_r HAVE_STRTOK_R)
if(HAVE_STRTOK_R)
   target_compile_definitions(libics PRIVATE -DHAVE_STRTOK_R)
endif()

# Install
install(TARGETS libics libics_static DESTINATION lib)
export(TARGETS libics FILE cmake/libicsTargets.cmake)

include(CMakePackageConfigHelpers)
write_basic_package_version_file(
      cmake/libicsConfigVersion.cmake
      VERSION ${PACKAGE_VERSION}
      COMPATIBILITY AnyNewerVersion)

configure_package_config_file(
      cmake/libicsConfig.cmake.in
      cmake/libicsConfig.cmake
      INSTALL_DESTINATION cmake/)

install(TARGETS libics
      EXPORT libicsTargets
      ARCHIVE DESTINATION lib
      LIBRARY DESTINATION lib
      RUNTIME DESTINATION bin
      INCLUDES DESTINATION include)

install(FILES ${HEADERS} DESTINATION include)

install(FILES
      ${CMAKE_CURRENT_BINARY_DIR}/cmake/libicsConfig.cmake
      ${CMAKE_CURRENT_BINARY_DIR}/cmake/libicsConfigVersion.cmake
      DESTINATION cmake/)

install(EXPORT libicsTargets DESTINATION cmake)


# Unit tests
enable_testing()

add_executable(test_ics1 EXCLUDE_FROM_ALL test_ics1.c)
target_link_libraries(test_ics1 libics)
add_executable(test_ics2a EXCLUDE_FROM_ALL test_ics2a.c)
target_link_libraries(test_ics2a libics)
add_executable(test_ics2b EXCLUDE_FROM_ALL test_ics2b.c)
target_link_libraries(test_ics2b libics)
if(LIBICS_USE_ZLIB)
   add_executable(test_gzip EXCLUDE_FROM_ALL test_gzip.c)
   target_link_libraries(test_gzip libics)
endif()
add_executable(test_compress EXCLUDE_FROM_ALL test_compress.c)
target_link_libraries(test_compress libics)
add_executable(test_strides EXCLUDE_FROM_ALL test_strides.c)
@@ -111,11 +158,11 @@ add_executable(test_metadata EXCLUDE_FROM_ALL test_metadata.c)
target_link_libraries(test_metadata libics)
add_executable(test_history EXCLUDE_FROM_ALL test_history.c)
target_link_libraries(test_history libics)
add_custom_target(all_tests DEPENDS

set(TEST_PROGRAMS
      test_ics1
      test_ics2a
      test_ics2b
      test_gzip
      test_compress
      test_strides
      test_strides2
@@ -123,22 +170,29 @@ add_custom_target(all_tests DEPENDS
      test_metadata
      test_history
      )
add_test(ctest_build_test_code "${CMAKE_COMMAND}" --build ${PROJECT_BINARY_DIR} --target all_tests)
add_test(NAME test_ics1 COMMAND test_ics1 ${PROJECT_SOURCE_DIR}/test/testim.ics result_v1.ics)
if(LIBICS_USE_ZLIB)
   set(TEST_PROGRAMS ${TEST_PROGRAMS} test_gzip)
endif()
add_custom_target(all_tests DEPENDS ${TEST_PROGRAMS})

add_test(ctest_build_test_code "${CMAKE_COMMAND}" --build "${PROJECT_BINARY_DIR}" --target all_tests)
add_test(NAME test_ics1 COMMAND test_ics1 "${CMAKE_CURRENT_SOURCE_DIR}/test/testim.ics" result_v1.ics)
set_tests_properties(test_ics1 PROPERTIES DEPENDS ctest_build_test_code)
add_test(NAME test_ics2a COMMAND test_ics2a ${PROJECT_SOURCE_DIR}/test/testim.ics result_v2a.ics)
add_test(NAME test_ics2a COMMAND test_ics2a "${CMAKE_CURRENT_SOURCE_DIR}/test/testim.ics" result_v2a.ics)
set_tests_properties(test_ics2a PROPERTIES DEPENDS ctest_build_test_code)
add_test(NAME test_ics2b COMMAND test_ics2b ${PROJECT_SOURCE_DIR}/test/testim.ics result_v2b.ics)
add_test(NAME test_ics2b COMMAND test_ics2b "${CMAKE_CURRENT_SOURCE_DIR}/test/testim.ics" result_v2b.ics)
set_tests_properties(test_ics2b PROPERTIES DEPENDS ctest_build_test_code)
add_test(NAME test_gzip COMMAND test_gzip ${PROJECT_SOURCE_DIR}/test/testim.ics result_v2z.ics)
if(LIBICS_USE_ZLIB)
   add_test(NAME test_gzip COMMAND test_gzip "${CMAKE_CURRENT_SOURCE_DIR}/test/testim.ics" result_v2z.ics)
   set_tests_properties(test_gzip PROPERTIES DEPENDS ctest_build_test_code)
add_test(NAME test_compress COMMAND test_compress ${PROJECT_SOURCE_DIR}/test/testim.ics ${PROJECT_SOURCE_DIR}/test/testim_c.ics)
endif()
add_test(NAME test_compress COMMAND test_compress "${CMAKE_CURRENT_SOURCE_DIR}/test/testim.ics" "${CMAKE_CURRENT_SOURCE_DIR}/test/testim_c.ics")
set_tests_properties(test_compress PROPERTIES DEPENDS ctest_build_test_code)
add_test(NAME test_strides COMMAND test_strides ${PROJECT_SOURCE_DIR}/test/testim.ics result_s.ics)
add_test(NAME test_strides COMMAND test_strides "${CMAKE_CURRENT_SOURCE_DIR}/test/testim.ics" result_s.ics)
set_tests_properties(test_strides PROPERTIES DEPENDS ctest_build_test_code)
add_test(NAME test_strides2 COMMAND test_strides2 ${PROJECT_SOURCE_DIR}/test/testim.ics result_s2.ics)
add_test(NAME test_strides2 COMMAND test_strides2 "${CMAKE_CURRENT_SOURCE_DIR}/test/testim.ics" result_s2.ics)
set_tests_properties(test_strides2 PROPERTIES DEPENDS ctest_build_test_code)
add_test(NAME test_strides3 COMMAND test_strides3 ${PROJECT_SOURCE_DIR}/test/testim.ics result_s3.ics)
add_test(NAME test_strides3 COMMAND test_strides3 "${CMAKE_CURRENT_SOURCE_DIR}/test/testim.ics" result_s3.ics)
set_tests_properties(test_strides3 PROPERTIES DEPENDS ctest_build_test_code)
add_test(NAME test_metadata1 COMMAND test_metadata result_v1.ics)
set_tests_properties(test_metadata1 PROPERTIES DEPENDS test_ics1)
@@ -146,7 +200,16 @@ add_test(NAME test_metadata2 COMMAND test_metadata result_v2a.ics)
set_tests_properties(test_metadata2 PROPERTIES DEPENDS test_ics2a)
add_test(NAME test_metadata3 COMMAND test_metadata result_v2b.ics)
set_tests_properties(test_metadata3 PROPERTIES DEPENDS test_ics2b)
if(LIBICS_USE_ZLIB)
   add_test(NAME test_metadata4 COMMAND test_metadata result_v2z.ics)
   set_tests_properties(test_metadata4 PROPERTIES DEPENDS test_gzip)
endif()
add_test(NAME test_history COMMAND test_history result_v1.ics)
set_tests_properties(test_history PROPERTIES DEPENDS test_ics1)


# Include the C++ interface?
set(LIBICS_INCLUDE_CPP TRUE CACHE BOOL "Include the C++ interface")
if(LIBICS_INCLUDE_CPP)
   include(support/cpp_interface/CMakeLists.txt)
endif()
+16 −4
Original line number Diff line number Diff line
@@ -73,17 +73,29 @@ test_strides3_LDADD = libics.la
test_metadata_LDADD = libics.la
test_history_LDADD = libics.la

TESTS = test_ics1.sh \
TESTS1 = test_ics1.sh \
        test_ics2a.sh \
        test_ics2b.sh \
        test_compress.sh \
        test_gzip.sh \
        test_strides.sh \
        test_strides2.sh \
        test_strides3.sh \
        test_metadata.sh \
        test_metadata1.sh \
        test_history.sh

if ICS_ZLIB
TESTS2 = test_gzip.sh test_metadata2.sh
else
TESTS2 =
endif

if ICS_DO_GZEXT
TESTS3 = test_compress.sh
else
TESTS3 =
endif

TESTS = $(TESTS1) $(TESTS2) $(TESTS3)

# list other files that must go into the distribution:
EXTRA_DIST = INSTALL \
             GNU_LICENSE \
+36 −23
Original line number Diff line number Diff line
@@ -106,6 +106,7 @@ check_PROGRAMS = test_ics1$(EXEEXT) test_ics2a$(EXEEXT) \
	test_strides$(EXEEXT) test_strides2$(EXEEXT) \
	test_strides3$(EXEEXT) test_metadata$(EXEEXT) \
	test_history$(EXEEXT)
TESTS = $(TESTS1) $(am__EXEEXT_1) $(am__EXEEXT_2)
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
@@ -424,6 +425,8 @@ am__set_TESTS_bases = \
  bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \
  bases=`echo $$bases`
RECHECK_LOGS = $(TEST_LOGS)
@ICS_ZLIB_TRUE@am__EXEEXT_1 = test_gzip.sh test_metadata2.sh
@ICS_DO_GZEXT_TRUE@am__EXEEXT_2 = test_compress.sh
TEST_SUITE_LOG = test-suite.log
TEST_EXTENSIONS = @EXEEXT@ .test
LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver
@@ -445,8 +448,9 @@ TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver
TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \
	$(TEST_LOG_FLAGS)
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \
	$(srcdir)/libics_conf.h.in README TODO compile config.guess \
	config.sub depcomp install-sh ltmain.sh missing test-driver
	$(srcdir)/libics_conf.h.in INSTALL README TODO compile \
	config.guess config.sub depcomp install-sh ltmain.sh missing \
	test-driver
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
@@ -631,17 +635,19 @@ test_strides2_LDADD = libics.la
test_strides3_LDADD = libics.la
test_metadata_LDADD = libics.la
test_history_LDADD = libics.la
TESTS = test_ics1.sh \
TESTS1 = test_ics1.sh \
        test_ics2a.sh \
        test_ics2b.sh \
        test_compress.sh \
        test_gzip.sh \
        test_strides.sh \
        test_strides2.sh \
        test_strides3.sh \
        test_metadata.sh \
        test_metadata1.sh \
        test_history.sh

@ICS_ZLIB_FALSE@TESTS2 = 
@ICS_ZLIB_TRUE@TESTS2 = test_gzip.sh test_metadata2.sh
@ICS_DO_GZEXT_FALSE@TESTS3 = 
@ICS_DO_GZEXT_TRUE@TESTS3 = test_compress.sh

# list other files that must go into the distribution:
EXTRA_DIST = INSTALL \
@@ -1133,20 +1139,6 @@ test_ics2b.sh.log: test_ics2b.sh
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
test_compress.sh.log: test_compress.sh
	@p='test_compress.sh'; \
	b='test_compress.sh'; \
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
test_gzip.sh.log: test_gzip.sh
	@p='test_gzip.sh'; \
	b='test_gzip.sh'; \
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
test_strides.sh.log: test_strides.sh
	@p='test_strides.sh'; \
	b='test_strides.sh'; \
@@ -1168,9 +1160,9 @@ test_strides3.sh.log: test_strides3.sh
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
test_metadata.sh.log: test_metadata.sh
	@p='test_metadata.sh'; \
	b='test_metadata.sh'; \
test_metadata1.sh.log: test_metadata1.sh
	@p='test_metadata1.sh'; \
	b='test_metadata1.sh'; \
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
@@ -1182,6 +1174,27 @@ test_history.sh.log: test_history.sh
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
test_gzip.sh.log: test_gzip.sh
	@p='test_gzip.sh'; \
	b='test_gzip.sh'; \
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
test_metadata2.sh.log: test_metadata2.sh
	@p='test_metadata2.sh'; \
	b='test_metadata2.sh'; \
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
test_compress.sh.log: test_compress.sh
	@p='test_compress.sh'; \
	b='test_compress.sh'; \
	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
.test.log:
	@p='$<'; \
	$(am__set_b); \
Loading